@font-face {
  font-family: "Outfit";
  src: url("fonts/outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --fond: #0d0f1c;
  --fond-haut: #1c1a3f;
  --surface: #171a2c;
  --surface-haut: #21253c;
  --ligne: rgba(255, 255, 255, .09);
  --texte: #f3f4fa;
  --doux: #9ca1bb;
  --accent: #7c6cff;
  --accent-clair: #b3a9ff;
  --or: #ffc65c;
  --papier: #ffffff;
  --encre: #15172a;
  --rayon: 18px;
}

* { box-sizing: border-box; }

html { background: var(--fond); }
html, body { height: 100%; margin: 0; }

body {
  background: radial-gradient(130% 55% at 50% -10%, var(--fond-haut), transparent 70%) no-repeat, var(--fond);
  background-attachment: fixed;
  color: var(--texte);
  font: 400 17px/1.42 "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main {
  min-height: 100%;
  max-width: 480px;
  margin: auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: entree .24s ease-out;
}
@keyframes entree {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

h1 { font-size: 2.7rem; line-height: 1.05; margin: 0; font-weight: 600; letter-spacing: -.025em; }
h2 { font-size: 1.5rem; margin: 0; line-height: 1.22; font-weight: 600; letter-spacing: -.012em; }
h3 { font-size: .78rem; margin: 10px 0 0; color: var(--doux); font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
p { margin: 0; }
small { font-size: .82em; }

.gros { font-weight: 600; letter-spacing: -.02em; }
.doux { color: var(--doux); }
.centre { text-align: center; margin: auto 0; display: flex; flex-direction: column; gap: 16px; }
.ligne { display: flex; gap: 10px; align-items: center; }
.ecarte { justify-content: space-between; }
.pousse { margin-top: auto; }

/* Accueil */
.marque { display: flex; flex-direction: column; align-items: center; gap: 16px; margin: 11vh 0 26px; text-align: center; }
.marque svg { display: block; width: 84px; height: 84px; }
.separateur { display: flex; align-items: center; gap: 12px; color: var(--doux); font-size: .88rem; margin: 8px 0; }
.separateur::before, .separateur::after { content: ""; flex: 1; height: 1px; background: var(--ligne); }

/* Commandes */
button, input, select { font: inherit; color: inherit; }

button {
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: .005em;
  transition: transform .1s ease, background .15s ease, opacity .15s ease;
}
button:active:not(:disabled) { transform: scale(.98); }
button:disabled { opacity: .35; }
button.second { background: var(--surface-haut); color: var(--texte); }
button.petit { min-height: 48px; min-width: 48px; padding: 0; background: transparent; color: var(--doux); }
:focus-visible { outline: 2px solid var(--accent-clair); outline-offset: 2px; }

input[type="text"], select {
  width: 100%;
  min-height: 54px;
  padding: 0 15px;
  border: 1px solid var(--ligne);
  border-radius: 14px;
  background: var(--surface);
  color: var(--texte);
}
select option { color: #000; }
input::placeholder { color: var(--doux); opacity: 1; }
input[type="range"] { width: 100%; height: 48px; accent-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 6px; color: var(--doux); font-size: .88rem; }

/* Panneaux */
.bloc { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 16px; }
.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.liste li { background: var(--surface); border: 1px solid var(--ligne); border-radius: 14px; padding: 9px 13px; min-height: 56px; }
.absent { opacity: .45; }

/* Salon */
.salon { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.salon small { display: block; color: var(--doux); font-size: .74rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.code { font-size: clamp(2.5rem, 12.5vw, 3rem); line-height: 1.15; font-weight: 600; letter-spacing: .07em; }
.qr { display: block; width: 112px; height: 112px; padding: 4px; border-radius: 12px; background: #fff; }
.invite { grid-column: 1 / -1; }

.joueur { display: flex; align-items: center; gap: 11px; min-width: 0; }
.joueur small { color: var(--doux); }

.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.liste-themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme { min-height: 50px; padding: 0 12px; border: 1px solid var(--ligne); background: var(--surface); color: var(--texte); font-weight: 500; }
.theme:first-child { grid-column: 1 / -1; }
.theme.choisi { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.theme:disabled { opacity: 1; color: var(--doux); }
.theme.choisi:disabled { color: #fff; }
.jeux { grid-template-columns: 1fr; }
.adultes .theme:first-child { grid-column: auto; }
.note { font-size: .86rem; margin-top: -6px; }
.jeux .theme { min-height: 62px; padding: 8px 15px; text-align: left; }
.jeux strong, .jeux small { display: block; }
.jeux strong { font-weight: 600; }
.jeux small { color: var(--doux); font-weight: 400; font-size: .84rem; }
.jeux .choisi small { color: rgba(255, 255, 255, .86); }

details.reglages { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 0 15px; }
details.reglages summary { min-height: 54px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; font-weight: 500; }
details.reglages summary::-webkit-details-marker { display: none; }
details.reglages summary::after { content: "▾"; color: var(--doux); font-size: .8rem; transition: transform .15s; }
details.reglages[open] summary::after { transform: rotate(180deg); }
details.reglages summary span { color: var(--doux); font-weight: 400; font-size: .85rem; margin-left: auto; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 15px; }

.collant {
  position: sticky;
  bottom: 0;
  margin: auto -20px -20px;
  padding: 22px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--fond) 30%);
  display: flex;
  flex-direction: column;
}

/* En jeu */
.entete { display: flex; flex-direction: column; gap: 9px; }
.haut { display: flex; justify-content: space-between; color: var(--doux); font-size: .9rem; }
.croix { min-height: 40px; min-width: 40px; margin-left: 6px; color: var(--doux); }
.quitter { background: transparent; border: 1px solid var(--ligne); color: var(--doux); }
.chrono { color: var(--texte); font-weight: 600; font-variant-numeric: tabular-nums; }
.presse .chrono { color: #ff6b81; animation: battement 1s ease-in-out infinite; }
.presse .barre i { background: #ff6b81; }
@keyframes battement { 50% { opacity: .45; } }
.barre { height: 4px; border-radius: 4px; background: var(--surface-haut); overflow: hidden; }
.barre i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--accent); transition: width .25s linear; }

.question {
  --mode: #5a4de6;
  background: var(--papier);
  color: var(--encre);
  border-radius: 20px;
  padding: 20px 20px 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .38);
}
.question[data-mode="curseur"] { --mode: #0f8f7c; }
.question[data-mode="mot"] { --mode: #c8325f; }
.question[data-mode="classement"] { --mode: #a8620c; }
.question[data-mode="choix"] { --mode: #1f6fc0; }
.question[data-mode="qui"] { --mode: #5a4de6; }
.question .etiquette {
  display: block;
  margin-bottom: 9px;
  color: var(--mode);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.question.petite { padding: 13px 16px 15px; border-radius: 16px; box-shadow: none; }
.question.petite h2 { font-size: 1.08rem; }
.question.arrive { animation: carte-arrive .42s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes carte-arrive {
  from { transform: translateY(18px) scale(.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.consigne { color: var(--doux); }
.choix { display: flex; flex-direction: column; gap: 10px; }
.choix button { min-height: 60px; padding: 8px 16px; text-align: left; font-weight: 500; }
.alerte { padding: 12px 14px; border-radius: 14px; background: rgba(124, 108, 255, .18); border: 1px solid var(--accent); color: var(--texte); font-weight: 500; }

.grande-valeur { font-size: 3.6rem; line-height: 1.05; font-weight: 600; letter-spacing: -.02em; text-align: center; font-variant-numeric: tabular-nums; }

.roue { display: block; width: min(80vw, 330px); margin: 0 auto; overflow: visible; filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .5)); }
.roue g.tourne { transition: transform 2.5s cubic-bezier(.12, .7, .12, 1); transform-origin: 100px 100px; }
.roue text { font: 600 7.8px "Outfit", system-ui, sans-serif; text-anchor: middle; dominant-baseline: middle; }
.roue .secteur { transition: opacity .25s; }
.roue .fini .secteur:not(.gagne) { opacity: .28; }
.roue .pointeur { transform-origin: 100px 6px; }
.roue.lancee .pointeur { animation: claque .13s ease-in-out 12 alternate, claque .26s ease-in-out 1.56s 4 alternate; }
@keyframes claque {
  from { transform: rotate(-7deg); }
  to { transform: rotate(7deg); }
}
.bonus { min-height: 1.5em; color: var(--or); font-size: 1.15rem; font-weight: 600; }

.classement { touch-action: pan-y; }
.classement li { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px; user-select: none; transition: background .12s, border-color .12s; }
.classement .poignee { touch-action: none; padding: 12px 6px; color: var(--doux); cursor: grab; }
.classement .nom { flex: 1; min-width: 0; }
.classement li.tenu { background: var(--surface-haut); border-color: var(--accent); }

.trombi { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.trombi .personne { width: 68px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .8rem; color: var(--doux); overflow: hidden; }
.trombi .personne span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trombi .avatar { width: 46px; height: 46px; font-size: .95rem; opacity: .28; transition: opacity .2s; }
.trombi .fait { color: var(--texte); }
.trombi .fait .avatar { opacity: 1; }

/* Révélation */
.frise { position: relative; height: 54px; margin: 28px 14px 6px; border-bottom: 2px solid var(--surface-haut); }
.frise i { position: absolute; bottom: -7px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--doux); }
.frise i.cible { background: var(--accent); width: 20px; height: 20px; margin-left: -10px; bottom: -11px; box-shadow: 0 0 0 5px rgba(124, 108, 255, .25); z-index: 1; }
.frise span { position: absolute; transform: translateX(-50%); white-space: nowrap; font-size: .85rem; }
.frise span.cible { color: var(--texte); font-weight: 600; top: -14px; }

.retourne { animation: retourne .4s ease-out both; animation-delay: calc(var(--i) * 1s); }
@keyframes retourne {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.points { color: var(--accent-clair); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Scores et fin */
.score { position: relative; overflow: hidden; }
.score::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--part) * 1%); background: rgba(124, 108, 255, .16); transition: width .5s ease; }
.score > * { position: relative; }
.liste li.moi { border-color: var(--accent); }

.gagnant { text-align: center; margin-top: 12px; }
.gagnant h2 { font-size: 1.9rem; }
.marches { display: flex; align-items: flex-end; justify-content: center; gap: 8px; min-height: 190px; }
.marche { flex: 1; max-width: 130px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.marche .nom { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.marche .socle {
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 12px 12px 0 0;
  background: var(--surface-haut);
  font-size: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  animation: monte .5s cubic-bezier(.2, .8, .25, 1) both;
  transform-origin: bottom;
}
@keyframes monte { from { transform: scaleY(.1); opacity: 0; } to { transform: none; opacity: 1; } }
.marche.r1 .avatar { width: 52px; height: 52px; font-size: 1.05rem; box-shadow: 0 0 0 2px var(--fond), 0 0 0 4px var(--or); }
.marche.r1 .socle { height: 108px; background: var(--or); color: var(--encre); font-size: 1.4rem; }
.marche.r2 .socle { height: 76px; }
.marche.r3 .socle { height: 54px; background: var(--surface); }

.tableau-defile { overflow-x: auto; padding: 8px; }
table { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: .85rem; }
th, td { padding: 8px 5px; text-align: center; border-radius: 8px; }
th { font-weight: 500; color: var(--doux); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td { font-variant-numeric: tabular-nums; font-weight: 500; }
td.vide { color: var(--surface-haut); }

.titres { display: grid; gap: 8px; }
.titre { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--ligne); border-radius: 14px; background: var(--surface); }
.titre span { color: var(--doux); }
.titre strong { font-weight: 600; }

#toast {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--papier);
  color: var(--encre);
  font-weight: 500;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}

@media (prefers-reduced-motion: reduce) {
  main, .question.arrive, .marche .socle, .presse .chrono { animation: none; }
  .retourne { animation-duration: .01s; }
  .roue g.tourne { transition-duration: .4s; }
  .roue.lancee .pointeur { animation: none; }
}
