/* IRONWORKS - Industrial Tactical HUD */

@import url('https://fonts.googleapis.com/css2?family=Teko:wght@400;500;600;700&family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
    --hud-green: #39FF14;
    --hud-green-60: rgba(57, 255, 20, 0.6);
    --hud-green-30: rgba(57, 255, 20, 0.3);
    --hud-green-15: rgba(57, 255, 20, 0.15);
    --hud-green-08: rgba(57, 255, 20, 0.08);

    --hud-orange: #FF6B2C;
    --hud-red: #FF2D2D;
    --hud-red-dim: rgba(255, 45, 45, 0.3);
    --hud-cyan: #00D4FF;
    --hud-cyan-dim: rgba(0, 212, 255, 0.2);
    --hud-gold: #FFD700;

    --panel-bg: rgba(8, 12, 18, 0.72);
    --panel-border: rgba(57, 255, 20, 0.16);
    --overlay-bg: rgba(4, 6, 10, 0.90);

    --text-bright: #E0E4E8;
    --text-mid: #7A7F88;
    --text-dim: #3E434C;

    --font-display: 'Teko', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;

    --hud-pad: 22px;
}

/* ===== RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    overflow: hidden;
    background: #000;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--text-bright);
    cursor: none;
    user-select: none;
    -webkit-user-select: none;
}

canvas { display: block; }

.hidden { display: none !important; }

/* ===== HUD CONTAINER ===== */
#hud {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ===== CROSSHAIR ===== */
#crosshair {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80px; height: 80px;
}

/* --- Laser: red precision dot --- */
.ch-laser-dot {
    position: absolute;
    width: 6px; height: 6px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(255, 40, 40, 0.9);
    box-shadow: 0 0 6px rgba(255, 40, 40, 0.6), 0 0 12px rgba(255, 40, 40, 0.2);
    display: none;
}

/* --- AK: tactical lines --- */
.ch-line {
    position: absolute;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
    display: none;
}
.ch-line-top {
    width: 2px; height: 8px;
    left: 50%; top: 50%;
    transform-origin: center bottom;
}
.ch-line-bottom {
    width: 2px; height: 8px;
    left: 50%; top: 50%;
    transform-origin: center top;
}
.ch-line-left {
    width: 8px; height: 2px;
    top: 50%; left: 50%;
    transform-origin: right center;
}
.ch-line-right {
    width: 8px; height: 2px;
    top: 50%; left: 50%;
    transform-origin: left center;
}

/* --- Shotgun: ring + pellet dots --- */
.ch-shotgun-ring {
    position: absolute;
    top: 50%; left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    display: none;
}
.ch-pellet {
    position: absolute;
    width: 3px; height: 3px;
    top: 50%; left: 50%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.3);
    display: none;
}

/* ===== HITMARKER ===== */
#hitmarker {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 20px; height: 20px;
    color: #fff;
}

.hitmarker-line {
    position: absolute;
    width: 8px; height: 2px;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}
.hitmarker-tl { top: 2px; left: 2px; transform: rotate(-45deg); }
.hitmarker-tr { top: 2px; right: 2px; transform: rotate(45deg); }
.hitmarker-bl { bottom: 2px; left: 2px; transform: rotate(45deg); }
.hitmarker-br { bottom: 2px; right: 2px; transform: rotate(-45deg); }

/* ===== TOP BAR ===== */
#top-bar {
    position: absolute;
    top: var(--hud-pad); left: var(--hud-pad); right: var(--hud-pad);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 2px;
}

#wave-indicator {
    color: var(--hud-green);
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--hud-green-30);
    padding: 2px 12px;
    border-left: 2px solid var(--hud-green);
}

#gold-counter {
    color: var(--hud-gold);
    font-family: var(--font-mono);
    font-size: 16px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    padding: 3px 14px;
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.15);
}

#kill-counter {
    color: var(--text-mid);
    font-family: var(--font-mono);
    font-size: 14px;
    letter-spacing: 1px;
    padding: 2px 12px;
    border-right: 2px solid var(--text-dim);
}

/* ===== VITALS PANEL (Health + Armor) ===== */
.vitals-panel {
    position: absolute;
    bottom: var(--hud-pad);
    left: var(--hud-pad);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
}

/* Corner brackets */
.vitals-panel::before,
.vitals-panel::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    pointer-events: none;
}
.vitals-panel::before {
    top: -1px; left: -1px;
    border-top: 2px solid var(--hud-green);
    border-left: 2px solid var(--hud-green);
}
.vitals-panel::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--hud-green);
    border-right: 2px solid var(--hud-green);
}

#health-container,
#armor-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    width: 30px;
    letter-spacing: 2px;
}

.bar-bg {
    position: relative;
    width: 190px;
    height: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

/* Segmented overlay */
.bar-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 17px,
        rgba(8, 12, 18, 0.7) 17px,
        rgba(8, 12, 18, 0.7) 19px
    );
    z-index: 1;
    pointer-events: none;
}

.bar-fill {
    height: 100%;
    width: 100%;
    background: var(--hud-green);
    transition: width 0.2s ease;
    box-shadow: 0 0 8px var(--hud-green-30);
}

.bar-fill.armor {
    background: var(--hud-cyan);
    box-shadow: 0 0 8px var(--hud-cyan-dim);
}

.bar-value {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-bright);
    width: 30px;
    text-align: right;
    font-weight: bold;
}

/* ===== AMMO PANEL ===== */
.ammo-panel {
    position: absolute;
    bottom: var(--hud-pad);
    right: var(--hud-pad);
    padding: 10px 16px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    text-align: right;
}

/* Corner brackets */
.ammo-panel::before,
.ammo-panel::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    pointer-events: none;
}
.ammo-panel::before {
    top: -1px; right: -1px;
    border-top: 2px solid var(--hud-green);
    border-right: 2px solid var(--hud-green);
}
.ammo-panel::after {
    bottom: -1px; left: -1px;
    border-bottom: 2px solid var(--hud-green);
    border-left: 2px solid var(--hud-green);
}

#ammo-container {
    text-align: right;
}

#weapon-name {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: 3px;
    margin-bottom: 2px;
    text-transform: uppercase;
}

#ammo-display {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 600;
    letter-spacing: 2px;
    line-height: 1;
}

#ammo-mag {
    color: var(--text-bright);
}

.ammo-sep {
    color: var(--text-dim);
    margin: 0 3px;
    font-size: 28px;
}

#ammo-reserve {
    color: var(--text-mid);
    font-size: 26px;
}

/* ===== RELOAD PROMPT ===== */
#reload-prompt {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--hud-red);
    letter-spacing: 3px;
    text-shadow: 0 0 8px var(--hud-red-dim);
    animation: blink 0.6s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ===== WAVE ANNOUNCEMENT ===== */
#wave-announcement {
    position: absolute;
    top: 32%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    transition: opacity 0.5s ease;
}

#wave-announcement:not(.hidden) {
    animation: waveReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#wave-announcement-text {
    font-family: var(--font-display);
    font-size: 64px;
    font-weight: 700;
    color: var(--hud-green);
    letter-spacing: 12px;
    text-shadow:
        0 0 20px var(--hud-green-60),
        0 0 60px var(--hud-green-30);
}

@keyframes waveReveal {
    0% {
        opacity: 0;
        letter-spacing: 40px;
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        letter-spacing: 12px;
        filter: blur(0);
    }
}

