/* ============================================
   Sky Runner - 2026 UI/UX Design
   Space Theme | Dark Mode | Glassmorphism
   ============================================ */

/* Skip to main content link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary, #4a90d9);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 14px;
    border-radius: 0 0 4px 0;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

:root {
    --primary: #5f27cd;
    --primary-light: #7c4dff;
    --secondary: #00d2d3;
    --accent: #ffa502;
    --danger: #ff6348;
    --bg: #0f0f1e;
    --bg-light: #1a1a35;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-hover: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --text: #f0f0f5;
    --text-sec: #a0a0b8;
    --text-dim: #5a5a70;
    --glass-blur: blur(12px);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode overrides */
[data-theme="light"] {
    --bg: #f0f0fa;
    --bg-light: #e8e8f5;
    --surface: rgba(95, 39, 205, 0.06);
    --surface-hover: rgba(95, 39, 205, 0.1);
    --border: rgba(95, 39, 205, 0.12);
    --border-hover: rgba(95, 39, 205, 0.25);
    --text: #1a1028;
    --text-sec: #5a4a70;
    --text-dim: #8a7aa0;
}
[data-theme="light"] body {
    background: var(--bg);
    color: var(--text);
}
[data-theme="light"] .app-loader {
    background: var(--bg);
}
[data-theme="light"] .screen,
[data-theme="light"] .game-over-screen {
    background: var(--bg);
}
[data-theme="light"] .overlay {
    background: rgba(240, 240, 250, 0.85);
}
[data-theme="light"] .overlay-card {
    background: rgba(95, 39, 205, 0.05);
    border-color: rgba(95, 39, 205, 0.12);
    box-shadow: 0 4px 16px rgba(95, 39, 205, 0.06);
}
[data-theme="light"] .skin-card,
[data-theme="light"] .theme-card {
    background: rgba(95, 39, 205, 0.05);
    border-color: rgba(95, 39, 205, 0.1);
}
[data-theme="light"] .skin-card.selected,
[data-theme="light"] .theme-card.selected {
    border-color: var(--primary);
    background: rgba(95, 39, 205, 0.1);
}
[data-theme="light"] .stat-card {
    background: rgba(95, 39, 205, 0.04);
    border-color: rgba(95, 39, 205, 0.1);
}
[data-theme="light"] .btn {
    box-shadow: 0 2px 8px rgba(95, 39, 205, 0.1);
}
[data-theme="light"] .hud {
    background: rgba(95, 39, 205, 0.05);
    border-color: rgba(95, 39, 205, 0.1);
}
[data-theme="light"] .recommend-card {
    background: rgba(95, 39, 205, 0.04);
    border-color: rgba(95, 39, 205, 0.1);
}
[data-theme="light"] .lang-btn {
    background: rgba(95, 39, 205, 0.08);
    color: var(--text);
    border-color: rgba(95, 39, 205, 0.18);
}
[data-theme="light"] .lang-menu {
    background: rgba(240, 240, 250, 0.95);
    border-color: rgba(95, 39, 205, 0.18);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .lang-option {
    color: #5a4a70;
}
[data-theme="light"] .lang-option:hover {
    background: rgba(95, 39, 205, 0.1);
    color: var(--text);
}
[data-theme="light"] .lang-option.active {
    background: rgba(95, 39, 205, 0.15);
    color: var(--text);
}
[data-theme="light"] .loader-spinner {
    border-color: rgba(95, 39, 205, 0.12);
    border-top-color: var(--primary);
}
/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 12px;
    right: 96px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}
