/* ── Base ── */
body {
    margin: 0; overflow: hidden; background: black;
    font-family: 'Courier New', 'Lucida Console', monospace;
    touch-action: none;
}

/* ── HUD ── */
#ui {
    position: absolute; top: 10px; left: 10px; color: white; z-index: 5;
    font-size: 16px; font-weight: bold;
    background: rgba(0,0,0,0.75); padding: 14px 18px;
    border-radius: 6px; pointer-events: none;
    border: 1px solid #1a1a2e;
    font-family: 'Courier New', monospace;
}

#secondary-hud {
    margin-top: 5px; color: #ffdd00; font-size: 13px; letter-spacing: 1px;
    text-shadow: 0 0 8px #ffdd00;
}

#combo-display {
    font-size: 18px; font-weight: bold; letter-spacing: 1px;
    animation: comboPulse 0.4s ease-in-out infinite alternate;
}
@keyframes comboPulse { from { text-shadow: 0 0 8px #ffff00; } to { text-shadow: 0 0 20px #ffff00, 0 0 40px rgba(255,255,0,0.4); } }

/* ── Mobile Controls Wrapper ── */
#mobile-controls {
    display: none; position: fixed; inset: 0; pointer-events: none; z-index: 15;
}
#mobile-controls > * { pointer-events: auto; }

.touch-btn {
    position: absolute; bottom: 30px; right: 30px;
    width: 90px; height: 90px; background: rgba(255, 0, 64, 0.3);
    border: 3px solid #ff0040; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: bold; user-select: none;
}
#reload-btn       { right: 140px; width: 70px; height: 70px; bottom: 40px; font-size: 12px; background: rgba(0,255,255,0.2); border-color: #00ffff; }
#rocket-btn       { right: 230px; width: 60px; height: 60px; bottom: 50px; font-size: 20px; background: rgba(255,221,0,0.2); border-color: #ffdd00; }
#pause-touch-btn {
    position: absolute; top: 16px; right: 16px;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0,0,0,0.55); border: 2px solid rgba(0,255,255,0.5);
    color: #00ffff; font-size: 13px; font-weight: bold; letter-spacing: 2px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; user-select: none;
}
#joystick-container {
    position: absolute; bottom: 30px; left: 30px;
    width: 140px; height: 140px; background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3); border-radius: 50%; z-index: 15;
}
#joystick-knob {
    position: absolute; top: 45px; left: 45px;
    width: 50px; height: 50px; background: #00ffff;
    border-radius: 50%; box-shadow: 0 0 15px #00ffff;
}

/* ════════════════════════════════════════
   MAIN MENU
════════════════════════════════════════ */
#menu {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: #000008; color: white; z-index: 20; overflow: hidden;
}

#menu-grid {
    position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(0,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,255,0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridPan 20s linear infinite;
}
@keyframes gridPan {
    from { background-position: 0 0; }
    to   { background-position: 50px 50px; }
}

.scanlines-overlay {
    position: absolute; inset: 0; pointer-events: none; z-index: 1;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(0,0,0,0.18) 3px, rgba(0,0,0,0.18) 4px
    );
}

#menu-rain { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.rain-drop {
    position: absolute; top: -80px; width: 1px;
    background: linear-gradient(transparent, #00ffff);
    animation: rainFall linear infinite;
}
@keyframes rainFall { to { transform: translateY(110vh); } }

#menu-content {
    position: relative; z-index: 10;
    display: flex; flex-direction: column; align-items: center;
    gap: 16px; max-width: 560px; width: 100%; padding: 0 20px;
}

#menu-tag {
    color: rgba(0,255,255,0.45); font-size: 11px; letter-spacing: 3px;
    margin-bottom: 4px; text-align: center;
}

