/* Quiz d'Halloween Reanova : thème nuit, pensé d'abord pour le téléphone. */
:root {
  --nuit: #120a1f;
  --nuit-2: #1d1131;
  --carte: rgba(34, 20, 56, .82);
  --carte-2: rgba(255, 255, 255, .05);
  --bord: rgba(255, 255, 255, .10);
  --texte: #f5f0fc;
  --texte-2: #b9add2;
  --orange: #ff7a1a;
  --orange-2: #ffa24a;
  --orange-pale: rgba(255, 122, 26, .16);
  --vert: #6ee7a0;
  --vert-pale: rgba(110, 231, 160, .14);
  --rouge: #ff7070;
  --rouge-pale: rgba(255, 112, 112, .14);
  --rayon: 16px;
  --ombre: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--nuit); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--texte);
  background:
    radial-gradient(120% 60% at 50% 0%, #2a1748 0%, transparent 60%),
    linear-gradient(180deg, #1a0f2e 0%, var(--nuit) 50%, #0b0614 100%);
  background-attachment: fixed;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Ciel : lune et étoiles, en arrière-plan fixe. */
.ciel { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.ciel::before {
  content: ""; position: absolute; width: 2px; height: 2px; border-radius: 50%; top: 0; left: 0;
  background: transparent;
  box-shadow:
    8vw 12vh #fff8, 22vw 6vh #fff6, 35vw 18vh #fff5, 48vw 9vh #fff7, 63vw 22vh #fff4,
    76vw 4vh #fff6, 91vw 15vh #fff5, 14vw 30vh #fff3, 57vw 35vh #fff3, 84vw 40vh #fff4,
    5vw 55vh #fff3, 30vw 48vh #fff2, 70vw 60vh #fff3, 95vw 70vh #fff2, 42vw 75vh #fff2;
}
.lune {
  position: absolute; top: 46px; right: -40px; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #fff5d6 0%, #ffe3a3 45%, #f2c46d 100%);
  box-shadow: 0 0 60px 18px rgba(255, 214, 140, .22), 0 0 140px 60px rgba(255, 170, 80, .10);
  opacity: .85;
}

a { color: var(--orange-2); }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; font-weight: 800; }
h2 { font-size: 1.15rem; margin: 0 0 14px; font-weight: 800; }
p { margin: 0 0 12px; }
.intro { color: var(--texte-2); }
.note { color: var(--texte-2); font-size: .92rem; margin-top: 18px; }
.visuellement-cache {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Barre du haut */
.barre {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(14, 8, 26, .72); border-bottom: 1px solid var(--bord);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.marque { display: flex; align-items: center; gap: 8px; color: var(--texte); text-decoration: none; font-weight: 800; }
.marque img { display: block; }
.marque-societe { color: var(--orange-2); }
.barre-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.barre-actions form { margin: 0; }
.lien-barre { color: var(--texte-2); text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.lien-barre:hover { color: var(--texte); background: var(--carte-2); }
.qui { display: none; color: var(--texte-2); font-size: .92rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { width: 100%; margin: 20px auto 32px; padding: 0 14px; flex: 1; }
main.etroit { max-width: 640px; }
main.large { max-width: 1180px; }

.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 22px 18px; margin-bottom: 18px; box-shadow: var(--ombre);
}

/* Boutons */
.bouton, .bouton-secondaire, .bouton-discret {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border-radius: 12px; padding: 12px 20px; border: 1px solid transparent;
  transition: background .15s, transform .1s, opacity .15s, box-shadow .15s;
}
.bouton {
  background: linear-gradient(180deg, var(--orange-2), var(--orange)); color: #1b0d02;
  box-shadow: 0 6px 22px rgba(255, 122, 26, .35);
}
.bouton:hover { box-shadow: 0 8px 28px rgba(255, 122, 26, .5); }
.bouton:active { transform: translateY(1px); }
.bouton[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }
.bouton-grand { width: 100%; padding: 15px 20px; font-size: 1.08rem; }
.bouton-secondaire { background: var(--carte-2); color: var(--texte); border-color: var(--bord); }
.bouton-secondaire:hover { background: rgba(255, 255, 255, .1); }
.bouton-discret { background: none; color: var(--texte-2); padding: 6px 10px; font-weight: 600; }
.bouton-discret:hover { color: var(--texte); background: var(--carte-2); }
:focus-visible { outline: 3px solid var(--orange-2); outline-offset: 2px; }

/* Formulaires */
.pile { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.pile label, .etiquette { font-weight: 700; font-size: .95rem; margin-top: 8px; }
.pile .bouton { margin-top: 18px; }
input[type=text], input[type=password], input[type=search], .select {
  font: inherit; font-size: 1rem; padding: 12px 14px; width: 100%;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px;
  background: rgba(10, 5, 20, .55); color: var(--texte);
}
input::placeholder { color: #8f83a8; }
input:focus, .select:focus { border-color: var(--orange-2); outline: none; box-shadow: 0 0 0 3px var(--orange-pale); }
.alerte {
  background: var(--rouge-pale); border: 1px solid rgba(255, 112, 112, .4); color: #ffd2d2;
  padding: 10px 14px; border-radius: 12px; font-weight: 600;
}

/* Connexion et accueil */
.connexion, .accueil { text-align: center; }
.connexion { max-width: 440px; margin: 24px auto; }
.connexion .pile { text-align: left; }
.mascotte { display: block; margin: -4px auto 6px; width: 120px; height: auto; animation: flotter 4s ease-in-out infinite; }
.accueil .mascotte { width: 140px; }
.regles { text-align: left; margin: 18px 0 22px; padding: 0; list-style: none; display: grid; gap: 10px; }
.regles li {
  background: var(--carte-2); border: 1px solid var(--bord); border-radius: 12px; padding: 10px 14px 10px 40px;
  position: relative; color: var(--texte-2);
}
.regles li strong { color: var(--texte); }
.regles li::before {
  content: ""; position: absolute; left: 14px; top: 17px; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--orange-2), var(--orange));
  box-shadow: 0 0 10px rgba(255, 122, 26, .6);
}

@keyframes flotter {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .mascotte, .fantome { animation: none !important; }
}

/* Jeu */
.jeu { display: flex; flex-direction: column; }
.jeu-entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pastille {
  display: inline-block; background: var(--orange-pale); color: var(--orange-2); border: 1px solid rgba(255, 162, 74, .35);
  font-weight: 800; font-size: .88rem; padding: 4px 12px; border-radius: 999px; letter-spacing: .02em;
}
.score-provisoire { color: var(--texte-2); font-weight: 600; }
.score-provisoire strong { color: var(--texte); font-size: 1.1rem; }
.progression {
  width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; margin-bottom: 4px;
  background: rgba(255, 255, 255, .08); -webkit-appearance: none; appearance: none;
}
.progression::-webkit-progress-bar { background: rgba(255, 255, 255, .08); border-radius: 999px; }
.progression::-webkit-progress-value { background: linear-gradient(90deg, var(--orange), var(--orange-2)); border-radius: 999px; }
.progression::-moz-progress-bar { background: linear-gradient(90deg, var(--orange), var(--orange-2)); border-radius: 999px; }

.scene {
  margin: 6px auto 4px; display: grid; place-items: center; width: 100%;
  background: radial-gradient(closest-side, rgba(160, 110, 255, .22), rgba(255, 122, 26, .07) 60%, transparent 100%);
}
.fantome {
  display: block; width: min(72vw, 330px, 40vh); height: auto; aspect-ratio: 1;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .55)) drop-shadow(0 0 18px rgba(255, 255, 255, .08));
  animation: flotter 4.5s ease-in-out infinite;
}
.scene-petite .fantome { width: min(58vw, 240px); }
.question { text-align: center; font-size: 1.3rem; margin: 6px 0 12px; }

.reponse { display: flex; flex-direction: column; gap: 8px; }
.recherche { font-size: 1.05rem; }
.compteur { color: var(--texte-2); font-size: .85rem; margin: 0 2px; min-height: 1.2em; }
.liste {
  display: grid; grid-template-columns: 1fr; gap: 6px;
  max-height: 34vh; overflow-y: auto; padding: 2px; margin: 0 -2px;
  overscroll-behavior: contain; scrollbar-color: rgba(255,255,255,.25) transparent;
}
.choix {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--bord); background: var(--carte-2);
  font-weight: 600; transition: background .12s, border-color .12s;
}
.choix:hover { background: rgba(255, 255, 255, .09); }
.choix:focus-within { border-color: var(--orange-2); }
.choix input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid #8f83a8; display: grid; place-items: center;
}
.choix input::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.choix input:checked { border-color: var(--orange); }
.choix input:checked::after { background: var(--orange); }
.choix input:focus-visible { outline: none; }
.choix.actif { background: var(--orange-pale); border-color: var(--orange); }
.aucun { color: var(--texte-2); text-align: center; padding: 14px; margin: 0; }
.barre-valider {
  position: sticky; bottom: 0; padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--nuit) 35%);
}