/* Tutorial glitch effect on wave announcement text */
#wave-announcement.tutorial-glitch #wave-announcement-text {
    animation: tutGlitchReveal 0.4s ease-out, tutGlitchSubtle 4s ease-in-out 0.4s infinite;
}

@keyframes tutGlitchReveal {
    0%   { opacity: 0; transform: translateX(-3px); text-shadow: 2px 0 #ff0040, -2px 0 #00ffcc, 0 0 20px var(--hud-green-60); }
    20%  { opacity: 1; transform: translateX(2px); text-shadow: -1px 0 #ff0040, 1px 0 #00ffcc, 0 0 20px var(--hud-green-60); }
    40%  { transform: translateX(-1px); text-shadow: 1px 0 #ff0040, -1px 0 #00ffcc, 0 0 20px var(--hud-green-60); }
    60%  { transform: translateX(0); }
    100% { text-shadow: 0 0 20px var(--hud-green-60), 0 0 60px var(--hud-green-30); }
}

@keyframes tutGlitchSubtle {
    0%, 92%, 100% { text-shadow: 0 0 20px var(--hud-green-60), 0 0 60px var(--hud-green-30); transform: translateX(0); }
    93% { text-shadow: 1px 0 #ff0040, -1px 0 #00ffcc, 0 0 20px var(--hud-green-60); transform: translateX(1px); }
    94% { text-shadow: -1px 0 #ff0040, 1px 0 #00ffcc, 0 0 20px var(--hud-green-60); transform: translateX(-1px); }
    95% { text-shadow: 0 0 20px var(--hud-green-60), 0 0 60px var(--hud-green-30); transform: translateX(0); }
}

/* Tutorial body/subtitle text below title */
#wave-announcement-body {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    color: rgba(224, 228, 232, 0.75);
    letter-spacing: 1px;
    line-height: 1.6;
    max-width: 480px;
    margin: 12px auto 0;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.2);
}

#wave-announcement-body:empty {
    display: none;
}

/* ===== MINIMAP ===== */
#minimap-container {
    position: absolute;
    top: 54px;
    right: var(--hud-pad);
    width: 180px;
    height: 120px;
    border: 1px solid var(--panel-border);
    background: var(--panel-bg);
    pointer-events: none;
    z-index: 11;
}

#minimap-container::before,
#minimap-container::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    z-index: 12;
}

#minimap-container::before {
    top: -1px;
    right: -1px;
    border-top: 2px solid var(--hud-green);
    border-right: 2px solid var(--hud-green);
}

#minimap-container::after {
    bottom: -1px;
    left: -1px;
    border-bottom: 2px solid var(--hud-green);
    border-left: 2px solid var(--hud-green);
}

#minimap {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

/* ===== KILL FEED ===== */
#kill-feed {
    position: absolute;
    top: 182px;
    right: var(--hud-pad);
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.kill-feed-entry {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--hud-green);
    letter-spacing: 1px;
    padding: 2px 8px;
    background: linear-gradient(90deg, transparent 0%, rgba(57, 255, 20, 0.06) 100%);
    border-right: 2px solid var(--hud-green-30);
    animation: killFeedSlide 0.25s ease-out;
}

@keyframes killFeedSlide {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== INVENTORY BAR ===== */
#inventory-bar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding: 5px 8px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
}

.inv-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 7px;
    min-width: 40px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}

.inv-slot.weapon.active {
    border-color: var(--hud-green-30);
    background: var(--hud-green-08);
    border-top: 2px solid var(--hud-green);
}

.inv-slot.weapon.locked {
    opacity: 0.25;
    border-color: rgba(255, 45, 45, 0.15);
}

.inv-slot.item {
    min-width: 42px;
}

.inv-key {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.inv-label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mid);
    letter-spacing: 1px;
    white-space: nowrap;
}

.inv-item-name {
    font-family: var(--font-body);
    font-size: 9px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.inv-count {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--hud-green);
    line-height: 1;
}

.inv-separator {
    width: 1px;
    background: var(--panel-border);
    margin: 0 4px;
    align-self: stretch;
}

/* ===== STREAK ANNOUNCEMENT ===== */
#streak-announcement {
    position: absolute;
    top: 24%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 700;
    color: var(--hud-orange);
    letter-spacing: 6px;
    text-shadow:
        0 0 20px rgba(255, 107, 44, 0.7),
        0 0 50px rgba(255, 107, 44, 0.3);
    pointer-events: none;
    z-index: 15;
}

/* ===== BOSS HEALTH ===== */
#boss-health-container {
    position: absolute;
    top: 54px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 320px;
}

#boss-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--hud-red);
    letter-spacing: 6px;
    margin-bottom: 4px;
    text-shadow: 0 0 10px var(--hud-red-dim);
}

#boss-health-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 45, 45, 0.3);
}

#boss-health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #991111, var(--hud-red));
    transition: width 0.3s ease;
    box-shadow: 0 0 8px var(--hud-red-dim);
}

/* ===== DAMAGE VIGNETTE ===== */
#damage-vignette {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 35%,
        rgba(200, 20, 20, 0.65) 100%
    );
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

/* ===== GOLD POPUP ===== */
#gold-popup {
    position: absolute;
    top: 44%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--hud-gold);
    letter-spacing: 4px;
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#gold-popup.pop-in {
    animation: goldPopIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes goldPopIn {
    0%   { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ===== SHOP PROMPT ===== */
#shop-prompt {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--hud-green);
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--hud-green-30);
    animation: shopPulse 1.2s ease-in-out infinite;
}

@keyframes shopPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* ============================================ */
/* ===== SCREEN OVERLAYS ===== */
/* ============================================ */

#start-screen,
#death-screen,
#pause-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(6px) saturate(0.6);
    -webkit-backdrop-filter: blur(6px) saturate(0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
}

.screen-content {
    text-align: center;
    max-width: 520px;
    width: 100%;
    padding: 0 20px;
}

/* ===== SHARED SCREEN ELEMENTS ===== */
.title {
    font-family: var(--font-display);
    font-size: 80px;
    font-weight: 700;
    color: var(--hud-green);
    letter-spacing: 16px;
    line-height: 1;
    text-shadow:
        0 0 20px var(--hud-green-60),
        0 0 60px var(--hud-green-30),
        0 4px 20px rgba(0, 0, 0, 0.4);
    margin-bottom: 8px;
}

.subtitle {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-mid);
    letter-spacing: 8px;
    margin-bottom: 24px;
}

.divider {
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-green), transparent);
    margin: 20px auto;
    box-shadow: 0 0 8px var(--hud-green-30);
}

.prompt {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-mid);
    letter-spacing: 5px;
    margin-top: 28px;
}

.pulse {
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ===== START SCREEN ===== */
#start-screen {
    overflow: hidden;
}

/* CRT scanline overlay on start screen */
#start-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(57, 255, 20, 0.018) 2px,
        rgba(57, 255, 20, 0.018) 4px
    );
    pointer-events: none;
    z-index: 2;
}

.start-content { position: relative; z-index: 3; }

/* --- Title: aggressive glitch + breathing glow --- */
.start-title {
    position: relative;
    animation: startTitleFloat 4s ease-in-out infinite alternate,
               titleBreathe 4s ease-in-out infinite alternate,
               startTitleFlicker 4s step-end infinite;
}

