        @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; }

        /* === 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); }

        #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; background: rgba(0,0,0,0.2); }
        .tut-container { position: absolute; top: 25%; left: 50%; transform: translateX(-50%); background: rgba(0, 10, 20, 0.7); border: 1px solid var(--primary); padding: 20px 40px; border-radius: 10px; box-shadow: 0 0 30px rgba(0,255,255,0.2); text-align: center; backdrop-filter: blur(4px); animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
        .tut-msg { font-family: 'Orbitron', sans-serif; font-size: 1.8rem; color: #fff; text-shadow: 0 0 10px var(--primary); margin-bottom: 15px; letter-spacing: 2px; }
        .tut-arrow { font-size: 4rem; color: var(--primary); filter: drop-shadow(0 0 15px var(--primary)); display: inline-block; animation: bounceArrow 1s infinite ease-in-out; }
        #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; 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-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: #aaa; font-size: 0.9rem; margin-bottom: 15px; height: 40px; }
        .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;
        }
        .changelog-content.open { max-height: 300px; overflow-y: auto; border: 1px solid #333; }
        .changelog-list { list-style: none; padding: 10px; margin: 0; font-family: 'Rajdhani'; color: #ccc; font-size: 0.95rem; }
        .changelog-list li { margin-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 3px; }
        .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-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 Buttons */
        .res-btn-group { display: flex; gap: 5px; }
        .res-btn { padding: 5px 10px; font-size: 0.8rem; border: 1px solid #555; background: transparent; color: #aaa; cursor: pointer; font-family: 'Orbitron'; }
        .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); }

        #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); }
        body.phone-mode h1 { font-size: 3rem; margin-top: 20px; }
        body.phone-mode .menu-stats { flex-direction: row; gap: 20px; margin: 10px 0; }
        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; }
        body.phone-mode .btn-row { flex-direction: column; width: 80%; gap: 10px; margin-top: 15px; }
        body.phone-mode button { width: 100%; padding: 15px; font-size: 1.2rem; }
        body.phone-mode .btn-online { padding: 13px; font-size: 1rem; }
        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.8rem; padding: 15px; }
        body.phone-mode .modal-grid { grid-template-columns: 1fr; gap: 15px; }
        body.phone-mode .shop-item, body.phone-mode .setting-item { flex-direction: row; text-align: left; justify-content: space-between; padding: 15px; }
        body.phone-mode .item-name { margin: 0; font-size: 1rem; }
        body.phone-mode .item-desc { display: none; }
        body.phone-mode .item-cost { margin: 0 10px; font-size: 1rem; }
        body.phone-mode .buy-btn { padding: 8px 15px; font-size: 0.9rem; }

        /* Leaderboard panels — hide on very small screens */
        @media (max-width: 500px) {
            #nu-lb-left, #nu-lb-right { display: none !important; }
        }
        /* MP hub and lobby grid → single col on phone */
        @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; }