#menu-title {
    font-size: clamp(36px, 7vw, 68px); font-family: 'Courier New', monospace;
    letter-spacing: 6px; margin: 0; color: #fff;
    text-shadow: 0 0 20px #00ffff, 0 0 60px rgba(0,255,255,0.3);
    position: relative; animation: titleFlicker 4s infinite;
}
#menu-title::before, #menu-title::after {
    content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%;
}
#menu-title::before {
    color: #ff0040; animation: glitchTop 3.5s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%); text-shadow: -2px 0 #ff0040;
}
#menu-title::after {
    color: #00ffff; animation: glitchBot 3.5s infinite 0.1s;
    clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%); text-shadow: 2px 0 #00ffff;
}
@keyframes glitchTop {
    0%, 90%, 100% { transform: translate(0); opacity: 0; }
    92% { transform: translate(-3px, -1px); opacity: 1; }
    94% { transform: translate(3px,   1px); opacity: 1; }
    96% { transform: translate(-2px,  0);   opacity: 1; }
    98% { transform: translate(0);          opacity: 0; }
}
@keyframes glitchBot {
    0%, 88%, 100% { transform: translate(0); opacity: 0; }
    90% { transform: translate(3px,   1px); opacity: 1; }
    93% { transform: translate(-3px, -1px); opacity: 1; }
    96% { transform: translate(0);          opacity: 0; }
}
@keyframes titleFlicker {
    0%, 97%, 100% { opacity: 1; } 98% { opacity: 0.7; } 99% { opacity: 1; }
}

#menu-sub {
    color: #00ffff; font-size: 13px; letter-spacing: 4px; margin-top: 6px; text-align: center;
    text-shadow: 0 0 12px #00ffff; animation: subPulse 2.5s ease-in-out infinite;
}
@keyframes subPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

#menu-best {
    display: flex; align-items: center; gap: 14px;
    background: rgba(0,255,255,0.05); border: 1px solid rgba(0,255,255,0.2);
    padding: 8px 24px; border-radius: 4px;
}
.menu-label { color: rgba(255,255,255,0.45); font-size: 11px; letter-spacing: 2px; }
.menu-hs-val { color: #ffff00; font-size: 22px; font-weight: bold; text-shadow: 0 0 12px #ffff00; }

/* Rank row */
#menu-rank-row {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    padding: 6px 18px; border-radius: 4px; width: 100%; max-width: 360px;
    box-sizing: border-box;
}
.menu-rank-name {
    color: #00ff88; font-size: 13px; font-weight: bold; letter-spacing: 2px;
    text-shadow: 0 0 10px #00ff88;
}
#menu-rank-bar {
    flex: 1; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
#menu-rank-prog {
    height: 100%; background: #00ff88; border-radius: 2px;
    box-shadow: 0 0 6px #00ff88; transition: width 0.5s ease;
}

/* Selected operative row */
#menu-operative-row {
    display: flex; align-items: center; gap: 14px;
    background: rgba(0,255,255,0.04); border: 1px solid rgba(0,255,255,0.12);
    padding: 6px 20px; border-radius: 4px;
}
.operative-name { font-size: 14px; letter-spacing: 2px; font-weight: bold; }

/* Difficulty selector */
#difficulty-row {
    display: flex; align-items: center; gap: 12px;
    width: 100%; max-width: 360px;
}
#diff-buttons { display: flex; gap: 6px; flex: 1; }
.diff-btn {
    flex: 1; padding: 7px 0; font-size: 11px; letter-spacing: 1px; cursor: pointer;
    background: transparent; border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.35); border-radius: 3px;
    font-family: 'Courier New', monospace; transition: all 0.18s;
}
.diff-btn:hover { color: rgba(255,255,255,0.6); border-color: rgba(255,255,255,0.3); }
.diff-btn.active {
    color: #ff0040; border-color: #ff0040;
    background: rgba(255,0,64,0.1); box-shadow: 0 0 10px rgba(255,0,64,0.2);
}
#diff-veteran.active { color: #ff8800; border-color: #ff8800; background: rgba(255,136,0,0.1); box-shadow: 0 0 10px rgba(255,136,0,0.2); }
#diff-ghost.active   { color: #aa00ff; border-color: #aa00ff; background: rgba(170,0,255,0.1); box-shadow: 0 0 10px rgba(170,0,255,0.2); }

/* Menu buttons */
#menu-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }

