@keyframes console-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
    animation: console-shake 0.5s linear;
}

    body { background: #050505; color: #00ff41; font-family: 'Courier New', monospace; margin: 0; overflow: hidden; }
        
        .wrapper { 
            display: grid; 
            grid-template-columns: 1fr 1fr; 
            height: 100vh; 
            gap: 10px; 
            padding: 20px 20px 40px 20px; /* Added 40px bottom padding to clear the footer */
            box-sizing: border-box; 
            overflow: hidden; 
        }

        /* Ensure the left panel stays organized */
        .panel { 
            border: 2px solid #00ff41; 
            padding: 20px 20px 10px 20px; /* Reduced bottom padding */
            display: flex; 
            flex-direction: column; 
            /* Change from 0.05 to 0.15 for better visibility, or use a solid dark green */
            background: rgba(0, 20, 0, 0.95); 
            height: calc(100vh - 80px); /* Account for footer height + margin */
            box-sizing: border-box;
            position: relative;
            overflow: hidden;
            box-shadow: inset 0 0 15px rgba(0, 255, 65, 0.1);
        }

        @keyframes aiPulse {
            0% { transform: scale(1); opacity: 1; }
            50% { transform: scale(1.05); opacity: 0.9; }
            100% { transform: scale(1); opacity: 1; }
        }

        @keyframes aiWave {
            0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.5; }
            50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.2; }
            100% { transform: translate(-50%, -50%) scale(1.4); opacity: 0; }
        }

        @keyframes aiGlow {
            0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.4), inset 0 0 15px rgba(0, 255, 65, 0.2); }
            50% { box-shadow: 0 0 40px rgba(0, 255, 65, 0.7), inset 0 0 25px rgba(0, 255, 65, 0.4); }
        }

        @keyframes aiBlueGlow {
            0%, 100% { box-shadow: 0 0 20px rgba(0, 150, 255, 0.4), inset 0 0 15px rgba(0, 150, 255, 0.2); border-color: rgba(0, 150, 255, 0.5); }
            50% { box-shadow: 0 0 40px rgba(0, 150, 255, 0.7), inset 0 0 25px rgba(0, 150, 255, 0.4); border-color: rgba(0, 150, 255, 1); }
        }

        .ai-blue-glow {
            animation: aiBlueGlow 1.5s ease-in-out infinite !important;
            background: radial-gradient(circle, #001122 20%, #004488 60%, #00aaff 100%) !important;
        }

        @keyframes aiRedGlow {
            0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.4), inset 0 0 15px rgba(255, 0, 0, 0.2); border-color: rgba(255, 0, 0, 0.5); }
            50% { box-shadow: 0 0 40px rgba(255, 0, 0, 0.7), inset 0 0 25px rgba(255, 0, 0, 0.4); border-color: rgba(255, 0, 0, 1); }
        }

        .ai-red-glow {
            animation: aiRedGlow 1s ease-in-out infinite !important;
            background: radial-gradient(circle, #110000 20%, #440000 60%, #ff0000 100%) !important;
        }

        @keyframes aiVibrate {
            0% { transform: translate(0, 0); }
            10% { transform: translate(-2px, -2px); }
            20% { transform: translate(2px, -1px); }
            30% { transform: translate(-3px, 1px); }
            40% { transform: translate(3px, 2px); }
            50% { transform: translate(-2px, -2px); }
            60% { transform: translate(2px, 1px); }
            70% { transform: translate(-3px, -1px); }
            80% { transform: translate(3px, 2px); }
            90% { transform: translate(-2px, -1px); }
            100% { transform: translate(0, 0); }
        }

        @keyframes aiSwirl {
            0% { transform: rotate(0deg) scale(1); }
            50% { transform: rotate(180deg) scale(1.2); }
            100% { transform: rotate(360deg) scale(1); }
        }

        @keyframes hazard-pulse {
            0% { box-shadow: 0 0 5px #ff9900; background-color: #ff9900; }
            50% { box-shadow: 0 0 15px #ff4400, 0 0 5px #ff9900; background-color: #ff4400; }
            100% { box-shadow: 0 0 5px #ff9900; background-color: #ff9900; }
        }

        .hazard-blip {
            animation: hazard-pulse 1s infinite alternate ease-in-out;
            border-radius: 2px !important; /* Slightly more square for danger */
            z-index: 20 !important;
        }

        .ai-vibrating {
            animation: aiVibrate 0.3s linear !important;
        }

        .ai-core-inner {
            position: absolute;
            width: 80%;
            height: 80%;
            background: radial-gradient(circle, rgba(0,255,255,0.8) 0%, rgba(0,100,255,0.4) 50%, transparent 70%);
            border-radius: 50%;
            filter: blur(2px);
            animation: aiSwirl 4s linear infinite;
        }

        .ai-core-swirl {
            position: absolute;
            width: 100%;
            height: 100%;
            border: 2px solid transparent;
            border-top: 2px solid rgba(255,255,255,0.6);
            border-bottom: 2px solid rgba(0,255,255,0.4);
            border-radius: 50%;
            animation: aiSwirl 2s linear infinite;
        }

        /* Comms panel overlay */

        #comms-panel-overlay h3 {
            color: #00ffff;
            font-size: 0.9rem;
            margin-top: 0;
            border-bottom: 1px solid #00ffff22;
            padding-bottom: 5px;
        }
        #comms-panel-overlay .comms-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 30px;
        }

        /* Constrain the buttons */
        #comms-panel-overlay button {
            width: auto;
            min-width: 150px;
            max-width: 250px;
            padding: 8px 15px;
            background: rgba(0, 255, 255, 0.1);
            border: 1px solid #00ffff;
            color: #00ffff;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            text-transform: uppercase;
            transition: all 0.2s;
        }

        #comms-panel-overlay button:hover {
            background: rgba(0, 255, 255, 0.3);
            box-shadow: 0 0 10px #00ffff88;
        }

        /* Keep the close button red but small */
        #comms-panel-overlay .close-btn {
            background: #aa0000 !important;
            border: none !important;
            color: white !important;
            min-width: 80px !important;
        }
        
        /* Ensure the status area stays pinned at the bottom */
        .status-area {
            flex-shrink: 0; 
            border-top: 1px solid #00ff4144;
            padding-top: 10px;
            margin-bottom: 0; /* Remove any margin that might push the panel edge */
        }

        #footer-build-info {
            position: fixed;
            bottom: 0; 
            left: 0;
            width: 100%;
            font-size: 0.65rem;
            color: #00ff4166;    
            text-transform: uppercase;
            pointer-events: auto; /* ENABLE CLICKING FOR REBOOT/LOGOUT */
            letter-spacing: 1px;
            z-index: 9999; 
            background: rgba(0, 10, 5, 0.9); 
            padding: 8px 15px;
            border-top: 1px solid #00ff4133;
            display: none; /* Controlled by JS */
            justify-content: space-between;
            align-items: center;
            box-sizing: border-box;
        }

        h2 { 
            color: #00ff41; 
            border-bottom: 1px solid #00ff41; 
            padding-bottom: 5px; 
            margin-top: 0; 
            text-transform: uppercase;
            letter-spacing: 2px;
        }

        /*Ship Design */

        /* The Container for the Ship */
        #ship-wireframe { 
            position: relative; 
            width: 320px;       /* Fixed width for horizontal spread - increased for cargo block */
            height: 120px;      /* Reduced height */
            margin: 10px auto;  
            border: 1px dashed #00ff4133; 
            display: flex; 
            flex-direction: row; /* Horizontal */
            align-items: center; 
            justify-content: center; 
        }

        /* Ship Component Styling */
        .ship-part {
            border: 1px solid #00ff41;
            height: 60px;
            margin: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            text-align: center;
            background: rgba(0, 255, 65, 0.1);
            box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
            box-sizing: border-box;
        }

        .engine-module { 
            width: 40px; 
            border-left: none; 
            clip-path: polygon(100% 0%, 100% 100%, 0% 80%, 0% 20%); /* Flare out left */
        }
        
        .cargo-module {
            width: 50px;
            background: rgba(0, 255, 65, 0.05); /* Same as others, slightly dark */
            transition: all 0.3s;
        }

        .cargo-module:hover {
            background: rgba(0, 255, 65, 0.2);
            box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
            cursor: pointer;
        }

        .service-module { 
            width: 120px; 
            display: grid;
            grid-template-columns: 1fr 1fr;
            grid-template-rows: 1fr 1fr;
            gap: 2px;
            padding: 2px;
        }

        .sub-room {
            border: 1px solid #00ff41;
            background: rgba(0, 255, 65, 0.05);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 8px; /* Small font to fit the 4 slots */
            color: #00ff41;
            transition: all 0.2s;
        }

        .sub-room:hover {
            background: rgba(0, 255, 255, 0.1);
            box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
        }

        .engine-module:hover {
            background: rgba(255, 170, 0, 0.2);
            box-shadow: 0 0 15px rgba(255, 170, 0, 0.4);
            cursor: pointer;
        }

        .command-module { 
            width: 40px; 
            clip-path: polygon(0% 0%, 80% 0%, 100% 50%, 80% 100%, 0% 100%); /* Point right */
        }

        /* The railgun mounted top horizontal */
        .railgun-mount {
            width: 60px;
            height: 14px;
            position: absolute;
            left: calc(50% - 30px);
            top: calc(50% - 40px);
            z-index: 5;
            transition: width 0.3s, background 0.1s, box-shadow 0.1s;
            display: flex;
            align-items: center;
            background: transparent;
        }

        /* The magnetic rails */
        .railgun-mount::before {
            content: '';
            position: absolute;
            left: 0;
            top: 2px;
            width: 100%;
            height: 10px;
            border-top: 3px solid #00ff41;
            border-bottom: 3px solid #00ff41;
            box-sizing: border-box;
            box-shadow: inset 0 0 5px rgba(0,255,65,0.5), 0 0 5px rgba(0,255,65,0.5);
            background: rgba(0,255,65,0.1);
            transition: inherit;
        }

        /* The base block */
        .railgun-mount::after {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            width: 15px;
            height: 14px;
            background: #00ff41;
            box-shadow: 0 0 10px #00ff41;
            border-radius: 2px 0 0 2px;
        }

        /* The container for the 4 missiles mounted bottom horizontal */
        .missile-rack {
            position: absolute;
            left: 50%;
            bottom: calc(50% - 38px); /* Just below the service bay bottom border */
            transform: translateX(-50%);
            display: flex;
            flex-direction: row; /* horizontal lineup */
            gap: 4px; 
            z-index: 5;
        }

        /* Point Defense Cannons (PDC) mounts */
        .pdc-mount {
            position: absolute;
            width: 24px;
            height: 16px;
            color: #00ff41;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease-in-out;
            z-index: 6;
        }
        .pdc-mount:hover {
            color: #00ffff;
            filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.8));
        }
        .pdc-mount svg circle, .pdc-mount svg line {
            stroke: currentColor;
            fill: none;
            transition: all 0.2s ease-in-out;
        }
        .pdc-mount svg circle {
            fill: currentColor;
            fill-opacity: 0.2;
        }
        #pdc-1-indicator {
            left: calc(50% - 65px);
            top: calc(50% - 41px);
        }
        #pdc-2-indicator {
            left: calc(50% - 65px);
            bottom: calc(50% - 41px);
        }

        /* The individual missile visual cue */
        .ordnance-unit {
            width: 12px;
            height: 6px;
            background: #00ffff; 
            box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
            border-radius: 1px;
            transition: opacity 0.3s ease;
        }

        /* Class to hide them when fired */
        .depleted {
            opacity: 0;
        }

        .vector-readout {
            font-size: 0.75rem;
            color: #00ff41;
            background: rgba(0, 50, 0, 0.3);
            padding: 5px 10px;
            border: 1px solid #00ff4144;
            margin-top: 5px;
            display: inline-block;
            letter-spacing: 1px;
        }
        .vector-readout span {
            color: #ffffff; /* Make the numbers pop */
        }

        #passive-scan-btn {
            background: #050505;
            color: #00ff4188; /* Dimmer green when off */
            border: 1px solid #00ff4144;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            transition: all 0.3s ease;
        }

        #passive-scan-btn:hover {
            background: #00ff4122;
            color: #00ff41;
        }
        
        /* Left Side */
        #ship-wireframe { flex-grow: 1; border: 1px dashed #00ff4133; margin: 10px 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; text-align: center; }
        
        

        /* Flexible grid that preserves both modules */
        .grid-controls { 
            display: grid; 
            grid-template-columns: 1fr 1fr; 
            /* Scanner takes auto height, bottom row splits the rest 50/50 */
            grid-template-rows: auto 1fr; 
            gap: 15px;
            height: 100%;
            overflow: hidden; /* Prevents the whole suite from scrolling */
        }

        /* Updated module behavior */
        .module {
            border: 1px solid #00ff4188;
            padding: 10px;
            display: flex;
            flex-direction: column;
            /* Prevents content from stretching vertically */
            justify-content: flex-start;
            background: rgba(0, 10, 0, 0.5);
            min-height: 0; /* Critical for grid stability */
        }

        /* Guides the player's eye to the app iframe (e.g. "go check in with
           the JDSV" story beats). Added/removed via JS, not tied to a fixed
           duration — cleared once the objective it's pointing at is done. */
        @keyframes iframe-attention-pulse {
            0%, 100% { box-shadow: 0 0 8px rgba(255,170,0,0.4), inset 0 0 8px rgba(255,170,0,0.12); border-color: #ffaa00; }
            50%      { box-shadow: 0 0 26px rgba(255,170,0,0.9), inset 0 0 20px rgba(255,170,0,0.28); border-color: #ffe066; }
        }

        #iframe-grid-container.iframe-attention-highlight {
            border: 2px solid #ffaa00;
            animation: iframe-attention-pulse 1.3s ease-in-out infinite;
        }

        /* Same idea, scoped to the expand-view button itself — points at the
           specific control rather than the whole frame. Cleared as soon as
           the button is clicked, independent of the iframe highlight above. */
        @keyframes expand-btn-attention-pulse {
            0%, 100% { box-shadow: 0 0 6px rgba(255,170,0,0.5); border-color: #ffaa00; }
            50%      { box-shadow: 0 0 16px 3px rgba(255,170,0,0.95); border-color: #ffe066; }
        }

        #frame-expand-btn.expand-btn-attention-highlight {
            border: 1px solid #ffaa00 !important;
            animation: expand-btn-attention-pulse 1.1s ease-in-out infinite;
        }

        /* Same pulse, reused for the COMMS command button — "click on COMMS
           then change the channel" story beat. Cleared when the panel opens. */
        #comms-btn.comms-btn-attention-highlight {
            border: 1px solid #ffaa00 !important;
            animation: expand-btn-attention-pulse 1.1s ease-in-out infinite;
        }

        /* Same pulse, reused for the CIRCUIT command button — "reset the PDC
           circuits" story beat. Cleared when the panel opens. */
        #circuit-btn.circuit-btn-attention-highlight {
            border: 1px solid #ffaa00 !important;
            animation: expand-btn-attention-pulse 1.1s ease-in-out infinite;
        }

        /* Same pulse, reused for the destination [ SET ] button — "set that as
           our next destination" story beat. Cleared when the picker opens. */
        #set-destination-btn.set-destination-attention-highlight {
            border: 1px solid #ffaa00 !important;
            animation: expand-btn-attention-pulse 1.1s ease-in-out infinite;
        }

        /* Same pulse, reused for the [ MAINFRAME VIEW ] button — "click UPDATE
           AI FIRMWARE on the Mainframe Panel" story beat. Cleared when the
           mainframe panel opens. */
        #mainframe-view-btn.mainframe-view-attention-highlight {
            border: 1px solid #ffaa00 !important;
            animation: expand-btn-attention-pulse 1.1s ease-in-out infinite;
        }

        /* Ensure buttons stay compact */
        .module button {
            width: 100%;
            padding: 6px;
            margin: 2px 0;
            font-size: 0.75rem;
            flex-shrink: 0; /* Prevents buttons from squishing */
        }

        /* Global Button Reset for Command Modules */
        .module button, .scanner-controls button {
            background: #050505;
            color: #00ff41;
            border: 1px solid #00ff4144;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            text-transform: uppercase;
            transition: all 0.2s ease;
            padding: 8px;
            font-size: 0.75rem;
        }

        .module button:hover, .scanner-controls button:hover {
            background: #00ff4122;
            color: #00ff41;
            border-color: #00ff41;
            box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
        }

        .module button:disabled {
            background: #050505;
            color: #444;
            border-color: #222;
            cursor: not-allowed;
        }

