/* ==========================================================================
   Orbit Fusion - Style System
   ========================================================================== */

:root {
    --bg-color: #060913;
    --panel-bg: rgba(13, 19, 36, 0.82);
    --border-glow: rgba(148, 163, 184, 0.14);
    
    /* Pleasant Bioluminescent Cosmic Palette */
    --cyan: #22d3ee;
    --magenta: #f43f85;
    --yellow: #fbbf24;
    --green: #34d399;
    --purple: #a78bfa;
    --white: #f8fafc;
    --red: #f87171;
    
    /* Font System */
    --font-title: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Reset & Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-body);
    color: #ffffff;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Typography Mapping for Premium Interface Legibility */
.game-title, 
.game-over-title, 
.level-up-content h2, 
.neon-text-magenta,
.hud-value,
.best-score-val,
.go-stat-value,
.combo-badge,
.high-score-badge {
    font-family: var(--font-title);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #0d1326 0%, #050711 100%);
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* ==========================================================================
   HUD Layout (Heads Up Display)
   ========================================================================== */

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to canvas when clicking HUD */
}

/* Allow click on sound button */
#sound-toggle {
    pointer-events: auto;
}

.hud-item {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    padding: 10px 18px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.hud-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.68);
    margin-bottom: 2px;
}

.hud-value {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Crisp text accents without glow */
.neon-cyan {
    color: var(--cyan);
    text-shadow: none;
}

.neon-magenta {
    color: var(--magenta);
    text-shadow: none;
}

.neon-yellow {
    color: var(--yellow);
    text-shadow: none;
}

/* Score Area */
.score-container {
    position: relative;
    min-width: 110px;
}

.combo-badge {
    position: absolute;
    right: -10px;
    top: -10px;
    background: var(--magenta);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 0 12px rgba(255, 0, 127, 0.5);
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    animation: combo-pop 0.3s ease, bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite alternate;
}

/* Combo Tier Variations */
.combo-tier-1 {
    background: linear-gradient(135deg, #ffdd00, #ff8800);
    color: #050508;
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.58);
}

.combo-tier-2 {
    background: linear-gradient(135deg, #ff5e00, #ff007f);
    color: #ffffff;
    box-shadow: 0 0 18px rgba(255, 94, 0, 0.64);
}

.combo-tier-3 {
    background: linear-gradient(135deg, #ff007f, #00f0ff);
    color: #050508;
    box-shadow: 0 0 22px rgba(0, 240, 255, 0.7);
    animation: combo-pop 0.3s ease, pulse-cyan-glow 0.6s infinite alternate, bounce 0.4s infinite alternate;
}

@keyframes combo-pop {
    0% { transform: scale(1.6); }
    100% { transform: scale(1.0); }
}

@keyframes pulse-cyan-glow {
    from { box-shadow: 0 0 15px rgba(0, 240, 255, 0.56); }
    to { box-shadow: 0 0 25px rgba(255, 0, 127, 0.7); }
}

/* Settings UI Controls */
.settings-container {
    width: 100%;
    margin-top: 12px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 14px;
}

.setting-label {
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.setting-btn {
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.setting-btn:hover {
    background: var(--cyan);
    color: #050508;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.setting-btn:active {
    transform: scale(0.95);
}

/* Level Area */
.level-container {
    width: 200px;
    align-items: center;
}

.level-badge {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.xp-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.xp-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--magenta), var(--cyan));
    box-shadow: 0 0 8px var(--magenta);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stability Area */
.stability-container {
    width: 180px;
}

.stability-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.stability-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.stability-bar-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--yellow), #ff5e00);
    box-shadow: 0 0 8px var(--yellow);
    transition: width 0.2s ease, background 0.3s ease;
}

.stability-bar-fill.critical {
    background: linear-gradient(90deg, var(--red), #b30000);
    box-shadow: 0 0 8px var(--red);
    animation: pulse-danger 0.5s infinite alternate;
}

/* Sound Button */
.sound-toggle-btn {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    color: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.sound-toggle-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sound-toggle-btn:active {
    transform: scale(0.95);
}

/* HUD Controls Group */
.hud-controls {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.pause-toggle-btn {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    color: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.pause-toggle-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.pause-toggle-btn:active {
    transform: scale(0.95);
}

.theme-toggle-btn {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    color: rgba(255, 255, 255, 0.7);
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Overlay Panels (Start & Game Over Screens)
   ========================================================================== */

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    background: rgba(5, 5, 8, 0.55);
    transition: opacity 0.4s ease, visibility 0.4s ease;
    overflow-y: auto; /* Permite scroll-ul dacă ecranul este mic pe verticală */
    padding: 20px 10px;
}

.glass-panel {
    width: 100%;
    max-width: 440px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transform: scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto; /* Aliniază pe centru în mod flexibil pe verticală */
}

.overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.overlay.hidden .glass-panel {
    transform: scale(0.85);
}

/* Game Title */
.game-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 8px;
}

.neon-text {
    color: #ffffff;
    text-shadow: none;
}

.accent-text {
    color: var(--cyan);
}

.game-tagline {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 24px;
    font-weight: 300;
}

/* Tutorial Box & Steps List */
.tutorial-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    margin-bottom: 24px;
    text-align: left;
}

.tutorial-box h3 {
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    color: var(--magenta);
    text-transform: uppercase;
    margin-bottom: 15px;
    text-align: center;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-1 {
    background: rgba(0, 240, 255, 0.1);
    color: var(--cyan);
    border: 1px solid var(--cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.step-2 {
    background: rgba(255, 0, 127, 0.1);
    color: var(--magenta);
    border: 1px solid var(--magenta);
    box-shadow: 0 0 8px rgba(255, 0, 127, 0.3);
}

.step-3 {
    background: rgba(255, 221, 0, 0.1);
    color: var(--yellow);
    border: 1px solid var(--yellow);
    box-shadow: 0 0 8px rgba(255, 221, 0, 0.3);
}

.step-item p {
    font-size: 0.75rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.85);
}

.control-tip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
}

.control-tip p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.85);
}

.control-tip strong {
    color: var(--cyan);
    text-shadow: none;
}

.pause-guide {
    margin-top: 10px;
    margin-bottom: 24px;
}

/* Best Score UI */
.stats-box {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

.best-score-label {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.62);
    margin-bottom: 4px;
}

.best-score-val {
    font-size: 1.8rem;
    font-weight: 700;
}

/* History Box */
.history-box {
    width: 100%;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 12px;
}

.history-box h3 {
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--cyan);
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: left;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.history-item:last-child {
    border-bottom: none;
}

.hist-date {
    color: rgba(255, 255, 255, 0.6);
    font-family: monospace;
}

.hist-level {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.hist-score {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Action Button */
.action-btn {
    width: 100%;
    padding: 14px 32px;
    margin-top: 12px;
    background: linear-gradient(115deg, #0ea5e9 0%, #6366f1 52%, #ec4899 100%);
    border: none;
    border-radius: 100px;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    font-family: var(--font-title);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(255, 0, 127, 0.18);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 240, 255, 0.28);
}

.action-btn:active {
    transform: translateY(1px);
}

/* ==========================================================================
   Game Over Screen Styles
   ========================================================================== */

.game-over-title {
    font-size: 2rem;
    letter-spacing: 3px;
    margin-bottom: 6px;
}

.neon-red-text {
    color: var(--red);
    text-shadow: none;
}

.game-over-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.68);
    margin-bottom: 30px;
}

.game-over-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 24px;
    gap: 15px;
}

.go-stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.go-stat-label {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.62);
    margin-bottom: 6px;
}

.go-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.high-score-badge {
    background: linear-gradient(135deg, var(--yellow), #ff5e00);
    color: #000000;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    letter-spacing: 1px;
    margin-bottom: 30px;
    box-shadow: 0 0 15px rgba(255, 221, 0, 0.5);
    animation: flash 0.8s ease-in-out infinite alternate;
}

.restart-btn {
    background: linear-gradient(135deg, #12c2e9 0%, #c471ed 50%, #f64f59 100%);
    box-shadow: 0 8px 25px rgba(196, 113, 237, 0.25);
}

/* ==========================================================================
   Level Up Banner Overlay
   ========================================================================== */

.level-up-banner {
    position: absolute;
    top: 30%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.level-up-content {
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 0, 127, 0.3);
    padding: 20px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(255, 0, 127, 0.25),
                0 0 30px rgba(255, 0, 127, 0.15);
    transform: scale(1);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.level-up-banner.hidden {
    opacity: 0;
    transform: scale(0.7) translateY(-20px);
}

.neon-text-magenta {
    color: var(--magenta);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: none;
    margin-bottom: 4px;
}

#level-up-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes bounce {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-5px);
    }
}

@keyframes flash {
    from {
        opacity: 0.8;
        transform: scale(1);
    }
    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes pulse-danger {
    from {
        opacity: 0.8;
        filter: drop-shadow(0 0 2px var(--red));
    }
    to {
        opacity: 1;
        filter: drop-shadow(0 0 10px var(--red));
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive Overrides */
@media (max-width: 600px) {
    #hud {
        top: 8px;
        left: 6px;
        right: 6px;
        gap: 4px;
        flex-wrap: nowrap; /* Keep HUD on one line, use flexible sizing */
    }
    
    .hud-item {
        padding: 4px 6px;
        border-radius: 8px;
        flex: 1;
        min-width: 0; /* Let it shrink on narrow screens without overflow */
        overflow: hidden;
    }
    
    .score-container {
        min-width: 55px;
    }
    
    .session-container {
        min-width: 55px;
    }
    
    .level-container {
        flex: 1.1;
        min-width: 60px;
    }
    
    .stability-container {
        flex: 1.1;
        min-width: 65px;
    }
    
    .hud-label {
        font-size: 0.48rem;
        letter-spacing: 0px;
        margin-bottom: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .hud-value {
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .stability-header {
        flex-direction: column; /* Stack label and value vertically on mobile */
        align-items: flex-start;
        gap: 0px;
    }
    
    .level-badge {
        flex-direction: column; /* Stack label and value vertically on mobile */
        align-items: flex-start;
        gap: 0px;
    }
    
    .xp-bar-container {
        height: 3px;
        margin-top: 2px;
    }
    
    .stability-bar-container {
        height: 3px;
        margin-top: 2px;
    }
    
    .hud-controls {
        gap: 3px;
        flex-shrink: 0;
    }
    
    .sound-toggle-btn, .pause-toggle-btn, .theme-toggle-btn {
        padding: 5px;
        width: 32px;
        height: 32px;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .sound-toggle-btn svg, .pause-toggle-btn svg, .theme-toggle-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .overlay {
        padding: 10px 8px;
        background: rgba(5, 5, 8, 0.85);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
    }
    
    .glass-panel {
        padding: 22px 14px;
        border-radius: 20px;
        width: 100%;
        max-width: 100%;
    }
    
    .setting-row {
        padding: 8px 10px;
        gap: 6px;
    }

    .setting-label {
        font-size: 0.65rem;
        letter-spacing: 0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .setting-btn {
        padding: 5px 10px;
        font-size: 0.7rem;
        flex-shrink: 0;
    }
    
    .game-title {
        font-size: 1.6rem;
        letter-spacing: 2px;
    }
    
    .game-tagline {
        font-size: 0.8rem;
        margin-bottom: 16px;
    }
    
    .tutorial-box {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .step-item {
        padding: 6px 10px;
        gap: 8px;
    }
    
    .step-num {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
    }
    
    .step-item p {
        font-size: 0.7rem;
    }
    
    .control-tip {
        padding: 8px 12px;
        margin-bottom: 16px;
    }
    
    .control-tip p {
        font-size: 0.7rem;
    }
    
    .progression-btn-row {
        gap: 6px;
        margin-top: 10px;
        margin-bottom: 16px;
    }

    .sub-action-btn {
        padding: 7px 6px;
        font-size: 0.7rem;
    }

    .action-btn {
        padding: 12px 24px;
        font-size: 0.9rem;
        margin-top: 12px;
    }
    
    .stats-box {
        margin-bottom: 16px;
    }
    
    .best-score-val {
        font-size: 1.4rem;
    }
    
    .history-box {
        padding: 8px;
        margin-bottom: 16px;
    }
    
    .history-item {
        font-size: 0.7rem;
    }
}

/* ==========================================================================
   Sistem Teme: LIGHT THEME Overrides
   ========================================================================== */

body.light-theme {
    --bg-color: #eef3f9;
    --panel-bg: rgba(255, 255, 255, 0.90);
    --border-glow: rgba(15, 23, 42, 0.09);
    
    /* Pleasant, high-contrast jewel & pastel-sky tones for Light Mode */
    --cyan: #0284c7;
    --magenta: #db2777;
    --yellow: #d97706;
    --green: #059669;
    --purple: #7c3aed;
    --white: #0f172a;
    --red: #dc2626;
    
    color: #0f172a;
}

body.light-theme #game-container {
    background: radial-gradient(circle at center, #f8fafc 0%, #e2eaf5 100%);
}

body.light-theme .hud-item {
    color: #1a1a24;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

body.light-theme .hud-label {
    color: rgba(0, 0, 0, 0.5);
    font-weight: 600; /* Text mai vizibil */
}

body.light-theme .glass-panel {
    color: #1a1a24;
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.1), 
                inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

body.light-theme .game-title {
    color: #1a1a24;
    text-shadow: none; /* Fără străluciri lăptoase greu de citit */
}

body.light-theme .game-tagline {
    color: rgba(0, 0, 0, 0.65);
    font-weight: 500;
}

body.light-theme .tutorial-box {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .tutorial-box h3 {
    font-weight: 800;
}

body.light-theme .step-item {
    background: rgba(0, 0, 0, 0.03); /* Carduleț ușor mai întunecat pentru contrast */
    border-color: rgba(0, 0, 0, 0.04);
}

body.light-theme .step-item p {
    color: #1e2028;
    font-weight: 500;
}

body.light-theme .step-item p strong {
    color: #000000;
    font-weight: 700;
}

body.light-theme .control-tip {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .control-tip p {
    color: #1e2028;
    font-weight: 500;
}

body.light-theme .control-tip strong {
    color: var(--cyan);
    text-shadow: none;
}

body.light-theme .best-score-label {
    color: rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

body.light-theme .history-box {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .hist-date {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .hist-level {
    color: #1a1a24;
}

body.light-theme .hist-score {
    color: #1a1a24;
}

/* Butoanele de control (Sound / Pause / Theme) în modul Light */
body.light-theme .sound-toggle-btn,
body.light-theme .pause-toggle-btn,
body.light-theme .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.85);
    color: #2c2c35;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.light-theme .sound-toggle-btn:hover,
body.light-theme .pause-toggle-btn:hover,
body.light-theme .theme-toggle-btn:hover {
    color: #000000;
    border-color: rgba(0, 0, 0, 0.25);
    background: #ffffff;
}

/* Redefinire umbre text / neon în modul Light pentru contrast mărit */
body.light-theme .neon-cyan {
    text-shadow: none;
}

body.light-theme .neon-magenta {
    text-shadow: none;
}

body.light-theme .neon-yellow {
    text-shadow: none;
}

body.light-theme .neon-red-text {
    text-shadow: none;
}

body.light-theme .neon-text-magenta {
    text-shadow: none;
}

/* Ecranul Level Up în modul Light */
body.light-theme .level-up-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(207, 0, 106, 0.4);
    box-shadow: 0 10px 40px rgba(207, 0, 106, 0.15);
}

body.light-theme #level-up-text {
    color: #1a1a24;
}

/* Scrollbar personalizat în modul Light */
body.light-theme ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

body.light-theme .xp-bar-container,
body.light-theme .stability-bar-container {
    background: rgba(0, 0, 0, 0.08);
}

/* Ecranul Game Over în modul Light */
body.light-theme .game-over-subtitle {
    color: rgba(0, 0, 0, 0.6);
    font-weight: 500;
}

body.light-theme .go-stat-item {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .go-stat-label {
    color: rgba(0, 0, 0, 0.5);
    font-weight: 600;
}

body.light-theme .high-score-badge {
    box-shadow: 0 4px 12px rgba(176, 130, 0, 0.3);
}

/* ==========================================================================
   Milestone 3: R2 Healthy Mindset & Anti-Burnout Framework Styles
   ========================================================================== */

/* 1. HUD Session Time Indicator */
.session-container {
    min-width: 90px;
}

.neon-white {
    color: #ffffff;
    text-shadow: none;
}

/* 2. Non-Intrusive Session Rest Reminder Banner */
.rest-reminder-banner {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 520px;
    z-index: 50;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rest-reminder-banner.hidden {
    opacity: 0;
    transform: translate(-50%, -30px);
    pointer-events: none;
}

.rest-reminder-content {
    background: rgba(10, 15, 28, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 20px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 12px 35px rgba(0, 240, 255, 0.25),
                inset 0 1px 1px rgba(255, 255, 255, 0.15);
    animation: bannerPulse 3s infinite alternate;
}

@keyframes bannerPulse {
    from { border-color: rgba(0, 240, 255, 0.3); box-shadow: 0 12px 35px rgba(0, 240, 255, 0.2); }
    to { border-color: rgba(255, 0, 127, 0.4); box-shadow: 0 12px 40px rgba(255, 0, 127, 0.3); }
}

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

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

.rest-title {
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.rest-text {
    font-size: 0.78rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.85);
}

.rest-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.rest-btn {
    padding: 8px 14px;
    border-radius: 12px;
    font-family: var(--font-title);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.rest-btn-primary {
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    color: #050508;
    box-shadow: 0 4px 12px rgba(0, 240, 255, 0.2);
}

.rest-btn-primary:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 16px rgba(0, 240, 255, 0.34);
}

.rest-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.rest-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

/* 3. Zen / Flow Mode Selectors & Visual Aura */
.mode-selector-container {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.mode-selector-title {
    align-self: center;
}

.mode-selector {
    display: flex;
    gap: 10px;
    width: 100%;
}

.mode-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mode-btn .mode-name {
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.84);
    margin-bottom: 3px;
    letter-spacing: 1px;
}

.mode-btn .mode-desc {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.66);
}

.mode-btn:hover {
    border-color: rgba(0, 240, 255, 0.4);
    background: rgba(0, 240, 255, 0.06);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(170, 0, 255, 0.15));
    border: 1px solid var(--cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.mode-btn.active .mode-name {
    color: var(--cyan);
    text-shadow: none;
}

.mode-btn.active .mode-desc {
    color: rgba(255, 255, 255, 0.8);
}

/* Zen Mode Serene Body Atmosphere */
body.zen-mode:not(.light-theme) #game-container {
    background: radial-gradient(circle at center, #071929 0%, #030914 100%);
}

body.light-theme.zen-mode #game-container {
    background: radial-gradient(circle at center, #f0f9ff 0%, #dff0fa 100%);
}

/* 4. Pause Screen Breathing & Mindfulness Visualizer Widget */
.breathing-widget-container {
    width: 100%;
    background: rgba(0, 240, 255, 0.03);
    border: 1px solid rgba(0, 240, 255, 0.1);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.breathing-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.breathing-title {
    font-family: var(--font-title);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--cyan);
}

.breathing-subtitle {
    font-size: 0.62rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.68);
    font-weight: 500;
}

.breathing-visualizer {
    width: 110px;
    height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin: 8px 0;
}

.breathing-ring-outer {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid var(--cyan);
    background: radial-gradient(circle, rgba(0, 240, 255, 0.15) 0%, rgba(170, 0, 255, 0.05) 70%, transparent 100%);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2), inset 0 0 15px rgba(0, 240, 255, 0.14);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s linear, border-color 0.4s ease, box-shadow 0.4s ease;
    transform: scale(0.8);
}

.breathing-ring-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.breathing-phase-text {
    font-family: var(--font-title);
    font-size: 0.72rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: none;
}

.breathing-timer-text {
    font-family: var(--font-title);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cyan);
}

.breathing-subtext {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.3;
    text-align: center;
}

/* Breathing Phase State Animations */
.breathing-ring-outer.inhale {
    border-color: var(--cyan);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.42), inset 0 0 20px rgba(0, 240, 255, 0.2);
}

.breathing-ring-outer.hold {
    border-color: var(--yellow);
    box-shadow: 0 0 25px rgba(255, 221, 0, 0.42), inset 0 0 20px rgba(255, 221, 0, 0.2);
}

.breathing-ring-outer.exhale {
    border-color: var(--magenta);
    box-shadow: 0 0 25px rgba(255, 0, 127, 0.42), inset 0 0 20px rgba(255, 0, 127, 0.2);
}

.breathing-ring-outer.rest {
    border-color: var(--green);
    box-shadow: 0 0 25px rgba(0, 255, 102, 0.42), inset 0 0 20px rgba(0, 255, 102, 0.2);
}

/* 5. Positive Reinforcement Run Summary Screen */
.summary-panel {
    max-width: 480px;
}

.positive-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    margin-bottom: 20px;
}

.positive-stats-grid .go-stat-item {
    padding: 10px 8px;
    border-radius: 14px;
}

.positive-stats-grid .go-stat-label {
    font-size: 0.55rem;
    letter-spacing: 1px;
}

.positive-stats-grid .go-stat-value {
    font-size: 1.3rem;
}

.highlight-stat {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(170, 0, 255, 0.12)) !important;
    border: 1px solid rgba(0, 240, 255, 0.4) !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
    grid-column: span 3;
}

.highlight-stat .go-stat-value {
    font-size: 1.9rem;
}

.positive-feedback-box {
    width: 100%;
    background: rgba(0, 255, 102, 0.05);
    border: 1px solid rgba(0, 255, 102, 0.2);
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
    text-align: center;
}

.positive-feedback-box p {
    font-size: 0.78rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

/* 6. Light Theme Overrides for R2 Elements */
body.light-theme .rest-reminder-content {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 130, 163, 0.3);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.1);
}

body.light-theme .rest-title {
    color: var(--cyan);
}

body.light-theme .rest-text {
    color: #1a1a24;
}

body.light-theme .rest-btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a24;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .mode-btn {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .mode-btn .mode-name {
    color: #1a1a24;
}

body.light-theme .mode-btn .mode-desc {
    color: rgba(0, 0, 0, 0.55);
}

body.light-theme .mode-btn.active {
    background: rgba(0, 130, 163, 0.08);
    border-color: var(--cyan);
}

body.light-theme .breathing-widget-container {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .breathing-subtext {
    color: rgba(0, 0, 0, 0.7);
}

body.light-theme .positive-feedback-box {
    background: rgba(0, 140, 55, 0.06);
    border-color: rgba(0, 140, 55, 0.25);
}

body.light-theme .positive-feedback-box p {
    color: #1a1a24;
}

body.light-theme .neon-white {
    color: #1a1a24;
    text-shadow: none;
}

/* ==========================================================================
   Milestone 4 (R3): Progression & Persistence System Styles
   ========================================================================== */

/* Toast Notification System */
.toast-container {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(12, 14, 28, 0.92);
    border: 1px solid var(--cyan);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 280px;
    max-width: 420px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: toast-enter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}

.toast-icon {
    font-size: 1.8rem;
    line-height: 1;
    filter: none;
}

.toast-content {
    display: flex;
    flex-direction: column;
}

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

.toast-message {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 2px;
}

@keyframes toast-enter {
    0% { opacity: 0; transform: translateY(-30px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal Panels */
.modal-overlay {
    z-index: 1000;
}

.modal-panel {
    width: 92%;
    max-width: 580px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    border-radius: 20px;
}

.modal-panel .modal-header {
    position: relative;
    width: 100%;
    padding-right: 54px;
}

.modal-panel .close-btn {
    position: absolute;
    top: -8px;
    right: 0;
    width: 44px;
    min-width: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.modal-subtitle {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: -6px;
}

.close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--magenta);
}

/* Badges Grid */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.badge-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.3s ease;
}

.badge-card.unlocked {
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.1);
}

.badge-card.locked {
    opacity: 0.55;
    filter: grayscale(0.8);
}

.badge-card-icon {
    font-size: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.badge-card-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.badge-card-name {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
}

.badge-card.unlocked .badge-card-name {
    color: var(--cyan);
}

.badge-card-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
    line-height: 1.3;
}

.badge-card-status {
    margin-top: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 8px;
    align-self: flex-start;
    text-transform: uppercase;
}

.badge-card.unlocked .badge-card-status {
    background: rgba(0, 255, 102, 0.15);
    color: var(--green);
    border: 1px solid rgba(0, 255, 102, 0.3);
}

.badge-card.locked .badge-card-status {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.4);
}

/* Stats Grid */
.stats-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-icon {
    font-size: 1.6rem;
    margin-bottom: 6px;
}

.stat-card-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.stat-card-value {
    font-family: var(--font-title);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Themes Grid */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.theme-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.theme-card.active {
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
    background: rgba(0, 240, 255, 0.06);
}

.theme-card.locked {
    opacity: 0.6;
    filter: grayscale(0.5);
}

.theme-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-card-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
}

.theme-card-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.theme-card.active .theme-card-badge {
    background: var(--cyan);
    color: #050508;
}

.theme-card.unlocked:not(.active) .theme-card-badge {
    background: rgba(0, 255, 102, 0.15);
    color: var(--green);
}

.theme-card.locked .theme-card-badge {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

.theme-swatches {
    display: flex;
    gap: 6px;
    align-items: center;
}

.swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.theme-card-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.theme-select-btn {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.theme-card.unlocked .theme-select-btn {
    background: linear-gradient(135deg, var(--cyan), var(--purple));
    color: #ffffff;
}

.theme-card.active .theme-select-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    cursor: default;
}

.theme-card.locked .theme-select-btn {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.3);
    cursor: not-allowed;
}

.progression-btn-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
    margin-bottom: 20px;
}

.sub-action-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.sub-action-btn:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--cyan);
}

/* Light Theme overrides for R3 elements */
body.light-theme .badge-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .badge-card-name {
    color: #1a1a24;
}

body.light-theme .badge-card-desc {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .stat-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .stat-card-label {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .theme-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .theme-card-title {
    color: #1a1a24;
}

body.light-theme .theme-card-desc {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .sub-action-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
    color: #1a1a24;
}

body.light-theme .modal-subtitle {
    color: rgba(0, 0, 0, 0.6);
}

body.light-theme .close-btn {
    color: rgba(0, 0, 0, 0.5);
}

/* ========================================================================== 
   Responsive polish & input ergonomics (v2)
   ========================================================================== */

html,
body {
    min-height: 100%;
    min-height: 100dvh;
    overscroll-behavior: none;
}

button,
summary {
    font: inherit;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}

#game-canvas {
    touch-action: none;
}

#hud {
    top: max(20px, env(safe-area-inset-top));
    left: 50%;
    right: auto;
    width: calc(100% - 40px);
    max-width: 1200px;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: minmax(110px, 0.75fr) minmax(180px, 1fr) minmax(180px, 1fr) minmax(110px, 0.75fr) auto;
    gap: 12px;
}

.hud-item {
    min-height: 64px;
    justify-content: center;
}

.hud-controls {
    align-self: stretch;
}

.sound-toggle-btn,
.pause-toggle-btn,
.theme-toggle-btn,
.lang-toggle-btn {
    width: 48px;
    min-width: 48px;
    min-height: 48px;
}

.overlay {
    padding:
        max(20px, env(safe-area-inset-top))
        max(12px, env(safe-area-inset-right))
        max(20px, env(safe-area-inset-bottom))
        max(12px, env(safe-area-inset-left));
}

.start-panel {
    max-width: 720px;
    padding: 30px;
}

.start-panel .game-tagline {
    margin-bottom: 18px;
}

.start-panel .mode-selector-container {
    margin-bottom: 14px;
}

.start-panel > .action-btn {
    margin: 0 0 14px;
    min-height: 52px;
}

.tutorial-box {
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
}

.tutorial-box summary {
    position: relative;
    padding: 13px 46px 13px 18px;
    color: var(--magenta);
    cursor: pointer;
    font-family: var(--font-title);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    list-style: none;
    text-align: left;
}

.tutorial-box summary::-webkit-details-marker {
    display: none;
}

.tutorial-box summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    color: var(--cyan);
    font-size: 1.25rem;
    line-height: 1;
}

.tutorial-box[open] summary::after {
    content: "−";
}

.tutorial-content {
    padding: 0 16px 14px;
}

.start-panel .steps-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.start-panel .step-item {
    align-items: flex-start;
    height: 100%;
    padding: 10px;
}

.start-panel .step-item p {
    text-align: left;
}

.start-panel .control-tip {
    margin: 0;
    padding: 10px 12px;
}

.start-panel .stats-box {
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 6px;
}

.start-panel .best-score-val {
    font-size: 1.45rem;
}

.start-panel .history-box {
    max-height: 112px;
    overflow-y: auto;
    margin: 0 0 8px;
}

.start-panel .progression-btn-row {
    margin: 6px 0 0;
}

.pause-panel {
    max-width: 760px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    grid-template-areas:
        "title title"
        "tagline tagline"
        "guide guide"
        "settings breathing"
        "resume resume";
    gap: 12px 18px;
    padding: 26px;
}

.pause-panel > .game-title {
    grid-area: title;
    margin: 0;
}

.pause-panel > .game-tagline {
    grid-area: tagline;
    margin: -6px 0 0;
}

.pause-panel > .pause-guide {
    grid-area: guide;
    margin: 0;
}

.pause-panel > .settings-container {
    grid-area: settings;
    align-self: stretch;
    justify-content: center;
    margin: 0;
}

.pause-panel > .breathing-widget-container {
    grid-area: breathing;
    align-self: stretch;
    justify-content: center;
    margin: 0;
}

.pause-panel > #resume-btn {
    grid-area: resume;
    margin-top: 2px;
}

.sub-action-btn,
.rest-btn,
.setting-btn,
.theme-select-btn,
.close-btn {
    min-height: 44px;
}

.touch-controls {
    display: none;
    position: absolute;
    z-index: 12;
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    justify-content: space-between;
    pointer-events: none;
}

.touch-control-btn {
    width: 88px;
    min-height: 62px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 240, 255, 0.45);
    border-radius: 18px;
    background: rgba(8, 12, 24, 0.78);
    color: #ffffff;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
    pointer-events: auto;
    touch-action: none;
}

.touch-control-btn:last-child {
    border-color: rgba(255, 0, 127, 0.5);
}

.touch-control-btn:active,
.touch-control-btn.is-active {
    transform: scale(0.94);
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.22);
}

.touch-key {
    color: var(--cyan);
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 800;
}

.touch-control-btn:last-child .touch-key {
    color: var(--magenta);
}

.touch-label {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 1px;
}

body.light-theme .touch-control-btn {
    background: rgba(255, 255, 255, 0.84);
    color: #111827;
    border-color: rgba(0, 130, 163, 0.5);
}

body.light-theme .touch-label {
    color: rgba(17, 24, 39, 0.7);
}

@media (max-width: 800px), (pointer: coarse) {
    #hud {
        top: max(8px, env(safe-area-inset-top));
        left: max(6px, env(safe-area-inset-left));
        right: max(6px, env(safe-area-inset-right));
        width: auto;
        max-width: none;
        transform: none;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
    }

    .hud-item {
        width: auto;
        min-width: 0;
        min-height: 48px;
        padding: 5px 7px;
        overflow: hidden;
    }

    .score-container,
    .session-container,
    .level-container,
    .stability-container {
        width: auto;
        min-width: 0;
    }

    .hud-label {
        max-width: 100%;
        font-size: 0.5rem;
        letter-spacing: 0.2px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

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

    .level-badge,
    .stability-header {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 0;
    }

    .xp-bar-container,
    .stability-bar-container {
        margin-top: 3px;
    }

    .stability-container .hud-label,
    .session-container .hud-label {
        font-size: 0;
    }

    .stability-container .hud-label::after,
    .session-container .hud-label::after {
        font-size: 0.5rem;
        letter-spacing: 0.2px;
    }

    .stability-container .hud-label::after,
    .session-container .hud-label::after {
        content: attr(data-short);
    }

    .hud-controls {
        position: absolute;
        top: calc(100% + 7px);
        right: 0;
        display: flex;
        gap: 5px;
    }

    .sound-toggle-btn,
    .pause-toggle-btn,
    .theme-toggle-btn,
    .lang-toggle-btn {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        height: 44px;
        padding: 6px;
        border-radius: 12px;
    }

    #hud:not(.hidden) ~ .touch-controls {
        display: flex;
    }

    .toast-container {
        top: calc(max(8px, env(safe-area-inset-top)) + 102px);
        width: calc(100% - 28px);
    }

    .toast {
        width: 100%;
        min-width: 0;
        padding: 10px 14px;
    }
}

@media (max-width: 600px) {
    .overlay {
        align-items: flex-start;
        padding:
            max(8px, env(safe-area-inset-top))
            max(8px, env(safe-area-inset-right))
            max(10px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
    }

    .start-panel {
        padding: 18px 14px 14px;
        border-radius: 18px;
    }

    .start-panel .game-title {
        font-size: clamp(1.45rem, 8vw, 1.8rem);
        line-height: 1.05;
    }

    .start-panel .game-tagline {
        margin-bottom: 12px;
    }

    .start-panel .mode-selector-container {
        margin-bottom: 10px;
    }

    .mode-btn {
        min-height: 58px;
        padding: 8px 6px;
    }

    .mode-btn .mode-name {
        font-size: 0.75rem;
    }

    .mode-btn .mode-desc {
        font-size: 0.58rem;
    }

    .start-panel > .action-btn {
        min-height: 50px;
        margin-bottom: 10px;
    }

    .tutorial-box summary {
        padding: 11px 42px 11px 14px;
    }

    .tutorial-content {
        padding: 0 10px 10px;
    }

    .start-panel .steps-list {
        grid-template-columns: 1fr;
        gap: 5px;
        margin-bottom: 8px;
    }

    .start-panel .step-item {
        flex-direction: row;
        align-items: center;
        padding: 6px 8px;
    }

    .start-panel .step-item p,
    .start-panel .control-tip p {
        font-size: 0.68rem;
    }

    .start-panel .stats-box {
        margin-top: 2px;
    }

    .start-panel .progression-btn-row {
        gap: 6px;
    }

    .start-panel .sub-action-btn {
        min-height: 44px;
        padding: 7px 4px;
        font-size: 0.65rem;
    }

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

    .highlight-stat {
        grid-column: span 2;
    }

    .modal-panel {
        width: 100%;
        padding: 18px 14px;
    }

    .pause-panel {
        display: flex;
        max-width: 100%;
        padding: 20px 14px;
        gap: 0;
    }

    .pause-panel > .game-title {
        margin-bottom: 8px;
    }

    .pause-panel > .game-tagline {
        margin: 0 0 10px;
    }

    .pause-panel > .pause-guide {
        margin: 0 0 10px;
    }

    .pause-panel > .settings-container {
        margin: 0 0 12px;
    }

    .pause-panel > .breathing-widget-container {
        margin: 0 0 12px;
    }

    .modal-header h2 {
        font-size: 1.05rem;
        text-align: left;
    }

    .badges-grid,
    .themes-grid,
    .stats-grid-container {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 620px) and (min-width: 700px) {
    .start-panel {
        max-width: 900px;
        padding: 18px 24px;
    }

    .start-panel .game-tagline,
    .start-panel .mode-selector-container {
        margin-bottom: 10px;
    }

    .start-panel .tutorial-box {
        margin-bottom: 8px;
    }

    .start-panel .progression-btn-row {
        margin-top: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Readable, calm controls & bilingual/endless UI polish at every viewport size. */
.panel-top-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.endless-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-title);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.32);
    color: var(--cyan);
}

.top-utility-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.utility-pill-btn {
    min-height: 34px;
    padding: 4px 11px;
    border-radius: 999px;
    font-family: var(--font-title);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    transition: all 0.2s ease;
}

.utility-pill-btn:hover {
    background: rgba(34, 211, 238, 0.18);
    border-color: var(--cyan);
    color: #ffffff;
}

.lang-toggle-btn {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glow);
    color: rgba(255, 255, 255, 0.85);
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-title);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: all 0.2s ease;
}

