/* Les 80 ans d'Anne : thème automne en Corrèze (bordeaux, doré, vert forêt, crème).
   Mobile d'abord, très gros textes et boutons, forts contrastes. */

:root {
  --bordeaux: #7a1f2b;
  --bordeaux-fonce: #5a1420;
  --dore: #c9962b;
  --dore-clair: #f3dfa8;
  --foret: #2f5233;
  --foret-fonce: #1f3a23;
  --creme: #fbf5e9;
  --carte: #fffdf8;
  --encre: #2a1a14;
  --doux: #5e4a40;
  --ligne: #e3d5bd;
  --ok: #2f5233;
  --ko: #9b2226;
  --a: #7a1f2b;   /* couleurs des 4 réponses du quiz */
  --b: #2f5233;
  --c: #9a6a00;
  --d: #2d4a6b;
  --rayon: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 20px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--creme);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; color: var(--bordeaux); }
h2 { font-size: 1.4rem; color: var(--bordeaux); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
a { color: var(--bordeaux); }
img { max-width: 100%; }

/* Gros « 80 » décoratif en fond */
.deco80 {
  position: fixed; right: -.15em; bottom: -.25em; z-index: 0;
  font: 900 46vmin/1 Georgia, serif; color: var(--dore); opacity: .10;
  pointer-events: none; user-select: none;
}
#app { position: relative; z-index: 1; max-width: 640px; margin: 0 auto; padding: 0 16px calc(110px + env(safe-area-inset-bottom)); }
#app.sans-onglets { padding-bottom: 40px; }
.loading { padding: 40vh 0 0; text-align: center; font-size: 1.2rem; color: var(--doux); }

/* En-tête */
.entete { padding: calc(14px + env(safe-area-inset-top)) 0 10px; display: flex; align-items: center; gap: 12px; }
.entete h1 { margin: 0; font-size: 1.6rem; flex: 1; }
.entete .pastille80 {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: var(--bordeaux); color: var(--dore-clair);
  display: grid; place-items: center; font: 900 1.25rem/1 Georgia, serif;
  box-shadow: 0 0 0 3px var(--dore);
}

/* Bandeau hors ligne : dans le flux de la page, jamais par-dessus un champ */
.horsligne { background: var(--dore-clair); color: var(--encre); border: 2px solid var(--dore); border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; font-weight: 600; }

/* Cartes */
.box { background: var(--carte); border: 2px solid var(--ligne); border-radius: var(--rayon); padding: 18px; margin: 0 0 16px; box-shadow: 0 2px 0 var(--ligne); }
.box.accent { border-color: var(--dore); }
.muted { color: var(--doux); }
.petit { font-size: .85rem; }
.centre { text-align: center; }

/* Boutons */
button, .btn {
  font: inherit; font-weight: 700; font-size: 1.1rem;
  min-height: 60px; padding: 14px 20px; border-radius: 16px; border: 0;
  background: var(--bordeaux); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; touch-action: manipulation;
  transition: transform .08s ease, filter .15s ease;
}
button:active, .btn:active { transform: scale(.97); }
button:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 4px solid var(--dore); outline-offset: 2px; }
button[disabled] { opacity: .5; cursor: default; }
.btn-large { width: 100%; }
.btn-or { background: var(--dore); color: var(--encre); }
.btn-vert { background: var(--foret); }
.btn-clair { background: transparent; color: var(--bordeaux); border: 3px solid var(--bordeaux); }
.lien-discret { background: none; border: 0; color: var(--doux); text-decoration: underline; font-weight: 500; font-size: 1rem; min-height: 48px; padding: 8px; }
.rangee { display: flex; gap: 10px; flex-wrap: wrap; }
.rangee > * { flex: 1 1 140px; }

/* Champs */
label { display: block; font-weight: 700; margin: 12px 0 6px; }
input[type=text], input[type=password], textarea, select {
  width: 100%; font: inherit; font-size: 1.1rem; padding: 14px; min-height: 56px;
  border: 2px solid var(--doux); border-radius: 14px; background: #fff; color: var(--encre);
}
textarea { min-height: 120px; resize: vertical; }
input[type=file] { font-size: 1rem; max-width: 100%; }
.erreur { color: var(--ko); font-weight: 700; }

