        @import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;700&family=Orbitron:wght@900&display=swap');

        /* --- VARIABLES & RESET --- */
        :root {
            --primary: #00ffff;
            --secondary: #ff00cc;
            --glass: rgba(0, 10, 20, 0.9);
            --gold: #ffd700;
            --silver: #e0e0e0;
            --bronze: #cd7f32;
            --ice: #aaffff;
            --dark-bg: #050505;
        }

        body {
            margin: 0; overflow: hidden; background-color: var(--dark-bg);
            font-family: 'Rajdhani', sans-serif;
            touch-action: none; user-select: none; -webkit-user-select: none;
            cursor: none; 
        }
        
        body.mouse-active { cursor: default; }

        #canvas-container { width: 100vw; height: 100vh; display: block; }

        /* === CACHE NOTICE BANNER === */
        #cache-notice {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0;
            z-index: 99999;
            background: linear-gradient(90deg, rgba(10,5,0,0.97) 0%, rgba(20,10,0,0.97) 50%, rgba(10,5,0,0.97) 100%);
            border-bottom: 1px solid rgba(255,180,0,0.45);
            box-shadow: 0 2px 20px rgba(255,160,0,0.2), inset 0 -1px 0 rgba(255,200,0,0.1);
            padding: 10px 16px 10px 14px;
            align-items: flex-start;
            justify-content: space-between;
            gap: 12px;
            font-family: 'Rajdhani', sans-serif;
        }
        #cache-notice-icon {
            font-size: 1.3rem;
            color: #ffb700;
            text-shadow: 0 0 12px rgba(255,180,0,0.8);
            flex-shrink: 0;
            margin-top: 2px;
        }
        #cache-notice-body {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            flex: 1;
        }
        #cache-notice-text {
            font-size: 0.85rem;
            color: #e8c96a;
            line-height: 1.5;
            letter-spacing: 0.3px;
        }
        #cache-notice-text strong {
            color: #ffd060;
            font-size: 0.9rem;
            letter-spacing: 1px;
            font-family: 'Orbitron', sans-serif;
            font-weight: 900;
        }
        .cache-how {
            display: inline-block;
            margin-top: 4px;
            font-size: 0.78rem;
            color: rgba(255,200,80,0.65);
            letter-spacing: 0.2px;
        }
        #cache-notice-close {
            background: transparent;
            border: 1px solid rgba(255,180,0,0.35);
            color: rgba(255,180,0,0.7);
            font-size: 0.85rem;
            padding: 3px 9px;
            cursor: pointer;
            border-radius: 2px;
            transition: 0.15s;
            flex-shrink: 0;
            font-family: 'Rajdhani', sans-serif;
            width: auto;
            margin-top: 2px;
            letter-spacing: 1px;
        }
        #cache-notice-close:hover {
            background: rgba(255,180,0,0.15);
            color: #ffb700;
            border-color: rgba(255,180,0,0.7);
            transform: none;
            box-shadow: none;
        }

        @media (max-width: 600px) {
            #cache-notice { padding: 9px 10px 9px 10px; gap: 8px; }
            #cache-notice-text { font-size: 0.78rem; }
            #cache-notice-text strong { font-size: 0.78rem; letter-spacing: 0; }
            .cache-how { font-size: 0.7rem; }
        }

        /* === LOADING SCREEN === */
        #loading-screen {
            position: fixed;
            top: 0; left: 0; width: 100%; height: 100%;
            background: linear-gradient(135deg, #050510 0%, #0a0a25 50%, #050510 100%);
            display: flex; flex-direction: column;
            justify-content: center; align-items: center;
            z-index: 9999;
            transition: opacity 1s ease;
            overflow: hidden;
        }

        #loading-screen::after {
            content: " ";
            display: block;
            position: absolute;
            top: 0; left: 0; bottom: 0; right: 0;
            background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
            z-index: 10000;
            background-size: 100% 4px, 3px 100%;
            pointer-events: none;
            opacity: 0.3;
        }

        #loading-screen.fade-out {
            opacity: 0;
            pointer-events: none;
        }

        #logo-container {
            width: 180px; height: 180px;
            margin-bottom: 40px;
            position: relative;
        }

        #game-logo {
            width: 100%; height: 100%;
            border-radius: 30px;
            box-shadow: 0 0 30px var(--primary), 0 0 60px rgba(0, 255, 255, 0.3);
            object-fit: cover;
            animation: logoPulse 2s ease-in-out infinite;
        }

        @keyframes logoPulse {
            0%, 100% { 
                box-shadow: 0 0 30px var(--primary), 0 0 60px rgba(0, 255, 255, 0.3);
                transform: scale(1);
            }
            50% { 
                box-shadow: 0 0 50px var(--primary), 0 0 100px rgba(0, 255, 255, 0.5), 0 0 20px var(--secondary);
                transform: scale(1.05);
            }
        }

        #progress-container {
            width: 80%; max-width: 400px;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: 20px;
            border: 1px solid rgba(0, 255, 255, 0.3);
        }

        #progress-bar {
            width: 0%;
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--secondary));
            transition: width 0.2s ease;
            box-shadow: 0 0 15px var(--primary);
        }

        #loading-text {
            font-family: 'Orbitron', sans-serif;
            font-size: 14px;
            color: var(--primary);
            letter-spacing: 3px;
            margin-bottom: 10px;
            text-shadow: 0 0 10px var(--primary);
        }

        #tip-text {
            font-size: 14px;
            color: #888;
            margin-top: 30px;
            font-style: italic;
            min-height: 40px;
            text-align: center;
            padding: 0 30px;
            max-width: 500px;
            line-height: 1.4;
            transition: opacity 0.3s ease;
        }

        #start-prompt {
            display: none;
            margin-top: 40px;
            font-family: 'Orbitron', sans-serif;
            font-size: 18px;
            color: var(--primary);
            letter-spacing: 4px;
            text-transform: uppercase;
            animation: blinkPrompt 1.5s ease-in-out infinite;
            cursor: pointer;
        }

        @keyframes blinkPrompt {
            0%, 100% { opacity: 1; text-shadow: 0 0 20px var(--primary); }
            50% { opacity: 0.5; text-shadow: 0 0 10px var(--primary); }
        }

        /* --- UI LAYOUT --- */
        #ui {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none; display: flex; flex-direction: column;
            justify-content: space-between; padding: 20px; box-sizing: border-box; z-index: 10;
            transition: transform 0.3s ease;
        }

        body.tv-mode #ui, body.tv-mode #battle-overlay {
            transform: scale(1.15);
            transform-origin: center center;
            width: 86.9%;
            height: 86.9%;
            margin: 6.5%;
            padding: 0;
        }
        
        body.tv-mode .freeze-container { display: none !important; }
        body.mp-active #coin-panel { opacity: 0; }
        body.tv-mode #mute-btn {
            position: absolute; top: 20px; right: 20px; font-size: 3rem; z-index: 200;
        }
        
        .hud-top { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; }

        .panel {
            background: var(--glass); backdrop-filter: blur(4px);
            border: 1px solid rgba(0,255,255,0.5); border-left: 4px solid var(--primary);
            padding: 10px 25px; transform: skewX(-15deg);
            box-shadow: 0 0 25px rgba(0,255,255,0.2);
            animation: hudSlideDown 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            transition: all 0.3s ease;
        }

        .label { display: block; font-size: 0.9rem; color: #ccc; letter-spacing: 2px; transform: skewX(15deg); font-weight: 700; margin-bottom: 2px; }
        .value { font-family: 'Orbitron', sans-serif; font-size: 2.2rem; color: #fff; transform: skewX(15deg); text-shadow: 0 0 15px var(--primary); }
        .value.switching { animation: valueSwitch 0.5s ease-in-out; color: var(--gold) !important; text-shadow: 0 0 20px var(--gold) !important; }
        
        #score-val { color: #ffff00; text-shadow: 0 0 15px #ffff00; white-space: nowrap; }

        #session-timer {
            position: absolute; top: 20px; left: 50%; transform: translateX(-50%) skewX(-15deg);
            background: rgba(0,0,0,0.6); border: 1px solid var(--gold); border-bottom: 4px solid var(--gold);
            padding: 5px 30px; color: var(--gold); font-family: 'Orbitron'; font-size: 2rem;
            text-shadow: 0 0 10px var(--gold); display: none; 
        }
        body.tv-mode #session-timer { display: block; animation: hudSlideDown 0.5s; }

        #combo-box { position: absolute; top: 110px; left: 20px; opacity: 0; transition: opacity 0.2s; transform: skewX(-10deg); }
        .combo-text { font-family: 'Orbitron', sans-serif; font-size: 3.5rem; color: #ff0055; text-shadow: 0 0 25px #ff0055; font-style: italic; }

        #powerups { position: absolute; bottom: 140px; left: 30px; display: flex; flex-direction: column; gap: 12px; transition: all 0.3s ease; }
        .powerup-badge {
            display: flex; align-items: center; gap: 12px; opacity: 0; transition: all 0.3s;
            transform: skewX(-10deg); background: rgba(0,0,0,0.7); padding: 10px 25px;
            border-radius: 4px; border-left: 4px solid #fff; box-shadow: 0 0 10px rgba(0,0,0,0.5);
        }
        .p-icon { font-size: 1.8rem; animation: pulse 0.8s infinite; }
        .p-text { font-family: 'Orbitron', sans-serif; color: #fff; font-size: 1.3rem; }
        .p-timer { display: none; font-family: 'Orbitron', sans-serif; color: #ff0000; font-size: 1.8rem; font-weight: 900; text-shadow: 0 0 10px red; }
        
        #shield-badge { border-color: #0088ff; } #shield-badge .p-text { color: #0088ff; text-shadow: 0 0 15px #0088ff; }
        #magnet-badge { border-color: #aa00ff; } #magnet-badge .p-text { color: #aa00ff; text-shadow: 0 0 15px #aa00ff; }
        #frozen-badge { border-color: var(--ice); } #frozen-badge .p-text { color: var(--ice); text-shadow: 0 0 15px var(--ice); }
        #rainbow-badge { border-color: #fff; background: linear-gradient(90deg, rgba(255,0,0,0.4), rgba(0,255,0,0.4), rgba(0,0,255,0.4)); }
        #rainbow-badge .p-text { background: linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; font-weight: 900; filter: drop-shadow(0 0 5px rgba(255,255,255,0.5)); }

        #rainbow-badge.warning { animation: pulseWarning 1s infinite; }
        #rainbow-badge.warning .p-text { display: none; }
        #rainbow-badge.warning .p-timer { display: block; }
        @keyframes pulseWarning { 
            0%, 100% { background-color: rgba(50,0,0,0.7); box-shadow: 0 0 10px #ff0000; } 
            50% { background-color: rgba(255,0,0,0.7); box-shadow: 0 0 25px #ff0000; } 
        }

        .speed-container { position: absolute; bottom: 30px; right: 30px; text-align: right; animation: hudSlideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); transition: all 0.3s ease; }
        .speed-bar-bg { width: 300px; height: 16px; background: rgba(255,255,255,0.15); transform: skewX(-30deg); border: 2px solid #777; overflow: hidden; margin-top: 8px; box-shadow: 0 0 10px rgba(0,0,0,0.5); }
        .speed-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #00ffff, #ff00cc, #ff0000); box-shadow: 0 0 25px #ff00cc; transition: width 0.05s; }

        .freeze-container {
            position: absolute; bottom: 30px; left: 30px; 
            width: 100px; height: 100px;
            pointer-events: auto; cursor: pointer;
            display: flex; justify-content: center; align-items: center;
            animation: hudSlideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            transition: all 0.3s ease;
        }
        .freeze-ring { position: absolute; width: 100%; height: 100%; border: 2px dashed #333; border-radius: 50%; transition: 0.3s; }
        .freeze-hex {
            width: 80px; height: 80px; background: rgba(0, 10, 20, 0.8);
            clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
            display: flex; justify-content: center; align-items: center; position: relative;
            border: 2px solid #333; transition: all 0.2s; overflow: hidden; z-index: 2;
        }
        .freeze-hex::after { content: ''; position: absolute; inset: 0; border: 2px solid #555; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); pointer-events: none; }
        .freeze-fill { position: absolute; bottom: 0; left: 0; width: 100%; height: 0%; background: linear-gradient(to top, #0088ff, var(--ice)); opacity: 0.5; transition: height 0.1s linear; z-index: 0; }
        .freeze-icon { font-size: 2.5rem; z-index: 2; filter: grayscale(1) opacity(0.5); transition: 0.3s; }
        .freeze-key { position: absolute; top: -30px; width: 150px; text-align: center; font-family: 'Orbitron'; font-size: 0.8rem; color: #555; font-weight: bold; text-shadow: 0 0 2px black; letter-spacing: 1px; transition: 0.3s; }
        .freeze-ripple { position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; border: 4px solid var(--ice); transform: translate(-50%, -50%); opacity: 0; pointer-events: none; z-index: 1; }
        .freeze-ripple.animate { animation: rippleEffect 0.6s ease-out; }
        @keyframes rippleEffect { 0% { width: 0; height: 0; opacity: 1; border-width: 10px; } 100% { width: 300px; height: 300px; opacity: 0; border-width: 0px; } }
        .freeze-container.ready .freeze-ring { border-color: var(--ice); border-style: solid; border-top-color: transparent; border-left-color: transparent; animation: spinRing 1s linear infinite; box-shadow: 0 0 15px var(--ice), inset 0 0 15px var(--ice); }
        .freeze-container.ready .freeze-hex { background: rgba(0, 40, 60, 0.9); transform: scale(1.1); box-shadow: 0 0 30px rgba(170, 255, 255, 0.4); }
        .freeze-container.ready .freeze-hex::after { border-color: var(--ice); }
        .freeze-container.ready .freeze-icon { filter: grayscale(0) drop-shadow(0 0 10px white); animation: pulseIcon 0.8s infinite alternate; }
        .freeze-container.ready .freeze-key { color: var(--ice); text-shadow: 0 0 8px var(--ice); animation: blinkText 1s infinite; }
        .freeze-container.active .freeze-hex { animation: drainShake 0.2s infinite; border-color: white; }

        /* --- BATTLE DEBUG OVERLAY --- */
        #battle-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none; z-index: 5; display: none;
        }
        .battle-grid {
            display: grid; width: 100%; height: 100%;
            grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
        }
        .battle-grid.two-player {
            grid-template-columns: 1fr 1fr; grid-template-rows: 1fr;
        }
        .battle-cell {
            border: 2px solid rgba(255,255,255,0.05); position: relative;
            box-sizing: border-box; transition: 0.2s; pointer-events: auto;
        }
        .battle-cell.dead {
            border: 4px solid #ff0000;
            background: rgba(50, 0, 0, 0.5);
        }
        
        .battle-name-input {
            position: absolute; top: 10px; left: 10px;
            background: rgba(0,0,0,0.7); color: #fff; border: 1px solid #555;
            font-family: 'Orbitron'; font-size: 0.8rem; padding: 4px 8px;
            pointer-events: auto; width: 120px;
        }
        .battle-name-input:focus { border-color: var(--primary); outline: none; }

        .ingame-name-tag {
            position: absolute; bottom: 30px; left: 0; width: 100%; text-align: center;
            font-family: 'Orbitron', sans-serif; font-size: 1.8rem; font-weight: 900;
            color: rgba(255, 255, 255, 0.75); text-shadow: 0 0 10px black, 0 0 20px var(--primary);
            pointer-events: none; opacity: 0.65;
            text-transform: uppercase; letter-spacing: 2px;
            transform: translateY(0);
        }
        .ingame-name-tag.animate-in {
            animation: nameEntrySlide 2s ease-out forwards;
        }

        @keyframes nameEntrySlide {
            0% { opacity: 0; transform: translateY(30px); }
            30% { opacity: 1; transform: translateY(0); }
            100% { opacity: 0.65; transform: translateY(0); }
        }

        .battle-status {
            position: absolute; bottom: 10px; right: 10px;
            font-family: 'Orbitron'; font-size: 1rem; color: #fff;
            text-shadow: 0 0 10px black; opacity: 0.8;
        }

        /* --- VIRTUAL CURSOR --- */
        #virtual-cursor {
            position: absolute; width: 20px; height: 20px;
            border: 2px solid var(--primary); border-radius: 50%;
            background: rgba(0,255,255,0.3);
            box-shadow: 0 0 15px var(--primary), inset 0 0 10px var(--primary);
            pointer-events: none; z-index: 9999;
            transform: translate(-50%, -50%);
            display: none;
            transition: transform 0.1s;
        }
        #virtual-cursor.active { display: block; }
        #virtual-cursor.click { transform: translate(-50%, -50%) scale(0.8); background: var(--primary); }

        /* === DANGER VIGNETTE === */
        #danger-vignette {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none; z-index: 35; opacity: 0;
            box-shadow: inset 0 0 120px 40px rgba(255, 20, 20, 0.85);
            transition: opacity 0.08s linear;
        }

        /* === SCORE MILESTONE BANNER === */
        #milestone-banner {
            position: fixed; top: 30%; left: 50%; transform: translate(-50%, -50%);
            pointer-events: none; z-index: 50;
            font-family: 'Orbitron', sans-serif; font-weight: 900;
            font-size: clamp(0.9rem, 2.8vw, 1.6rem);
            color: var(--gold); letter-spacing: 4px;
            text-shadow: 0 0 15px var(--gold), 0 0 35px rgba(255,215,0,0.5);
            opacity: 0; white-space: nowrap;
        }
        #milestone-banner.milestone-show {
            animation: milestonePop 2.5s ease forwards;
        }
        @keyframes milestonePop {
            0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
            10%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
            18%  { transform: translate(-50%, -50%) scale(1); }
            70%  { opacity: 1; }
            100% { opacity: 0; transform: translate(-50%, -70%); }
        }

        #winner-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.9); z-index: 200; display: none;
            flex-direction: column; justify-content: center; align-items: center;
            animation: modalPop 0.5s;
        }
        
        .ranking-container {
            display: flex; flex-direction: column; gap: 20px; width: 80%; max-width: 800px;
        }
        .rank-row {
            display: flex; align-items: center; justify-content: space-between;
            background: rgba(255,255,255,0.05); padding: 20px;
            border: 1px solid #444; border-radius: 8px; transform: skewX(-15deg);
            animation: slideIn 0.5s backwards;
        }
        .rank-row.rank-1 { border: 2px solid var(--gold); background: linear-gradient(90deg, rgba(255,215,0,0.2), transparent); animation-delay: 0.1s; transform: skewX(-15deg) scale(1.1); box-shadow: 0 0 30px rgba(255,215,0,0.2); }
        .rank-row.rank-2 { border: 2px solid var(--silver); animation-delay: 0.3s; }
        .rank-row.rank-3 { border: 2px solid var(--bronze); animation-delay: 0.5s; }
        
        .rank-pos { font-family: 'Orbitron'; font-size: 3rem; font-weight: 900; width: 80px; text-align: center; }
        
        .rank-row.rank-1 .rank-pos, .rank-row.rank-1 .trophy-icon { color: #ffd700 !important; text-shadow: 0 0 20px #ffd700 !important; }
        .rank-row.rank-2 .rank-pos, .rank-row.rank-2 .trophy-icon { color: #e0e0e0 !important; text-shadow: 0 0 20px #e0e0e0 !important; }
        .rank-row.rank-3 .rank-pos, .rank-row.rank-3 .trophy-icon { color: #cd7f32 !important; text-shadow: 0 0 20px #cd7f32 !important; }
        
        .trophy-icon { font-size: 2.5rem; margin-right: 20px; font-family:'Orbitron'; font-weight:900; }
        .rank-row.rank-1 .trophy-icon { animation: pulse 1s infinite; }
        
        .rank-name { font-family: 'Rajdhani'; font-size: 2rem; color: #fff; flex-grow: 1; text-align: left; font-weight: bold; }
        .rank-score { font-family: 'Orbitron'; font-size: 1.8rem; color: var(--primary); }

        .win-close-btn {
            position: absolute; top: 30px; right: 30px;
            font-size: 2rem; color: #fff; background: transparent; border: 2px solid #fff;
            width: 60px; height: 60px; border-radius: 50%; cursor: pointer;
            display: flex; justify-content: center; align-items: center;
            font-family: 'Orbitron'; transition: 0.2s;
        }
        .win-close-btn:hover { background: #fff; color: #000; box-shadow: 0 0 20px #fff; }

        /* --- OVERLAYS --- */
        #floating-text-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
        .float-item { position: absolute; font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 2rem; color: #fff; text-shadow: 0 0 15px currentColor; animation: floatUp 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; z-index: 15; }
        
        #tutorial-ui { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; display: none; z-index: 50; }

        /* ── Tutorial animations ────────────────────────────────────────── */
        @keyframes tutSlideIn {
            0%   { opacity:0; transform:translateX(-50%) translateY(-28px) scale(.92); }
            65%  { transform:translateX(-50%) translateY(5px) scale(1.02); }
            100% { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
        }
        @keyframes tutSlideOut {
            0%   { opacity:1; transform:translateX(-50%) translateY(0) scale(1); }
            100% { opacity:0; transform:translateX(-50%) translateY(-20px) scale(.92); }
        }
        @keyframes tutStepEnter {
            0%   { opacity:0; transform:translateX(-50%) scale(.94); }
            60%  { transform:translateX(-50%) scale(1.03); }
            100% { opacity:1; transform:translateX(-50%) scale(1); }
        }
        @keyframes tutPulseGlow {
            0%,100% { box-shadow: 0 0 18px rgba(0,255,255,.15), 0 0 0 1px rgba(0,255,255,.1); }
            50%     { box-shadow: 0 0 36px rgba(0,255,255,.35), 0 0 0 1px rgba(0,255,255,.25); }
        }
        @keyframes tutArrowBounce {
            0%,100% { transform: translateX(-50%) translateY(0) scale(1); }
            50%     { transform: translateX(-50%) translateY(-18px) scale(1.1); }
        }
        @keyframes tutArrowBounceLeft {
            0%,100% { transform: translateX(-50%) scale(1); }
            50%     { transform: translateX(calc(-50% - 16px)) scale(1.1); }
        }
        @keyframes tutArrowBounceRight {
            0%,100% { transform: translateX(-50%) scale(1); }
            50%     { transform: translateX(calc(-50% + 16px)) scale(1.1); }
        }
        @keyframes tutArrowBounceSide {
            0%,100% { transform: translateX(-50%) scaleX(1); filter: drop-shadow(0 0 14px rgba(0,255,255,.7)); }
            50%     { transform: translateX(-50%) scaleX(1.12); filter: drop-shadow(0 0 32px rgba(0,255,255,.95)); }
        }
        @keyframes tutArrowPulse {
            0%,100% { transform: translateX(-50%) scale(1);   filter: drop-shadow(0 0 14px rgba(255,200,0,.8)); }
            50%     { transform: translateX(-50%) scale(1.18); filter: drop-shadow(0 0 36px rgba(255,200,0,1)); }
        }
        @keyframes tutArrowInfoPop {
            0%   { opacity:0; transform: translateX(-50%) scale(.6); }
            60%  { transform: translateX(-50%) scale(1.12); }
            100% { opacity:1; transform: translateX(-50%) scale(1); }
        }
        @keyframes tutArrowDown {
            0%,100% { transform: translateX(-50%) translateY(0) scale(1); }
            50%     { transform: translateX(-50%) translateY(18px) scale(1.1); }
        }
        @keyframes tutBadgePop {
            0%   { opacity:0; transform:scale(.5); }
            70%  { transform:scale(1.15); }
            100% { opacity:1; transform:scale(1); }
        }
        @keyframes tutKeyPop {
            0%   { opacity:0; transform:translateY(8px); }
            100% { opacity:1; transform:translateY(0); }
        }

        /* ── Card (text + keys only, no arrow inside) ────────────────────── */
        .tut-container {
            position: absolute; top: 18%; left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(160deg, rgba(0,6,20,.93) 0%, rgba(0,3,12,.96) 100%);
            border: 1px solid rgba(0,255,255,.3);
            padding: 22px 40px 20px;
            border-radius: 14px;
            box-shadow: 0 0 24px rgba(0,255,255,.14), 0 0 0 1px rgba(0,255,255,.08), inset 0 1px 0 rgba(0,255,255,.05);
            text-align: center;
            backdrop-filter: blur(10px);
            animation: tutSlideIn 0.5s cubic-bezier(0.22,1,0.36,1) both, tutPulseGlow 2.6s ease-in-out 0.6s infinite;
            min-width: 270px; max-width: 90vw;
        }
        .tut-container.tut-step-exit {
            animation: tutSlideOut .28s cubic-bezier(0.6,0,.8,.4) both !important;
        }
        .tut-container.tut-step-enter {
            animation: tutStepEnter .42s cubic-bezier(0.22,1,0.36,1) both !important;
        }

        /* ── Free-floating neon arrow (SVG-based, no emoji) ────────────────── */
        #tut-arrow {
            position: absolute;
            bottom: 22%;
            left: 50%;
            transform: translateX(-50%);
            display: flex; align-items: center; justify-content: center; gap: 10px;
            pointer-events: none;
            animation: tutArrowBounce 1.0s ease-in-out infinite;
            transition: opacity .25s;
        }
        #tut-arrow.tut-arrow-down   { animation: tutArrowDown  1.0s ease-in-out infinite; }
        #tut-arrow.tut-arrow-side   { animation: tutArrowBounceSide 0.9s ease-in-out infinite; }
        #tut-arrow.tut-arrow-dash   { animation: tutArrowPulse 0.85s ease-in-out infinite; }
        #tut-arrow.tut-arrow-info   { animation: tutArrowInfoPop 0.5s cubic-bezier(0.22,1,0.36,1) both; }

        /* SVG neon arrow sizing */
        .tut-na-svg       { width: 56px; height: 74px; overflow: visible; display: block; }
        .tut-na-svg-h     { width: 74px; height: 56px; }
        #tut-arrow.tut-arrow-side .tut-na-svg-h { width: 88px; height: 66px; }
        #tut-arrow.tut-arrow-dash .tut-na-svg   { width: 80px; height: 54px; }
        #tut-arrow.tut-arrow-info .tut-na-svg   { width: 76px; height: 58px; }

        /* ── Death shockwave rings ──────────────────────────────────────────── */
        .death-shockwave, .death-shockwave-2 {
            position: fixed;
            width: 0; height: 0;
            border-radius: 50%;
            border: 6px solid #ff4400;
            box-shadow: 0 0 18px #ff4400, inset 0 0 18px rgba(255,68,0,.3);
            transform: translate(-50%, -50%);
            pointer-events: none;
            z-index: 201;
            animation: deathShockExpand 0.85s cubic-bezier(0, 0.2, 0.4, 1) forwards;
        }
        .death-shockwave-2 {
            border-color: #ffaa00;
            box-shadow: 0 0 18px #ffaa00;
            animation-duration: 0.7s;
        }
        @keyframes deathShockExpand {
            0%   { width: 0; height: 0; opacity: 1; border-width: 8px; }
            100% { width: 600px; height: 600px; opacity: 0; border-width: 1px; }
        }

        /* Step badge */
        .tut-step-badge {
            display: inline-block;
            font-family: 'Rajdhani', sans-serif;
            font-size: .62rem; font-weight: 700; letter-spacing: 2px;
            color: rgba(0,255,255,.45);
            border: 1px solid rgba(0,255,255,.12);
            border-radius: 20px; padding: 2px 10px;
            margin-bottom: 10px;
            animation: tutBadgePop .4s cubic-bezier(0.22,1,0.36,1) .1s both;
        }

        /* Main instruction text */
        .tut-msg {
            font-family: 'Orbitron', sans-serif;
            font-size: 1.3rem; font-weight: 900;
            color: #fff;
            text-shadow: 0 0 10px rgba(0,255,255,.65), 0 0 26px rgba(0,255,255,.25);
            margin-bottom: 6px;
            letter-spacing: 1.5px;
            line-height: 1.3;
        }
        .tut-msg.tut-msg-info {
            color: #ffe88a;
            text-shadow: 0 0 10px rgba(255,220,80,.6), 0 0 24px rgba(255,200,0,.2);
            font-size: 1.05rem;
        }

        /* Subtitle hint */
        .tut-sub {
            font-family: 'Rajdhani', sans-serif;
            font-size: .8rem; letter-spacing: 1.5px;
            color: rgba(0,255,255,.5);
            margin-top: 4px;
            min-height: 1.1em;
            transition: opacity .3s;
        }
        .tut-sub.tut-sub-info { color: rgba(255,220,120,.55); }

        /* Key pill row */
        .tut-key-row {
            display: flex; align-items: center; justify-content: center;
            gap: 6px; margin-top: 14px;
        }
        .tut-key {
            display: inline-flex; align-items: center; justify-content: center;
            font-family: 'Orbitron', sans-serif; font-size: .7rem; font-weight: 900;
            color: #00ffff;
            background: rgba(0,255,255,.07);
            border: 1px solid rgba(0,255,255,.28);
            border-bottom: 2px solid rgba(0,255,255,.45);
            border-radius: 5px;
            padding: 4px 10px; min-width: 32px;
            animation: tutKeyPop .35s ease both;
            box-shadow: 0 0 8px rgba(0,255,255,.1);
        }
        .tut-key-dash {
            color: #ffcc00;
            border-color: rgba(255,200,0,.35);
            border-bottom-color: rgba(255,200,0,.6);
            background: rgba(255,200,0,.06);
            box-shadow: 0 0 10px rgba(255,200,0,.15);
        }
        .tut-key-or {
            font-family: 'Rajdhani', sans-serif;
            font-size: .6rem; color: rgba(255,255,255,.22); letter-spacing: 1px;
        }

        /* Mobile adjustments */
        @media (max-width:600px) {
            .tut-container { top: 16%; padding: 18px 20px 16px; min-width: 210px; max-width: 88vw; }
            .tut-msg { font-size: 1.05rem; }
            .tut-msg.tut-msg-info { font-size: .9rem; }
            #tut-arrow { bottom: 20%; }
            .tut-na-svg { width: 44px; height: 58px; }
            .tut-na-svg-h { width: 58px; height: 44px; }
            .tut-sub { font-size: .72rem; }
            .tut-key { font-size: .62rem; padding: 3px 8px; }
        }
        #flash-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: white; opacity: 0; pointer-events: none; z-index: 100; transition: opacity 0.1s; }
        #hyperspace-overlay { position: absolute; top: 50%; left: 50%; width: 0; height: 0; background: radial-gradient(circle, #fff 0%, var(--primary) 40%, transparent 70%); transform: translate(-50%, -50%); border-radius: 50%; opacity: 0; pointer-events: none; z-index: 90; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
        #hyperspace-overlay.active { width: 300vmax; height: 300vmax; opacity: 1; transition: all 3s ease-in; }
        #countdown-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; justify-content: center; align-items: center; pointer-events: none; z-index: 150; background: rgba(0,0,0,0.3); }
        .count-digit { font-family: 'Orbitron', sans-serif; font-size: 15rem; font-weight: 900; color: #fff; text-shadow: 0 0 50px var(--primary); animation: countPop 0.8s ease-out forwards; }
        
        /* --- MENU --- */
        #overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(15px); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 20; transition: opacity 0.4s; pointer-events: auto; }
        h1 { font-family: 'Orbitron', sans-serif; font-size: 5rem; margin: 0; background: linear-gradient(to bottom, #fff, var(--primary)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-transform: uppercase; font-style: italic; filter: drop-shadow(0 0 30px var(--primary)); text-align: center; line-height: 0.9; animation: titleFlyIn 0.85s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, titlePulse 3s 0.9s infinite ease-in-out; }
        .menu-stats { display: flex; gap: 30px; margin: 20px 0; animation: fadeIn 1s ease-out 0.2s backwards; }
        .stat-box { text-align: center; color: #fff; font-family: 'Rajdhani', sans-serif; }
        .stat-label { font-size:1rem; color:#aaa; font-weight:700; transition: color 0.3s; }
        .stat-val { font-size: 1.5rem; color: var(--gold); font-weight: bold; transition: color 0.3s; }
        .controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; animation: fadeIn 1s ease-out 0.4s backwards; }
        .c-item { background: rgba(255,255,255,0.08); padding: 15px; border: 1px solid #444; text-align: center; border-radius: 4px; }
        .c-key { color: var(--primary); font-weight: bold; display: block; margin-bottom: 8px; font-size: 1.2rem; }
        .c-desc { color: #aaa; font-size: 0.9rem; }
        .btn-row { display: flex; gap: 20px; margin-top: 20px; justify-content: center; animation: fadeIn 1s ease-out 0.6s backwards; }
        button { padding: 20px 60px; font-size: 1.5rem; font-family: 'Orbitron', sans-serif; font-weight: 900; background: transparent; color: var(--primary); border: 2px solid var(--primary); cursor: pointer; box-shadow: 0 0 25px rgba(0,255,255,0.2); transition: all 0.15s; text-transform: uppercase; letter-spacing: 3px; position: relative; overflow: hidden; }
        button::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: 0.5s; }
        button:hover::before { left: 100%; }
        button:hover { background: var(--primary); color: #000; box-shadow: 0 0 60px var(--primary), inset 0 0 10px rgba(255,255,255,0.5); transform: scale(1.05); text-shadow: none; }
        button:active { transform: scale(0.95); filter: contrast(1.2); }
        button.clicked { animation: btnHyperspace 0.4s forwards; }
        .btn-secondary { border-color: var(--secondary); color: var(--secondary); font-size: 1.2rem; padding: 15px 30px; }
        .btn-secondary:hover { background: var(--secondary); box-shadow: 0 0 40px var(--secondary); }
        .btn-settings { border-color: #fff; color: #fff; font-size: 1.2rem; padding: 15px 30px; }
        .btn-settings:hover { background: #fff; color: #000; box-shadow: 0 0 40px #fff; }
        .btn-online { border-color: #00ff88; color: #00ff88; font-size: 1rem; padding: 12px 35px; letter-spacing: 3px; }
        .btn-online:hover { background: #00ff88; color: #000; box-shadow: 0 0 40px #00ff88; }
        #mute-btn { pointer-events: auto; font-size: 2.5rem; cursor: pointer; opacity: 0.9; filter: drop-shadow(0 0 8px white); transition: transform 0.2s; }
        #mute-btn:hover { transform: scale(1.2); }
        
        /* --- DEATH JOKE TEXT --- */
        #death-msg {
            font-family: 'Orbitron', sans-serif; font-size: 1.5rem; color: #ff0055;
            text-shadow: 0 0 5px rgba(0,0,0,0.8);
            margin-top: 15px; height: 30px; background: transparent;
            opacity: 0; transition: opacity 0.5s; text-transform: uppercase; letter-spacing: 2px;
            pointer-events: none;
        }

        /* --- NEW HIGH SCORE POPUP --- */
        #highscore-popup {
            position: absolute; top: 80px; left: 50%; transform: translateX(-50%) translateY(-20px);
            background: rgba(10, 5, 0, 0.9); border: 2px solid var(--gold);
            padding: 10px 25px; display: flex; flex-direction: column; align-items: center; justify-content: center;
            z-index: 300; transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            box-shadow: 0 0 30px rgba(255, 215, 0, 0.4); border-radius: 4px; pointer-events: none;
            opacity: 0;
        }
        #highscore-popup.show { 
            transform: translateX(-50%) translateY(0); 
            opacity: 1; 
            animation: pulseGold 1s infinite alternate; 
        }
        .hs-icon { font-size: 2.5rem; margin-bottom: 5px; }
        .hs-text { color: var(--gold); font-family: 'Orbitron'; font-weight: bold; font-size: 1.2rem; letter-spacing: 1px; }
        .hs-val { color: #fff; font-family: 'Rajdhani'; font-weight: bold; font-size: 1.5rem; }
        @keyframes pulseGold { 0% { box-shadow: 0 0 20px rgba(255,215,0,0.3); transform: translateX(-50%) scale(1); } 100% { box-shadow: 0 0 40px rgba(255,215,0,0.6); transform: translateX(-50%) scale(1.05); } }
        @keyframes valueSwitch { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

        /* --- MODALS --- */
        .modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,2,5,0.92); backdrop-filter: blur(20px); z-index: 30; display: none; flex-direction: column; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
        .modal-container { display: flex; flex-direction: column; width: 100%; max-width: 1000px; height: 90vh; background: rgba(0, 10, 20, 0.8); border: 2px solid rgba(0, 255, 255, 0.2); border-radius: 12px; overflow: hidden; box-shadow: 0 0 80px rgba(0,0,0,0.9), inset 0 0 20px rgba(0, 255, 255, 0.05); position: relative; }
        .modal-container::before { content: ""; position: absolute; top:0; left:0; right:0; height: 2px; background: linear-gradient(90deg, transparent, var(--primary), transparent); }
        .modal-header { font-family: 'Orbitron', sans-serif; font-size: 2.5rem; color: #fff; text-shadow: 0 0 20px var(--primary); padding: 20px; text-align: center; background: rgba(0,0,0,0.5); flex-shrink: 0; }
        .modal-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px; }
        .modal-content::-webkit-scrollbar { width: 5px; }
        .modal-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.3); border-radius: 3px; }
        .modal-content::-webkit-scrollbar-thumb { background: rgba(0,255,255,0.35); border-radius: 3px; }
        .modal-content::-webkit-scrollbar-thumb:hover { background: rgba(0,255,255,0.65); }
        .modal-footer { padding: 20px; text-align: center; background: rgba(0,0,0,0.5); flex-shrink: 0; border-top: 1px solid #333; }
        .modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; width: 100%; }

        .shop-item, .ach-item, .setting-item { background: rgba(255,255,255,0.05); border: 1px solid #333; padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; transition: 0.2s; }
        .shop-item:hover, .setting-item:hover { border-color: var(--primary); background: rgba(0,255,255,0.05); transform: translateY(-5px); }
        .item-name { font-family: 'Orbitron'; color: #fff; font-size: 1.2rem; margin-bottom: 10px; }
        .item-desc { color: rgba(0,255,255,0.72); font-size: 0.9rem; margin-bottom: 15px; height: 40px; text-shadow: 0 0 10px rgba(0,255,255,0.35); }
        .item-cost { color: var(--gold); font-weight: bold; font-size: 1.2rem; margin-bottom: 15px; }
        
        .buy-btn { padding: 10px 20px; font-size: 1rem; border: 1px solid var(--primary); color: var(--primary); background: transparent; cursor: pointer; }
        .buy-btn:disabled { border-color: #555; color: #555; cursor: not-allowed; box-shadow: none; }
        .buy-btn.owned { border-color: #00ff00; color: #00ff00; }
        .buy-btn.equipped { background: #00ff00; color: #000; }
        .close-btn { padding: 15px 40px; border: 1px solid #fff; color: #fff; background: transparent; cursor: pointer; }
        .close-btn:hover { background: #fff; color: #000; }

        /* --- CONTROLS TAB SPECIFIC --- */
        .key-bind-btn { min-width: 100px; font-family: 'Orbitron'; font-weight: bold; transition: 0.2s; }
        .key-bind-btn.listening { background: var(--secondary); color: white; border-color: var(--secondary); animation: pulse 0.5s infinite; }
        .control-desc-box { background: rgba(0,0,0,0.3); border: 1px dashed #555; padding: 15px; margin-top: 10px; font-size: 0.85rem; color: #aaa; text-align: left; }

        /* --- MULTIPLAYER SETUP STYLES --- */
        .controller-list { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 15px; }
        .controller-card { 
            display: flex; justify-content: space-between; align-items: center; 
            padding: 15px; background: rgba(0,0,0,0.4); border: 1px solid #444; 
            transition: all 0.2s; 
        }
        .controller-card.active { 
            border-color: #00ff00; box-shadow: 0 0 15px #00ff00; 
            background: rgba(0,255,0,0.1); 
        }
        .controller-icon { font-size: 1.5rem; margin-right: 15px; }
        .controller-info { flex-grow: 1; text-align: left; }
        .controller-id { color: #888; font-size: 0.8rem; }
        .player-name-input { 
            background: transparent; border: none; border-bottom: 1px solid #555; 
            color: var(--primary); font-family: 'Orbitron'; font-size: 1rem; 
            width: 150px; text-align: right; 
        }
        .player-name-input:focus { outline: none; border-color: var(--primary); }

        /* --- TABS FOR SETTINGS --- */
        .settings-tabs { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid #333; padding-bottom: 10px; flex-wrap: wrap; }
        .tab-btn { padding: 10px 20px; background: transparent; border: 1px solid #555; color: #888; cursor: pointer; font-family: 'Orbitron'; font-size: 1rem; transition: 0.2s; }
        .tab-btn:hover { color: #fff; border-color: #fff; }
        .tab-btn.active { background: var(--primary); color: #000; border-color: var(--primary); box-shadow: 0 0 15px var(--primary); }
        
        .tab-content { display: none; opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }
        .tab-content.active { display: block; opacity: 1; transform: translateY(0); }
        
        /* --- CREDITS & CHANGELOG SPECIFIC --- */
        .credit-info { text-align: center; color: #fff; margin-bottom: 20px; border-bottom: 1px solid #333; padding-bottom: 20px; }
        .credit-role { color: var(--primary); font-family: 'Orbitron'; font-size: 1.2rem; margin-bottom: 5px; }
        .credit-name { font-size: 1.5rem; font-weight: bold; }
        .credit-date { color: #aaa; font-size: 0.9rem; margin-top: 5px; }
        
        .changelog-container {
            width: 100%; max-width: 500px; margin: 10px auto;
        }
        .changelog-btn {
            background: transparent; border: 1px solid var(--primary); color: var(--primary);
            font-family: 'Orbitron'; font-size: 0.9rem; padding: 5px 15px; cursor: pointer;
            transition: 0.3s; display: inline-block; margin-top: 10px;
        }
        .changelog-btn:hover { background: var(--primary); color: #000; box-shadow: 0 0 15px var(--primary); }
        
        .changelog-content {
            max-height: 0; overflow: hidden; transition: max-height 0.4s ease-in-out;
            background: rgba(0,0,0,0.3); border-radius: 4px; text-align: left;
            margin-top: 5px; scrollbar-width: thin; scrollbar-color: rgba(0,255,255,.45) transparent;
        }
        .changelog-content.open { max-height: 300px; overflow-y: auto; border: 1px solid rgba(0,255,255,.2); box-shadow: inset 0 0 12px rgba(0,0,0,.4); }
        .changelog-content::-webkit-scrollbar { width: 4px; }
        .changelog-content::-webkit-scrollbar-track { background: transparent; }
        .changelog-content::-webkit-scrollbar-thumb { background: rgba(0,255,255,.45); border-radius: 2px; }
        .changelog-content::-webkit-scrollbar-thumb:hover { background: rgba(0,255,255,.75); }
        .changelog-list { list-style: none; padding: 10px; margin: 0; font-family: 'Rajdhani'; color: #ccc; font-size: 0.95rem; }
        .changelog-list li { margin-bottom: 8px; border-bottom: 1px solid rgba(0,255,255,.08); padding-bottom: 6px; line-height: 1.4; }
        .changelog-ver { color: var(--gold); font-weight: bold; margin-right: 5px; }
        
        .credits-stage {
            width: 100%; height: 100px;
            display: flex; justify-content: center; align-items: center;
            margin: 20px 0; background: rgba(0,0,0,0.3); border: 1px solid #333;
            overflow: hidden;
        }
        #credits-text {
            font-family: 'Orbitron'; font-size: 1.5rem; color: #fff;
            opacity: 0; transform: scale(0.8); transition: all 0.5s ease;
            text-align: center;
        }
        #credits-text.visible { opacity: 1; transform: scale(1); }
        #credits-text.gold { color: var(--gold); text-shadow: 0 0 10px var(--gold); }

        /* --- REDEEM CODE STYLES --- */
        .redeem-container {
            width: 80%; max-width: 400px; margin: 10px auto 30px auto;
            text-align: center; border: 1px solid #333; padding: 15px; background: rgba(0,0,0,0.5);
        }
        .redeem-input {
            width: 100%; background: rgba(255,255,255,0.1); border: 1px solid var(--primary);
            color: #fff; font-family: 'Rajdhani'; font-size: 1.2rem; padding: 10px;
            margin-bottom: 10px; text-align: center; letter-spacing: 2px;
            box-sizing: border-box;
        }
        .redeem-input:focus { outline: none; box-shadow: 0 0 10px var(--primary); background: rgba(0,255,255,0.1); }
        .redeem-btn {
            width: 100%; padding: 8px; background: transparent; border: 1px solid var(--gold);
            color: var(--gold); font-family: 'Orbitron'; cursor: pointer; transition: 0.2s;
        }
        .redeem-btn:hover { background: var(--gold); color: #000; box-shadow: 0 0 15px var(--gold); }
        #redeem-msg { height: 20px; font-size: 0.9rem; margin-top: 10px; font-weight: bold; }

        .feedback-btn {
            background: rgba(255, 215, 0, 0.1); border: 1px solid var(--gold); color: var(--gold);
            padding: 10px 25px; margin-top: 20px; font-family: 'Orbitron'; font-size: 1rem; cursor: pointer;
            transition: 0.2s; text-decoration: none; display: inline-block;
        }
        .feedback-btn:hover { background: var(--gold); color: #000; box-shadow: 0 0 20px var(--gold); }

        /* STATS TAB */
        .stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px; }
        .stat-item { background: rgba(0,0,0,0.3); border-left: 3px solid #555; padding: 15px; }
        .stat-item h4 { margin: 0 0 5px 0; font-family: 'Orbitron'; color: #aaa; font-size: 0.9rem; }
        .stat-item div { font-family: 'Rajdhani'; font-size: 1.4rem; color: #fff; font-weight: bold; }
        
        .ach-item { border-left: 4px solid #333; align-items: flex-start; text-align: left; }
        @keyframes achUnlockedGlow {
            0%, 100% { box-shadow: 0 0 6px rgba(255,215,0,0.35), 0 0 0 1px rgba(255,215,0,0.15); border-color: rgba(255,215,0,0.5); }
            50%       { box-shadow: 0 0 22px rgba(255,215,0,0.75), 0 0 40px rgba(255,215,0,0.2), 0 0 0 1px rgba(255,215,0,0.55); border-color: rgba(255,200,80,0.9); }
        }
        .ach-item.unlocked {
            border-left-color: var(--gold);
            border-color: rgba(255,215,0,0.4);
            background: linear-gradient(90deg, rgba(255,215,0,0.12), rgba(255,215,0,0.03));
            animation: achUnlockedGlow 2.5s ease-in-out infinite;
        }
        .ach-title { color: #fff; font-weight: bold; font-size: 1.2rem; }
        .ach-desc { color: rgba(0,255,255,0.72); font-size: 0.88rem; margin: 5px 0; line-height: 1.4; text-shadow: 0 0 10px rgba(0,255,255,0.35); }
        .ach-reward { color: var(--gold); font-size: 0.9rem; margin-top: 5px; font-weight: bold; letter-spacing: 1px; }

        .track-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 15px; background: rgba(0,0,0,0.3); border: 1px solid #444; margin-bottom: 10px; cursor: pointer; transition: 0.2s; box-sizing: border-box; }
        .track-item:hover { border-color: var(--primary); }
        .track-item.active { border-color: #00ff00; background: rgba(0,255,0,0.1); }
        .track-item.locked { opacity: 0.5; cursor: not-allowed; border-color: #333; }
        .track-name { color: #fff; font-weight: bold; }
        .track-status { font-size: 0.8rem; color: #aaa; }
        input[type=range] { width: 100%; accent-color: var(--primary); margin: 10px 0; }
        .setting-row { margin-bottom: 25px; color: white; font-family: 'Orbitron'; }
        .setting-row-flex { display: flex; justify-content: space-between; align-items: center; }
        .setting-row-col { display: flex; flex-direction: column; gap: 10px; }
        .row-between { display: flex; justify-content: space-between; align-items: center; }
        .toggle-btn { padding: 5px 15px !important; font-size: 0.9rem !important; }
        .panel-balance { margin: 0 auto 20px auto; width: fit-content; }
        .settings-section-title.centered { width: 100%; text-align: center; }
        .res-btn-full { flex: 1; padding: 15px; font-size: 1rem; }
        .mode-desc { font-size: 0.7rem; color: #888; }
        .setting-label { display: flex; justify-content: space-between; }
        .settings-section-title { font-family: 'Orbitron'; color: var(--primary); font-size: 1.5rem; margin: 30px 0 15px 0; border-bottom: 1px solid #333; padding-bottom: 5px; }
        .power-warning { color: #ffaa00; font-size: 0.8rem; font-style: italic; margin-top: 5px; display: none; }
        .power-warning.show { display: block; animation: blinkText 2s infinite; }
        .opt-desc { color: #888; font-size: 0.8rem; margin-top: 5px; }

        /* Resolution / Language Buttons */
        .res-btn-group { display: flex; flex-wrap: wrap; gap: 5px; }
        .res-btn { padding: 7px 12px; font-size: 0.8rem; border: 1px solid #555; background: transparent; color: #aaa; cursor: pointer; font-family: 'Orbitron'; border-radius: 2px; transition: .18s; }
        .res-btn:hover { border-color: #fff; color: #fff; }
        .res-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(0,255,255,0.1); box-shadow: 0 0 8px rgba(0,255,255,.2); }

        #ach-popup { position: absolute; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px); background: rgba(0,0,0,0.9); border: 2px solid var(--gold); padding: 15px 30px; display: flex; align-items: center; gap: 15px; z-index: 300; transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); box-shadow: 0 0 30px rgba(255, 215, 0, 0.3); }
        #ach-popup.show { transform: translateX(-50%) translateY(0); }
        .ach-icon { font-size: 2rem; }
        .ach-pop-title { color: var(--gold); font-family: 'Orbitron'; font-weight: bold; }
        .ach-pop-desc { color: #fff; font-size: 0.9rem; }

        #daily-popup { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,10,20,0.95); border: 2px solid var(--gold); padding: 40px; text-align: center; z-index: 400; display: none; box-shadow: 0 0 50px var(--gold); animation: modalPop 0.5s; border-radius: 10px; }
        .daily-title { font-family: 'Orbitron'; font-size: 2rem; color: var(--gold); margin-bottom: 10px; }
        .daily-coin { font-size: 4rem; margin: 20px 0; animation: pulse 1s infinite; }
        .daily-btn { margin-top: 20px; border-color: var(--gold); color: var(--gold); }
        .daily-btn:hover { background: var(--gold); color: #000; }

        /* --- PHONE MODE OVERRIDES --- */
        body.phone-mode .panel { transform: skewX(0deg); padding: 5px 10px; }
        body.phone-mode .value { font-size: 1.5rem; transform: skewX(0deg); }
        body.phone-mode .label { font-size: 0.7rem; transform: skewX(0deg); }
        body.phone-mode .speed-container { top: 80px; right: 10px; bottom: auto; transform: scale(0.8); transform-origin: top right; }
        body.phone-mode #powerups { top: 80px; left: 10px; bottom: auto; transform: scale(0.8); transform-origin: top left; }
        body.phone-mode .freeze-container { bottom: 40px; left: 50%; transform: translateX(-50%) scale(1.2); }

        /* Main menu layout */
        body.phone-mode h1 { font-size: 2.8rem; margin-top: 16px; margin-bottom: 8px; letter-spacing: 3px; }
        body.phone-mode .menu-stats { flex-direction: row; flex-wrap: wrap; gap: 12px; margin: 8px 0; justify-content: center; }
        body.phone-mode .btn-row { flex-direction: column; width: 86%; gap: 9px; margin-top: 12px; }
        body.phone-mode button { width: 100%; padding: 15px; font-size: 1.1rem; letter-spacing: 2px; }
        body.phone-mode #startBtn { width: 86%; }
        body.phone-mode .btn-online { padding: 13px; font-size: 1rem; }
        body.phone-mode .btn-secondary, body.phone-mode .btn-settings { font-size: 0.9rem; padding: 12px; }

        /* Controls */
        body.phone-mode .controls-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; width: 90%; }
        body.phone-mode .c-item { padding: 8px; }
        body.phone-mode .c-key { font-size: 0.9rem; margin-bottom: 2px; }
        body.phone-mode .c-desc { font-size: 0.7rem; }

        /* Modal */
        body.phone-mode .modal { padding: 0; }
        body.phone-mode .modal-container { width: 100%; height: 100%; border-radius: 0; border: none; }
        body.phone-mode .modal-header { font-size: 1.6rem; padding: 12px; }
        body.phone-mode .modal-content { padding: 14px; }
        body.phone-mode .modal-grid { grid-template-columns: 1fr; gap: 15px; }
        body.phone-mode .settings-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
        body.phone-mode .tab-btn { padding: 9px 4px; font-size: 0.65rem; letter-spacing: 0; }
        body.phone-mode .settings-section-title { font-size: 1.1rem; margin: 18px 0 10px; }

        /* Language grid on phone */
        body.phone-mode .res-btn-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
        body.phone-mode .res-btn { padding: 11px 4px; font-size: 0.75rem; text-align: center; width: 100%; box-sizing: border-box; }

        /* Shop & Achievements — 2-column grid with descriptions */
        body.phone-mode #shop-grid,
        body.phone-mode #ach-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

        body.phone-mode .shop-item,
        body.phone-mode .ach-item,
        body.phone-mode .setting-item {
            flex-direction: column;
            text-align: center;
            align-items: center;
            justify-content: flex-start;
            padding: 12px 8px;
            gap: 5px;
        }
        body.phone-mode .item-name { margin: 0 0 2px; font-size: 0.85rem; }
        body.phone-mode .item-desc {
            display: block;
            font-size: 0.72rem;
            color: rgba(0,255,255,0.72);
            text-shadow: 0 0 10px rgba(0,255,255,0.35);
            background: none;
            margin-bottom: 4px;
            line-height: 1.3;
        }
        body.phone-mode .item-cost { margin: 0 0 4px; font-size: 0.9rem; }
        body.phone-mode .buy-btn { padding: 7px 10px; font-size: 0.8rem; width: 100%; box-sizing: border-box; }

        /* Achievement items in phone mode */
        body.phone-mode .ach-title { font-size: 0.85rem; text-align: center; }
        body.phone-mode .ach-desc {
            font-size: 0.72rem;
            color: rgba(0,255,255,0.72);
            text-shadow: 0 0 10px rgba(0,255,255,0.35);
            line-height: 1.3;
            text-align: center;
        }
        body.phone-mode .ach-reward { font-size: 0.72rem; text-align: center; }

        /* Leaderboard panels — hide on very small screens (except in phone mode) */
        @media (max-width: 500px) {
            body:not(.phone-mode) #nu-lb-left,
            body:not(.phone-mode) #nu-lb-right { display: none !important; }
        }

        /* Death joke text — half size on phone */
        body.phone-mode #death-msg { font-size: 0.75rem !important; height: 20px !important; letter-spacing: 1px !important; }

        /* Leaderboard title: show TOP 3 label in phone mode */
        body.phone-mode .nu-lb-t10 { display: none !important; }
        body.phone-mode .nu-lb-t3  { display: inline !important; }

        /* Leaderboard in phone mode: sit beside title/stats area, top 3 only */
        body.phone-mode #nu-lb-left,
        body.phone-mode #nu-lb-right {
            top: 22vh !important;
            transform: none !important;
            min-width: 76px !important;
            max-width: 98px !important;
            padding: 6px 6px !important;
            font-size: .55rem !important;
        }
        body.phone-mode #nu-lb-left div[style*="font-size:.55rem"],
        body.phone-mode #nu-lb-right div[style*="font-size:.55rem"] { font-size: .48rem !important; }
        body.phone-mode #nu-lb-list-left > div,
        body.phone-mode #nu-lb-list-right > div { padding: 2px 3px !important; gap: 3px !important; }
        body.phone-mode #nu-lb-list-left > div span,
        body.phone-mode #nu-lb-list-right > div span { font-size: .45rem !important; }
        body.phone-mode #nu-lb-list-left > div:nth-child(n+4),
        body.phone-mode #nu-lb-list-right > div:nth-child(n+4) { display: none !important; }

        /* ── Online hub: game options → 2×2 grid on phone mode ── */
        body.phone-mode #nu-game-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }

        /* ── Online hub: SP/MP leaderboard → stack on phone mode ── */
        body.phone-mode #nu-hub-lb > div:first-child { grid-template-columns: 1fr !important; }

        /* ── Settings: skins & world themes → 2-col grid on phone mode ── */
        body.phone-mode #skin-list,
        body.phone-mode #world-list { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }

        /* ── Settings: music tracks → 2-col grid on phone mode ── */
        body.phone-mode #track-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
        body.phone-mode #track-list .track-item { margin-bottom: 0; }

        /* ── PWA standalone: safe-area padding ── */
        @media all and (display-mode: standalone) {
            body { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
            #overlay { padding-top: max(20px, env(safe-area-inset-top, 20px)); }
            #nu-mp-hub { padding-top: env(safe-area-inset-top, 0px); }
        }

        /* ── Small phone (<480px) ── */
        @media (max-width: 480px) {
            /* Language grid: 3 per row on narrow screens */
            .res-btn-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
            .res-btn { padding: 10px 4px; font-size: 0.75rem; text-align: center; width: 100%; box-sizing: border-box; }

            /* Settings tabs: 2 columns */
            .settings-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; }
            .tab-btn { padding: 10px 4px; font-size: 0.7rem; letter-spacing: 0; }

            /* Tighter settings layout */
            .settings-section-title { font-size: 1.1rem; margin: 20px 0 10px; }
            .modal-header { font-size: 1.5rem; padding: 12px; }
            .modal-content { padding: 12px; }

            /* Main menu: tighter vertical spacing */
            h1 { font-size: 2.4rem; margin-bottom: 8px; }
            .btn-row { gap: 8px; margin-top: 10px; width: 88%; }
            button { padding: 14px 20px; font-size: 1rem; }
            .btn-secondary, .btn-settings { padding: 11px 14px; font-size: 0.85rem; }
            .btn-online { padding: 12px 14px; font-size: 0.9rem; }
            .menu-stats { gap: 12px; flex-wrap: wrap; justify-content: center; }

            /* MP hub on phone */
            #nu-hub-play > div:first-child { grid-template-columns: 1fr !important; }
            #nu-hub-lb > div:first-child   { grid-template-columns: 1fr !important; }
            #nu-mp-results [style*="min-width:340px"] { min-width: 0 !important; width: 90vw; }
            #nu-hub-players [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
        }

        /* MP hub and lobby grid → single col on phone (560px covers tablets too) */
        @media (max-width: 560px) {
            #nu-hub-play > div:first-child { grid-template-columns: 1fr !important; }
            #nu-hub-lb > div:first-child   { grid-template-columns: 1fr !important; }
            #nu-mp-results [style*="min-width:340px"] { min-width: 0 !important; width: 90vw; }
        }

        /* === TABLET / IPAD RESPONSIVE === */
        /* Scrollable overlay so menu never gets clipped */
        #overlay { overflow-y: auto; }

        @media (max-width: 1024px) and (min-width: 501px) {
            h1 { font-size: 3.8rem; }
            button { padding: 16px 40px; font-size: 1.2rem; }
            .btn-secondary { font-size: 1rem; padding: 13px 22px; }
            .btn-settings  { font-size: 1rem; padding: 13px 22px; }
            .btn-online    { font-size: 0.9rem; padding: 11px 28px; }
            .controls-grid { gap: 10px; }
            .btn-row { gap: 12px; margin-top: 15px; }
        }

        /* Compact layout when viewport height is tight (iPad landscape, small screens) */
        @media (max-height: 750px) {
            #overlay { justify-content: flex-start; padding-top: 24px; }
            h1 { font-size: 2.8rem; margin-bottom: 5px; }
            .menu-stats { margin: 8px 0; gap: 20px; }
            .controls-grid { margin: 8px 0; gap: 6px; }
            .btn-row { margin-top: 10px; gap: 8px; }
            button { padding: 13px 40px; font-size: 1.1rem; }
            .btn-secondary, .btn-settings { padding: 11px 18px; font-size: 0.95rem; }
        }

        @keyframes hudSlideDown { from { transform: skewX(-15deg) translateY(-100px); opacity: 0; } to { transform: skewX(-15deg) translateY(0); opacity: 1; } }
        @keyframes hudSlideUp { from { transform: translateY(100px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        @keyframes floatUp { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 20% { transform: translateY(-20px) scale(1.2); opacity: 1; } 100% { transform: translateY(-150px) scale(1); opacity: 0; } }
        @keyframes slideIn { from { transform: translateX(-50%) translateY(-50px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
        @keyframes bounceArrow { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-15px) scale(1.1); } }
        @keyframes titleFlyIn { from { transform: translateY(-70px) scale(0.85); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
        @keyframes titlePulse { 0%, 100% { transform: scale(1); filter: drop-shadow(0 0 30px var(--primary)); } 50% { transform: scale(1.05); filter: drop-shadow(0 0 50px var(--primary)); } }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
        @keyframes btnHyperspace { 0% { transform: scale(0.95); box-shadow: 0 0 10px var(--primary); } 50% { transform: scale(1.1); box-shadow: 0 0 80px var(--primary), inset 0 0 30px #fff; background: #fff; color: #000; } 100% { transform: scale(1); box-shadow: 0 0 60px var(--primary); } }
        @keyframes modalPop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
        @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
        @keyframes spinRing { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        @keyframes pulseIcon { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.2); opacity: 1; text-shadow: 0 0 15px white; } }
        @keyframes blinkText { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
        @keyframes drainShake { 0% { transform: translate(0,0) scale(1.1); } 25% { transform: translate(1px, 1px) scale(1.1); } 50% { transform: translate(-1px, -1px) scale(1.1); } 75% { transform: translate(-1px, 1px) scale(1.1); } 100% { transform: translate(1px, -1px) scale(1.1); } }
        @keyframes countPop { 0% { transform: scale(0.5); opacity: 0; } 50% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
        @keyframes glitch {
            0% { transform: translate(0); text-shadow: -2px 0 var(--secondary), 2px 0 var(--primary); }
            20% { transform: translate(-2px, 1px); }
            40% { transform: translate(2px, -1px); text-shadow: 2px 0 var(--secondary), -2px 0 var(--primary); }
            60% { transform: translate(-1px, 2px); }
            80% { transform: translate(1px, -2px); }
            100% { transform: translate(0); }
        }
        h1:hover { cursor: pointer; }

        /* ── Username callsign shine effect ── */
        @keyframes nuShineMove {
            0%   { background-position: -200% center; }
            100% { background-position:  200% center; }
        }
        .nu-username-shine {
            color: #00ffff;
            font-size: 1.15rem;
            font-weight: 900;
            letter-spacing: 3px;
            display: inline-block;
            cursor: default;
            transition: text-shadow .25s;
        }
        .nu-username-shine:hover {
            background: linear-gradient(
                105deg,
                #00ffff 0%,
                #ffffff 35%,
                #00ffff 50%,
                #ffffff 65%,
                #00ffff 100%
            );
            background-size: 200% auto;
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            text-fill-color: transparent;
            animation: nuShineMove .9s linear infinite;
            text-shadow: none;
        }