#start-btn {
    padding: 16px 60px; font-size: 20px; cursor: pointer; width: 100%; max-width: 320px;
    background: transparent; color: #ff0040; border: 2px solid #ff0040; border-radius: 4px;
    font-family: 'Courier New', monospace; letter-spacing: 3px;
    box-shadow: 0 0 20px rgba(255,0,64,0.4), inset 0 0 20px rgba(255,0,64,0.05);
    animation: btnPulse 1.8s ease-in-out infinite;
    transition: background 0.15s, color 0.15s; position: relative; overflow: hidden;
}
#start-btn::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,0,64,0.15), transparent);
    animation: btnSweep 2.5s linear infinite;
}
@keyframes btnSweep { to { left: 160%; } }
#start-btn:hover { background: #ff0040; color: #fff; box-shadow: 0 0 40px rgba(255,0,64,0.8); }
@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255,0,64,0.4), inset 0 0 20px rgba(255,0,64,0.05); }
    50%       { box-shadow: 0 0 40px rgba(255,0,64,0.7), inset 0 0 20px rgba(255,0,64,0.1); }
}
.btn-arrow { margin-right: 8px; }

#codex-btn {
    padding: 10px 40px; font-size: 13px; cursor: pointer; width: 100%; max-width: 320px;
    background: transparent; color: rgba(0,255,255,0.6); border: 1px solid rgba(0,255,255,0.25);
    border-radius: 4px; font-family: 'Courier New', monospace; letter-spacing: 2px;
    transition: all 0.2s;
}
#codex-btn:hover {
    background: rgba(0,255,255,0.08); color: #00ffff;
    border-color: rgba(0,255,255,0.5); box-shadow: 0 0 16px rgba(0,255,255,0.15);
}

/* Controls */
#menu-controls { width: 100%; }
.menu-section-label {
    color: rgba(255,255,255,0.3); font-size: 10px; letter-spacing: 3px;
    text-align: center; margin-bottom: 10px;
}
.ctrl-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center; }
.ctrl-key {
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    padding: 4px 10px; border-radius: 3px; font-size: 11px;
    color: #00ffff; letter-spacing: 1px; text-align: center; white-space: nowrap;
}
.ctrl-act { color: rgba(255,255,255,0.5); font-size: 11px; letter-spacing: 1px; }

/* ── GAME OVER ── */
#gameover {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    flex-direction: column; background: radial-gradient(circle, #1a0005 0%, #000000 100%);
    color: white; z-index: 20; font-family: 'Courier New', monospace;
}
#go-inner {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    max-width: 520px; width: 90%; padding: 0 20px;
}
#go-inner h1 { font-size: clamp(24px, 4vw, 44px); margin: 0; letter-spacing: 4px; text-align: center; }

#rank-up-badge {
    background: rgba(0,255,136,0.12); border: 1px solid #00ff88;
    color: #00ff88; font-size: 13px; letter-spacing: 3px;
    padding: 8px 24px; border-radius: 4px;
    animation: rankUpPulse 0.6s ease-in-out infinite alternate;
}
@keyframes rankUpPulse { from { box-shadow: 0 0 8px rgba(0,255,136,0.3); } to { box-shadow: 0 0 24px rgba(0,255,136,0.7); } }

.go-stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%;
}
.go-stat {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
    padding: 10px 6px; border-radius: 4px;
}
.go-stat-label { font-size: 9px; letter-spacing: 2px; color: rgba(255,255,255,0.35); }
.go-stat-val   { font-size: 20px; font-weight: bold; }

.go-xp-row {
    color: rgba(255,255,255,0.5); font-size: 11px; letter-spacing: 2px;
}
.stat-bar-row {
    display: flex; align-items: center; gap: 10px; width: 100%;
    font-size: 10px; letter-spacing: 2px; color: rgba(255,255,255,0.4);
}
.stat-bar-track {
    flex: 1; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden;
}
.stat-bar-fill {
    height: 100%; background: #00ff88; border-radius: 2px; box-shadow: 0 0 6px #00ff88;
}

#gameover button {
    margin-top: 4px; padding: 14px 50px; font-size: 16px; cursor: pointer;
    background: transparent; color: #ff0040; border: 2px solid #ff0040;
    border-radius: 4px; font-family: 'Courier New', monospace;
    letter-spacing: 3px; box-shadow: 0 0 20px rgba(255,0,64,0.4);
    transition: background 0.15s, color 0.15s;
}
#gameover button:hover { background: #ff0040; color: #fff; }

