/* ==========================================================================
   H.U.B. (HARDWARE UNIT BAY) MODAL - Unique Styles
   ==========================================================================
   
   Unique styling for the H.U.B. modal.
   
   Tab navigation base styles (.modal-tabs, .tab-btn) are in modal.css
   
   Last Updated: 2025-01-XX
   ========================================================================== */

/* ==========================================================================
   H.U.B. MODAL CONTAINER - Cyan Theme
   ========================================================================== */

/* The H.U.B. (Hardware Unit Bay) uses cyan to match button */
.hub-modal-content {
    display: flex;
    flex-direction: column;
    min-height: 56vh;
    max-height: 80vh;
    overflow: hidden;
    background-color: rgba(3, 10, 14, 0.94);
    --modal-frame-rgb: 0 220 255;
    --modal-panel-surface: var(--modal-circuit-vein-layers), linear-gradient(135deg, rgba(5, 14, 18, 0.96), rgba(3, 10, 14, 0.94));
    background-image: var(--modal-panel-surface);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 2px solid rgba(0, 206, 230, 0.75);
    border-radius: var(--radius-lg, 6px);
    box-shadow:
        0 0 10px rgba(0, 0, 0, 0.2),
        0 0 4px rgba(0, 174, 201, 0.08) inset,
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.45);
    margin: auto;
    position: relative;
    z-index: 10;
    padding: 10px 12px;
}

/* NOTE: Scan lines effect moved to modal.css (.hub-modal-content::before) */

/* H.U.B. Modal - Header Container */
.hub-header-container {
    margin-bottom: 0;
}

/* Header container - matches How To structure */
.hub-modal-content .hub-header-container h2 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Legacy / non–HUD titles only (H.U.B. uses .modal-hud-title from modal.css) */
.hub-modal-content .hub-header-container h2:not(.modal-hud-title) {
    gap: 15px;
    margin: 0 0 5px 0;
    padding: 0 40px 0 0;
}

/* Fix units display placement - next to header text, not behind X */
.hub-modal-content .hub-header-container h2 #hubUnitsDisplay {
    margin-left: 0;
    margin-right: 0;
    order: 1;
}

/* .pause-indicator removed (consolidated in modal.css) */

/* H.U.B. modal animations */
.hub-modal-content.is-opening {
    animation: modalFadeInGrow 0.2s ease-out forwards;
}

.hub-modal-content.is-closing {
    animation: modalFadeOutShrink 0.18s ease-in forwards;
}

/* Sticky header for H.U.B. modal - cyan to match button */
/* Sticky header for H.U.B. modal - cyan to match button */
.hub-modal-content .modal-header {
    flex-shrink: 0;
    border-bottom: 1px solid #00aec9;
    padding: 6px 12px;
    margin: 0;
    z-index: 5;
    background: rgba(0, 0, 0, 0.86);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Hide scrollbar on upgrade modal */
#upgradeModal {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#upgradeModal::-webkit-scrollbar {
    display: none;
}

/* ==========================================================================
   UPGRADE CONTENT - Fade effect at bottom
   ========================================================================== */

.upgrade-grid {
    display: grid !important;
}

/* --- Outer wrapper for sectioned tabs (Towers & Buffs, System, etc.) --- */
/* Uses a unique class to avoid inheriting grid display from .upgrade-grid
   (grid layout owned by .upgrade-grid in CBDstyles.css) */
.hub-tab-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* --- TOWER UNIT GRID: inherits shared 4-col desktop grid, responsive in modal.css --- */

/* Compact card variant for cards in the shared HUB grid */
.upgrade-grid .upgrade-card.tutorial-tower {
    padding: 8px 8px 6px;
    min-height: auto;
}

.upgrade-grid .upgrade-card.tutorial-tower h4 {
    font-size: 11px;
    margin-bottom: 3px;
}

.upgrade-grid .upgrade-card.tutorial-tower p {
    font-size: 9px;
    line-height: 1.2;
    margin-bottom: 4px;
}

.upgrade-grid .hub-card-icon-container {
    height: calc(74px * 1.06);
    margin: 2px 0 6px;
}

