/* ================= THEMES & ROOT VARIABLES ================= */
:root {
    --bg-dark: #070a12;
    --bg-surface: rgba(11, 17, 29, 0.96);
    --bg-card: rgba(16, 24, 40, 0.88);
    --primary-cyan: #00f5d4;
    --primary-glow: rgba(0, 245, 212, 0.35);
    --secondary-pink: #ff007f;
    --secondary-glow: rgba(255, 0, 127, 0.35);
    --maze-wall: #00f5d4;
    --accent-gold: #ffe600;
    --accent-gem: #b5179e;
    --accent-freeze: #00f0ff;
    --accent-speed: #70e000;
    --accent-shield: #00b4d8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-dim: rgba(0, 245, 212, 0.2);
    --border-glow: rgba(0, 245, 212, 0.4);
    --glow-power: 10px;
}

/* Theme: Quantum Core (Neon Violet) */
body.theme-quantum {
    --bg-dark: #080614;
    --bg-surface: rgba(18, 13, 32, 0.96);
    --bg-card: rgba(28, 19, 48, 0.88);
    --primary-cyan: #c084fc;
    --primary-glow: rgba(192, 132, 252, 0.35);
    --maze-wall: #a855f7;
    --border-dim: rgba(168, 85, 247, 0.25);
    --border-glow: rgba(168, 85, 247, 0.45);
}

/* Theme: Neon Reactor (Emerald Lime) */
body.theme-reactor {
    --bg-dark: #040d06;
    --bg-surface: rgba(11, 24, 13, 0.96);
    --bg-card: rgba(16, 36, 20, 0.88);
    --primary-cyan: #70e000;
    --primary-glow: rgba(112, 224, 0, 0.35);
    --maze-wall: #22c55e;
    --border-dim: rgba(34, 197, 94, 0.25);
    --border-glow: rgba(34, 197, 94, 0.45);
}

/* Theme: AI Fortress (Electric Blue) */
body.theme-fortress {
    --bg-dark: #050b14;
    --bg-surface: rgba(10, 19, 32, 0.96);
    --bg-card: rgba(16, 28, 48, 0.88);
    --primary-cyan: #00b4d8;
    --primary-glow: rgba(0, 180, 216, 0.35);
    --maze-wall: #3b82f6;
    --border-dim: rgba(59, 130, 246, 0.25);
    --border-glow: rgba(59, 130, 246, 0.45);
}

/* Glow Intensity Levels */
body.glow-high {
    --glow-power: 16px;
    --primary-glow: rgba(0, 245, 212, 0.55);
}
body.glow-low {
    --glow-power: 3px;
    --primary-glow: rgba(0, 245, 212, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100vw;
    /* Clean, crisp tech grid with ZERO circular glowing blobs in background */
    background-image: 
        linear-gradient(rgba(0, 245, 212, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 245, 212, 0.03) 1px, transparent 1px);
    background-size: 36px 36px, 36px 36px;
    transition: background-color 0.4s ease;
}

#game-container {
    position: relative;
    width: 820px;
    max-width: 98vw;
    height: 640px;
    max-height: 98vh;
    background: #080c14;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 245, 212, 0.18), 0 0 1px var(--primary-cyan);
    border: 1px solid var(--border-dim);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease;
}

/* Subtle Screen Shake */
#game-container.screen-shake {
    animation: gentleShake 0.3s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes gentleShake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
    40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* REUSABLE NOTIFICATION POPUP (Top Center, Non-Overlapping, Smooth Vanish) */
.toast {
    position: absolute;
    top: 86px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 16, 28, 0.96);
    border: 1px solid var(--primary-cyan);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.75), 0 0 14px var(--primary-glow);
    color: var(--text-main);
    padding: 7px 20px;
    border-radius: 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    z-index: 100;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
    animation: toastPopIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes toastPopIn {
    from { opacity: 0; transform: translate(-50%, -12px) scale(0.96); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.toast.toast-hiding {
    opacity: 0;
    transform: translate(-50%, -15px) scale(0.96);
}

/* IN-GAME HUD (Non-Overlapping, Above Canvas) */
#hud {
    flex: 0 0 auto;
    background: linear-gradient(180deg, #0b111e 0%, #070b13 100%);
    border-bottom: 1px solid var(--border-dim);
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 25;
}

.hud-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.hud-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 4px 10px;
    border-radius: 6px;
}

.hud-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.hud-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-cyan);
    text-shadow: 0 0 8px var(--primary-glow);
}