/* ── BOSS BAR ── */
#boss-bar-wrapper {
    position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
    z-index: 12; pointer-events: none;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 320px;
}
#boss-label {
    font-size: 10px; letter-spacing: 4px; color: #ff4400;
    text-shadow: 0 0 12px #ff4400; font-family: 'Courier New', monospace;
}
#boss-bar-track {
    width: 320px; height: 8px; background: rgba(255,68,0,0.15);
    border: 1px solid rgba(255,68,0,0.4); border-radius: 4px; overflow: hidden;
}
#boss-bar-fill {
    height: 100%; background: #ff4400;
    box-shadow: 0 0 10px #ff4400; border-radius: 4px;
    transition: width 0.1s linear;
}
#boss-phase-label {
    font-size: 9px; letter-spacing: 3px; color: rgba(255,68,0,0.6);
    font-family: 'Courier New', monospace;
}

/* ── Crosshair ── */
#crosshair {
    position: absolute; top: 50%; left: 50%;
    width: 20px; height: 20px; margin-left: -10px; margin-top: -10px;
    border: 2px solid #00ffff; border-radius: 50%; z-index: 5; pointer-events: none;
}
#crosshair::after { content: ''; position: absolute; top: 9px; left: 9px; width: 2px; height: 2px; background: #00ffff; }

/* ── Reload warning ── */
#reload-msg { color: #ffcc00; font-weight: bold; display: none; margin-top: 5px; animation: blink 0.5s infinite; pointer-events: auto; cursor: pointer; padding: 3px 8px; border: 1px solid rgba(255,204,0,0.4); border-radius: 4px; }
#reload-msg:hover { background: rgba(255,204,0,0.15); }
@keyframes blink { 50% { opacity: 0; } }

/* ── Rotate Device Overlay ── */
#rotate-overlay {
    display: none; position: fixed; inset: 0; background: #000010; z-index: 9999;
    flex-direction: column; align-items: center; justify-content: center;
    color: white; text-align: center;
}
#rotate-overlay .rotate-icon { font-size: 80px; animation: rotateAnim 1.5s ease-in-out infinite; display: block; margin-bottom: 20px; }
#rotate-overlay p { font-size: 20px; color: #00ffff; letter-spacing: 2px; text-shadow: 0 0 10px #00ffff; }
@keyframes rotateAnim {
    0%  { transform: rotate(0deg); }
    40% { transform: rotate(90deg); }
    60% { transform: rotate(90deg); }
    100%{ transform: rotate(0deg); }
}

/* ── Damage overlay ── */
#damage-overlay {
    position: fixed; inset: 0; pointer-events: none; z-index: 10; opacity: 0;
    box-shadow: inset 0 0 120px 60px rgba(255,0,40,0.85); transition: opacity 0.05s linear;
}

/* ── Muzzle flash ── */
#muzzle-flash {
    position: fixed; inset: 0; pointer-events: none; z-index: 9; opacity: 0;
    background: radial-gradient(circle at center, rgba(0,255,255,0.18) 0%, transparent 60%);
}

/* ── Minimap ── */
#minimap {
    display: none; position: absolute; bottom: 160px; right: 20px;
    width: 140px; height: 140px; border-radius: 50%;
    border: 2px solid #00ffff; box-shadow: 0 0 12px #00ffff;
    z-index: 10; pointer-events: none;
}

/* ══ PAUSE MENU ══ */
#pause-menu {
    position: absolute; inset: 0; z-index: 17;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.82); backdrop-filter: blur(2px);
}
#pause-content {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    border: 1px solid rgba(0,255,255,0.2); border-radius: 6px;
    padding: 44px 60px; background: rgba(0,0,8,0.9);
    box-shadow: 0 0 60px rgba(0,255,255,0.08);
}
#pause-tag   { color: rgba(0,255,255,0.4); font-size: 10px; letter-spacing: 4px; margin-bottom: 4px; }
#pause-title { font-size: 36px; letter-spacing: 8px; color: #fff;
    text-shadow: 0 0 20px #00ffff, 0 0 60px rgba(0,255,255,0.2); margin-bottom: 12px; }
