/* ============================================
   NEON SURVIVOR - Complete Stylesheet
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cyan: #00ffff;
    --cyan-dark: #006688;
    --magenta: #ff00ff;
    --red: #ff0044;
    --gold: #ffdd00;
    --green: #00ff88;
    --purple: #aa00ff;
    --blue: #4488ff;
    --bg-dark: #0a0a1a;
    --bg-panel: rgba(5, 10, 30, 0.92);
    --text: #e0e8ff;
    --text-dim: #6688aa;
    --font-title: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text);
    font-family: var(--font-body);
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}

/* --- Game Container --- */
#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#game-container canvas {
    display: block;
}

/* --- UI Overlay --- */
#ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* --- Screens --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.screen.active {
    display: flex;
    pointer-events: auto;
}

/* --- Menu Content Panel --- */
.menu-content {
    background: var(--bg-panel);
    border: 1px solid var(--cyan-dark);
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    min-width: 380px;
    max-width: 500px;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.1), inset 0 0 40px rgba(0, 255, 255, 0.03);
    animation: fadeIn 0.4s ease-out;
}

.menu-content.wide {
    min-width: 600px;
    max-width: 750px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Title --- */
.game-title {
    font-family: var(--font-title);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.title-neon {
    font-size: 5.5rem;
    color: var(--cyan);
    text-shadow: 0 0 20px var(--cyan), 0 0 60px rgba(0, 255, 255, 0.5), 0 0 120px rgba(0,255,255,0.2);
    animation: titleGlow 3s ease-in-out infinite;
}

.title-survivor {
    font-size: 3.5rem;
    color: var(--magenta);
    text-shadow: 0 0 20px var(--magenta), 0 0 60px rgba(255, 0, 255, 0.5);
    letter-spacing: 12px;
}

.game-title span {
    color: var(--magenta);
    text-shadow: 0 0 20px var(--magenta), 0 0 60px rgba(255, 0, 255, 0.4);
    font-size: 3rem;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1rem;
    margin-top: 10px;
    letter-spacing: 8px;
    font-family: var(--font-title);
    font-weight: 400;
}

/* ============================================
   MODERN MAIN MENU
   ============================================ */
#menu-screen {
    background: linear-gradient(180deg, rgba(2,4,15,0.97) 0%, rgba(5,10,30,0.95) 100%);
    flex-direction: column;
    overflow: hidden;
}

.menu-bg-grid {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    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: 60px 60px;
    animation: gridScroll 15s linear infinite;
    pointer-events: none;
}

/* Animated ambient glow orbs */
.menu-bg-grid::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 15%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,255,0.08) 0%, transparent 70%);
    animation: menuOrb1 8s ease-in-out infinite;
    pointer-events: none;
}

.menu-bg-grid::after {
    content: '';
    position: absolute;
    bottom: 15%;
    right: 10%;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,0,255,0.06) 0%, transparent 70%);
    animation: menuOrb2 10s ease-in-out infinite;
    pointer-events: none;
}

@keyframes menuOrb1 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.6; }
    33% { transform: translate(40px, -30px) scale(1.2); opacity: 1; }
    66% { transform: translate(-20px, 20px) scale(0.9); opacity: 0.4; }
}

@keyframes menuOrb2 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
    50% { transform: translate(-30px, -20px) scale(1.15); opacity: 0.8; }
}

@keyframes gridScroll {
    0% { transform: translateY(0); }
    100% { transform: translateY(60px); }
}

.menu-scanline {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,255,255,0.015) 2px,
        rgba(0,255,255,0.015) 4px
    );
    pointer-events: none;
}

/* Moving scan beam across menu */
.menu-scanline::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0,255,255,0.3), transparent);
    animation: scanBeam 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes scanBeam {
    0% { top: -2%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 102%; opacity: 0; }
}

.menu-layout {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    height: 100%;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 40px 20px;
    gap: 30px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.menu-header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

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

.menu-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.menu-gem-display {
    font-family: var(--font-title);
    font-size: 1.3rem;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255, 221, 0, 0.4);
    letter-spacing: 2px;
    padding: 8px 24px;
    border: 1px solid rgba(255,221,0,0.2);
    border-radius: 20px;
    background: rgba(255,221,0,0.04);
}

.play-btn {
    width: 280px !important;
    padding: 18px 40px !important;
    font-size: 1.4rem !important;
    letter-spacing: 6px !important;
    border-radius: 8px !important;
    position: relative;
    animation: playPulse 2s ease-in-out infinite;
}

@keyframes playPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(0, 255, 255, 0.7), 0 0 60px rgba(255, 0, 255, 0.3);
    }
}

.play-btn::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    z-index: -1;
    opacity: 0.15;
    transition: opacity 0.3s;
    animation: playPulseGlow 2s ease-in-out infinite;
}

@keyframes playPulseGlow {
    0%, 100% {
        opacity: 0.15;
    }
    50% {
        opacity: 0.35;
    }
}

.play-btn:hover::after {
    opacity: 0.5;
    animation: none;
}

.menu-nav-row {
    display: flex;
    gap: 14px;
    margin-top: 8px;
}

.menu-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 24px;
    min-width: 100px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(0,255,255,0.12);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s;
    font-family: var(--font-title);
    color: var(--text-dim);
    position: relative;
}

/* Notification badge dot */
.menu-nav-card .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 8px rgba(255,0,68,0.6);
    animation: badgePulse 1.5s ease-in-out infinite;
    display: none;
}

.menu-nav-card .badge-dot.visible {
    display: block;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 8px rgba(255,0,68,0.6); }
    50% { transform: scale(1.2); box-shadow: 0 0 14px rgba(255,0,68,0.9); }
}

.menu-nav-card:hover {
    background: rgba(0,255,255,0.06);
    border-color: rgba(0,255,255,0.35);
    color: var(--cyan);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,255,255,0.12);
}

.nav-icon {
    font-size: 1.8rem;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.menu-footer {
    animation: fadeIn 0.8s ease-out 0.4s both;
}

/* Settings corner button (menu screen) — positioned relative to #menu-screen */
.menu-settings-corner {
    position: fixed;
    bottom: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 255, 0.2);
    background: rgba(2, 4, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    z-index: 20;
}
.menu-settings-corner:hover {
    border-color: var(--cyan);
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 14px rgba(0, 255, 255, 0.25);
    transform: rotate(45deg);
}

.controls-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
}

.control-key {
    font-size: 0.75rem;
    color: var(--text-dim);
    opacity: 0.6;
}

/* ============================================
   OVERLAY SCREENS (Game Over, Pause, etc.)
   ============================================ */
.overlay-backdrop {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(2, 4, 15, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay-backdrop.gameover-bg {
    background: radial-gradient(ellipse at center top, rgba(80, 0, 20, 0.5) 0%, rgba(2, 4, 15, 0.92) 70%);
}

.overlay-layout {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    height: 100%;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    padding: 20px;
    gap: 12px;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.overlay-layout::-webkit-scrollbar {
    width: 8px;
}

.overlay-layout::-webkit-scrollbar-track {
    background: rgba(0, 255, 255, 0.05);
}

.overlay-layout::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.3);
    border-radius: 4px;
}

.overlay-layout::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.5);
}

.overlay-icon {
    font-size: 3rem;
    opacity: 0.7;
    animation: fadeInDown 0.6s ease-out;
}

.overlay-title {
    font-family: var(--font-title);
    font-size: 2.2rem;
    color: var(--cyan);
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    letter-spacing: 4px;
    margin: 0;
    animation: fadeInDown 0.6s ease-out;
}

.overlay-title.upgrade-glow {
    color: var(--green);
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.overlay-subtitle {
    color: var(--text-dim);
    font-size: 0.95rem;
    letter-spacing: 2px;
}

/* ── Upgrade Selection Screen ── */
#upgrade-choices {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
    margin: 20px 0;
    justify-content: center;
}

/* Rarity tier styles for wave upgrade cards */
.upgrade-rarity-tag {
    font-family: var(--font-title);
    font-size: 0.55rem;
    letter-spacing: 2px;
    margin-bottom: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

#upgrade-screen .upgrade-card.rarity-common {
    border-color: rgba(0, 255, 255, 0.2);
    background: rgba(0, 255, 255, 0.04);
}
#upgrade-screen .upgrade-card.rarity-common .upgrade-rarity-tag {
    color: var(--cyan);
    background: rgba(0, 255, 255, 0.1);
}

