        /* --- GLOBAL RESET --- */
        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
            background-color: #000;
            background-image:
                radial-gradient(1.5px 1.5px at 20px 30px, #fff, rgba(0, 0, 0, 0)),
                radial-gradient(1.5px 1.5px at 40px 70px, #ffffff, rgba(0, 0, 0, 0)),
                radial-gradient(1.5px 1.5px at 50px 160px, #fff, rgba(0, 0, 0, 0)),
                radial-gradient(1.5px 1.5px at 90px 40px, #fff, rgba(0, 0, 0, 0)),
                radial-gradient(1.5px 1.5px at 130px 80px, #fff, rgba(0, 0, 0, 0)),
                radial-gradient(1.5px 1.5px at 160px 120px, #fff, rgba(0, 0, 0, 0));
            background-size: 200px 200px, 350px 350px, 250px 250px, 150px 150px, 300px 300px, 400px 400px;
            background-repeat: repeat;
            font-family: 'Courier New', monospace;
            overflow: hidden;
            color: #00D4FF;
        }

        /* --- 3D CANVAS --- */
        #deck-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            z-index: 1;
        }



        /* --- SIDEBARS --- */
        .sidebar {
            position: fixed;
            top: 0;
            bottom: 0;
            height: 100%;
            width: 420px;
            background: rgba(3, 5, 8, 0.95);
            border-right: 1px solid #112233;
            z-index: 1000;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            /* Allow footer to stick to bottom */
            /* padding: 70px 20px 20px 20px; OLD: Ticker space */
            padding: 20px;
            /* NEW: Full height */
            box-sizing: border-box;
            /* backdrop-filter removed: re-blurring two full-height panels every WebGL frame cost GPU time; background is 95% opaque anyway */
            box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
        }

        .resize-handle {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 10px;
            cursor: col-resize;
            z-index: 1001;
            transition: background 0.2s;
        }

        .resize-handle:hover,
        .resize-handle.active {
            background: rgba(0, 212, 255, 0.3);
        }

        #handle-left {
            right: 0;
            cursor: col-resize;
        }

        #handle-right {
            left: 0;
            cursor: col-resize;
        }

        #sidebar-left {
            left: 0;
            border-right: 1px solid #112233;
            border-left: none;
        }

        #sidebar-right {
            right: 0;
            border-left: 1px solid #112233;
            border-right: none;
        }

        /* --- UI PANELS --- */
        .panel {
            margin-bottom: 25px;
            width: 100%;
            flex-shrink: 0;
        }

        /* Ensure log panel can scroll */
        .panel[style*="flex-grow"] {
            overflow: hidden;
            min-height: 0;
        }

        .panel-header {
            font-size: 13px;
            font-weight: 900;
            color: #fff;
            border-bottom: 2px solid #00D4FF;
            padding-bottom: 6px;
            margin-bottom: 12px;
            letter-spacing: 1px;
            display: flex;
            justify-content: space-between;
        }

        .hud-title {
            font-size: 24px;
            font-weight: 900;
            color: #fff;
            margin-bottom: 25px;
            border-bottom: 1px solid #333;
            padding-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 12px;
            text-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
        }

        #hud-logo {
            width: 36px;
            height: 36px;
            display: none;
            border: 1px solid #00D4FF;
        }

        .row {
            display: flex;
            justify-content: space-between !important;
            width: 100%;
            margin-bottom: 8px;
        }

        .header {
            display: flex;
            align-items: center;
            font-size: 16px;
            font-weight: bold;
            border-left: 4px solid #00D4FF;
            padding-left: 10px;
            margin-bottom: 15px;
            background: rgba(0, 212, 255, 0.1);
            padding: 10px;
        }

        #log-feed {
            flex-grow: 1;
            overflow-y: auto;
            min-height: 0;
            /* Crucial for flex child scroll */
            padding-right: 5px;
            margin-bottom: 10px;
            /* No max-height - fills available space */
        }

        /* Custom Scrollbar */
        #log-feed::-webkit-scrollbar {
            width: 5px;
        }

        #log-feed::-webkit-scrollbar-thumb {
            background: #00D4FF;
            border-radius: 2px;
        }

        #log-feed::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.3);
        }

        /* Gemini Response Scrollbar (match log-feed) */
        #gemini-response::-webkit-scrollbar {
            width: 5px;
        }

        #gemini-response::-webkit-scrollbar-thumb {
            background: #00D4FF;
            border-radius: 2px;
        }

        #gemini-response::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.3);
        }

        .stat-row {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 14px;
            color: #8899AA;
            border-bottom: 1px solid #112233;
            padding-bottom: 4px;
        }

        .val {
            font-weight: bold;
            color: #fff;
            font-size: 15px;
        }

        /* LOGS */
        #neural-container {
            flex-grow: 1;
            overflow-y: auto;
            min-height: 100px;
            background: rgba(0, 0, 0, 0.4);
            padding: 10px;
            border: 1px solid #112233;
            margin-bottom: 20px;
            font-size: 12px;
        }

        .log-line {
            margin-bottom: 10px;
            line-height: 1.4;
            color: #00D4FF;
            white-space: pre-wrap;
        }

        /* Query Chip Buttons */
        .query-chip {
            background: rgba(0, 212, 255, 0.15);
            border: 1px solid #00D4FF;
            color: #00D4FF;
            padding: 12px 6px;
            font-family: 'Share Tech Mono', monospace;
            font-size: 11px;
            line-height: 1.2;
            text-align: center;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }

        .query-chip:hover {
            background: rgba(0, 212, 255, 0.4);
            color: #fff;
        }

        /* BARS & BUTTONS */
        #options-container {
            display: none;
            margin-bottom: 20px;
        }

        .bar-bg {
            flex-grow: 1;
            height: 6px;
            background: #112233;
            margin: 0 10px;
        }

        .bar-fill {
            height: 100%;
            background: #00D4FF;
            width: 0%;
            transition: width 1s;
        }

        .option-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 11px;
            margin-bottom: 6px;
        }

        button {
            width: 100%;
            padding: 15px;
            border: 1px solid #00D4FF;
            background: rgba(0, 212, 255, 0.1);
            color: #00D4FF;
            font-family: inherit;
            font-weight: bold;
            cursor: pointer;
            text-transform: uppercase;
            transition: all 0.2s;
            margin-top: 5px;
        }

        button:hover:not(:disabled) {
            background: #00D4FF;
            color: #000;
            box-shadow: 0 0 20px #00D4FF;
        }

        button:disabled {
            border-color: #333;
            color: #555;
            cursor: not-allowed;
        }

        .modal-cmd {
            background: #00D4FF;
            color: #000;
            border: 2px solid #fff;
            margin-bottom: 15px;
            display: none;
        }

        .modal-cmd:hover {
            background: #fff;
            color: #000;
            box-shadow: 0 0 20px #fff;
        }

        /* IMAGES & CHARTS */
        #sat-viewport {
            width: 100%;
            height: 250px;
            /* Fixed height to prevent layout shifts */
            min-height: 250px;
            /* Ensure box is always this big */
            background: #000;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            overflow: hidden;
            border: 1px solid #333;
        }

        #sat-image {
            width: 100%;
            height: auto;
            display: block;
            object-fit: contain;
            /* Ensures no layout shift */
            cursor: zoom-in;
        }

        .mag-icon {
            position: absolute;
            bottom: 10px;
            right: 10px;
            width: 24px;
            height: 24px;
            opacity: 0.7;
            pointer-events: none;
            filter: drop-shadow(0 0 2px #000);
            z-index: 10;
        }

        #sat-zoom-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.6);
            /* Backdrop dim */
            z-index: 20000;
            display: none;
            align-items: center;
            justify-content: center;
            cursor: zoom-out;
        }

        #sat-zoom-img {
            max-width: 90vw;
            max-height: 90vh;
            width: auto;
            height: auto;
            object-fit: contain;
            border: 1px solid #00D4FF;
            box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
            display: block;
        }

        #sat-overlay-text {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            /* Full width bar */
            font-family: 'Share Tech Mono', monospace;
            font-size: 12px;
            color: #fff;
            background: rgba(0, 20, 30, 0.9);
            padding: 8px;
            border-top: 1px solid #0ff;
            display: none;
            line-height: 1.4;
        }

        #sat-loading {
            color: #FF3333;
            font-weight: bold;
            text-align: center;
            display: block;
        }

        .bottom-panel {
            margin-top: auto;
        }

        canvas {
            width: 100%;
            height: 140px;
            background: rgba(0, 0, 0, 0.5);
            border: 1px solid #333;
        }

        /* TICKER */
        #ticker-bar {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 50px;
            background: rgba(255, 0, 0, 0.85);
            display: none;
            z-index: 500;
            /* Was 2000. Now below sidebars (1000) */
            overflow: hidden;
            white-space: nowrap;
            box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
            border-bottom: 1px solid #fff;
        }

        .ticker-text {
            color: white;
            font-weight: 900;
            font-size: 20px;
            letter-spacing: 3px;
            line-height: 50px;
            padding-left: 20px;
            animation: scroll 45s linear infinite;
        }

        @keyframes scroll {
            from {
                transform: translateX(100vw);
            }

            to {
                transform: translateX(-100%);
            }
        }

        .blink {
            animation: blinker 1s linear infinite;
        }

        @keyframes blinker {
            50% {
                opacity: 0.5;
            }
        }

        @keyframes pulseglow {

            0%,
            100% {
                opacity: 1;
                transform: scale(1);
            }

            50% {
                opacity: 0.7;
                transform: scale(1.02);
            }
        }

        /* Pause/Reset button container */
        #sim-controls-split {
            display: flex;
        }

        #sim-controls-split button {
            padding: 12px 20px;
            font-family: 'Share Tech Mono', monospace;
            font-size: 12px;
            font-weight: bold;
            cursor: pointer;
            border: 1px solid #00D4FF;
            transition: all 0.3s ease;
        }

        .subtle-pulse {
            animation: pulseglow 2s infinite ease-in-out;
            box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
            border-color: #ffffff !important;
            color: #ffffff !important;
        }

        #pause-btn {
            background: #FFB800 !important;
            color: #000 !important;
            border-color: #FFB800 !important;
        }

        #pause-btn:hover {
            background: #FFC933 !important;
        }

        /* Disclaimer Modal */
        #disclaimer-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #disclaimer-box {
            background: rgba(5, 15, 25, 0.98);
            border: 2px solid #00D4FF;
            max-width: 600px;
            padding: 30px 40px;
            box-shadow: 0 0 60px rgba(0, 212, 255, 0.3);
        }

        #disclaimer-box h1 {
            color: #00D4FF;
            font-size: 24px;
            margin: 0 0 20px 0;
            letter-spacing: 2px;
        }

        #disclaimer-box h2 {
            color: #FFB800;
            font-size: 14px;
            margin: 20px 0 10px 0;
            letter-spacing: 1px;
        }

        #disclaimer-box p {
            color: #aaa;
            font-size: 13px;
            line-height: 1.6;
            margin: 0 0 10px 0;
        }

        #disclaimer-box ul {
            color: #00D4FF;
            font-size: 12px;
            margin: 0 0 15px 0;
            padding-left: 20px;
        }

        #disclaimer-box li {
            margin-bottom: 6px;
        }

        #disclaimer-box .warning {
            background: rgba(255, 0, 0, 0.15);
            border: 1px solid #FF4444;
            padding: 12px 15px;
            margin: 20px 0;
            color: #FF6666;
            font-size: 12px;
            text-align: center;
        }

        #agree-btn {
            width: 100%;
            padding: 15px;
            background: #00D4FF;
            color: #000;
            border: none;
            font-family: 'Share Tech Mono', monospace;
            font-size: 14px;
            font-weight: bold;
            letter-spacing: 2px;
            cursor: pointer;
            margin-top: 10px;
        }

        #agree-btn:hover {
            background: #33DDFF;
        }

        /* --- LOADING OVERLAY --- */
        #loader {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: #000;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            transition: opacity 0.8s ease-out;
        }

        .loader-text {
            color: #00D4FF;
            font-size: 24px;
            letter-spacing: 4px;
            text-transform: uppercase;
            animation: pulse-loader 1.5s infinite;
        }

        @keyframes pulse-loader {
            0% {
                opacity: 0.3;
            }

            50% {
                opacity: 1;
            }

            100% {
                opacity: 0.3;
            }
        }

        /* --- TOUR OVERLAY --- */
        @keyframes pulse-text {
            0% {
                opacity: 0.4;
            }

            50% {
                opacity: 1;
            }

            100% {
                opacity: 0.4;
            }
        }

        .pulsing {
            animation: pulse-text 1.5s infinite ease-in-out;
            cursor: wait !important;
        }

        #tour-overlay {
            position: absolute;
            /* Change from fixed for dynamic positioning */
            width: 460px;
            /* Wider width for tooltips */
            background: rgba(10, 20, 30, 0.95);
            border: 1px solid #00D4FF;
            color: #fff;
            padding: 24px;
            z-index: 3000;
            font-family: 'Share Tech Mono', monospace;
            display: none;
            box-shadow: 0 0 40px rgba(0, 212, 255, 0.2);
            backdrop-filter: blur(10px);
            transition: top 0.5s, left 0.5s, transform 0.5s;
        }

        /* Force Bottom Dock for Step 7 */
        #tour-overlay.bottom-dock {
            position: fixed !important;
            top: auto !important;
            bottom: 50px !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
        }

        /* --- TOUR ARROWS --- */
        #tour-overlay::after {
            content: '';
            position: absolute;
            width: 0;
            height: 0;
            border: 10px solid transparent;
            display: none;
            /* Shown via JS class */
        }

        #tour-overlay.has-target::after {
            display: block;
        }

        /* ARROW TOP (Points Up) - Default */
        #tour-overlay.arrow-top::after {
            border-bottom-color: #00D4FF;
            top: -20px;
            left: 50%;
            transform: translateX(-50%);
        }

        /* ARROW RIGHT (Points Right) */
        #tour-overlay.arrow-right::after {
            border-left-color: #00D4FF;
            top: var(--arrow-top, 50%);
            right: -20px;
            /* Pointing Right */
            left: auto;
            border-color: transparent transparent transparent #00D4FF;
            transform: translateY(-50%);
        }

        /* ARROW BOTTOM (Points Down) - For tooltips ABOVE target */
        #tour-overlay.arrow-bottom::after {
            border-top-color: #00D4FF;
            bottom: -20px;
            top: auto;
            left: 50%;
            transform: translateX(-50%);
        }

        /* OVERRIDE: Step 2 Arrow Alignment */
        #tour-overlay.step-retrieve::after {
            top: 120px;
            /* Force arrow lower to point at element despite tooltip offset */
        }

        /* Centered Mode class */
        #tour-overlay.centered {
            position: fixed;
            top: 50% !important;
            left: 50% !important;
            transform: translate(-50%, -50%) !important;
            width: 600px;
            border: 2px solid #00D4FF;
        }

        #tour-title {
            color: #00D4FF;
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        #tour-text {
            font-size: 16px;
            line-height: 1.6;
            color: #CCDDFF;
            margin-bottom: 15px;
        }

        #tour-controls {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .tour-btn {
            background: rgba(0, 212, 255, 0.1);
            border: 1px solid #00D4FF;
            color: #00D4FF;
            padding: 12px 24px;
            font-size: 14px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.2s;
        }

        .tour-btn:disabled {
            opacity: 0.3;
            cursor: not-allowed;
            border-color: #555;
            color: #555;
        }

        /* --- MING TOGGLE (Footer) --- */
        .ming-toggle {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 11px;
            color: #557788;
            margin-top: 8px;
            cursor: pointer;
            position: relative;
            /* For tooltip positioning */
        }

        .ming-toggle input {
            appearance: none;
            width: 14px;
            height: 14px;
            border: 1px solid #557788;
            box-shadow: 0 0 5px rgba(85, 119, 136, 0.2);
            position: relative;
            cursor: pointer;
        }

        .ming-toggle input:checked {
            background: #00D4FF;
            border-color: #00D4FF;
            box-shadow: 0 0 10px #00D4FF;
        }

        .ming-toggle:hover {
            color: #00D4FF;
        }

        /* Help Icon (?) */
        .ming-help {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 12px;
            height: 12px;
            border: 1px solid #557788;
            border-radius: 50%;
            font-size: 9px;
            margin-left: 2px;
            color: #557788;
            cursor: help;
        }

        .ming-toggle:hover .ming-help {
            border-color: #00D4FF;
            color: #00D4FF;
        }

        /* Tooltip */
        .ming-tooltip {
            visibility: hidden;
            width: 200px;
            background-color: rgba(10, 20, 30, 0.95);
            color: #fff;
            text-align: left;
            border: 1px solid #00D4FF;
            padding: 10px;
            position: absolute;
            z-index: 10000;
            bottom: 140%;
            /* Above the toggle */
            left: 50%;
            transform: translateX(-50%);
            font-size: 11px;
            line-height: 1.4;
            box-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
            opacity: 0;
            transition: opacity 0.2s;
            pointer-events: none;
        }

        .ming-tooltip::after {
            content: "";
            position: absolute;
            top: 100%;
            left: 50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: #00D4FF transparent transparent transparent;
        }

        /* Show tooltip on hovering the help icon specifically? Or the whole label? User said "next to... shows on hover". */
        /* Let's trigger on hovering the (?) icon for precision, or the label. 
           User: "shows on hover a message" (implied hovering the icon likely) */
        .ming-help:hover .ming-tooltip {
            visibility: visible;
            opacity: 1;
        }

        .sidebar-footer {
            padding: 20px;
            border-top: 1px solid #224466;
            font-size: 10px;
            color: #557788;
            letter-spacing: 1px;
            /* Center Alignment */
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .footer-title {
            font-size: 12px;
            /* Larger */
            font-weight: bold;
            letter-spacing: 2px;
            margin-bottom: 4px;
        }

        .tour-btn:hover:not(:disabled) {
            background: #00D4FF;
            color: #000;
        }

        /* Highlight effect for tour targets */
        .tour-highlight {
            box-shadow: 0 0 30px #FF00FF !important;
            border-color: #FF00FF !important;
            z-index: 3001 !important;
            position: relative;
        }

        /* SCENARIO SELECTOR & PROFILE BADGE */
        .scenario-bar {
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin-bottom: 8px;
            flex-shrink: 0;
        }
        .scenario-label {
            font-size: 10px;
            color: #00D4FF;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        #scenario-select {
            width: 100%;
            background: rgba(0, 18, 36, 0.92);
            color: #00FFCC;
            border: 1px solid #00D4FF;
            padding: 7px 10px;
            font-family: 'Share Tech Mono', monospace;
            font-size: 12px;
            letter-spacing: 1px;
            text-transform: uppercase;
            outline: none;
            cursor: pointer;
            box-shadow: inset 0 0 8px rgba(0, 212, 255, 0.2);
            transition: border-color 0.2s, box-shadow 0.2s;
        }
        #scenario-select:hover, #scenario-select:focus {
            border-color: #00FFCC;
            box-shadow: 0 0 10px rgba(0, 255, 204, 0.35);
        }
        #scenario-select option {
            background: #020c18;
            color: #00FFCC;
            padding: 6px;
        }
        .profile-badge {
            font-size: 10px;
            padding: 1px 6px;
            border: 1px solid #00D4FF;
            color: #00D4FF;
            background: rgba(0, 212, 255, 0.12);
            letter-spacing: 1px;
        }