/* Glitch layer 1: red/cyan chromatic split, frequent slices */
.start-title::before {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    color: var(--hud-green);
    text-shadow: -3px 0 rgba(255, 0, 80, 0.35), 3px 0 rgba(0, 255, 200, 0.35);
    clip-path: inset(0 0 100% 0);
    animation: startGlitch1 3s step-end infinite;
    pointer-events: none;
}

/* Glitch layer 2: offset duplicate, different timing */
.start-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    color: var(--hud-green);
    text-shadow: 4px 0 rgba(0, 255, 200, 0.25), -4px 0 rgba(255, 0, 80, 0.25);
    clip-path: inset(0 0 100% 0);
    animation: startGlitch2 2.5s step-end infinite 0.7s;
    pointer-events: none;
}

@keyframes startTitleFloat {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-3px); }
}

/* Main title flicker — brief opacity drops */
@keyframes startTitleFlicker {
    0%, 100% { opacity: 1; }
    18%   { opacity: 1; }
    18.5% { opacity: 0.7; }
    19%   { opacity: 1; }
    47%   { opacity: 1; }
    47.2% { opacity: 0.85; }
    47.6% { opacity: 1; }
    73%   { opacity: 1; }
    73.3% { opacity: 0.6; }
    73.8% { opacity: 0.9; }
    74.2% { opacity: 1; }
}

/* Glitch layer 1: aggressive, frequent slices */
@keyframes startGlitch1 {
    0%, 100%  { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    10%       { clip-path: inset(0 0 100% 0); }
    10.5%     { clip-path: inset(20% 0 50% 0); transform: translateX(-4px); }
    11%       { clip-path: inset(65% 0 15% 0); transform: translateX(3px); }
    11.5%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    30%       { clip-path: inset(0 0 100% 0); }
    30.3%     { clip-path: inset(45% 0 25% 0); transform: translateX(5px); }
    30.8%     { clip-path: inset(10% 0 70% 0); transform: translateX(-3px); }
    31.3%     { clip-path: inset(75% 0 5% 0); transform: translateX(2px); }
    31.6%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    55%       { clip-path: inset(0 0 100% 0); }
    55.2%     { clip-path: inset(30% 0 40% 0); transform: translateX(-6px); }
    55.6%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    70%       { clip-path: inset(0 0 100% 0); }
    70.2%     { clip-path: inset(55% 0 20% 0); transform: translateX(4px); }
    70.5%     { clip-path: inset(5% 0 80% 0); transform: translateX(-5px); }
    70.9%     { clip-path: inset(80% 0 0% 0); transform: translateX(3px); }
    71.2%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    88%       { clip-path: inset(0 0 100% 0); }
    88.3%     { clip-path: inset(40% 0 35% 0); transform: translateX(-3px); }
    88.6%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
}

/* Glitch layer 2: offset timing, different slice positions */
@keyframes startGlitch2 {
    0%, 100%  { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    15%       { clip-path: inset(0 0 100% 0); }
    15.3%     { clip-path: inset(60% 0 10% 0); transform: translateX(5px); }
    15.7%     { clip-path: inset(15% 0 65% 0); transform: translateX(-4px); }
    16%       { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    42%       { clip-path: inset(0 0 100% 0); }
    42.2%     { clip-path: inset(35% 0 30% 0); transform: translateX(-6px); }
    42.5%     { clip-path: inset(70% 0 5% 0); transform: translateX(4px); }
    42.8%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    65%       { clip-path: inset(0 0 100% 0); }
    65.4%     { clip-path: inset(25% 0 50% 0); transform: translateX(3px); }
    65.7%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    82%       { clip-path: inset(0 0 100% 0); }
    82.2%     { clip-path: inset(50% 0 20% 0); transform: translateX(-5px); }
    82.5%     { clip-path: inset(8% 0 75% 0); transform: translateX(6px); }
    82.9%     { clip-path: inset(0 0 100% 0); transform: translateX(0); }
}

/* --- Staggered entrance --- */
.start-subtitle { opacity: 0; animation: subtitleFadeIn 0.6s ease 0.15s forwards; }
.start-divider  { opacity: 0; animation: subtitleFadeIn 0.5s ease 0.3s forwards; }

/* --- Code bits background --- */
.start-code-bits {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.code-bit {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--hud-green);
    opacity: 0;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
    animation: codeBitDrift var(--cb-duration, 12s) linear var(--cb-delay, 0s) infinite;
}

@keyframes codeBitDrift {
    0%   { opacity: 0; transform: translateY(0); }
    10%  { opacity: var(--cb-opacity, 0.06); }
    90%  { opacity: var(--cb-opacity, 0.06); }
    100% { opacity: 0; transform: translateY(-30px); }
}

/* --- Grouped keybinds layout --- */
.controls-info {
    margin-top: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
}

.controls-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.controls-group-header {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    color: var(--hud-green-60);
    letter-spacing: 3px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--hud-green-15);
}

.control-row {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    line-height: 1.4;
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-mid);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    min-width: 32px;
    text-align: center;
    letter-spacing: 1px;
}

/* ===== STAT ROWS (Pause + Death) ===== */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 3px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--hud-green);
    line-height: 1;
}

/* ===== PAUSE SCREEN ===== */
.pause-title {
    color: var(--hud-green);
    text-shadow:
        0 0 20px var(--hud-green-60),
        0 0 60px var(--hud-green-30);
}

.pause-stats {
    margin-top: 8px;
}

.pause-weapons {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pause-section-title {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 4px;
    margin-bottom: 10px;
}

.pause-weapon-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.pause-weapon-name {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-mid);
    letter-spacing: 1px;
}

.pause-weapon-ammo {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--hud-green);
}

/* ===== DEATH SCREEN ===== */
#death-screen {
    background: rgba(0, 0, 0, 0.92) !important;
    backdrop-filter: blur(4px) saturate(0.3) !important;
    overflow: hidden;
    flex-direction: column;
}

/* --- Scanlines --- */
.death-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
    z-index: 10;
    animation: death-scanline-scroll 8s linear infinite;
}

@keyframes death-scanline-scroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* --- Matrix rain canvas --- */
#death-matrix-rain {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.12;
    pointer-events: none;
    z-index: 1;
}

/* --- Glitch blocks --- */
.death-glitch-block {
    position: absolute;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    mix-blend-mode: screen;
}

.death-glitch-block-1 {
    top: 18%; left: 0; right: 0; height: 3px;
    background: var(--hud-red);
    animation: death-glitch-flash 4s infinite 0.5s;
}

.death-glitch-block-2 {
    top: 55%; left: 5%; width: 40%; height: 2px;
    background: var(--hud-cyan);
    animation: death-glitch-flash 3.2s infinite 1.2s;
}

.death-glitch-block-3 {
    top: 72%; right: 0; width: 25%; height: 4px;
    background: var(--hud-green);
    animation: death-glitch-flash 5s infinite 2s;
}

@keyframes death-glitch-flash {
    0%, 92%, 100% { opacity: 0; transform: translateX(0); }
    93% { opacity: 0.8; transform: translateX(-8px); }
    94% { opacity: 0; }
    95% { opacity: 0.6; transform: translateX(12px); height: 6px; }
    96% { opacity: 0; transform: translateX(0); }
    97% { opacity: 0.9; transform: translateX(-3px) scaleY(2); }
    98% { opacity: 0; }
}

