/* RetroMusicQuiz — Dark neon theme, mobile-first */
:root {
    --orange: #ff6b35;
    --cyan: #00e5ff;
    --green: #4caf50;
    --red: #f44336;
    --bg: #0a0a0f;
    --bg2: #12121a;
    --bg3: #1c1c2a;
    --text: #f0f0f5;
    --text-muted: rgba(255,255,255,0.55);
    --border: rgba(255,255,255,0.08);
    --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
}
.hidden { display: none !important; }

/* Logo */
.logo-wrap { text-align: center; padding: 48px 0 24px; }
.logo {
    font-family: 'Caveat', cursive;
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--orange), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}
.tagline {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-primary {
    background: var(--orange);
    color: #fff;
    box-shadow: 0 4px 20px rgba(255,107,53,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 28px rgba(255,107,53,0.45); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.04); }
.btn-accent {
    background: transparent;
    color: var(--cyan);
    border: 1px solid rgba(0,229,255,0.3);
}
.btn-accent:hover { border-color: var(--cyan); background: rgba(0,229,255,0.06); }
.btn-small { padding: 8px 16px; font-size: 14px; width: auto; }
.btn-emoji { font-size: 18px; margin-right: 6px; }
.btn-back {
    background: none; border: none; color: var(--text-muted); font-size: 14px;
    cursor: pointer; padding: 8px 0; font-family: inherit;
}

.start-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }
.start-footer { margin-top: auto; padding: 24px 0; text-align: center; }
.powered-by { font-size: 12px; color: var(--text-muted); }
.powered-by a { color: var(--cyan); text-decoration: none; }

/* Loading */
#screen-loading { align-items: center; justify-content: center; }
.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 16px; color: var(--text-muted); font-size: 14px; }

/* Playing */
.play-header { margin-bottom: 16px; }
.progress-bar {
    height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--orange); border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}
.play-meta {
    display: flex; justify-content: space-between; margin-top: 8px;
    font-family: 'Space Mono', monospace; font-size: 12px; color: var(--text-muted);
}

/* Visual area */
.visual-area { margin-bottom: 16px; }
.visual-card { text-align: center; }

.cover-wrap {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg2);
}
.cover-img {
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scale(1.15);
}