.pause-btn {
    width: 240px; padding: 13px 0; font-size: 14px; letter-spacing: 3px;
    cursor: pointer; background: transparent; border-radius: 4px;
    font-family: 'Courier New', monospace; transition: all 0.18s;
    color: #00ffff; border: 1px solid rgba(0,255,255,0.35);
}
.pause-btn:hover { background: rgba(0,255,255,0.1); border-color: #00ffff; }
#pause-exit-btn { color: rgba(255,255,255,0.45); border-color: rgba(255,255,255,0.15); margin-top: 4px; }
#pause-exit-btn:hover { color: #ff0040; border-color: #ff0040; background: rgba(255,0,64,0.08); }

/* ══ POWERUP HUD ══ */
#boosts-hud {
    position: absolute; top: 10px; right: 10px;
    flex-direction: column; gap: 6px; z-index: 5; pointer-events: none;
}
.boost-tag {
    padding: 5px 12px; border-radius: 3px; font-size: 11px;
    letter-spacing: 2px; font-weight: bold; font-family: 'Courier New', monospace;
    animation: boostPulse 0.8s ease-in-out infinite;
}
.boost-speed     { background: rgba(255,0,255,0.15); border: 1px solid #ff00ff; color: #ff00ff; }
.boost-shield    { background: rgba(0,136,255,0.15); border: 1px solid #0088ff; color: #0088ff; }
.boost-rapid     { background: rgba(255,136,0,0.15); border: 1px solid #ff8800; color: #ff8800; }
.boost-overclock { background: rgba(255,255,255,0.12); border: 1px solid #ffffff; color: #ffffff; }
@keyframes boostPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ── Wave bonus ── */
#wave-bonus {
    position: absolute; top: 30%; left: 50%; transform: translateX(-50%);
    color: #ffff00; font-size: 26px; font-weight: bold; letter-spacing: 3px;
    text-shadow: 0 0 20px #ffff00; pointer-events: none; z-index: 15;
    opacity: 0; transition: opacity 0.5s ease-out; font-family: 'Courier New', monospace;
    text-align: center;
}

/* ── Wave modifier banner ── */
#modifier-banner {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: #ff8800; font-size: 20px; font-weight: bold; letter-spacing: 4px;
    text-shadow: 0 0 20px #ff8800; pointer-events: none; z-index: 16;
    background: rgba(0,0,0,0.75); padding: 16px 40px; border-radius: 4px;
    border: 1px solid rgba(255,136,0,0.4);
    font-family: 'Courier New', monospace; text-align: center;
    opacity: 0; transition: opacity 0.4s ease;
}
#modifier-banner.visible { opacity: 1; }

/* ── Kill feed ── */
#kill-feed {
    position: fixed; right: 12px; top: 60px;
    display: flex; flex-direction: column; gap: 4px;
    z-index: 11; pointer-events: none;
    font-family: 'Courier New', monospace;
}
.kf-entry {
    font-size: 12px; font-weight: bold; letter-spacing: 2px;
    text-align: right; text-shadow: 0 0 8px currentColor;
    padding: 2px 0;
}

/* ── Achievement toast ── */
#achievement-toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 18; pointer-events: none;
    background: rgba(0,0,8,0.92); border: 1px solid rgba(255,221,0,0.5);
    border-radius: 5px; padding: 12px 28px;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-family: 'Courier New', monospace;
    opacity: 0; transition: opacity 0.35s ease;
    box-shadow: 0 0 30px rgba(255,221,0,0.15);
}
#achievement-toast.visible { opacity: 1; }
.ach-label { color: rgba(255,221,0,0.5); font-size: 9px; letter-spacing: 4px; }
.ach-name  { color: #ffdd00; font-size: 15px; font-weight: bold; letter-spacing: 3px; text-shadow: 0 0 12px #ffdd00; }
.ach-desc  { color: rgba(255,255,255,0.45); font-size: 10px; letter-spacing: 1px; }

/* ════════════════════════════════════════
   TUTORIAL
════════════════════════════════════════ */
#tutorial-overlay {
    position: absolute; inset: 0; z-index: 22;
    flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0,0,8,0.97); color: white; overflow: hidden;
}
#tut-slide-area {
    width: 100%; max-width: 640px; padding: 36px 40px;
    display: flex; flex-direction: column; gap: 18px;
    position: relative; z-index: 5;
}
.tut-tag   { color: rgba(0,255,255,0.4); font-size: 10px; letter-spacing: 4px; }
.tut-title { font-size: clamp(20px, 4vw, 36px); letter-spacing: 5px; color: #fff;
    text-shadow: 0 0 20px rgba(0,255,255,0.3); font-weight: bold; line-height: 1.15; }