.lives-display {
    display: flex;
    gap: 2px;
    font-size: 1rem;
}

.lives-display .heart {
    filter: drop-shadow(0 0 4px rgba(255, 0, 127, 0.5));
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.lives-display .heart.lost {
    opacity: 0.2;
    filter: grayscale(100%);
}

.health-bar-wrapper {
    position: relative;
    width: 110px;
    height: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    overflow: hidden;
}

.pacify-box .hud-val {
    color: #22c55e;
    text-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.pacify-box .hud-val.warning {
    color: #f59e0b;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}

.pacify-box .hud-val.danger {
    color: #ef4444;
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
    animation: healthPulse 1s infinite alternate;
}

/* HEALTH BAR COLORS (Fresh Cyan > Solar Gold > Red) */
.health-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00f5d4, #70e000);
    box-shadow: 0 0 10px rgba(112, 224, 0, 0.6);
    transition: width 0.25s ease, background 0.3s ease;
}

.health-fill.warning {
    background: linear-gradient(90deg, #f59e0b, #ffe600);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.health-fill.danger {
    background: linear-gradient(90deg, #ff0055, #ef4444);
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.7);
    animation: healthPulse 0.8s infinite alternate;
}

@keyframes healthPulse {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    text-shadow: 0 0 4px #000;
}

.hud-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    min-height: 40px;
}

/* MISSION TEXT (Clean, Sleek Pill) */
.mission-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 245, 212, 0.08);
    border: 1px solid var(--border-dim);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.mission-wrapper.portal-ready {
    background: rgba(0, 245, 212, 0.16);
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    box-shadow: 0 0 12px var(--primary-glow);
    animation: portalPulse 1s infinite alternate;
}

@keyframes portalPulse {
    from { transform: scale(1); }
    to { transform: scale(1.02); }
}

.hud-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-btn {
    height: 30px;
    min-width: 84px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-dim);
    color: var(--primary-cyan);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.hud-btn:hover {
    background: rgba(0, 245, 212, 0.15);
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-glow);
}

.hud-btn.powers-btn {
    color: var(--accent-gold);
    border-color: rgba(255, 215, 0, 0.35);
    background: rgba(255, 215, 0, 0.04);
}

.hud-btn.powers-btn:hover {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    color: #fff;
}

/* TACTICAL CYBER DEFENSE ARSENAL MODAL (Levels 13, 14, 15) */
.tactical-powers-modal {
    max-width: 680px;
    width: 95%;
}

.powers-score-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 255, 204, 0.08);
    border: 1px solid rgba(0, 255, 204, 0.3);
    border-radius: 8px;
    padding: 10px 18px;
    margin: 12px 0 16px 0;
}

.score-banner-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.score-banner-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    margin-top: 3px;
}

.score-banner-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.35rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
}

.powers-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .powers-grid {
        grid-template-columns: 1fr;
    }
}

.power-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-dim);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.25s ease;
    position: relative;
}

.power-card:hover {
    border-color: rgba(0, 255, 204, 0.5);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}

.power-card.equipped {
    border-color: #00ffcc;
    background: rgba(0, 255, 204, 0.1);
    box-shadow: 0 0 16px rgba(0, 255, 204, 0.35);
}

.power-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.power-card-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.power-card-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.power-card-desc {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-muted);
    flex: 1;
}

.power-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.power-cost-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    color: #ffd700;
    letter-spacing: 0.5px;
}

.btn-power-select {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--primary-cyan);
    background: rgba(0, 255, 204, 0.12);
    color: var(--primary-cyan);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-power-select:hover:not(:disabled) {
    background: var(--primary-cyan);
    color: #000;
    box-shadow: 0 0 10px var(--primary-glow);
}

.btn-power-select:disabled {
    opacity: 0.45;
    border-color: var(--border-dim);
    color: var(--text-muted);
    cursor: not-allowed;
}

.power-card.equipped .btn-power-select {
    background: #00ffcc;
    color: #000;
    border-color: #00ffcc;
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.4);
}

.powers-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-deploy-hero {
    font-size: 0.95rem;
    font-weight: 900;
    padding: 10px 24px;
    letter-spacing: 1px;
}

