/* ============================================
   MINDSNAP — Complete Stylesheet
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --bg-deep: #06060f;
    --bg-surface: #0d0d1f;
    --neon-pink: #ff00ea;
    /* More magenta/hot pink */
    --neon-cyan: #00e5ff;
    --neon-lime: #76ff03;
    --neon-orange: #ff9100;
    --neon-purple: #d500f9;
    --neon-yellow: #ffea00;
    --neon-red: #ff0000;
    /* Pure deep red */
    --neon-blue: #2979ff;
    --text-primary: #f0f0ff;
    --text-secondary: #8888aa;
    --glass-bg: rgba(15, 15, 40, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-main: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
    --timer-color: var(--neon-cyan);
    --particle-color: 0, 229, 255;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-main);
    background: var(--bg-deep);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

#bg-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Version Tag */
.test-tag {
    background: #ffcc00;
    color: #000 !important;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 20px;
    display: inline-block;
}

.test-tag.hidden {
    display: none;
}

/* ---------- Screens ---------- */
.screen {
    position: fixed;
    inset: 0;
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 100 !important; /* Higher z-index to stay above base layers */
    opacity: 0;
}

.screen.active {
    display: flex !important;
    opacity: 1;
}

.game-screen {
    flex-direction: column;
    justify-content: flex-start; /* Align to top as in v1.1.1 */
    padding: 16px;
    padding-top: calc(10px + env(safe-area-inset-top)); /* Space for notch */
    gap: 0;
}

/* ---------- Glass Panel ---------- */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 32px 28px;
    text-align: center;
    max-width: 440px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
}

/* ============================================
   MAIN MENU
   ============================================ */
.menu-panel {
    animation: float-in 0.6s ease-out;
    padding: 28px 24px;
    padding-top: calc(28px + env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.game-title {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 6px;
}

.title-mind {
    color: var(--text-primary);
    font-size: 2.2rem;
    letter-spacing: 0.2em;
    opacity: 0.8;
}

.title-snap {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 3.5rem;
    filter: drop-shadow(0 0 20px rgba(255, 45, 123, 0.3));
    letter-spacing: -0.03em;
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.hs-spacer {
    height: 16px;
    margin-bottom: 16px;
}

.hs-label {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    font-weight: 600;
}

.hs-value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

/* Buttons */
button {
    pointer-events: auto;
}

.neon-btn {
    display: inline-block;
    padding: 14px 40px;
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #fff;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    border: none;
    border-radius: 60px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 0 25px rgba(255, 45, 123, 0.25), 0 0 50px rgba(213, 0, 249, 0.12);
    touch-action: manipulation; /* Fix for mobile double-tap zoom delay */
    pointer-events: auto;
}

.neon-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(255, 45, 123, 0.4);
}

.neon-btn:active {
    transform: scale(0.96);
}

.pulse-btn {
    animation: btn-pulse 2s ease-in-out infinite;
}

@keyframes btn-pulse {

    0%,
    100% {
        box-shadow: 0 0 25px rgba(255, 45, 123, 0.25);
    }

    50% {
        box-shadow: 0 0 45px rgba(255, 45, 123, 0.4), 0 0 80px rgba(213, 0, 249, 0.2);
    }
}

.daily-btn {
    width: 100%;
    padding: 12px;
    font-size: 0.85rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.15);
}

.daily-btn.hidden {
    display: none !important;
}

.play-btn {
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 40px;
}

.btn-main {
    display: block;
    font-size: 1rem;
    line-height: 1.2;
}

.btn-sub {
    display: block;
    font-size: 0.65rem;
    opacity: 0.7;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.menu-footer {
    margin-top: 16px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.5;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Mode Cards */
.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    font-family: var(--font-main);
    color: var(--text-primary);
    text-align: left;
    transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.mode-card:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.06);
}

.mode-card:active {
    transform: scale(0.97);
}

.mode-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.mode-info {
    flex: 1;
}

.mode-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
}

.mode-desc {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.mode-best {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-cyan);
    min-width: 30px;
    text-align: right;
}

.mode-cc:hover {
    border-color: rgba(255, 23, 68, 0.3);
}

.mode-rr:hover {
    border-color: rgba(255, 234, 0, 0.3);
}

.mode-mf:hover {
    border-color: rgba(0, 229, 255, 0.3);
}

