:root {
    --bg: #0d0c0b;
    --panel: #161412;
    --gold: #f5c24c;
    --gold-deep: #b8862b;
    --cream: #f3ead8;
    --muted: #8f877a;
    --line: rgba(243, 234, 216, .85);
    --ui: 'Bebas Neue', 'Oswald', Impact, sans-serif;
    --serif: 'Cinzel', 'Trajan Pro', Georgia, serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    background: radial-gradient(ellipse at 50% 30%, #1b1815 0%, var(--bg) 60%) fixed;
    color: var(--cream);
    font-family: var(--ui);
    letter-spacing: .04em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; }

/* Vinyles en fond */
.vinyl {
    position: fixed; z-index: -1; border-radius: 50%; pointer-events: none;
    background:
        radial-gradient(circle, transparent 0 18%, var(--ring) 18% 26%, transparent 26% 47%, rgba(255,255,255,.04) 47% 48%, transparent 48%),
        radial-gradient(circle, #151311 0 70%, transparent 70%);
}
.vinyl--a { --ring: rgba(184, 134, 43, .55); width: 440px; height: 440px; left: -150px; top: 10vh; animation: spin 40s linear infinite; }
.vinyl--b { --ring: rgba(120, 40, 40, .55); width: 400px; height: 400px; right: -120px; bottom: 2vh; animation: spin 52s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Titres dorés */
.gold-title {
    font-family: var(--serif);
    font-weight: 700;
    margin: 0;
    line-height: .95;
    letter-spacing: .02em;
    background: linear-gradient(180deg, #ffe7a3 0%, var(--gold) 45%, var(--gold-deep) 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 0 22px rgba(245, 194, 76, .25));
}
.gold-title--sm { font-size: clamp(28px, 5vw, 44px); }
.gold-title--md { font-size: clamp(40px, 8vw, 72px); }
.gold-title--year { font-size: clamp(40px, 6vw, 64px); }

/* Boutons */
.btn {
    display: block; width: 100%;
    padding: 12px 20px;
    font-size: 22px; text-align: center;
    color: var(--gold);
    background: rgba(13, 12, 11, .8);
    border: 2px solid var(--line);
    border-radius: 6px;
    transition: transform .12s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); background: #1d1a16; }
.btn--primary { background: var(--gold); color: #1a1408; border-color: var(--gold); font-size: 26px; }
.btn--primary:hover { background: #ffd469; }
.btn--outline { width: auto; display: inline-block; padding: 10px 26px; }

.pill {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 9px 16px;
    font-size: 16px;
    background: rgba(13, 12, 11, .85);
    border: 1.5px solid var(--line);
    border-radius: 999px;
    color: var(--cream);
}
.pill:disabled { opacity: .35; cursor: default; }
.pill.is-on { color: var(--gold); border-color: var(--gold); }

.icon-btn {
    display: grid; place-items: center;
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--line);
    background: rgba(13, 12, 11, .85);
    font-size: 18px;
    font-family: system-ui, sans-serif;
}

/* Interrupteur mode rapide */
.switch { cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 34px; height: 18px; border-radius: 99px; background: #3a3631; position: relative; transition: background .2s; }
.switch-dot { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--cream); transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--gold-deep); }
.switch input:checked + .switch-track .switch-dot { transform: translateX(16px); background: var(--gold); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Accueil ---------- */
.home {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px 80px;
    text-align: center;
}
.kicker { color: var(--gold); font-size: 20px; letter-spacing: .3em; margin: 0 0 14px; }
.home .gold-title { font-size: clamp(48px, 10vw, 104px); }
.home-sub { font-family: system-ui, sans-serif; letter-spacing: 0; color: var(--muted); font-size: 15px; line-height: 1.5; margin: 18px 0 30px; }
.menu { display: grid; gap: 12px; width: min(340px, 100%); }

.modal {
    background: #12100e; color: var(--cream);
    border: 2px solid var(--gold); border-radius: 10px;
    padding: 28px; width: min(640px, 94vw);
    text-align: center;
}
.modal::backdrop { background: rgba(0,0,0,.75); }
.modal-close { position: absolute; top: 12px; right: 12px; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; margin-top: 20px; }
.year-grid a { padding: 8px 0; border: 1px solid #3b362f; border-radius: 4px; font-size: 20px; color: var(--gold); }
.year-grid a:hover { background: var(--gold); color: #1a1408; }

.credit {
    position: fixed; left: 12px; bottom: 6px;
    font-size: 11px; color: var(--muted); letter-spacing: .1em;
}
.is-playing .credit { display: none; }

/* ---------- Jeu ---------- */
.topbar {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    padding: 14px 16px 6px;
}
.topbar > :first-child { justify-self: start; }
.topbar > :last-child { justify-self: end; }

.results-head { text-align: center; margin: -4px 0 6px; }
.results-head span { display: block; font-size: clamp(26px, 4vw, 38px); color: var(--gold); }
.results-head small { font-size: 14px; color: var(--cream); letter-spacing: .12em; }
.show-results #year-title { font-size: 30px; }

.board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px 16px;
    width: min(880px, 100% - 24px);
    margin: 8px auto 90px;
}

.card { display: flex; flex-direction: column; gap: 8px; transition: opacity .3s, transform .3s; }
.card.is-hidden { visibility: hidden; opacity: 0; transform: translateY(12px) scale(.96); }
.card.is-entering { animation: pop .35s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }

.cover {
    position: relative; display: block; padding: 0;
    aspect-ratio: 1 / 1;
    border: 5px solid var(--cream);
    border-radius: 10px;
    background: #222;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s, transform .15s;
}
.cover:hover { transform: translateY(-2px); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter .3s; }
.cover-fallback { display: grid; place-items: center; height: 100%; padding: 10px; font-size: 22px; color: var(--gold); background: linear-gradient(135deg, #2b241a, #120f0c); }
.play-badge {
    position: absolute; right: 8px; bottom: 8px;
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(10, 9, 8, .82);
    border: 2px solid var(--gold);
    color: var(--gold);
    font-family: system-ui, sans-serif; font-size: 13px;
}
.no-preview { position: absolute; left: 0; right: 0; top: 0; padding: 4px; font-size: 13px; background: rgba(0,0,0,.75); color: var(--muted); }
.pct {
    position: absolute; inset: 0;
    display: none; place-items: center;
    font-size: clamp(30px, 4.6vw, 46px);
    color: var(--gold);
    text-shadow: 0 2px 10px #000, 0 0 3px #000;
}

.card.is-playing .cover { border-color: var(--gold); box-shadow: 0 0 26px rgba(245, 194, 76, .45); }

.meta {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 10px 8px;
    border: 1.5px solid var(--line);
    border-radius: 6px;
    background: rgba(20, 18, 16, .9);
    text-align: center;
    min-height: 96px;
}
.meta h3 { margin: 0; font-size: 19px; font-weight: 400; color: var(--gold); line-height: 1.05; }
.meta p { margin: 0; font-size: 15px; color: var(--cream); }
.save {
    margin-top: 6px;
    padding: 4px 26px;
    font-size: 19px;
    border: none; border-radius: 4px;
    background: var(--gold); color: #1a1408;
    transition: background .2s, opacity .2s, transform .1s;
}
.save:hover:not(:disabled) { background: #ffd469; transform: scale(1.05); }
.save:disabled { opacity: .45; cursor: default; }
.card.was-mine .save::after { content: ' ✓'; }
.mine-tag { margin-top: 4px; font-size: 14px; color: #1a1408; background: var(--cream); padding: 1px 10px; border-radius: 3px; }

/* Résultats */
.show-results .save { display: none; }
.show-results .play-badge { display: none; }
.show-results .pct { display: grid; }
.show-results .cover img { filter: brightness(.42); }
.show-results .card.is-winner .cover { border-color: var(--gold); box-shadow: 0 0 34px rgba(245, 194, 76, .6); }
.show-results .card.is-winner .cover img { filter: brightness(.6); }
.show-results .card.is-winner .meta { border-color: var(--gold); }
.show-results .board { cursor: pointer; }

/* Intro */
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(8, 7, 6, .72); }
.card-box {
    width: min(660px, 100%);
    padding: 40px 30px;
    text-align: center;
    background: linear-gradient(180deg, #191613, #100e0c);
    border: 2px solid var(--gold);
    border-radius: 10px;
}
.card-box p { font-size: 21px; margin: 14px 0; }
.card-box .hl { color: var(--gold); }
.card-box .btn { margin-top: 14px; }

.bottombar {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: space-between; align-items: center;
    padding: 22px 16px 12px;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(13, 12, 11, .92) 55%);
}
.bottombar > * { pointer-events: auto; }

/* ---------- Classements ---------- */
.corner-close { position: fixed; top: 14px; right: 16px; z-index: 5; }
.rankings { width: min(760px, 100% - 24px); margin: 0 auto; padding: 40px 0 60px; text-align: center; }
.rank-list { display: grid; gap: 8px; text-align: left; }
.rank-row {
    display: grid; grid-template-columns: 64px 52px 1fr auto 80px; align-items: center; gap: 14px;
    padding: 8px 14px;
    border: 1px solid #2d2924; border-radius: 6px;
    background: rgba(20, 18, 16, .85);
    transition: border-color .2s;
}
.rank-row:hover { border-color: var(--gold); }
.rank-year { font-size: 26px; color: var(--gold); }
.rank-cover { width: 52px; height: 52px; border-radius: 4px; object-fit: cover; }
.rank-song strong { display: block; font-weight: 400; font-size: 20px; }
.rank-song small { color: var(--muted); font-size: 15px; }
.rank-pct { font-size: 26px; color: var(--gold); }
.rank-total { font-size: 14px; color: var(--muted); text-align: right; }
.rank-empty { grid-column: 2 / -1; color: var(--muted); font-size: 17px; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
    .topbar { grid-template-columns: auto 1fr auto; gap: 8px; }
    .switch { font-size: 13px; padding: 7px 10px; }
    .meta h3 { font-size: 17px; }
    .rank-row { grid-template-columns: 48px 44px 1fr auto; }
    .rank-cover { width: 44px; height: 44px; }
    .rank-total { display: none; }
    .card-box p { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .vinyl { animation: none; }
    .card.is-entering { animation: none; }
}
