/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

:root {
    --pal-bg-1: #667eea;
    --pal-bg-2: #764ba2;
    --pal-accent: #4ecca3;
    --tap-target: 56px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
}

button { font-family: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, .mode-tile:focus-visible {
    outline: 3px solid #ffd54a;
    outline-offset: 2px;
}

/* ===== SCREEN MANAGEMENT ===== */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; opacity: 1; }

/* ===== TOP BAR ===== */
.top-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(env(safe-area-inset-top), 12px) 14px 8px 14px;
    background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0));
    z-index: 200;
    pointer-events: none;
}
.top-bar > * { pointer-events: auto; }
.top-bar.hidden { display: none; }

.top-bar-right { display: flex; gap: 6px; }
.coin-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,235,59,0.5);
    border-radius: 999px;
    color: #ffeb3b;
    font-weight: 800;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
}
.coin-icon {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #ffeb3b;
    color: #333;
    font-weight: 900;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
}
.icon-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}
.icon-btn:active { transform: scale(0.92); }

/* ===== MENU / FRONTCARD ===== */
.menu-screen {
    background: linear-gradient(135deg, var(--pal-bg-1) 0%, var(--pal-bg-2) 100%);
    padding: max(env(safe-area-inset-top), 70px) 16px max(env(safe-area-inset-bottom), 20px);
    justify-content: flex-start;
}
.menu-header {
    text-align: center;
    margin-bottom: 22px;
}
.game-title {
    font-size: clamp(40px, 12vw, 64px);
    font-weight: 900;
    letter-spacing: -2px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.tagline {
    font-size: clamp(12px, 3.5vw, 16px);
    opacity: 0.9;
    margin-top: 4px;
    letter-spacing: 2px;
}
.mode-grid {
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 18px;
}
.mode-tile {
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.25);
    border-radius: 18px;
    color: #fff;
    padding: 16px 14px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.15s ease, background 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 140px;
}
.mode-tile:active, .mode-tile:focus-visible { transform: scale(0.97); background: rgba(255,255,255,0.18); }
.mode-name { font-size: 20px; font-weight: 900; letter-spacing: 1.5px; }
.mode-meta { font-size: 11px; opacity: 0.85; letter-spacing: 1px; }