.lang-toggle-btn:hover {
    color: #ffffff;
    border-color: var(--cyan);
    transform: scale(1.05);
}

.sector-pill {
    font-family: var(--font-title);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(244, 63, 133, 0.14);
    border: 1px solid rgba(244, 63, 133, 0.32);
    color: var(--magenta);
    margin-left: auto;
}

body.light-theme .endless-pill {
    background: rgba(2, 132, 199, 0.10);
    border-color: rgba(2, 132, 199, 0.28);
    color: #0369a1;
}

body.light-theme .utility-pill-btn {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.14);
    color: #1e293b;
}

body.light-theme .utility-pill-btn:hover {
    background: rgba(2, 132, 199, 0.12);
    border-color: #0284c7;
    color: #0f172a;
}

body.light-theme .lang-toggle-btn {
    background: rgba(255, 255, 255, 0.88);
    color: #1e293b;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

body.light-theme .lang-toggle-btn:hover {
    color: #0284c7;
    border-color: #0284c7;
    background: #ffffff;
}

body.light-theme .sector-pill {
    background: rgba(219, 39, 119, 0.10);
    border-color: rgba(219, 39, 119, 0.28);
    color: #be185d;
}

.start-panel {
    max-width: 680px;
    padding: 20px 24px;
}

.start-panel .game-title {
    font-size: 2rem;
    margin-bottom: 4px;
    text-shadow: none;
}

.start-panel .game-tagline {
    font-size: 0.92rem;
    line-height: 1.45;
    margin-bottom: 10px;
}

.start-panel .mode-selector-container {
    margin-bottom: 10px;
    gap: 5px;
}

.mode-btn {
    padding: 9px 10px;
}

.start-panel .mode-desc {
    font-size: 0.78rem;
    line-height: 1.35;
}

.quick-guide {
    font-size: 0.88rem;
    line-height: 1.45;
    color: #cbd5e1;
    margin: 0 0 8px;
}

.start-panel > .action-btn {
    margin: 0 0 8px;
    min-height: 48px;
    padding: 12px 28px;
}

.music-setting {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 4px 0 8px;
    font-size: 0.84rem;
    color: #cbd5e1;
}

.music-setting input {
    min-height: 32px;
    width: 120px;
    accent-color: var(--cyan);
    cursor: pointer;
}

.music-setting span {
    font-size: 0.78rem;
}

.tutorial-box {
    margin-bottom: 8px;
}

.tutorial-box summary {
    padding: 9px 42px 9px 14px;
    font-size: 0.74rem;
}

.tutorial-content {
    padding: 0 12px 10px;
}

.start-panel .steps-list {
    margin-bottom: 8px;
    gap: 6px;
}

.start-panel .step-item {
    padding: 8px 10px;
}

.start-panel .step-item p,
.start-panel .control-tip p {
    font-size: 0.80rem;
    line-height: 1.42;
}

.start-panel .control-tip {
    padding: 8px 10px;
}

.start-panel .stats-box {
    margin: 0 0 4px;
}

.start-panel .best-score-val {
    font-size: 1.3rem;
}

.start-panel .history-box {
    max-height: 82px;
    padding: 8px 10px;
    margin: 0 0 6px;
}

.start-panel .progression-btn-row {
    margin: 4px 0 0;
}

body.light-theme .quick-guide,
body.light-theme .music-setting {
    color: #334155;
}

body.light-theme .modal-subtitle,
body.light-theme .theme-card-desc {
    color: #475569;
}

body.light-theme .music-setting input {
    accent-color: #0284c7;
}

button:focus-visible,
summary:focus-visible,
input:focus-visible {
    outline: 3px solid var(--cyan);
    outline-offset: 3px;
}

body.light-theme .overlay {
    background: rgba(226, 234, 245, 0.80);
}

body.light-theme .action-btn {
    background: linear-gradient(115deg, #0284c7 0%, #4f46e5 52%, #db2777 100%);
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(2, 132, 199, 0.22);
}

body.light-theme .tutorial-box summary {
    color: #be185d;
}

body.light-theme .start-panel .mode-desc {
    color: #475569;
}

/* Text accents use harmonious, eye-friendly shades in both Dark & Light modes */
body:not(.light-theme) .neon-cyan { color: #67e8f9; }
body:not(.light-theme) .neon-magenta,
body:not(.light-theme) .neon-text-magenta { color: #f472b6; }
body:not(.light-theme) .neon-yellow { color: #fcd34d; }
body:not(.light-theme) .neon-red-text { color: #fca5a5; }
body.light-theme .neon-cyan { color: #0369a1; }
body.light-theme .neon-magenta,
body.light-theme .neon-text-magenta { color: #be185d; }
body.light-theme .neon-yellow { color: #b45309; }
body.light-theme .neon-red-text { color: #b91c1c; }

/* Pause settings: compact layout so all controls stay above the fold */
.pause-panel {
    max-width: 820px;
    grid-template-columns: minmax(0, 1.55fr) minmax(220px, 1fr);
    grid-template-areas:
        "title title"
        "tagline tagline"
        "guide guide"
        "settings breathing"
        "music music"
        "resume resume";
    gap: 8px 16px;
    padding: 18px 22px;
}

.pause-panel > .music-setting {
    grid-area: music;
    margin: 0;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(140, 160, 190, 0.07);
}

.pause-panel .settings-container {
    gap: 6px;
}

.pause-panel .setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 7px 11px;
    text-align: left;
}

.setting-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pause-panel .setting-label {
    font-size: 0.82rem;
    letter-spacing: 0;
    line-height: 1.3;
    color: #e2e8f0;
}

.setting-description {
    font-size: 0.73rem;
    line-height: 1.35;
    color: #94a3b8;
}

.pause-panel .setting-btn {
    min-width: 98px;
    max-width: 136px;
    min-height: 36px;
    border-radius: 10px;
    padding: 6px 10px;
    box-shadow: none;
    color: #a5f3fc;
    background: #1e3346;
    border-color: #3b6982;
}

.pause-panel .setting-btn:hover {
    background: #2b4963;
    color: #ffffff;
}

.pause-panel .breathing-subtitle {
    color: #94a3b8;
    font-size: 0.74rem;
    line-height: 1.35;
    letter-spacing: 0;
}

body.light-theme .pause-panel .setting-row {
    background: #f1f5f9;
    border-color: #d8e2ee;
}

body.light-theme .pause-panel .setting-label,
body.light-theme .pause-panel .breathing-phase-text {
    color: #0f172a;
}

body.light-theme .pause-panel .setting-description,
body.light-theme .breathing-subtitle {
    color: #475569;
}

body.light-theme .pause-panel .setting-btn {
    color: #0369a1;
    background: #e0f2fe;
    border-color: #7dd3fc;
}

body.light-theme .pause-panel .setting-btn:hover {
    background: #bae6fd;
    color: #0c4a6e;
}

@media (max-width: 800px), (pointer: coarse) {
    .sector-pill {
        display: none;
    }
}

@media (max-width: 680px) {
    .pause-panel {
        display: flex;
        flex-direction: column;
        padding: 14px 12px;
        gap: 8px;
    }
    .pause-panel .setting-row {
        grid-template-columns: minmax(0, 1fr) 98px;
        gap: 8px;
        padding: 6px 9px;
    }
    .pause-panel > .breathing-widget-container {
        padding: 10px 12px;
        gap: 6px;
    }
    .pause-panel .breathing-visualizer {
        width: 86px;
        height: 86px;
        margin: 2px 0;
    }
    .pause-panel .breathing-ring-outer {
        width: 78px;
        height: 78px;
    }
    .pause-panel > .music-setting {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .panel-top-bar {
        margin-bottom: 6px;
    }
    .endless-pill {
        font-size: 0.60rem;
        padding: 3px 8px;
    }
    .utility-pill-btn {
        min-height: 30px;
        padding: 3px 9px;
        font-size: 0.66rem;
    }
    .start-panel .step-item p,
    .start-panel .control-tip p {
        font-size: 0.76rem;
    }
    .start-panel .mode-desc {
        font-size: 0.72rem;
    }
    .quick-guide {
        font-size: 0.80rem;
    }
}

/* ==========================================================================
   SYMMETRY & GEOMETRIC ALIGNMENT OVERRIDES (PC & SMARTPHONE)
   ========================================================================== */

/* 1. Symmetrical Cockpit HUD on PC & Mobile */
#hud {
    top: max(18px, env(safe-area-inset-top));
    left: 50%;
    right: auto;
    width: calc(100% - 36px);
    max-width: 1140px;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(135px, 1.08fr) auto minmax(135px, 1.08fr) minmax(120px, 1fr);
    grid-template-areas: "score level controls stability session";
    align-items: stretch;
    gap: 12px;
}

.score-container { grid-area: score; width: 100%; min-width: 0; position: relative; }
.level-container { grid-area: level; width: 100%; min-width: 0; position: relative; }
.hud-controls {
    grid-area: controls;
    align-self: center;
    justify-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.stability-container { grid-area: stability; width: 100%; min-width: 0; position: relative; }
.session-container { grid-area: session; width: 100%; min-width: 0; position: relative; }

.hud-item {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 68px;
    padding: 9px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    overflow: visible;
}

.hud-label {
    width: 100%;
    text-align: center;
    margin-bottom: 0;
    padding-left: 1.5px; /* Compensate uppercase letter-spacing for optical centering */
    line-height: 1.15;
}

.hud-value {
    width: 100%;
    text-align: center;
    line-height: 1.15;
}

.level-badge,
.stability-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
}

.score-container::after,
.session-container::after {
    content: "";
    display: block;
    width: 100%;
    height: 5px;
    margin-top: 5px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.32), transparent);
}

body.light-theme .score-container::after,
body.light-theme .session-container::after {
    background: linear-gradient(90deg, transparent, rgba(2, 132, 199, 0.25), transparent);
}

.xp-bar-container,
.stability-bar-container {
    width: 100%;
    height: 5px;
    margin-top: 5px;
    border-radius: 3px;
}

.sector-pill {
    position: absolute;
    top: 6px;
    right: 8px;
    margin: 0;
    font-size: 0.58rem;
    padding: 1px 6px;
    line-height: 1.25;
    pointer-events: none;
}

.combo-badge {
    right: 8px;
    top: -9px;
    z-index: 2;
}

/* 2. Symmetrical Start Screen Header, Tutorial, Slider, Record & Buttons */
.panel-top-bar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

#start-lang-btn {
    justify-self: start;
}

.endless-pill {
    justify-self: center;
    text-align: center;
    justify-content: center;
}

.top-utility-btns {
    justify-self: end;
    display: flex;
    justify-content: flex-end;
}

.utility-pill-btn {
    min-width: 118px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.game-title {
    text-align: center;
    padding-left: 3px; /* Compensate 3-4px letter-spacing */
}

.mode-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.mode-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.mode-btn .mode-name,
.mode-btn .mode-desc {
    width: 100%;
    text-align: center;
}

.music-setting {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin: 4px 0 8px;
}

.music-setting > span:first-child {
    text-align: right;
    justify-self: end;
}

.music-setting > input {
    justify-self: center;
    margin: 0;
}

.music-setting > span:last-child {
    text-align: left;
    justify-self: start;
}

.tutorial-box summary {
    text-align: center;
    padding: 9px 44px;
}

.start-panel .steps-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
}

.start-panel .step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 8px 10px;
    gap: 5px;
    height: 100%;
}

.start-panel .step-item p {
    text-align: center;
    width: 100%;
}

.start-panel .control-tip,
.pause-panel .control-tip {
    text-align: center;
}

.start-panel .control-tip p,
.pause-panel .control-tip p {
    text-align: center;
}

.start-panel .stats-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1px;
    padding: 5px 24px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    margin: 2px auto 6px;
}

body.light-theme .start-panel .stats-box {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.08);
}

.start-panel .best-score-label {
    margin-bottom: 0;
    padding-left: 1.5px;
    text-align: center;
}

.start-panel .best-score-val {
    text-align: center;
    line-height: 1.15;
}

.history-box h3 {
    text-align: center;
}

.history-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.hist-date { text-align: left; }
.hist-level { text-align: center; }
.hist-score { text-align: right; }

.progression-btn-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.sub-action-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
}

/* 3. Symmetrical Pause Screen Rows & Breathing Circle */
.pause-panel {
    max-width: 820px;
    grid-template-columns: minmax(0, 1.38fr) minmax(250px, 1fr);
    align-items: stretch;
}

.pause-panel .setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 134px;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
}

.pause-panel .setting-copy {
    text-align: left;
    align-items: flex-start;
}

.pause-panel .setting-btn {
    width: 134px;
    min-width: 134px;
    max-width: 134px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.breathing-widget-container {
    justify-content: center;
    text-align: center;
}

.breathing-header {
    width: 100%;
    text-align: center;
}

.breathing-phase-text {
    padding-left: 1px;
    text-align: center;
}

.breathing-timer-text {
    text-align: center;
}

/* 4. Symmetrical Game Over & Modal Cards */
.go-stat-item {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.go-stat-label,
.go-stat-value {
    width: 100%;
    text-align: center;
}

.modal-panel .modal-header {
    padding: 0 48px 12px 48px;
    justify-content: center;
    text-align: center;
}

.modal-panel .modal-header h2 {
    width: 100%;
    text-align: center;
}

.modal-subtitle {
    width: 100%;
    text-align: center;
}

.badge-card {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    padding: 16px 14px;
}

.badge-card-info {
    align-items: center;
    text-align: center;
    width: 100%;
}

.badge-card-name,
.badge-card-desc {
    width: 100%;
    text-align: center;
}

.badge-card-status {
    align-self: center;
    margin-top: 10px;
}

.theme-card {
    align-items: center;
    text-align: center;
}

.theme-card-header {
    width: 100%;
    justify-content: space-between;
}

.theme-swatches {
    width: 100%;
    justify-content: center;
    margin: 2px 0;
}

.theme-card-desc {
    width: 100%;
    text-align: center;
}

@media (min-width: 601px) {
    .themes-grid .theme-card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        width: calc(50% - 7px);
        justify-self: center;
    }
}

.touch-control-btn {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.touch-label {
    padding-left: 1px;
    text-align: center;
}

/* 5. Smartphone & Compact Tablet Symmetry Overrides */
@media (max-width: 800px), (pointer: coarse) {
    #hud {
        top: max(8px, env(safe-area-inset-top));
        left: max(8px, env(safe-area-inset-left));
        right: max(8px, env(safe-area-inset-right));
        width: auto;
        max-width: none;
        transform: none;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-areas:
            "score level stability session"
            "controls controls controls controls";
        gap: 6px;
    }

    .hud-item {
        min-height: 52px;
        padding: 6px 6px;
        align-items: center;
        justify-content: center;
        text-align: center;
        overflow: visible;
    }

    .level-badge,
    .stability-header {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 1px;
    }

    .hud-label,
    .stability-container .hud-label::after,
    .session-container .hud-label::after {
        display: block;
        width: 100%;
        text-align: center;
        padding-left: 0;
    }

    .hud-value {
        text-align: center;
    }

    .score-container::after,
    .session-container::after,
    .xp-bar-container,
    .stability-bar-container {
        height: 4px;
        margin-top: 4px;
    }

    .hud-controls {
        position: static;
        grid-area: controls;
        justify-self: center;
        justify-content: center;
        margin-top: 2px;
        gap: 8px;
    }
}

@media (max-width: 680px) {
    .pause-panel .setting-row {
        grid-template-columns: minmax(0, 1fr) 112px;
        gap: 8px;
        padding: 6px 10px;
    }

    .pause-panel .setting-btn {
        width: 112px;
        min-width: 112px;
        max-width: 112px;
        padding: 5px 8px;
        font-size: 0.68rem;
    }
}

@media (max-width: 600px) {
    .panel-top-bar {
        grid-template-columns: auto 1fr auto;
        gap: 6px;
    }

    .utility-pill-btn {
        min-width: 86px;
        padding: 3px 8px;
        font-size: 0.64rem;
    }

    .endless-pill {
        font-size: 0.56rem;
        padding: 3px 7px;
        letter-spacing: 0.5px;
    }

    .tutorial-box summary {
        padding: 10px 38px;
        text-align: center;
    }

    .start-panel .steps-list {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .start-panel .step-item {
        display: grid;
        grid-template-columns: 24px 1fr 24px;
        align-items: center;
        padding: 7px 10px;
        gap: 8px;
    }

    .start-panel .step-item p {
        text-align: center;
    }

    .rest-reminder-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 14px 16px;
        gap: 10px;
    }

    .rest-info {
        text-align: center;
    }

    .rest-actions {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }

    .modal-panel .modal-header {
        padding: 0 40px 10px 40px;
    }

    .modal-panel .modal-header h2 {
        text-align: center;
    }
}

/* ==========================================================================
   ENHANCEMENTS: COMBO DECAY, ZEN GOALS, TOUCH ICONS, QUIT & HOME BUTTONS
   ========================================================================== */

.combo-wrapper {
    position: absolute;
    right: -10px;
    top: -12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    pointer-events: none;
}

.combo-wrapper .combo-badge {
    position: static;
    margin: 0;
}

.combo-timer-track {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.combo-timer-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #22d3ee, #f43f85);
    border-radius: 999px;
    transform-origin: left;
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.85);
}

.zen-goal-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(52, 211, 153, 0.16);
    border: 1px solid rgba(52, 211, 153, 0.45);
    color: #34d399;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.2);
    transition: all 0.3s ease;
    animation: gentle-fade-in 0.3s ease;
}

body.light-theme .zen-goal-pill {
    background: rgba(4, 120, 87, 0.12);
    border-color: rgba(4, 120, 87, 0.38);
    color: #047857;
}

.touch-rotate-icon {
    display: block;
    margin-bottom: 2px;
    color: var(--cyan);
    transition: transform 0.15s ease;
}

.touch-control-btn:last-child .touch-rotate-icon {
    color: var(--magenta);
}

.touch-control-btn:active .touch-rotate-icon,
.touch-control-btn.is-active .touch-rotate-icon {
    transform: scale(1.18);
}

.pause-quit-btn {
    margin-top: 10px;
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.38);
    color: #fca5a5;
    font-weight: 700;
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pause-quit-btn:hover {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(239, 68, 68, 0.75);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.45);
}

body.light-theme .pause-quit-btn {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.32);
    color: #dc2626;
}

body.light-theme .pause-quit-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #991b1b;
}

.go-home-btn {
    margin-top: 10px;
    width: 100%;
}

@keyframes gentle-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