#upgrade-screen .upgrade-card.rarity-uncommon {
    border-color: rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.05);
}
#upgrade-screen .upgrade-card.rarity-uncommon .upgrade-rarity-tag {
    color: var(--green);
    background: rgba(0, 255, 136, 0.15);
}
#upgrade-screen .upgrade-card.rarity-uncommon .upgrade-name {
    color: var(--green);
}

#upgrade-screen .upgrade-card.rarity-rare {
    border-color: rgba(255, 221, 0, 0.35);
    background: rgba(255, 221, 0, 0.06);
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.1);
}
#upgrade-screen .upgrade-card.rarity-rare .upgrade-rarity-tag {
    color: var(--gold);
    background: rgba(255, 221, 0, 0.15);
}
#upgrade-screen .upgrade-card.rarity-rare .upgrade-name {
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 221, 0, 0.3);
}

.upgrade-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
}

#btn-upgrade-reroll,
#btn-upgrade-skip {
    flex: 1;
    max-width: 160px;
    padding: 12px 16px !important;
    font-size: 0.85rem;
}

.upgrade-meta {
    font-size: 0.8rem;
    color: rgba(0, 255, 255, 0.5);
    margin-top: 12px;
    text-align: center;
    letter-spacing: 1px;
}

#btn-upgrade-reroll:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.1) !important;
}

.overlay-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    margin-top: 6px;
}

/* --- Game Over Screen --- */
.gameover-title {
    font-family: var(--font-title);
    font-weight: 900;
    font-size: 4rem !important;
    color: var(--red) !important;
    text-shadow: 0 0 30px var(--red), 0 0 80px rgba(255, 0, 68, 0.4) !important;
    letter-spacing: 6px;
    animation: gameoverPulse 2s ease-in-out infinite, fadeInDown 0.6s ease-out;
}

@keyframes gameoverPulse {
    0%, 100% { text-shadow: 0 0 30px var(--red), 0 0 80px rgba(255, 0, 68, 0.3); }
    50% { text-shadow: 0 0 40px var(--red), 0 0 100px rgba(255, 0, 68, 0.5), 0 0 150px rgba(255 ,0, 68, 0.15); }
}

#final-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 8px 0;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    min-width: 110px;
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 255, 0.1);
    border-radius: 10px;
    transition: border-color 0.3s;
}

.stat-card.highlight {
    border-color: rgba(255, 221, 0, 0.25);
    background: rgba(255, 221, 0, 0.04);
}

.stat-card.gem {
    border-color: rgba(255, 221, 0, 0.2);
    background: rgba(255, 221, 0, 0.03);
}

.stat-card-label {
    font-family: var(--font-title);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.stat-card-value {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text);
}

.stat-card.highlight .stat-card-value {
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255, 221, 0, 0.4);
}

.stat-card.gem .stat-card-value {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 221, 0, 0.3);
}

/* --- Pause Screen --- */
#pause-screen .overlay-layout {
    gap: 20px;
}

#pause-screen .overlay-icon {
    font-size: 4rem;
    opacity: 0.5;
}

/* --- Name Input (game over) --- */
#name-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    max-width: 360px;
    animation: fadeIn 0.6s ease-out 0.3s both;
}

#player-name {
    flex: 1;
    padding: 12px 15px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.25);
    border-radius: 8px;
    color: var(--cyan);
    font-family: var(--font-title);
    font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
    outline: none;
    letter-spacing: 2px;
    height: 44px;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-user-select: text;
    user-select: text;
}

#player-name::placeholder {
    color: rgba(0, 255, 255, 0.25);
}

#player-name:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
}

/* --- Leaderboard (overlay) --- */
#leaderboard-screen .overlay-layout {
    max-width: 550px;
}

#leaderboard-list {
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin-bottom: 10px;
    animation: fadeIn 0.5s ease-out 0.2s both;
}

/* --- Shop (overlay) --- */
#shop-screen .overlay-layout {
    max-width: 700px;
}

.shop-balance {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--gold);
    text-shadow: 0 0 12px rgba(255, 221, 0, 0.4);
    letter-spacing: 2px;
    padding: 6px 22px;
    border: 1px solid rgba(255, 221, 0, 0.15);
    border-radius: 20px;
    background: rgba(255, 221, 0, 0.04);
}

#shop-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin-bottom: 10px;
    padding: 5px;
    animation: fadeIn 0.5s ease-out 0.2s both;
}

/* --- Achievements (overlay) --- */
#achievements-screen .overlay-layout {
    max-width: 600px;
}

.achieve-panel {
    width: 100%;
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    margin-bottom: 10px;
    animation: fadeIn 0.5s ease-out 0.1s both;
}

/* --- Upgrade (overlay) --- */
#upgrade-screen .overlay-layout {
    gap: 16px;
    max-width: 720px;
    justify-content: center;
}

h2 {
    font-family: var(--font-title);
    font-size: 2rem;
    color: var(--cyan);
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

/* --- Buttons --- */
.neon-btn {
    display: block;
    width: 100%;
    padding: 14px 30px;
    margin: 10px 0;
    border: none;
    border-radius: 6px;
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.neon-btn.primary {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.15), rgba(0, 255, 255, 0.05));
    color: var(--cyan);
    border: 2px solid var(--cyan);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2), inset 0 0 15px rgba(0, 255, 255, 0.05);
}

.neon-btn.primary:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 255, 255, 0.1));
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.4), inset 0 0 20px rgba(0, 255, 255, 0.1);
    transform: translateY(-2px);
}

.neon-btn.secondary {
    background: linear-gradient(135deg, rgba(170, 0, 255, 0.1), rgba(170, 0, 255, 0.03));
    color: var(--purple);
    border: 1px solid rgba(170, 0, 255, 0.4);
    box-shadow: 0 0 10px rgba(170, 0, 255, 0.1);
}

.neon-btn.secondary:hover {
    background: linear-gradient(135deg, rgba(170, 0, 255, 0.2), rgba(170, 0, 255, 0.08));
    box-shadow: 0 0 20px rgba(170, 0, 255, 0.3);
    transform: translateY(-2px);
}

.neon-btn.small {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 700;
    height: 44px;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15), rgba(0, 255, 136, 0.05));
    color: var(--green);
    border: 1px solid var(--green);
}

.neon-btn:active {
    transform: translateY(1px) !important;
}

.neon-btn:focus {
    outline: none;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.6), inset 0 0 20px rgba(0, 255, 255, 0.1);
}

.neon-btn.primary:focus {
    box-shadow: 0 0 35px rgba(0, 255, 255, 0.8), inset 0 0 25px rgba(0, 255, 255, 0.15);
}

.neon-btn.secondary:focus {
    box-shadow: 0 0 30px rgba(170, 0, 255, 0.6), inset 0 0 20px rgba(170, 0, 255, 0.1);
}

/* Keyboard-only focus styles (avoid showing on mouse/touch) */
button:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}

.neon-btn:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 2px;
}

/* --- Controls Info (old, kept for compatibility) --- */
.controls-info {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 255, 255, 0.15);
    display: none; /* hidden — using new .controls-grid */
}

.control-row {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 6px 0;
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 4px;
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--cyan);
    margin-right: 5px;
}

/* --- HUD --- */
#hud-screen {
    pointer-events: none;
}

#hud-screen.active {
    pointer-events: none;
}

#hud-top-left {
    position: absolute;
    top: 20px;
    left: 25px;
    background: rgba(2, 4, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.08);
}

#hud-score {
    display: flex;
    flex-direction: column;
}

#hud-combo {
    margin-top: 5px;
}

.hud-label {
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 3px;
}

.hud-value {
    font-family: var(--font-title);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.combo-text {
    font-family: var(--font-title);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 221, 0, 0.5);
    transition: all 0.15s;
}

.combo-text.active {
    transform: scale(1.3);
    color: var(--red);
    text-shadow: 0 0 20px rgba(255, 0, 68, 0.8);
}

#hud-top-center {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(2, 4, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 255, 0.08);
}

.hud-small {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* --- Health Bar --- */
#hud-bottom {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(2, 4, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(0, 255, 255, 0.08);
}

#health-bar-container {
    position: relative;
    width: 300px;
    text-align: center;
}

#health-bar-bg {
    width: 100%;
    height: 14px;
    background: rgba(255, 0, 68, 0.15);
    border: 1px solid rgba(255, 0, 68, 0.3);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

#health-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--red), #ff4466);
    box-shadow: 0 0 10px rgba(255, 0, 68, 0.5);
    border-radius: 7px;
    transition: width 0.3s ease;
}