.theme-toggle:hover { transform: scale(1.1); }
.theme-toggle:active { transform: scale(0.95); }
[data-theme="light"] .theme-toggle {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
    color: var(--text);
}
/* Light mode: back/home link visibility */
[data-theme="light"] .back-link,
[data-theme="light"] .home-link {
    color: var(--text-sec);
}
[data-theme="light"] .back-link:hover,
[data-theme="light"] .home-link:hover {
    color: var(--primary);
}
/* Light mode: HUD elements over game canvas */
[data-theme="light"] .hud-score {
    color: var(--text);
    text-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
[data-theme="light"] .hud-pause {
    color: var(--text);
}
/* Light mode: hide dark-mode star background */
[data-theme="light"] .bg-stars {
    opacity: 0;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 터치 최적화 */
button, a, input, [role="button"], [role="link"] {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* App Loader */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.loader-emoji {
    font-size: 48px;
    animation: loader-bounce 1s ease-in-out infinite;
}
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: loader-spin 0.8s linear infinite;
}
.loader-text {
    font-size: 14px;
    color: var(--text-sec);
    letter-spacing: 1px;
    font-weight: 500;
}
@keyframes loader-spin {
    to { transform: rotate(360deg); }
}
@keyframes loader-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

input[type="text"], textarea {
    -webkit-user-select: text;
    user-select: text;
}

html, body {
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
}

.hidden { display: none !important; }

/* === Game Wrapper === */
.game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    margin: 0 auto;
    overflow: hidden;
}

/* === Screens === */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
}

.screen.hidden { display: none; }

/* === Background Stars (CSS) === */
.bg-stars {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 10%, rgba(255,255,255,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 40%, rgba(255,255,255,0.4) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* === Ad Banner === */
.ad-banner {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    margin: 8px 12px;
    flex-shrink: 0;
}

.ad-placeholder {
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ad-bottom-go { margin-top: auto; }

/* =============================
   MENU SCREEN
   ============================= */
.menu-screen {
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 100%;
    max-width: 340px;
}

.game-logo {
    text-align: center;
}

.logo-rocket {
    font-size: 56px;
    display: block;
    animation: rocketFloat 2.5s ease-in-out infinite;
}

@keyframes rocketFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-12px) rotate(5deg); }
}

.game-logo h1 {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--secondary), var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.logo-sub {
    font-size: 14px;
    color: var(--text-sec);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 4px;
}

.high-score-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 10px 24px;
}

.hs-label {
    font-size: 13px;
    color: var(--text-sec);
}

.hs-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.menu-hint {
    font-size: 12px;
    color: var(--text-dim);
    animation: pulse 2s ease-in-out infinite;
}

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

/* === Buttons === */
.btn-primary, .btn-secondary, .btn-revive {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    min-height: 52px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 20px rgba(95, 39, 205, 0.3);
}

.btn-primary:hover, .btn-primary:active {
    transform: scale(1.03);
    box-shadow: 0 6px 28px rgba(95, 39, 205, 0.5);
}

.btn-secondary {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.btn-icon { font-size: 20px; }

.btn-start { font-size: 18px; }

.btn-revive {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    box-shadow: 0 4px 20px rgba(243, 156, 18, 0.3);
}

.btn-revive:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 28px rgba(243, 156, 18, 0.5);
}

.revive-icon { font-size: 20px; }

.btn-back {
    background: none;
    border: none;
    color: var(--text-sec);
    font-size: 15px;
    cursor: pointer;
    padding: 10px;
    min-height: 44px;
}

.btn-back:hover { color: var(--text); }

/* =============================
   GAME SCREEN
   ============================= */
.game-screen {
    background: var(--bg);
}

#game-canvas {
    display: block;
    width: 100%;
    flex: 1;
    touch-action: none;
}

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    z-index: 10;
}