.title-card {
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.card-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}
.card-song {
    font-family: 'Caveat', cursive;
    font-size: 24px;
    font-weight: 700;
    margin-top: 12px;
}
.card-artist { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* Equalizer */
.eq-row { display: flex; justify-content: center; margin: 12px 0; }
.eq {
    display: flex; gap: 3px; align-items: flex-end; height: 24px;
}
.eq span {
    width: 4px;
    background: var(--orange);
    border-radius: 2px;
    animation: eqBounce 0.8s ease-in-out infinite;
}
.eq span:nth-child(1) { animation-delay: 0s; }
.eq span:nth-child(2) { animation-delay: 0.15s; }
.eq span:nth-child(3) { animation-delay: 0.3s; }
.eq span:nth-child(4) { animation-delay: 0.45s; }
.eq span:nth-child(5) { animation-delay: 0.6s; }

@keyframes eqBounce {
    0%, 100% { height: 4px; }
    50% { height: 20px; }
}
.eq.is-buffering span { animation: eqPulse 1.2s ease-in-out infinite; opacity: 0.5; }
@keyframes eqPulse {
    0%, 100% { height: 6px; }
    50% { height: 10px; }
}
.eq.is-paused span { animation: none; height: 4px; }

/* Which Came First pairs */
.pair-wrap {
    display: flex; gap: 12px; align-items: center;
}
.pair-card {
    flex: 1;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
    color: var(--text);
}
.pair-card:hover { border-color: rgba(255,255,255,0.2); }
.pair-card.is-correct { border-color: var(--green); background: rgba(76,175,80,0.1); }
.pair-card.is-wrong { border-color: var(--red); opacity: 0.6; }
.pair-thumb {
    width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px;
}
.pair-info { padding: 8px 0 0; }
.pair-title { display: block; font-weight: 600; font-size: 13px; }
.pair-artist { display: block; font-size: 12px; color: var(--text-muted); }
.pair-year {
    display: inline-block; margin-top: 6px; font-family: 'Space Mono', monospace;
    font-size: 14px; font-weight: 700; color: var(--cyan);
}
.pair-vs {
    font-family: 'Space Mono', monospace;
    font-weight: 700; font-size: 14px; color: var(--text-muted);
    flex-shrink: 0;
}

/* Question text */
.question-text {
    font-size: 18px; font-weight: 600; text-align: center;
    margin-bottom: 16px;
}

/* Alternatives */
.alternatives {
    display: flex; flex-direction: column; gap: 8px;
}
.alt-btn {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.alt-btn:hover { background: var(--bg3); border-color: rgba(255,255,255,0.15); }
.alt-btn:disabled { cursor: default; }
.alt-btn.is-correct {
    background: rgba(76,175,80,0.15);
    border-color: var(--green);
    color: var(--green);
}
.alt-btn.is-wrong {
    background: rgba(244,67,54,0.15);
    border-color: var(--red);
    color: var(--red);
}
.alt-btn.shake {
    animation: shake 0.4s ease;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Results */
#screen-results { align-items: center; }
.results-header { text-align: center; margin-bottom: 24px; }
.results-stars { font-size: 48px; margin-bottom: 8px; }
.results-title { font-size: 24px; font-weight: 700; }
.results-feedback { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.results-score { text-align: center; margin-bottom: 20px; }
.score-big {
    font-family: 'Space Mono', monospace;
    font-size: 36px; font-weight: 700;
    color: var(--orange);
}
.score-detail { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.results-grid {
    font-size: 28px; letter-spacing: 2px; text-align: center;
    margin-bottom: 20px;
}
.results-breakdown {
    width: 100%;
    margin-bottom: 24px;
}
.bd-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}
.bd-correct { background: rgba(76,175,80,0.08); }
.bd-wrong { background: rgba(244,67,54,0.08); }
.bd-icon { font-weight: 700; width: 20px; text-align: center; }
.bd-correct .bd-icon { color: var(--green); }
.bd-wrong .bd-icon { color: var(--red); }
.bd-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.results-actions {
    width: 100%;
    display: flex; flex-direction: column; gap: 10px;
    margin-bottom: 24px;
}

/* Watch on RVH */
.results-videos { width: 100%; }
.results-videos h3 {
    font-size: 14px; color: var(--text-muted); margin-bottom: 12px;
    font-weight: 600;
}
.rv-card {
    display: flex; align-items: center; gap: 12px;
    padding: 8px;
    background: var(--bg2);
    border-radius: 8px;
    margin-bottom: 6px;
    text-decoration: none; color: var(--text);
    transition: background 0.2s;
}
.rv-card:hover { background: var(--bg3); }
.rv-card img { width: 60px; height: 34px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.rv-card span { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results-footer { text-align: center; padding: 16px 0; }

/* Leaderboard */
.lb-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.lb-title { font-size: 20px; font-weight: 700; }
.lb-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.lb-tab {
    flex: 1; padding: 10px 8px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text-muted);
    font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; text-align: center;
}
.lb-tab.active { background: var(--orange); color: #fff; border-color: var(--orange); }

.lb-table { width: 100%; }
.lb-row {
    display: flex; padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.lb-header-row { color: var(--text-muted); font-weight: 600; }
.lb-row.is-me { background: rgba(255,107,53,0.08); border-radius: 6px; }
.lb-rank { width: 32px; text-align: center; flex-shrink: 0; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pts { width: 60px; text-align: right; font-family: 'Space Mono', monospace; font-weight: 700; }
.lb-correct { width: 40px; text-align: right; color: var(--text-muted); }
.lb-total { text-align: center; padding: 12px 0; color: var(--text-muted); font-size: 12px; }
.lb-loading, .lb-empty, .lb-error { text-align: center; padding: 24px 0; color: var(--text-muted); font-size: 14px; }
.lb-footer { margin-top: auto; padding: 24px 0; text-align: center; }

.lb-nickname { margin-top: 16px; }
.lb-nickname p { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.nickname-form { display: flex; gap: 8px; }
.nickname-form input {
    flex: 1; padding: 10px 12px;
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-family: 'DM Sans', sans-serif; font-size: 14px;
    outline: none;
}
.nickname-form input:focus { border-color: var(--orange); }

/* Already played */
.already-played-content { text-align: center; }
.already-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.already-score {
    font-family: 'Space Mono', monospace;
    font-size: 32px; font-weight: 700;
    color: var(--orange);
    margin-bottom: 8px;
}
.already-grid { font-size: 24px; letter-spacing: 2px; margin-bottom: 16px; }
.countdown { font-size: 14px; color: var(--text-muted); font-family: 'Space Mono', monospace; }

/* Decade Challenge */
.decade-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
    margin-top: 32px;
}
.decade-btn {
    padding: 20px 12px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    font-size: 20px; font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.decade-btn:hover {
    border-color: var(--cyan);
    background: rgba(0,229,255,0.06);
    box-shadow: 0 0 16px rgba(0,229,255,0.15);
}
.decade-btn:nth-child(4),
.decade-btn:nth-child(5) {
    grid-column: span 1;
}
/* Center last row if 2 items */
.decade-grid { justify-items: center; }
.decade-btn { width: 100%; }

.decade-play-meta {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; font-size: 14px;
    border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.decade-label {
    font-family: 'Space Mono', monospace; font-weight: 700;
    color: var(--cyan); font-size: 16px;
}
.decade-lives { font-size: 18px; }
.decade-streak { color: var(--text-muted); font-size: 13px; }

.best-scores { margin-top: 24px; text-align: center; }
.best-scores h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 8px; }
.best-row {
    display: flex; justify-content: space-between;
    padding: 6px 16px; font-size: 14px;
}
.best-row span:first-child { font-family: 'Space Mono', monospace; color: var(--cyan); }
.best-row span:last-child { font-family: 'Space Mono', monospace; font-weight: 700; }
.text-muted { color: var(--text-muted); font-size: 13px; }

#screen-decade-gameover { align-items: center; }