.tut-body  { font-size: 13px; line-height: 1.85; color: rgba(255,255,255,0.6);
    border-top: 1px solid rgba(0,255,255,0.08); padding-top: 16px; }
.tut-hl    { color: #00ffff; font-style: normal; }
.tut-table { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.tut-row   { display: flex; align-items: center; gap: 14px; }
.tut-badge { flex: 0 0 88px; font-size: 11px; letter-spacing: 2px; font-weight: bold;
    border: 1px solid; padding: 3px 6px; border-radius: 3px; text-align: center; }
.tut-dot   { flex: 0 0 12px; height: 12px; border-radius: 50%; }
.tut-key   { flex: 0 0 90px; font-size: 11px; letter-spacing: 1px; text-align: center;
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
    padding: 4px 8px; border-radius: 3px; color: #00ffff; }
.tut-desc  { font-size: 12px; color: rgba(255,255,255,0.5); }
.tut-btns  { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.tut-skip-btn {
    padding: 8px 20px; font-size: 11px; letter-spacing: 2px; cursor: pointer;
    background: transparent; border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.25); border-radius: 3px;
    font-family: 'Courier New', monospace; transition: all 0.2s;
}
.tut-skip-btn:hover { color: rgba(255,255,255,0.5); border-color: rgba(255,255,255,0.25); }
.tut-next-btn {
    padding: 13px 36px; font-size: 14px; letter-spacing: 3px; cursor: pointer;
    background: transparent; border: 2px solid #00ffff; color: #00ffff;
    border-radius: 4px; font-family: 'Courier New', monospace;
    box-shadow: 0 0 16px rgba(0,255,255,0.15); transition: all 0.18s;
}
.tut-next-btn:hover { background: rgba(0,255,255,0.1); box-shadow: 0 0 30px rgba(0,255,255,0.3); }
.tut-progress { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.tut-pip    { width: 22px; height: 2px; background: rgba(255,255,255,0.12); border-radius: 1px; }
.tut-pip-on { background: #00ffff; box-shadow: 0 0 6px #00ffff; }

#tut-hint {
    position: fixed; top: 60px; left: 50%;
    transform: translateX(-50%) translateY(-10px);
    z-index: 12; pointer-events: none;
    background: rgba(0,0,8,0.88); border: 1px solid rgba(0,255,255,0.4);
    color: #fff; font-size: 13px; letter-spacing: 2px; font-weight: bold;
    padding: 11px 26px; border-radius: 4px; white-space: nowrap;
    opacity: 0; transition: opacity 0.4s ease, transform 0.4s ease;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 24px rgba(0,255,255,0.12);
    max-width: 90vw; white-space: normal; text-align: center;
}

#tutorial-btn {
    padding: 10px 40px; font-size: 13px; cursor: pointer; width: 100%; max-width: 320px;
    background: transparent; color: rgba(0,255,255,0.55); border: 1px solid rgba(0,255,255,0.2);
    border-radius: 4px; font-family: 'Courier New', monospace; letter-spacing: 2px;
    transition: all 0.2s;
}
#tutorial-btn:hover { color: #00ffff; border-color: rgba(0,255,255,0.5); background: rgba(0,255,255,0.05); }

/* ════════════════════════════════════════
   SETTINGS
════════════════════════════════════════ */
#settings {
    position: absolute; inset: 0; flex-direction: column;
    background: #000008; color: white; z-index: 20; overflow: hidden;
}
#settings-header {
    position: relative; z-index: 10;
    display: flex; align-items: center; padding: 14px 24px;
    border-bottom: 1px solid rgba(0,255,255,0.15); flex-shrink: 0;
    background: rgba(0,0,0,0.5);
}
#settings-title-text { color: rgba(0,255,255,0.5); font-size: 11px; letter-spacing: 4px;
    position: absolute; left: 50%; transform: translateX(-50%); }
#settings-body {
    position: relative; z-index: 5; overflow-y: auto;
    padding: 40px 0; display: flex; flex-direction: column;
    align-items: center; gap: 32px; flex: 1;
}
#settings-body::-webkit-scrollbar { width: 3px; }
#settings-body::-webkit-scrollbar-thumb { background: rgba(0,255,255,0.3); }
.settings-section { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 18px; }
.settings-section-label { color: rgba(0,255,255,0.4); font-size: 10px; letter-spacing: 4px;
    border-bottom: 1px solid rgba(0,255,255,0.1); padding-bottom: 8px; }