/* --- Error popups --- */
.death-error-popup {
    position: absolute;
    width: 220px;
    background: rgba(10, 2, 2, 0.85);
    border: 1px solid rgba(255, 45, 45, 0.5);
    border-radius: 2px;
    z-index: 8;
    opacity: 0;
    transform: scale(0.7) translateY(10px);
    box-shadow:
        0 0 20px rgba(255, 45, 45, 0.1),
        inset 0 0 30px rgba(255, 45, 45, 0.03);
    font-family: var(--font-mono);
}

.death-error-bar {
    background: rgba(255, 45, 45, 0.15);
    padding: 4px 8px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--hud-red);
    border-bottom: 1px solid rgba(255, 45, 45, 0.2);
    display: flex;
    align-items: center;
    gap: 4px;
}

.death-error-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--hud-red);
    opacity: 0.7;
    display: inline-block;
}

.death-error-dot:first-child { background: #ff4444; }
.death-error-dot:nth-child(2) { background: #884444; }
.death-error-dot:nth-child(3) { background: #553333; margin-right: 6px; }

.death-error-body {
    padding: 8px 10px;
    font-size: 10px;
    line-height: 1.6;
    color: rgba(255, 120, 120, 0.8);
}

.death-popup-1 {
    top: 8%; left: 5%;
    animation: death-popup-in 0.3s ease-out 0.8s both, death-popup-jitter 6s infinite 1.1s;
}

.death-popup-2 {
    top: 12%; right: 6%;
    animation: death-popup-in 0.3s ease-out 1.4s both, death-popup-jitter 5s infinite 1.7s;
}

.death-popup-3 {
    bottom: 16%; left: 8%;
    animation: death-popup-in 0.3s ease-out 2.0s both, death-popup-jitter 7s infinite 2.3s;
}

.death-popup-4 {
    bottom: 10%; right: 4%;
    width: 190px;
    animation: death-popup-in 0.3s ease-out 2.6s both, death-popup-jitter 4.5s infinite 2.9s;
}

@keyframes death-popup-in {
    0% { opacity: 0; transform: scale(0.7) translateY(10px); }
    60% { opacity: 1; transform: scale(1.04) translateY(-2px); }
    100% { opacity: 0.95; transform: scale(1) translateY(0); }
}

@keyframes death-popup-jitter {
    0%, 97%, 100% { transform: translate(0, 0); }
    97.5% { transform: translate(-2px, 1px); }
    98% { transform: translate(3px, -1px); }
    98.5% { transform: translate(-1px, 2px); }
    99% { transform: translate(1px, -1px); }
}

/* --- Main content --- */
.death-content {
    position: relative;
    z-index: 9;
    text-align: center;
    max-width: 560px;
    width: 100%;
    padding: 0 20px;
    animation: death-content-in 0.6s ease-out 0.2s both;
}

@keyframes death-content-in {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* --- Glitch title --- */
.death-glitch-title {
    font-family: var(--font-display);
    font-size: 72px;
    font-weight: 700;
    color: var(--hud-red);
    letter-spacing: 8px;
    position: relative;
    text-shadow:
        0 0 30px rgba(255, 45, 45, 0.4),
        0 0 80px rgba(255, 45, 45, 0.15);
    animation: death-title-glitch 3s infinite;
}

.death-glitch-title::before,
.death-glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    overflow: hidden;
}

.death-glitch-title::before {
    color: var(--hud-cyan);
    z-index: -1;
    animation: death-glitch-clip-top 3s infinite linear;
}

.death-glitch-title::after {
    color: var(--hud-green);
    z-index: -1;
    animation: death-glitch-clip-bot 3s infinite linear;
}

@keyframes death-title-glitch {
    0%, 90%, 100% { transform: translate(0); }
    91% { transform: translate(-3px, 1px); }
    92% { transform: translate(2px, -1px); }
    93% { transform: translate(0); }
    94% { transform: translate(4px, 2px) skewX(-1deg); }
    95% { transform: translate(-2px, -1px); }
    96% { transform: translate(0); }
}

@keyframes death-glitch-clip-top {
    0%, 88% { clip-path: inset(0 0 100% 0); }
    89% { clip-path: inset(10% 0 60% 0); transform: translate(-4px, 0); }
    90% { clip-path: inset(30% 0 40% 0); transform: translate(3px, 0); }
    91% { clip-path: inset(0 0 100% 0); transform: translate(0); }
    95% { clip-path: inset(50% 0 20% 0); transform: translate(-6px, 0); }
    96% { clip-path: inset(0 0 100% 0); transform: translate(0); }
    100% { clip-path: inset(0 0 100% 0); }
}

@keyframes death-glitch-clip-bot {
    0%, 91% { clip-path: inset(100% 0 0 0); }
    92% { clip-path: inset(60% 0 10% 0); transform: translate(5px, 0); }
    93% { clip-path: inset(40% 0 30% 0); transform: translate(-3px, 0); }
    94% { clip-path: inset(100% 0 0 0); transform: translate(0); }
    97% { clip-path: inset(20% 0 50% 0); transform: translate(4px, 0); }
    98% { clip-path: inset(100% 0 0 0); transform: translate(0); }
    100% { clip-path: inset(100% 0 0 0); }
}

/* --- Subtitle --- */
.death-subtitle {
    font-family: var(--font-mono);
    font-size: 13px;
    color: rgba(255, 80, 80, 0.6);
    letter-spacing: 4px;
    margin-top: 6px;
    margin-bottom: 28px;
    animation: death-subtitle-in 0.4s ease-out 0.5s both;
}

@keyframes death-subtitle-in {
    0% { opacity: 0; letter-spacing: 20px; }
    100% { opacity: 1; letter-spacing: 4px; }
}

/* --- Terminal window --- */
.death-terminal {
    background: rgba(6, 10, 6, 0.8);
    border: 1px solid rgba(57, 255, 20, 0.2);
    border-radius: 4px;
    text-align: left;
    overflow: hidden;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.5),
        0 0 1px rgba(57, 255, 20, 0.3),
        inset 0 0 60px rgba(57, 255, 20, 0.02);
    animation: death-terminal-in 0.5s ease-out 0.7s both;
}

@keyframes death-terminal-in {
    0% { opacity: 0; transform: scaleY(0.01) scaleX(0.8); }
    40% { opacity: 1; transform: scaleY(1.02) scaleX(1); }
    100% { transform: scaleY(1) scaleX(1); }
}

.death-terminal-header {
    background: rgba(57, 255, 20, 0.08);
    border-bottom: 1px solid rgba(57, 255, 20, 0.15);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.death-term-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.death-term-dot.red { background: #ff5f57; }
.death-term-dot.yellow { background: #febc2e; }
.death-term-dot.green { background: #28c840; }

.death-term-path {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(57, 255, 20, 0.4);
    margin-left: 8px;
}

.death-terminal-body {
    padding: 14px 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    color: rgba(57, 255, 20, 0.7);
}

.death-term-line {
    opacity: 0;
    animation: death-line-type 0.3s ease-out both;
}

.death-term-line:nth-child(1) { animation-delay: 1.0s; }
.death-term-line:nth-child(2) { animation-delay: 1.4s; }
.death-term-line:nth-child(3) { animation-delay: 1.8s; }

@keyframes death-line-type {
    0% { opacity: 0; transform: translateX(-5px); }
    100% { opacity: 1; transform: translateX(0); }
}

.death-term-prompt {
    color: var(--hud-green);
    font-weight: 700;
}

.death-term-cmd {
    color: rgba(57, 255, 20, 0.9);
}

.death-term-error {
    color: var(--hud-red);
    text-shadow: 0 0 8px rgba(255, 45, 45, 0.3);
}

/* --- Stat block --- */
.death-stat-block {
    margin: 6px 0 10px 0;
    padding: 8px 12px;
    background: rgba(57, 255, 20, 0.04);
    border-left: 2px solid rgba(57, 255, 20, 0.3);
    opacity: 0;
    animation: death-line-type 0.3s ease-out 2.2s both;
}

.death-stat-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 2px 0;
}

.death-stat-key {
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(57, 255, 20, 0.5);
    min-width: 140px;
}

.death-stat-eq {
    color: rgba(57, 255, 20, 0.3);
}

.death-stat-val {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--hud-green);
    text-shadow: 0 0 12px var(--hud-green-30);
}

/* --- Best games in terminal --- */
.death-best-list {
    margin: 4px 0 8px 0;
    padding: 6px 12px;
    background: rgba(57, 255, 20, 0.03);
    border-left: 2px solid rgba(57, 255, 20, 0.15);
    opacity: 0;
    animation: death-line-type 0.3s ease-out 2.8s both;
}

.best-game-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(57, 255, 20, 0.45);
    border-bottom: 1px solid rgba(57, 255, 20, 0.06);
}

.best-game-row.new-best {
    color: var(--hud-green);
    text-shadow: 0 0 6px var(--hud-green-30);
}

.best-game-rank {
    width: 24px;
    font-family: var(--font-mono);
    color: rgba(57, 255, 20, 0.3);
}

.best-game-kills {
    font-weight: 700;
    color: inherit;
}

.best-game-detail {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(57, 255, 20, 0.35);
}

.new-best-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--hud-green);
    letter-spacing: 3px;
    margin-top: 6px;
    text-shadow: 0 0 10px var(--hud-green-30);
    animation: death-new-best-pulse 1.5s infinite;
}

@keyframes death-new-best-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* --- Cursor blink --- */
.death-cursor-line {
    opacity: 0;
    animation: death-line-type 0.3s ease-out 3.2s both;
}

.death-term-cursor {
    animation: death-cursor-blink 0.8s step-end infinite;
    color: var(--hud-green);
}

@keyframes death-cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Restart prompt --- */
.death-restart-prompt {
    font-family: var(--font-mono);
    font-size: 13px;
    color: rgba(57, 255, 20, 0.5);
    letter-spacing: 4px;
    margin-top: 24px;
    opacity: 0;
    animation: death-restart-in 0.4s ease-out 3.5s both;
}

.death-restart-bracket {
    color: var(--hud-red);
    font-weight: 700;
}

.death-restart-prompt:hover {
    color: var(--hud-green);
    text-shadow: 0 0 12px var(--hud-green-30);
}

@keyframes death-restart-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* ===== UPGRADE SCREEN ===== */
#upgrade-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(6px) saturate(0.6);
    -webkit-backdrop-filter: blur(6px) saturate(0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
}

.upgrade-title {
    font-family: var(--font-display);
    font-size: 40px;
    font-weight: 700;
    color: var(--hud-green);
    letter-spacing: 10px;
    margin-bottom: 36px;
    text-shadow: 0 0 20px var(--hud-green-30);
}

.upgrade-options {
    display: flex;
    gap: 16px;
}

.upgrade-option {
    position: relative;
    width: 200px;
    padding: 24px 18px 20px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.upgrade-option::before,
.upgrade-option::after {
    content: '';
    position: absolute;
    width: 10px; height: 10px;
    pointer-events: none;
    transition: border-color 0.2s;
}
.upgrade-option::before {
    top: -1px; left: -1px;
    border-top: 2px solid var(--panel-border);
    border-left: 2px solid var(--panel-border);
}
.upgrade-option::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--panel-border);
    border-right: 2px solid var(--panel-border);
}