.hint-btn {
    color: var(--accent-gold);
    border-color: rgba(255, 230, 0, 0.35);
}

.hint-btn:hover {
    background: rgba(255, 230, 0, 0.15);
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.4);
}

.hud-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* Canvas Area */
#canvas-container {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #05080e;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

#confettiCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 45;
}

.hidden {
    display: none !important;
}

/* SCREENS & MODALS */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 9, 15, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    text-align: center;
}

.screen-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-glow);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 20px var(--primary-glow);
    border-radius: 12px;
    padding: 26px;
    display: flex;
    flex-direction: column;
    max-height: 92%;
    position: relative;
}

/* CLOSE (✕) BUTTON ON MODALS */
.btn-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-dim);
    color: var(--text-muted);
    font-size: 1.1rem;
    font-family: 'Orbitron', sans-serif;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-modal-close:hover {
    color: #fff;
    border-color: var(--secondary-pink);
    background: rgba(255, 0, 127, 0.2);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.5);
    transform: scale(1.1);
}

.modal-header {
    margin-bottom: 16px;
}

.modal-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.85rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--primary-cyan);
    text-shadow: 0 0 12px var(--primary-glow);
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 1.02rem;
    margin-top: 4px;
}

.modal-footer {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

/* ================= MAIN MENU (Sleek, Professional, Horizontal Layout) ================= */
.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.logo-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4.2rem;
    font-weight: 900;
    letter-spacing: 8px;
    margin-bottom: 2px;
}

.glow-cyan {
    color: var(--primary-cyan);
    text-shadow: 0 0 var(--glow-power) var(--primary-cyan), 0 0 25px var(--primary-glow);
}

.glow-pink {
    color: var(--secondary-pink);
    text-shadow: 0 0 var(--glow-power) var(--secondary-pink), 0 0 25px var(--secondary-glow);
}

.logo-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 4px;
    color: var(--text-muted);
    margin-bottom: 22px;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 490px;
    max-width: 92vw;
}

.menu-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
}

.btn-play-hero {
    width: 100%;
    padding: 13px 22px;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 2px;
}

.menu-row .btn {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.menu-row-primary .btn {
    padding: 13px 22px;
    font-size: 1.05rem;
    font-weight: 700;
}

.menu-row-secondary .btn {
    padding: 11px 18px;
    font-size: 0.95rem;
}

.menu-row-tertiary .btn {
    padding: 11px 18px;
    font-size: 0.95rem;
}

.menu-footer {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.footer-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.86rem;
    letter-spacing: 1.5px;
    color: var(--primary-cyan);
    text-shadow: 0 0 6px var(--primary-glow);
}

.footer-credit {
    font-size: 0.82rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ================= BUTTONS ================= */
.btn {
    background: rgba(12, 18, 30, 0.85);
    color: var(--primary-cyan);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    border: 1px solid var(--border-dim);
    padding: 10px 18px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    transition: all 0.22s ease;
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.08) inset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-cyan);
    color: #05080e;
    border-color: var(--primary-cyan);
    box-shadow: 0 0 18px var(--primary-cyan);
    transform: translateY(-2px);
}

.btn:disabled, .btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    transform: none !important;
}

.btn-primary {
    background: rgba(0, 245, 212, 0.14);
    border-color: var(--primary-cyan);
    box-shadow: 0 0 14px var(--primary-glow);
}

.btn-continue {
    background: rgba(255, 230, 0, 0.08);
    color: var(--accent-gold);
    border-color: rgba(255, 230, 0, 0.35);
}

.btn-continue:hover:not(:disabled) {
    background: var(--accent-gold);
    color: #05080e;
    box-shadow: 0 0 18px var(--accent-gold);
}

.btn-danger {
    color: var(--secondary-pink);
    border-color: var(--secondary-pink);
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.15) inset;
}

.btn-danger:hover {
    background: var(--secondary-pink);
    color: #fff;
    box-shadow: 0 0 18px var(--secondary-pink);
}