.settings-row  { display: flex; align-items: center; gap: 16px; }
.settings-label { flex: 0 0 180px; font-size: 12px; letter-spacing: 2px; color: rgba(255,255,255,0.55); }
.settings-slider {
    flex: 1; -webkit-appearance: none; height: 3px;
    background: rgba(0,255,255,0.15); border-radius: 2px; outline: none; cursor: pointer;
}
.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px;
    border-radius: 50%; background: #00ffff; box-shadow: 0 0 8px #00ffff; cursor: pointer;
}
.settings-slider::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: #00ffff; box-shadow: 0 0 8px #00ffff; border: none; cursor: pointer;
}
.settings-val { flex: 0 0 28px; font-size: 12px; color: #00ffff; text-align: right; letter-spacing: 1px; }
.settings-toggle {
    padding: 6px 20px; font-size: 11px; letter-spacing: 2px; cursor: pointer;
    background: transparent; border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.4); border-radius: 3px;
    font-family: 'Courier New', monospace; transition: all 0.2s;
}
.settings-toggle.on { border-color: #00ffff; color: #00ffff;
    background: rgba(0,255,255,0.1); box-shadow: 0 0 10px rgba(0,255,255,0.2); }
#gyro-row { display: none; }
#gyro-sens-row { display: none; }

#settings-btn {
    padding: 8px 40px; font-size: 12px; cursor: pointer; width: 100%; max-width: 320px;
    background: transparent; color: rgba(255,255,255,0.35); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px; font-family: 'Courier New', monospace; letter-spacing: 2px;
    transition: all 0.2s;
}
#settings-btn:hover { color: rgba(255,255,255,0.6); border-color: rgba(255,255,255,0.25); }

/* ════════════════════════════════════════
   INTEL DATABASE (CODEX)
════════════════════════════════════════ */
#codex {
    position: absolute; inset: 0; flex-direction: column;
    background: #000008; color: white; z-index: 20; overflow: hidden;
}
#codex-header {
    position: relative; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px; border-bottom: 1px solid rgba(0,255,255,0.15);
    flex-shrink: 0; background: rgba(0,0,0,0.5);
}
#codex-title-text { color: rgba(0,255,255,0.5); font-size: 11px; letter-spacing: 4px;
    position: absolute; left: 50%; transform: translateX(-50%); }
#codex-tabs { display: flex; gap: 8px; }
.codex-tab {
    padding: 6px 20px; font-size: 12px; letter-spacing: 2px; cursor: pointer;
    background: transparent; border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.4); border-radius: 3px;
    font-family: 'Courier New', monospace; transition: all 0.2s;
}
.codex-tab:hover  { color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.3); }
.codex-tab.active { color: #00ffff; border-color: #00ffff; background: rgba(0,255,255,0.08); }
.back-link { color: rgba(255,255,255,0.4); font-size: 12px; letter-spacing: 2px;
    cursor: pointer; transition: color 0.2s; z-index: 1; }
.back-link:hover { color: rgba(255,255,255,0.8); }

#codex-body { display: flex; flex: 1; overflow: hidden; position: relative; z-index: 5; }

#codex-sidebar {
    width: 190px; border-right: 1px solid rgba(255,255,255,0.07);
    overflow-y: auto; padding: 8px 0; flex-shrink: 0;
    background: rgba(0,0,0,0.3);
}
#codex-sidebar::-webkit-scrollbar { width: 3px; }
#codex-sidebar::-webkit-scrollbar-thumb { background: rgba(0,255,255,0.3); }

.codex-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; cursor: pointer; transition: background 0.15s;
    border-left: 2px solid transparent;
}
.codex-item:hover  { background: rgba(255,255,255,0.05); }
.codex-item.active { background: rgba(255,255,255,0.07); border-left-color: currentColor; }
.codex-item.selected-operative { background: rgba(0,255,255,0.05); }