.upgrade-option:hover {
    border-color: var(--hud-green-60);
    background: rgba(57, 255, 20, 0.05);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px var(--hud-green-08);
}
.upgrade-option:hover::before,
.upgrade-option:hover::after {
    border-color: var(--hud-green);
}

.upgrade-key {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: inline-block;
    padding: 3px 10px;
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.upgrade-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--hud-green);
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.upgrade-desc {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-mid);
    letter-spacing: 1px;
    line-height: 1.4;
}

/* ===== SHOP SCREEN ===== */
#shop-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(2, 4, 8, 0.94);
    backdrop-filter: blur(8px) saturate(0.5);
    -webkit-backdrop-filter: blur(8px) saturate(0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    cursor: default;
    padding: 0;
    overflow-y: auto;
}

/* Scanline overlay for CRT atmosphere */
#shop-screen::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 30, 0.015) 2px,
        rgba(0, 255, 30, 0.015) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* Shop header bar — fixed dark strip at top */
.shop-header {
    width: 100%;
    padding: 28px 40px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(4, 8, 14, 0.6);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.shop-title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
    color: var(--hud-green);
    letter-spacing: 12px;
    text-shadow: 0 0 20px var(--hud-green-30), 0 0 40px rgba(57, 255, 20, 0.1);
    line-height: 1;
}

.shop-title-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 4px;
    margin-top: 4px;
}

/* Gold balance — prominent, unmistakably gold */
.shop-gold {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 2px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.shop-gold-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.shop-gold-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-gold-icon {
    color: #FFD700;
    font-size: 16px;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    animation: shopGoldPulse 2s ease-in-out infinite;
}

.shop-gold-amount {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: #FFD700;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.5),
        0 0 30px rgba(255, 165, 0, 0.2),
        0 1px 0 rgba(180, 140, 0, 0.8);
    letter-spacing: 2px;
    line-height: 1;
}

@keyframes shopGoldPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; text-shadow: 0 0 12px rgba(255, 215, 0, 0.9); }
}

/* Tab navigation — underline style with glow */
.shop-tabs {
    display: flex;
    gap: 0;
    width: 100%;
    justify-content: center;
    background: rgba(4, 8, 14, 0.4);
    border-bottom: 1px solid rgba(57, 255, 20, 0.08);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.shop-tab {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 4px;
    padding: 14px 36px;
    cursor: pointer;
    transition: color 0.25s, box-shadow 0.25s;
    position: relative;
    border-bottom: 2px solid transparent;
}

.shop-tab::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--hud-green);
    box-shadow: 0 0 8px var(--hud-green-60);
    transition: width 0.3s ease, left 0.3s ease;
}

.shop-tab.active {
    color: var(--hud-green);
    text-shadow: 0 0 12px var(--hud-green-30);
}

.shop-tab.active::after {
    width: 100%;
    left: 0;
}

.shop-tab:hover:not(.active) {
    color: var(--text-mid);
}

/* Items grid — responsive 3-column */
.shop-items {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 28px 40px;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    flex: 1;
    align-content: start;
}

/* Item card — structured left-aligned layout */
.shop-item {
    position: relative;
    padding: 18px 16px 16px;
    background: rgba(8, 14, 22, 0.85);
    border: 1px solid rgba(57, 255, 20, 0.1);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}

/* Corner brackets on shop items */
.shop-item::before,
.shop-item::after {
    content: '';
    position: absolute;
    width: 8px; height: 8px;
    pointer-events: none;
    transition: border-color 0.2s;
}
.shop-item::before {
    top: -1px; left: -1px;
    border-top: 2px solid rgba(57, 255, 20, 0.25);
    border-left: 2px solid rgba(57, 255, 20, 0.25);
}
.shop-item::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid rgba(57, 255, 20, 0.25);
    border-right: 2px solid rgba(57, 255, 20, 0.25);
}