/* Maintain special colors for specific weapons */
#laser-btn { color: #aa0000; border-color: #aa000044; }
#missile-btn { color: #00ffff; border-color: #00ffff44; }
        
        
        #suit-light { 
            width: 100%; height: 40px; background: #221100; border: 2px solid #553300; 
            color: #553300; display: flex; align-items: center; justify-content: center; font-weight: bold; cursor: pointer;
        }

        #suit-light.active { background: #ffaa00; color: #000; box-shadow: 0 0 20px #ffaa00; animation: blink 1s infinite; }
        
        #terminal { 
            height: 180px; /* Locked height for roughly 10 lines of text */
            background: rgba(0, 17, 0, 0.8); 
            border: 1px solid #00ff41; 
            padding: 10px; 
            font-size: 0.8rem; 
            overflow-y: scroll; /* Forces the scrollbar to always stay visible for a "tech" look */
            color: #00ff41;
            margin-bottom: 10px;
            flex-shrink: 0; /* Prevents other elements from squishing the terminal */
        }

        /*ATC stuff */
        .atc-contact {
            border-left: 2px solid #00ffff;
            background: rgba(0, 255, 255, 0.05);
            padding: 8px;
            margin-bottom: 8px;
            font-family: 'Courier New', monospace;
            font-size: 0.75rem; /* Smaller font for the side panel */
        }

        .contact-id {
            color: #00ffff;
            font-weight: bold;
            margin-bottom: 3px;
        }

        .atc-divider {
            border: 0;
            border-top: 1px dashed rgba(0, 255, 255, 0.2);
            margin: 5px 0;
        }

        .contact-info {
            font-size: 0.75rem;
            color: rgba(0, 255, 255, 0.8);
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        
        /*Scanner Stuff */

        /* Unify Scanner Buttons */
        .scanner-controls button {
            background: #050505;
            color: #00ff41;
            border: 1px solid #00ff4144;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            transition: all 0.3s ease;
            text-transform: uppercase;
        }

        .scanner-controls button:hover {
            background: #00ff4122;
            box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
        }
        /* The circular radar frame */
        /* The circular radar frame - Expanded for the new layout */
        /* Update the Scanner to include range rings */
        .scanner-circle {
            width: 320px; /* Slightly smaller to ensure fit */
            height: 320px;
            border: 2px solid #00ff4144;
            border-radius: 50%;
            margin: 10px auto;
            position: relative;
            /* Concentric rings added via repeating-radial-gradient */
            background: 
                repeating-radial-gradient(
                    circle,
                    transparent,
                    transparent 49px,
                    rgba(0, 255, 65, 0.1) 50px
                ),
                radial-gradient(circle, #00ff4111 0%, transparent 70%);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 0 20px #00ff4122;
        }

        /* The red box that appears on lock */
        #contact-blip.locked {
            border-radius: 2px; /* Makes it slightly squared */
            outline: 2px solid #ff0000;
            outline-offset: 4px;
            animation: box-flicker 0.2s infinite alternate;
        }

        #systems-deck button:hover {
            background: rgba(0, 255, 255, 0.3);
            box-shadow: 0 0 10px #00ffff88;
        }

        @keyframes box-flicker {
            from { opacity: 1; outline-offset: 4px; }
            to { opacity: 0.8; outline-offset: 6px; }
        }

        /* Styling for the text next to the blip */
        .blip-distance {
            position: absolute;
            left: 15px; /* Offset to the right of the blip */
            top: -5px;
            font-size: 9px;
            white-space: nowrap;
            color: #ff0000;
            text-shadow: 1px 1px 2px black;
            pointer-events: none; /* Prevents text from blocking clicks */
            font-weight: bold;
        }

        .dynamic-contact {
            position: absolute;
            width: 6px;
            height: 6px;
            background: #00ffff; /* Friendly/Neutral Cyan */
            border-radius: 50%;
            transform: translate(-50%, -50%);
            z-index: 5;
        }

        .dynamic-blip {
            position: absolute;
            width: 4px;
            height: 4px;
            padding: 10px; /* Expands the clickable radius drastically */
            background-color: #00ffff;
            background-clip: content-box;
            border-radius: 50%;
            transform: translate(-50%, -50%);
            box-shadow: 0 0 5px #00ffff;
            z-index: 15; /* Top priority for clicks */
            cursor: crosshair;
        }

        .blip-label {
            position: absolute;
            top: 5px;
            left: 5px;
            font-size: 8px;
            color: #00ffff;
            white-space: nowrap;
            text-shadow: 1px 1px 2px #000;
            pointer-events: none; /* This ensures the click goes "through" the text to the blip */
        }

        .ghost-blip {
            background: #ffaa00; /* Warning Orange for ghosts */
            box-shadow: 0 0 10px #ffaa00;
        }

        .blip-label {
            position: absolute;
            top: 10px;
            left: 10px;
            font-size: 0.6rem;
            white-space: nowrap;
            pointer-events: none;
            color: #00ff41;
        }

        .lead-indicator {
            position: absolute;
            width: 8px;
            height: 8px;
            border: 1px dashed #00ffff88; /* Dimmer cyan dashed circle */
            border-radius: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            z-index: 4;
        }

        /* Optional: A small 'X' inside the lead circle */
        .lead-indicator::after {
            content: '+';
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            font-size: 10px;
            color: #00ffff44;
        }

        /* The sweeping radar line */
        .scanner-line {
            width: 50%;
            height: 2px;
            background: linear-gradient(to right, transparent, #00ff41);
            position: absolute;
            top: 50%;
            left: 50%;
            transform-origin: left;
            animation: sweep 4s linear infinite; /* Rotates every 4 seconds */
            z-index: 2;
            pointer-events: none; /* Never steal clicks */
        }

        /* The red blip for detected enemies */
        #contact-blip {
            display: none; /* Hidden until startScan() finds something */
            position: absolute;
            width: 8px;
            height: 8px;
            background: #ff0000;
            border-radius: 50%;
            box-shadow: 0 0 15px #ff0000, 0 0 5px white;
            z-index: 10;
        }

       /* Animation for the sweep */
        @keyframes sweep {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        @keyframes blink { 50% { opacity: 0.5; } }


        /* Startup Checklist Items */

    /* Startup Checklist Modal */
    #startup-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: #000;
        z-index: 3000;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }

    .checklist-box {
        border: 2px solid #00ff41;
        background: rgba(0, 20, 0, 0.9);
        padding: 30px;
        width: 400px;
        box-shadow: 0 0 20px #00ff4144;
    }

    .checklist-item {
        margin: 15px 0;
        display: flex;
        align-items: center;
        gap: 15px;
        font-size: 1rem;
    }

    .checklist-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
        cursor: pointer;
        accent-color: #00ff41;
    }

    .init-btn {
        width: 100%;
        margin-top: 20px;
        padding: 10px;
        background: #00ff41;
        color: #000;
        border: none;
        font-family: 'Courier New', bold;
        cursor: pointer;
        font-weight: bold;
    }

    .init-btn:disabled {
        background: #004400;
        color: #00ff4188;
        cursor: not-allowed;
    }      

    /* Specifically target the checklist text */
    .checklist-item label {
        color: #00ff41; /* Solid CRT Green */
        text-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
        cursor: pointer;
        opacity: 1 !important; /* Overrides any inherited dimming */
    }

    /* Make it glow when you hover over the item */
    .checklist-item:hover label {
        color: #ffffff;
        text-shadow: 0 0 10px #00ff41;
    }

    /* Diagnostics & Master Alarm */
    #master-alarm-banner {
        position: fixed;
        top: 0; left: 0; width: 100%;
        background: #ff0000;
        color: #fff;
        text-align: center;
        font-size: 1.5rem;
        font-weight: bold;
        letter-spacing: 5px;
        padding: 5px 0;
        z-index: 9999;
        display: none;
        animation: master-flash 0.5s infinite alternate;
        border-bottom: 3px solid #ffaa00;
        box-shadow: 0 0 30px #ff0000;
    }

    @keyframes master-flash {
        from { background: #aa0000; opacity: 1; }
        to { background: #ff0000; opacity: 0.8; }
    }

    .diag-log {
        height: 120px;
        overflow-y: auto;
        background: rgba(0,20,0,0.4);
        border: 1px inset #00ff4144;
        padding: 5px;
        font-size: 0.65rem;
        font-family: 'Courier New', monospace;
        margin-bottom: 10px;
    }

    .diag-tier-1 { color: #ff0000; font-weight: bold; text-shadow: 0 0 5px #ff0000; margin-bottom: 2px; }
    .diag-tier-2 { color: #ffaa00; margin-bottom: 2px; }
    .diag-tier-3 { color: #00ffff; margin-bottom: 2px; }

    .diag-btn {
        width: 100%; 
        margin-top: 5px; 
        font-size: 0.65rem;
        background: rgba(0, 20, 20, 0.8);
        border: 1px solid rgba(0, 255, 255, 0.3);
        color: #00ffff;
        font-family: 'Courier New', monospace;
        padding: 6px;
        cursor: pointer;
        text-transform: uppercase;
        transition: all 0.2s ease;
        box-shadow: inset 0 0 5px rgba(0, 255, 255, 0.1);
    }
    .diag-btn:active {
        color: #000;
    }

    .diag-btn-l3 { color: #00ffff; border-color: #00ffff44; }
    .diag-btn-l3:hover { background: rgba(0, 255, 255, 0.15); border-color: #00ffff; box-shadow: 0 0 8px rgba(0, 255, 255, 0.3); }

    .diag-btn-l2 { color: #ffaa00; border-color: #ffaa0044; }
    .diag-btn-l2:hover { background: rgba(255, 170, 0, 0.15); border-color: #ffaa00; box-shadow: 0 0 8px rgba(255, 170, 0, 0.3); }

    .diag-btn-l1 { color: #ff0000; border-color: #ff000044; background: rgba(50,0,0,0.5); }
    .diag-btn-l1:hover { background: rgba(255, 0, 0, 0.25); border-color: #ff0000; box-shadow: 0 0 8px rgba(255, 0, 0, 0.5); }

    .diag-btn-drill { color: #ff00ff; border-color: #ff00ff44; margin-top: 15px; }
    .diag-btn-drill:hover { background: rgba(255, 0, 255, 0.15); border-color: #ff00ff; box-shadow: 0 0 8px rgba(255, 0, 255, 0.3); }
    .checklist-item input[type="checkbox"] {
        border: 1px solid #00ff41;
        background: transparent;
    }

    /* End of Startup Checklist Items */

    #footer-build-info {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(0, 10, 0, 0.95);
        border-top: 1px solid #00ff4144;
        color: #00ff4188;
        padding: 6px 20px;
        font-family: 'Courier New', monospace;
        font-size: 0.65rem;
        display: none; /* Shown after login */
        justify-content: space-between;
        align-items: center;
        z-index: 8000;
        box-sizing: border-box;
    }

    .alarm-square {
        display: none;
        padding: 4px 8px;
        color: #fff;
        font-size: 0.6rem;
        font-weight: bold;
        font-family: 'Courier New', monospace;
        z-index: 10;
        white-space: nowrap;
        margin: 2px;
        flex: 0 0 auto;
        width: fit-content;
        min-width: 60px;
        text-align: center;
        box-sizing: border-box;
    }

    .alarm-red {
        background: rgba(255, 0, 0, 0.9);
        border: 1px solid #ff0000;
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
    }

    .alarm-yellow {
        background: rgba(255, 170, 0, 0.9);
        border: 1px solid #ffaa00;
        box-shadow: 0 0 15px rgba(255, 170, 0, 0.8);
        color: #000; /* Contrast for yellow */
    }

    .alarm-orange {
        background: rgba(255, 100, 0, 0.9);
        border: 1px solid #ff6400;
        box-shadow: 0 0 15px rgba(255, 100, 0, 0.8);
        color: #fff;
    }

    .alarm-master-active {
        background: #ff0000 !important;
        border: 1px solid #ff0000;
        box-shadow: 0 0 20px #ff0000;
        animation: blink 0.5s infinite;
        display: block !important;
    }

    .alarm-master-acknowledged {
        background: #880000 !important;
        border: 1px solid #ff0000;
        box-shadow: 0 0 5px #ff0000;
        animation: none !important;
        display: block !important;
    }

    #alarm-container {
        position: absolute;
        top: 5px;
        left: 335px; /* Shifted slightly left to give more room */
        display: flex;
        flex-direction: column; /* Stack vertically to create columns via wrapping */
        flex-wrap: wrap;
        gap: 2px;
        align-items: flex-start;
        align-content: flex-start; /* Ensure columns stay together */
        justify-content: flex-start;
        max-width: 450px; /* Increased width to accommodate more columns if needed */
        max-height: 110px; /* Height limit triggers the wrap to a new column */
        overflow: visible; /* Remove the slider, let it overflow horizontally if truly excessive */
        padding: 2px;
    }

    #logout-confirmation-overlay,
    #private-records-confirmation-overlay,
    #abandon-story-confirmation-overlay,
    #idle-warning-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.85);
        z-index: 9000;
        display: none;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }

    .confirm-modal {
        background: rgba(10, 20, 10, 0.95);
        border: 2px solid #00ff41;
        padding: 40px;
        width: 450px;
        text-align: center;
        box-shadow: 0 0 30px rgba(0, 255, 65, 0.2);
    }

    .confirm-btn {
        background: transparent;
        border: 1px solid #00ff41;
        color: #00ff41;
        padding: 10px 30px;
        cursor: pointer;
        font-family: 'Courier New', monospace;
        letter-spacing: 2px;
        transition: all 0.2s;
        margin: 0 10px;
        font-size: 0.9rem;
    }

    .confirm-btn:hover {
        background: #00ff41;
        color: #000;
        box-shadow: 0 0 15px #00ff41;
    }

    .confirm-btn-no {
        border-color: #ff4444;
        color: #ff4444;
    }

    .confirm-btn-no:hover {
        background: #ff4444;
        color: #000;
        box-shadow: 0 0 15px #ff4444;
    }

    /* Game Settings dialog tab nav */
    .settings-tab-btn {
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        color: #00ff4177;
        font-family: 'Courier New', monospace;
        font-size: 0.7rem;
        letter-spacing: 1.5px;
        padding: 8px 14px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .settings-tab-btn:hover {
        color: #00ff41cc;
    }

    .settings-tab-btn.active {
        color: #00ff41;
        border-bottom-color: #00ff41;
    }

    .settings-tab-btn-danger {
        color: #ff444477;
    }

    .settings-tab-btn-danger:hover {
        color: #ff4444cc;
    }

    .settings-tab-btn-danger.active {
        color: #ff4444;
        border-bottom-color: #ff4444;
    }

    #shutdown-sequence-overlay {
        position: fixed;
        inset: 0;
        background: #000;
        z-index: 9999;
        display: none;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        font-family: 'Courier New', monospace;
        color: #00ff41;
    }

    #shutdown-text {
        width: 80%;
        max-width: 600px;
        font-size: 1.1rem;
        line-height: 1.6;
    }

    /* Circuit Breaker Styles */
    #circuit-breaker-panel {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 140px;
        background: #111;
        border: 2px solid #555;
        padding: 10px;
        box-shadow: inset 0 0 10px #000;
        z-index: 30;
    }

    .breaker-label {
        color: #ffff0088;
        font-size: 0.5rem;
        font-family: monospace;
        margin-bottom: 2px;
        display: block;
    }

    .breaker-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        border-bottom: 1px solid #222;
        padding-bottom: 4px;
    }

    .breaker-switch {
        width: 34px;
        height: 18px;
        background: #222;
        border: 1px solid #444;
        position: relative;
        cursor: pointer;
        transition: all 0.2s;
    }

    .breaker-switch::after {
        content: "";
        position: absolute;
        top: 2px;
        width: 14px;
        height: 12px;
        background: #666;
        transition: all 0.2s;
        box-shadow: 0 0 5px #000;
    }

    /* ENGAGED STATE (LEFT/UP) */
    .breaker-on {
        background: #004400;
        border-color: #00ff4144;
    }
    .breaker-on::after {
        left: 2px;
        background: #00ff41;
        box-shadow: 0 0 5px #00ff41;
    }

    /* POPPED STATE (RIGHT/DOWN) */
    .breaker-off {
        background: #221111;
        border-color: #ff000044;
    }
    .breaker-off::after {
        right: 2px;
        background: #555;
    }

    .breaker-indicator {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #222;
        margin-left: 5px;
    }

    .indicator-on {
        background: #00ff41;
        box-shadow: 0 0 5px #00ff41;
    }

    .breaker-row-new {
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 0, 0.05);
        border: 1px solid #ffff0011;
        padding: 8px 12px;
        transition: all 0.3s;
    }
    .breaker-row-new:hover {
        background: rgba(255, 255, 0, 0.1);
        border-color: #ffff0044;
    }
    .breaker-info {
        display: flex;
        flex-direction: column;
    }
    .breaker-id {
        font-size: 0.55rem;
        color: #ffff0088;
        font-weight: bold;
    }
    .breaker-label-new {
        font-size: 0.75rem;
        color: #ffff00;
        letter-spacing: 1px;
    }
    .switch-group {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    .breaker-switch-new {
        width: 40px;
        height: 20px;
        background: #111;
        border: 1px solid #444;
        position: relative;
        cursor: pointer;
        transition: all 0.2s;
        box-shadow: inset 0 0 5px #000;
    }
    .breaker-switch-new::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 22px; /* OFF state on the RIGHT */
        width: 16px;
        height: 14px;
        background: #333;
        transition: all 0.2s;
        border: 1px solid #555;
    }
    .breaker-switch-new.breaker-on::after {
        left: 2px; /* ON state on the LEFT */
        background: #00ff41;
        border-color: #00ff41;
        box-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    }
    .breaker-indicator-new {
        width: 10px;
        height: 10px;
        background: #222;
        border-radius: 50%;
        border: 1px solid #333;
        transition: all 0.3s;
    }
    .breaker-indicator-new.indicator-on {
        background: #00ff41;
        box-shadow: 0 0 12px #00ff41, 0 0 20px rgba(0, 255, 65, 0.4);
        border-color: #ffffff;
    }

    /* EPS BUS STYLING */
    .eps-bus-column {
        display: flex;
        flex-direction: column;
        gap: 10px;
        background: rgba(0, 20, 40, 0.3);
        border: 1px solid rgba(0, 255, 255, 0.1);
        padding: 15px;
        position: relative;
    }
    
    .eps-bus-header {
        font-size: 0.8rem;
        color: #ffff00;
        letter-spacing: 2px;
        text-align: center;
        margin-bottom: 15px;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(255, 255, 0, 0.3);
        font-weight: bold;
    }

    .eps-power-line {
        position: absolute;
        top: 60px;
        left: 25px;
        bottom: 40px;
        width: 2px;
        background: rgba(255, 255, 0, 0.2);
        z-index: 1;
    }

    .eps-power-line.powered {
        background: rgba(0, 255, 65, 0.6);
        box-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
    }

    .eps-chip-unit {
        position: relative;
        z-index: 2;
        margin-left: 10px;
        background: linear-gradient(180deg, #1a1d20 0%, #0d0e10 100%);
        border: 1px solid #3a3f45;
        border-radius: 3px;
        padding: 8px 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: all 0.3s;
        box-shadow: 0 4px 10px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.1);
        min-height: 50px;
    }

    .eps-chip-unit.powered {
        border-color: #00ff4144;
        box-shadow: 0 4px 15px rgba(0,255,65,0.1), inset 0 1px 1px rgba(255,255,255,0.05);
    }

    .eps-chip-unit.fuse-failed, .eps-chip-unit.cu-failed {
        border-color: #ff4444aa !important;
        background: linear-gradient(180deg, #2a1d20 0%, #1a0e10 100%) !important;
        box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3) !important;
    }

    .eps-chip-unit::before {
        content: '';
        position: absolute;
        left: -10px;
        top: 50%;
        width: 10px;
        height: 2px;
        background: rgba(255, 255, 0, 0.2);
    }

    .eps-chip-unit.powered::before {
        background: rgba(0, 255, 65, 0.6);
    }

    /* Original Toggle Styles for Load Center */
    .eps-breaker-item {
        position: relative;
        z-index: 2;
        margin-left: 20px;
        background: rgba(0,0,0,0.6);
        border: 1px solid rgba(255,255,0,0.15);
        padding: 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: all 0.2s;
        min-height: 40px;
    }

    .eps-breaker-item.powered {
        border-color: rgba(0, 255, 65, 0.5);
        box-shadow: inset 0 0 10px rgba(0, 255, 65, 0.1);
    }

    /* Chip Socket Design */
    /* Chip Module Design for E-BUS */
    .eps-chip-module {
        width: 60px;
        height: 38px;
        background: #050505;
        border: 2px solid #222;
        border-radius: 2px;
        position: relative;
        box-shadow: inset 0 2px 10px rgba(0,0,0,1);
        overflow: hidden;
        transition: all 0.3s;
    }

    .eps-chip-module::after {
        content: '';
        position: absolute;
        top: 4px;
        left: 4px;
        right: 4px;
        bottom: 4px;
        background: #111;
        border: 1px solid #333;
        border-radius: 1px;
        opacity: 1;
        transition: all 0.3s;
    }

    .eps-chip-module.active::after {
        background: linear-gradient(135deg, #444 0%, #222 100%);
        border-color: #00ff4188;
        box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
        background-image: 
            linear-gradient(90deg, transparent 50%, rgba(255,255,255,0.05) 50%),
            linear-gradient(transparent 50%, rgba(255,255,255,0.05) 50%);
        background-size: 4px 4px;
    }

    .eps-chip-module::before {
        content: '';
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 8px;
        background: #222;
        border-radius: 1px;
        z-index: 10;
        transition: all 0.3s;
    }

    .eps-chip-module.active::before {
        background: #00ff41;
        box-shadow: 0 0 10px #00ff41;
    }

    /* Original Toggle Switches for Load Center */
    .eps-switch {
        width: 36px;
        height: 18px;
        background: #050505;
        border: 1px solid #444;
        border-radius: 2px;
        position: relative;
        box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
        cursor: pointer;
        transition: border-color 0.2s;
    }

    .eps-switch::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 14px;
        height: 12px;
        background: #333;
        border: 1px solid #555;
        border-radius: 1px;
        transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }

    .eps-switch.active {
        border-color: #00ff4188;
    }

    .eps-switch.active::after {
        left: 18px;
        background: #00ff41;
        border-color: #00ff41;
        box-shadow: 0 0 10px rgba(0, 255, 65, 0.4);
    }

    .eps-status-text {
        font-size: 0.5rem;
        font-weight: bold;
        letter-spacing: 1px;
        margin-top: 2px;
        transition: all 0.3s;
    }

    .eps-breaker-item.powered .eps-status-text {
        color: #00ff41;
        text-shadow: 0 0 5px #00ff4144;
    }

    .eps-breaker-item:not(.powered) .eps-status-text {
        color: #666;
    }

    /* Master Switch Variant */
    .eps-master-row .eps-switch {
        width: 44px;
        height: 22px;
        border-color: #ffff0044;
    }

    .eps-master-row .eps-switch::after {
        width: 18px;
        height: 16px;
    }

    .eps-master-row .eps-switch.active::after {
        left: 22px;
        background: linear-gradient(180deg, #aaaa00 0%, #666600 100%);
        border-color: #ffff00;
        box-shadow: 0 0 10px rgba(255, 255, 0, 0.3);
    }

    .eps-status-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #333;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
        transition: all 0.3s ease;
    }

    .eps-status-dot.active {
        background: #00ff41;
        box-shadow: 0 0 8px #00ff41;
    }

    .eps-status-dot.inactive {
        background: #ff4444;
        box-shadow: 0 0 8px #ff4444;
    }

    .eps-master-row {
        margin-bottom: 20px;
        border-bottom: 1px dashed rgba(255,255,0,0.2);
        padding-bottom: 15px;
    }
    .spare-breaker-unit {
        width: 14px;
        height: 24px;
        background: #333;
        border: 2px solid #555;
        border-radius: 2px;
        position: relative;
        box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    }
    .spare-breaker-unit::after {
        content: '';
        position: absolute;
        top: 4px;
        left: 3px;
        width: 8px;
        height: 8px;
        background: #222;
        border: 1px solid #444;
    }

    /* Tactical Expansion Overlay */
    .iframe-expand-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 5, 0, 0.95);
        z-index: 5000;
        justify-content: center;
        align-items: center;
        backdrop-filter: blur(5px);
    }

    .iframe-expand-container {
        width: 90vw;
        height: 90vh;
        border: 2px solid #00ff41;
        background: #000;
        position: relative;
        box-shadow: 0 0 50px rgba(0, 255, 65, 0.3);
        display: flex;
        flex-direction: column;
    }

    .expand-header {
        height: 40px;
        background: rgba(0, 255, 65, 0.1);
        border-bottom: 1px solid #00ff4144;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
        color: #00ff41;
        font-size: 0.8rem;
        font-weight: bold;
        letter-spacing: 2px;
    }

    .expand-body {
        flex-grow: 1;
        position: relative;
    }

    .expand-body iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

    /* Premium Login UI */
    #player-select-overlay {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: radial-gradient(circle at center, #0a192f 0%, #020817 100%) !important;
        overflow: hidden;
        font-family: 'Outfit', sans-serif;
    }

    #player-select-overlay::before {
        content: "";
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(0, 255, 255, 0.03) 0%, transparent 50%);
        animation: nebula-drift 60s linear infinite;
        pointer-events: none;
    }

    @keyframes nebula-drift {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    #player-select-overlay::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, 
            transparent 0%, 
            rgba(0, 255, 65, 0.03) 50%, 
            transparent 100%);
        background-size: 100% 4px;
        animation: scanline 10s linear infinite;
        pointer-events: none;
        opacity: 0.5;
    }

    @keyframes scanline {
        0% { transform: translateY(-100%); }
        100% { transform: translateY(100%); }
    }

    #login-gate {
        backdrop-filter: blur(10px);
        background: rgba(15, 25, 45, 0.7) !important;
        border: 1px solid rgba(255, 170, 0, 0.3) !important;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 170, 0, 0.05);
        border-radius: 4px;
        position: relative;
        z-index: 10;
    }

    .gate-btn {
        width: 100%;
        background: rgba(255, 170, 0, 0.05);
        border: 1px solid rgba(255, 170, 0, 0.2);
        color: rgba(255, 170, 0, 0.8);
        padding: 16px;
        cursor: pointer;
        font-family: 'Outfit', sans-serif;
        text-align: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        letter-spacing: 2px;
        font-size: 0.8rem;
        display: block;
        box-sizing: border-box;
        text-transform: uppercase;
        position: relative;
        overflow: hidden;
    }
    
    .gate-btn::after {
        content: "";
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 170, 0, 0.1), transparent);
        transition: 0.5s;
    }

    .gate-btn:hover {
        background: rgba(255, 170, 0, 0.15);
        border-color: #ffaa00;
        color: #ffaa00;
        box-shadow: 0 0 20px rgba(255, 170, 0, 0.3);
        transform: translateY(-2px);
    }

    .gate-btn:hover::after {
        left: 100%;
    }

    .gate-btn:active {
        transform: translateY(0);
    }

    #operator-email-input, #operator-name-input {
        background: rgba(0, 0, 0, 0.6) !important;
        border: 1px solid rgba(255, 170, 0, 0.3) !important;
        color: #ffaa00 !important;
        font-family: 'Inter', monospace !important;
        font-size: 0.9rem !important;
        padding: 14px !important;
        transition: all 0.3s;
    }

    #operator-email-input:focus, #operator-name-input:focus {
        border-color: #ffaa00 !important;
        box-shadow: 0 0 15px rgba(255, 170, 0, 0.2);
        background: rgba(0, 0, 0, 0.8) !important;
    }

    #requirement-gate .gate-btn {
        margin-top: 20px;
        background: rgba(255, 255, 255, 0.03);
        color: rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    #requirement-gate .gate-btn:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: #ffffff;
        color: #ffffff;
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    }

    #jdsv-signup-overlay {
        position: fixed;
        inset: 0;
        z-index: 20000;
        display: none;
        flex-direction: column;
        align-items: center;
        overflow: hidden;
    }

    #jdsv-signup-overlay::before {
        content: "";
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(255, 170, 0, 0.02) 0%, transparent 50%);
        animation: nebula-drift 60s linear infinite;
        pointer-events: none;
    }

    #jdsv-signup-overlay::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(to bottom, 
            transparent 0%, 
            rgba(255, 170, 0, 0.02) 50%, 
            transparent 100%);
        background-size: 100% 4px;
        animation: scanline 12s linear infinite;
        pointer-events: none;
        opacity: 0.3;
    }

    /* INTRO CUTSCENE STYLES */
    #intro-cutscene {
        position: fixed;
        inset: 0;
        background: #000;
        z-index: 10000;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        cursor: pointer;
    }

    .cutscene-frame {
        max-width: 800px;
        width: 85%;
        display: flex;
        flex-direction: column;
        align-items: center;
        animation: cutsceneFadeIn 2s ease-out;
    }

    #cutscene-image-container {
        width: 100%;
        max-height: 60vh;
        border: 4px solid #333;
        box-shadow: 0 0 40px rgba(0,0,0,1), 0 0 20px rgba(255,170,0,0.1);
        margin-bottom: 25px;
        background: #050505;
        position: relative;
        overflow: hidden;
    }

    #cutscene-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: opacity 1s ease-in-out, transform 8s linear;
        opacity: 1;
    }

    #cutscene-img.fade-out {
        opacity: 0;
    }

    #cutscene-caption {
        text-align: center;
        max-width: 750px;
    }

    #cutscene-text {
        font-family: 'Courier New', monospace;
        color: #ffaa00;
        font-size: 1.1rem;
        line-height: 1.6;
        text-shadow: 0 0 10px rgba(255,170,0,0.3);
        margin-bottom: 15px;
        transition: opacity 0.5s ease;
    }

    .skip-hint {
        color: #444;
        font-size: 0.65rem;
        letter-spacing: 3px;
        text-transform: uppercase;
        animation: pulseHint 2s infinite;
    }

    @keyframes cutsceneFadeIn {
        from { opacity: 0; transform: scale(1.05); }
        to { opacity: 1; transform: scale(1); }
    }

    @keyframes pulseHint {
        0%, 100% { opacity: 0.3; }
        50% { opacity: 0.7; }
    }

    /* File Browser puzzle — AI-flagged target file (boarding mini-game) */
    @keyframes file-hint-pulse {
        0%, 100% { box-shadow: 0 0 4px rgba(0,255,65,0.4); border-left-color: #00ff41; background: rgba(0,255,65,0.08); }
        50%      { box-shadow: 0 0 16px rgba(0,255,65,0.9); border-left-color: #7bff9e; background: rgba(0,255,65,0.22); }
    }

    .file-hint {
        animation: file-hint-pulse 1.1s ease-in-out infinite;
        border-left: 2px solid #00ff41 !important;
    }

    .file-hint-marker {
        color: #00ff41;
        font-weight: bold;
        font-size: 0.78rem;
        letter-spacing: 1px;
        margin-left: 4px;
    }

    @keyframes systemPowerOnFlicker {
        0% { opacity: 0; filter: brightness(0); }
        5% { opacity: 1; filter: brightness(1.5); }
        10% { opacity: 0.5; filter: brightness(0.5); }
        15% { opacity: 1; filter: brightness(1.2); }
        30% { opacity: 0.2; filter: brightness(0.2); }
        40% { opacity: 1; filter: brightness(1); }
        45% { opacity: 0.8; filter: brightness(0.8); }
        50% { opacity: 1; filter: brightness(1); text-shadow: 0 0 10px #00ff41; }
        100% { opacity: 1; filter: brightness(1); }
    }

    .flicker-on {
        animation: systemPowerOnFlicker 1.5s ease-out forwards;
    }

    /* AMS Coil Pulsing Animation */
    @keyframes ams-pulse {
        0% {
            opacity: 0.3;
            transform: scale(0.95);
            filter: brightness(0.8);
        }
        50% {
            opacity: 1;
            transform: scale(1.05);
            filter: brightness(1.5) drop-shadow(0 0 10px #ff00ff);
        }
        100% {
            opacity: 0.3;
            transform: scale(0.95);
            filter: brightness(0.8);
        }
    }

    .ams-coil-ring {
        box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
    }

    .ams-coil-ring:hover {
        filter: brightness(1.3) drop-shadow(0 0 20px #ff00ff);
    }

    #ams-core {
        animation: ams-core-glow 3s infinite;
    }

    @keyframes ams-core-glow {
        0%, 100% {
            box-shadow: 0 0 5px rgba(255, 0, 255, 0.8);
        }
        50% {
            box-shadow: 0 0 20px rgba(255, 0, 255, 1);
        }
    }

    /* CU FAILURE STATES */
    @keyframes cuFailurePulse {
        0% { background: rgba(255, 0, 0, 0.05); border-color: #ff000044; box-shadow: 0 0 5px rgba(255, 0, 0, 0.1); }
        50% { background: rgba(255, 0, 0, 0.2); border-color: #ff0000; box-shadow: 0 0 15px rgba(255, 0, 0, 0.4); }
        100% { background: rgba(255, 0, 0, 0.05); border-color: #ff000044; box-shadow: 0 0 5px rgba(255, 0, 0, 0.1); }
    }

    .cu-failed {
        animation: cuFailurePulse 2s infinite ease-in-out !important;
        border: 1px solid #ff0000 !important;
    }

    .btn-replace-cu {
        background: #ff0000;
        color: white;
        border: none;
        padding: 2px 6px;
        font-size: 0.55rem;
        font-family: 'Outfit', sans-serif;
        font-weight: bold;
        cursor: pointer;
        border-radius: 2px;
        box-shadow: 0 0 10px rgba(255,0,0,0.5);
        transition: all 0.2s;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .btn-replace-cu:hover {
        background: #ff4444;
        transform: scale(1.05);
    }

    .btn-replace-cu:active {
        transform: scale(0.95);
    }

    /* AI Core Level 2+ Styles */
    .ai-core-level-2 {
        background: radial-gradient(circle, #000a18 20%, #003b6f 60%, #00f3ff 100%) !important;
        border: 2px solid rgba(0, 243, 255, 0.7) !important;
        box-shadow: 0 0 35px rgba(0, 243, 255, 0.6) !important;
    }
    .ai-core-level-2 .ai-core-inner {
        background: radial-gradient(circle, rgba(0,243,255,0.95) 0%, rgba(0,120,255,0.6) 50%, transparent 70%) !important;
        animation: aiSwirl 1.5s linear infinite !important;
    }
    .ai-core-level-2 .ai-core-swirl {
        border-top: 2.5px solid rgba(255,255,255,0.9) !important;
        border-bottom: 2.5px solid rgba(0,243,255,0.7) !important;
        animation: aiSwirl 0.7s linear infinite !important;
    }
    .ai-core-level-2 .ai-wave-ring-1 {
        border-color: rgba(0, 243, 255, 0.4) !important;
    }
    .ai-core-level-2 .ai-wave-ring-2 {
        border-color: rgba(0, 243, 255, 0.2) !important;
    }

    /* ============================================================
       VESSEL MANAGEMENT SYSTEM (VMS)
       ============================================================ */

    /* Make the main console a grid with a top bar row spanning both columns */
    #main-console.wrapper {
        grid-template-rows: auto 1fr;
    }
    /* Bar + both panels collapse to fit the new top row (bar ~34px + 10px gap) */
    #main-console.wrapper > .panel {
        height: calc(100vh - 80px - 44px);
    }

    /* ---- Slim always-visible VMS bar ---- */
    #vms-bar {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        gap: 14px;
        height: 34px;
        padding: 0 12px;
        box-sizing: border-box;
        border: 1px solid #00ff4188;
        background: linear-gradient(90deg, rgba(0,20,0,0.95), rgba(0,12,0,0.95));
        font-family: 'Courier New', monospace;
        font-size: 0.62rem;
        color: #00ff41;
        letter-spacing: 1px;
        overflow: hidden;
        white-space: nowrap;
    }
    #vms-bar .vms-bar-tag {
        font-weight: bold;
        color: #00ffff;
        letter-spacing: 2px;
        border-right: 1px solid #00ffff33;
        padding-right: 12px;
    }
    #vms-bar .vms-metric { color: #00ff4188; }
    #vms-bar .vms-metric b { color: #00ff41; font-weight: bold; }
    #vms-bar .vms-micro {
        display: inline-block;
        width: 34px;
        height: 6px;
        background: #111;
        border: 1px solid #00ff4144;
        vertical-align: middle;
        position: relative;
    }
    #vms-bar .vms-micro > i {
        display: block;
        height: 100%;
        background: #00ff41;
        transition: width 0.4s, background 0.4s;
    }
    #vms-bar .vms-spacer { flex: 1; }
    /* Status pill — nominal (green) vs fault (amber, flashing) */
    #vms-bar-status {
        font-weight: bold;
        padding: 2px 8px;
        border: 1px solid #00ff4188;
        color: #00ff41;
        background: rgba(0,255,65,0.08);
    }
    #vms-bar-status.vms-fault {
        color: #000;
        border-color: #ffaa00;
        background: #ffaa00;
        animation: blink 0.7s step-start infinite;
    }
    #vms-bar-expand {
        background: rgba(0,255,255,0.1);
        border: 1px solid #00ffff88;
        color: #00ffff;
        font-family: inherit;
        font-size: 0.6rem;
        font-weight: bold;
        padding: 3px 10px;
        cursor: pointer;
        letter-spacing: 1px;
    }
    #vms-bar-expand:hover { background: rgba(0,255,255,0.25); }

    /* ---- Expanded full-screen VMS overlay ---- */
    #vms-overlay {
        display: none;
        position: fixed;
        top: 4%;
        left: 4%;
        width: 92%;
        height: 90%;
        background: rgba(0, 8, 6, 0.98);
        border: 2px solid #00ffff;
        z-index: 3200;
        padding: 18px;
        box-sizing: border-box;
        box-shadow: 0 0 60px rgba(0, 255, 255, 0.18);
        font-family: 'Courier New', monospace;
        flex-direction: column;
        backdrop-filter: blur(8px);
    }
    #vms-overlay .vms-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #00ffff44;
        padding-bottom: 8px;
        margin-bottom: 12px;
        flex-shrink: 0;
    }
    #vms-overlay .vms-head h2 {
        margin: 0;
        border: none;
        color: #00ffff;
        font-size: 1rem;
        letter-spacing: 3px;
    }
    #vms-overlay .vms-close {
        background: #ff0000;
        color: #fff;
        border: none;
        padding: 4px 12px;
        cursor: pointer;
        font-weight: bold;
        font-family: inherit;
    }
    /* Two-panel body: Primary Diagnostics | System Synoptic */
    #vms-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        flex: 1;
        min-height: 0;
    }
    .vms-pane {
        border: 1px solid #00ffff33;
        background: rgba(0, 12, 12, 0.5);
        padding: 12px;
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    .vms-pane > .vms-pane-title {
        color: #00ffff;
        font-size: 0.7rem;
        font-weight: bold;
        letter-spacing: 2px;
        border-bottom: 1px solid #00ffff22;
        padding-bottom: 6px;
        margin-bottom: 10px;
        flex-shrink: 0;
    }

    /* Telemetry grid (top half of Primary Diagnostics) */
    #vms-telemetry {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        flex-shrink: 0;
    }
    .vms-tgroup {
        border: 1px solid #00ff4122;
        background: rgba(0,255,65,0.03);
        padding: 8px;
    }
    .vms-tgroup-h {
        color: #00ff4188;
        font-size: 0.55rem;
        font-weight: bold;
        letter-spacing: 1px;
        margin-bottom: 6px;
    }
    .vms-trow {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.62rem;
        color: #00ff4199;
        margin: 3px 0;
    }
    .vms-trow b { color: #00ff41; font-family: monospace; }
    .vms-tbar {
        height: 5px;
        background: #111;
        border: 1px solid #00ff4133;
        margin-top: 2px;
    }
    .vms-tbar > i { display: block; height: 100%; background: #00ff41; transition: width 0.4s, background 0.4s; }

    /* Dynamic Alert Zone (lower half of Primary Diagnostics) */
    #vms-alert-zone {
        margin-top: 12px;
        border-top: 1px solid #00ffff22;
        padding-top: 10px;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
    .vms-nominal {
        color: #00ff41;
        font-weight: bold;
        font-size: 0.7rem;
        letter-spacing: 1px;
        padding: 8px 4px;
    }
    .vms-fault-block { display: flex; flex-direction: column; gap: 2px; }
    .vms-fault-header {
        background: #ffaa00;
        color: #000;
        font-weight: bold;
        font-size: 0.62rem;
        padding: 4px 8px;
        letter-spacing: 1px;
        animation: blink 0.8s step-start infinite;
    }
    .vms-fault-header.vms-crit {
        background: #ff0000;
        color: #fff;
    }
    .vms-action {
        color: #4db8ff;
        font-size: 0.6rem;
        padding: 3px 8px 3px 16px;
        border-left: 2px solid #4db8ff44;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
    }
    .vms-action:hover { background: rgba(77,184,255,0.1); }
    .vms-action .vms-dots { color: #4db8ff44; }
    /* Inoperable systems summary (State C) pinned to bottom */
    #vms-inop {
        margin-top: auto;
        border-top: 1px solid #ffaa0033;
        padding-top: 6px;
        flex-shrink: 0;
    }
    #vms-inop .vms-inop-line {
        color: #ffaa00;
        font-size: 0.58rem;
        font-weight: bold;
        letter-spacing: 1px;
        padding: 2px 4px;
    }

    /* System Synoptic placeholder (modes wired in phase c) */
    #vms-synoptic {
        flex: 1;
        min-height: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #00ffff66;
        font-size: 0.7rem;
        letter-spacing: 2px;
        text-align: center;
        border: 1px dashed #00ffff22;
    }
    #vms-synoptic-mode {
        color: #00ffff;
        font-weight: bold;
    }

    /* EBUS SCHEMATIC REDESIGN (Rev 5.0) */
    .ebus-core-panel {
        padding: 8px 16px;
        background: #0a1620;
        border: 1px solid #ffe14d;
        clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
        box-shadow: 0 0 18px rgba(255, 225, 77, 0.15);
    }

    .ebus-halo {
        position: absolute;
        inset: -12px;
        border-radius: 50%;
        border: 1px dashed;
        animation: ebus-spin 24s linear infinite;
    }

    @keyframes ebus-spin {
        to { transform: rotate(360deg); }
    }

    /* CU Cards: angled clipped corners pointing toward the feeder (left for Bus A, right for Bus B, top for Aux) */
    .eps-chip-unit.ebus-a {
        background: linear-gradient(180deg, #101d26 0%, #0a141b 100%);
        border: 1px solid #2a4a3a;
        border-right: 2px solid #00ff88;
        clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
        min-height: auto;
        margin-left: 0;
        transition: all 0.3s;
    }

    .eps-chip-unit.ebus-b {
        background: linear-gradient(180deg, #101d26 0%, #0a141b 100%);
        border: 1px solid #2a4a3a;
        border-left: 2px solid #00ff88;
        clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
        min-height: auto;
        margin-left: 0;
        transition: all 0.3s;
    }

    .eps-chip-unit.ebus-x {
        background: linear-gradient(180deg, #101d26 0%, #0a141b 100%);
        border: 1px solid #2a4a3a;
        border-top: 2px solid #00ff88;
        clip-path: polygon(0 8px, 8px 0, 100% 0, 100% 100%, 0 100%);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px;
        min-height: auto;
        margin-left: 0;
        transition: all 0.3s;
    }

    /* Powered state: brighten edge stripe and add glow */
    .eps-chip-unit.ebus-a.powered {
        border-right-color: #00ff41;
        box-shadow: 0 0 12px rgba(0, 255, 65, 0.2);
    }

    .eps-chip-unit.ebus-b.powered {
        border-left-color: #00ff41;
        box-shadow: 0 0 12px rgba(0, 255, 65, 0.2);
    }

    .eps-chip-unit.ebus-x.powered {
        border-top-color: #00ff41;
        box-shadow: 0 0 12px rgba(0, 255, 65, 0.2);
    }

    /* Failed state: red edge and pulsing glow */
    .eps-chip-unit.ebus-a.cu-failed {
        border-right-color: #ff3c3c;
        background: linear-gradient(180deg, #241318 0%, #160b0e 100%);
        animation: ebus-fail 1.6s ease-in-out infinite;
    }

    .eps-chip-unit.ebus-b.cu-failed {
        border-left-color: #ff3c3c;
        background: linear-gradient(180deg, #241318 0%, #160b0e 100%);
        animation: ebus-fail 1.6s ease-in-out infinite;
    }

    .eps-chip-unit.ebus-x.cu-failed {
        border-top-color: #ff3c3c;
        background: linear-gradient(180deg, #241318 0%, #160b0e 100%);
        animation: ebus-fail 1.6s ease-in-out infinite;
    }

    @keyframes ebus-fail {
        0%, 100% { box-shadow: 0 0 4px rgba(255, 60, 60, 0.5); }
        50% { box-shadow: 0 0 14px rgba(255, 60, 60, 0.9); }
    }

    /* Non-operational state: dim and desaturate */
    .eps-chip-unit.ebus-a:not(.powered):not(.cu-failed),
    .eps-chip-unit.ebus-b:not(.powered):not(.cu-failed),
    .eps-chip-unit.ebus-x:not(.powered):not(.cu-failed) {
        opacity: 0.7;
        border-color: #1a2a36;
    }

    .eps-chip-unit.ebus-a:not(.powered):not(.cu-failed) { border-right-color: #2a4a3a; }
    .eps-chip-unit.ebus-b:not(.powered):not(.cu-failed) { border-left-color: #2a4a3a; }
    .eps-chip-unit.ebus-x:not(.powered):not(.cu-failed) { border-top-color: #2a4a3a; }

    /* ===================================================================
       EBUS SCHEMATIC REWORK — scoped to #power-bus-overlay only.
       The circuit panel (.eps-breaker-item) is intentionally untouched.
       All state classes (powered / cu-failed / active) are still driven
       by syncEPSUI(); these rules are purely presentational.
       =================================================================== */

    /* Rotating dashed halo around each bus ring (decorative, always on) */
    #power-bus-overlay .ebus-halo {
        position: absolute;
        inset: -11px;
        border: 1px dashed rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        animation: ebus-spin 26s linear infinite;
        pointer-events: none;
    }

    @keyframes ebus-spin {
        to { transform: rotate(360deg); }
    }

    /* Fusion core panel */
    #power-bus-overlay .ebus-core-panel {
        padding: 9px 0;
        background: #0a1620;
        border: 1px solid #ffe14d;
        clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
        box-shadow: 0 0 25px rgba(255, 225, 77, 0.15);
        animation: ebus-core-pulse 4s ease-in-out infinite;
    }

    @keyframes ebus-core-pulse {
        0%, 100% { box-shadow: 0 0 18px rgba(255, 225, 77, 0.12); }
        50% { box-shadow: 0 0 32px rgba(255, 225, 77, 0.28); }
    }

    /* CU cards — slot-sized, clipped corners angled toward their feeder */
    #power-bus-overlay .eps-chip-unit {
        margin: 0;
        min-height: 0;
        padding: 4px 10px;
        border-radius: 0;
        background: linear-gradient(180deg, #101d26 0%, #0a141b 100%);
        border: 1px solid #24333f;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
        z-index: 3;
    }

    /* Kill the legacy 10px stub — feeders are drawn by the SVG taps now */
    #power-bus-overlay .eps-chip-unit::before {
        display: none;
    }

    /* Feed-side accent edge + corner cuts per column */
    #power-bus-overlay .ebus-a {
        clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
        border-right: 2px solid #33454f;
    }

    #power-bus-overlay .ebus-b {
        clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
        border-left: 2px solid #33454f;
    }

    #power-bus-overlay .ebus-x {
        clip-path: polygon(0 9px, 9px 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
        border-top: 2px solid #33454f;
    }

    /* Powered: connector edge and card light up green */
    #power-bus-overlay .eps-chip-unit.powered {
        border-color: #2a4a3a;
        box-shadow: 0 4px 14px rgba(0, 255, 65, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    #power-bus-overlay .ebus-a.powered { border-right-color: #00ff41; }
    #power-bus-overlay .ebus-b.powered { border-left-color: #00ff41; }
    #power-bus-overlay .ebus-x.powered { border-top-color: #00ff41; }

    /* CU failure: red card with pulsing glow */
    #power-bus-overlay .eps-chip-unit.cu-failed {
        border-color: #ff4444 !important;
        background: linear-gradient(180deg, #241318 0%, #160b0e 100%) !important;
        animation: ebus-fail-pulse 1.6s ease-in-out infinite;
    }

    @keyframes ebus-fail-pulse {
        0%, 100% { box-shadow: 0 0 4px rgba(255, 68, 68, 0.45); }
        50% { box-shadow: 0 0 16px rgba(255, 68, 68, 0.85); }
    }

    /* Compact typography and chip module sized for the slot grid */
    #power-bus-overlay .eps-name {
        font-size: 0.62rem;
        letter-spacing: 1px;
    }

    #power-bus-overlay .eps-status-text {
        font-size: 0.48rem;
    }

    #power-bus-overlay .eps-chip-module {
        width: 44px;
        height: 26px;
        flex: none;
    }

    /* Bus feed switches inside the rings */
    #power-bus-overlay .eps-switch {
        width: 40px;
        height: 18px;
        border-color: #555;
    }

    #power-bus-overlay .eps-switch::after {
        width: 16px;
        height: 12px;
    }

    #power-bus-overlay .eps-switch.active::after {
        left: 21px;
    }