.menu-nav {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

.nav-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: transform 0.15s, background 0.15s;
    touch-action: none;
}

.nav-icon-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.08);
}

.nav-icon-btn:active {
    transform: scale(0.92);
}

.ads-btn.hidden {
    display: none !important;
}

.rule-bar {
    width: 100%;
    max-width: 600px;
    padding: 14px 20px;
    /* Restored v1.1.1 style vertical rhythm */
    margin-top: 10px;
    margin-bottom: 5px;
    flex-shrink: 0;
    position: relative;
}

.rule-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px rgba(255, 234, 0, 0.3);
}

/* Stroop word */
.stroop-word {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    margin-top: 6px;
    text-shadow: 0 0 20px currentColor;
    animation: stroop-pulse 0.6s ease-in-out;
}

.stroop-word.hidden {
    display: none;
}

@keyframes stroop-pulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Timer */
.timer-container {
    width: 100%;
    max-width: 600px;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: var(--timer-color);
    border-radius: 3px;
    transition: width 0.05s linear;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.timer-bar.warning {
    background: var(--neon-orange);
    box-shadow: 0 0 10px rgba(255, 145, 0, 0.4);
}

.timer-bar.danger {
    background: var(--neon-red);
    box-shadow: 0 0 12px rgba(255, 23, 68, 0.5);
    animation: timer-flash 0.3s ease-in-out infinite alternate;
}

@keyframes timer-flash {
    to {
        opacity: 0.5;
    }
}

.phase-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--neon-purple);
    text-shadow: 0 0 12px rgba(213, 0, 249, 0.3);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.phase-indicator.hidden {
    display: none;
}

/* Combo */
.combo-display {
    font-size: 1.3rem;
    font-weight: 900;
    margin-bottom: 4px;
    transition: opacity 0.3s, transform 0.3s;
}

.combo-display.hidden {
    display: none;
}

.combo-text {
    background: linear-gradient(90deg, var(--neon-orange), var(--neon-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 8px rgba(255, 145, 0, 0.4));
}

.combo-display.fire .combo-text {
    background: linear-gradient(90deg, var(--neon-yellow), var(--neon-red), var(--neon-orange));
    -webkit-background-clip: text;
    background-clip: text;
    animation: fire-text 0.4s ease-in-out infinite alternate;
}

@keyframes fire-text {
    to {
        filter: drop-shadow(0 0 18px rgba(255, 60, 0, 0.7));
    }
}

/* Score */
.score-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 2px 0;
    pointer-events: none;
}

.score-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
}

.score-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
    min-width: 50px;
}

.score-value.score-pop {
    animation: score-pop 0.25s ease-out;
}

@keyframes score-pop {
    0% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.3)
    }

    100% {
        transform: scale(1)
    }
}

/* =========================================
   UI BADGES (LEVELS, COMBOS)
   ========================================= */

/* Top HUD Container for center alignment */
.game-top-hud {
    position: relative;
    width: 100%;
    padding: 10px 16px;
    padding-top: 0; /* Let game-screen padding handle the top */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.game-bottom-hud {
    margin-top: auto;
    width: 100%;
    padding-bottom: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}

.game-bottom-hud > * {
    pointer-events: auto;
}

.level-badge {
    background: rgba(10, 10, 15, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.6);
    backdrop-filter: blur(8px);
    margin: 0;
    pointer-events: auto;
}

/* Pause Button in Game Screen */
.game-pause-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    backdrop-filter: blur(8px);
    pointer-events: auto;
    margin: 0;
}

.game-pause-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.1);
}

.game-pause-btn:active {
    transform: scale(0.95);
}

/* ============================================
   SHAPES (Color Chaos + Memory Flash)
   ============================================ */
.shape-arena,
.mf-arena {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    /* Reduced gap between rows */
    width: 100%;
    max-width: 600px;
    padding: 12px;
    min-height: 180px;
    align-content: center;
    /* Ensures blocks pack tighter */
}

.shape {
    cursor: pointer;
    transition: transform 0.12s;
    animation: shape-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    touch-action: none;
}

.shape:active {
    transform: scale(0.88) !important;
}

.shape.circle {
    border-radius: 50%;
}

.shape.square {
    border-radius: 14%;
}

.shape.triangle {
    clip-path: polygon(50% 8%, 95% 92%, 5% 92%);
    border-radius: 0;
}