.shop-item:hover:not(.shop-item-locked):not(.shop-item-owned) {
    border-color: var(--hud-green-60);
    background: rgba(57, 255, 20, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 20px var(--hud-green-08);
}
.shop-item:hover:not(.shop-item-locked):not(.shop-item-owned)::before,
.shop-item:hover:not(.shop-item-locked):not(.shop-item-owned)::after {
    border-color: var(--hud-green);
}

.shop-item-owned {
    border-color: rgba(255, 255, 255, 0.05);
    opacity: 0.4;
    cursor: default;
}

.shop-item-locked {
    border-color: rgba(255, 45, 45, 0.15);
    opacity: 0.55;
    cursor: default;
}
.shop-item-locked::before {
    border-color: rgba(255, 45, 45, 0.3) !important;
}
.shop-item-locked::after {
    border-color: rgba(255, 45, 45, 0.3) !important;
}

/* Key badge — keyboard-key style, top-right */
.shop-item .upgrade-key {
    position: absolute;
    top: 8px;
    right: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    min-width: 22px;
    text-align: center;
    padding: 2px 6px;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Item name — green, prominent */
.shop-weapon-name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--hud-green);
    letter-spacing: 2px;
    margin-bottom: 6px;
    line-height: 1.1;
    padding-right: 36px;
}

/* Stats line — readable mid-brightness */
.shop-weapon-stats {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-mid);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Description — subtle but legible */
.shop-item-description {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 400;
    color: var(--text-dim);
    letter-spacing: 0.3px;
    margin-bottom: 14px;
    line-height: 1.4;
    opacity: 0.85;
}

/* Price — gold for affordable, green default, dim for owned */
.shop-weapon-price {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 2px;
    border-top: 1px solid rgba(57, 255, 20, 0.08);
    padding-top: 10px;
    margin-top: 0;
}

.shop-weapon-price.affordable {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.35);
}

.shop-weapon-price.owned {
    color: var(--text-dim);
    font-size: 14px;
    letter-spacing: 3px;
}

.shop-weapon-price.owned::before {
    content: '\2713  ';
    color: var(--hud-green);
}

/* Close hint — bottom bar */
.shop-close-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-dim);
    letter-spacing: 3px;
    padding: 16px 0 24px;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.shop-section-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--hud-green);
    letter-spacing: 4px;
    margin: 20px 0 8px;
    text-align: center;
    text-transform: uppercase;
    opacity: 0.6;
}

.shop-close-hint {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 3px;
    margin-top: 24px;
}

/* ===== SCANNER OVERLAY ===== */
#scanner-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 3px solid var(--hud-green);
    box-shadow: inset 0 0 60px rgba(57, 255, 20, 0.15);
    pointer-events: none;
    z-index: 90;
    animation: scannerPulse 1s ease-in-out infinite;
}

#scanner-overlay::after {
    content: 'SCANNING...';
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--hud-green);
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--hud-green-30);
}

@keyframes scannerPulse {
    0%, 100% { border-color: var(--hud-green); box-shadow: inset 0 0 60px rgba(57, 255, 20, 0.15); }
    50% { border-color: rgba(57, 255, 20, 0.4); box-shadow: inset 0 0 30px rgba(57, 255, 20, 0.05); }
}

/* ===== OVERCLOCK OVERLAY ===== */
#overclock-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 2px solid var(--hud-cyan);
    box-shadow: inset 0 0 40px rgba(0, 255, 255, 0.1);
    pointer-events: none;
    z-index: 90;
    animation: overclockPulse 0.5s ease-in-out infinite;
}

@keyframes overclockPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== TECH TOOLS BAR ===== */
#tech-tools-bar {
    position: absolute;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.tech-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 8px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    min-width: 40px;
}

.tech-slot.on-cooldown {
    opacity: 0.4;
}

.tech-slot.active-effect {
    border-color: var(--hud-green);
    box-shadow: 0 0 8px var(--hud-green-30);
}

.tech-key {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--hud-green);
    letter-spacing: 1px;
}

.tech-name {
    font-family: var(--font-body);
    font-size: 8px;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.tech-charges {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--hud-gold);
}

/* ===== TUTORIAL OVERLAY ===== */
#tutorial-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 85;
}


#tutorial-hints {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    pointer-events: none;
}

.tut-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: rgba(8, 12, 18, 0.88);
    border: 1px solid rgba(57, 255, 20, 0.3);
    border-left: 3px solid var(--hud-green);
    animation: tutHintIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.tut-hint.done {
    animation: tutHintOut 0.3s ease forwards;
    pointer-events: none;
}

.tut-key {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--hud-green);
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid rgba(57, 255, 20, 0.25);
    padding: 4px 10px;
    min-width: 36px;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 0 6px rgba(57, 255, 20, 0.4);
}

.tut-action {
    font-family: var(--font-body);
    font-size: 13px;
    color: rgba(224, 228, 232, 0.85);
    letter-spacing: 1px;
}

@keyframes tutHintIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes tutHintOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

#tutorial-skip {
    position: absolute;
    bottom: 90px;
    left: var(--hud-pad);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--hud-green);
    background: rgba(8, 12, 18, 0.75);
    border: 1px solid rgba(57, 255, 20, 0.35);
    padding: 8px 18px;
    cursor: pointer;
    letter-spacing: 2px;
    pointer-events: auto;
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

#tutorial-skip:hover {
    background: rgba(57, 255, 20, 0.08);
    border-color: var(--hud-green);
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.2);
}

.tut-hint.nudge {
    animation: tutNudge 0.6s ease-in-out 3;
}

@keyframes tutNudge {
    0%, 100% { border-color: rgba(57, 255, 20, 0.3); }
    50%      { border-color: rgba(57, 255, 20, 0.8); box-shadow: 0 0 12px rgba(57, 255, 20, 0.3); }
}

#tutorial-start-btn {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--hud-green);
    background: rgba(8, 12, 18, 0.85);
    border: 2px solid var(--hud-green);
    padding: 14px 40px;
    cursor: pointer;
    letter-spacing: 6px;
    pointer-events: auto;
    text-shadow: 0 0 12px rgba(57, 255, 20, 0.5);
    animation: tutStartPulse 1.5s ease-in-out infinite;
}

@keyframes tutStartPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(57, 255, 20, 0.2); }
    50%      { box-shadow: 0 0 30px rgba(57, 255, 20, 0.4); }
}

#tutorial-start-btn:hover {
    background: rgba(57, 255, 20, 0.1);
}

/* ===== PERMANENT VIGNETTE ===== */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 55%,
        rgba(0, 0, 0, 0.55) 100%
    );
    pointer-events: none;
    z-index: 5;
}

/* ============================================ */
/* ===== HOME / LANDING SCREEN ===== */
/* ============================================ */

#home-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #020408;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: default;
    overflow: hidden;
}

/* --- Matrix digital rain (pure CSS, 3 layers) --- */
.home-matrix-bg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(57, 255, 20, 0.012) 2px,
            rgba(57, 255, 20, 0.012) 4px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 32px,
            rgba(57, 255, 20, 0.018) 32px,
            rgba(57, 255, 20, 0.018) 33px
        );
    animation: matrixScroll 10s linear infinite;
}

