        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        :root {
            /* Core Palette */
            --bg: #0a0a14;
            --bg-deep: #050510;
            --bg2: #0e0e24;
            --bg3: #1a1a2e;
            /* Accent */
            --cyan: #06b6d4;
            --cyan-bright: #22d3ee;
            --cyan-deep: #0891b2;
            --green: #10b981;
            --purple: #8b5cf6;
            --pink: #ec4899;
            --orange: #f59e0b;
            --amber: #f59e0b;
            --amber-deep: #b45309;
            --red: #ef4444;
            --acid-green: #84cc16;
            --blue-lab: #3b82f6;
            /* Material */
            --wood: #8b6914;
            --wood-dark: #5a4310;
            --paper: #f5f5dc;
            --paper-dim: #d4cfa0;
            --glass: rgba(180, 220, 255, 0.12);
            --glass-bright: rgba(200, 240, 255, 0.4);
            /* Text */
            --text: #e2e8f0;
            --text-dim: #64748b;
            --text-bright: #f8fafc;
            /* Containers */
            --card-bg: rgba(12, 14, 32, 0.85);
            --card-bg-deep: rgba(8, 10, 24, 0.92);
            --border: rgba(6, 182, 212, 0.18);
            --border-bright: rgba(34, 211, 238, 0.5);
            /* Glow presets */
            --glow-cyan: 0 0 12px rgba(6, 182, 212, 0.45), 0 0 24px rgba(6, 182, 212, 0.2);
            --glow-amber: 0 0 12px rgba(245, 158, 11, 0.5), 0 0 28px rgba(245, 158, 11, 0.2);
            --glow-red: 0 0 12px rgba(239, 68, 68, 0.5), 0 0 28px rgba(239, 68, 68, 0.2);
            --glow-green: 0 0 12px rgba(16, 185, 129, 0.45), 0 0 24px rgba(16, 185, 129, 0.2);
            --glow-soft: 0 2px 12px rgba(0, 0, 0, 0.5);
            /* Easing */
            --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
            --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
            --ease-smooth: cubic-bezier(0.65, 0, 0.35, 1);
        }

        body {
            font-family: 'JetBrains Mono', monospace;
            background:
                radial-gradient(ellipse at top left, rgba(6,182,212,0.06), transparent 40%),
                radial-gradient(ellipse at bottom right, rgba(245,158,11,0.04), transparent 50%),
                linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
            color: var(--text);
            min-height: 100vh;
            overflow-x: hidden;
            touch-action: none;
            -webkit-user-select: none;
            user-select: none;
        }
        /* Global tone grading + vignette overlay (top layer for cinematic feel) */
        body::after {
            content: '';
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 99;
            background:
                radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.18) 100%),
                linear-gradient(180deg, rgba(6,182,212,0.015) 0%, transparent 30%, rgba(245,158,11,0.01) 100%);
            mix-blend-mode: overlay;
        }

        .cyber-bg {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background-image:
                linear-gradient(rgba(6,182,212,.04) 1px, transparent 1px),
                linear-gradient(90deg, rgba(6,182,212,.04) 1px, transparent 1px);
            background-size: 40px 40px;
            z-index: 0;
            pointer-events: none;
        }

        .scanlines {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: repeating-linear-gradient(
                0deg, transparent, transparent 2px,
                rgba(0, 0, 0, 0.03) 2px, rgba(0, 0, 0, 0.03) 4px
            );
            pointer-events: none;
            z-index: 100;
        }

        /* ===== Intro Screen ===== */
        #introScreen {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 200;
            background: #1a0a00;
        }
        #introCanvas {
            width: 100%;
            height: 100%;
            display: block;
        }
        #skipBtn {
            position: fixed;
            bottom: 30px;
            right: 30px;
            z-index: 201;
            background: rgba(0,0,0,0.6);
            color: #ccc;
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 8px;
            padding: 8px 20px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s;
        }
        #skipBtn:hover { background: rgba(255,255,255,0.15); color: #fff; }

        /* ===== App Container ===== */
        .app-container {
            position: relative;
            z-index: 1;
            max-width: 1400px;
            margin: 0 auto;
            padding: 10px;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        /* ===== Top Bar ===== */
        .top-bar {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 14px;
            background:
                linear-gradient(135deg, rgba(12,14,32,0.92), rgba(18,20,40,0.85));
            border: 1px solid rgba(34,211,238,0.25);
            border-radius: 14px;
            backdrop-filter: blur(16px) saturate(180%);
            margin-bottom: 8px;
            flex-wrap: wrap;
            box-shadow:
                inset 0 1px 0 rgba(34,211,238,0.15),
                0 4px 20px rgba(0,0,0,0.5),
                0 0 30px rgba(6,182,212,0.08);
            position: relative;
        }
        .top-bar::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(34,211,238,0.9), transparent);
        }
        .back-btn {
            background: rgba(6,182,212,0.1);
            border: 1px solid rgba(6,182,212,0.2);
            border-radius: 10px;
            padding: 6px 12px;
            color: var(--cyan);
            font-size: 13px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            text-decoration: none;
            transition: all 0.2s;
        }
        .back-btn:hover { background: rgba(6,182,212,0.2); }
        .page-title {
            font-family: 'Orbitron', 'Jua', sans-serif;
            font-weight: 900;
            font-size: 20px;
            letter-spacing: 2px;
            background: linear-gradient(135deg, var(--cyan-bright), var(--green), var(--cyan));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            flex: 1;
            text-transform: uppercase;
            filter: drop-shadow(0 0 8px rgba(6,182,212,0.5));
            position: relative;
        }
        .page-title::before {
            content: '◆ ';
            color: var(--cyan-bright);
            -webkit-text-fill-color: var(--cyan-bright);
            text-shadow: 0 0 8px rgba(6,182,212,0.8);
        }
        .page-title::after {
            content: ' ◆';
            color: var(--amber);
            -webkit-text-fill-color: var(--amber);
            text-shadow: 0 0 8px rgba(245,158,11,0.8);
        }
        .mission-display {
            background: rgba(139,92,246,0.1);
            border: 1px solid rgba(139,92,246,0.2);
            border-radius: 10px;
            padding: 5px 12px;
            font-size: 12px;
            cursor: pointer;
            max-width: 300px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .score-display {
            background: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(245,158,11,0.08));
            border: 1px solid rgba(245,158,11,0.45);
            border-radius: 10px;
            padding: 6px 14px;
            font-family: 'Orbitron', monospace;
            font-weight: 900;
            font-size: 14px;
            color: var(--amber);
            letter-spacing: 1.5px;
            text-shadow: 0 0 8px rgba(245,158,11,0.6);
            box-shadow:
                inset 0 1px 0 rgba(255,200,100,0.3),
                0 0 16px rgba(245,158,11,0.2);
        }
        .lang-toggle {
            background: rgba(6,182,212,0.1);
            border: 1px solid rgba(6,182,212,0.2);
            border-radius: 8px;
            padding: 4px 10px;
            color: var(--cyan);
            font-size: 12px;
            cursor: pointer;
        }
        .replay-btn {
            background: rgba(236,72,153,0.1);
            border: 1px solid rgba(236,72,153,0.2);
            border-radius: 8px;
            padding: 4px 10px;
            color: var(--pink);
            font-size: 11px;
            cursor: pointer;
        }
        .audio-ctrl {
            display: flex; align-items: center; gap: 4px;
            background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(6,182,212,0.02));
            border: 1px solid rgba(6,182,212,0.25);
            border-radius: 10px;
            padding: 3px 8px;
        }
        .audio-ctrl .replay-btn { background: transparent; border: none; padding: 2px 4px; color: var(--cyan-bright); }

        /* ===== Game Layout ===== */
        .game-layout {
            display: flex;
            gap: 8px;
            align-items: flex-start;
            flex: 1;
        }

        .side-panel {
            width: 175px;
            flex-shrink: 0;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 3px;
            background:
                linear-gradient(135deg, rgba(12,14,32,0.92), rgba(18,20,40,0.85)),
                repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(6,182,212,0.02) 2px, rgba(6,182,212,0.02) 3px);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 7px 6px;
            backdrop-filter: blur(16px) saturate(180%);
            max-height: calc(100vh - 100px);
            overflow-y: auto;
            align-content: start;
            box-shadow:
                inset 0 1px 0 rgba(34,211,238,0.15),
                inset 0 0 20px rgba(6,182,212,0.04),
                0 8px 32px rgba(0,0,0,0.5),
                0 0 20px rgba(6,182,212,0.08);
            position: relative;
        }
        /* 🆕 Photoshop-style floating panel mode */
        .side-panel.floating {
            position: fixed !important;
            z-index: 50;
            max-height: unset;
            resize: both;
            min-width: 140px;
            min-height: 200px;
            max-width: 600px;
        }
        .side-panel.floating::after {
            content: '';
            position: absolute;
            right: 0; bottom: 0;
            width: 14px; height: 14px;
            background: linear-gradient(135deg, transparent 50%, rgba(34,211,238,0.6) 55%, rgba(34,211,238,0.9) 100%);
            cursor: nwse-resize;
            pointer-events: none;
        }
        /* Drag handle (floating panels get a title bar) */
        .panel-drag-handle {
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 22px;
            background: linear-gradient(90deg, rgba(34,211,238,0.25), rgba(168,85,247,0.12));
            border-bottom: 1px solid rgba(34,211,238,0.3);
            border-radius: 14px 14px 0 0;
            cursor: move;
            display: none;
            align-items: center;
            justify-content: space-between;
            padding: 0 8px;
            font-size: 10px;
            color: #22d3ee;
            font-family: 'Orbitron', monospace;
            letter-spacing: 1px;
            grid-column: 1 / -1;
            z-index: 2;
        }
        .side-panel.floating .panel-drag-handle {
            display: flex;
        }
        .side-panel.floating { padding-top: 28px; }
        .panel-dock-btn {
            background: rgba(0,0,0,0.5);
            border: 1px solid rgba(34,211,238,0.4);
            color: #22d3ee;
            border-radius: 3px;
            padding: 1px 6px;
            font-size: 9px;
            cursor: pointer;
            font-family: inherit;
        }
        .panel-dock-btn:hover { background: rgba(34,211,238,0.2); }
        /* Float toggle button (clearly visible top-right of panel) */
        .panel-float-toggle {
            position: absolute;
            top: 4px;
            right: 4px;
            background: linear-gradient(135deg, rgba(34,211,238,0.25), rgba(168,85,247,0.15));
            border: 1.5px solid #22d3ee;
            color: #22d3ee;
            border-radius: 6px;
            padding: 4px 10px;
            font-size: 11px;
            cursor: pointer;
            z-index: 3;
            font-family: 'Jua', sans-serif;
            font-weight: bold;
            letter-spacing: 0.5px;
            box-shadow: 0 2px 6px rgba(34,211,238,0.3);
            transition: all 0.15s;
        }
        .panel-float-toggle::before { content: '⇱ '; font-size: 13px; }
        .panel-float-toggle:hover {
            background: linear-gradient(135deg, rgba(34,211,238,0.4), rgba(168,85,247,0.3));
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(34,211,238,0.5);
        }
        /* Hidden when floating (handle takes over) */
        .side-panel.floating .panel-float-toggle { display: none; }
        .side-panel::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(34,211,238,0.8), transparent);
        }
        .side-panel::after {
            content: '';
            position: absolute;
            bottom: 0; left: 0; right: 0;
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(245,158,11,0.3), transparent);
        }
        .side-panel::-webkit-scrollbar { width: 3px; }
        .side-panel::-webkit-scrollbar-thumb { background: rgba(6,182,212,0.2); border-radius: 3px; }

        .panel-title {
            grid-column: 1 / -1;
            font-family: 'Orbitron', 'Jua', sans-serif;
            font-weight: 700;
            font-size: 11px;
            letter-spacing: 1.5px;
            color: var(--cyan-bright);
            padding: 4px 4px 5px;
            border-bottom: 1px solid rgba(6,182,212,0.3);
            margin-bottom: 1px;
            text-shadow: 0 0 8px rgba(6,182,212,0.6);
            text-transform: uppercase;
            position: relative;
        }
        .panel-title::after {
            content: '●';
            position: absolute;
            right: 6px;
            top: 4px;
            color: var(--green);
            font-size: 6px;
            animation: blink 2s infinite;
        }
        @keyframes blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.3; }
        }
        .panel-group {
            grid-column: 1 / -1;
            font-family: 'Special Elite', monospace;
            font-size: 9px;
            color: var(--amber);
            padding: 5px 4px 2px;
            letter-spacing: 1px;
            opacity: 0.7;
        }

        .equip-btn, .chem-btn {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 5px 6px;
            border-radius: 6px;
            cursor: grab;
            font-size: 10px;
            font-family: 'JetBrains Mono', monospace;
            transition: all 0.18s var(--ease-smooth);
            border: 1px solid transparent;
            position: relative;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: var(--text);
            user-select: none;
            -webkit-user-drag: element;
        }
        .equip-btn:active, .chem-btn:active { cursor: grabbing; }
        .drag-ghost {
            position: fixed;
            pointer-events: none;
            z-index: 9999;
            padding: 6px 10px;
            background: linear-gradient(135deg, rgba(6,182,212,0.9), rgba(6,182,212,0.6));
            border: 2px solid var(--cyan-bright);
            border-radius: 8px;
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            box-shadow: 0 0 24px rgba(6,182,212,0.8), 0 8px 20px rgba(0,0,0,0.5);
            transform: translate(-50%, -50%) scale(1.1);
            display: flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
            opacity: 0.95;
            transition: transform 0.08s;
        }
        .drag-ghost.chem { background: linear-gradient(135deg, rgba(132,204,22,0.9), rgba(132,204,22,0.5)); border-color: var(--acid-green); box-shadow: 0 0 24px rgba(132,204,22,0.8), 0 8px 20px rgba(0,0,0,0.5); }
        .drag-ghost .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.4); }
        .drag-ghost.over-target { transform: translate(-50%, -50%) scale(1.3); box-shadow: 0 0 32px rgba(245,158,11,1), 0 0 60px rgba(245,158,11,0.6); border-color: var(--amber); }
        #labCanvas.drag-over { outline: 2px dashed var(--cyan-bright); outline-offset: -4px; }
        #labCanvas.drag-over-chem { outline: 2px dashed var(--acid-green); outline-offset: -4px; }
        .equip-btn {
            background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(6,182,212,0.03));
            border-left: 2px solid rgba(6,182,212,0.3);
        }
        .equip-btn:hover {
            background: linear-gradient(135deg, rgba(6,182,212,0.25), rgba(6,182,212,0.1));
            border-color: var(--cyan-bright);
            border-left-color: var(--cyan-bright);
            transform: translateX(2px);
            box-shadow: 0 0 12px rgba(6,182,212,0.3);
        }
        .equip-btn.active {
            background: linear-gradient(135deg, rgba(6,182,212,0.4), rgba(6,182,212,0.15));
            border-color: var(--cyan-bright);
            border-left-color: var(--amber);
            box-shadow: 0 0 16px rgba(6,182,212,0.5), inset 0 0 8px rgba(255,255,255,0.1);
        }
        .equip-btn .icon { font-size: 13px; flex-shrink: 0; filter: drop-shadow(0 0 2px rgba(6,182,212,0.6)); }

        .chem-btn {
            background: linear-gradient(135deg, rgba(132,204,22,0.08), rgba(132,204,22,0.03));
            border-left: 2px solid rgba(132,204,22,0.3);
        }
        .chem-btn:hover {
            background: linear-gradient(135deg, rgba(132,204,22,0.25), rgba(132,204,22,0.1));
            border-color: var(--acid-green);
            border-left-color: var(--acid-green);
            transform: translateX(-2px);
            box-shadow: 0 0 12px rgba(132,204,22,0.3);
        }
        .chem-btn.active {
            background: linear-gradient(135deg, rgba(132,204,22,0.4), rgba(132,204,22,0.15));
            border-color: var(--acid-green);
            border-left-color: var(--amber);
            box-shadow: 0 0 16px rgba(132,204,22,0.5);
        }
        .chem-btn .chem-dot {
            width: 9px; height: 9px;
            border-radius: 50%;
            flex-shrink: 0;
            border: 1px solid rgba(255,255,255,0.3);
            box-shadow: inset 0 0 3px rgba(255,255,255,0.4), 0 0 4px currentColor;
        }

        /* Smart tooltip (JS-driven, body-level, no overflow issues) */
        #smartTooltip {
            position: fixed;
            background: linear-gradient(135deg, rgba(8,10,24,0.98), rgba(14,16,36,0.98));
            border: 1px solid var(--cyan-bright);
            border-radius: 10px;
            padding: 10px 14px;
            font-size: 12px;
            font-family: 'JetBrains Mono', monospace;
            color: var(--text-bright);
            white-space: pre-line;
            min-width: 200px;
            max-width: 320px;
            line-height: 1.55;
            letter-spacing: 0.2px;
            backdrop-filter: blur(12px);
            box-shadow:
                inset 0 1px 0 rgba(34,211,238,0.25),
                0 0 20px rgba(6,182,212,0.35),
                0 12px 32px rgba(0,0,0,0.7);
            pointer-events: none;
            z-index: 99999;
            opacity: 0;
            transform: translateY(-4px);
            transition: opacity 0.12s var(--ease-smooth), transform 0.12s var(--ease-smooth);
        }
        #smartTooltip.show {
            opacity: 1;
            transform: translateY(0);
        }

        /* ===== Canvas Area ===== */
        .canvas-area {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .canvas-wrap {
            position: relative;
            border-radius: 14px;
            overflow: hidden;
            border: 1px solid var(--border);
            background: #050510;
        }
        #labCanvas {
            display: block;
            width: 100%;
            height: auto;
            cursor: crosshair;
        }
        .canvas-hud {
            position: absolute;
            top: 8px; left: 8px;
            display: flex;
            gap: 6px;
            pointer-events: none;
        }
        .hud-chip {
            background: linear-gradient(135deg, rgba(5,8,16,0.92), rgba(10,14,28,0.85));
            border: 1px solid rgba(34,211,238,0.35);
            border-radius: 6px;
            padding: 4px 10px;
            font-family: 'Orbitron', monospace;
            font-weight: 700;
            font-size: 11px;
            color: var(--cyan-bright);
            text-shadow: 0 0 6px rgba(6,182,212,0.6);
            backdrop-filter: blur(8px);
            box-shadow:
                inset 0 1px 0 rgba(34,211,238,0.2),
                0 2px 8px rgba(0,0,0,0.4),
                0 0 12px rgba(6,182,212,0.2);
            letter-spacing: 1px;
        }

        /* Avatar in lab - pixel Dr. Luna */
        .avatar-face-canvas {
            width: 28px;
            height: 28px;
            image-rendering: pixelated;
            image-rendering: crisp-edges;
            border-radius: 4px;
            flex-shrink: 0;
            box-shadow: 0 0 6px rgba(245,158,11,0.5);
        }
        .avatar-chip {
            position: absolute;
            top: 8px; right: 8px;
            background: rgba(0,0,0,0.7);
            border: 1px solid rgba(236,72,153,0.3);
            border-radius: 10px;
            padding: 4px 8px;
            display: flex;
            align-items: center;
            gap: 6px;
            pointer-events: none;
        }

        /* ===== Top-right language + accessibility controls ===== */
        .top-right-ctrls {
            position: absolute;
            top: 8px;
            right: 160px;  /* leaves space for avatar-chip on far right */
            display: flex;
            gap: 6px;
            z-index: 19;
        }
        .lang-toggle, .a11y-btn {
            background: linear-gradient(135deg, rgba(10,14,28,0.85), rgba(18,22,38,0.75));
            border: 1px solid rgba(34,211,238,0.4);
            border-radius: 6px;
            color: #fff;
            padding: 5px 10px;
            font-family: 'Jua', sans-serif;
            font-size: 12px;
            cursor: pointer;
            backdrop-filter: blur(6px);
            transition: all 0.15s;
            box-shadow: 0 2px 6px rgba(0,0,0,0.4);
            min-height: 28px;
            display: flex;
            align-items: center;
        }
        .lang-toggle:hover, .a11y-btn:hover {
            border-color: #22d3ee;
            box-shadow: 0 2px 10px rgba(34,211,238,0.4);
            transform: translateY(-1px);
        }
        .a11y-btn.active {
            background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(239,68,68,0.2));
            border-color: #f59e0b;
            color: #fcd34d;
            box-shadow: 0 2px 12px rgba(245,158,11,0.5);
        }
        .lang-active {
            font-family: 'Orbitron', monospace;
            font-weight: 700;
            font-size: 11px;
            letter-spacing: 1px;
            color: #22d3ee;
        }

        /* ===== Colorblind mode (Deuteranopia simulation) ===== */
        body.cb-mode #labCanvas {
            filter: url('#deuteranopia-filter');
        }
        body.cb-mode .chem-btn .chem-dot {
            outline: 2px solid #fff;
            outline-offset: 1px;
        }
        /* High-contrast mode */
        body.hc-mode {
            --cyan: #00ffff !important;
            --cyan-bright: #ffffff !important;
            --text: #ffffff !important;
            --bg: #000000 !important;
            --panel-bg: #000000 !important;
        }
        body.hc-mode * {
            text-shadow: none !important;
        }
        body.hc-mode .equip-btn, body.hc-mode .chem-btn {
            background: #000 !important;
            border: 2px solid #fff !important;
            color: #fff !important;
        }
        body.hc-mode .hud-chip, body.hc-mode .lab-float-btn {
            background: #000 !important;
            border: 2px solid #fff !important;
            color: #fff !important;
        }
        body.hc-mode .avatar-chip, body.hc-mode .top-right-ctrls button {
            background: #000 !important;
            border: 2px solid #fff !important;
            color: #fff !important;
        }

        /* ===== Bottom-right floating controls ===== */
        .lab-float-ctrls {
            position: absolute;
            right: 10px;
            bottom: 10px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            align-items: flex-end;
            pointer-events: none;
            z-index: 15;
        }
        .lab-float-btn {
            pointer-events: auto;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px;
            background: linear-gradient(135deg, rgba(10,14,28,0.92), rgba(18,22,38,0.85));
            border: 1.5px solid rgba(245,158,11,0.5);
            border-radius: 10px;
            color: #fff;
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            cursor: pointer;
            backdrop-filter: blur(10px);
            box-shadow:
                inset 0 1px 0 rgba(255,200,100,0.2),
                0 4px 12px rgba(0,0,0,0.5),
                0 0 16px rgba(245,158,11,0.15);
            transition: all 0.15s ease;
            user-select: none;
        }
        .lab-float-btn:hover {
            transform: translateY(-1px);
            border-color: rgba(245,158,11,0.8);
            box-shadow:
                inset 0 1px 0 rgba(255,200,100,0.3),
                0 6px 16px rgba(0,0,0,0.6),
                0 0 22px rgba(245,158,11,0.35);
        }
        .lab-float-btn.active {
            background: linear-gradient(135deg, rgba(245,158,11,0.25), rgba(239,68,68,0.2));
            border-color: #f59e0b;
            box-shadow:
                inset 0 1px 0 rgba(255,220,150,0.4),
                0 4px 14px rgba(245,158,11,0.4),
                0 0 24px rgba(245,158,11,0.5);
            color: #ffecc1;
            text-shadow: 0 0 8px rgba(245,158,11,0.8);
        }
        .lab-float-btn .lab-icon {
            font-size: 18px;
            line-height: 1;
        }
        .lab-float-btn .lab-state {
            font-family: 'Orbitron', monospace;
            font-weight: 700;
            font-size: 11px;
            letter-spacing: 1.5px;
            padding: 2px 7px;
            border-radius: 4px;
            background: rgba(0,0,0,0.6);
            color: #888;
            transition: all 0.2s;
        }
        .lab-float-btn.active .lab-state {
            background: #f59e0b;
            color: #0a0a14;
            text-shadow: none;
            box-shadow: 0 0 10px rgba(245,158,11,0.7);
        }
        .lab-float-btn.thermal {
            border-color: rgba(34,211,238,0.5);
            box-shadow:
                inset 0 1px 0 rgba(150,230,255,0.2),
                0 4px 12px rgba(0,0,0,0.5),
                0 0 16px rgba(34,211,238,0.15);
        }
        .lab-float-btn.thermal:hover {
            border-color: rgba(34,211,238,0.9);
            box-shadow:
                inset 0 1px 0 rgba(150,230,255,0.3),
                0 6px 16px rgba(0,0,0,0.6),
                0 0 22px rgba(34,211,238,0.4);
        }
        .lab-float-btn.thermal.active {
            background: linear-gradient(135deg, rgba(34,211,238,0.25), rgba(239,68,68,0.2));
            border-color: #22d3ee;
            box-shadow:
                inset 0 1px 0 rgba(150,230,255,0.4),
                0 4px 14px rgba(34,211,238,0.4),
                0 0 24px rgba(34,211,238,0.5);
            color: #d1faff;
            text-shadow: 0 0 8px rgba(34,211,238,0.8);
        }
        .lab-float-btn.thermal.active .lab-state {
            background: #22d3ee;
            color: #0a0a14;
        }

        /* ===== MSDS Popup (Material Safety Data Sheet) ===== */
        .msds-modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.85);
            backdrop-filter: blur(8px);
            z-index: 250;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 40px;
        }
        .msds-modal.show { display: flex; }
        .msds-panel {
            max-width: 640px;
            width: 100%;
            max-height: 85vh;
            background: linear-gradient(135deg, #0a1020, #161a32);
            border: 2px solid #ef4444;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 40px rgba(239,68,68,0.3);
            display: flex;
            flex-direction: column;
        }
        .msds-header {
            padding: 16px 22px;
            background: linear-gradient(135deg, rgba(239,68,68,0.25), rgba(245,158,11,0.15));
            border-bottom: 2px solid rgba(239,68,68,0.5);
            position: relative;
        }
        .msds-header::before {
            content: '⚠️ MSDS';
            position: absolute;
            top: 12px; left: 20px;
            font-family: 'Orbitron', monospace;
            font-size: 10px;
            color: #ef4444;
            letter-spacing: 2px;
        }
        .msds-title {
            font-family: 'Jua', sans-serif;
            font-size: 22px;
            color: #fff;
            margin-top: 14px;
        }
        .msds-subtitle {
            font-size: 13px;
            color: #ffa;
            margin-top: 4px;
            font-family: 'JetBrains Mono', monospace;
        }
        .msds-signal {
            display: inline-block;
            margin-top: 6px;
            padding: 4px 10px;
            background: #ef4444;
            color: #fff;
            font-weight: bold;
            border-radius: 4px;
            font-family: 'Jua', sans-serif;
        }
        .msds-close {
            position: absolute;
            top: 12px; right: 14px;
            width: 28px; height: 28px;
            background: rgba(0,0,0,0.6);
            border: 1px solid rgba(239,68,68,0.5);
            color: #fff;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
        }
        .msds-body {
            padding: 18px 22px;
            overflow-y: auto;
            color: #dde;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }
        .msds-section {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .msds-label {
            font-family: 'Orbitron', monospace;
            font-size: 10px;
            color: #22d3ee;
            letter-spacing: 1.5px;
        }
        .msds-value {
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            color: #fff;
            line-height: 1.5;
        }
        .msds-tag {
            display: inline-block;
            padding: 3px 8px;
            margin: 2px 3px 2px 0;
            background: rgba(34,211,238,0.15);
            border: 1px solid rgba(34,211,238,0.4);
            border-radius: 12px;
            color: #22d3ee;
            font-size: 11px;
            font-family: 'Jua', sans-serif;
        }
        .msds-tag.danger {
            background: rgba(239,68,68,0.2);
            border-color: rgba(239,68,68,0.6);
            color: #fca5a5;
        }
        .msds-tag.warn {
            background: rgba(245,158,11,0.2);
            border-color: rgba(245,158,11,0.6);
            color: #fcd34d;
        }
        .msds-firstaid {
            background: rgba(239,68,68,0.1);
            border-left: 4px solid #ef4444;
            padding: 10px 14px;
            border-radius: 4px;
            color: #fee;
            font-size: 12px;
            line-height: 1.6;
        }
        .msds-tip {
            background: rgba(34,211,238,0.1);
            border-left: 4px solid #22d3ee;
            padding: 10px 14px;
            border-radius: 4px;
            color: #cdf;
            font-size: 12px;
            line-height: 1.6;
        }

        /* ===== Scenario guide action buttons ===== */
        .sg-actions {
            margin-top: 12px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .sg-yt-btn, .sg-quiz-btn {
            padding: 8px 12px;
            background: rgba(239,68,68,0.2);
            border: 1px solid rgba(239,68,68,0.5);
            border-radius: 6px;
            color: #fca5a5;
            font-family: 'Jua', sans-serif;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.15s;
        }
        .sg-yt-btn:hover { background: rgba(239,68,68,0.35); transform: translateX(2px); }
        .sg-quiz-btn {
            background: rgba(168,85,247,0.2);
            border-color: rgba(168,85,247,0.5);
            color: #d8b4fe;
        }
        .sg-quiz-btn:hover { background: rgba(168,85,247,0.35); }

        /* ===== YouTube comparison modal ===== */
        .yt-modal, .quiz-modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.85);
            backdrop-filter: blur(6px);
            z-index: 260;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 30px;
        }
        .yt-modal.show, .quiz-modal.show { display: flex; }
        .yt-panel, .quiz-panel {
            max-width: 720px;
            width: 100%;
            background: linear-gradient(135deg, #0d1020, #161a32);
            border: 2px solid #ef4444;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 20px 60px rgba(0,0,0,0.9);
            display: flex;
            flex-direction: column;
        }
        .quiz-panel { border-color: #a855f7; max-width: 640px; max-height: 85vh; }
        .yt-header, .quiz-header {
            padding: 14px 20px;
            background: linear-gradient(135deg, rgba(239,68,68,0.25), rgba(245,158,11,0.1));
            border-bottom: 2px solid rgba(239,68,68,0.5);
            position: relative;
        }
        .quiz-header {
            background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(34,211,238,0.1));
            border-bottom-color: rgba(168,85,247,0.5);
        }
        .yt-title, .quiz-title {
            font-family: 'Jua', sans-serif;
            font-size: 16px;
            color: #fff;
        }
        .yt-sub, .quiz-sub {
            font-size: 11px;
            color: #aab;
            margin-top: 4px;
        }
        .yt-close, .quiz-close {
            position: absolute;
            top: 10px; right: 12px;
            width: 26px; height: 26px;
            background: rgba(0,0,0,0.6);
            border: 1px solid rgba(239,68,68,0.5);
            color: #fff;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
        }
        .yt-body {
            padding: 16px 20px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            align-items: center;
        }
        .yt-body iframe {
            max-width: 100%;
            border-radius: 6px;
            background: #000;
        }
        .yt-info {
            font-size: 12px;
            color: #cde;
            background: rgba(34,211,238,0.1);
            border-left: 3px solid #22d3ee;
            padding: 10px 12px;
            border-radius: 4px;
            width: 100%;
            line-height: 1.6;
        }

        /* Quiz styles */
        .quiz-body {
            padding: 20px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }
        .quiz-item {
            background: rgba(34,211,238,0.05);
            border: 1px solid rgba(34,211,238,0.2);
            border-radius: 6px;
            padding: 12px;
        }
        .quiz-q {
            color: #fff;
            font-family: 'Jua', sans-serif;
            font-size: 14px;
            margin-bottom: 8px;
            line-height: 1.5;
        }
        .quiz-choices {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }
        .quiz-choice {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            background: rgba(10,14,28,0.5);
            border: 1px solid rgba(100,120,160,0.2);
            border-radius: 4px;
            color: #dde;
            cursor: pointer;
            font-size: 12px;
        }
        .quiz-choice:hover { background: rgba(34,211,238,0.12); border-color: rgba(34,211,238,0.4); }
        .quiz-choice input[type="radio"] { cursor: pointer; }
        .quiz-input {
            width: 120px;
            padding: 6px 10px;
            background: #0a0a14;
            border: 1px solid rgba(34,211,238,0.4);
            border-radius: 4px;
            color: #fff;
            font-size: 14px;
            font-family: monospace;
        }
        .quiz-unit {
            margin-left: 8px;
            color: #88a;
            font-size: 12px;
        }
        .quiz-footer {
            padding: 14px 20px;
            background: rgba(0,0,0,0.3);
            border-top: 1px solid rgba(168,85,247,0.3);
            display: flex;
            gap: 8px;
            justify-content: flex-end;
        }
        .quiz-submit {
            padding: 10px 20px;
            background: linear-gradient(135deg, #a855f7, #7e22ce);
            border: none;
            border-radius: 6px;
            color: #fff;
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            cursor: pointer;
        }
        .quiz-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(168,85,247,0.5); }
        .quiz-score {
            text-align: center;
            padding: 20px;
            margin-bottom: 10px;
        }
        .quiz-score-pct {
            font-size: 40px;
            font-family: 'Orbitron', monospace;
            font-weight: bold;
        }
        .quiz-score-grade {
            font-size: 14px;
            margin-top: 4px;
            color: #dde;
        }
        .quiz-result {
            padding: 8px 12px;
            border-radius: 4px;
            font-size: 12px;
        }
        .quiz-result.correct {
            background: rgba(34,197,94,0.1);
            border-left: 3px solid #22c55e;
            color: #bbf7d0;
        }
        .quiz-result.wrong {
            background: rgba(239,68,68,0.1);
            border-left: 3px solid #ef4444;
            color: #fecaca;
        }
        .quiz-res-line { margin-top: 4px; font-size: 11px; color: #cde; }

        /* ===== 🆕 Reagent Shelf Manager ===== */
        .all-chems-btn {
            width: 100%;
            padding: 6px 10px;
            margin: 4px 0 10px 0;
            background: linear-gradient(135deg, rgba(34,211,238,0.2), rgba(168,85,247,0.15));
            border: 1px solid rgba(34,211,238,0.5);
            border-radius: 6px;
            color: #22d3ee;
            font-family: 'Jua', sans-serif;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.15s;
        }
        .all-chems-btn:hover {
            background: linear-gradient(135deg, rgba(34,211,238,0.35), rgba(168,85,247,0.25));
            border-color: #22d3ee;
            box-shadow: 0 2px 10px rgba(34,211,238,0.4);
        }
        .cp-modal {
            position: fixed; inset: 0;
            background: rgba(0,0,0,0.85);
            backdrop-filter: blur(6px);
            z-index: 270;
            display: none;
            align-items: center; justify-content: center;
            padding: 30px;
        }
        .cp-modal.show { display: flex; }
        .cp-panel {
            max-width: 900px; width: 100%;
            max-height: 85vh;
            background: linear-gradient(135deg, #0a1020, #161a32);
            border: 2px solid rgba(34,211,238,0.5);
            border-radius: 12px;
            display: flex; flex-direction: column;
            overflow: hidden;
        }
        .cp-header {
            padding: 16px 20px;
            background: linear-gradient(135deg, rgba(34,211,238,0.2), rgba(168,85,247,0.1));
            border-bottom: 2px solid rgba(34,211,238,0.4);
            position: relative;
        }
        .cp-title {
            font-family: 'Jua', sans-serif;
            font-size: 18px;
            color: #fff;
        }
        .cp-sub {
            font-size: 11px;
            color: #88a;
            margin-top: 4px;
        }
        .cp-close {
            position: absolute; top: 12px; right: 14px;
            width: 28px; height: 28px;
            background: rgba(239,68,68,0.3);
            border: 1px solid #ef4444;
            color: #fff;
            border-radius: 4px;
            cursor: pointer;
        }
        .cp-body {
            padding: 16px 20px;
            overflow-y: auto;
            flex: 1;
        }
        .cp-actions {
            display: flex; gap: 8px;
            margin-bottom: 16px;
        }
        .cp-action-btn {
            padding: 6px 12px;
            background: rgba(10,14,28,0.7);
            border: 1px solid rgba(100,120,160,0.4);
            color: #dde;
            border-radius: 6px;
            font-size: 11px;
            cursor: pointer;
            font-family: 'Jua', sans-serif;
        }
        .cp-action-btn:hover { background: rgba(34,211,238,0.15); border-color: #22d3ee; }
        .cp-group { margin-bottom: 18px; }
        .cp-group-title {
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            color: #22d3ee;
            border-left: 3px solid #22d3ee;
            padding-left: 8px;
            margin-bottom: 8px;
        }
        .cp-items {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
            gap: 6px;
        }
        .cp-item {
            display: flex; align-items: center; gap: 6px;
            padding: 6px 8px;
            background: rgba(10,14,28,0.5);
            border: 1px solid rgba(100,120,160,0.2);
            border-radius: 4px;
            color: #dde;
            cursor: pointer;
            font-size: 11px;
            transition: all 0.1s;
        }
        .cp-item:hover { background: rgba(34,211,238,0.1); }
        .cp-item.checked {
            background: rgba(34,211,238,0.18);
            border-color: rgba(34,211,238,0.6);
            color: #fff;
        }
        .cp-item input[type=checkbox] { cursor: pointer; }
        .cp-dot {
            width: 12px; height: 12px;
            border-radius: 50%;
            border: 1px solid rgba(255,255,255,0.3);
            flex-shrink: 0;
        }
        .cp-chem-name { flex: 1; font-weight: 500; }
        .cp-formula { color: #88a; font-family: monospace; font-size: 10px; }
        .cp-footer {
            padding: 12px 20px;
            background: rgba(0,0,0,0.3);
            border-top: 1px solid rgba(34,211,238,0.3);
            display: flex; justify-content: space-between; align-items: center;
        }
        .cp-count {
            color: #22d3ee;
            font-family: 'Orbitron', monospace;
            font-size: 11px;
        }
        .cp-save {
            padding: 8px 22px;
            background: linear-gradient(135deg, #22d3ee, #06b6d4);
            border: none;
            border-radius: 6px;
            color: #fff;
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            cursor: pointer;
        }
        .cp-save:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(34,211,238,0.5); }

        /* ===== Hazard warning banner (bottom of canvas) ===== */
        .hazard-banner {
            position: absolute;
            bottom: 10px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, rgba(239,68,68,0.95), rgba(245,60,60,0.9));
            color: #fff;
            padding: 10px 18px;
            border-radius: 8px;
            font-family: 'Jua', sans-serif;
            font-size: 14px;
            box-shadow: 0 4px 14px rgba(239,68,68,0.6), inset 0 1px 0 rgba(255,200,200,0.3);
            border: 2px solid #fff;
            display: none;
            z-index: 20;
            animation: hazardPulse 0.8s ease-in-out infinite;
            text-align: center;
            max-width: 80%;
        }
        .hazard-banner.show { display: block; }
        @keyframes hazardPulse {
            0%, 100% { transform: translateX(-50%) scale(1); }
            50% { transform: translateX(-50%) scale(1.05); }
        }
        .ppe-row {
            position: absolute;
            top: 10px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 10px;
            padding: 6px 14px;
            background: rgba(245,158,11,0.15);
            border: 1.5px solid rgba(245,158,11,0.5);
            border-radius: 8px;
            color: #fcd34d;
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            backdrop-filter: blur(6px);
            display: none;
            z-index: 18;
        }
        .ppe-row.show { display: flex; }
        .ppe-row .ppe-icon {
            font-size: 18px;
            filter: drop-shadow(0 0 4px rgba(245,158,11,0.8));
        }

        /* ===== Scenario picker (textbook experiments modal) ===== */
        .spk-modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(6px);
            z-index: 200;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 30px;
        }
        .spk-modal.show { display: flex; }
        .spk-modal > * {
            max-width: 1100px;
            width: 100%;
            max-height: 85vh;
            background: linear-gradient(135deg, #0d1220, #161a2e);
            border: 1.5px solid rgba(245,158,11,0.4);
            border-radius: 14px;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(245,158,11,0.15);
        }
        .spk-header {
            padding: 16px 20px;
            background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(34,211,238,0.1));
            border-bottom: 1px solid rgba(245,158,11,0.3);
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
        }
        .spk-title {
            font-family: 'Jua', sans-serif;
            font-size: 18px;
            color: #ffd689;
            flex: 1 0 100%;
        }
        .spk-sub {
            font-size: 12px;
            color: #aab;
            flex: 1 0 100%;
        }
        .spk-close {
            position: absolute;
            top: 12px; right: 12px;
            width: 32px; height: 32px;
            background: rgba(239,68,68,0.2);
            border: 1px solid rgba(239,68,68,0.5);
            color: #fff;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            font-weight: bold;
        }
        .spk-close:hover { background: rgba(239,68,68,0.4); }
        .spk-body {
            padding: 20px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        .spk-group-title {
            font-family: 'Jua', sans-serif;
            font-size: 15px;
            color: #22d3ee;
            margin-bottom: 8px;
            padding-left: 4px;
            border-left: 3px solid #22d3ee;
        }
        .spk-items {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
            gap: 10px;
        }
        .spk-item {
            text-align: left;
            padding: 12px;
            background: rgba(10,14,28,0.7);
            border: 1px solid rgba(100,120,160,0.3);
            border-radius: 8px;
            color: #fff;
            cursor: pointer;
            transition: all 0.15s;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .spk-item:hover {
            background: rgba(245,158,11,0.15);
            border-color: #f59e0b;
            transform: translateY(-2px);
            box-shadow: 0 4px 14px rgba(245,158,11,0.25);
        }
        .spk-item-code {
            font-family: 'Orbitron', monospace;
            font-size: 10px;
            color: #f59e0b;
            letter-spacing: 1px;
        }
        .spk-item-title {
            font-family: 'Jua', sans-serif;
            font-size: 14px;
            color: #fff;
        }
        .spk-item-area {
            font-size: 11px;
            color: #8aa;
        }

        /* ===== Scenario guide panel (appears after loading scenario) ===== */
        .scenario-guide {
            position: absolute;
            top: 74px;
            right: 10px;
            width: 280px;
            background: linear-gradient(135deg, rgba(13,18,32,0.95), rgba(22,26,46,0.92));
            border: 1.5px solid rgba(34,211,238,0.5);
            border-radius: 10px;
            padding: 14px;
            color: #fff;
            backdrop-filter: blur(8px);
            box-shadow: 0 6px 20px rgba(0,0,0,0.5), 0 0 22px rgba(34,211,238,0.2);
            font-family: 'Jua', sans-serif;
            font-size: 12px;
            display: none;
            z-index: 15;
            max-height: 70%;
            overflow-y: auto;
        }
        .scenario-guide.show { display: block; }
        .sg-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
            padding-bottom: 6px;
            border-bottom: 1px solid rgba(34,211,238,0.3);
        }
        .sg-code {
            font-family: 'Orbitron', monospace;
            font-size: 10px;
            color: #f59e0b;
            letter-spacing: 1px;
            background: rgba(245,158,11,0.15);
            padding: 2px 6px;
            border-radius: 4px;
        }
        .sg-grade {
            font-size: 11px;
            color: #22d3ee;
            flex: 1;
        }
        .sg-close {
            width: 22px; height: 22px;
            background: rgba(239,68,68,0.3);
            border: 1px solid rgba(239,68,68,0.6);
            color: #fff;
            border-radius: 4px;
            cursor: pointer;
            font-size: 11px;
        }
        .sg-title {
            font-size: 15px;
            color: #ffd689;
            margin-bottom: 4px;
        }
        .sg-area {
            font-size: 10px;
            color: #8aa;
            margin-bottom: 6px;
        }
        .sg-summary {
            font-size: 11px;
            color: #cde;
            line-height: 1.4;
            margin-bottom: 8px;
        }
        .sg-goal {
            font-size: 12px;
            color: #fff;
            background: rgba(245,158,11,0.12);
            padding: 6px 8px;
            border-left: 3px solid #f59e0b;
            border-radius: 4px;
            margin-bottom: 8px;
            line-height: 1.4;
        }
        .sg-hints ol {
            margin: 4px 0 0 18px;
            padding: 0;
            font-size: 11px;
            line-height: 1.5;
            color: #dde;
        }
        .sg-tips {
            margin-top: 10px;
            padding: 6px 8px;
            background: rgba(34,211,238,0.1);
            border-left: 3px solid #22d3ee;
            border-radius: 4px;
            font-size: 11px;
            color: #cdf;
            line-height: 1.4;
        }

        .avatar-face { font-size: 20px; }
        .avatar-name { font-size: 10px; color: var(--pink); }

        /* Canvas toolbar — neon holographic */
        .canvas-toolbar {
            position: absolute;
            left: 8px;
            top: 8px;
            display: flex;
            flex-direction: column;
            gap: 2px;
            background:
                linear-gradient(180deg, rgba(14,16,36,0.95), rgba(10,12,28,0.98));
            border: 1px solid rgba(34,211,238,0.3);
            border-radius: 10px;
            padding: 4px;
            z-index: 10;
            backdrop-filter: blur(12px);
            box-shadow:
                inset 0 1px 0 rgba(34,211,238,0.2),
                0 4px 16px rgba(0,0,0,0.5),
                0 0 24px rgba(6,182,212,0.15);
        }
        .canvas-toolbar::before {
            content: 'TOOLS';
            position: absolute;
            top: -16px;
            left: 50%;
            transform: translateX(-50%);
            font-family: 'Orbitron', monospace;
            font-size: 8px;
            font-weight: 700;
            color: var(--cyan-bright);
            letter-spacing: 2px;
            text-shadow: 0 0 6px rgba(6,182,212,0.8);
            opacity: 0.7;
        }
        .tb-btn {
            width: 30px; height: 30px;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer;
            border-radius: 6px;
            font-size: 14px;
            position: relative;
            border: 1px solid transparent;
            background: linear-gradient(135deg, rgba(6,182,212,0.05), transparent);
            color: var(--text);
            transition: all 0.15s var(--ease-smooth);
        }
        .tb-btn:hover {
            background: linear-gradient(135deg, rgba(34,211,238,0.3), rgba(6,182,212,0.1));
            border-color: var(--cyan-bright);
            transform: scale(1.08);
            box-shadow: 0 0 12px rgba(6,182,212,0.5), inset 0 0 8px rgba(255,255,255,0.1);
        }
        .tb-btn.active {
            background: linear-gradient(135deg, var(--cyan), var(--cyan-deep));
            border-color: var(--cyan-bright);
            color: #fff;
            box-shadow:
                0 0 16px rgba(6,182,212,0.8),
                inset 0 0 12px rgba(255,255,255,0.2),
                inset 0 1px 0 rgba(255,255,255,0.4);
            animation: tbPulse 2s infinite;
        }
        @keyframes tbPulse {
            0%, 100% { box-shadow: 0 0 16px rgba(6,182,212,0.8), inset 0 0 12px rgba(255,255,255,0.2), inset 0 1px 0 rgba(255,255,255,0.4); }
            50% { box-shadow: 0 0 24px rgba(34,211,238,1), inset 0 0 16px rgba(255,255,255,0.3), inset 0 1px 0 rgba(255,255,255,0.4); }
        }
        .tb-btn .tb-key {
            position: absolute;
            bottom: 0px; right: 1px;
            font-size: 7px;
            color: var(--text-dim);
            font-weight: bold;
        }
        .tb-btn.active .tb-key { color: rgba(255,255,255,0.7); }
        .tb-btn[data-tip]:hover::after {
            left: 115%;
            top: 50%;
            transform: translateY(-50%);
        }
        .tb-sep { width: 20px; height: 1px; background: rgba(255,255,255,0.1); margin: 2px auto; }
        /* HUD moved to right side to not clash with toolbar */
        .canvas-hud { left: auto !important; right: 8px; top: 40px !important; }
        .avatar-chip { top: 8px !important; right: 8px; }

        /* Canvas bottom controls (compact) */
        .canvas-controls {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
            align-items: center;
        }
        .ctrl-group {
            display: flex;
            align-items: center;
            gap: 4px;
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 3px 6px;
        }
        .ctrl-label { font-size: 9px; color: var(--text-dim); }
        .ctrl-btn {
            background: rgba(6,182,212,0.1);
            border: 1px solid rgba(6,182,212,0.2);
            border-radius: 5px;
            padding: 2px 6px;
            font-size: 10px;
            color: var(--text);
            cursor: pointer;
        }
        .ctrl-btn.active { background: rgba(6,182,212,0.3); border-color: var(--cyan); }

        /* ===== Lab Notebook ===== */
        .notebook-panel {
            background: var(--card-bg);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 8px 12px;
            margin-top: 8px;
            max-height: 150px;
            overflow-y: auto;
            backdrop-filter: blur(12px);
        }
        .notebook-title {
            font-family: 'Jua', sans-serif;
            font-size: 13px;
            color: var(--amber);
            margin-bottom: 6px;
            cursor: pointer;
        }
        .notebook-entry {
            font-size: 11px;
            padding: 3px 0;
            border-bottom: 1px solid rgba(255,255,255,0.03);
            display: flex;
            gap: 8px;
        }
        .notebook-entry .time { color: var(--text-dim); flex-shrink: 0; }
        .notebook-entry .eq { color: var(--cyan); }
        .notebook-entry .desc { color: var(--text); opacity: 0.7; }

        /* ===== Toast ===== */
        .toast {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%) translateY(-20px);
            background: rgba(15, 15, 40, 0.95);
            border: 1px solid var(--cyan);
            border-radius: 12px;
            padding: 12px 24px;
            font-size: 14px;
            z-index: 150;
            opacity: 0;
            transition: all 0.3s;
            pointer-events: none;
            text-align: center;
            backdrop-filter: blur(12px);
            box-shadow: 0 0 30px rgba(6,182,212,0.2);
        }
        .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
        .toast.danger { border-color: var(--red); box-shadow: 0 0 30px rgba(239,68,68,0.3); }
        .toast.success { border-color: var(--green); box-shadow: 0 0 30px rgba(16,185,129,0.3); }

        /* ===== Mission Modal ===== */
        .modal-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.7);
            z-index: 160;
            display: none;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(4px);
        }
        .modal-overlay.show { display: flex; }
        .modal-box {
            background: linear-gradient(135deg, #0e0e24, #1a1a3e);
            border: 1px solid var(--cyan);
            border-radius: 16px;
            padding: 20px;
            max-width: 620px;
            width: 95%;
            max-height: 85vh;
            overflow-y: auto;
            box-shadow: 0 0 40px rgba(6,182,212,0.2);
        }
        .modal-box::-webkit-scrollbar { width: 4px; }
        .modal-box::-webkit-scrollbar-thumb { background: rgba(6,182,212,0.3); border-radius: 4px; }
        .modal-title {
            font-family: 'Jua', sans-serif;
            font-size: 22px;
            color: var(--cyan);
            margin-bottom: 12px;
            text-align: center;
        }
        .modal-body { font-size: 13px; line-height: 1.7; }
        .modal-close {
            display: block;
            margin: 16px auto 0;
            background: rgba(6,182,212,0.2);
            border: 1px solid var(--cyan);
            border-radius: 10px;
            padding: 8px 32px;
            color: var(--cyan);
            font-size: 14px;
            cursor: pointer;
        }

        /* ===== Mobile ===== */
        @media (max-width: 900px) {
            .game-layout { flex-direction: column; }
            .side-panel {
                width: 100%;
                flex-direction: row;
                flex-wrap: wrap;
                max-height: none;
                overflow-y: visible;
            }
            .panel-title { width: 100%; }
            .panel-group { width: 100%; }
        }
        @media (max-width: 640px) {
            .top-bar { padding: 6px 8px; gap: 6px; }
            .page-title { font-size: 16px; }
            .mission-display { display: none; }
            .equip-btn span:not(.icon), .chem-btn span:not(.chem-dot) { display: none; }
            .equip-btn, .chem-btn { padding: 6px; justify-content: center; }
            .side-panel { padding: 6px 4px; gap: 2px; }
        }

/* ===== Step 3: Simplified toolbar + More menu ===== */
.tb-btn.tb-more {
    background: linear-gradient(135deg, rgba(168,85,247,0.25), rgba(34,211,238,0.15));
    border-color: rgba(168,85,247,0.5);
}
.tb-btn.tb-more:hover {
    background: linear-gradient(135deg, rgba(168,85,247,0.4), rgba(34,211,238,0.25));
    box-shadow: 0 0 12px rgba(168,85,247,0.5);
}
.more-menu {
    position: absolute;
    left: 58px;
    top: 280px;
    min-width: 220px;
    background: linear-gradient(135deg, rgba(13,18,32,0.96), rgba(22,26,46,0.95));
    border: 1.5px solid rgba(168,85,247,0.5);
    border-radius: 10px;
    padding: 8px;
    display: none;
    z-index: 30;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), 0 0 24px rgba(168,85,247,0.25);
}
.more-menu.show { display: block; }
.mm-title {
    font-family: 'Jua', sans-serif;
    font-size: 12px;
    color: #c084fc;
    padding: 4px 8px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.mm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: #dde;
    font-family: 'Jua', sans-serif;
    font-size: 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.1s;
    text-align: left;
}
.mm-item:hover {
    background: rgba(168,85,247,0.15);
    color: #fff;
    padding-left: 14px;
}
.mm-item.mm-danger { color: #fca5a5; }
.mm-item.mm-danger:hover { background: rgba(239,68,68,0.2); }
.mm-icon { font-size: 16px; width: 20px; text-align: center; }
.mm-item kbd {
    margin-left: auto;
    padding: 2px 7px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(168,85,247,0.4);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #c084fc;
}
.mm-divider {
    height: 1px;
    background: rgba(168,85,247,0.3);
    margin: 6px 2px;
}

/* Shortcut help modal */
.shortcut-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    z-index: 280;
    display: none;
    align-items: center;
    justify-content: center;
}
.shortcut-modal.show { display: flex; }
.shortcut-panel {
    width: 640px;
    max-width: 90vw;
    background: linear-gradient(135deg, #0d1220, #161a32);
    border: 2px solid rgba(34,211,238,0.5);
    border-radius: 14px;
    overflow: hidden;
}
.shortcut-panel h2 {
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(34,211,238,0.2), rgba(168,85,247,0.1));
    border-bottom: 1px solid rgba(34,211,238,0.3);
    font-family: 'Jua', sans-serif;
    color: #22d3ee;
    font-size: 18px;
    margin: 0;
    position: relative;
}
.shortcut-panel h2 .sk-close {
    position: absolute; top: 14px; right: 18px;
    background: rgba(239,68,68,0.3);
    border: 1px solid #ef4444;
    color: #fff; width: 28px; height: 28px;
    border-radius: 4px; cursor: pointer;
}
.sk-body {
    padding: 18px 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    max-height: 70vh;
    overflow-y: auto;
}
.sk-group { display: flex; flex-direction: column; gap: 6px; }
.sk-group h3 {
    font-family: 'Jua', sans-serif;
    font-size: 12px;
    color: #f59e0b;
    margin: 8px 0 2px 0;
    padding-left: 4px;
    border-left: 3px solid #f59e0b;
}
.sk-row { display: flex; gap: 8px; align-items: center; font-size: 12px; color: #dde; }
.sk-row kbd {
    padding: 3px 8px;
    background: #1a1a22;
    border: 1px solid rgba(34,211,238,0.4);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #22d3ee;
    min-width: 24px;
    text-align: center;
}

/* ===== Step 4: 3-min Onboarding Tour ===== */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    pointer-events: none;
    display: none;
}
.tour-overlay.show { display: block; }
.tour-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    pointer-events: auto;
    backdrop-filter: blur(2px);
    transition: clip-path 0.35s ease;
}
.tour-spotlight {
    position: absolute;
    border: 3px solid #22d3ee;
    border-radius: 12px;
    pointer-events: none;
    box-shadow:
        0 0 0 3px rgba(34,211,238,0.3),
        0 0 40px rgba(34,211,238,0.7),
        0 0 0 9999px rgba(0,0,0,0.7);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    animation: tourPulse 2s ease-in-out infinite;
}
@keyframes tourPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34,211,238,0.3), 0 0 40px rgba(34,211,238,0.7), 0 0 0 9999px rgba(0,0,0,0.7); }
    50% { box-shadow: 0 0 0 6px rgba(34,211,238,0.5), 0 0 60px rgba(34,211,238,0.9), 0 0 0 9999px rgba(0,0,0,0.7); }
}
.tour-arrow {
    position: absolute;
    font-size: 48px;
    color: #f59e0b;
    text-shadow: 0 0 10px rgba(245,158,11,0.8);
    pointer-events: none;
    animation: tourArrowBob 1.2s ease-in-out infinite;
    z-index: 402;
}
@keyframes tourArrowBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}
.tour-tooltip {
    position: absolute;
    width: 340px;
    background: linear-gradient(135deg, #0d1220, #161a32);
    border: 2px solid #22d3ee;
    border-radius: 12px;
    padding: 18px 20px;
    color: #fff;
    font-family: 'Jua', sans-serif;
    box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 30px rgba(34,211,238,0.3);
    pointer-events: auto;
    z-index: 403;
    transition: all 0.3s;
}
.tour-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}
.tour-dot {
    flex: 1;
    height: 4px;
    background: rgba(34,211,238,0.2);
    border-radius: 2px;
    transition: all 0.3s;
}
.tour-dot.active { background: #22d3ee; }
.tour-dot.done { background: rgba(34,211,238,0.6); }
.tour-title {
    font-size: 16px;
    color: #22d3ee;
    margin-bottom: 8px;
}
.tour-desc {
    font-size: 13px;
    color: #dde;
    line-height: 1.6;
    margin-bottom: 14px;
}
.tour-hint {
    background: rgba(245,158,11,0.15);
    border-left: 3px solid #f59e0b;
    padding: 8px 10px;
    margin-bottom: 14px;
    border-radius: 4px;
    font-size: 12px;
    color: #fcd34d;
    line-height: 1.5;
}
.tour-btns {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}
.tour-btn {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-family: 'Jua', sans-serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.tour-btn-prev {
    background: transparent;
    border: 1px solid rgba(100,120,160,0.4);
    color: #aab;
}
.tour-btn-prev:hover { background: rgba(100,120,160,0.15); color: #fff; }
.tour-btn-skip {
    background: transparent;
    color: #666;
    text-decoration: underline;
    font-size: 10px;
}
.tour-btn-skip:hover { color: #aab; }
.tour-btn-next {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    color: #fff;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(34,211,238,0.4);
}
.tour-btn-next:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(34,211,238,0.6); }
.tour-step-num {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    color: #f59e0b;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

/* Completion celebration */
.tour-celebrate {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 450;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    backdrop-filter: blur(8px);
}
.tour-celebrate.show { display: flex; }
.tour-celebrate-content {
    text-align: center;
    animation: celebPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes celebPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.tour-celebrate h1 {
    font-family: 'Jua', sans-serif;
    font-size: 64px;
    background: linear-gradient(135deg, #22d3ee, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(245,158,11,0.5));
    margin-bottom: 14px;
}
.tour-celebrate p {
    font-family: 'Jua', sans-serif;
    font-size: 18px;
    color: #dde;
    margin-bottom: 24px;
}
.tour-celebrate-btn {
    padding: 14px 34px;
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: 'Jua', sans-serif;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(34,211,238,0.5);
}
.tour-celebrate-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(34,211,238,0.7); }
/* Confetti particles */
.confetti {
    position: absolute;
    width: 8px;
    height: 14px;
    top: -20px;
    animation: confettiFall linear forwards;
    pointer-events: none;
}
@keyframes confettiFall {
    to { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}