.upgrade-grid .hub-upgrade-bar {
    min-height: 32px;
    font-size: 10px;
    padding: 0 6px;
}

/* Individual tower icon (centered, cover/contain-based) */
.hub-card-icon-container .hub-card-tower-icon {
    width: calc(60px * 1.06) !important;
    /* +6% vs prior HUB art */
    height: calc(60px * 1.06) !important;
    display: block !important;
    position: relative;
    z-index: 5 !important;
    /* Ensure it stays above the frame */
    border-radius: 50%;
    clip-path: circle(48% at 50% 50%);
    /* Slightly tighter clip to prevent edge bleeding */
    background-repeat: no-repeat;
    background-position: center;
}

/* ==========================================================================
   H.U.B. UPGRADE BAR GAUGE (replaces solid button with progress bar)
   ========================================================================== */

.hub-upgrade-bar {
    position: relative;
    overflow: hidden;
    width: 100%;
    min-height: 32px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 0, 0.3);
    border-radius: 4px;
    background: transparent !important;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: uppercase;
}

.hub-upgrade-bar .hub-upgrade-bar-track {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    pointer-events: none;
}

.hub-upgrade-bar .hub-upgrade-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    min-width: 2px;
    border-radius: 4px 0 0 4px;
    transition: width 0.25s ease-out;
    pointer-events: none;
    box-shadow: 0 0 8px currentColor;
}

.hub-upgrade-bar .hub-upgrade-bar-fill.bar-state-red {
    background: linear-gradient(90deg, rgba(90, 12, 28, 0.92), rgba(220, 35, 55, 0.96));
    box-shadow: 0 0 10px rgba(255, 80, 100, 0.55);
}

/* Closing in (wave or units) — distinct from red, less muddy than old mustard */
.hub-upgrade-bar .hub-upgrade-bar-fill.bar-state-yellow {
    background: linear-gradient(90deg, rgba(200, 140, 0, 0.88), rgba(255, 224, 60, 0.96));
    box-shadow: 0 0 10px rgba(255, 210, 80, 0.55);
}