#shield-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(68, 136, 255, 0.6), rgba(68, 136, 255, 0.8));
    box-shadow: 0 0 10px rgba(68, 136, 255, 0.5);
    border-radius: 7px;
    transition: width 0.3s ease;
}

#health-text {
    display: block;
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
    letter-spacing: 1px;
}

/* --- Dash Bar --- */
#dash-indicator {
    width: 100px;
    text-align: center;
}

#dash-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

#dash-bar {
    height: 100%;
    width: 100%;
    background: var(--cyan);
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
    border-radius: 4px;
    transition: width 0.1s linear;
}

#dash-text {
    display: block;
    font-family: var(--font-title);
    font-size: 0.6rem;
    color: var(--cyan);
    margin-top: 3px;
    letter-spacing: 2px;
}

/* --- Ultimate Bar --- */
#ultimate-indicator {
    width: 100px;
    text-align: center;
}

#ultimate-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(170, 0, 255, 0.1);
    border: 1px solid rgba(170, 0, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

#ultimate-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--purple), #ff00ff);
    box-shadow: 0 0 8px rgba(170, 0, 255, 0.5);
    border-radius: 4px;
    transition: width 0.3s ease;
}

#ultimate-bar.ready {
    background: linear-gradient(90deg, #ff00ff, #ffaa00);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.6);
    animation: ultimatePulse 0.8s ease-in-out infinite;
}

@keyframes ultimatePulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 0, 255, 0.4); }
    50% { box-shadow: 0 0 20px rgba(255, 0, 255, 0.8), 0 0 40px rgba(255, 0, 255, 0.3); }
}

#ultimate-text {
    display: block;
    font-family: var(--font-title);
    font-size: 0.6rem;
    color: var(--purple);
    margin-top: 3px;
    letter-spacing: 2px;
}

#ultimate-text.ready {
    color: #ff00ff;
    animation: ultimateTextPulse 0.8s ease-in-out infinite;
}

/* --- Keybind hints (PC only) --- */
.keybind-hint {
    display: block;
    font-family: var(--font-title);
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
    margin-top: 1px;
}

/* ============================================
   SETTINGS SCREEN
   ============================================ */
.settings-group {
    width: 100%;
    max-width: 400px;
    text-align: left;
    margin-bottom: 10px;
}
.settings-label {
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}
.settings-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.settings-option {
    flex: 1;
    min-width: 70px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 255, 255, 0.03);
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.settings-option:hover {
    border-color: var(--cyan);
    color: var(--text);
}
.settings-option.active {
    border-color: var(--cyan);
    background: rgba(0, 255, 255, 0.12);
    color: var(--cyan);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.15);
}
.settings-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(0, 255, 255, 0.12);
    outline: none;
}
.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cyan);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
}

/* ── Credits Section ── */
.credits-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 255, 255, 0.1);
    text-align: center;
    opacity: 0.5;
    transition: opacity 0.3s;
}
.credits-section:hover { opacity: 0.8; }
.credits-text {
    font-size: 0.75rem;
    color: #8892b0;
    margin: 0 0 4px;
    letter-spacing: 0.5px;
}
.credits-tech {
    font-size: 0.65rem;
    color: #4a5080;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ============================================
   TOOLTIPS — First Launch
   ============================================ */
.tooltips-backdrop {
    background: rgba(2, 4, 15, 0.96) !important;
}

.tooltips-layout {
    gap: 20px !important;
    background: linear-gradient(135deg, rgba(5, 10, 40, 0.95) 0%, rgba(15, 5, 35, 0.85) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 20px;
    padding: 36px 32px !important;
    max-width: 900px !important;
    max-height: 90vh !important;
    height: auto !important;
    margin: 5vh auto !important;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.15), inset 0 0 30px rgba(0, 255, 255, 0.05);
    animation: slideUp 0.5s ease-out !important;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.tooltips-title {
    animation: fadeInDown 0.6s ease-out;
    margin-bottom: 4px !important;
    gap: 2px !important;
}

.tooltips-title .title-neon {
    font-size: 3.5rem;
}

.tooltips-title .title-survivor {
    font-size: 2.2rem;
}

.tooltips-layout .tooltips-welcome {
    font-size: 2rem !important;
    color: rgba(0, 255, 255, 0.8) !important;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.4) !important;
    margin: 0 !important;
    animation: fadeInDown 0.7s ease-out 0.1s both !important;
    font-weight: 600;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
    letter-spacing: initial !important;
}

.tooltips-layout .overlay-title {
    font-size: 2.8rem;
    letter-spacing: 6px;
    margin-bottom: 12px;
    animation: fadeInDown 0.7s ease-out;
    background: linear-gradient(90deg, var(--cyan) 0%, rgba(0, 255, 255, 0.6) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.tooltips-layout .tooltips-goal {
    color: rgba(200, 220, 255, 0.8);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    margin: 2px 0 0 0 !important;
    letter-spacing: 1px;
    animation: fadeInDown 0.8s ease-out 0.1s both;
}

.tooltips-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    width: 100%;
    animation: fadeIn 0.8s ease-out 0.2s both;
}

.tooltip-card:nth-child(5) {
    grid-column: 1 / -1;
    justify-content: center;
}

.tooltip-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.08) 0%, rgba(100, 0, 150, 0.04) 100%);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tooltip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.tooltip-card:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.15) 0%, rgba(100, 0, 150, 0.08) 100%);
    border-color: rgba(0, 255, 255, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 200, 255, 0.15);
}

.tooltip-card:hover::before {
    left: 100%;
}

.tooltip-card span:first-child {
    position: relative;
    z-index: 1;
}

.tooltip-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(0, 255, 255, 0.3));
}

.tooltip-card:nth-child(5) .tooltip-icon {
    margin-bottom: 0;
}

.tooltip-card span:not(.tooltip-icon) {
    line-height: 1.5;
    color: rgba(220, 235, 255, 0.85);
}

.tooltip-card b {
    color: var(--cyan);
    font-weight: 600;
}

/* Button styling for tooltips */
#btn-tooltips-ok {
    margin-top: 8px;
    animation: fadeInUp 0.8s ease-out 0.3s both;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.3) 0%, rgba(100, 200, 255, 0.2) 100%);
    border: 2px solid var(--cyan);
    font-size: 1.1rem;
    padding: 14px 32px;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.2);
}

#btn-tooltips-ok:hover {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.5) 0%, rgba(100, 200, 255, 0.35) 100%);
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.4), inset 0 0 15px rgba(0, 255, 255, 0.2);
    transform: scaleY(1.05);
}

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

/* ============================================
   COLORBLIND FILTERS
   ============================================ */
html.cb-deuteranopia #game-container canvas,
html.cb-deuteranopia #ui-overlay {
    filter: sepia(0.4) saturate(1.6) hue-rotate(-30deg);
}
html.cb-protanopia #game-container canvas,
html.cb-protanopia #ui-overlay {
    filter: sepia(0.3) saturate(1.4) hue-rotate(20deg);
}
html.cb-tritanopia #game-container canvas,
html.cb-tritanopia #ui-overlay {
    filter: sepia(0.3) saturate(1.8) hue-rotate(-60deg) brightness(1.05);
}

/* ============================================
   MENU TRANSITION ANIMATIONS
   ============================================ */
.screen {
    transition: opacity 0.3s ease;
    opacity: 0;
}
.screen.active {
    opacity: 1;
    animation: screenFadeIn 0.35s ease-out;
}
@keyframes screenFadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to   { opacity: 1; transform: scale(1); }
}
.overlay-layout {
    animation: overlaySlideIn 0.35s ease-out !important;
}
@keyframes overlaySlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ACHIEVEMENT PROGRESS BARS
   ============================================ */
.achieve-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.achieve-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--green));
    border-radius: 2px;
    transition: width 0.4s ease;
}
.achieve-progress-text {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ============================================
   POST-MORTEM STATS
   ============================================ */
/* Post-mortem toggle button */
.postmortem-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 480px;
    padding: 8px 12px;
    margin-top: 6px;
    border: 1px solid rgba(0, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(0, 255, 255, 0.03);
    color: var(--text-dim);
    font-family: var(--font-title);
    font-size: 0.7rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.25s;
}
.postmortem-toggle:hover {
    border-color: var(--cyan);
    color: var(--text);
    background: rgba(0, 255, 255, 0.08);
}
.postmortem-toggle .toggle-arrow {
    transition: transform 0.3s;
}
.postmortem-toggle.open .toggle-arrow {
    transform: rotate(180deg);
}
.postmortem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 480px;
    margin-top: 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
}
.postmortem-grid.open {
    max-height: 400px;
    opacity: 1;
}
.postmortem-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    background: rgba(0, 255, 255, 0.03);
    border: 1px solid rgba(0, 255, 255, 0.08);
    border-radius: 6px;
    gap: 2px;
}
.postmortem-label {
    font-size: 0.55rem;
    font-family: var(--font-title);
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
}
.postmortem-value {
    font-size: 1rem;
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--text);
}