.btn-danger-small {
    background: rgba(255, 0, 127, 0.1);
    color: var(--secondary-pink);
    border: 1px solid var(--secondary-pink);
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-danger-small:hover {
    background: var(--secondary-pink);
    color: #fff;
    box-shadow: 0 0 10px var(--secondary-pink);
}

/* ================= LEVEL SELECT GRID (5 cols x 3 rows) ================= */
.level-select-modal {
    width: 760px;
    max-width: 95%;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 12px;
    margin: 8px 0;
    overflow-y: auto;
    padding: 6px;
}

.level-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.level-card:hover:not(.locked) {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
    background: rgba(0, 245, 212, 0.1);
}

.level-card.current {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 15px var(--primary-glow);
    animation: currentLevelPulse 1.5s infinite alternate;
}

@keyframes currentLevelPulse {
    from { border-color: rgba(0, 245, 212, 0.5); }
    to { border-color: var(--primary-cyan); box-shadow: 0 0 20px var(--primary-cyan); }
}

.level-card.completed {
    border-color: rgba(0, 245, 212, 0.4);
}

.level-card.locked {
    opacity: 0.35;
    cursor: not-allowed;
    background: rgba(10, 15, 24, 0.5);
    border-color: rgba(255, 255, 255, 0.06);
}

.level-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--primary-cyan);
}

.level-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.level-continue-pill {
    background: rgba(255, 230, 0, 0.18);
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 8px;
    letter-spacing: 0.8px;
    margin: 2px 0;
    box-shadow: 0 0 8px rgba(255, 230, 0, 0.35);
    animation: continuePillPulse 1.4s infinite alternate;
}

@keyframes continuePillPulse {
    from { transform: scale(0.97); box-shadow: 0 0 4px rgba(255, 230, 0, 0.2); }
    to { transform: scale(1.03); box-shadow: 0 0 10px rgba(255, 230, 0, 0.5); }
}

.level-stars {
    display: flex;
    gap: 2px;
    font-size: 0.8rem;
    color: var(--accent-gold);
}

.level-stars .star-empty {
    color: rgba(255, 255, 255, 0.15);
}

.level-status-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.75rem;
    color: var(--primary-cyan);
}

/* ================= HOW TO PLAY MODAL ================= */
.how-to-modal {
    width: 600px;
    max-width: 95%;
}

.how-to-scroll {
    overflow-y: auto;
    max-height: 420px;
    text-align: left;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.guide-block {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 12px 16px;
}

.guide-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.05rem;
    color: var(--primary-cyan);
    margin-bottom: 6px;
}

.guide-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.guide-pills .pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.guide-pills kbd {
    background: #172033;
    border: 1px solid #334155;
    color: #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 2px;
}

.guide-list {
    list-style: none;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.95rem;
}

.guide-list li {
    padding-left: 14px;
    position: relative;
}

.guide-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--primary-cyan);
    font-weight: bold;
}

/* ================= STATISTICS & ACHIEVEMENTS MODAL ================= */
.stats-modal {
    width: 680px;
    max-width: 95%;
}

.stats-scroll {
    overflow-y: auto;
    max-height: 420px;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-card-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-cyan);
}

.stat-card-lbl {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.section-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    color: var(--accent-gold);
    text-align: left;
    margin-bottom: 8px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.achievement-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    transition: all 0.2s ease;
}

.achievement-card.unlocked {
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.2);
}

.achievement-card.locked {
    opacity: 0.45;
}

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

.ach-info {
    display: flex;
    flex-direction: column;
}

.ach-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
}

.ach-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ach-status {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-top: 2px;
    letter-spacing: 0.5px;
}

.stats-footer {
    display: flex;
    justify-content: space-between;
}

/* ================= SETTINGS MODAL ================= */
.settings-modal {
    width: 520px;
    max-width: 95%;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
    margin: 8px 0;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: var(--primary-cyan);
    min-width: 42px;
    text-align: right;
}

.toggle-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-cyan);
    cursor: pointer;
}

.slider {
    width: 140px;
    accent-color: var(--primary-cyan);
    cursor: pointer;
}

.custom-select {
    background: #0b111e;
    border: 1px solid var(--primary-cyan);
    color: #fff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.setting-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 0;
}