.hud-score {
    font-size: 32px;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-score.score-pop {
    animation: scorePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scorePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.hud-pause {
    width: 44px;
    height: 44px;
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tap-hint {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 18px;
    color: var(--text-sec);
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

/* =============================
   OVERLAYS
   ============================= */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.overlay-card, .interstitial-card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    width: 85%;
    max-width: 320px;
}

.overlay-card h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* =============================
   GAMEOVER SCREEN
   ============================= */
.gameover-screen {
    justify-content: center;
    align-items: center;
    padding: 16px;
    background: rgba(15, 15, 30, 0.95);
}

.gameover-card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.go-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 20px;
}

.go-scores {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.go-score-main, .go-score-best {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.go-label {
    font-size: 13px;
    color: var(--text-sec);
}

.go-score-main .go-value {
    font-size: 40px;
    font-weight: 900;
    color: var(--accent);
}

.go-score-best .go-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--secondary);
}

.go-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    border-radius: 100px;
    padding: 10px 20px;
    margin-bottom: 16px;
}

.rank-icon { font-size: 22px; }
.rank-title { font-size: 15px; font-weight: 600; }

.go-new-record {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    animation: pulse 1s ease-in-out infinite;
    margin-bottom: 12px;
}

.go-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.go-sub-buttons {
    display: flex;
    gap: 10px;
}

.btn-share, .btn-menu {
    flex: 1;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

.btn-share:hover, .btn-menu:hover {
    background: var(--surface-hover);
}

/* =============================
   SKINS SCREEN
   ============================= */
.skins-header, .stats-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.skins-header h2, .stats-header h2 {
    font-size: 20px;
}

.token-display {
    text-align: center;
    padding: 12px;
    font-size: 15px;
    color: var(--text-sec);
}

.token-display strong {
    color: var(--accent);
    font-size: 18px;
}

.skins-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.skin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.skin-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(95, 39, 205, 0.2);
}

.skin-card.locked {
    opacity: 0.7;
}

.skin-emoji { font-size: 36px; margin-bottom: 8px; }
.skin-name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.skin-rarity { 
    font-size: 11px; 
    font-weight: 600; 
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.skin-description { 
    font-size: 11px; 
    color: var(--text-sec); 
    margin-bottom: 12px;
    line-height: 1.4;
}
.skin-status { font-size: 12px; color: var(--secondary); font-weight: 600; }
.skin-unlock {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}
.skin-unlock-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: var(--transition);
}
.skin-unlock-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
}

.skin-select-btn, .skin-buy-btn {
    padding: 8px 16px;
    border-radius: 100px;
    border: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    transition: var(--transition);
}

.skin-select-btn {
    background: var(--primary);
    color: white;
}