/* Correction */
.correction { text-align: center; }
.correction .pastille { margin-bottom: 10px; }
.verdict { font-size: 2.1rem; margin: 4px 0 6px; }
.juste .verdict { color: var(--vert); }
.rate .verdict { color: var(--rouge); }
.correction.juste { border-color: rgba(110, 231, 160, .35); }
.correction.rate { border-color: rgba(255, 112, 112, .35); }
.revelation { font-size: 1.15rem; }
.revelation strong { color: var(--orange-2); }
.ta-reponse { color: var(--texte-2); }
.correction .score-provisoire { margin: 4px 0 16px; }

/* Résultat */
.resultat { text-align: center; }
.sur-titre { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; color: var(--texte-2); font-weight: 700; margin-bottom: 0; }
.score-final { margin: 0; line-height: 1; font-weight: 900; }
.score-chiffre {
  font-size: 5rem;
  background: linear-gradient(180deg, #fff4e6, var(--orange-2) 60%, var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.score-total { font-size: 2rem; color: var(--texte-2); }
.duree { color: var(--texte-2); font-size: 1.05rem; margin-top: 6px; }
.position { font-size: 1.1rem; }
.position strong { color: var(--orange-2); }
.commentaire { font-weight: 700; margin-bottom: 0; }

.tableau-defilant { overflow-x: auto; margin: 0 -4px; }
.classement { width: 100%; border-collapse: collapse; font-size: .96rem; }
.classement th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texte-2); padding: 6px 8px; border-bottom: 1px solid var(--bord);
}
.classement td { padding: 9px 8px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.classement .num { text-align: right; white-space: nowrap; }
.classement .rang { font-weight: 800; color: var(--texte-2); white-space: nowrap; width: 3.2em; }
.classement .nom { font-weight: 600; }
.classement .temps { color: var(--texte-2); }
.classement tr.podium-1 .rang { color: #ffd166; }
.classement tr.podium-2 .rang { color: #d9d9e6; }
.classement tr.podium-3 .rang { color: #e8a36a; }
.classement tr.moi td { background: var(--orange-pale); }
.classement tr.moi td:first-child { border-radius: 10px 0 0 10px; box-shadow: inset 3px 0 0 var(--orange); }
.classement tr.moi td:last-child { border-radius: 0 10px 10px 0; }
.classement.admin { font-size: .9rem; }
.vide { color: var(--texte-2); text-align: center; padding: 10px 0; margin: 0; }
.actions { margin: 18px 0 0; text-align: center; }

.recap { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.recap-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px;
  background: var(--carte-2); border: 1px solid var(--bord);
}
.recap-item img { width: 64px; height: 64px; flex: none; }
.recap-item p { margin: 0; }
.recap-nom { font-weight: 700; }
.recap-donnee { color: var(--texte-2); font-size: .9rem; }
.marque-reponse { display: inline-block; width: 1.2em; font-weight: 900; }
.recap-item.juste .marque-reponse { color: var(--vert); }
.recap-item.rate .marque-reponse { color: var(--rouge); }

.pied { text-align: center; color: #7d7196; font-size: .82rem; padding: 18px 16px 26px; }

/* Petits téléphones : barre du haut sur une ligne. */
@media (max-width: 419px) {
  .barre { padding-left: 12px; padding-right: 12px; gap: 8px; }
  .marque { font-size: .95rem; gap: 6px; }
  .marque img { width: 26px; height: 26px; }
  .marque-societe { display: none; }
  .barre-actions { gap: 2px; }
  .lien-barre, .barre .bouton-discret { padding: 6px 7px; font-size: .9rem; }
}

/* Écrans plus larges */
@media (min-width: 560px) {
  .carte { padding: 28px 30px; }
  .qui { display: inline; }
  .liste { grid-template-columns: 1fr 1fr; max-height: 300px; }
  .recap { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.8rem; }
  .question { font-size: 1.45rem; }
}
@media (min-width: 900px) {
  main { margin-top: 32px; }
  .lune { top: 70px; right: 6vw; width: 200px; height: 200px; }
}

/* -- Correction : le fantôme s'évapore et laisse voir la vraie photo ------------------- */
.scene-revelation { position: relative; display: grid; place-items: center; }
.scene-revelation > * { grid-area: 1 / 1; }
.photo-revelee {
  width: min(46vw, 200px); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 50%;
  border: 4px solid var(--orange-2);
  box-shadow: 0 0 0 7px var(--orange-pale), 0 18px 40px rgba(0, 0, 0, .5);
  opacity: 0; animation: photo-apparait .9s cubic-bezier(.2, .8, .2, 1) 1.05s forwards;
}
.correction.juste .photo-revelee { border-color: var(--vert); box-shadow: 0 0 0 7px var(--vert-pale), 0 0 36px rgba(110, 231, 160, .32), 0 18px 40px rgba(0, 0, 0, .5); }
.correction.rate .photo-revelee { border-color: var(--rouge); box-shadow: 0 0 0 7px var(--rouge-pale), 0 0 36px rgba(255, 112, 112, .28), 0 18px 40px rgba(0, 0, 0, .5); }
.fantome-disparait { position: relative; z-index: 1; animation: s-evaporer 1.5s cubic-bezier(.55, 0, .7, .45) .45s forwards; }
.brume {
  position: relative; z-index: 2; width: 75%; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .6), rgba(230, 215, 255, .18) 45%, rgba(255, 255, 255, 0) 68%);
  opacity: 0; transform: scale(.3); animation: brume 1.7s ease-out .85s forwards;
}
@keyframes s-evaporer {
  0%   { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); filter: blur(0); }
  22%  { opacity: 1; transform: translateY(6px) scale(.96) rotate(-4deg); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-120px) scale(1.35) rotate(7deg); filter: blur(14px); }
}
@keyframes photo-apparait {
  from { opacity: 0; transform: scale(.65); filter: blur(10px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes brume {
  0%   { opacity: 0; transform: scale(.3); }
  35%  { opacity: .9; }
  100% { opacity: 0; transform: scale(1.7); }
}
@media (prefers-reduced-motion: reduce) {
  .fantome-disparait, .brume { display: none; }
  .photo-revelee { animation: none; opacity: 1; }
}

/* -- Stats du tableau des scores ------------------------------------------------------- */
.stats-grille { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 6px; }
@media (min-width: 560px) { .stats-grille { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--carte-2); border: 1px solid var(--bord); border-radius: 12px; padding: 14px 16px; }
.stat-titre { margin: 0 0 4px; color: var(--texte-2); font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.stat-nom { margin: 0; font-size: 1.2rem; font-weight: 800; }
.stat-plus .stat-nom { color: var(--vert); }
.stat-moins .stat-nom { color: var(--orange-2); }
.stat-detail { margin: 2px 0 10px; color: var(--texte-2); font-size: .92rem; }
.stat .progression { margin: 0; }
.jauge-plus::-webkit-progress-value { background: var(--vert); }
.jauge-plus::-moz-progress-bar { background: var(--vert); }
.stat-moyenne { margin: 14px 0 0; color: var(--texte-2); }
.stat-moyenne strong { color: var(--texte); }

/* -- Accueil : annonce du prix ---------------------------------------------------------- */
.prix {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 12px; text-align: center;
  background: var(--orange-pale); border: 1px solid rgba(255, 122, 26, .45);
  color: var(--texte); font-weight: 700; box-shadow: 0 0 24px rgba(255, 122, 26, .15);
}
.prix strong { color: var(--orange-2); }

/* -- Farce (console admin et résultat) --------------------------------------------------- */
.farce-admin .farces { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; gap: 10px; }
.farce-armee { padding: 12px 14px; border-radius: 12px; background: var(--orange-pale); border: 1px solid rgba(255, 122, 26, .45); }
.farce-armee p { margin: 0 0 8px; }
.farce-form { display: grid; gap: 6px; max-width: 420px; margin-top: 10px; }
.farce-form .bouton { margin-top: 10px; justify-self: start; }
.pastille-farce { font-size: .75rem; vertical-align: middle; }
.farce-revelee {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; font-weight: 700;
  background: var(--orange-pale); border: 1px solid rgba(255, 122, 26, .45);
}