.item-dot    { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.item-labels { display: flex; flex-direction: column; gap: 2px; }
.item-name   { font-size: 13px; letter-spacing: 2px; font-weight: bold; }
.item-tag    { font-size: 9px; letter-spacing: 1px; color: rgba(255,255,255,0.3); }
.item-check  { margin-left: auto; font-size: 10px; color: #00ffff; }

#codex-main { flex: 1; display: flex; overflow: hidden; }

#codex-preview-area {
    width: 260px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; border-right: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.4);
}
#preview-canvas { display: block; border-radius: 4px; box-shadow: 0 0 30px rgba(0,255,255,0.1); }
#preview-label  { font-size: 9px; letter-spacing: 3px; color: rgba(255,255,255,0.25); text-align: center; }

#codex-info-area {
    flex: 1; overflow-y: auto; padding: 28px 32px;
}
#codex-info-area::-webkit-scrollbar { width: 3px; }
#codex-info-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

#codex-info { opacity: 0; transform: translateX(30px); }
#codex-info.slide-in {
    animation: slideInRight 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes slideInRight { to { opacity: 1; transform: translateX(0); } }

.info-name { font-size: clamp(22px, 3.5vw, 36px); font-weight: bold;
    letter-spacing: 5px; margin-bottom: 4px; line-height: 1.1; }
.info-tag  { font-size: 10px; letter-spacing: 3px; color: rgba(255,255,255,0.35);
    margin-bottom: 18px; border-left: 2px solid currentColor;
    padding-left: 10px; display: inline-block; }
.info-desc { font-size: 13px; line-height: 1.8; color: rgba(255,255,255,0.55);
    margin-bottom: 24px; max-width: 420px; }

.info-stats { margin-bottom: 22px; display: flex; flex-direction: column; gap: 10px; }
.info-stat-row { display: flex; align-items: center; gap: 10px; }
.stat-lbl { width: 38px; font-size: 10px; letter-spacing: 1px; color: rgba(255,255,255,0.4);
    flex-shrink: 0; text-align: right; }
.stat-track { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.stat-fill  { height: 100%; width: 0%; border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.stat-num   { width: 16px; font-size: 11px; color: rgba(255,255,255,0.5); text-align: right; }

.info-perks { margin-bottom: 28px; display: flex; flex-direction: column; gap: 6px; }
.perk-item  { font-size: 12px; letter-spacing: 1px; color: rgba(255,255,255,0.45);
    padding: 6px 10px; background: rgba(255,255,255,0.03);
    border-left: 2px solid rgba(255,255,255,0.15); border-radius: 0 3px 3px 0; }

.select-op-btn {
    padding: 12px 32px; font-size: 13px; cursor: pointer; letter-spacing: 2px;
    background: transparent; border: 1px solid rgba(0,255,255,0.4); color: #00ffff;
    border-radius: 4px; font-family: 'Courier New', monospace;
    transition: all 0.2s; display: block; width: 100%; max-width: 300px;
}
.select-op-btn:hover { background: rgba(0,255,255,0.12); border-color: #00ffff; }
.select-op-btn.already-selected {
    border-color: #00ffff; background: rgba(0,255,255,0.1);
    color: #00ffff; cursor: default; box-shadow: 0 0 12px rgba(0,255,255,0.2);
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
#menu { overflow-y: auto; }
#menu-content { padding-top: 12px; padding-bottom: 12px; }

@media (max-height: 520px) {
    #menu-content { gap: 6px; }
    #menu-tag { font-size: 9px; letter-spacing: 2px; margin-bottom: 0; }
    #menu-title { font-size: clamp(22px, 5vw, 38px); letter-spacing: 3px; }
    #menu-sub { font-size: 10px; letter-spacing: 3px; margin-top: 2px; }
    #menu-best { padding: 5px 14px; }
    .menu-hs-val { font-size: 16px; }
    #menu-operative-row { padding: 4px 14px; }
    .operative-name { font-size: 12px; }
    #menu-buttons { gap: 6px; }
    #start-btn { padding: 10px 40px; font-size: 16px; }
    #codex-btn, #tutorial-btn, #settings-btn { padding: 7px 30px; font-size: 11px; }
    #menu-controls { display: none; }
    #menu-rank-row { padding: 4px 14px; }
    #difficulty-row { gap: 8px; }
}
@media (max-height: 380px) {
    #menu-content { gap: 4px; }
    #menu-best { display: none; }
    #menu-operative-row { padding: 3px 12px; }
    #start-btn { padding: 8px 30px; font-size: 14px; }
}