.mode-preview {
    position: relative;
    height: 36px;
    border-radius: 10px;
    background: rgba(0,0,0,0.25);
    overflow: hidden;
}
.mode-preview .bar {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 6px;
    animation: previewSlide 2.4s ease-in-out infinite;
}
.mode-preview .bar-a { background: #ff6b6b; left: 0; }
.mode-preview .bar-b { background: #4ecdc4; right: 0; animation-direction: reverse; }
.mode-preview.fast .bar { animation-duration: 1.1s; }
.mode-preview.slow .bar { animation-duration: 4s; }
@keyframes previewSlide {
    0%, 100% { transform: translate(0, -50%); }
    50% { transform: translate(calc(100% * 4), -50%); }
}
.mode-preview .bar-b { animation-name: previewSlideR; }
@keyframes previewSlideR {
    0%, 100% { transform: translate(0, -50%); }
    50% { transform: translate(calc(-100% * 4), -50%); }
}

.menu-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

/* ===== SUB-SCREEN (settings/leaderboard/etc) ===== */
.sub-screen {
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
    justify-content: flex-start;
    padding: max(env(safe-area-inset-top), 70px) 16px max(env(safe-area-inset-bottom), 20px);
}
.sub-header {
    width: 100%;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.sub-header h2 {
    font-size: 22px;
    letter-spacing: 2px;
    font-weight: 900;
}
.back-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary {
    font-size: 16px;
    font-weight: 700;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.btn-primary {
    background: #fff;
    color: #5c6bc0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}
.btn-primary:active { transform: scale(0.95); }
.btn-secondary {
    background: transparent;
    color: #fff;
    border: 2px solid #fff;
}
.btn-secondary:active { transform: scale(0.95); background: rgba(255,255,255,0.1); }
.btn-secondary.danger { color: #ff6b6b; border-color: #ff6b6b; }

.button-group { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }

/* ===== GAME SCREEN ===== */
#game { background: #000; }
.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: max(env(safe-area-inset-top), 20px) 20px 20px 20px;
    position: relative;
    z-index: 10;
}
.score-container, .best-container, .level-container {
    display: flex; flex-direction: column; align-items: center;
}
.best-container { align-items: flex-end; }
.level-text {
    font-size: 18px; font-weight: bold;
    color: var(--pal-accent);
    text-shadow: 0 0 10px rgba(78, 204, 163, 0.5);
}
.label { font-size: 12px; opacity: 0.6; letter-spacing: 1px; font-weight: 600; }
.score-value { font-size: 28px; font-weight: 900; letter-spacing: -1px; color: #fff; }

.combo-text {
    display: inline-block;
    min-height: 18px;
    font-size: 14px;
    font-weight: 700;
    color: #ffeb3b;
    text-shadow: 0 2px 10px rgba(255,235,59,0.6);
    letter-spacing: 1px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.combo-text.active { opacity: 1; animation: bounceIn 0.3s ease; }

/* ===== CANVAS ===== */
.game-canvas {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.center-zone {
    position: absolute;
    width: 200px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.08);
    border-left: 2px dashed rgba(255,255,255,0.4);
    border-right: 2px dashed rgba(255,255,255,0.4);
    pointer-events: none;
    z-index: 1;
}
.color-bar {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(255,255,255,0.12);
    pointer-events: none;
    will-change: transform;
    left: 0;
}
body.cb-mode .left-bar {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 0 0 3px #fff;
}
body.cb-mode .right-bar {
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5), inset 0 0 0 3px #000;
}
/* Shape variants */
body.shape-rounded .color-bar { border-radius: 18px; }
body.shape-hex .color-bar { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); border-radius: 0; }
body.shape-blob .color-bar { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }

.left-bar { z-index: 2; }
.right-bar { z-index: 3; }
.particle-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.tap-area {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 5;
    cursor: pointer;
}

/* ===== GAME FOOTER ===== */
.game-footer {
    width: 100%;
    padding: 20px 20px max(env(safe-area-inset-bottom), 20px) 20px;
    text-align: center;
}
.feedback {
    font-size: 24px;
    font-weight: 900;
    min-height: 30px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.feedback.perfect { color: #4caf50; animation: feedbackPop 0.5s ease; }
.feedback.good { color: #ffeb3b; animation: feedbackPop 0.5s ease; }
.feedback.okay { color: #ff9800; animation: feedbackPop 0.5s ease; }
.feedback.miss { color: #f44336; animation: shake 0.5s ease; }
.instruction { font-size: 14px; opacity: 0.5; letter-spacing: 1px; animation: pulse 2s ease-in-out infinite; }

/* ===== GAME OVER ===== */
#gameOver { background: linear-gradient(135deg, #434343 0%, #000 100%); }
.game-over-content { text-align: center; animation: fadeInUp 0.6s ease; padding: 20px; max-width: 420px; }
.game-over-title { font-size: 36px; font-weight: 900; margin-bottom: 20px; letter-spacing: 2px; color: #f44336; }
.final-score { display: flex; flex-direction: column; margin-bottom: 12px; }
.big-score { font-size: 56px; font-weight: 900; letter-spacing: -2px; color: #fff; }
.new-record { font-size: 20px; font-weight: 700; color: #ffeb3b; margin: 12px 0; animation: bounceIn 0.6s ease; }
.new-record.hidden { display: none; }
.stats-grid { display: flex; justify-content: center; gap: 26px; margin: 20px 0; }
.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 30px; font-weight: 900; color: #fff; }
.stat-label { font-size: 11px; opacity: 0.6; margin-top: 4px; letter-spacing: 1px; }

.name-entry { margin: 14px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.name-entry.hidden { display: none; }
.name-entry input {
    width: 120px;
    padding: 10px;
    text-align: center;
    text-transform: uppercase;
    font-size: 28px;
    font-weight: 900;
    background: rgba(255,255,255,0.1);
    border: 2px solid #fff;
    color: #fff;
    border-radius: 12px;
    letter-spacing: 6px;
}

/* ===== PAUSE / TOGGLES ===== */
.pause-btn {
    position: fixed;
    top: max(env(safe-area-inset-top), 20px);
    left: 20px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 14px; font-weight: 900;
    cursor: pointer;
    z-index: 100;
}
.pause-btn:active { transform: scale(0.9); }
.pause-btn.hidden, .info-btn.hidden { display: none; }

.info-btn {
    position: fixed;
    top: max(env(safe-area-inset-top), 20px);
    right: 20px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 20px; font-weight: 700;
    cursor: pointer;
    z-index: 100;
}

.pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.pause-overlay.hidden { display: none; }
.pause-card {
    background: #1a1a1a;
    padding: 36px 28px;
    border-radius: 20px;
    text-align: center;
    min-width: 240px;
}
.pause-card h2 { font-size: 28px; margin-bottom: 24px; letter-spacing: 3px; color: #fff; }
.pause-card .btn-primary, .pause-card .btn-secondary {
    display: block; width: 100%; margin-top: 12px;
    padding: 14px 28px; font-size: 16px;
}

.toggle-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.toggle-btn[aria-pressed="true"] { background: rgba(78, 204, 163, 0.3); border-color: var(--pal-accent); }

/* ===== SETTINGS LIST ===== */
.settings-list {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    font-size: 14px;
    min-height: var(--tap-target);
}
.setting-row input[type="range"] { width: 50%; }
.setting-row select {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 14px;
}

/* ===== LEADERBOARD ===== */
.tabs { display: flex; gap: 6px; width: 100%; max-width: 480px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
    flex: 1;
    min-width: 70px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}
.tab.active { background: rgba(78, 204, 163, 0.25); border-color: var(--pal-accent); }
.lb-list {
    list-style: none;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.lb-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    font-weight: 700;
}
.lb-list .lb-rank { color: #ffeb3b; width: 30px; }
.lb-list .lb-name { flex: 1; margin-left: 8px; letter-spacing: 2px; }
.lb-list .lb-score { font-size: 18px; }

/* ===== ACHIEVEMENTS ===== */
.ach-list {
    list-style: none;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ach-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border-left: 4px solid rgba(255,255,255,0.15);
}
.ach-list li.unlocked { border-left-color: #ffd54a; background: rgba(255,213,74,0.1); }
.ach-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 900;
    flex-shrink: 0;
}
.ach-list li.unlocked .ach-icon { background: #ffd54a; color: #333; }
.ach-text { flex: 1; }
.ach-name { font-weight: 800; font-size: 14px; }
.ach-desc { font-size: 12px; opacity: 0.7; margin-top: 2px; }

/* ===== SHOP ===== */
.shop-sec {
    width: 100%;
    max-width: 520px;
    margin: 8px 0 8px 0;
    font-size: 14px;
    letter-spacing: 2px;
    opacity: 0.7;
}
.shop-grid {
    width: 100%;
    max-width: 520px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.shop-item {
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease;
}
.shop-item:active { transform: scale(0.97); }
.shop-item.selected { border-color: var(--pal-accent); background: rgba(78,204,163,0.15); }
.shop-item.locked { opacity: 0.7; }
.shop-swatch {
    height: 44px;
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.shop-swatch .sw {
    width: 20px; height: 20px;
    border-radius: 5px;
    margin: 0 3px;
    display: inline-block;
}
.shop-name { font-weight: 800; font-size: 13px; }
.shop-price { font-size: 11px; margin-top: 4px; color: #ffeb3b; }
.shop-price.owned { color: var(--pal-accent); }

/* ===== PACKS GRID ===== */
.packs-grid {
    width: 100%;
    max-width: 520px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}
.pack-tile {
    aspect-ratio: 1;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
}
.pack-tile.locked { opacity: 0.4; cursor: not-allowed; }
.pack-tile .pack-id { font-size: 20px; }
.pack-tile .pack-name { font-size: 9px; opacity: 0.8; letter-spacing: 1px; }

/* ===== HOW TO ===== */
.howto-body {
    width: 100%;
    max-width: 480px;
    background: rgba(255,255,255,0.05);
    padding: 20px;
    border-radius: 14px;
}
.howto-body h4 { margin-top: 14px; margin-bottom: 8px; color: #999; }
.howto-body ul { list-style: none; margin: 10px 0; }
.howto-body li { padding-left: 18px; position: relative; margin: 6px 0; }
.howto-body li:before { content: "•"; position: absolute; left: 0; color: var(--pal-accent); }
.howto-body p { margin-bottom: 10px; line-height: 1.5; opacity: 0.9; }
.tip {
    background: rgba(102, 126, 234, 0.2);
    padding: 14px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    margin-top: 14px;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: max(env(safe-area-inset-top), 70px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: rgba(0,0,0,0.85);
    border: 2px solid #ffd54a;
    color: #ffd54a;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 1px;
    animation: toastIn 0.3s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== TAP TARGET SIZING ===== */
body[data-tap="small"] .color-bar { width: 50px; height: 50px; }
body[data-tap="med"] .color-bar { width: 60px; height: 60px; }
body[data-tap="large"] .color-bar { width: 72px; height: 72px; }
body[data-tap="small"] .center-zone { width: 160px; }
body[data-tap="large"] .center-zone { width: 240px; }

/* ===== REDUCED MOTION ===== */
body.reduced-motion .particle-layer { display: none; }
body.reduced-motion * { animation-duration: 0.01ms !important; transition-duration: 0.05s !important; }
@media (prefers-reduced-motion: reduce) {
    body { animation: none; }
    .particle-layer { display: none; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
@keyframes feedbackPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 375px) {
    .game-title { font-size: 42px; }
    .big-score { font-size: 44px; }
    .stats-grid { gap: 18px; }
    .mode-tile { min-height: 120px; padding: 12px 10px; }
    .mode-name { font-size: 17px; }
}

/* ===== SAFE AREA ===== */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ===== LIGHT THEME ===== */
:root[data-theme="light"] body { background: #f6f6fb; color: #15192e; }
:root[data-theme="light"] .menu-screen {
    background: linear-gradient(135deg, #e9ebf5 0%, #d9dcef 100%);
    color: #15192e;
}
:root[data-theme="light"] .sub-screen {
    background: linear-gradient(180deg, #f6f6fb 0%, #e9ebf5 100%);
    color: #15192e;
}
:root[data-theme="light"] .top-bar {
    background: linear-gradient(180deg, rgba(15,18,40,0.06), rgba(15,18,40,0));
}
:root[data-theme="light"] .icon-btn,
:root[data-theme="light"] .back-btn {
    background: rgba(255,255,255,0.8);
    border-color: rgba(15,18,40,0.18);
    color: #15192e;
}
:root[data-theme="light"] .coin-pill {
    background: rgba(255,255,255,0.85);
    border-color: rgba(200,146,0,0.5);
    color: #8a6500;
}
:root[data-theme="light"] .btn-primary { background: #15192e; color: #fff; box-shadow: 0 6px 18px rgba(15,18,40,0.18); }
:root[data-theme="light"] .btn-secondary { color: #15192e; border-color: #15192e; }
:root[data-theme="light"] .btn-secondary:active { background: rgba(15,18,40,0.08); }
:root[data-theme="light"] .setting-row { color: #15192e; }
:root[data-theme="light"] .setting-row select,
:root[data-theme="light"] .setting-row input[type="range"] {
    background: #fff;
    color: #15192e;
}
:root[data-theme="light"] .toggle-btn {
    background: rgba(15,18,40,0.06);
    color: #15192e;
    border-color: rgba(15,18,40,0.2);
}
:root[data-theme="light"] .toggle-btn[aria-pressed="true"] {
    background: rgba(78,204,163,0.25);
}
:root[data-theme="light"] #game { background: #15192e; }
:root[data-theme="light"] .pause-overlay,
:root[data-theme="light"] .pause-card { color: #15192e; }
:root[data-theme="light"] .pause-card { background: #fff; box-shadow: 0 10px 40px rgba(15,18,40,0.25); }

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) body { background: #f6f6fb; color: #15192e; }
    :root:not([data-theme="dark"]) .menu-screen {
        background: linear-gradient(135deg, #e9ebf5 0%, #d9dcef 100%);
        color: #15192e;
    }
    :root:not([data-theme="dark"]) .sub-screen {
        background: linear-gradient(180deg, #f6f6fb 0%, #e9ebf5 100%);
        color: #15192e;
    }
    :root:not([data-theme="dark"]) .icon-btn,
    :root:not([data-theme="dark"]) .back-btn {
        background: rgba(255,255,255,0.8);
        border-color: rgba(15,18,40,0.18);
        color: #15192e;
    }
    :root:not([data-theme="dark"]) .btn-primary { background: #15192e; color: #fff; }
    :root:not([data-theme="dark"]) .btn-secondary { color: #15192e; border-color: #15192e; }
    :root:not([data-theme="dark"]) #game { background: #15192e; }
}