.shape.diamond {
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    border-radius: 0;
}

.shape.star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    border-radius: 0;
}

.shape.hexagon {
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    border-radius: 0;
}

.shape.color-red {
    background: var(--neon-red);
    box-shadow: 0 0 20px rgba(255, 23, 68, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-blue {
    background: var(--neon-blue);
    box-shadow: 0 0 20px rgba(41, 121, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-green {
    background: var(--neon-lime);
    box-shadow: 0 0 20px rgba(118, 255, 3, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-pink {
    background: var(--neon-pink);
    box-shadow: 0 0 20px rgba(255, 45, 123, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-cyan {
    background: var(--neon-cyan);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-orange {
    background: var(--neon-orange);
    box-shadow: 0 0 20px rgba(255, 145, 0, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-purple {
    background: var(--neon-purple);
    box-shadow: 0 0 20px rgba(213, 0, 249, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

.shape.color-yellow {
    background: var(--neon-yellow);
    box-shadow: 0 0 20px rgba(255, 234, 0, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.08);
}

/* Clip-path shapes need drop-shadow instead */
.shape.triangle,
.shape.diamond,
.shape.star,
.shape.hexagon {
    box-shadow: none !important;
}

.shape.triangle.color-red,
.shape.diamond.color-red,
.shape.star.color-red,
.shape.hexagon.color-red {
    filter: drop-shadow(0 0 14px rgba(255, 23, 68, 0.5));
}

.shape.triangle.color-blue,
.shape.diamond.color-blue,
.shape.star.color-blue,
.shape.hexagon.color-blue {
    filter: drop-shadow(0 0 14px rgba(41, 121, 255, 0.5));
}

.shape.triangle.color-green,
.shape.diamond.color-green,
.shape.star.color-green,
.shape.hexagon.color-green {
    filter: drop-shadow(0 0 14px rgba(118, 255, 3, 0.5));
}

.shape.triangle.color-pink,
.shape.diamond.color-pink,
.shape.star.color-pink,
.shape.hexagon.color-pink {
    filter: drop-shadow(0 0 14px rgba(255, 45, 123, 0.5));
}

.shape.triangle.color-cyan,
.shape.diamond.color-cyan,
.shape.star.color-cyan,
.shape.hexagon.color-cyan {
    filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.5));
}

.shape.triangle.color-orange,
.shape.diamond.color-orange,
.shape.star.color-orange,
.shape.hexagon.color-orange {
    filter: drop-shadow(0 0 14px rgba(255, 145, 0, 0.5));
}

.shape.triangle.color-purple,
.shape.diamond.color-purple,
.shape.star.color-purple,
.shape.hexagon.color-purple {
    filter: drop-shadow(0 0 14px rgba(213, 0, 249, 0.5));
}

.shape.triangle.color-yellow,
.shape.diamond.color-yellow,
.shape.star.color-yellow,
.shape.hexagon.color-yellow {
    filter: drop-shadow(0 0 14px rgba(255, 234, 0, 0.5));
}

.shape.size-small {
    width: 50px;
    height: 50px;
}

.shape.size-medium {
    width: 70px;
    height: 70px;
}

.shape.size-large {
    width: 92px;
    height: 92px;
}

/* Ghost mode */
.shape.ghost-out {
    animation: ghost-fade 1.2s ease-in-out infinite alternate;
}

@keyframes ghost-fade {
    0% {
        opacity: 1
    }

    100% {
        opacity: 0.1
    }
}

/* Trail effects */
.shape.trail-glow {
    box-shadow: 0 0 35px currentColor, 0 0 55px currentColor !important;
}

.shape.trail-spark::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: inherit;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
    animation: spark-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes spark-pulse {
    to {
        opacity: 0.2;
        transform: scale(1.15);
    }
}

.shape.trail-fire {
    animation: fire-shape 0.4s ease-in-out infinite alternate !important;
}

@keyframes fire-shape {
    from {
        filter: drop-shadow(0 0 12px rgba(255, 100, 0, 0.5)) brightness(1);
    }

    to {
        filter: drop-shadow(0 0 25px rgba(255, 50, 0, 0.8)) brightness(1.15);
    }
}

@keyframes shape-enter {
    from {
        transform: scale(0);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

/* ============================================
   HELP & INSTRUCTIONS
   ============================================ */
.help-panel {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.help-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
    text-align: left;
    margin-bottom: 20px;
}

.help-item {
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.help-mode-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.help-mode-title.cc {
    color: var(--neon-red);
}

.help-mode-title.rr {
    color: var(--neon-yellow);
}

.help-mode-title.mf {
    color: var(--neon-cyan);
}

.help-item p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.help-list {
    text-align: left;
    padding-left: 20px;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.help-list li {
    margin-bottom: 5px;
}

.help-list b {
    color: var(--text-primary);
}

.help-item b {
    color: var(--text-primary);
}

.help-ok-btn {
    width: 100%;
}


.shape.correct-tap {
    animation: correct-pulse 0.35s ease-out forwards;
}

@keyframes correct-pulse {
    0% {
        transform: scale(1)
    }

    40% {
        transform: scale(1.3);
        opacity: 0.8
    }

    100% {
        transform: scale(1.5);
        opacity: 0
    }
}

.shape.wrong-tap {
    animation: wrong-shake 0.4s ease-out forwards;
}

@keyframes wrong-shake {
    0% {
        transform: translateX(0)
    }

    20% {
        transform: translateX(-10px)
    }

    40% {
        transform: translateX(10px)
    }

    60% {
        transform: translateX(-6px)
    }

    80% {
        transform: translateX(6px)
    }

    100% {
        transform: translateX(0);
        opacity: 0.3
    }
}

/* ============================================
   REVERSE REFLEX
   ============================================ */
.rr-signal-area {
    width: 100%;
    max-width: 600px;
    padding: 24px 20px;
    /* Removed large margin that pushed it down. Now sits just below HUD */
    margin-top: 5px;
    margin-bottom: 10px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.rr-signal {
    font-size: clamp(3.5rem, 15vw, 6rem);
    line-height: 1;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 30px rgba(0, 229, 255, 0.5), 0 0 60px rgba(0, 229, 255, 0.2);
    transition: transform 0.15s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.signal-flash {
    animation: signal-pop 0.3s ease-out;
}

@keyframes signal-pop {
    0% {
        transform: scale(0.3);
        opacity: 0
    }

    60% {
        transform: scale(1.15)
    }

    100% {
        transform: scale(1);
        opacity: 1
    }
}

.signal-fake {
    animation: fake-flash 0.3s ease-out;
    filter: hue-rotate(180deg);
}

@keyframes fake-flash {
    50% {
        opacity: 0.3;
        transform: scale(0.9)
    }
}

.rr-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    letter-spacing: 0.12em;
    font-weight: 600;
    text-transform: uppercase;
}

/* Zones */
.rr-zones {
    flex: 1;
    display: flex;
    width: 100%;
    max-width: 500px;
    gap: 14px;
    padding: 16px;
    margin: 0 auto;
    align-items: stretch;
}

.rr-2way {
    flex-direction: row;
}

.rr-2way .rr-zone {
    flex: 1;
    min-width: 0;
    min-height: clamp(100px, 20vh, 160px);
}

.rr-4way {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: 340px;
    width: 340px;
    flex: none;
}

.rr-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 24px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-family: var(--font-main);
    transition: transform 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s;
    touch-action: none;
    backdrop-filter: blur(6px);
}

.rr-zone:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.03);
}

.rr-zone:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.12);
}

/* Arrow icon inside zone */
.rr-zone-arrow {
    font-size: 3rem;
    line-height: 1;
    text-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
    pointer-events: none;
    transition: transform 0.15s, text-shadow 0.15s;
}

.rr-zone:hover .rr-zone-arrow {
    transform: scale(1.15);
    text-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
}

.rr-zone-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    color: var(--text-secondary);
    opacity: 0.6;
    pointer-events: none;
    text-transform: uppercase;
}

/* Direction-specific styling */
.rr-zone-left {
    border-color: rgba(255, 45, 123, 0.2);
    background: linear-gradient(135deg, rgba(255, 45, 123, 0.06), transparent);
    box-shadow: inset 0 0 30px rgba(255, 45, 123, 0.03);
}

.rr-zone-left:active {
    border-color: rgba(255, 45, 123, 0.5);
    box-shadow: 0 0 25px rgba(255, 45, 123, 0.25), inset 0 0 30px rgba(255, 45, 123, 0.08);
}

.rr-zone-right {
    border-color: rgba(0, 229, 255, 0.2);
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.06), transparent);
    box-shadow: inset 0 0 30px rgba(0, 229, 255, 0.03);
}

.rr-zone-right:active {
    border-color: rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.25), inset 0 0 30px rgba(0, 229, 255, 0.08);
}

.rr-zone-up {
    border-color: rgba(118, 255, 3, 0.2);
    background: linear-gradient(135deg, rgba(118, 255, 3, 0.06), transparent);
    box-shadow: inset 0 0 30px rgba(118, 255, 3, 0.03);
}

.rr-zone-up:active {
    border-color: rgba(118, 255, 3, 0.5);
    box-shadow: 0 0 25px rgba(118, 255, 3, 0.25), inset 0 0 30px rgba(118, 255, 3, 0.08);
}

.rr-zone-down {
    border-color: rgba(255, 234, 0, 0.2);
    background: linear-gradient(135deg, rgba(255, 234, 0, 0.06), transparent);
    box-shadow: inset 0 0 30px rgba(255, 234, 0, 0.03);
}

.rr-zone-down:active {
    border-color: rgba(255, 234, 0, 0.5);
    box-shadow: 0 0 25px rgba(255, 234, 0, 0.25), inset 0 0 30px rgba(255, 234, 0, 0.08);
}

/* ============================================
   MEMORY FLASH
   ============================================ */
.mf-prompt {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 12px 20px;
    /* Removed large margin that pushed it down. Now sits just below HUD */
    margin-top: 5px;
    border-radius: 12px;
    flex-shrink: 0;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    margin-bottom: 8px;
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.mf-watching {
    color: var(--neon-yellow);
}

.mf-tapping {
    color: var(--neon-cyan);
}

.mf-flash-phase {
    justify-content: center;
    gap: 20px;
}

.mf-grid-phase {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}

.mf-flash-shape {
    animation: shape-enter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mf-grid-shape {
    animation: shape-enter 0.2s ease-out;
}

.mf-tapped {
    pointer-events: none;
}

.mf-correct {
    outline: 3px solid var(--neon-lime);
    outline-offset: 2px;
    filter: drop-shadow(0 0 12px rgba(118, 255, 3, 0.6)) drop-shadow(0 0 24px rgba(118, 255, 3, 0.3)) !important;
    animation: match-pop 0.3s ease-out;
    transform: scale(1.08);
}

@keyframes match-pop {
    50% {
        transform: scale(1.2)
    }
}

.mf-wrong {
    border: 3px solid var(--neon-red) !important;
    box-shadow: 0 0 20px rgba(255, 23, 68, 0.4) !important;
    opacity: 0.5;
}

.mf-reveal {
    border: 3px dashed var(--neon-yellow) !important;
    opacity: 0.5;
    animation: reveal-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes reveal-pulse {
    from {
        opacity: 0.3
    }

    to {
        opacity: 0.6
    }
}

/* ============================================
   GAME OVER
   ============================================ */
.gameover-panel {
    animation: float-in 0.5s ease-out;
}

.gameover-title {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--neon-red);
    text-shadow: 0 0 25px rgba(255, 23, 68, 0.3);
    margin-bottom: 6px;
}

.final-mode {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.final-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--neon-yellow);
    text-shadow: 0 0 12px rgba(255, 234, 0, 0.3);
    animation: title-pop 0.5s ease-out;
}

@keyframes title-pop {
    from {
        transform: scale(0.5);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.final-score-block {
    margin-bottom: 8px;
}

.final-score-label {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.final-score-value {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 25px rgba(0, 229, 255, 0.4);
    animation: score-count-in 0.6s ease-out;
}

@keyframes score-count-in {
    from {
        transform: scale(0.3);
        opacity: 0
    }

    to {
        transform: scale(1);
        opacity: 1
    }
}

.score-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.detail-item {
    text-align: center;
}

.detail-label {
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    display: block;
}

.detail-value {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-purple);
}

.new-best-badge {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px rgba(255, 234, 0, 0.4);
    margin-bottom: 8px;
    animation: badge-glow 1s ease-in-out infinite alternate;
}

.new-best-badge.hidden {
    display: none;
}

@keyframes badge-glow {
    from {
        opacity: 0.7;
        transform: scale(0.95)
    }

    to {
        opacity: 1;
        transform: scale(1.05)
    }
}

.reward-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.reward-btn {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.72rem;
    transition: transform 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.reward-btn small {
    color: var(--text-secondary);
    font-size: 0.58rem;
}

.reward-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.07);
}

.reward-btn:active {
    transform: scale(0.94);
}

.reward-btn.hidden {
    display: none;
}

.gameover-actions {
    margin-top: 4px;
}

.retry-btn {
    margin-bottom: 10px;
}

.gameover-sub-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.sub-action-btn {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 600;
    transition: transform 0.15s, color 0.15s;
}

.sub-action-btn:hover {
    transform: scale(1.05);
    color: var(--text-primary);
}

/* ============================================
   LEADERBOARD
   ============================================ */
.lb-panel {
    animation: float-in 0.5s ease-out;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 20px;
}

.lb-panel::-webkit-scrollbar {
    width: 4px;
}

.lb-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.lb-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.back-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    pointer-events: auto;
}

.back-btn:hover {
    transform: scale(1.1);
}

.lb-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.lb-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.lb-mode-tab {
    flex: 1;
    padding: 8px 4px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.lb-mode-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.lb-tabs {
    display: flex;
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.lb-tab {
    flex: 1;
    padding: 8px;
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}

.lb-tab.active {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.lb-content {
    min-height: 150px;
}

.lb-empty {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 30px 0;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 0.15s;
}

.lb-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.lb-row.lb-player {
    background: rgba(0, 229, 255, 0.07);
    border: 1px solid rgba(0, 229, 255, 0.12);
}

.lb-rank {
    font-size: 0.85rem;
    min-width: 32px;
    text-align: center;
}

.lb-name {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-date {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.lb-score {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--neon-cyan);
    min-width: 36px;
    text-align: right;
}

/* ============================================
   CUSTOMIZE
   ============================================ */
.custom-panel {
    animation: float-in 0.5s ease-out;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 20px;
}

.custom-section {
    margin-bottom: 20px;
}

.custom-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: left;
    text-transform: uppercase;
}

.theme-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.theme-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.theme-card:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.06);
}

.theme-card:active {
    transform: scale(0.97);
}

.theme-card.selected {
    border-color: var(--neon-cyan);
    background: rgba(0, 229, 255, 0.05);
}

.theme-card.locked {
    opacity: 0.45;
    cursor: default;
}

.theme-card.locked:hover {
    transform: none;
}

.theme-icon {
    font-size: 1.3rem;
}

.theme-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
}

.theme-lock {
    font-size: 0.65rem;
    color: var(--text-secondary);
}



/* ============================================
   AD OVERLAYS
   ============================================ */
.ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.ad-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ad-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    backdrop-filter: blur(20px);
    animation: float-in 0.4s ease-out;
}

.ad-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    background: rgba(255, 145, 0, 0.2);
    color: var(--neon-orange);
    border: 1px solid rgba(255, 145, 0, 0.25);
    margin-bottom: 16px;
}

.ad-placeholder {
    padding: 30px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.08);
    margin-bottom: 16px;
}

.ad-placeholder-icon {
    font-size: 2rem;
    margin-bottom: 6px;
}

.ad-placeholder-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.ad-placeholder-sub {
    font-size: 0.65rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 3px;
}

.ad-countdown {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.ad-countdown span {
    color: var(--neon-cyan);
    font-family: var(--font-mono);
    font-weight: 700;
}

.ad-skip-btn {
    padding: 10px 28px;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
    border: none;
    color: #fff;
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

.ad-skip-btn:hover {
    transform: scale(1.05);
}

.ad-skip-btn.hidden {
    display: none;
}

.reward-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--neon-yellow);
    margin-bottom: 12px;
}

.reward-progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.reward-progress {
    height: 100%;
    width: 0%;
    background: var(--neon-lime);
    border-radius: 3px;
    transition: width 0.1s;
    box-shadow: 0 0 8px rgba(118, 255, 3, 0.3);
}

/* ============================================
   TOASTS & EFFECTS
   ============================================ */
/* Achievement toast — at BOTTOM so it doesn't block gameplay */
.achievement-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 300;
    padding: 12px 20px;
    border-radius: 14px;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 234, 0, 0.2);
    backdrop-filter: blur(20px);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neon-yellow);
    text-shadow: 0 0 12px rgba(255, 234, 0, 0.3);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

.achievement-toast.visible {
    transform: translateX(-50%) translateY(0);
}

.achievement-toast.hidden {
    display: none;
}

.share-toast,
.ad-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    z-index: 300;
    padding: 10px 20px;
    border-radius: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: transform 0.3s, opacity 0.3s;
    opacity: 0;
}

.share-toast.visible,
.ad-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.screen-flash {
    position: fixed;
    inset: 0;
    background: rgba(255, 23, 68, 0.12);
    z-index: 100;
    pointer-events: none;
    animation: flash-fade 0.3s ease-out forwards;
}

@keyframes flash-fade {
    from {
        opacity: 1
    }

    to {
        opacity: 0
    }
}

.rule-change-flash {
    animation: rule-flash 0.5s ease-out;
}

@keyframes rule-flash {
    0% {
        transform: scale(1);
        color: var(--neon-yellow)
    }

    30% {
        transform: scale(1.12);
        color: var(--neon-red)
    }

    100% {
        transform: scale(1)
    }
}

.focus-mode .rule-text {
    color: var(--neon-red) !important;
    text-shadow: 0 0 25px rgba(255, 23, 68, 0.5) !important;
    animation: focus-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes focus-pulse {
    from {
        opacity: 0.8
    }

    to {
        opacity: 1
    }
}

.invert-mode .shape-arena,
.invert-mode .mf-arena {
    filter: invert(1) hue-rotate(180deg);
}

/* ============================================
   UTILITY & RESPONSIVE
   ============================================ */
.hidden {
    display: none !important;
}

@keyframes float-in {
    from {
        transform: translateY(25px) scale(0.96);
        opacity: 0
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2.6rem;
    }

    .title-snap {
        font-size: 2.8rem;
    }

    .title-mind {
        font-size: 1.8rem;
    }

    .glass-panel {
        padding: 24px 18px;
    }

    .rule-text {
        font-size: 1.2rem;
    }

    .stroop-word {
        font-size: 1.8rem;
    }

    .shape.size-small {
        width: 42px;
        height: 42px;
    }

    .shape.size-medium {
        width: 58px;
        height: 58px;
    }

    .shape.size-large {
        width: 76px;
        height: 76px;
    }

    .final-score-value {
        font-size: 2.5rem;
    }

    .rr-signal {
        font-size: 4rem;
    }

    .mode-card {
        padding: 10px 12px;
    }

    .mode-icon {
        font-size: 1.3rem;
    }

    .mode-name {
        font-size: 0.8rem;
    }
}

/* ============================================
   AD OVERLAYS
   ============================================ */
.ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

.ad-overlay.active {
    opacity: 1;
    visibility: visible;
}

.ad-content {
    width: 90%;
    max-width: 400px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.ad-badge {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
}

.ad-placeholder {
    width: 100%;
    height: 180px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px dashed var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ad-placeholder-icon {
    font-size: 3rem;
}

.ad-placeholder-text {
    font-weight: 700;
    color: var(--text-primary);
}

.ad-placeholder-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.ad-countdown {
    font-family: var(--font-mono);
    color: var(--neon-cyan);
    font-size: 0.9rem;
}

.ad-skip-btn {
    margin-top: 10px;
    background: transparent;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 10px 30px;
    border-radius: 30px;
    font-weight: 800;
    cursor: pointer;
}

.reward-progress-bar {
    width: 80%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.reward-progress {
    height: 100%;
    background: var(--neon-lime);
    width: 0%;
    transition: width 0.1s linear;
}

@media (min-width: 768px) {

    .shape-arena,
    .mf-arena {
        max-width: 500px;
    }

    .rr-zones {
        max-width: 500px;
    }
}

/* Background Patterns */
body.bg-dots {
    background-image: radial-gradient(var(--text-secondary) 1px, transparent 1px);
    background-size: 24px 24px;
    background-color: var(--bg-deep);
}

body.bg-grid {
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(0, 255, 213, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 255, 213, 0.05) 1px, transparent 1px);
    background-color: var(--bg-deep);
}

body.bg-dots .glass-panel,
body.bg-grid .glass-panel {
    background: var(--glass-bg);
    border-color: var(--glass-border);
}

body.bg-dots #bg-canvas,
body.bg-grid #bg-canvas {
    opacity: 0.3;
    /* Tone down particles on patterns */
}

/* ============================================
   SETTINGS SCREEN
   ============================================ */
.settings-panel {
    padding: 24px 20px;
    max-width: 400px;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 10px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.setting-group label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.setting-row span {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.setting-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 8px 0;
}

/* Settings action buttons */
.settings-action-btn {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-align: left;
    cursor: pointer;
    margin-bottom: 8px;
    transition: transform 0.12s, background 0.12s, border-color 0.12s;
    touch-action: none;
}

.settings-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.01);
}

.settings-action-btn:active {
    transform: scale(0.97);
}

.settings-danger-btn {
    border-color: rgba(255, 23, 68, 0.2);
    color: var(--neon-red);
}

.settings-danger-btn:hover {
    border-color: rgba(255, 23, 68, 0.4);
    background: rgba(255, 23, 68, 0.05);
}

/* Volume Slider */
.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}

.vol-icon {
    font-size: 1.1rem;
    opacity: 0.8;
}

#volume-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    outline: none;
}

#volume-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--neon-cyan);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--neon-purple);
    box-shadow: 0 0 10px rgba(213, 0, 249, 0.4);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Premium Wide Button */
.premium-wide-btn {
    width: 100%;
    padding: 16px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
}

.setting-footer {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.version-id {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.dev-info {
    font-size: 0.58rem;
    color: var(--text-secondary);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============ LEVEL UP OVERLAY ============ */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#countdown-text {
    z-index: 1001; /* Above the panel */
}
.levelup-content {
    text-align: center;
    animation: levelup-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes levelup-pop {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.levelup-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px var(--neon-purple));
}

#levelup-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--neon-yellow);
    text-shadow: 0 0 20px rgba(255, 234, 0, 0.5);
    margin: 0;
}

#levelup-desc {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    margin-top: 10px;
    text-transform: uppercase;
}

/* ============ MEMORY FLASH ENHANCEMENTS ============ */
.mf-lives {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
    justify-content: center;
}

.heart {
    font-size: 1.5rem;
    filter: grayscale(1) opacity(0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s;
}

.heart.active {
    filter: grayscale(0) opacity(1);
    transform: scale(1.1);
    animation: heart-pulse 2s infinite;
}

@keyframes heart-pulse {
    0% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1.1);
    }
}