.sub-tip {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ================= CONFIRMATION DIALOG MODAL ================= */
.confirm-overlay {
    z-index: 100;
}

.confirm-modal {
    width: 420px;
    max-width: 90%;
    padding: 24px;
}

.confirm-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

/* ================= PAUSE MODAL (Horizontal Buttons) ================= */
.pause-modal {
    width: 460px;
    max-width: 95%;
}

.pause-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.pause-actions .btn {
    flex: 1 1 45%;
    min-width: 140px;
}

/* ================= LEVEL COMPLETE MODAL (Horizontal Buttons) ================= */
.complete-modal {
    width: 490px;
    max-width: 95%;
    animation: cyberModalIn 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border-color: var(--primary-cyan);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px var(--primary-glow);
}

@keyframes cyberModalIn {
    0% { transform: translateY(18px) scale(0.95); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.stars-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 2.5rem;
    color: var(--accent-gold);
    margin: 8px 0;
    text-shadow: 0 0 15px rgba(255, 230, 0, 0.6);
}

.star-icon.empty {
    color: rgba(255, 255, 255, 0.15);
    text-shadow: none;
}

.rating-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    color: var(--primary-cyan);
    margin-bottom: 12px;
}

.stats-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-dim);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.stat-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.stat-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-cyan);
}

.stat-lbl {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* HORIZONTAL ACTION BUTTONS */
.complete-actions, .game-over-actions, .victory-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.complete-actions .btn, .game-over-actions .btn, .victory-actions .btn {
    flex: 1 1 auto;
    min-width: 120px;
}

/* ================= GAME OVER MODAL ================= */
.game-over-modal {
    width: 480px;
    max-width: 95%;
    animation: cyberGameOverGlitch 0.4s ease-out;
    border-color: #ff0055;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(255, 0, 85, 0.45);
}

@keyframes cyberGameOverGlitch {
    0% { transform: scale(0.96); filter: hue-rotate(90deg) contrast(150%); opacity: 0; }
    40% { transform: scale(1.02) translate(-2px, 1px); filter: contrast(130%); opacity: 0.8; }
    70% { transform: translate(2px, -1px); }
    100% { transform: scale(1) translate(0, 0); opacity: 1; }
}

.glitch-text {
    position: relative;
    display: inline-block;
}

/* ================= VICTORY MODAL ================= */
.victory-modal {
    width: 560px;
    max-width: 95%;
}

.victory-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.victory-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-top: 4px;
}

.victory-tag {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 12px;
}

.victory-badge {
    background: linear-gradient(90deg, rgba(255, 230, 0, 0.15), rgba(0, 245, 212, 0.15));
    border: 1px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 8px 18px;
    border-radius: 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
    display: inline-block;
    box-shadow: 0 0 15px rgba(255, 230, 0, 0.3);
}

.victory-stats {
    grid-template-columns: repeat(4, 1fr);
}

/* ================= MOBILE VIRTUAL CONTROLS ================= */
#mobile-controls {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: none;
    z-index: 40;
}

.mobile-dpad {
    position: relative;
    width: 130px;
    height: 130px;
    pointer-events: auto;
}

.dpad-btn {
    position: absolute;
    width: 42px;
    height: 42px;
    background: rgba(11, 17, 29, 0.85);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    box-shadow: 0 0 8px var(--primary-glow);
    touch-action: none;
}

.dpad-btn:active {
    background: var(--primary-cyan);
    color: #05080e;
}

.dpad-btn.up { top: 0; left: 44px; }
.dpad-btn.down { bottom: 0; left: 44px; }
.dpad-btn.left { top: 44px; left: 0; }
.dpad-btn.right { top: 44px; right: 0; }

.mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: auto;
}

.mobile-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(11, 17, 29, 0.85);
    border: 1px solid var(--primary-cyan);
    color: var(--primary-cyan);
    font-size: 1.3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px var(--primary-glow);
    cursor: pointer;
    touch-action: none;
}

.mobile-btn:active {
    background: var(--primary-cyan);
    color: #05080e;
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .menu-nav {
        width: 90vw;
    }

    .menu-row {
        flex-direction: column;
        gap: 8px;
    }

    .level-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(5, auto);
    }

    .stats-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .achievements-grid {
        grid-template-columns: 1fr;
    }

    .hud-top-bar {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hud-bottom-bar {
        flex-wrap: wrap;
        justify-content: center;
    }

    .logo-title {
        font-size: 3.2rem;
    }

    .complete-actions, .game-over-actions, .victory-actions, .pause-actions {
        flex-direction: column;
    }
}