.home-matrix-bg::before {
    content: '';
    position: absolute;
    top: -200%; left: 0;
    width: 100%; height: 400%;
    background:
        repeating-linear-gradient(
            180deg,
            transparent 0%,
            rgba(57, 255, 20, 0.04) 1.5%,
            transparent 3%,
            transparent 7%,
            rgba(57, 255, 20, 0.025) 8.5%,
            transparent 10%,
            transparent 16%,
            rgba(57, 255, 20, 0.015) 17%,
            transparent 18%,
            transparent 25%
        );
    animation: matrixRain 5s linear infinite;
}

.home-matrix-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(
        ellipse at 50% 40%,
        transparent 20%,
        rgba(2, 4, 8, 0.6) 60%,
        rgba(2, 4, 8, 0.92) 100%
    );
}

@keyframes matrixScroll {
    from { background-position: 0 0; }
    to   { background-position: 0 240px; }
}

@keyframes matrixRain {
    from { transform: translateY(0); }
    to   { transform: translateY(25%); }
}

/* --- CRT scanline sweep --- */
.home-scanline {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(57, 255, 20, 0.025) 2px,
        rgba(57, 255, 20, 0.025) 4px
    );
    background-size: 100% 4px;
}

.home-scanline::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(57, 255, 20, 0.08) 20%,
        rgba(57, 255, 20, 0.12) 50%,
        rgba(57, 255, 20, 0.08) 80%,
        transparent 100%
    );
    animation: scanlineSweep 4s linear infinite;
    box-shadow: 0 0 20px 4px rgba(57, 255, 20, 0.04);
}

@keyframes scanlineSweep {
    from { top: -4px; }
    to   { top: 100%; }
}

/* --- Glitch overlay (subtle flicker) --- */
.home-glitch-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    animation: glitchFlash 8s step-end infinite;
}

@keyframes glitchFlash {
    0%, 100% { opacity: 0; }
    42%      { opacity: 0; }
    42.5%    { opacity: 1; background: rgba(57, 255, 20, 0.015); }
    43%      { opacity: 0; }
    78%      { opacity: 0; }
    78.3%    { opacity: 1; background: rgba(57, 255, 20, 0.02); }
    78.6%    { opacity: 0; }
}

/* --- Content layer --- */
.home-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Logo block --- */
.home-logo-block {
    text-align: center;
    margin-bottom: 8px;
}

.home-logo-flicker {
    display: flex;
    align-items: center;
    gap: 20px;
    animation: logoEntry 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.home-logo-line {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-green), transparent);
    box-shadow: 0 0 8px var(--hud-green-30);
    opacity: 0.6;
}

@keyframes logoEntry {
    0% {
        opacity: 0;
        letter-spacing: 60px;
        filter: blur(12px);
        transform: scaleX(1.3);
    }
    60% {
        opacity: 1;
        filter: blur(0);
    }
    100% {
        opacity: 1;
        letter-spacing: 20px;
        filter: blur(0);
        transform: scaleX(1);
    }
}

/* Title — larger, breathing glow, glitch-ready with data-text */
.home-title {
    font-size: 104px;
    letter-spacing: 20px;
    position: relative;
    text-shadow:
        0 0 20px var(--hud-green-60),
        0 0 60px var(--hud-green-30),
        0 0 120px rgba(57, 255, 20, 0.12);
    animation: titleBreathe 4s ease-in-out infinite alternate;
}

.home-title::before {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    color: var(--hud-green);
    text-shadow: -2px 0 rgba(255, 0, 80, 0.15), 2px 0 rgba(0, 255, 200, 0.15);
    clip-path: inset(0 0 0 0);
    animation: glitchText 6s step-end infinite;
    pointer-events: none;
}

@keyframes titleBreathe {
    0% {
        text-shadow:
            0 0 20px var(--hud-green-60),
            0 0 60px var(--hud-green-30),
            0 0 120px rgba(57, 255, 20, 0.12);
    }
    100% {
        text-shadow:
            0 0 30px var(--hud-green-60),
            0 0 90px rgba(57, 255, 20, 0.35),
            0 0 180px rgba(57, 255, 20, 0.18);
    }
}

@keyframes glitchText {
    0%, 100% { clip-path: inset(0 0 100% 0); }
    35%      { clip-path: inset(0 0 100% 0); }
    35.5%    { clip-path: inset(40% 0 30% 0); transform: translateX(-3px); }
    36%      { clip-path: inset(70% 0 10% 0); transform: translateX(2px); }
    36.5%    { clip-path: inset(0 0 100% 0); transform: translateX(0); }
    72%      { clip-path: inset(0 0 100% 0); }
    72.2%    { clip-path: inset(15% 0 60% 0); transform: translateX(2px); }
    72.6%    { clip-path: inset(0 0 100% 0); transform: translateX(0); }
}

.home-subtitle {
    letter-spacing: 10px;
    margin-top: 6px;
    color: var(--text-dim);
    opacity: 0;
    animation: subtitleFadeIn 0.8s ease 0.6s forwards;
}

@keyframes subtitleFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Divider with center node --- */
.home-divider {
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-green-30), transparent);
    margin: 28px 0 32px;
    position: relative;
    opacity: 0;
    animation: subtitleFadeIn 0.6s ease 0.8s forwards;
}

.home-divider-node {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: var(--hud-green);
    box-shadow: 0 0 8px var(--hud-green-60), 0 0 20px var(--hud-green-30);
    display: block;
}

.home-divider-node::before,
.home-divider-node::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 3px;
    height: 3px;
    background: var(--hud-green);
    opacity: 0.4;
    transform: translateY(-50%);
}

.home-divider-node::before { left: -14px; }
.home-divider-node::after  { right: -14px; }

/* --- Buttons container --- */
.home-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: subtitleFadeIn 0.7s ease 1s forwards;
}

/* --- Home button --- */
.home-btn {
    position: relative;
    width: 380px;
    padding: 16px 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
    outline: none;
}

/* Corner brackets */
.home-btn::before,
.home-btn::after {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    pointer-events: none;
    transition: border-color 0.2s;
}
.home-btn::before {
    top: -1px; left: -1px;
    border-top: 2px solid var(--panel-border);
    border-left: 2px solid var(--panel-border);
}
.home-btn::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--panel-border);
    border-right: 2px solid var(--panel-border);
}

.home-btn:hover:not(.home-btn-locked) {
    border-color: var(--hud-green-60);
    background: rgba(57, 255, 20, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px var(--hud-green-08);
}
.home-btn:hover:not(.home-btn-locked)::before,
.home-btn:hover:not(.home-btn-locked)::after {
    border-color: var(--hud-green);
}
.home-btn:hover:not(.home-btn-locked) .home-btn-arrow {
    transform: translateX(4px);
    opacity: 1;
}

.home-btn-icon {
    font-size: 12px;
    color: var(--hud-green);
    opacity: 0.6;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.home-btn-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.home-btn-label {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--hud-green);
    letter-spacing: 5px;
    line-height: 1;
}

.home-btn-hint {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 2px;
    margin-top: 4px;
}

.home-btn-arrow {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--hud-green);
    opacity: 0.3;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.home-btn-lock {
    font-size: 8px;
    color: var(--hud-cyan);
    opacity: 0.4;
    flex-shrink: 0;
}

/* Locked multiplayer button */
.home-btn-locked {
    opacity: 0.35;
    cursor: default;
}
.home-btn-locked .home-btn-label {
    color: var(--hud-cyan);
}
.home-btn-locked .home-btn-icon {
    color: var(--hud-cyan);
}
.home-btn-locked:hover {
    border-color: rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.02);
    transform: translateY(-1px);
    box-shadow: none;
}
.home-btn-locked:hover::before,
.home-btn-locked:hover::after {
    border-color: rgba(0, 212, 255, 0.25);
}