/* ============================================================
   Added in the performance/robustness audit pass
   ============================================================ */

/* Telemetry link health badge (toggled by app.js after 3 consecutive poll failures) */
#link-status {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2500;
    padding: 6px 14px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    color: #000;
    background: #FFB800;
    border: 1px solid #fff;
    box-shadow: 0 0 18px rgba(255, 184, 0, 0.6);
    display: none;
}
#link-status.visible {
    display: block;
    animation: blinker 1s linear infinite;
}

/* Intercept window warning on the flight telemetry ETA */
#fp-eta.warn {
    color: #FF4444 !important;
    font-weight: bold;
    animation: blinker 0.8s linear infinite;
}

/* Keep the HiDPI chart crisp and sized by its container (ResizeObserver reads this box) */
#profileCanvas {
    display: block;
    width: 100%;
    height: 140px;
}

/* Responsive sidebars: keep the globe usable on laptops and large tablets */
@media (max-width: 1440px) {
    .sidebar { width: 360px; }
}
@media (max-width: 1200px) {
    .sidebar { width: 320px; padding: 14px; }
    .val { font-size: 13px; }
    .ticker-text { font-size: 16px; }
}
@media (max-width: 960px) {
    .sidebar { width: 280px; padding: 10px; }
    #tour-overlay { width: 360px; }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .blink, .subtle-pulse, #link-status.visible, #fp-eta.warn, .pulsing { animation: none !important; }
    .ticker-text { animation-duration: 120s; }
    * { transition-duration: 0.01ms !important; }
}