/* Hide keybind hints on mobile/touch devices */
@media (hover: none) and (pointer: coarse) {
    .keybind-hint.pc-only { display: none; }
    #hud-bottom { display: none !important; }
    /* Hide detailed stats button on mobile */
    .hud-mini-btn { display: none !important; }
    #quick-stats-panel { display: none !important; }
}

@keyframes ultimateTextPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; text-shadow: 0 0 10px rgba(255, 0, 255, 0.5); }
}

/* --- Quick Stats Button & Panel --- */
.hud-mini-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    background: rgba(2, 4, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.hud-mini-btn:hover {
    border-color: var(--cyan);
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
}

#quick-stats-panel {
    position: absolute;
    top: 70px;
    right: 25px;
    width: 240px;
    background: rgba(2, 4, 15, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 12px;
    padding: 14px;
    pointer-events: all;
    z-index: 5;
    animation: fadeIn 0.2s ease-out;
}

#quick-stats-panel.hidden {
    display: none;
}

.quick-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.1);
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--cyan);
    letter-spacing: 2px;
}

.quick-stats-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.quick-stats-close:hover {
    color: var(--red);
    background: rgba(255, 0, 68, 0.1);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.78rem;
}

.stat-row-label {
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.stat-row-value {
    font-family: var(--font-title);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 1px;
}

.stat-row-value.highlight-green { color: var(--green); }
.stat-row-value.highlight-gold { color: var(--gold); }
.stat-row-value.highlight-cyan { color: var(--cyan); }
.stat-row-value.highlight-red { color: var(--red); }

/* --- Save Indicator --- */
.save-indicator {
    position: absolute;
    bottom: 80px;
    right: 25px;
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--green);
    letter-spacing: 2px;
    background: rgba(2, 4, 15, 0.7);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 136, 0.2);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s;
}

.save-indicator.hidden {
    opacity: 0;
}

/* --- Player World HP Bar (follows character in 3D) --- */
.player-world-hp {
    position: fixed;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 5;
    transform: translate(-50%, 0);
    opacity: 0.9;
    transition: opacity 0.3s;
}

.player-world-hp.hidden {
    opacity: 0;
}

.world-hp-bar-bg {
    width: 52px;
    height: 5px;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
}

.world-hp-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff2255, #ff4466);
    border-radius: 3px 0 0 3px;
    transition: width 0.2s ease;
    z-index: 1;
}

.world-shield-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(0, 255, 255, 0.7), rgba(0, 200, 255, 0.5));
    border-radius: 3px 0 0 3px;
    transition: width 0.2s ease;
    z-index: 2;
}

/* --- Wave Announce --- */
#wave-announce {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    transition: opacity 0.5s;
}

#wave-announce.hidden {
    opacity: 0;
    pointer-events: none;
}

#wave-announce.visible {
    opacity: 1;
    animation: waveAnnounce 0.5s ease-out;
}

#wave-announce-text {
    display: block;
    font-family: var(--font-title);
    font-size: 3rem;
    font-weight: 900;
    color: var(--cyan);
    text-shadow: 0 0 30px var(--cyan), 0 0 80px rgba(0, 255, 255, 0.3);
    letter-spacing: 6px;
}

#wave-announce-sub {
    display: block;
    font-size: 1rem;
    color: var(--text-dim);
    letter-spacing: 4px;
    margin-top: 5px;
}

@keyframes waveAnnounce {
    from { transform: scale(2); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* --- Leaderboard Entries --- */
.lb-entry {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.08);
    transition: background 0.2s;
}

.lb-entry:hover {
    background: rgba(0, 255, 255, 0.05);
}

.lb-rank {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    width: 40px;
    color: var(--text-dim);
}

.lb-rank.gold { color: var(--gold); }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-name {
    flex: 1;
    font-size: 1rem;
    color: var(--text);
    text-align: left;
    margin-left: 10px;
}

.lb-score {
    font-family: var(--font-title);
    font-weight: 700;
    color: var(--cyan);
    font-size: 1rem;
}

.lb-wave {
    font-size: 0.8rem;
    color: var(--text-dim);
    width: 60px;
    text-align: right;
}

.lb-empty {
    padding: 30px;
    color: var(--text-dim);
    font-style: italic;
}

/* --- Upgrade Screen (wave selection cards) --- */
#upgrade-screen #upgrade-choices {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

#upgrade-screen .upgrade-card {
    background: rgba(0, 255, 255, 0.04);
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 10px;
    padding: 25px 20px;
    width: 180px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
    flex-direction: column;
    display: flex;
    align-items: center;
}

#upgrade-screen .upgrade-card:hover {
    background: rgba(0, 255, 255, 0.12);
    border-color: var(--cyan);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.2);
    transform: translateY(-5px);
}

#upgrade-screen .upgrade-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

#upgrade-screen .upgrade-name {
    font-family: var(--font-title);
    font-size: 0.9rem;
    color: var(--cyan);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

#upgrade-screen .upgrade-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.3;
}

/* Upgrade progression dots */
.upgrade-dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.upgrade-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s;
}

.upgrade-dot.filled {
    border-color: transparent;
}
.upgrade-dot.filled.rarity-common {
    background: var(--cyan);
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.5);
}
.upgrade-dot.filled.rarity-uncommon {
    background: var(--green);
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.5);
}
.upgrade-dot.filled.rarity-rare {
    background: var(--gold);
    box-shadow: 0 0 6px rgba(255, 221, 0, 0.5);
}

.upgrade-pick-count {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: rgba(0, 255, 255, 0.6);
    letter-spacing: 1px;
    text-align: center;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.3);
    border-radius: 3px;
}

/* --- Screen Shake --- */
.shake {
    animation: shake 0.15s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(0); }
    25% { transform: translate(-4px, 2px); }
    50% { transform: translate(3px, -3px); }
    75% { transform: translate(-2px, 4px); }
}

/* --- Damage Flash --- */
.damage-flash {
    animation: damageFlash 0.2s ease-out;
}

@keyframes damageFlash {
    0% { box-shadow: inset 0 0 100px rgba(255, 0, 68, 0.4); }
    100% { box-shadow: none; }
}

/* --- Loading --- */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.loading-text {
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--cyan);
    animation: pulse 1.5s infinite;
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
    .title-neon {
        font-size: 3rem;
    }

    .title-survivor {
        font-size: 2rem;
    }

    .game-title span {
        font-size: 2rem;
    }

    .menu-content {
        padding: 25px 30px;
        min-width: 280px;
        max-width: 90vw;
    }

    .menu-content.wide {
        min-width: 300px;
        max-width: 95vw;
    }

    h2 {
        font-size: 1.5rem;
    }

    .neon-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
        min-height: 44px;
    }

    #upgrade-choices {
        flex-direction: column;
        align-items: center;
    }

    #upgrade-screen .upgrade-card,
    .upgrade-card {
        width: 90%;
        max-width: 300px;
        padding: 16px 14px;
    }

    .upgrade-dots {
        gap: 4px;
        margin-top: 8px;
        padding-top: 6px;
    }

    .upgrade-dot {
        width: 7px;
        height: 7px;
    }

    #health-bar-container {
        width: 200px;
    }

    #hud-top-left {
        top: 10px;
        left: 12px;
        padding: 8px 10px;
    }

    .hud-value {
        font-size: 1.4rem;
    }

    .combo-text {
        font-size: 1.1rem;
    }

    #hud-bottom {
        bottom: 100px;
        flex-direction: column;
        gap: 8px;
    }

    .controls-grid {
        display: none;
    }

    #final-stats {
        gap: 8px;
    }

    .stat-card {
        padding: 10px 14px;
        min-width: 90px;
    }

    .stat-card-value {
        font-size: 1.2rem;
    }

    .gameover-title {
        font-size: 2.5rem !important;
    }

    .overlay-layout {
        padding: 30px 16px;
    }

    .subtitle {
        font-size: 0.8rem;
        letter-spacing: 4px;
    }

    .menu-nav-row {
        gap: 10px;
    }

    .menu-nav-card {
        padding: 12px 16px;
        min-width: 80px;
    }

    .play-btn {
        width: 240px !important;
        font-size: 1.2rem !important;
    }
}