.hub-upgrade-bar .hub-upgrade-bar-fill.bar-state-green {
    background: linear-gradient(90deg, rgba(0, 80, 40, 0.85), rgba(0, 200, 100, 0.95));
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.hub-upgrade-bar .hub-upgrade-bar-label {
    position: relative;
    z-index: 2;
    pointer-events: none;
    color: #ffdd99;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    max-width: 100%;
    min-width: 0;
    font-size: 10px;
    /* Strong dark outline for readability on red/orange fill (phones + small text) */
    text-shadow:
        0 0 3px rgba(0, 0, 0, 1),
        0 0 5px rgba(0, 0, 0, 1),
        -1px -1px 0 rgba(0, 0, 0, 1),
        -1px 1px 0 rgba(0, 0, 0, 1),
        1px -1px 0 rgba(0, 0, 0, 1),
        1px 1px 0 rgba(0, 0, 0, 1),
        0 -1px 0 rgba(0, 0, 0, 1),
        0 1px 0 rgba(0, 0, 0, 1),
        -1px 0 0 rgba(0, 0, 0, 1),
        1px 0 0 rgba(0, 0, 0, 1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   H.U.B. resource glyphs — same box on every tab (Enemy, Towers, Core, etc.)
   modals.js: injectHubBarLabelIcons (wave + units chip) + modal unit headers
   -------------------------------------------------------------------------- */
.hub-units-chip,
.hub-energy-chip,
.hub-upgrade-bar .hub-bar-inline-icon--wave {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    box-sizing: border-box;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.hub-units-chip {
    display: inline-block;
    vertical-align: middle;
    background-image: url('../assets/icons/ui/shard_crystal_chip.webp');
    filter: drop-shadow(0 0 5px #ffaa00);
    clip-path: circle(50% at 50% 50%);
}

.hub-energy-chip {
    display: inline-block;
    vertical-align: middle;
    background-image: url('../assets/icons/ui/energy_HP.webp');
    filter: drop-shadow(0 0 5px rgba(0, 221, 255, 0.78));
    clip-path: circle(50% at 50% 50%);
}

.hub-upgrade-bar .hub-units-chip {
    display: block;
    margin: 0;
}

.hub-upgrade-bar .hub-bar-inline-icon--wave {
    background-image: url('../assets/icons/hub/chart_stats_up_increase.webp');
    filter: drop-shadow(0 0 4px rgba(100, 200, 255, 0.5));
}

.hub-dual-gate-stack {
    display: grid;
    gap: 7px;
    margin-top: 4px;
}

.hub-dual-gate-bar {
    min-height: 32px;
}

.hub-dual-gate-bar--wave {
    cursor: default;
}

.hub-upgrade-bar.affordable {
    border-color: rgba(0, 255, 136, 0.5);
    color: #00ff88;
}

.hub-upgrade-bar.affordable:hover:not(:disabled) {
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.hub-upgrade-bar.disabled .hub-upgrade-bar-label,
.hub-upgrade-bar:disabled .hub-upgrade-bar-label {
    color: #ff6666;
}

.hub-upgrade-bar.affordable .hub-upgrade-bar-label {
    color: #b8ffd4;
}

/* ==========================================================================
   ENHANCED UPGRADE CARDS - .tutorial-tower variant
   ========================================================================== */

.upgrade-card.tutorial-tower {
    min-height: auto;
    justify-content: space-between;
    padding: 10px 12px;
    margin: 0;
    background-color: rgba(2, 12, 13, 0.86);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 19px, color-mix(in srgb, var(--pulse-color, #00ff88) 10%, transparent) 19px, color-mix(in srgb, var(--pulse-color, #00ff88) 10%, transparent) 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0, 221, 255, 0.055) 19px, rgba(0, 255, 136, 0.05) 20px),
        radial-gradient(ellipse at center, color-mix(in srgb, var(--pulse-color, #00ff88) 18%, transparent) 0%, rgba(0, 34, 30, 0.55) 52%, rgba(0, 10, 14, 0.88) 100%);
    /* HOLD V2: solid grid border (tower tint when --pulse-color set on card) */
    border: 1px solid color-mix(in srgb, var(--pulse-color, #00ff88) 48%, rgba(0, 255, 136, 0.28));
    border-image: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 0 18px color-mix(in srgb, var(--pulse-color, #00ff88) 8%, transparent),
        0 0 8px color-mix(in srgb, var(--pulse-color, #00ff88) 18%, transparent),
        0 2px 10px rgba(0, 0, 0, 0.36);
}

.upgrade-card.tutorial-tower:not(.hub-upgrade-unavailable):hover {
    border-color: var(--card-color, #00ff88);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 0 18px color-mix(in srgb, var(--pulse-color, #00ff88) 14%, transparent),
        0 0 20px color-mix(in srgb, var(--card-color, #00ff88) 40%, transparent),
        0 2px 12px rgba(0, 0, 0, 0.38);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 19px, color-mix(in srgb, var(--pulse-color, #00ff88) 16%, transparent) 19px, color-mix(in srgb, var(--pulse-color, #00ff88) 16%, transparent) 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0, 221, 255, 0.08) 19px, rgba(0, 255, 136, 0.075) 20px),
        radial-gradient(ellipse at center, color-mix(in srgb, var(--pulse-color, #00ff88) 30%, transparent) 0%, rgba(0, 52, 42, 0.64) 62%, rgba(0, 18, 20, 0.9) 100%);
    animation: hubCardPulse 2s infinite alternate;
}

@keyframes hubCardPulse {
    from {
        box-shadow: 0 0 15px var(--card-color, rgba(0, 255, 136, 0.3));
    }

    to {
        box-shadow: 0 0 30px var(--card-color, rgba(0, 255, 136, 0.5)), inset 0 0 20px var(--card-color, rgba(0, 255, 136, 0.25));
    }
}

/* Tactical Scanline Sweep - Moved to icon container */
.hub-card-icon-container::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -100%;
    width: 200%;
    height: 200%;
    background: linear-gradient(to bottom,
            transparent 0%,
            transparent 45%,
            rgba(255, 255, 255, 0.12) 48%,
            rgba(255, 255, 255, 0.25) 50%,
            rgba(255, 255, 255, 0.12) 52%,
            transparent 55%,
            transparent 100%);
    transform: rotate(-25deg);
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s;
    clip-path: circle(50% at 50% 50%);
    /* Match icon circle exactly */
}

.upgrade-card:not(.hub-upgrade-unavailable):hover .hub-card-icon-container::after {
    animation: hubCardScan 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 1;
}

@keyframes hubCardScan {
    0% {
        top: -100%;
        left: -100%;
    }

    100% {
        top: 100%;
        left: 100%;
    }
}

/* --- HUB ACTIVE TAB HIGHLIGHTING --- */
.hub-modal-content .tab-btn.active {
    background: linear-gradient(180deg, rgba(0, 255, 136, 0.25) 0%, rgba(0, 255, 136, 0.05) 100%) !important;
    color: #00ff88 !important;
    border: 1px solid rgba(0, 255, 136, 0.6) !important;
    border-top: 3px solid #00ff88 !important;
    /* Prominent top border */
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.15), inset 0 0 5px rgba(0, 255, 136, 0.1) !important;
    transform: translateY(-2px) !important;
    z-index: 10 !important;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.4) !important;
}

.hub-modal-content .tab-btn:hover:not(.active) {
    background: rgba(0, 255, 255, 0.08) !important;
    color: #66dddd !important;
    border-color: rgba(0, 255, 255, 0.3) !important;
}

/* HUB Card Icon Styles (SVG Fallback) */
.hub-card-icon-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 4px 0 10px 0;
    height: calc(74px * 1.06);
    width: 100%;
    position: relative;
    pointer-events: none;
    overflow: hidden;
    /* Contain the scanline sweep within the icon area */
}

.hub-card-svg {
    height: 100%;
    filter: drop-shadow(0 0 4px var(--card-color, #00ffff));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- NEW PNG SPRITE STYLES --- */
.hub-card-png-container {
    position: relative;
    height: 100%;
    width: calc(74px * 1.06);
    display: flex;
    justify-content: center;
    align-items: center;
}

.hub-card-svg-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hub-card-png-icon {
    position: relative;
    width: calc(56px * 1.06);
    height: calc(56px * 1.06);
    border-radius: 50%;
    background-repeat: no-repeat;
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Clip to circle to ensure no box corners show */
    clip-path: circle(50% at 50% 50%);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.upgrade-card:not(.hub-upgrade-unavailable):hover .hub-card-png-icon {
    transform: rotate(16deg) scale(1.05);
    /* 16-degree turn + slight pop (but stay in circle) */
    filter: drop-shadow(0 0 15px var(--card-color, #00ffff)) brightness(1.25);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.2);
}

.upgrade-card.maxed .hub-card-png-icon {
    opacity: 1;
    filter: drop-shadow(0 0 10px var(--card-color, #00ffff)) brightness(1.08) saturate(1.15);
}

.upgrade-card.hub-upgrade-unavailable .hub-card-png-icon {
    opacity: 0.34;
    filter: grayscale(1) saturate(0.55) brightness(0.42);
}

.upgrade-card:not(.hub-upgrade-unavailable):hover .hub-card-svg {
    transform: rotate(16deg);
    filter: drop-shadow(0 0 12px var(--card-color, #00ffff));
}

/* ==========================================================================
   UPGRADE CARD CONTENT - Text and Labels
   ========================================================================== */

.upgrade-card.tutorial-tower h4 {
    margin: 0 0 4px 0;
    font-size: 12px;
    font-weight: bold;
    color: #0f0;
    text-align: center;
    line-height: 1.2;
}

.upgrade-card.tutorial-tower p {
    margin: 0 0 6px 0;
    font-size: 10px;
    line-height: 1.25;
    color: #ccc;
    text-align: center;
    flex-grow: 1;
}

/* ==========================================================================
   PROGRESS BARS - Upgrade Progress and Evolution
   ========================================================================== */

.upgrade-progress-container {
    margin: 6px 0;
    flex-grow: 1;
}

.upgrade-progress-bar {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: var(--radius-sm, 3px);
    height: 6px;
    overflow: hidden;
    position: relative;
    margin-top: 3px;
    display: block;
    width: 100%;
}

.upgrade-progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-color);
}

.upgrade-progress-text {
    font-size: 9px;
    color: #ffaa00;
    opacity: 0.9;
    font-weight: bold;
    text-align: center;
    margin-bottom: 2px;
}

/* ==========================================================================
   EVOLUTION PROGRESS BARS - Color-coded (Red/Green/Blue)
   ========================================================================== */

#dmg-evolution-fill {
    background: linear-gradient(90deg, #440000, #ff0000, #ff4444);
    box-shadow: 0 0 8px #ff0000;
    transition: width 0.3s ease-out, box-shadow 0.4s ease-out, filter 0.4s ease-out;
}

#rng-evolution-fill {
    background: linear-gradient(90deg, #004400, #00ff00, #44ff44);
    box-shadow: 0 0 8px #00ff00;
    transition: width 0.3s ease-out, box-shadow 0.4s ease-out, filter 0.4s ease-out;
}

#spd-evolution-fill {
    background: linear-gradient(90deg, #000044, #0000ff, #4444ff);
    box-shadow: 0 0 8px #0000ff;
    transition: width 0.3s ease-out, box-shadow 0.4s ease-out, filter 0.4s ease-out;
}

/* ==========================================================================
   EVOLUTION PULSE ANIMATIONS - Color-specific
   ========================================================================== */

/* Evolution pulse animations moved to modal.css as shared utilities */
/* Using: dmgEvolutionPulse, rngEvolutionPulse, spdEvolutionPulse from modal.css */

#dmg-evolution-fill.recently-upgraded {
    animation: dmgEvolutionPulse 0.6s ease-in-out;
}

#rng-evolution-fill.recently-upgraded {
    animation: rngEvolutionPulse 0.6s ease-in-out;
}

#spd-evolution-fill.recently-upgraded {
    animation: spdEvolutionPulse 0.6s ease-in-out;
}

/* ==========================================================================
   UPGRADE CARD STATES
   ========================================================================== */

/* STATE 1: LOCKED (Can't Afford) — HOLD V2 diagonal stripe border, tower-tinted */
.upgrade-card.tutorial-tower.hub-upgrade-unavailable {
    opacity: 0.72;
    filter: grayscale(0.45) saturate(0.62) brightness(0.74);
    border: 2px solid transparent !important;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 19px, color-mix(in srgb, var(--pulse-color, #ff4444) 6%, transparent) 19px, color-mix(in srgb, var(--pulse-color, #ff4444) 6%, transparent) 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0, 221, 255, 0.035) 19px, rgba(0, 255, 136, 0.025) 20px),
        linear-gradient(135deg, rgba(7, 5, 8, 0.96), rgba(2, 8, 10, 0.92)),
        radial-gradient(ellipse at center, color-mix(in srgb, var(--pulse-color, #ff4444) 11%, transparent) 0%, rgba(0, 12, 14, 0.72) 62%, rgba(0, 5, 8, 0.94) 100%);
    border-image: repeating-linear-gradient(45deg,
            color-mix(in srgb, var(--pulse-color, #ff4444) 38%, transparent),
            color-mix(in srgb, var(--pulse-color, #ff4444) 18%, transparent) 10px,
            color-mix(in srgb, var(--pulse-color, #ff4444) 38%, transparent) 20px) 1 !important;
    box-shadow:
        inset 0 0 16px color-mix(in srgb, var(--pulse-color, #ff4444) 7%, transparent),
        0 0 6px color-mix(in srgb, var(--pulse-color, #ff4444) 14%, transparent),
        0 2px 8px rgba(0, 0, 0, 0.35) !important;
    cursor: not-allowed;
}

.upgrade-card.tutorial-tower.hub-upgrade-unavailable:hover {
    animation: none;
    transform: none;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 19px, color-mix(in srgb, var(--pulse-color, #ff4444) 7%, transparent) 19px, color-mix(in srgb, var(--pulse-color, #ff4444) 7%, transparent) 20px),
        repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0, 221, 255, 0.04) 19px, rgba(0, 255, 136, 0.03) 20px),
        linear-gradient(135deg, rgba(8, 5, 8, 0.97), rgba(2, 9, 10, 0.94)),
        radial-gradient(ellipse at center, color-mix(in srgb, var(--pulse-color, #ff4444) 13%, transparent) 0%, rgba(0, 12, 14, 0.74) 62%, rgba(0, 5, 8, 0.95) 100%);
    box-shadow:
        inset 0 0 16px color-mix(in srgb, var(--pulse-color, #ff4444) 8%, transparent),
        0 0 8px color-mix(in srgb, var(--pulse-color, #ff4444) 16%, transparent),
        0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

.modal-system-card.hub-upgrade-unavailable::before {
    display: none;
}

.upgrade-card.tutorial-tower.hub-upgrade-unavailable::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent 0%,
            color-mix(in srgb, var(--pulse-color, #ff4444) 10%, transparent) 42%,
            color-mix(in srgb, var(--pulse-color, #ff4444) 22%, transparent) 50%,
            color-mix(in srgb, var(--pulse-color, #ff4444) 10%, transparent) 58%,
            transparent 100%);
    animation: hubUnavailableScan 5.8s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
    opacity: 0.45;
}

.upgrade-card.tutorial-tower.hub-upgrade-unavailable > * {
    position: relative;
    z-index: 2;
}

.upgrade-card.tutorial-tower.has-main-gate {
    overflow: hidden;
}

.hub-main-gate-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 16px;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 7px, rgba(255, 102, 204, 0.055) 7px, rgba(255, 102, 204, 0.055) 8px),
        radial-gradient(circle at center, rgba(255, 64, 190, 0.19), rgba(4, 0, 10, 0.86) 62%, rgba(0, 0, 0, 0.92));
    border: 1px solid color-mix(in srgb, var(--pulse-color, #ff66cc) 54%, transparent);
    color: #ff9be4;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 10px color-mix(in srgb, var(--pulse-color, #ff66cc) 72%, transparent);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 5;
}

.upgrade-card.tutorial-tower.main-gate-offline .hub-main-gate-overlay {
    opacity: 0.92;
    transform: scale(1);
}

.hub-main-gate-primary {
    font-size: clamp(12px, 1.2vw, 15px);
    letter-spacing: 0.12em;
}

.hub-main-gate-secondary {
    max-width: 84%;
    padding: 4px 9px;
    border: 1px solid rgba(0, 255, 255, 0.28);
    background: rgba(0, 10, 14, 0.66);
    color: #7cf7ff;
    font-size: 10px;
    letter-spacing: 0.08em;
    white-space: normal;
}

@keyframes hubUnavailableScan {
    0%, 100% {
        transform: translateX(-110%);
        opacity: 0;
    }

    50% {
        transform: translateX(110%);
        opacity: 0.45;
    }
}

/* STATE 5: CAN AFFORD (any non-locked upgrade) — HOLD V2 stripe */
.upgrade-card.tutorial-tower.can-afford {
    border: 2px solid transparent;
    border-image: repeating-linear-gradient(45deg,
            color-mix(in srgb, var(--pulse-color, #00ff88) 50%, transparent),
            color-mix(in srgb, var(--pulse-color, #00ff88) 28%, transparent) 10px,
            color-mix(in srgb, var(--pulse-color, #00ff88) 50%, transparent) 20px) 1;
    box-shadow:
        0 0 6px color-mix(in srgb, var(--pulse-color, #00ff88) 28%, transparent),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

/* NOT AFFORDABLE + NOT MAXED + NOT LOCKED — HOLD V2 stripe without graying unlocked art */
/* STATE 6: MAXED – complete vibe, no bar / MAXED button */
.upgrade-card.tutorial-tower.maxed {
    opacity: 1;
    border: 2px solid color-mix(in srgb, var(--pulse-color, #00ff88) 48%, rgba(0, 255, 136, 0.45));
    border-image: none;
    box-shadow:
        0 0 12px color-mix(in srgb, var(--pulse-color, #00ff88) 22%, transparent),
        inset 0 0 20px color-mix(in srgb, var(--pulse-color, #00ff88) 8%, transparent),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Single "Complete" strip – reuses panel border/glow, no bar */
.hub-upgrade-complete {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-xl, 8px);
    background: linear-gradient(135deg, rgba(0, 40, 28, 0.85), rgba(0, 28, 20, 0.9));
    border: 1px solid rgba(0, 255, 136, 0.5);
    box-shadow:
        0 0 10px rgba(0, 255, 136, 0.15),
        inset 0 1px 0 rgba(0, 255, 136, 0.2);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.hub-upgrade-complete-icon {
    font-size: 16px;
    color: #00ff88;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.8);
    filter: drop-shadow(0 0 4px rgba(0, 255, 136, 0.5));
}

.hub-upgrade-complete-text {
    text-transform: uppercase;
}

/* ==========================================================================
   MOBILE RESPONSIVE - H.U.B. Specific
   ========================================================================== */

@media (max-width: 640px) {
    .hub-modal-content {
        padding: 12px;
    }

    .hub-modal-content .hub-header-container h2:not(.modal-hud-title) {
        font-size: clamp(26px, 4vw, 20px);
        gap: 10px;
    }

    .hub-modal-content .hub-header-container h2 #hubUnitsDisplay,
    .hub-modal-content .hub-header-container h2 #hubEnergyDisplay {
        font-size: clamp(10px, 2.5vw, 11px) !important;
        padding: 3px 6px !important;
    }

    /* Upgrade bar contrast on small screens: larger label, solid tap target */
    .hub-upgrade-bar {
        min-height: 32px;
        font-size: 11px;
    }

    .hub-upgrade-bar .hub-upgrade-bar-label {
        font-size: 11px;
        font-weight: 700;
    }

    .hub-units-chip,
    .hub-energy-chip,
    .hub-upgrade-bar .hub-bar-inline-icon--wave {
        width: 19px;
        height: 19px;
    }
}

/* --- ACHIEVEMENT CARDS --- */
.achievement-grid {
    margin-bottom: 4px;
}

.achievement-card {
    --card-shine-rgb: var(--tier-rgb, 0, 255, 136);
    --card-shine-alpha: 0.035;
    --card-shine-duration: 0.78s;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 10px 8px;
    align-items: center;
    text-align: center;
}

.achievement-card:hover {
    border-color: var(--tier-color, rgba(0, 255, 136, 0.35));
    box-shadow: 0 0 16px rgba(var(--tier-rgb, 0, 255, 136), 0.18);
}

.achievement-card.done {
    --card-shine-alpha: 0.055;
    border-color: var(--tier-color, rgba(0, 255, 136, 0.4));
    box-shadow: 0 0 10px rgba(var(--tier-rgb, 0, 255, 136), 0.15);
}

.achievement-card .ach-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.achievement-card .ach-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px var(--tier-color, #00ff88));
}

.achievement-card .ach-icon.no-icon {
    width: 14px;
    height: 14px;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    border-radius: 0;
    border: none;
    background: var(--tier-color, #888);
    box-shadow: 0 0 8px var(--tier-color, #888);
    align-self: center;
    margin-bottom: 8px;
}

.achievement-card .ach-name {
    font-size: 11px;
    font-weight: bold;
    color: #ccc;
    margin-bottom: 3px;
    line-height: 1.2;
}

.achievement-card.done .ach-name {
    color: #fff;
}

.achievement-card .ach-desc {
    font-size: 10px;
    color: #555;
    margin-bottom: 6px;
    line-height: 1.3;
    flex: 1;
}

.achievement-card .ach-bar-wrap {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 2px;
    margin-bottom: 5px;
}

.achievement-card .ach-bar {
    height: 3px;
    border-radius: 2px;
    background: var(--tier-color, #888);
    transition: width 0.3s;
}

.achievement-card .ach-reward {
    font-size: 9px;
    color: #ffaa00;
    letter-spacing: 0.3px;
}

.achievement-card .ach-check {
    position: absolute;
    top: 5px;
    right: 7px;
    color: #00ff88;
    font-size: 13px;
    text-shadow: 0 0 6px #00ff88;
}

.achievement-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
    margin: 14px 0 8px;
}