/* Onglets du bas */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--bordeaux-fonce);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,.2);
}
.onglets button {
  flex: 1; min-height: 64px; padding: 4px 2px; border-radius: 12px;
  background: transparent; color: #f6e7c9; font-size: .78rem; font-weight: 700;
  flex-direction: column; gap: 2px;
}
.onglets button .ico { font-size: 1.5rem; line-height: 1; }
.onglets button[aria-selected=true] { background: var(--dore); color: var(--encre); }
.onglets .pastille { position: absolute; margin: -6px 0 0 26px; background: var(--dore); color: var(--encre); border-radius: 10px; font-size: .7rem; padding: 0 6px; }
/* Clavier ouvert : les onglets fixes se cachent pour ne rien recouvrir */
body.saisie .onglets { display: none; }

/* Programme */
.programme { white-space: pre-line; font-size: 1.1rem; }
.annonce { padding: 10px 0; border-bottom: 1px solid var(--ligne); font-weight: 600; }
.annonce:last-child { border-bottom: 0; }

/* Missions */
.mission { position: relative; }
.niveau { display: inline-block; font-size: .85rem; font-weight: 800; padding: 4px 12px; border-radius: 99px; color: #fff; margin-bottom: 8px; }
.niveau.facile { background: var(--foret); }
.niveau.moyen { background: var(--c); }
.niveau.difficile { background: var(--bordeaux); }
.mission .texte { font-size: 1.25rem; font-weight: 700; margin-bottom: 14px; }
.etat { font-weight: 800; font-size: 1.1rem; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; }
.etat.attente { background: var(--dore-clair); }
.etat.reussie { background: #dcebd9; color: var(--foret-fonce); }
.etat.refusee { background: #f6d9d6; color: var(--ko); }
.jokers { font-size: 1rem; color: var(--doux); margin: 4px 0 14px; }

/* Panneau plein écran (mission accomplie, livre d'or, question secrète) */
.panneau { position: fixed; inset: 0; z-index: 40; background: var(--creme); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panneau .dedans { max-width: 640px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px 40px; }
.apercu { display: block; max-height: 40vh; margin: 10px auto; border-radius: 12px; }

/* Bingo */
.grille { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; } /* minmax(0,…) : un mot long ne fait jamais déborder la grille */
.case {
  min-height: 92px; padding: 6px 4px; border-radius: 12px; font-size: .72rem; font-weight: 700; line-height: 1.2;
  background: var(--carte); color: var(--encre); border: 2px solid var(--ligne); hyphens: auto; overflow-wrap: break-word;
  display: block; position: relative; padding: 14px 3px 6px; text-align: center;
}
.case.cochee { background: var(--foret); color: #fff; border-color: var(--foret-fonce); }
.case.cochee::before { content: "✓"; position: absolute; top: 2px; left: 6px; font-size: .8rem; }
.case.ligne { background: var(--dore); color: var(--encre); border-color: var(--bordeaux); }

/* Quiz */
.chrono { height: 18px; background: var(--ligne); border-radius: 9px; overflow: hidden; margin: 10px 0 6px; }
.chrono > div { height: 100%; background: var(--dore); transition: width .2s linear; }
.secondes { font: 900 2.2rem/1 Georgia, serif; text-align: center; color: var(--bordeaux); }
.question { font-size: 1.45rem; font-weight: 800; margin: 10px 0 16px; }
.reponses { display: grid; grid-template-columns: 1fr; gap: 12px; }
.rep { min-height: 76px; font-size: 1.2rem; text-align: left; justify-content: flex-start; padding: 14px 16px; }
.rep .lettre { flex: none; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; font-weight: 900; }
.rep.a { background: var(--a); } .rep.b { background: var(--b); } .rep.c { background: var(--c); } .rep.d { background: var(--d); }
.rep.choisie { box-shadow: 0 0 0 5px var(--dore); }
.rep.eteinte { opacity: .35; }
.vote { margin: 8px 0; }
.vote .barre { height: 34px; border-radius: 10px; display: flex; align-items: center; padding: 0 10px; color: #fff; font-weight: 800; min-width: 44px; }
.vote.bonne .libelle { font-weight: 900; }
.vote.bonne .libelle::after { content: "  ✓ bonne réponse"; color: var(--foret); }
.gain { font: 900 1.6rem/1.2 Georgia, serif; text-align: center; margin: 8px 0 14px; }
.top3 li { font-size: 1.15rem; font-weight: 700; margin: 4px 0; }

/* Podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin: 20px 0; }
.podium .marche { flex: 1; max-width: 140px; text-align: center; }
.podium .socle { background: var(--bordeaux); color: var(--dore-clair); border-radius: 12px 12px 0 0; font: 900 2rem/1 Georgia, serif; padding-top: 12px; }
.podium .p1 .socle { height: 150px; background: var(--dore); color: var(--encre); }
.podium .p2 .socle { height: 110px; }
.podium .p3 .socle { height: 80px; background: var(--foret); }
.podium .qui { font-weight: 800; font-size: 1.05rem; margin-bottom: 6px; overflow-wrap: anywhere; }
.podium .emoji { font-size: 2.2rem; display: block; }

/* Révélation : plein écran, synchronisée par l'horloge du serveur */
.revelation { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 50% 30%, var(--bordeaux), var(--bordeaux-fonce)); color: #fff; overflow-y: auto; }
.revelation .dedans { max-width: 640px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 16px 40px; text-align: center; }
.revelation h1, .revelation h2 { color: var(--dore-clair); }
.revelation .grand { font: 900 3rem/1.1 Georgia, serif; color: var(--dore); }
.revelation .mur { max-height: 62vh; border-radius: 16px; border: 4px solid var(--dore); }
.revelation .rang { background: rgba(255,255,255,.1); border-radius: 16px; padding: 14px; margin: 10px 0; animation: monte .6s ease both; }
.revelation .rang .n { font: 900 1.6rem/1 Georgia, serif; color: var(--dore); }
.revelation .rang .nom { font-size: 1.5rem; font-weight: 800; }
.revelation .rang .titre { font-style: italic; color: var(--dore-clair); }
.revelation .rang.premier { background: var(--dore); color: var(--encre); }
.revelation .rang.premier .n, .revelation .rang.premier .titre { color: var(--bordeaux-fonce); }
.revelation .mot { white-space: pre-line; font-size: 1.3rem; background: rgba(0,0,0,.2); border-radius: 16px; padding: 18px; margin-top: 16px; }
.suspense { font: 900 4rem/1 Georgia, serif; color: var(--dore); animation: pulse 1s ease-in-out infinite; }
.revelation .lien-discret { color: var(--dore-clair); }

/* Mode Anne : encore plus grand, une seule chose à l'écran */
body.anne { font-size: 1.15rem; }
body.anne .question { font-size: 1.8rem; }
body.anne .rep { min-height: 92px; font-size: 1.45rem; }
main .grand { font: 900 1.6rem/1.2 Georgia, serif; color: var(--bordeaux); margin: 8px 0; }
.anne-ecran { text-align: center; padding-top: 10px; }
.anne-ecran .grand { font: 900 2.2rem/1.2 Georgia, serif; color: var(--bordeaux); margin: 20px 0; }

/* Annonce « BINGO ! » à tout le monde */
.toast {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 16px; right: 16px; z-index: 60;
  max-width: 600px; margin: 0 auto; background: var(--foret); color: #fff; font-weight: 800; font-size: 1.15rem;
  padding: 16px 18px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.3); animation: monte .4s ease both;
}
body.saisie .toast { display: none; } /* jamais au-dessus d'une zone de saisie */
.bingo-geant { font: 900 3.6rem/1 Georgia, serif; color: var(--bordeaux); text-align: center; margin: 10px 0; animation: pulse .8s ease-in-out 3; }

@keyframes monte { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 560px) {
  .reponses { grid-template-columns: 1fr 1fr; }
  .case { font-size: .85rem; min-height: 110px; }
}