/* ============================================
   MOBILE TOUCH CONTROLS
   ============================================ */
#mobile-controls {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9;
    pointer-events: none;
    display: none;
}

#mobile-controls.visible {
    display: block;
}

#joystick-zone {
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    pointer-events: auto;
    touch-action: none;
}

#joystick-base {
    display: none;
    position: absolute;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.10);
    border: 2px solid rgba(0, 255, 255, 0.25);
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#joystick-knob {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.6), rgba(0, 255, 255, 0.2));
    border: 2px solid rgba(0, 255, 255, 0.7);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
    transition: transform 0.05s linear;
}

/* Auto-aim indicator — shown on nearest enemy */
#auto-aim-indicator {
    position: fixed;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 16;
    transform: translate(-50%, -50%);
    transition: left 0.08s linear, top 0.08s linear;
}

#auto-aim-indicator.hidden {
    display: none;
}

#auto-aim-indicator .aim-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(255, 50, 50, 0.7);
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.4), inset 0 0 8px rgba(255, 50, 50, 0.15);
    animation: aimRingPulse 0.8s ease-in-out infinite;
}

@keyframes aimRingPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

/* Mobile ability buttons — circular with SVG ring progress */
#mobile-ability-buttons {
    position: absolute;
    bottom: max(80px, calc(env(safe-area-inset-bottom, 10px) + 70px));
    right: max(16px, env(safe-area-inset-right, 10px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
    z-index: 17;
    align-items: flex-end;
}

/* Shared ability button base */
.ability-btn {
    position: relative;
    pointer-events: auto;
    border-radius: 50%;
    border: none;
    background: rgba(10, 10, 30, 0.6);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ability-btn .ability-icon {
    position: relative;
    z-index: 2;
    line-height: 1;
    filter: drop-shadow(0 0 4px currentColor);
}

/* SVG ring overlay */
.ability-ring {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
    z-index: 1;
}
.ability-ring .ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 4;
}
.ability-ring .ring-fill {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.12s linear;
}

/* --- Dash button --- */
#mobile-dash-btn {
    width: 76px;
    height: 76px;
    color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.15), inset 0 0 10px rgba(0, 255, 255, 0.05);
    margin-right: 8px;
}
#mobile-dash-btn .ability-icon { font-size: 1.6rem; }
#mobile-dash-btn .ring-fill { stroke: var(--cyan); }
#mobile-dash-btn.ready {
    box-shadow: 0 0 22px rgba(0, 255, 255, 0.5);
    animation: dashBtnPulse 1s ease-in-out infinite;
}
#mobile-dash-btn:active {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.5);
}

@keyframes dashBtnPulse {
    0%, 100% { box-shadow: 0 0 14px rgba(0, 255, 255, 0.25); transform: scale(1); }
    50% { box-shadow: 0 0 28px rgba(0, 255, 255, 0.6); transform: scale(1.08); }
}

/* --- Ultimate button (larger) --- */
#mobile-ultimate-btn {
    width: 90px;
    height: 90px;
    color: var(--purple);
    box-shadow: 0 0 12px rgba(170, 0, 255, 0.15), inset 0 0 10px rgba(170, 0, 255, 0.05);
    opacity: 0.5;
    transition: opacity 0.3s, box-shadow 0.3s;
}
#mobile-ultimate-btn .ability-icon { font-size: 2rem; }
#mobile-ultimate-btn .ring-fill { stroke: var(--purple); }

#mobile-ultimate-btn.ready {
    opacity: 1;
    box-shadow: 0 0 28px rgba(255, 0, 255, 0.5), inset 0 0 14px rgba(255, 0, 255, 0.12);
    animation: ultimateBtnPulse 1.2s ease-in-out infinite;
}

@keyframes ultimateBtnPulse {
    0%, 100% { box-shadow: 0 0 18px rgba(255, 0, 255, 0.35), inset 0 0 8px rgba(255, 0, 255, 0.05); transform: scale(1); }
    50% { box-shadow: 0 0 35px rgba(255, 0, 255, 0.65), inset 0 0 16px rgba(255, 0, 255, 0.12); transform: scale(1.1); }
}

#mobile-ultimate-btn:active {
    background: rgba(170, 0, 255, 0.25);
    box-shadow: 0 0 25px rgba(170, 0, 255, 0.5);
}

#mobile-pause-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    padding: 8px 12px;
    touch-action: manipulation;
    z-index: 10;
}

/* Hide mobile controls on desktop */
@media (hover: hover) and (pointer: fine) {
    #mobile-controls {
        display: none !important;
    }
}

/* ============================================
   FLOATING TEXT / FEEDBACK
   ============================================ */
#floating-texts {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
    overflow: hidden;
}

.floating-text {
    position: absolute;
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    text-shadow: 0 0 8px currentColor, 0 2px 6px rgba(0,0,0,0.6);
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: none;
    pointer-events: none;
    white-space: nowrap;
    z-index: 21;
}

.floating-text.big {
    font-size: 1.6rem;
}

.floating-text.animate {
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    30% {
        opacity: 1;
        transform: translateY(-30px) scale(1.15);
    }
    100% {
        opacity: 0;
        transform: translateY(-80px) scale(0.7);
    }
}

/* Damage vignette */
#damage-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 18;
    opacity: 0;
    transition: opacity 0.3s;
}

#damage-vignette.low-health {
    background: radial-gradient(ellipse at center, transparent 50%, rgba(255, 0, 30, 0.35) 100%);
}

/* Kill flash */
#kill-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 17;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.08s;
}

#kill-flash.active {
    opacity: 1;
}

/* Powerup announce text */
.powerup-announce {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%) scale(0.5);
    font-family: var(--font-title);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--green);
    text-shadow: 0 0 15px currentColor, 0 0 40px rgba(0, 255, 136, 0.3);
    letter-spacing: 3px;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
}

.powerup-announce.animate {
    animation: powerupPop 1.8s ease-out forwards;
}

@keyframes powerupPop {
    0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
    15% { opacity: 1; transform: translateX(-50%) scale(1.15); }
    30% { opacity: 1; transform: translateX(-50%) scale(1); }
    70% { opacity: 1; transform: translateX(-50%) translateY(-15px) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px) scale(0.8); }
}

/* No-hit bonus */
.nohit-bonus {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%) scale(0.5);
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 15px var(--gold), 0 0 40px rgba(255, 221, 0, 0.3);
    letter-spacing: 2px;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
}

.nohit-bonus.animate {
    animation: powerupPop 2.2s ease-out forwards;
}

/* ============================================
   GEM SYSTEM
   ============================================ */

#hud-gems {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.gem-icon {
    font-size: 1rem;
}

.hud-gem-value {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 221, 0, 0.3);
    transition: transform 0.2s;
}

.hud-gem-value.gem-pulse {
    animation: gemPulse 0.5s ease-out;
}