.heart.lost {
    animation: heart-break 0.5s forwards;
}

@keyframes heart-break {
    0% {
        transform: scale(1.2);
    }

    50% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.mf-actions {
    margin-bottom: 5px;
}

.hint-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--neon-cyan);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.hint-btn:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
}

.hint-btn:active {
    transform: translateY(0);
}

.hint-btn:disabled {
    opacity: 0.3;
    cursor: default;
    filter: grayscale(1);
}

/* ============ COMING SOON LEADERBOARD ============ */
.coming-soon-overlay {
    padding: 40px 20px;
    text-align: center;
}

.cs-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.coming-soon-overlay h3 {
    font-size: 1.5rem;
    color: var(--neon-cyan);
    letter-spacing: 0.1em;
    margin-bottom: 5px;
}

.coming-soon-overlay p {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.coming-soon-overlay small {
    display: block;
    margin-top: 15px;
    opacity: 0.5;
    font-size: 0.7rem;
}

/* Daily UI Updates */
.daily-target {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--neon-yellow);
    margin-top: 4px;
}

.daily-info {
    margin-top: 6px;
    margin-bottom: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.daily-btn.daily-beaten {
    border-color: var(--neon-yellow);
    box-shadow: 0 0 15px rgba(255, 234, 0, 0.3);
}

/* Reverse Reflex Upgrades */
#rr-signal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    background: rgba(0, 229, 255, 0.05);
    border: 3px solid rgba(0, 229, 255, 0.2);
    border-radius: 20px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.6), 0 0 5px white;
    -webkit-text-stroke: 5px var(--neon-cyan);
    paint-order: markers fill stroke;
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.1) inset;
}

.rr-zone-label {
    font-weight: 900;
    font-size: 2.8rem;
    -webkit-text-stroke: 2px white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}


/* Difficulty Picker */
.difficulty-picker {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.diff-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 10px 0;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
}

.diff-btn.active {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.2);
}

/* ============================================
   ACCESSIBILITY: Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .timer-bar {
        transition: width 0.01ms linear !important;
    }
}