.skin-buy-btn {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.skin-buy-btn.disabled {
    background: var(--text-dim);
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================
   THEMES SCREEN
   ============================= */
.themes-screen {
    display: flex;
    flex-direction: column;
}

.themes-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.themes-header h2 {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.theme-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.theme-card:hover:not(.locked) {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.theme-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(95, 39, 205, 0.3);
}

.theme-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.theme-preview {
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, #1e3c72, #2a5298, #0f0f1e);
    position: relative;
    overflow: hidden;
}

.theme-info {
    padding: 12px;
}

.theme-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.theme-description {
    font-size: 11px;
    color: var(--text-sec);
    line-height: 1.4;
    margin-bottom: 8px;
}

.theme-unlock {
    font-size: 10px;
    color: var(--text-dim);
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    margin-top: 4px;
}

.theme-selected-badge {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
}

/* =============================
   STATS SCREEN
   ============================= */
.stats-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.stat-row:last-child { border-bottom: none; }

.stat-row span { color: var(--text-sec); }
.stat-row strong { color: var(--text); font-size: 16px; }

/* =============================
   INTERSTITIAL AD
   ============================= */
.interstitial-card {
    max-width: 340px;
}

.interstitial-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.interstitial-placeholder {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 16px;
}

.interstitial-timer {
    font-size: 14px;
    color: var(--text-sec);
    margin-bottom: 12px;
}

.interstitial-timer span {
    font-weight: 800;
    color: var(--accent);
    font-size: 18px;
}

.btn-close-ad {
    padding: 10px 24px;
    background: var(--primary);
    border: none;
    border-radius: 100px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    min-height: 44px;
}

/* =============================
   RESPONSIVE
   ============================= */
@media (max-height: 600px) {
    .game-logo h1 { font-size: 32px; }
    .logo-rocket { font-size: 40px; }
    .menu-content { gap: 16px; }
    .btn-primary, .btn-secondary { padding: 12px 20px; min-height: 46px; }
}

@media (min-width: 481px) {
    .game-wrapper {
        height: 100vh;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

/* === Accessibility === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* === RECOMMENDATIONS === */
.recommendations-section { margin-top: 24px; padding: 0 4px; }
.rec-title { font-size: 15px; font-weight: 700; color: var(--text-sec); margin-bottom: 12px; text-align: center; letter-spacing: 0.5px; }
.rec-grid { display: flex; flex-direction: column; gap: 10px; }
.rec-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; text-decoration: none; color: var(--text); transition: all 0.3s ease; }
.rec-card:hover, .rec-card:active { background: rgba(255,255,255,0.1); border-color: var(--primary); transform: translateY(-1px); }
.rec-icon { font-size: 28px; flex-shrink: 0; width: 40px; text-align: center; }
.rec-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-name { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-desc { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === LANGUAGE SELECTOR === */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.lang-btn {
    background: rgba(59,130,246,0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(59,130,246,0.4);
    color: #fff;
    font-size: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn:hover {
    background: rgba(59,130,246,0.5);
    transform: scale(1.05);
}

.lang-menu {
    position: absolute;
    top: 52px;
    right: 0;
    background: rgba(5,10,25,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 12px;
    padding: 8px;
    min-width: 150px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.lang-menu.hidden {
    display: none;
}

.lang-option {
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    color: #e0e8f8;
    transition: background 0.2s;
}

.lang-option:hover {
    background: rgba(59,130,246,0.2);
}

.lang-option.active {
    background: rgba(59,130,246,0.3);
    font-weight: 600;
}

/* Game Footer & Back Link */
.game-footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 20px;
}

.back-link, .home-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    font-size: 13px;
    padding: 12px 0;
    transition: color 0.2s;
}

.back-link:hover, .home-link:hover {
    color: rgba(255,255,255,0.7);
}

/* === DOPAMINE ENHANCEMENT EFFECTS === */

/* Screen Shake */
@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-2px, -2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-2px, 2px); }
    80% { transform: translate(2px, 2px); }
}

.screen.shake {
    animation: screenShake 0.3s ease-in-out;
}

/* Screen Flash */
@keyframes screenFlash {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(255, 255, 255, 0.15); }
}

.screen.flash {
    animation: screenFlash 0.2s ease-in-out;
}

.screen.flash-success {
    animation: screenFlash 0.2s ease-in-out;
    --flash-color: rgba(46, 213, 115, 0.2);
}

.screen.flash-danger {
    animation: screenFlash 0.2s ease-in-out;
    --flash-color: rgba(255, 99, 72, 0.2);
}

/* Floating Score Popup */
@keyframes scoreFloating {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(1.2);
    }
}

.score-popup {
    position: fixed;
    font-weight: 900;
    font-size: 24px;
    pointer-events: none;
    z-index: 100;
    animation: scoreFloating 0.8s ease-out forwards;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.score-popup.normal {
    color: var(--accent);
}

.score-popup.small {
    color: #ffffff;
    font-size: 20px;
}

.score-popup.medium {
    color: #ffdd57;
    font-size: 28px;
    animation: scoreFloating 0.8s ease-out forwards, scoreShake 0.3s ease-in-out;
}

.score-popup.large {
    color: #ffd700;
    font-size: 32px;
    font-weight: 900;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
    animation: scoreFloating 0.8s ease-out forwards, scoreShakeBig 0.4s ease-in-out;
}

.score-popup.bonus {
    color: var(--secondary);
    font-size: 32px;
}

.score-popup.combo5 {
    color: #ffd700;
    font-size: 36px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255, 215, 0, 1);
    animation: scoreFloating 1.2s ease-out forwards, scorePulseBig 0.6s ease-in-out;
}

.score-popup.combo10 {
    color: #ff6b9d;
    font-size: 40px;
    font-weight: 900;
    text-shadow: 0 0 25px rgba(255, 107, 157, 1);
    animation: scoreFloating 1.2s ease-out forwards, scorePulseBigger 0.6s ease-in-out;
}

.score-popup.milestone {
    color: #ffa502;
    font-size: 28px;
    font-weight: 900;
}

@keyframes scoreShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

@keyframes scoreShakeBig {
    0%, 100% { transform: translateX(0) scale(1); }
    25% { transform: translateX(-3px) scale(1.05); }
    75% { transform: translateX(3px) scale(1.05); }
}

@keyframes scorePulseBig {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes scorePulseBigger {
    0% { transform: scale(0.7) rotate(-10deg); }
    50% { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Combo Indicator */
.combo-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    text-align: center;
}

.combo-text {
    font-size: 48px;
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255, 165, 2, 0.8);
    animation: comboPulse 0.6s ease-out forwards;
}

.combo-text.combo-gold {
    color: #ffd700;
    text-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 165, 0, 0.6);
    animation: comboPulseGold 0.8s ease-out forwards;
}

@keyframes comboPulse {
    0% {
        opacity: 0;
        transform: scale(0.5) rotateZ(0deg);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: scale(2) rotateZ(360deg);
    }
}

@keyframes comboPulseGold {
    0% {
        opacity: 0;
        transform: scale(0.3) rotateZ(-30deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.15) rotateZ(10deg);
    }
    100% {
        opacity: 0;
        transform: scale(2.5) rotateZ(360deg);
    }
}

/* Confetti Particles */
@keyframes confetti-fall {
    to { transform: translateY(100vh) rotateZ(720deg); }
}

.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    pointer-events: none;
    z-index: 100;
}

.confetti.type-1 { background: linear-gradient(135deg, #ff6348, #ff4757); }
.confetti.type-2 { background: linear-gradient(135deg, #00d2d3, #0984e3); }
.confetti.type-3 { background: linear-gradient(135deg, #5f27cd, #6c5ce7); }
.confetti.type-4 { background: linear-gradient(135deg, #ffa502, #fdcb6e); }
.confetti.type-5 { background: linear-gradient(135deg, #2ed573, #00b894); }

/* Stage Banner */
.stage-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 110;
    text-align: center;
}

.stage-text {
    font-size: 56px;
    font-weight: 900;
    color: #00d2d3;
    text-shadow: 0 0 40px rgba(0, 210, 211, 1), 0 0 60px rgba(0, 165, 255, 0.6);
    animation: stageBannerPulse 1.5s ease-in-out forwards;
}

@keyframes stageBannerPulse {
    0% {
        opacity: 0;
        transform: scale(0) rotateZ(-45deg);
    }
    30% {
        opacity: 1;
        transform: scale(1.1) rotateZ(0deg);
    }
    70% {
        opacity: 1;
        transform: scale(1) rotateZ(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) rotateZ(10deg);
    }
}

/* Milestone Banner */
@keyframes milestoneIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }
    50% {
        opacity: 1;
        transform: translateY(0) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes milestoneOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px) scale(0.8);
    }
}

.milestone-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--accent) 0%, #ff8c42 100%);
    color: white;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
    pointer-events: none;
    z-index: 150;
    box-shadow: 0 10px 40px rgba(255, 165, 2, 0.5);
    animation: milestoneIn 0.5s ease-out, milestoneOut 0.5s ease-in 1.5s forwards;
}

.milestone-banner .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

/* === Accessibility Improvements === */
button:focus-visible,a:focus-visible,input:focus-visible,[role="button"]:focus-visible{outline:3px solid #f59e0b;outline-offset:2px;}
button,a[href],input[type="button"],input[type="submit"],[role="button"]{min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center;}
.skip-link{position:absolute;top:-40px;left:0;background:#f59e0b;color:white;padding:8px;text-decoration:none;z-index:100;}
.skip-link:focus{top:0;}
[role="dialog"]{z-index:1000;}
@media (prefers-reduced-motion: reduce){*{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;scroll-behavior:auto !important;}}
/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark, var(--bg-primary, var(--background, #0f0f23)));
}

::-webkit-scrollbar-thumb {
    background: #ff6b9d;
    border-radius: 5px;
    border: 2px solid var(--bg-dark, var(--bg-primary, var(--background, #0f0f23)));
}

::-webkit-scrollbar-thumb:hover {
    background: #ff88b0;
    opacity: 0.8;
}

/* Selection Color */
::selection {
    background: #ff6b9d;
    color: white;
}

::-moz-selection {
    background: #ff6b9d;
    color: white;
}

@media (prefers-contrast: more){button{border:2px solid #f59e0b;}}
.rec-card:focus-visible{outline:3px solid #f59e0b;outline-offset:4px;}
