/* Original CSS in original cascade order. Build 20260910-1. */

        /* --- LOCAL FONTS (bundled, no CDN) --- */
        @font-face { font-family: 'Arimo'; font-style: normal; font-weight: 400; font-display: swap; src: url('./fonts/arimo-400.woff2') format('woff2'); }
        @font-face { font-family: 'Arimo'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/arimo-700.woff2') format('woff2'); }
        @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('./fonts/jetbrains-mono-400.woff2') format('woff2'); }
        @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('./fonts/jetbrains-mono-500.woff2') format('woff2'); }
        @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('./fonts/jetbrains-mono-700.woff2') format('woff2'); }
        @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 800; font-display: swap; src: url('./fonts/jetbrains-mono-800.woff2') format('woff2'); }

        /* --- RESET & VARIABLES --- */
        :root {
            --bg-main: #06080a; 
            --bg-panel: rgba(255, 255, 255, 0.03); 
            --bg-panel-light: rgba(255, 255, 255, 0.05); 
            --border-color: rgba(255, 255, 255, 0.1); 
            --text-main: #e5e7eb; 
            
            --teal: #2dd4bf;
            --teal-glow: rgba(45,212,191,0.5);
            --purple: #c084fc;
            --purple-glow: rgba(192,132,252,0.5);
            --orange: #fb923c;
            --orange-glow: rgba(251,146,60,0.5);
            --red: #ef4444;
            --red-glow: rgba(239,68,68,0.6);
            --green: #4ade80;
            --green-glow: rgba(74,222,128,0.6);
            --grey: #94a3b8;
            --grey-glow: rgba(148,163,184,0.4);

            /* ── Live-Debug palette (matches index site) ── */
            --defuse-cyan: #00f2ff;
            --wild-green: #22c55e;
            --stasis-purple: #bc13fe;
            --tripwire-orange: #ff8c00;
            --alert-red: #ef4444;
            --mono: 'JetBrains Mono','Courier New',monospace;
        }

        * { box-sizing: border-box; font-family: 'Arimo', sans-serif; touch-action: manipulation; }
        html, body { 
            height: 100%;
            height: 100vh;
            height: var(--full-height, 100vh);
            height: 100dvh; /* Dynamic viewport - excludes address bar on mobile (modern) */
        }
        body { 
            margin: 0; padding: 0; 
            padding-top: env(safe-area-inset-top);
            padding-bottom: env(safe-area-inset-bottom);
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
            background-color: var(--bg-main); 
            color: var(--text-main); 
            overflow: hidden; 
            display: flex; 
            flex-direction: column; 
            user-select: none; 
            -webkit-tap-highlight-color: transparent;
            position: fixed; /* Prevent rubber-band scroll on iOS */
            width: 100%;
            inset: 0;
        }
        
        /* Typography */
        .font-mono { font-family: 'JetBrains Mono','Courier New',monospace; }
        .text-center { text-align: center; }
        .font-bold { font-weight: bold; }
        .font-black { font-weight: 900; }
        .tracking-widest { letter-spacing: 0.2em; }
        .uppercase { text-transform: uppercase; }

        /* Utility Classes */
        .hidden { display: none !important; }
        .flex { display: flex; }
        .flex-col { flex-direction: column; }
        .items-center { align-items: center; }
        .justify-center { justify-content: center; }
        .justify-between { justify-content: space-between; }
        .gap-2 { gap: 0.5rem; } .gap-4 { gap: 1rem; } .gap-8 { gap: 2rem; }
        .w-full { width: 100%; } .h-full { height: 100%; }
        .relative { position: relative; } .absolute { position: absolute; }
        
        button { cursor: pointer; border: none; outline: none; background: none; font-family: 'Arimo', sans-serif; transition: all 0.2s; }
        button:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

        /* --- BACKGROUND (matches index Live-Debug site) --- */
        body::before {
            content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
            background-image:
                linear-gradient(rgba(0,242,255,0.045) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0,242,255,0.045) 1px, transparent 1px),
                radial-gradient(ellipse at 50% -10%, rgba(188,19,254,0.06), transparent 60%);
            background-size: 44px 44px, 44px 44px, 100% 100%;
        }
        #play-particles {
            position: fixed; inset: 0; z-index: 0; pointer-events: none;
        }
        @media (max-width: 760px) { #play-particles { display: none; } }

        /* --- BACKGROUND --- */
        .bg-grid {
            position: absolute; inset: 0; z-index: 0; opacity: 0.02; pointer-events: none;
            background-image: linear-gradient(rgba(0,242,255,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0,242,255,0.05) 1px, transparent 1px), radial-gradient(ellipse at 50% -10%, rgba(188,19,254,0.06), transparent 60%);
            background-size: 40px 40px;
        }

        /* Scanline effect matching website */
        .scanline {
            width: 100%; height: 100px; z-index: 10;
            background: linear-gradient(0deg, rgba(0,0,0,0) 0%, rgba(255,255,255,0.05) 50%, rgba(0,0,0,0) 100%);
            opacity: 0.08; position: fixed; bottom: 100%;
            animation: scanline 8s linear infinite; pointer-events: none;
        }
        @keyframes scanline { 0% { bottom: 100%; } 100% { bottom: -10%; } }

        /* --- HEADER --- */
        header {
            background-color: rgba(0,0,0,0.9); border-bottom: 1px solid rgba(255,255,255,0.1);
            padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; z-index: 1000;
            backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        }
        .hdr-logo-link {
            text-decoration: none; display: flex; align-items: center; gap: 8px;
            outline: none; cursor: pointer; flex-shrink: 0;
        }
        .hdr-logo-img {
            height: 36px; width: auto; object-fit: contain; display: block;
            animation: hdr-logo-pulse 2.6s ease-in-out infinite;
        }
        @keyframes hdr-logo-pulse {
            0%, 100% { filter: drop-shadow(0 0 2px rgba(45,212,191,0.4)); transform: scale(1); }
            50% { filter: drop-shadow(0 0 10px rgba(45,212,191,0.85)); transform: scale(1.05); }
        }
        .header-title { font-family: 'JetBrains Mono','Courier New',monospace; font-size: 1.1rem; font-weight: bold; letter-spacing: 0.2em; color: transparent; background-clip: text; -webkit-background-clip: text; background-image: linear-gradient(to right, var(--teal), var(--purple)); display: flex; align-items: center; gap: 8px; text-transform: uppercase; }
        .header-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
        /* ── Layout declutter: only surface controls relevant to the current screen ── */
        body:not(.in-game) #btn-toggle-helper,
        body:not(.in-game) #btn-toggle-openhand,
        body:not(.in-game) #btn-toggle-rules { display: none; }
        
        .btn-header { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 12px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; background-color: transparent; border: 1px solid rgba(255,255,255,0.15); color: var(--text-main); text-decoration: none; min-height: 36px; letter-spacing: 0.1em; text-transform: uppercase; }
        .btn-header:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.3); }
        
        .btn-header.active-orange { border-color: var(--orange); color: var(--orange); box-shadow: 0 0 10px var(--orange-glow); background: transparent; }
        .btn-header.active-orange:hover { background: var(--orange); color: black; }
        
        .btn-header.active-teal { border-color: var(--teal); color: var(--teal); box-shadow: 0 0 10px var(--teal-glow); background: transparent; }
        .btn-header.active-teal:hover { background: var(--teal); color: black; }

        .btn-buy-now {
            display: inline-flex; align-items: center; justify-content: center;
            text-decoration: none; font-weight: bold; letter-spacing: 0.15em;
            color: var(--orange); border: 1px solid var(--orange);
            padding: 6px 12px; border-radius: 4px; font-size: 0.75rem;
            transition: all 0.3s; background: transparent; box-shadow: 0 0 8px var(--orange-glow); min-height: 36px; text-transform: uppercase;
            font-family: var(--mono);
        }
        .btn-buy-now:hover { background-color: var(--orange); color: black; box-shadow: 0 0 25px var(--orange-glow); }
        .buy-short { display: none; }
        @media (max-width: 768px) {
            .buy-full { display: none; }
            .buy-short { display: inline; }
        }

        /* How-to-play: same shape as BUY NOW, neon green */
        .btn-how-to {
            display: inline-flex; align-items: center; justify-content: center; gap: 6px;
            text-decoration: none; font-weight: bold; letter-spacing: 0.15em;
            color: var(--wild-green); border: 1px solid var(--wild-green);
            padding: 6px 12px; border-radius: 4px; font-size: 0.75rem;
            transition: all 0.3s; background: transparent;
            box-shadow: 0 0 8px var(--green-glow); min-height: 36px; text-transform: uppercase;
            font-family: var(--mono); cursor: pointer;
        }
        .btn-how-to:hover { background-color: var(--wild-green); color: #000; box-shadow: 0 0 25px var(--green-glow); }

        /* ── End-of-game BUY NOW overlay ── */
        .go-close {
            position: absolute; top: 10px; right: 12px;
            width: 34px; height: 34px; border-radius: 50%;
            background: transparent; border: 1px solid rgba(255,255,255,0.25);
            color: var(--text-main); font-size: 22px; line-height: 1; cursor: pointer;
            display: flex; align-items: center; justify-content: center; transition: all .2s;
        }
        .go-close:hover { border-color: var(--red); color: var(--red); box-shadow: 0 0 12px var(--red-glow); }
        .go-promo {
            width: 100%; border: 1px solid var(--orange); border-radius: 8px;
            padding: 16px 14px; margin-bottom: 14px;
            background: rgba(255,140,0,0.06); box-shadow: 0 0 18px rgba(255,140,0,0.18);
        }
        .go-promo-head {
            font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em;
            color: var(--orange); text-transform: uppercase; margin-bottom: 12px;
        }
        .go-buy-btn {
            display: inline-flex; align-items: center; gap: 8px; justify-content: center;
            text-decoration: none; font-family: var(--mono); font-weight: 700;
            letter-spacing: 0.12em; font-size: 1.05rem; text-transform: uppercase;
            color: var(--orange); background: rgba(6,8,10,0.85);
            border: 1px solid var(--orange); border-radius: 6px; padding: 12px 22px;
            transition: background .25s, color .25s; animation: buyPulse 2.1s ease-in-out infinite;
        }
        .go-buy-btn:hover { background: var(--orange); color: #000; animation: none; box-shadow: 0 0 28px var(--orange-glow); }
        .go-buy-btn .go-price { color: #fff !important; font-weight: 900; letter-spacing: 0.06em; }
        .go-buy-btn:hover .go-price { color: #000 !important; }
        @keyframes buyPulse {
            0%,100% { box-shadow: 0 0 14px rgba(255,140,0,0.35); }
            50%     { box-shadow: 0 0 26px rgba(255,140,0,0.85); }
        }
        .go-promo-sub {
            font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em;
            color: var(--green); text-transform: uppercase; margin-top: 12px;
        }
        .go-lobby-link {
            display: block; width: 100%; margin-top: 14px;
            background: transparent; border: 2px solid var(--teal); color: var(--teal);
            font-family: 'Arimo', sans-serif; font-size: 0.95rem; font-weight: bold; letter-spacing: 0.12em;
            text-transform: uppercase; cursor: pointer; padding: 14px 10px; border-radius: 5px;
            box-shadow: 0 0 15px var(--teal-glow), inset 0 0 10px var(--teal-glow);
            transition: all 0.3s ease;
        }
        .go-lobby-link:hover { background: var(--teal); color: black; box-shadow: 0 0 30px var(--teal-glow); }
        .go-lobby-link:active { transform: scale(0.98); }

        /* --- RETRO LOBBY BUTTONS --- */
        .btn-retro {
            background: transparent; font-family: 'Arimo', sans-serif; font-weight: bold; text-transform: uppercase;
            letter-spacing: 0.15em; display: inline-flex; align-items: center; justify-content: center;
            transition: all 0.3s ease; text-decoration: none; cursor: pointer;
        }
        .btn-play {
            border: 2px solid var(--green); color: var(--green);
            box-shadow: 0 0 15px var(--green-glow), inset 0 0 10px var(--green-glow);
        }
        .btn-play:hover { background: var(--green); color: black; box-shadow: 0 0 30px var(--green-glow); }
        
        .btn-buy {
            border: 2px solid var(--orange); color: var(--orange);
            box-shadow: 0 0 15px var(--orange-glow), inset 0 0 10px var(--orange-glow);
        }
        .btn-buy:hover { background: var(--orange); color: black; box-shadow: 0 0 30px var(--orange-glow); }

        /* Mode picker ,  three independent choices (no cycle trap) */
        .mode-pick {
            font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
            letter-spacing: 0.1em; text-transform: uppercase;
            padding: 10px 12px; border-radius: 5px; cursor: pointer;
            background: transparent; border: 1px solid rgba(255,255,255,0.18);
            color: var(--text-main); transition: all 0.2s; min-width: 110px;
        }
        .mode-pick:hover { border-color: var(--teal); color: var(--teal); }
        .mode-pick.active {
            border-color: var(--wild-green); color: var(--wild-green);
            box-shadow: 0 0 14px rgba(34,197,94,0.35); background: rgba(34,197,94,0.08);
        }
        .mode-pick.mode-red:hover { border-color: var(--alert-red); color: var(--alert-red); }
        .mode-pick.mode-red.active {
            border-color: var(--alert-red); color: var(--alert-red);
            box-shadow: 0 0 14px rgba(239,68,68,0.4); background: rgba(239,68,68,0.08);
        }
        #mode-btn-oaat.active {
            border-color: var(--tripwire-orange); color: var(--tripwire-orange);
            box-shadow: 0 0 14px rgba(255,140,0,0.35); background: rgba(255,140,0,0.08);
        }
        @media (max-width: 768px) {
            .mode-pick { min-width: 0; flex: 1 1 42%; font-size: 0.62rem; padding: 10px 8px; }
        }

        /* --- MENUS & OVERLAYS --- */
        .overlay {
            position: fixed; inset: 0; background: rgba(6,8,10,0.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
            display: flex; align-items: center; justify-content: center; z-index: 999999; padding: 16px; overflow-y: auto;
        }
        .overlay.passthrough { pointer-events: none; background: rgba(6,8,10,0.7); }
        /* Menu / lobby: always a true popup above the game (never buried under the board) */
        #screen-lobby {
            position: fixed !important;
            inset: 0 !important;
            z-index: 3000000 !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 16px !important;
            padding-top: max(16px, env(safe-area-inset-top)) !important;
            padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
            overflow-y: auto;
            background: rgba(6, 8, 10, 0.88) !important;
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }
        #screen-lobby > div {
            background: rgba(6, 8, 10, 0.96);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 10px;
            padding: 20px 18px 18px;
            box-shadow: 0 12px 40px rgba(0,0,0,0.75), 0 0 30px rgba(45,212,191,0.08);
            max-height: min(88vh, 720px);
            overflow-y: auto;
            position: relative;
            -webkit-overflow-scrolling: touch;
        }
        #screen-lobby .menu-close {
            position: absolute;
            top: 10px; right: 10px;
            z-index: 6;
            background: transparent;
            border: 1px solid rgba(255,255,255,0.2);
            color: var(--text-main);
            width: 36px; height: 36px;
            border-radius: 6px;
            font-size: 1.25rem;
            line-height: 1;
            cursor: pointer;
        }
        #screen-lobby .menu-close:hover { border-color: var(--red); color: var(--red); }
        @media (max-width: 768px) {
            #screen-lobby { padding: 10px !important; align-items: flex-start !important; padding-top: max(12px, env(safe-area-inset-top)) !important; }
            #screen-lobby > div {
                width: 100%;
                max-width: 100%;
                padding: 16px 14px 14px;
                max-height: calc(100dvh - 24px);
                border-radius: 12px;
            }
            #screen-lobby .btn-retro { min-width: 0 !important; flex: 1; padding: 12px 14px !important; font-size: 0.95rem !important; }
            #screen-lobby .setting-row { padding: 10px 0 !important; }
        }
        .overlay.passthrough .breach-modal { pointer-events: auto; }

        .modal {
            background: rgba(6,8,10,0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px;
            padding: 24px; max-width: 700px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,0.8);
            max-height: 90vh; display: flex; flex-direction: column; position: relative; margin: auto;
            backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
        }
        .modal-body { overflow-y: auto; padding-right: 8px; display: flex; flex-direction: column; gap: 16px; }

        .btn-primary {
            width: 100%; padding: 16px; background-color: transparent; color: var(--teal); font-weight: bold;
            text-transform: uppercase; letter-spacing: 0.15em; border-radius: 4px; font-size: 0.875rem;
            border: 1px solid var(--teal); box-shadow: 0 0 15px var(--teal-glow); margin-top: 16px; display: flex; justify-content: center; align-items: center; gap: 8px;
            transition: all 0.3s;
        }
        .btn-primary:hover { background: var(--teal); color: black; box-shadow: 0 0 25px var(--teal); }

        .setting-row { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.03); padding: 12px 16px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.05); margin-bottom: 8px; }
        .btn-icon { width: 36px; height: 36px; border-radius: 4px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.2rem;}
        .btn-icon:hover { background: rgba(255,255,255,0.1); }
        
        /* Rulebook Inner Styling */
        .rb-panel { background: rgba(255,255,255,0.03); padding: 16px; border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; margin-bottom: 16px; }
        .rb-panel.attack { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.05); }
        .rb-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--purple); color: black; font-weight: bold; font-size: 12px; margin-right: 8px; }
        
        /* --- GAME BOARD --- */
        #game-board { flex: 1; display: flex; flex-direction: column; position: relative; z-index: 10; transition: z-index 0.1s; }
        #ai-layer { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
        .ai-hand { position: absolute; display: flex; flex-direction: column; align-items: center; transition: all 0.5s; }
        .ai-hand.active { transform: scale(1.1); filter: drop-shadow(0 0 20px var(--green-glow)); z-index: 30; }
        .ai-hand.inactive { opacity: 0.6; transform: scale(0.9); z-index: 10; filter: grayscale(50%); }
        .ai-name { background: rgba(6,8,10,0.85); padding: 5px 11px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.15); font-size: 12px; font-weight: bold; letter-spacing: 0.06em; margin-bottom: 6px; white-space: nowrap; transition: color .2s, border-color .2s, box-shadow .2s; }
        /* In play → neon green. In trouble (firewall / taking damage) → alert red. */
        .ai-name.active { color: var(--wild-green); border-color: var(--wild-green); font-weight: bold; box-shadow: 0 0 12px var(--green-glow); }
        .ai-name.trouble { color: var(--red); border-color: var(--red); font-weight: bold; box-shadow: 0 0 12px var(--red-glow); animation: pulse 1s infinite; }
        .ai-cards-container { display: flex; justify-content: center; }
        /* Permanently hide the AI "SCANNING / EXECUTING" status badge ,  pure clutter */
        #ai-protocol-badge { display: none !important; }

        /* ── Seat head: names only (avatars/icons removed for cleaner mobile) ── */
        .ai-seat-head { display: flex; flex-direction: column; align-items: center; gap: 2px; }
        .ai-avatar-wrap { display: none !important; } /* permanently hide opponent icons */
        .seat-turn-tag { display: none; }
        .you-seat { display: none; }

        /* Red highlight when an AI is taking damage ,  uses outline/glow only so position transforms stay intact */
        .ai-hand.taking-damage {
            z-index: 45 !important;
            filter: drop-shadow(0 0 18px rgba(239,68,68,0.95)) drop-shadow(0 0 6px rgba(239,68,68,1)) !important;
        }
        .ai-hand.taking-damage .ai-name {
            color: #fff !important;
            border-color: var(--red) !important;
            background: rgba(180,20,20,0.95) !important;
            box-shadow: 0 0 16px var(--red-glow), inset 0 0 10px rgba(255,80,80,0.35) !important;
            animation: pulse 0.75s infinite;
            font-weight: 900;
        }
        .ai-hand.taking-damage .ai-cards-container {
            outline: 2px solid var(--red);
            outline-offset: 3px;
            border-radius: 6px;
            box-shadow: 0 0 20px var(--red-glow);
        }

        /* ── MOBILE: name + readable card-backs only ── */
        @media (max-width: 768px) {
            #ai-layer { z-index: 22; }
            .ai-hand {
                transition: top .35s ease, left .35s ease, right .35s ease;
                max-width: 48vw; /* prevent fans from spilling into the dock column */
            }
            .ai-name {
                font-size: 10px; margin-bottom: 3px; padding: 3px 8px; white-space: nowrap;
                background: rgba(6,8,10,0.92); border-radius: 4px; letter-spacing: 0.04em;
                max-width: 100%; overflow: hidden; text-overflow: ellipsis;
            }
            .ai-hand.inactive { opacity: 0.88; }
            .ai-hand.active .ai-name { color: var(--wild-green); border-color: var(--wild-green); box-shadow: 0 0 10px var(--green-glow); }
            .ai-hand .ai-name.trouble { color: var(--red); border-color: var(--red); box-shadow: 0 0 10px var(--red-glow); }
            .ai-hand.active { z-index: 33; }
            .ai-cards-container {
                transform: none;
                height: auto;
                max-height: 78px;
                margin-top: 2px;
                display: flex;
                justify-content: center;
                overflow: visible;
            }

            .you-seat { display: none !important; }
        }

        .arena { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; padding: 20px; z-index: 30; width: 100%; max-width: 800px; margin: 0 auto; position: relative; }
        /* Docks sit centred in the play area; the draw/END-TURN bar drops to the bottom (near the hand). */
        .controls-bar { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); }
        
        /* --- DOCKS --- */
        .docks-container { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; transition: z-index 0.2s; width: 100%; }
        .dock {
            width: 110px; height: 160px; border-radius: 8px; border: 2px solid; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 8px;
            background-color: transparent; position: relative; transition: all 0.3s;
            overflow: visible; /* allow value badge + OPEN tag to sit outside the frame */
        }
        .dock.empty { border-style: dashed; border-color: rgba(255,255,255,0.1); overflow: hidden; }
        .dock.solid { border-color: transparent; }
        .dock.valid-target { box-shadow: 0 0 20px var(--green-glow); border-color: var(--green); transform: scale(1.05); cursor: pointer; }
        .dock-label { position: absolute; top: 8px; left: 0; width: 100%; text-align: center; font-size: 10px; font-weight: bold; letter-spacing: 0.2em; opacity: 0.8; z-index: 10; color: white; text-shadow: 0 0 4px black; }
        .dock-value {
            position: absolute; top: -14px; right: -14px; width: 32px; height: 32px;
            background: var(--bg-main); border: 1px solid rgba(255,255,255,0.15); border-radius: 50%;
            display: flex; align-items: center; justify-content: center; font-weight: bold;
            font-family: 'Arimo', sans-serif; z-index: 25; box-shadow: 0 4px 6px rgba(0,0,0,0.8);
        }
        
        .dock-cards { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; margin-top: 16px; pointer-events: none; z-index: 10; }
        .dock-card-wrapper { position: absolute; transition: all 0.3s; }
        
        /* Dock Background Image Styling */
        .dock-bg-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; opacity: 0.8; border-radius: 6px; }
        /* Dock CSS fallbacks when bg image fails */
        .dock.no-bg.teal   { background: linear-gradient(160deg, rgba(12,74,82,0.4) 0%, rgba(2,29,35,0.6) 100%); border-color: var(--teal) !important; }
        .dock.no-bg.purple { background: linear-gradient(160deg, rgba(74,12,82,0.4) 0%, rgba(29,2,35,0.6) 100%); border-color: var(--purple) !important; }
        .dock.no-bg.orange { background: linear-gradient(160deg, rgba(90,42,0,0.4) 0%, rgba(42,17,0,0.6) 100%); border-color: var(--orange) !important; }
        /* ── RED DOCK slots (Red Shift) ── */
        .dock.red-dock { border-color: var(--red); box-shadow: inset 0 0 14px rgba(239,68,68,0.15); }
        .dock.red-dock.empty { border-style: dashed; border-color: rgba(239,68,68,0.5); background: repeating-linear-gradient(45deg, rgba(239,68,68,0.05) 0 8px, transparent 8px 16px); }
        .dock.red-dock .dock-label { color: #ff8a8a; text-shadow: 0 0 6px rgba(239,68,68,0.6); }
        .dock.red-dock.solid { border-color: var(--red); }
        /* ── RED DOCK slots (Red Shift) ── */
        .dock.red-dock { border-color: var(--red) !important; box-shadow: inset 0 0 18px rgba(239,68,68,0.12); }
        .dock.red-dock.empty { border-style: dashed; border-color: rgba(239,68,68,0.45) !important; }
        .dock.red-dock.no-bg, .dock.red-dock { background: linear-gradient(160deg, rgba(90,6,8,0.45) 0%, rgba(42,2,4,0.6) 100%); }
        .dock.red-dock .dock-label { color: #ff8f8f; text-shadow: 0 0 6px rgba(239,68,68,0.6); }
        .dock.red-dock.empty::after {
            content: "AWAIT DOCK CARD"; position: absolute; bottom: 10px; left: 0; width: 100%;
            text-align: center; font-family: var(--mono); font-size: 7px; letter-spacing: 0.12em;
            color: rgba(239,68,68,0.55); pointer-events: none;
        }
        /* 6 docks need to fit: shrink + allow two rows */
        body.redshift-board .docks-container {
            display: grid;
            grid-template-columns: repeat(3, auto);
            justify-content: center;
            column-gap: 30px; row-gap: 16px;
            max-width: 920px; margin: 0 auto;
        }
        /* faint connector line between a standard dock and the red dock beneath it */
        body.redshift-board .dock.red-dock::after {
            content: ""; position: absolute; top: -16px; left: 50%; width: 1px; height: 16px;
            background: linear-gradient(rgba(239,68,68,0.5), rgba(239,68,68,0)); transform: translateX(-50%);
            pointer-events: none;
        }
        body.redshift-board .dock { width: 90px; height: 130px; }
        @media (max-width: 1000px) { body.redshift-board .dock { width: 78px; height: 112px; } }
        @media (max-width: 760px)  { body.redshift-board .dock { width: 62px; height: 90px; } body.redshift-board .docks-container { gap: 10px; } }
        @media (max-width: 480px)  { body.redshift-board .dock { width: 50px; height: 74px; } body.redshift-board .dock-label { font-size: 7px; } }

        /* --- CARDS (UPDATED FOR IMAGES) --- */
        .card {
            width: 70px; height: 100px; border-radius: 6px; border: none !important; display: flex; flex-direction: column; align-items: center; justify-content: center;
            position: relative; background: none !important; cursor: pointer; transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s; flex-shrink: 0; user-select: none;
        }
        .card:hover { transform: translateY(-8px); z-index: 10; box-shadow: 0 5px 15px rgba(0,0,0,0.8); }
        .card.selected { transform: translateY(-20px); box-shadow: 0 0 15px rgba(255,255,255,0.8); border-radius: 6px; z-index: 20; border: 2px solid white !important; }
        
        .card.defend-pulse { 
            animation: defendPulse 1.5s infinite; 
            border-radius: 6px;
            border: 2px solid white !important;
            z-index: 9999999 !important; 
        }

        .card-art {
            width: 100%; height: 100%; object-fit: cover; border-radius: 6px;
            display: block; position: absolute; inset: 0; z-index: 5; pointer-events: none;
            opacity: 0; transition: opacity 0.12s ease;
        }
        .card-art.is-loaded { opacity: 1; }
        /* Hide CSS face whenever art is expected ,  no flash between face and image */
        .card.has-art .cardface { opacity: 0 !important; visibility: hidden; }
        .card.has-art.art-failed .cardface { opacity: 1 !important; visibility: visible; }
        .card.has-art.art-failed .card-art { display: none; }
        .plus-one-badge { position: absolute; top: -6px; right: -6px; background: var(--bg-main); border: 1px solid var(--red); color: var(--red); font-size: 10px; font-weight: bold; padding: 2px 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,0.8); z-index: 5; }

        /* ── CSS FALLBACK CARD (when image fails to load) ── */
        .card-fallback {
            position: absolute; inset: 0;
            display: none; /* shown only when card.no-art */
            flex-direction: column; align-items: center; justify-content: center;
            border-radius: 6px;
            font-family: 'Arimo', sans-serif;
            color: white;
            background: var(--grey);
            border: 1px solid rgba(255,255,255,0.15);
            box-shadow: inset 0 0 12px rgba(0,0,0,0.4);
            pointer-events: none;
            overflow: hidden;
        }
        .card.no-art .card-fallback { display: flex; }
        .card.no-art { background: transparent !important; }
        .card.no-art.fb-teal   .card-fallback { background: linear-gradient(160deg, #0c4a52 0%, #021d23 100%); border-color: var(--teal); }
        .card.no-art.fb-purple .card-fallback { background: linear-gradient(160deg, #4a0c52 0%, #1d0223 100%); border-color: var(--purple); }
        .card.no-art.fb-orange .card-fallback { background: linear-gradient(160deg, #5a2a00 0%, #2a1100 100%); border-color: var(--orange); }
        .card.no-art.fb-grey   .card-fallback { background: linear-gradient(160deg, #2a2a2a 0%, #111 100%); border-color: #666; }
        .card.no-art.fb-wild   .card-fallback { background: linear-gradient(160deg, #0a3a14 0%, #021505 100%); border-color: var(--green); }
        .card.no-art.fb-mod-pos .card-fallback { background: linear-gradient(160deg, #2a2a2a 0%, #111 100%); border-color: #666; color: var(--green); }
        .card.no-art.fb-mod-neg .card-fallback { background: linear-gradient(160deg, #2a2a2a 0%, #111 100%); border-color: #666; color: var(--red); }
        .fb-val-top  { position: absolute; top: 4px; left: 6px; font-size: 11px; font-weight: 700; line-height: 1; opacity: 0.95; }
        .fb-val-bot  { position: absolute; bottom: 4px; right: 6px; font-size: 11px; font-weight: 700; line-height: 1; transform: rotate(180deg); opacity: 0.95; }
        .fb-center { font-size: 22px; font-weight: 900; line-height: 1; text-shadow: 0 0 6px rgba(0,0,0,0.7); letter-spacing: 0.05em; }
        .fb-center.fb-tag { font-size: 9px; letter-spacing: 0.15em; padding: 0 4px; text-align: center; }
        .fb-sub { font-size: 7px; letter-spacing: 0.15em; opacity: 0.7; margin-top: 4px; text-transform: uppercase; }
        @media (max-width: 768px) {
            .fb-val-top, .fb-val-bot { font-size: 9px; }
            .fb-center { font-size: 18px; }
            .fb-center.fb-tag { font-size: 7px; }
        }

        /* ═══════════════════════════════════════════════════════════
           PROCEDURAL CSS CARD ART  (no image dependency)
           Every card renders as a styled face: neon frame, corner pips,
           centre value/tag, micro scanlines. Colour by suit token.
           ═══════════════════════════════════════════════════════════ */
        .cardface {
            position: absolute; inset: 0; z-index: 2; border-radius: 6px;
            display: flex; align-items: center; justify-content: center;
            font-family: var(--mono); overflow: hidden;
            background:
                linear-gradient(160deg, rgba(255,255,255,0.06), rgba(0,0,0,0.25)),
                var(--cf-bg, #15181d);
            border: 1.5px solid var(--cf-line, #555);
            box-shadow: inset 0 0 14px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.4);
            color: var(--cf-ink, #fff);
        }
        /* scanline texture */
        .cardface::before {
            content:""; position:absolute; inset:0; pointer-events:none; opacity:0.5;
            background: repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px);
        }
        /* grid corner bracket */
        .cardface::after {
            content:""; position:absolute; top:4px; left:4px; width:10px; height:10px;
            border-top:1.5px solid var(--cf-line); border-left:1.5px solid var(--cf-line); opacity:0.8;
        }
        .cf-pip { position:absolute; font-size:12px; font-weight:800; line-height:1; letter-spacing:0.02em;
                  text-shadow:0 0 6px var(--cf-glow, transparent); z-index:3; }
        .cf-pip.tl { top:5px; left:6px; }
        .cf-pip.br { bottom:5px; right:6px; transform:rotate(180deg); }
        .cf-center { font-size:30px; font-weight:800; line-height:1; z-index:3;
                     text-shadow:0 0 10px var(--cf-glow, rgba(0,0,0,0.6)); }
        .cf-tag { font-size:11px; font-weight:800; letter-spacing:0.16em; text-align:center;
                  z-index:3; padding:0 4px; text-shadow:0 0 10px var(--cf-glow); }
        .cf-sub { position:absolute; bottom:9px; left:0; right:0; text-align:center;
                  font-size:7px; letter-spacing:0.22em; opacity:0.8; z-index:3; text-transform:uppercase; }
        .cf-suit { position:absolute; top:5px; right:6px; font-size:7px; letter-spacing:0.12em;
                   opacity:0.7; z-index:3; text-transform:uppercase; }

        /* suit palettes */
        .cf-teal   { --cf-bg:#04282e; --cf-line:var(--teal);   --cf-ink:#e8fffb; --cf-glow:var(--teal-glow); }
        .cf-purple { --cf-bg:#250a33; --cf-line:var(--purple); --cf-ink:#f6ecff; --cf-glow:var(--purple-glow); }
        .cf-orange { --cf-bg:#321a06; --cf-line:var(--orange); --cf-ink:#fff1e2; --cf-glow:var(--orange-glow); }
        .cf-grey   { --cf-bg:#1c1f24; --cf-line:#8a94a3;       --cf-ink:#eef1f5; --cf-glow:var(--grey-glow); }
        .cf-green  { --cf-bg:#062a12; --cf-line:var(--green);  --cf-ink:#e6ffe9; --cf-glow:var(--green-glow); }
        .cf-cyan   { --cf-bg:#042a2f; --cf-line:var(--defuse-cyan); --cf-ink:#e8ffff; --cf-glow:rgba(0,242,255,0.5); }
        /* Modifiers are NEUTRAL (grey) assets ,  they attach to Grey cards. Symbol tinted only. */
        .cf-modpos { --cf-bg:#1c1f24; --cf-line:#8a94a3; --cf-ink:#9affc0; --cf-glow:var(--grey-glow); }
        .cf-modneg { --cf-bg:#1c1f24; --cf-line:#8a94a3; --cf-ink:#ff9a9a; --cf-glow:var(--grey-glow); }
        /* RED SHIFT suit */
        .cf-red    { --cf-bg:#ff0000; --cf-line:#7a0000;    --cf-ink:#000000; --cf-glow:rgba(255,255,255,0.85); }
        .cf-red .cardface, .cardface.cf-red { animation: redpulse 2.4s ease-in-out infinite; }
        .cardface.cf-red { background:#ff0000 !important; }
        .cf-red .cf-center, .cf-red .cf-tag, .cf-red .cf-pip {
            color:#000 !important;
            text-shadow:-2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 2px 2px 0 #fff, 0 0 3px #fff;
        }
        .cf-red .cf-suit { color:#1a0000; opacity:0.85; }
        .cf-red .cf-sub  { color:#000; opacity:1; font-weight:800; font-size:10px; letter-spacing:0.18em; }

        @keyframes redpulse { 0%,100%{ box-shadow: inset 0 0 14px rgba(0,0,0,0.45), 0 0 8px rgba(255,60,60,0.4);} 50%{ box-shadow: inset 0 0 14px rgba(0,0,0,0.45), 0 0 20px rgba(255,60,60,0.75);} }

        /* trigger cards get a hazard stripe at the base */
        .cf-trigger .cf-sub { font-weight:800; opacity:1; }
        .cardface.cf-haz { background-image:
                linear-gradient(160deg, rgba(255,255,255,0.06), rgba(0,0,0,0.25)),
                repeating-linear-gradient(45deg, rgba(0,0,0,0) 0 8px, rgba(255,255,255,0.04) 8px 16px),
                linear-gradient(var(--cf-bg), var(--cf-bg)); }

        /* PING utility */
        .cf-ping { --cf-bg:#2a0608; --cf-line:var(--red); --cf-ink:#ffe0e0; --cf-glow:var(--red-glow); }

        /* shrink art on small cards */
        @media (max-width: 768px) {
            .cf-center { font-size: 24px; }
            .cf-pip { font-size: 10px; }
            .cf-tag { font-size: 9px; }
        }


        .card.hidden-card { width: 50px; height: 75px; box-shadow: 0 2px 4px rgba(0,0,0,0.5); pointer-events: none; background: rgba(255,255,255,0.05); }

        /* --- CONTROLS BAR --- */
        .controls-bar {
            display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.03); padding: 10px 12px;
            border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); box-shadow: 0 10px 30px rgba(0,0,0,0.5);
            backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
            flex-wrap: nowrap; justify-content: center; width: auto; max-width: 96%;
        }
        .controls-bar .damage-banner {
            width: auto; margin: 0; padding: 6px 10px; white-space: nowrap; font-size: 11px;
        }
        .controls-bar .deck-btn {
            width: 56px; height: 64px; flex-shrink: 0;
        }
        .controls-bar .end-turn-btn {
            min-height: 44px; white-space: nowrap;
        }
        /* System log removed → hide the redundant discard "LOG" button, freeing touch room. */
        #btn-discard { display: none !important; }
        .deck-btn, .discard-btn {
            width: 64px; height: 72px; border-radius: 6px; border: 1px dashed rgba(255,255,255,0.15);
            display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s;
        }
        .deck-btn { background: rgba(255,255,255,0.03); border-style: solid; }
        .deck-btn:hover { border-color: var(--teal); background: #222; }
        .deck-btn.disabled { opacity: 0.3; pointer-events: none; }
        .deck-count { font-size: 18px; font-weight: bold; color: var(--text-main); }
        .deck-label { font-size: 10px; color: var(--teal); text-transform: uppercase; letter-spacing: 0.1em; font-weight: bold; margin-top: 4px; }
        
        .discard-btn { background: transparent; }
        .discard-btn:hover { border-color: var(--purple); background: rgba(176,38,255,0.1); }
        .discard-count { font-size: 18px; font-weight: bold; color: rgba(255,255,255,0.15); }
        .discard-label { font-size: 10px; color: var(--purple); text-transform: uppercase; letter-spacing: 0.1em; font-weight: bold; margin-top: 4px; }

        .end-turn-btn {
            border-radius: 4px; font-weight: bold; letter-spacing: 0.15em; font-size: 0.75rem; text-transform: uppercase;
            background: transparent; border: 1px solid var(--teal); color: var(--teal);
            display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.3s; min-height: 44px;
        }
        .end-turn-btn:hover { background: var(--teal); color: black; box-shadow: 0 0 20px var(--teal-glow); }
        .end-turn-btn:disabled { border-color: rgba(255,255,255,0.1) !important; color: rgba(255,255,255,0.2) !important; box-shadow: none !important; cursor: not-allowed; background: transparent !important; }

        .btn-undo { border-color: var(--orange); color: var(--orange); }
        .btn-undo:hover { background: var(--orange); color: black; box-shadow: 0 0 15px var(--orange-glow); }

        .damage-banner {
            background: rgba(255,51,51,0.1); border: 1px solid var(--red); color: var(--red);
            padding: 8px 12px; border-radius: 4px; font-family: 'Arimo', sans-serif; font-size: 12px;
            display: flex; align-items: center; justify-content: center; gap: 8px; animation: pulse 2s infinite; box-shadow: inset 0 0 10px rgba(255,0,0,0.2); margin-bottom: 8px; width: 100%;
        }

        /* --- PLAYER HAND --- */
        #player-hand-container {
            height: 160px; background: rgba(0,0,0,0.6); border-top: 1px solid rgba(255,255,255,0.08);
            padding: 24px 16px 16px 16px; display: flex; justify-content: center; align-items: flex-end;
            position: relative; z-index: 50; transition: z-index 0.2s;
            backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        }
        .hand-label { position: absolute; top: 8px; left: 16px; font-size: 10px; letter-spacing: 0.1em; color: var(--teal); opacity: 0.5; display: flex; align-items: center; gap: 8px; }
        .hand-cards { display: flex; justify-content: center; align-items: flex-end; width: 100%; padding: 0 8px; max-width: 1000px; margin: 0 auto; flex-wrap: nowrap; }
        .hand-card-wrapper { transition: transform 0.2s; position: relative; margin-left: -12px; }
        .hand-card-wrapper:first-child { margin-left: 0 !important; }
        .hand-card-wrapper:hover { z-index: 50 !important; }

        .lock-overlay {
            position: absolute; inset: 0; background: rgba(6,8,10,0.7); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
            display: flex; align-items: center; justify-content: center; z-index: 60;
        }
        .lock-text {
            font-size: 1.25rem; font-family: 'Arimo', sans-serif; color: var(--red); font-weight: bold; letter-spacing: 0.3em;
            animation: pulse 2s infinite; text-shadow: 0 0 10px var(--red-glow); border: 1px solid rgba(239,68,68,0.5);
            background: rgba(69,10,10,0.3); padding: 8px 24px; border-radius: 8px;
        }

        /* --- SYSTEM LOG --- */
        .system-log {
            position: absolute; top: 70px; right: 16px; width: 300px; max-height: 250px;
            background: rgba(6,8,10,0.6); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px;
            display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.5); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 99999;
            transition: transform 0.3s ease, opacity 0.3s ease;
        }
        .system-log.collapsed { transform: translateX(120%); opacity: 0; pointer-events: none; }
        .log-header { background: rgba(6,8,10,0.6); border-bottom: 1px solid rgba(255,255,255,0.08); padding: 8px 12px; font-size: 10px; color: var(--grey); text-transform: uppercase; letter-spacing: 0.1em; display: flex; justify-content: space-between; align-items: center; }
        .log-body { flex: 1; overflow-y: auto; padding: 12px; font-size: 11px; color: var(--text-main); display: flex; flex-direction: column; gap: 8px; line-height: 1.4; }
        .log-entry { opacity: 0.7; animation: fadeIn 0.3s ease-out forwards; }
        .log-entry strong { color: white; }

        /* --- DYNAMIC NOTICES --- */
        .helper-banner {
            position: absolute; bottom: 180px; left: 50%; transform: translateX(-50%); width: 90%; max-width: 500px;
            background: rgba(6,8,10,0.95); border: 1px solid var(--orange); border-radius: 6px; box-shadow: 0 0 20px rgba(251,146,60,0.2);
            padding: 12px; display: flex; gap: 12px; align-items: flex-start; z-index: 99999; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        }
        
        .breach-modal {
            background: rgba(6,8,10,0.95); border: 1px solid var(--red); padding: 32px; border-radius: 8px;
            display: flex; flex-direction: column; align-items: center; box-shadow: 0 0 40px var(--red-glow), inset 0 0 20px rgba(255,0,0,0.05); text-align: center; max-width: 400px; width: 90%;
            pointer-events: auto; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        }
        .breach-modal.defend { border-color: var(--teal); box-shadow: 0 0 40px var(--teal-glow), inset 0 0 20px rgba(0,240,255,0.1); animation: none; }
        
        .firewall-banner {
            position: absolute; top: 80px; left: 0; right: 0; display: flex; justify-content: center; z-index: 45; pointer-events: none; padding: 0 8px;
        }
        .firewall-text { background: rgba(255,0,0,0.1); border: 1px solid var(--red); color: var(--red); padding: 6px 16px; border-radius: 4px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; box-shadow: 0 0 15px var(--red-glow); animation: pulse 1s infinite; font-weight: bold; }

        /* --- MOBILE TWEAKS (optimised for card visualisation) --- */
        @media (max-width: 768px) {
            /* Compact header: square logo, no power/home, no clipped controls */
            header {
                padding: 6px 8px;
                flex-wrap: nowrap;
                align-items: center;
                min-height: 0;
                gap: 6px;
            }
            .hdr-logo-link {
                align-self: center;
                display: flex;
                align-items: center;
                flex-shrink: 0;
            }
            .hdr-logo-img {
                height: 44px;
                width: 44px;
                object-fit: cover;
                border-radius: 6px;
                border: 1px solid rgba(255,255,255,0.12);
            }
            .header-controls {
                gap: 4px;
                flex: 1;
                min-width: 0;
                justify-content: flex-end;
                flex-wrap: wrap;
                align-items: center;
                /* no max-height / overflow ,  never clip BUY NOW, HOW TO PLAY, or turn name */
            }
            .hide-on-mobile-hdr { display: none !important; }
            #btn-abort, #btn-home { display: none !important; }
            /* Turn name: ellipsis instead of hard truncate */
            #header-turn-indicator {
                max-width: 38vw;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                flex-shrink: 1;
                min-width: 0;
                padding-left: 6px;
                padding-right: 6px;
            }
            #header-turn-name {
                display: inline;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            /* Slightly larger player cards for readability */
            .card { width: 54px; height: 78px; border-radius: 5px; }
            .plus-one-badge { font-size: 8px; padding: 1px 3px; top: -4px; right: -4px; }
            
            .dock { width: 76px; height: 110px; padding: 3px; }
            .docks-container { gap: 10px; }
            .arena { gap: 12px; padding: 8px 6px; }
            .dock-label { font-size: 7px; top: 3px;}
            .dock-value { width: 22px; height: 22px; top: -10px; right: -10px; font-size: 12px;}
            
            .controls-bar { gap: 8px; padding: 8px 10px; }
            .controls-bar .deck-btn { width: 50px; height: 58px; }
            .deck-count, .discard-count { font-size: 14px; }
            .controls-bar .end-turn-btn { padding: 8px 12px; font-size: 0.7rem; min-height: 40px; }
            .controls-bar .damage-banner { padding: 5px 8px; font-size: 10px; }
            
            #player-hand-container { 
                height: 128px; 
                padding: 14px 4px calc(4px + env(safe-area-inset-bottom)) 4px;
            }
            .hand-label { font-size: 9px; top: 4px; left: 8px; }
            /* Tighter fan so player cards never fully stack */
            .hand-card-wrapper { margin-left: -10px; }
            
            .helper-banner { bottom: 140px; font-size: 11px; padding: 10px; width: 95%;}
            .system-log { top: 60px; right: 10px; width: 240px; height: 200px; }
            
            .modal { padding: 16px; width: 95%; margin: auto; }
            .hide-mobile { display: none !important; }
            
            .btn-header { padding: 5px 8px; min-height: 28px; font-size: 0.72rem;}
            .btn-buy-now, .btn-how-to { padding: 5px 8px; min-height: 28px; font-size: 0.72rem;}

            /* Kill the AI status overlay on all viewports */
            #ai-protocol-badge { display: none !important; }
        }

        @media (max-width: 400px) {
            .card { width: 50px; height: 72px; }
            .dock { width: 68px; height: 98px; }
            .docks-container { gap: 7px; }
            .controls-bar { padding: 6px 8px; gap: 6px; }
            .controls-bar .deck-btn { width: 46px; height: 54px; }
            .controls-bar .end-turn-btn { padding: 8px 10px; font-size: 0.65rem; }
            #player-hand-container { height: 122px; }
        }
        
        @media (max-height: 650px) {
            .arena { gap: 20px; padding: 10px; }
            .helper-banner { bottom: 130px; }
        }

        /* --- ANIMATIONS --- */
        @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
        
        @keyframes defendPulse { 
            0%, 100% { box-shadow: 0 0 15px rgba(0,240,255,0.6); transform: translateY(-30px) scale(1.1); border-color: white; } 
            50% { box-shadow: 0 0 30px rgba(0,240,255,1); transform: translateY(-40px) scale(1.15); border-color: white; } 
        }
        
        .animate-screen-shake { animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
        @keyframes screenShake {
          0%, 100% { transform: translate(0, 0); }
          10%, 30%, 50%, 70%, 90% { transform: translate(-8px, 5px) rotate(-1deg); }
          20%, 40%, 60%, 80% { transform: translate(8px, -5px) rotate(1deg); }
        }

        .animate-dock-shake { animation: dockShake 0.15s ease-in-out infinite; z-index: 40;}
        @keyframes dockShake {
          0%, 100% { transform: translateX(0) scale(1.05); }
          25% { transform: translateX(-4px) scale(1.05) rotate(-2deg); }
          50% { transform: translateX(4px) scale(1.05) rotate(2deg); }
          75% { transform: translateX(-4px) scale(1.05) rotate(-2deg); }
        }

        /* Scrollbar */
        ::-webkit-scrollbar { width: 4px; }
        ::-webkit-scrollbar-track { background: transparent; }
        ::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 2px; }

        /* ═══════════ LIVE-DEBUG CHROME (match index site) ═══════════ */
        header { backdrop-filter: blur(8px); }
        .btn-header, .btn-buy-now, .btn-how-to, .btn-retro, #btn-mode-toggle,
        .setting-row span, .modal-header, .log-header, .helper-banner,
        .header-title, #header-turn-indicator { font-family: var(--mono) !important; }

        /* bracket-style header buttons */
        .btn-buy-now {
            font-family: var(--mono) !important;
            border:1px solid var(--tripwire-orange) !important;
            color: var(--tripwire-orange) !important;
            text-shadow: 0 0 8px rgba(255,140,0,0.4);
            letter-spacing: 0.12em;
        }
        .btn-buy-now:hover { background: var(--tripwire-orange) !important; color:#000 !important; text-shadow:none; }

        /* lobby PLAY button glow-green, BUY orange ,  match site nav */
        .btn-retro.btn-play { color: var(--wild-green) !important; border-color: var(--wild-green) !important; text-shadow: 0 0 10px rgba(34,197,94,0.5); }
        .btn-retro.btn-play:hover { background: var(--wild-green) !important; color:#000 !important; text-shadow:none; }
        .btn-retro.btn-buy { color: var(--tripwire-orange) !important; border-color: var(--tripwire-orange) !important; text-shadow: 0 0 10px rgba(255,140,0,0.5); }
        .btn-retro.btn-buy:hover { background: var(--tripwire-orange) !important; color:#000 !important; text-shadow:none; }

        /* hex ticks down left edge, like the site */
        @media (min-width: 900px) {
            #screen-lobby::before {
                content: "0x00 \A 0x10 \A 0x20 \A 0x30 \A 0x40 \A 0x50 \A 0x60 \A 0x70 \A 0x80 \A 0x90 \A 0xA0";
                white-space: pre; position: absolute; top: 80px; left: 14px;
                font-family: var(--mono); font-size: 9px; line-height: 3.0;
                letter-spacing: 0.08em; color: rgba(0,242,255,0.14);
                pointer-events: none; user-select: none;
            }
        }

        /* ── STICKY BUY (bottom corner, like index sticky-buy) ── */
        #sticky-buy-play {
            position: fixed; right: 14px; bottom: 14px; z-index: 500;
            display: inline-flex; align-items: center; gap: 8px;
            font-family: var(--mono); font-size: 12px; font-weight: 700;
            letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
            padding: 10px 16px; border-radius: 6px;
            color: var(--tripwire-orange); background: rgba(6,8,10,0.9);
            border: 1px solid var(--tripwire-orange);
            box-shadow: 0 0 18px rgba(255,140,0,0.25); backdrop-filter: blur(8px);
            transition: all 0.25s; animation: sticky-buy-pulse 3s ease-in-out infinite;
        }
        #sticky-buy-play:hover { background: var(--tripwire-orange); color:#000; box-shadow: 0 0 28px rgba(255,140,0,0.6); }
        #sticky-buy-play .sb-price { color:#fff; }
        #sticky-buy-play:hover .sb-price { color:#000; }
        @keyframes sticky-buy-pulse {
            0%,100% { box-shadow: 0 0 14px rgba(255,140,0,0.2); }
            50%     { box-shadow: 0 0 26px rgba(255,140,0,0.5); }
        }
        /* hide sticky buy during active play so it never covers the hand */
        body.in-game #sticky-buy-play { display: none; }
        @media (max-width: 640px) { #sticky-buy-play { font-size: 10px; padding: 8px 12px; right: 10px; bottom: 10px; } }

        /* ── BOOT COMPILE overlay (mirrors index boot) ── */
        #play-boot {
            position: fixed; inset: 0; z-index: 99999;
            background:
              radial-gradient(ellipse at 30% 38%, rgba(74,222,128,0.10), transparent 55%),
              radial-gradient(ellipse at 50% 42%, rgba(45,212,191,0.13), transparent 62%),
              radial-gradient(ellipse at 72% 62%, rgba(251,146,60,0.09), transparent 55%),
              radial-gradient(ellipse at 50% 100%, rgba(188,19,254,0.11), transparent 60%),
              var(--bg-main);
            display: flex; align-items: center; justify-content: center;
            font-family: var(--mono); transition: opacity 0.5s ease; overflow: hidden;
        }
        /* faint cyber grid */
        #play-boot .pb-grid {
            position: absolute; inset: -10%;
            background-image:
              linear-gradient(rgba(45,212,191,0.055) 1px, transparent 1px),
              linear-gradient(90deg, rgba(45,212,191,0.055) 1px, transparent 1px);
            background-size: 46px 46px;
            mask-image: radial-gradient(ellipse at 50% 45%, #000 35%, transparent 78%);
            -webkit-mask-image: radial-gradient(ellipse at 50% 45%, #000 35%, transparent 78%);
            animation: pb-drift 22s linear infinite;
        }
        @keyframes pb-drift { to { transform: translateY(-46px); } }
        #play-boot .pb-stack {
            position: relative; z-index: 2;
            display: flex; flex-direction: column; align-items: center;
            padding: 0 24px; width: 100%; max-width: 460px;
        }
        #play-boot .pb-logo {
            width: min(74vw, 340px); height: auto; display: block;
            filter: drop-shadow(0 0 26px rgba(45,212,191,0.45)) drop-shadow(0 0 60px rgba(188,19,254,0.22));
            animation: pb-logo-in 0.9s cubic-bezier(.2,.7,.3,1) both, pb-pulse 3.4s ease-in-out 0.9s infinite;
        }
        @keyframes pb-logo-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
        @keyframes pb-pulse { 50% { filter: drop-shadow(0 0 34px rgba(45,212,191,0.62)) drop-shadow(0 0 74px rgba(188,19,254,0.3)); } }
        #play-boot .pb-tag {
            margin-top: 2px; font-size: 9.5px; letter-spacing: 0.3em; text-transform: uppercase;
            opacity: 0; animation: pb-fade 0.6s ease 0.5s forwards; text-align: center;
            background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange));
            -webkit-background-clip: text; background-clip: text; color: transparent;
        }
        @keyframes pb-fade { to { opacity: 0.9; } }
        #play-boot .pb-bar {
            margin: 20px 0 16px; width: min(62vw, 240px); height: 2px;
            background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
        }
        #play-boot .pb-bar span {
            display: block; height: 100%; width: 0;
            background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange));
            box-shadow: 0 0 12px var(--teal-glow);
            animation: pb-load 1.5s ease-out 0.35s forwards;
        }
        @keyframes pb-load { to { width: 100%; } }
        #play-boot .pb-lines { display: flex; flex-direction: column; gap: 5px; align-items: center; }
        #play-boot .pb-line { color: var(--wild-green); font-size: 10.5px; letter-spacing: 0.12em; opacity:0; }
        #play-boot .pb-line.on { opacity: 1; }
        #play-boot .pb-caret { display:inline-block; width:8px; height:13px; background: var(--defuse-cyan); margin-left:3px; vertical-align:-2px; animation: pb-caret 0.8s steps(2) infinite; }
        @keyframes pb-caret { 50% { opacity: 0; } }
        #play-boot.done { opacity: 0; pointer-events: none; }

    
        /* ══════════════ VISUAL POLISH LAYER (aesthetic-preserving) ══════════════ */

        /* ── ambient board depth: vignette + colour wash + data grid ── */
        body {
            background-image:
                radial-gradient(1200px 700px at 18% -8%,  rgba(45,212,191,0.07), transparent 60%),
                radial-gradient(1100px 700px at 88% 108%, rgba(192,132,252,0.06), transparent 60%),
                radial-gradient(140% 100% at 50% 50%,     transparent 55%, rgba(0,0,0,0.55) 100%),
                repeating-linear-gradient(0deg,  rgba(255,255,255,0.022) 0 1px, transparent 1px 44px),
                repeating-linear-gradient(90deg, rgba(255,255,255,0.022) 0 1px, transparent 1px 44px);
            background-attachment: fixed;
        }

        /* ── docks: resting depth, hover lift, colour-coded value chips ── */
        .dock { box-shadow: 0 12px 26px rgba(0,0,0,0.45); }
        .dock:not(.empty):not(.valid-target):hover { transform: translateY(-3px); box-shadow: 0 18px 32px rgba(0,0,0,0.55); }
        .dock.empty { background: rgba(255,255,255,0.015); }
        .dock.empty:not(.red-dock)::after {
            content: "AWAIT DATA"; position: absolute; bottom: 10px; left: 0; width: 100%;
            text-align: center; font-size: 7px; letter-spacing: 0.14em;
            color: rgba(255,255,255,0.28); pointer-events: none;
        }
        .dock.teal   .dock-value { border-color: rgba(45,212,191,0.55);  color: var(--teal); }
        .dock.purple .dock-value { border-color: rgba(192,132,252,0.55); color: var(--purple); }
        .dock.orange .dock-value { border-color: rgba(251,146,60,0.55);  color: var(--orange); }
        .dock.red-dock .dock-value { border-color: rgba(239,68,68,0.6);  color: #ff8f8f; }
        .dock-value { transition: border-color 0.25s, color 0.25s, box-shadow 0.25s; }
        .dock-value.dock-open { border-color: var(--green) !important; color: var(--green) !important; box-shadow: 0 0 12px var(--green-glow), 0 4px 6px rgba(0,0,0,0.8); }
        .dock-open-tag {
            position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%);
            font-size: 7px; font-weight: 800; letter-spacing: 0.12em; color: var(--green);
            background: var(--bg-main); padding: 2px 5px; border-radius: 3px;
            border: 1px solid var(--green); white-space: nowrap; font-family: var(--mono);
            z-index: 26; pointer-events: none;
        }
        /* Clip only the background art, not badges */
        .dock-bg-art { border-radius: 6px; overflow: hidden; }
        .dock-cards { overflow: visible; }

        /* ── valid-target: pulsing landing beacon ── */
        @keyframes targetPulse {
            0%, 100% { box-shadow: 0 0 16px var(--green-glow), 0 0 0 0 rgba(74,222,128,0.35); }
            50%      { box-shadow: 0 0 30px var(--green-glow), 0 0 0 7px rgba(74,222,128,0); }
        }
        .dock.valid-target { animation: targetPulse 1.15s ease-in-out infinite; }
        .dock.valid-target .dock-value { border-color: var(--green); color: var(--green); box-shadow: 0 0 10px var(--green-glow), 0 4px 6px rgba(0,0,0,0.8); }

        /* ── hand cards: deeper rest, springier hover, luminous selection ── */
        .card { box-shadow: 0 4px 12px rgba(0,0,0,0.55); }
        .card:hover { transform: translateY(-10px) scale(1.04); box-shadow: 0 16px 28px rgba(0,0,0,0.72); }
        .card.selected {
            transform: translateY(-22px) scale(1.05);
            box-shadow: 0 0 22px rgba(45,212,191,0.45), 0 16px 30px rgba(0,0,0,0.75);
            border: 2px solid #fff !important;
        }
        .hand-card-wrapper:hover { transform: translateY(-2px); }

        /* ── hand tray: uplink hairline + depth ── */
        #player-hand-container {
            background: linear-gradient(180deg, rgba(6,10,12,0.72), rgba(4,6,8,0.86));
            border-top: 1px solid rgba(45,212,191,0.22);
            box-shadow: 0 -20px 44px rgba(0,0,0,0.5), inset 0 1px 0 rgba(45,212,191,0.10);
        }
        .hand-label { opacity: 0.65; text-shadow: 0 0 8px rgba(45,212,191,0.35); }

        /* ── damage banner: hotter threat glow ── */
        .damage-banner { box-shadow: inset 0 0 14px rgba(255,0,0,0.25), 0 0 18px rgba(239,68,68,0.28); }

        /* ── system log: hairline + thin scrollbar ── */
        .system-log { border-color: rgba(45,212,191,0.14); }
        .system-log ::-webkit-scrollbar, .system-log::-webkit-scrollbar { width: 5px; }
        .system-log ::-webkit-scrollbar-thumb, .system-log::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
        .system-log ::-webkit-scrollbar-track, .system-log::-webkit-scrollbar-track { background: transparent; }

        /* ── header: seat the controls on the ambient glow ── */
        header { box-shadow: 0 10px 30px rgba(0,0,0,0.45); }

        /* ── calm mode ── */
        @media (prefers-reduced-motion: reduce) {
            .dock.valid-target, .damage-banner, .firewall-text, .lock-text { animation: none !important; }
            .card, .dock, .hand-card-wrapper { transition: none !important; }
        }
        /* ══════════════ END VISUAL POLISH LAYER ══════════════ */
    


        #legal-gate {
            position: fixed; inset: 0; z-index: 2147483647;
            display: flex; align-items: center; justify-content: center;
            padding: 24px; overflow-y: auto;
            background:
              radial-gradient(circle at 50% 20%, rgba(45,212,191,0.10), transparent 60%),
              #06080a;
            font-family: 'Arimo', Arial, sans-serif;
        }
        #legal-gate.dismissed { display: none; }
        /* ── Wireburn neon spectrum (from brand art): green → teal → purple → orange ── */
        .wb-neon-grad {
            background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange));
            -webkit-background-clip: text; background-clip: text; color: transparent;
        }
        .lg-card {
            position: relative; overflow: hidden;
            width: 100%; max-width: 480px;
            background: var(--bg-panel);
            border: 1px solid var(--border-color);
            border-radius: 8px; padding: 30px 26px 28px;
            box-shadow: 0 0 50px rgba(45,212,191,0.12), inset 0 0 40px rgba(0,0,0,0.4);
            margin: auto;
        }
        .lg-card::before {
            content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange));
            box-shadow: 0 0 14px rgba(45,212,191,0.5);
        }
        .lg-badge {
            font-family: var(--mono);
            font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase;
            margin-bottom: 14px;
            background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange));
            -webkit-background-clip: text; background-clip: text; color: transparent;
        }
        .lg-title {
            font-family: var(--mono);
            font-weight: 800; font-size: 1.6rem; letter-spacing: 0.04em;
            margin: 0 0 16px 0;
            background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange));
            -webkit-background-clip: text; background-clip: text; color: transparent;
        }
        .lg-body p {
            font-size: 0.82rem; line-height: 1.6; color: #94a3b8; margin: 0 0 12px 0;
        }
        .lg-body strong { color: var(--orange); }
        .lg-link { color: var(--teal); text-decoration: underline; }
        .lg-link:hover { color: var(--orange); }
        .lg-fine { font-size: 0.70rem !important; color: #64748b !important; border-top: 1px solid rgba(255,255,255,0.07); padding-top: 10px; }
        .lg-check {
            display: flex; align-items: flex-start; gap: 10px;
            margin: 18px 0 20px 0; cursor: pointer;
            font-size: 0.82rem; color: #e5e7eb; line-height: 1.4;
        }
        .lg-check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
        .lg-play {
            width: 100%; padding: 14px; font-family: 'Arimo', sans-serif;
            font-weight: bold; font-size: 1.1rem; letter-spacing: 0.15em; text-transform: uppercase;
            color: var(--green); background: transparent; border: 2px solid var(--green); border-radius: 5px;
            cursor: pointer; transition: all 0.3s ease;
            box-shadow: 0 0 15px var(--green-glow), inset 0 0 10px var(--green-glow);
        }
        .lg-play:hover:not(:disabled) { background: var(--green); color: black; box-shadow: 0 0 30px var(--green-glow); }
        .lg-play:disabled { border-color: rgba(255,255,255,0.15); color: #4b5563; box-shadow: none; cursor: not-allowed; }
        .lg-credits {
            display: block; margin: 16px auto 0; padding: 4px;
            background: none; border: none; cursor: pointer;
            font-family: 'JetBrains Mono', 'Courier New', monospace;
            font-size: 11px; letter-spacing: 0.1em; color: #64748b;
        }
        .lg-credits:hover { color: var(--teal); }
        .lg-credits-box {
            display: none; margin-top: 12px; padding: 14px;
            background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08);
            border-radius: 5px;
        }
        .lg-credits-box.open { display: block; }
        .lg-credits-box p { font-size: 0.72rem; line-height: 1.5; color: #94a3b8; margin: 0 0 8px 0; }
        .lg-credits-box p:last-child { margin-bottom: 0; }
        .lg-credits-box code { color: var(--teal); font-family: 'JetBrains Mono', monospace; }
    


        #install-chip {
            position: fixed; top: 12px; right: 12px; z-index: 3000000; display: none;
            font-family: 'Arimo', sans-serif; font-weight: bold; font-size: 0.72rem; letter-spacing: 0.1em;
            text-transform: uppercase; color: var(--teal); background: rgba(6,8,10,0.9);
            border: 1.5px solid var(--teal); border-radius: 6px; padding: 8px 12px; cursor: pointer;
            box-shadow: 0 0 14px var(--teal-glow); transition: all .2s;
        }
        #install-chip.show { display: block; }
        #install-chip:hover { background: var(--teal); color: #06080a; }

        #install-panel {
            position: fixed; inset: 0; z-index: 3200000; display: none;
            align-items: center; justify-content: center; padding: 20px;
            background: rgba(2,4,6,0.82);
        }
        #install-panel.show { display: flex; }
        #install-panel .ip-card {
            position: relative; width: 100%; max-width: 380px;
            background: var(--bg-panel, #0c1014); border: 1px solid var(--teal);
            border-radius: 10px; padding: 24px 22px;
            box-shadow: 0 0 40px rgba(45,212,191,0.25);
            font-family: 'Arimo', sans-serif; color: var(--text-main, #e5e7eb);
        }
        #install-panel .ip-close {
            position: absolute; top: 10px; right: 12px; background: transparent; border: none;
            color: #94a3b8; font-size: 1.5rem; line-height: 1; cursor: pointer;
        }
        #install-panel .ip-title {
            font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 0.95rem;
            letter-spacing: 0.15em; color: var(--teal); margin-bottom: 14px; text-align: center;
        }
        #install-panel .ip-body { font-size: 0.9rem; line-height: 1.55; }
        #install-panel .ip-body b { color: var(--teal); }
        #install-panel .ip-step { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
        #install-panel .ip-num {
            flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
            background: var(--teal); color: #06080a; font-weight: 800; font-size: 0.8rem;
            display: flex; align-items: center; justify-content: center;
        }
        #install-panel .ip-btn {
            display: block; width: 100%; margin-top: 16px; padding: 13px;
            font-family: 'Arimo', sans-serif; font-weight: bold; letter-spacing: 0.1em; text-transform: uppercase;
            background: var(--teal); color: #06080a; border: none; border-radius: 6px; cursor: pointer; font-size: 0.95rem;
        }
        #install-panel .ip-btn:hover { box-shadow: 0 0 22px var(--teal-glow); }
    


        @keyframes nullClausePulse {
            0% { transform: scale(0.3); opacity: 0; }
            60% { transform: scale(1.15); opacity: 1; }
            100% { transform: scale(1); opacity: 1; }
        }
        @keyframes nullClauseFlash {
            from { opacity: 0.6; }
            to { opacity: 1; }
        }
    


        #tutorial-overlay {
            position: fixed; inset: 0; z-index: 3600000; display: none;
            background:
                linear-gradient(rgba(0,242,255,0.05) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0,242,255,0.05) 1px, transparent 1px),
                radial-gradient(ellipse at 50% 0%, rgba(45,212,191,0.10), transparent 60%),
                radial-gradient(ellipse at 50% -10%, rgba(188,19,254,0.06), transparent 60%),
                var(--bg-main);
            background-size: 40px 40px, 40px 40px, 100% 100%, 100% 100%, 100% 100%;
            font-family: 'Arimo', Arial, sans-serif; overflow-y: auto;
        }
        #tutorial-overlay.open { display: flex; }
        .tut-frame { width: 100%; max-width: 560px; margin: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; min-height: 100%; }
        .tut-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
        .tut-brand { font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em; background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
        .tut-exit { background: none; border: 1px solid var(--border-color); color: var(--grey); font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
        .tut-exit:hover { color: #fff; border-color: #ef4444; }
        .tut-progress { height: 3px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; margin-bottom: 18px; }
        .tut-progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange)); transition: width .35s ease; }

        .tut-board { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; min-height: 130px; align-items: center; margin-bottom: 6px; }
        .tut-dock {
            width: 78px; height: 108px; border-radius: 8px; position: relative;
            border: 1.5px dashed rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center;
            background: rgba(255,255,255,0.02); transition: all .2s; flex-shrink: 0;
        }
        .tut-dock .tut-dock-name { position: absolute; top: 5px; left: 0; right: 0; text-align: center; font-size: 8px; letter-spacing: 0.15em; color: rgba(255,255,255,0.55); font-weight: 700; z-index: 3; }
        .tut-dock-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; z-index: 0; transition: opacity .3s ease; }
        .tut-offline { font-size: 8.5px; letter-spacing: 0.12em; opacity: 0.35; font-family: 'Arimo', sans-serif; position: relative; z-index: 1; }
        .tut-dock.tut-target { border-style: solid; border-color: #2dd4bf; box-shadow: 0 0 18px rgba(45,212,191,0.5); cursor: pointer; animation: tutPulse 1.2s infinite; }
        @keyframes tutPulse { 50% { box-shadow: 0 0 26px rgba(45,212,191,0.8); } }
        .tut-dock-badge { position: absolute; top: -12px; right: -12px; width: 28px; height: 28px; border-radius: 50%; background: #06080a; border: 1.5px solid rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
        .tut-dock-badge.open { border-color: #22c55e; color: #22c55e; }
        .tut-open-tag { position: absolute; bottom: -11px; left: 50%; transform: translateX(-50%); font-size: 7px; font-weight: 800; letter-spacing: 0.1em; color: #22c55e; background: #06080a; padding: 1px 4px; border-radius: 3px; border: 1px solid #22c55e; }

        .tut-card {
            width: 62px; height: 92px; border-radius: 7px; position: relative;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            font-weight: 800; border: 1.5px solid; background: #0c1014; transition: transform .15s, box-shadow .15s; flex-shrink: 0;
        }
        .tut-card .tv { font-size: 30px; line-height: 1; }
        .tut-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; z-index: 2; transition: opacity .25s ease; }
        /* When a card has real art, hide the CSS number/label until the image resolves
           (loads = image covers it; fails = .art-failed reveals text as fallback). */
        .tut-card.has-art .tv, .tut-card.has-art .tl { opacity: 0; transition: opacity .2s; }
        .tut-card.has-art.art-failed .tv, .tut-card.has-art.art-failed .tl { opacity: 1; }
        .tut-card .tl { font-size: 8px; letter-spacing: 0.12em; margin-top: 5px; opacity: 0.85; }
        .tut-card.teal   { border-color: var(--teal); color: var(--teal); }
        .tut-card.purple { border-color: var(--purple); color: var(--purple); }
        .tut-card.orange { border-color: var(--orange); color: var(--orange); }
        .tut-card.grey   { border-color: var(--grey); color: var(--text-main); }
        .tut-card.volt   { border-color: var(--wild-green); color: var(--wild-green); background: rgba(34,197,94,0.06); }
        .tut-card.stasis { border-color: var(--wild-green); color: var(--wild-green); background: rgba(34,197,94,0.06); }
        .tut-card.null   { border-color: #e5e7eb; color: #e5e7eb; background: rgba(255,255,255,0.04); }
        .tut-card.modifier { border-color: var(--grey); color: var(--text-main); background: rgba(148,163,184,0.08); }
        .tut-card.on-dock { width: 58px; height: 86px; }
        .tut-card.tut-playable { cursor: pointer; box-shadow: 0 0 14px rgba(45,212,191,0.45); animation: tutCardPulse 1.2s infinite; }
        @keyframes tutCardPulse { 50% { box-shadow: 0 0 22px rgba(45,212,191,0.75); transform: translateY(-4px); } }
        .tut-card.tut-selected { transform: translateY(-8px); box-shadow: 0 0 22px var(--orange-glow); border-color: var(--orange); }
        .tut-card.tut-dim { opacity: 0.35; }

        .tut-coach { position: relative; overflow: hidden; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 8px; padding: 15px 16px 15px 18px; margin: 14px 0; }
        .tut-coach::before { content:''; position:absolute; top:0; left:0; bottom:0; width:3px; background: linear-gradient(180deg, var(--wild-green), var(--teal), var(--purple), var(--orange)); }
        .tut-coach-title { font-family: var(--mono); font-weight: 800; font-size: 0.95rem; margin-bottom: 7px; letter-spacing: 0.02em; background: linear-gradient(90deg, var(--wild-green), var(--teal), var(--purple), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
        .tut-coach-text { font-size: 0.86rem; line-height: 1.55; color: #cbd5e1; }
        .tut-coach-text b { color: var(--orange); }
        .tut-hint { font-size: 0.78rem; color: var(--orange); margin-top: 10px; font-family: var(--mono); letter-spacing: 0.03em; min-height: 1em; }

        .tut-hand-wrap { margin-top: 4px; }
        .tut-hand-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: #64748b; text-align: center; margin-bottom: 8px; }
        .tut-hand { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; min-height: 92px; align-items: center; }

        .tut-controls { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
        .tut-btn { padding: 12px 22px; font-family: 'Arimo', sans-serif; font-weight: bold; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.12em; border-radius: 5px; cursor: pointer; transition: all 0.3s ease; }
        .tut-skip { background: transparent; border: 1px solid var(--border-color); color: var(--grey); }
        .tut-skip:hover { color: var(--text-main); }
        .tut-next { background: transparent; border: 2px solid var(--green); color: var(--green); box-shadow: 0 0 15px var(--green-glow), inset 0 0 10px var(--green-glow); }
        .tut-next:hover:not(:disabled) { background: var(--green); color: black; box-shadow: 0 0 30px var(--green-glow); }
        .tut-next:disabled { border-color: rgba(255,255,255,0.15); color: #4b5563; box-shadow: none; cursor: not-allowed; }
        @media (max-width: 420px) {
            .tut-dock { width: 66px; height: 94px; }
            .tut-card { width: 54px; height: 80px; } .tut-card .tv { font-size: 26px; }
        }
    
/* Focus visibility and motion preferences, preserving the original visual theme. */
:root { --cyan: var(--defuse-cyan); }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible {
    outline: 2px solid var(--teal); outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    #play-particles { display: none; }
    #play-boot .pb-line { opacity: 1; }
}