@keyframes gemPulse {
    0% { transform: scale(1); color: var(--gold); }
    30% { transform: scale(1.6); color: #fff; text-shadow: 0 0 20px var(--gold); }
    100% { transform: scale(1); color: var(--gold); }
}

.gem-color {
    color: var(--gold) !important;
    text-shadow: 0 0 10px rgba(255, 221, 0, 0.4);
}

.gem-announce {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translateX(-50%) scale(0.5);
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 20px var(--gold), 0 0 50px rgba(255, 221, 0, 0.3);
    letter-spacing: 3px;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
}

.gem-announce.animate {
    animation: powerupPop 2s ease-out forwards;
}

/* ============================================
   REVIVE
   ============================================ */
.neon-btn.revive {
    background: linear-gradient(135deg, rgba(255,221,0,0.15), rgba(255,221,0,0.05));
    color: var(--gold);
    border: 2px solid var(--gold);
    box-shadow: 0 0 15px rgba(255,221,0,0.2), inset 0 0 15px rgba(255,221,0,0.05);
    animation: reviveGlow 1.5s ease-in-out infinite;
}

.neon-btn.revive:hover {
    background: linear-gradient(135deg, rgba(255,221,0,0.3), rgba(255,221,0,0.1));
    box-shadow: 0 0 25px rgba(255,221,0,0.4), inset 0 0 20px rgba(255,221,0,0.1);
    transform: translateY(-2px);
}

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

.revive-flash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 25;
    background: radial-gradient(ellipse at center, rgba(255,221,0,0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.revive-flash.active {
    animation: reviveFlashAnim 1.5s ease-out forwards;
}

@keyframes reviveFlashAnim {
    0% { opacity: 1; }
    30% { opacity: 0.8; }
    100% { opacity: 0; }
}

.ultimate-flash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 25;
    background: radial-gradient(ellipse at center, rgba(170, 0, 255, 0.5) 0%, rgba(255, 0, 255, 0.2) 40%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.ultimate-flash.active {
    animation: ultimateFlashAnim 1.2s ease-out forwards;
}

@keyframes ultimateFlashAnim {
    0% { opacity: 1; }
    20% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* ── Nuke Flash ── */
.nuke-flash {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 25;
    background: radial-gradient(ellipse at center, rgba(255, 68, 0, 0.6) 0%, rgba(255, 150, 0, 0.3) 35%, rgba(255, 0, 0, 0.1) 60%, transparent 80%);
    opacity: 0;
    transition: opacity 0.2s;
}

.nuke-flash.active {
    animation: nukeFlashAnim 0.8s ease-out forwards;
}

@keyframes nukeFlashAnim {
    0% { opacity: 1; background: radial-gradient(ellipse at center, rgba(255, 255, 200, 0.8) 0%, rgba(255, 100, 0, 0.5) 30%, rgba(255, 0, 0, 0.2) 60%, transparent 80%); }
    15% { opacity: 0.9; }
    100% { opacity: 0; }
}

/* ── Daily Login Streak Toast ── */
.streak-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(255,140,0,0.25), rgba(255,60,0,0.18));
    border: 1px solid rgba(255,160,0,0.5);
    border-radius: 14px;
    padding: 14px 24px;
    z-index: 500;
    backdrop-filter: blur(14px);
    box-shadow: 0 0 30px rgba(255,120,0,0.3);
    transition: transform 0.5s cubic-bezier(.22,1.2,.36,1), opacity 0.5s;
    opacity: 0;
    pointer-events: none;
}
.streak-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.streak-toast-icon {
    font-size: 2rem;
    animation: streakIconPulse 1s ease-in-out infinite;
}
.streak-toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.streak-toast-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: #ffcc66;
    letter-spacing: 0.5px;
}
.streak-toast-reward {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 900;
    color: #ffdd00;
    text-shadow: 0 0 12px rgba(255,200,0,0.6);
}
@keyframes streakIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.25); }
}

/* ============================================
   SHOP CARDS
   ============================================ */
.shop-card {
    background: rgba(0, 255, 255, 0.04);
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 10px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
}

.shop-card:hover {
    background: rgba(0, 255, 255, 0.12);
    border-color: var(--cyan);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.15);
    transform: translateY(-3px);
}

.shop-card.equipped {
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(255, 221, 0, 0.2);
    background: rgba(255, 221, 0, 0.06);
}

.shop-card.owned .shop-price {
    color: var(--green);
}

.shop-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.shop-name {
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--cyan);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.shop-price {
    font-family: var(--font-title);
    font-size: 0.7rem;
    color: var(--gold);
    letter-spacing: 1px;
}

/* ── Shop Tabs ── */
.shop-tabs {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
    margin: 8px 0;
    flex-wrap: wrap;
}

.shop-tab {
    padding: 8px 16px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.4);
    color: var(--cyan);
    font-family: var(--font-title);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.25s;
}

.shop-tab:hover {
    border-color: var(--cyan);
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
}

.shop-tab.active {
    border-color: var(--gold);
    background: rgba(255, 221, 0, 0.15);
    color: var(--gold);
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.3);
    font-weight: 700;
}

.shop-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

/* ── Upgrade Section Headers (Active / Passive) ── */
.upgrade-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-top: 6px;
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--cyan);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(0, 200, 255, 0.25);
    text-shadow: 0 0 10px rgba(0, 200, 255, 0.4);
}

.upgrade-section-header.passive {
    color: #c084fc;
    border-bottom-color: rgba(192, 132, 252, 0.25);
    text-shadow: 0 0 10px rgba(192, 132, 252, 0.4);
    margin-top: 16px;
}

.upgrade-section-header .section-icon {
    font-size: 1.1rem;
}

.upgrade-section-header .section-desc {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 400;
    color: rgba(200, 215, 255, 0.5);
    letter-spacing: 0.5px;
    text-transform: none;
    text-shadow: none;
}

/* ── Upgrade Cards (Shop Enchantments) ── */
.upgrade-card {
    background: rgba(0, 150, 255, 0.06);
    border: 1px solid rgba(0, 150, 255, 0.3);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.25s;
}

.upgrade-card:hover:not(.maxed):not(.unaffordable) {
    background: rgba(0, 150, 255, 0.15);
    border-color: rgba(0, 200, 255, 0.6);
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.2);
    transform: translateX(4px);
}

.upgrade-card.maxed {
    background: rgba(255, 221, 0, 0.08);
    border-color: rgba(255, 221, 0, 0.3);
    opacity: 0.8;
}

.upgrade-card.unaffordable {
    background: rgba(255, 100, 100, 0.06);
    border-color: rgba(255, 100, 100, 0.2);
    opacity: 0.65;
    cursor: not-allowed;
}

.upgrade-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
}

.upgrade-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.upgrade-name {
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--cyan);
    letter-spacing: 1px;
    font-weight: 700;
}

.upgrade-desc {
    font-size: 0.85rem;
    color: rgba(220, 230, 255, 0.8);
    line-height: 1.4;
}

.upgrade-level {
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: rgba(0, 255, 255, 0.7);
    letter-spacing: 0.5px;
}

.upgrade-effect {
    font-size: 0.75rem;
    color: rgba(0, 255, 136, 0.7);
    line-height: 1.3;
}

.upgrade-cost {
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--gold);
    letter-spacing: 1px;
    font-weight: 700;
    text-align: right;
    flex-shrink: 0;
    min-width: 65px;
    text-shadow: 0 0 8px rgba(255, 221, 0, 0.3);
}

.upgrade-card.maxed .upgrade-cost {
    color: var(--green);
    font-size: 0.8rem;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.upgrade-card.unaffordable .upgrade-cost {
    color: rgba(255, 100, 100, 0.8);
    text-shadow: none;
}

/* ============================================
   BEST SCORE HUD
   ============================================ */
#hud-best-score {
    display: flex;
    flex-direction: column;
    margin-top: 2px;
    opacity: 0.6;
}

.hud-best-value {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 221, 0, 0.3);
}

/* ============================================
   REVIVE COUNTDOWN OVERLAY
   ============================================ */
#revive-overlay {
    background: rgba(0, 0, 0, 0.75);
    z-index: 30;
}

#revive-countdown-container {
    position: relative;
    width: 220px;
    height: 220px;
    cursor: pointer;
}

#revive-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 221, 0, 0.1);
    stroke-width: 6;
}

.ring-progress {
    fill: none;
    stroke: var(--gold);
    stroke-width: 6;
    stroke-linecap: round;
    filter: drop-shadow(0 0 8px rgba(255, 221, 0, 0.6));
    transition: stroke-dashoffset 0.1s linear;
}

#revive-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

#revive-icon {
    font-size: 3rem;
    animation: revivePulse 1.2s ease-in-out infinite;
}

#revive-text {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 15px rgba(255, 221, 0, 0.5);
    letter-spacing: 2px;
    margin: 4px 0;
}

#revive-countdown-cost {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--gold);
    opacity: 0.8;
}

#revive-countdown-timer {
    font-family: var(--font-title);
    font-size: 2.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

@keyframes revivePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

#revive-hint {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--gold);
    letter-spacing: 4px;
    opacity: 0.7;
    animation: hintBlink 1.5s ease-in-out infinite;
}

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

/* ============================================
   ACHIEVEMENTS & QUESTS
   ============================================ */
#achieve-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 18px;
}

.achieve-tab {
    padding: 8px 22px;
    border: 1px solid rgba(0, 255, 255, 0.2);
    border-radius: 20px;
    background: rgba(0, 255, 255, 0.03);
    color: var(--text-dim);
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.achieve-tab.active {
    background: rgba(0, 255, 255, 0.12);
    color: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

.achieve-tab:hover:not(.active) {
    background: rgba(0, 255, 255, 0.06);
    color: var(--text);
}

/* Achievement Cards */
.achieve-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    margin-bottom: 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.08);
    background: rgba(0, 255, 255, 0.02);
    transition: background 0.2s;
}

.achieve-card.unlocked {
    border-color: rgba(0, 255, 136, 0.2);
    background: rgba(0, 255, 136, 0.04);
}

