/* Feuille de style unique : l'écran télé et l'écran téléphone partagent la même
   base, seules les tailles changent. */

:root {
  --bg: #0d0b1a;
  --bg-soft: #171331;
  --panel: rgba(255, 255, 255, .06);
  --panel-strong: rgba(255, 255, 255, .11);
  --line: rgba(255, 255, 255, .14);
  --text: #f4f2ff;
  --muted: #a9a3c9;
  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --ok: #2fd6a5;
  --ko: #ff6b6b;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1100px 700px at 12% -10%, #2a1a5e 0%, transparent 60%),
    radial-gradient(900px 600px at 105% 5%, #5c1f47 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
p { margin: 0; }

a { color: inherit; }

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* --- Éléments de formulaire ------------------------------------------------ */

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label {
  display: block;
  margin-bottom: 7px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field { margin-bottom: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 26px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, opacity .12s ease;
}

.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-ghost {
  background: var(--panel);
  border: 1px solid var(--line);
}

.btn-wide { width: 100%; }
.btn-lg { padding: 20px 40px; font-size: 1.25rem; }

.error {
  padding: 13px 16px;
  margin-bottom: 18px;
  font-size: .92rem;
  color: #ffd9d9;
  background: rgba(255, 90, 90, .14);
  border: 1px solid rgba(255, 90, 90, .35);
  border-radius: 12px;
}

/* --- Accueil --------------------------------------------------------------- */

.shell {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.brand {
  margin-bottom: 28px;
  text-align: center;
}

.brand h1 { font-size: clamp(2.1rem, 8vw, 2.9rem); }

.brand .tag {
  margin-top: 10px;
  font-size: 1rem;
  color: var(--muted);
}

.card {
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.chip {
  padding: 8px 13px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.chip:hover { color: var(--text); border-color: var(--accent); }

.rules {
  margin-top: 26px;
  font-size: .9rem;
  line-height: 1.65;
  color: var(--muted);
}

.rules li { margin-bottom: 6px; }

/* --- Écran télé ------------------------------------------------------------ */

.tv {
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(16px, 2.4vw, 36px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vw, 26px);
}

.tv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.tv-title { font-size: clamp(1.2rem, 2.4vw, 2rem); }

.tv-sub { font-size: clamp(.8rem, 1.2vw, 1rem); color: var(--muted); }

.pill {
  padding: 9px 18px;
  font-size: clamp(.85rem, 1.3vw, 1.05rem);
  font-weight: 800;
  letter-spacing: .12em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.tv-body {
  flex: 1;
  display: grid;
  gap: clamp(16px, 2vw, 30px);
  grid-template-columns: minmax(0, 1fr) minmax(260px, 24vw);
  align-items: stretch;
  min-height: 0;
}

@media (max-width: 900px) {
  .tv-body { grid-template-columns: minmax(0, 1fr); }
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vw, 26px);
  padding: clamp(20px, 3vw, 40px);
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  min-height: 0;
}

.qr-wrap {
  padding: 18px;
  background: #fff;
  border-radius: 20px;
  line-height: 0;
}

.qr-wrap svg,
.qr-wrap img {
  display: block;
  width: clamp(180px, 26vh, 320px);
  height: clamp(180px, 26vh, 320px);
}

.join-code {
  font-size: clamp(2.6rem, 7vw, 5rem);
  font-weight: 900;
  letter-spacing: .14em;
  background: linear-gradient(120deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.join-url {
  font-size: clamp(.9rem, 1.5vw, 1.2rem);
  color: var(--muted);
}

/* Disque qui tourne pendant l'écoute */
.disc {
  position: relative;
  width: clamp(140px, 22vh, 260px);
  height: clamp(140px, 22vh, 260px);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, #14122b 0 3px, #1d1a3d 3px 6px);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.disc::after {
  content: "";
  width: 26%;
  height: 26%;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.disc.spinning { animation: spin 3.4s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .disc.spinning { animation: none; }
}

.mystery-year {
  font-size: clamp(3rem, 11vw, 8rem);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1;
}

.reveal {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 40px);
  flex-wrap: wrap;
  justify-content: center;
}

.reveal img {
  width: clamp(120px, 20vh, 230px);
  height: clamp(120px, 20vh, 230px);
  border-radius: 20px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.reveal-meta { text-align: left; max-width: 46ch; }

@media (max-width: 700px) { .reveal-meta { text-align: center; } }

.reveal-title { font-size: clamp(1.3rem, 3vw, 2.4rem); }

.reveal-artist {
  margin-top: 6px;
  font-size: clamp(1rem, 2vw, 1.5rem);
  color: var(--muted);
}

.year-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 22px;
  font-size: clamp(2rem, 6vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-radius: 16px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(14px, 1.6vw, 22px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow-y: auto;
  min-height: 0;
}

.side h3 {
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  background: var(--panel-strong);
  border: 1px solid transparent;
  border-radius: 14px;
  transition: border-color .2s ease, background .2s ease;
}

.player-row.ready { border-color: rgba(47, 214, 165, .5); }
.player-row.correct { background: rgba(47, 214, 165, .16); border-color: var(--ok); }
.player-row.wrong { background: rgba(255, 107, 107, .14); border-color: var(--ko); }

.dot {
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
}

.player-row .who { flex: 1; min-width: 0; }

.player-row .name {
  font-weight: 700;
  font-size: clamp(.9rem, 1.2vw, 1.05rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-row .meta { font-size: .78rem; color: var(--muted); }

.player-row .score {
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  font-weight: 900;
}

.offline { opacity: .45; }

.tv-controls {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

/* --- Écran joueur ---------------------------------------------------------- */

.play {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px 0 0;
}

.play-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 14px;
}

.play-head .name { font-weight: 800; font-size: 1.05rem; }
.play-head .sub { font-size: .78rem; color: var(--muted); }

.score-badge {
  padding: 8px 15px;
  font-weight: 900;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.play-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 8px 0 20px;
  min-height: 0;
}

.banner {
  margin: 0 16px;
  padding: 16px 18px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.banner.good { background: rgba(47, 214, 165, .16); border-color: var(--ok); }
.banner.bad { background: rgba(255, 107, 107, .14); border-color: var(--ko); }

.banner .headline { font-size: 1.3rem; font-weight: 800; }
.banner .detail { margin-top: 6px; font-size: .9rem; color: var(--muted); }

.instruction {
  padding: 0 16px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

/* Frise chronologique : bande défilante de cartes séparées par des emplacements */

.timeline {
  display: flex;
  align-items: stretch;
  /* `safe` garde le début de la frise accessible quand elle déborde. */
  justify-content: safe center;
  gap: 0;
  padding: 6px 16px 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.tl-card {
  flex: none;
  width: 116px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 15px;
}

.tl-card img,
.tl-card .tl-blank {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, .3);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}

.mystery-card {
  touch-action: none;
  cursor: grab;
  border-color: var(--accent);
  background: linear-gradient(150deg, rgba(124, 92, 255, .3), rgba(255, 92, 138, .2));
  box-shadow: 0 0 0 4px rgba(124, 92, 255, .18);
}

.mystery-card:active { cursor: grabbing; }

.mystery-card .yr { font-size: 2rem; }

.tl-card .yr { font-size: 1.45rem; font-weight: 900; line-height: 1; }

.tl-card .ttl {
  font-size: .68rem;
  line-height: 1.25;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tl-card.fresh {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(47, 214, 165, .22);
  animation: pop .45s ease;
}

@keyframes pop {
  from { transform: scale(.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.slot {
  flex: none;
  width: 54px;
  margin: 4px 0;
  display: grid;
  place-items: center;
  background: none;
  border: 2px dashed var(--line);
  border-radius: 13px;
  color: var(--muted);
  font-size: 1.5rem;
  font-family: inherit;
  cursor: pointer;
  transition: all .16s ease;
  padding: 0;
}

.slot:hover, .slot.hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(124, 92, 255, .16);
}

.slot.chosen {
  width: 116px;
  border-style: solid;
  border-color: var(--accent);
  background: linear-gradient(150deg, rgba(124, 92, 255, .3), rgba(255, 92, 138, .22));
  color: var(--text);
  font-size: 2.4rem;
  font-weight: 900;
}

.timeline.locked .slot { pointer-events: none; opacity: .3; }

.play-foot {
  position: sticky;
  bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 55%, transparent);
}

.waiting-list {
  margin-top: 12px;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  max-width: min(92vw, 420px);
  padding: 13px 18px;
  font-size: .92rem;
  text-align: center;
  color: #ffe3e3;
  background: rgba(70, 20, 30, .95);
  border: 1px solid rgba(255, 90, 90, .5);
  border-radius: 13px;
  box-shadow: var(--shadow);
  z-index: 50;
}

.connection-lost {
  position: fixed;
  inset: auto 0 0 0;
  padding: 11px;
  font-size: .85rem;
  text-align: center;
  background: rgba(255, 107, 107, .92);
  color: #2a0000;
  font-weight: 700;
  z-index: 60;
}

.winner {
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: 900;
  background: linear-gradient(120deg, #ffd76a, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