/* --- Footer watermark --- */
.home-footer {
    margin-top: 48px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-dim);
    letter-spacing: 2px;
    opacity: 0;
    animation: subtitleFadeIn 0.5s ease 1.3s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-footer-sys {
    color: var(--hud-green);
    opacity: 0.5;
}

.home-footer-sep {
    opacity: 0.25;
}

.home-footer-ver,
.home-footer-id {
    opacity: 0.6;
}

/* ===== COMING SOON TOAST ===== */
#coming-soon-toast {
    position: fixed;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    background: var(--panel-bg);
    border: 1px solid rgba(0, 212, 255, 0.2);
    z-index: 200;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1),
               toastFadeOut 0.4s ease-in 1.6s forwards;
}

/* Corner brackets */
#coming-soon-toast::before,
#coming-soon-toast::after {
    content: '';
    position: absolute;
    width: 8px; height: 8px;
    pointer-events: none;
}
#coming-soon-toast::before {
    top: -1px; left: -1px;
    border-top: 2px solid var(--hud-cyan);
    border-left: 2px solid var(--hud-cyan);
}
#coming-soon-toast::after {
    bottom: -1px; right: -1px;
    border-bottom: 2px solid var(--hud-cyan);
    border-right: 2px solid var(--hud-cyan);
}

.toast-icon {
    color: var(--hud-cyan);
    font-size: 14px;
    opacity: 0.7;
}

.toast-text {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--hud-cyan);
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--hud-cyan-dim);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   MULTIPLAYER
   ═══════════════════════════════════════════════════════════════ */

#mp-lobby {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #020408;
}

.mp-lobby-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 420px;
    width: 100%;
    padding: 40px;
}

.mp-title {
    font-family: var(--font-display);
    font-size: 2.4em;
    color: var(--hud-green);
    letter-spacing: 8px;
    text-shadow: 0 0 20px rgba(57, 255, 20, 0.4);
    text-align: center;
}

.mp-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--hud-green-dim), transparent);
    margin: 4px 0 12px;
}

/* Inputs */
.mp-label {
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--hud-green-dim);
    margin-bottom: 4px;
}

.mp-name-row {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 8px;
}

.mp-input {
    background: rgba(57, 255, 20, 0.05);
    border: 1px solid var(--hud-green-dim);
    color: var(--hud-green);
    font-family: var(--font-body);
    font-size: 16px;
    letter-spacing: 3px;
    padding: 12px 16px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mp-input:focus {
    border-color: var(--hud-green);
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.2), inset 0 0 8px rgba(57, 255, 20, 0.05);
}

.mp-input::placeholder {
    color: rgba(57, 255, 20, 0.25);
    letter-spacing: 3px;
}

.mp-code-input {
    font-size: 22px;
    letter-spacing: 8px;
    text-align: center;
    flex: 1;
}

.mp-join-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.mp-join-row .mp-btn {
    flex-shrink: 0;
    width: auto;
    padding: 12px 24px;
}

/* Buttons */
.mp-btn {
    background: rgba(57, 255, 20, 0.08);
    border: 1px solid var(--hud-green-dim);
    color: var(--hud-green);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 4px;
    padding: 14px 24px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    text-transform: uppercase;
}

.mp-btn:hover {
    background: rgba(57, 255, 20, 0.15);
    border-color: var(--hud-green);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.15);
    text-shadow: 0 0 8px var(--hud-green);
}

.mp-btn:active {
    background: rgba(57, 255, 20, 0.25);
}

.mp-btn-secondary {
    color: var(--hud-green-dim);
    border-color: rgba(57, 255, 20, 0.15);
    background: transparent;
    font-size: 12px;
}

.mp-btn-secondary:hover {
    color: var(--hud-green);
}

.mp-btn-start {
    background: rgba(57, 255, 20, 0.15);
    border-color: var(--hud-green);
    font-size: 16px;
}

.mp-btn-active {
    background: rgba(57, 255, 20, 0.2) !important;
    border-color: var(--hud-green) !important;
    box-shadow: 0 0 16px rgba(57, 255, 20, 0.2);
}

/* Room view */
.mp-room-code-display {
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 4px;
    color: var(--hud-green-dim);
    text-align: center;
    margin-bottom: 12px;
}

.mp-room-code-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 10px;
    color: var(--hud-green);
    text-shadow: 0 0 16px rgba(57, 255, 20, 0.5);
    display: block;
    margin-top: 6px;
    user-select: all;
}

.mp-player-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
    max-height: 200px;
    overflow-y: auto;
}

.mp-player-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(57, 255, 20, 0.04);
    border: 1px solid rgba(57, 255, 20, 0.1);
    transition: all 0.3s;
}

.mp-player-card.ready {
    border-color: var(--hud-green);
    background: rgba(57, 255, 20, 0.08);
}

.mp-player-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}

.mp-player-name {
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--hud-green);
    flex: 1;
}

.mp-player-status {
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--hud-green-dim);
}

.mp-player-card.ready .mp-player-status {
    color: var(--hud-green);
}

.mp-room-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

/* ─── Respawn Overlay ─── */
#mp-respawn {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.mp-respawn-content {
    text-align: center;
}

.mp-respawn-label {
    font-family: var(--font-display);
    font-size: 2em;
    letter-spacing: 8px;
    color: #ff3333;
    text-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
    margin-bottom: 12px;
}

.mp-respawn-timer {
    font-family: var(--font-body);
    font-size: 1.2em;
    letter-spacing: 4px;
    color: var(--hud-green-dim);
}

.mp-respawn-timer span {
    color: var(--hud-green);
    font-size: 1.5em;
    font-weight: 700;
}

/* ─── Scoreboard ─── */
#mp-scoreboard {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

.mp-scoreboard-content {
    background: rgba(2, 4, 8, 0.95);
    border: 1px solid var(--hud-green-dim);
    padding: 24px 32px;
    min-width: 360px;
    max-width: 480px;
}

.mp-scoreboard-title {
    font-family: var(--font-display);
    font-size: 1.2em;
    letter-spacing: 6px;
    color: var(--hud-green);
    text-align: center;
    margin-bottom: 16px;
    text-shadow: 0 0 12px rgba(57, 255, 20, 0.3);
}

.mp-scoreboard-header,
.mp-scoreboard-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
}

.mp-scoreboard-header {
    border-bottom: 1px solid var(--hud-green-dim);
    margin-bottom: 4px;
}

.mp-scoreboard-header .mp-sb-name,
.mp-scoreboard-header .mp-sb-stat {
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--hud-green-dim);
}

.mp-sb-name {
    flex: 1;
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--hud-green);
}

.mp-sb-stat {
    width: 50px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--hud-green);
}

.mp-scoreboard-row {
    border-bottom: 1px solid rgba(57, 255, 20, 0.06);
}

.mp-scoreboard-row.mp-local {
    background: rgba(57, 255, 20, 0.08);
}

.mp-scoreboard-row.mp-local .mp-sb-name {
    text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
}