.achieve-card.locked {
    opacity: 0.6;
}

.achieve-card.secret {
    opacity: 0.45;
    border-color: rgba(180, 0, 255, 0.15);
    background: rgba(180, 0, 255, 0.03);
    font-style: italic;
}

.achieve-icon {
    font-size: 1.8rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.achieve-info {
    flex: 1;
    text-align: left;
}

.achieve-name {
    font-family: var(--font-title);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

.achieve-desc {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.achieve-reward {
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 221, 0, 0.3);
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
}

.achieve-card.unlocked .achieve-reward {
    color: var(--green);
}

/* Quest reset timer */
.quest-reset-timer {
    text-align: center;
    font-family: var(--font-title);
    font-size: 0.8rem;
    color: var(--cyan);
    opacity: 0.85;
    padding: 6px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(0, 255, 255, 0.05);
    letter-spacing: 1px;
}

/* Quest Cards */
.quest-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.1);
    background: rgba(0, 255, 255, 0.02);
    transition: all 0.2s;
}

.quest-card.complete {
    border-color: rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.05);
}

.quest-card.claimed {
    opacity: 0.5;
    border-color: rgba(0, 255, 136, 0.1);
}

.quest-info {
    flex: 1;
    text-align: left;
}

.quest-text {
    font-family: var(--font-title);
    font-size: 0.85rem;
    color: var(--text);
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.quest-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--green));
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.4);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.quest-progress-text {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: var(--font-title);
    letter-spacing: 1px;
}

.quest-reward-section {
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.quest-claim-btn {
    padding: 6px 14px;
    border: 1px solid var(--gold);
    border-radius: 6px;
    background: rgba(255, 221, 0, 0.1);
    color: var(--gold);
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.quest-claim-btn.ready {
    animation: questReady 1.5s ease-in-out infinite;
}

.quest-claim-btn.ready:hover {
    background: rgba(255, 221, 0, 0.25);
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.3);
    transform: scale(1.05);
}

.quest-claim-btn.locked {
    opacity: 0.3;
    cursor: default;
    border-color: var(--text-dim);
    color: var(--text-dim);
}

@keyframes questReady {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 221, 0, 0.15); }
    50% { box-shadow: 0 0 18px rgba(255, 221, 0, 0.4); }
}

.quest-claimed-badge {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--green);
}

/* ============================================
   ACHIEVEMENT UNLOCK TOAST
   ============================================ */
.achievement-toast {
    position: fixed;
    top: 80px;
    right: -350px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(5, 10, 30, 0.95), rgba(0, 255, 136, 0.1));
    border: 1px solid rgba(0, 255, 136, 0.4);
    border-radius: 10px;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.2), 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: right 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.achievement-toast.show {
    right: 20px;
}

.achievement-toast.hide {
    right: -350px;
}

.toast-icon {
    font-size: 2rem;
}

.toast-content {
    text-align: left;
}

.toast-label {
    font-family: var(--font-title);
    font-size: 0.6rem;
    color: var(--green);
    letter-spacing: 3px;
    margin-bottom: 2px;
}

.toast-name {
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

.toast-reward {
    font-size: 0.8rem;
    color: var(--gold);
    margin-top: 2px;
}

/* ============================================
   TITLE GLOW KEYFRAME
   ============================================ */
@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 20px var(--cyan), 0 0 60px rgba(0, 255, 255, 0.4); }
    50% { text-shadow: 0 0 30px var(--cyan), 0 0 80px rgba(0, 255, 255, 0.6), 0 0 120px rgba(0, 255, 255, 0.2); }
}
/* ============================================
   RESPONSIVE DESIGN - BREAKPOINTS
   ============================================ */

/* Mobile Portrait (320-480px) */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .neon-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .neon-btn.small {
        height: 44px;
        min-width: 44px;
    }

    /* Upgrade choices — stack vertically on small screens */
    #upgrade-choices {
        gap: 8px;
        flex-direction: column;
        align-items: center;
    }

    #upgrade-screen .upgrade-card {
        width: 100%;
        max-width: 280px;
        padding: 10px 10px;
    }

    #upgrade-screen .upgrade-icon {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }

    #upgrade-screen .upgrade-name {
        font-size: 0.8rem;
        margin-bottom: 2px;
    }

    #upgrade-screen .upgrade-desc {
        font-size: 0.7rem;
        line-height: 1.2;
    }

    #upgrade-screen .upgrade-rarity-tag {
        font-size: 0.55rem;
        padding: 1px 6px;
    }

    #upgrade-screen .overlay-layout {
        padding: 14px 10px !important;
        gap: 6px !important;
    }

    #upgrade-screen .overlay-title {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }

    /* Shop enchantment cards — full width on mobile */
    .shop-panel .upgrade-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 14px 12px;
    }

    .upgrade-actions {
        flex-direction: row;
        gap: 6px;
        margin-top: 6px;
    }

    #btn-upgrade-reroll,
    #btn-upgrade-skip {
        max-width: 100%;
        width: 100%;
        padding: 8px 12px !important;
        font-size: 0.8rem;
    }

    /* HUD adjustments — hidden on mobile, info is on circular buttons + world HP */
    #hud-bottom {
        display: none !important;
    }

    #health-bar-container {
        width: 180px;
    }

    /* Shop panel */
    .shop-panel {
        max-height: 250px;
    }

    .upgrade-card {
        width: 100%;
        box-sizing: border-box;
    }

    #shop-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
        max-height: 40vh;
    }

    /* Achieve panel */
    .achieve-panel {
        max-height: 40vh;
    }

    .achieve-card {
        padding: 10px;
        gap: 10px;
    }

    /* Game over */
    .gameover-title {
        font-size: 2rem !important;
    }

    #final-stats {
        gap: 6px;
    }

    .stat-card {
        padding: 8px 12px;
        min-width: 80px;
    }

    .stat-card-value {
        font-size: 1.1rem;
    }

    /* Overlay layout */
    .overlay-layout {
        padding: 20px 12px;
        gap: 10px;
    }

    .overlay-title {
        font-size: 1.8rem;
    }

    .overlay-subtitle {
        font-size: 0.8rem;
    }

    /* Tooltips mobile adjustments */
    .tooltips-layout {
        padding: 32px 20px !important;
        gap: 16px !important;
        max-width: 95vw !important;
        max-height: auto !important;
        margin: 10px auto !important;
        border-radius: 16px;
    }

    .tooltips-layout .tooltips-title {
        margin-bottom: 4px !important;
    }

    .tooltips-layout .tooltips-title .title-neon {
        font-size: 2.5rem;
    }

    .tooltips-layout .tooltips-title .title-survivor {
        font-size: 1.5rem;
    }

    .tooltips-layout .overlay-icon {
        font-size: 3rem;
    }

    .tooltips-layout .overlay-title {
        font-size: 2rem;
        letter-spacing: 3px;
    }

    .tooltips-goal {
        font-size: 0.95rem;
    }

    .tooltips-content {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .tooltip-card:nth-child(5) {
        grid-column: auto;
    }

    .tooltip-card {
        padding: 12px;
        gap: 8px;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .tooltip-icon {
        font-size: 1.6rem;
    }

    .tooltip-card span:not(.tooltip-icon) {
        font-size: 0.85rem;
    }

    #btn-tooltips-ok {
        width: 100%;
        max-width: 200px;
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Mobile ability buttons safe area */
    #mobile-ability-buttons {
        bottom: max(60px, calc(env(safe-area-inset-bottom, 10px) + 50px));
        gap: 10px;
    }

    #mobile-dash-btn {
        width: 66px;
        height: 66px;
        margin-right: 4px;
    }
    #mobile-dash-btn .ability-icon { font-size: 1.3rem; }

    #mobile-ultimate-btn {
        width: 78px;
        height: 78px;
    }
    #mobile-ultimate-btn .ability-icon { font-size: 1.6rem; }

    /* Quick stats panel */
    #quick-stats-panel {
        width: 90vw;
        max-width: 280px;
    }

    /* Enchantment upgrade cards in shop */
    .upgrade-card .upgrade-icon {
        font-size: 1.8rem;
    }

    .upgrade-card .upgrade-name {
        font-size: 0.85rem;
    }

    .upgrade-card .upgrade-effect {
        font-size: 0.7rem;
    }

    body {
        padding: max(0px, env(safe-area-inset-top)) max(0px, env(safe-area-inset-right)) max(0px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left));
    }
}

/* Mobile Landscape (480-768px) */
@media (max-width: 768px) and (orientation: landscape) {
    html {
        font-size: 13px;
    }

    #hud-top-left,
    #hud-top-center {
        font-size: 0.85rem;
    }

    .upgrade-actions {
        flex-direction: row;
    }

    /* Landscape: reduce vertical space used */
    .overlay-layout {
        padding: 12px 16px;
        gap: 8px;
    }

    .overlay-title {
        font-size: 1.6rem;
    }

    #final-stats {
        gap: 6px;
    }

    /* Landscape: horizontal card layout for upgrades */
    #upgrade-choices {
        flex-direction: row;
        gap: 8px;
    }

    #upgrade-screen .upgrade-card {
        width: auto;
        flex: 1;
        min-width: 140px;
        max-width: 200px;
    }

    /* Move mobile buttons in landscape */
    #mobile-ability-buttons {
        bottom: max(30px, calc(env(safe-area-inset-bottom, 8px) + 20px));
        flex-direction: row;
        right: max(12px, env(safe-area-inset-right, 8px));
    }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    html {
        font-size: 16px;
    }

    .neon-btn {
        padding: 14px 30px;
        font-size: 1.1rem;
        min-height: 48px;
    }

    .neon-btn.small {
        height: 48px;
        min-width: 48px;
    }

    #upgrade-choices {
        gap: 14px;
    }

    .upgrade-actions {
        gap: 16px;
    }
}

/* Notch/Safe Area Support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0, env(safe-area-inset-left));
        padding-right: max(0, env(safe-area-inset-right));
        padding-top: max(0, env(safe-area-inset-top));
        padding-bottom: max(0, env(safe-area-inset-bottom));
    }

    #ui-overlay {
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    #hud-top-left,
    #hud-top-center {
        padding-top: max(8px, env(safe-area-inset-top));
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .shake { animation: none !important; }
    #ultimate-bar.ready { animation: none !important; }
    .gameover-title { animation: none !important; }
    .overlay-layout { animation: none !important; }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
    :root {
        --text: #ffffff;
        --text-dim: #cccccc;
    }
    
    .upgrade-card, .shop-card, .achieve-card, .quest-card {
        border-width: 2px;
    }
    
    .neon-btn {
        border: 2px solid currentColor;
    }
    
    #health-bar-bg, #dash-bar-bg, #ultimate-bar-bg {
        border-width: 2px;
    }
}

/* ============================================
   ENHANCED UI/UX — Cyberpunk Visual Polish
   ============================================ */

/* Animated border glow on HUD panels */
#hud-top-left,
#hud-top-center,
#hud-bottom {
    border-image: linear-gradient(135deg, rgba(0,255,255,0.15), rgba(255,0,255,0.08), rgba(0,255,255,0.15)) 1;
    border-width: 1px;
    border-style: solid;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#hud-top-left::before,
#hud-top-center::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(0,255,255,0.06) 0%, transparent 50%, rgba(255,0,255,0.03) 100%);
    pointer-events: none;
    z-index: -1;
}

/* Enhanced score counter glow */
.hud-value {
    background: linear-gradient(135deg, #e0e8ff, #00ffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 6px rgba(0,255,255,0.3));
}

/* Animated health bar with gradient pulse */
#health-bar {
    background: linear-gradient(90deg, #ff0044, #ff4466, #ff2255);
    background-size: 200% 100%;
    animation: healthBarShimmer 3s ease-in-out infinite;
}

@keyframes healthBarShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Health bar danger pulse when low */
#health-bar-bg.danger {
    animation: dangerPulse 0.5s ease-in-out infinite;
}

@keyframes dangerPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255,0,68,0.3); }
    50% { box-shadow: 0 0 18px rgba(255,0,68,0.7), inset 0 0 8px rgba(255,0,68,0.2); }
}

/* Enhanced stat cards with animated border */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, border-color 0.3s, box-shadow 0.3s;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -1px; left: -50%; right: -50%; bottom: -1px;
    background: linear-gradient(90deg, transparent 30%, rgba(0,255,255,0.12) 50%, transparent 70%);
    animation: cardShine 4s linear infinite;
    pointer-events: none;
}

@keyframes cardShine {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.stat-card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0,255,255,0.12);
    border-color: rgba(0,255,255,0.3);
}

/* Enhanced wave announce with glitch effect */
#wave-announce.visible #wave-announce-text {
    position: relative;
}

#wave-announce.visible #wave-announce-text::before,
#wave-announce.visible #wave-announce-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
}

#wave-announce.visible #wave-announce-text::before {
    color: var(--cyan);
    animation: glitch1 0.3s ease-out;
}

#wave-announce.visible #wave-announce-text::after {
    color: var(--magenta);
    animation: glitch2 0.3s ease-out;
}

@keyframes glitch1 {
    0% { transform: translate(-3px, -2px); opacity: 0.7; }
    50% { transform: translate(2px, 1px); opacity: 0.4; }
    100% { transform: translate(0, 0); opacity: 0; }
}

@keyframes glitch2 {
    0% { transform: translate(3px, 2px); opacity: 0.7; }
    50% { transform: translate(-2px, -1px); opacity: 0.4; }
    100% { transform: translate(0, 0); opacity: 0; }
}

/* Enhanced neon button hover with sweep animation */
.neon-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: left 0.5s;
}

.neon-btn:hover::before {
    left: 100%;
}

/* Upgrade card enhanced visuals */
.upgrade-card {
    position: relative;
    overflow: hidden;
}

.upgrade-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.upgrade-card:hover::after {
    opacity: 0.6;
}

#upgrade-screen .upgrade-card.rarity-rare::after {
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* Enhanced game over screen */
#gameover-screen .overlay-backdrop {
    background: radial-gradient(ellipse at center top, rgba(80, 0, 20, 0.5) 0%, rgba(2, 4, 15, 0.92) 70%);
}

#gameover-screen .overlay-backdrop::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255,0,68,0.01) 2px,
        rgba(255,0,68,0.01) 4px
    );
    pointer-events: none;
    animation: scanlinesDeath 8s linear infinite;
}

@keyframes scanlinesDeath {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Enhanced overlay panels with corner accents */
.overlay-layout::before {
    content: '';
    position: fixed;
    top: 10px; left: 10px;
    width: 20px; height: 20px;
    border-top: 2px solid rgba(0,255,255,0.2);
    border-left: 2px solid rgba(0,255,255,0.2);
    pointer-events: none;
    z-index: 100;
}

.overlay-layout::after {
    content: '';
    position: fixed;
    bottom: 10px; right: 10px;
    width: 20px; height: 20px;
    border-bottom: 2px solid rgba(0,255,255,0.2);
    border-right: 2px solid rgba(0,255,255,0.2);
    pointer-events: none;
    z-index: 100;
}

/* Enhanced combo text */
.combo-text {
    position: relative;
}

.combo-text.active::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    animation: comboPulse 0.5s ease-in-out infinite;
}

@keyframes comboPulse {
    0%, 100% { opacity: 0.5; transform: scaleX(0.8); }
    50% { opacity: 1; transform: scaleX(1.2); }
}

/* Enhanced gem display in menu */
.menu-gem-display {
    position: relative;
    overflow: hidden;
}

.menu-gem-display::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,221,0,0.08), transparent);
    animation: gemShine 3s ease-in-out infinite;
}

@keyframes gemShine {
    0%, 70% { left: -100%; }
    100% { left: 200%; }
}

/* Enhanced nav cards with corner brackets */
.menu-nav-card::before {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 8px; height: 8px;
    border-top: 1px solid rgba(0,255,255,0.2);
    border-left: 1px solid rgba(0,255,255,0.2);
    transition: all 0.3s;
}

.menu-nav-card::after {
    content: '';
    position: absolute;
    bottom: 4px; right: 4px;
    width: 8px; height: 8px;
    border-bottom: 1px solid rgba(0,255,255,0.2);
    border-right: 1px solid rgba(0,255,255,0.2);
    transition: all 0.3s;
}

.menu-nav-card:hover::before,
.menu-nav-card:hover::after {
    width: 14px; height: 14px;
    border-color: var(--cyan);
}

/* Revive overlay enhanced */
#revive-overlay #revive-countdown-container {
    filter: drop-shadow(0 0 30px rgba(255,221,0,0.3));
}

#revive-overlay #revive-hint {
    animation: reviveHintPulse 1.5s ease-in-out infinite;
}

@keyframes reviveHintPulse {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* Floating text enhancements */
.floating-text {
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}