/* Quiz en direct M@N : charte MonAssistantNumérique */
@font-face { font-family: 'Gordita'; src: url('fonts/Gordita-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Gordita'; src: url('fonts/Gordita-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Gordita'; src: url('fonts/Gordita-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Gordita'; src: url('fonts/Gordita-Black.woff2') format('woff2'); font-weight: 900; font-display: swap; }

:root {
  --jaune: #FDD12F;
  --jaune-pale: #FFF4C2;
  --jaune-fonce: #E5B80A;
  --encre: #2E2E2E;
  --texte: #6F6F6F;
  --gris-doux: #9A9A9A;
  --ligne: #E4E4E4;
  --gris-fond: #F5F5F5;
  --creme: #FFFBF0;
  --blanc: #FFFFFF;
  --orange: #F39200;
  --vert: #7FB93B;
  --erreur: #D9345D;
  --rayon: 16px;
  --ombre: 0 6px 24px rgba(46, 46, 46, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Gordita', 'Helvetica Neue', Arial, sans-serif;
  color: var(--encre);
  background: var(--creme);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
p { margin: 0 0 .8em; color: var(--texte); }
.at { color: var(--orange); }
.cache { display: none !important; }

.surtitre {
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--texte);
}
.pastille {
  display: inline-block; background: var(--jaune); color: var(--encre);
  font-weight: 700; border-radius: 999px; padding: .2em .8em; font-size: .85rem;
}
.carte { background: var(--blanc); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 20px; }
.encadre { background: var(--jaune-pale); border-radius: 12px; padding: 14px 16px; color: var(--encre); }

/* Boutons : le jaune est réservé aux actions */
.btn {
  font: inherit; font-weight: 700; border: 0; cursor: pointer; border-radius: 999px;
  padding: 14px 24px; font-size: 1rem; background: var(--jaune); color: var(--encre);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--jaune-fonce); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--ligne); color: var(--gris-doux); cursor: not-allowed; }
.btn.secondaire { background: var(--blanc); border: 2px solid var(--encre); }
.btn.secondaire:hover { background: var(--gris-fond); }
.btn.danger { background: var(--blanc); border: 2px solid var(--erreur); color: var(--erreur); }
.btn.danger.arme { background: var(--erreur); color: var(--blanc); }
.btn:focus-visible, .choix:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--encre); outline-offset: 2px;
}

/* Barres de résultats */
.barres { display: grid; gap: 14px; }
.barre .libelle { display: flex; justify-content: space-between; gap: 12px; font-weight: 500; margin-bottom: 6px; }
.barre .libelle .val { font-weight: 700; white-space: nowrap; }
.barre .piste { height: 22px; background: var(--gris-fond); border-radius: 999px; overflow: hidden; }
.barre .rempli { height: 100%; width: 0; background: var(--encre); border-radius: 999px; transition: width .5s ease; }
.barre.juste .rempli { background: var(--vert); }
.barre.juste .libelle::after { content: none; }
.barre.revele:not(.juste) .rempli { background: var(--gris-doux); }
.marque-juste { color: var(--vert); font-weight: 700; }

/* ---------- Page de vote (smartphone) ---------- */
.vote { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; min-height: 100vh; }
.vote header { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 16px; }
.vote header img { height: 34px; width: auto; }
.vote .progression { font-size: .85rem; color: var(--texte); font-weight: 500; }
.vote h1 { font-size: 1.35rem; }
.vote .mascotte { display: block; width: 180px; max-width: 60%; margin: 8px auto 16px; }
.liste-choix { display: grid; gap: 10px; margin: 16px 0 20px; }
.choix {
  font: inherit; text-align: left; width: 100%; cursor: pointer;
  background: var(--blanc); color: var(--encre); border: 2px solid var(--ligne); border-radius: 14px;
  padding: 16px 16px 16px 52px; position: relative; font-weight: 500; font-size: 1.02rem; min-height: 56px;
}
.choix::before {
  content: ''; position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: 2px solid var(--gris-doux); border-radius: 50%; background: var(--blanc);
}
.choix.multiple::before { border-radius: 6px; }
.choix[aria-pressed="true"] { border-color: var(--encre); background: var(--jaune-pale); }
.choix[aria-pressed="true"]::before { border-color: var(--encre); background: var(--encre); box-shadow: inset 0 0 0 4px var(--blanc); }
.choix:disabled { cursor: default; }
.vote .btn { width: 100%; font-size: 1.05rem; padding: 16px; }
.message { margin-top: 14px; font-weight: 500; }
.message.ok { color: var(--encre); }
.message.ko { color: var(--erreur); }
.verdict { font-size: 1.2rem; font-weight: 700; margin: 6px 0 10px; }
.verdict.bon { color: var(--vert); }
.verdict.faux { color: var(--erreur); }

/* ---------- Écran de salle (vidéoprojecteur 16:9) ---------- */
.ecran { height: 100vh; overflow: hidden; display: flex; flex-direction: column; padding: 3vh 4vw; background: var(--creme); }
.ecran header { display: flex; align-items: center; justify-content: space-between; }
.ecran header img { height: 6vh; width: auto; }
.ecran .compteur { font-size: 2.2vh; font-weight: 500; color: var(--texte); }
.ecran .compteur b { color: var(--encre); font-size: 3vh; }
.ecran main { flex: 1; display: flex; gap: 4vw; align-items: center; min-height: 0; }
.ecran .accueil { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; gap: 4vw; align-items: center; }
.ecran .accueil h1 { font-size: 6vh; font-weight: 900; }
.ecran .accueil p { font-size: 2.8vh; }
.ecran .accueil .lien { font-size: 3vh; font-weight: 700; color: var(--encre); word-break: break-all; }
.ecran .qr-grand { background: var(--blanc); border-radius: 24px; box-shadow: var(--ombre); padding: 2.5vh; justify-self: center; }
.ecran .qr-grand img { display: block; width: 58vh; height: 58vh; }
.ecran .mascotte { height: 22vh; width: auto; margin-top: 2vh; }
.ecran .zone-question { flex: 1; min-width: 0; }
.ecran .zone-question h1 { font-size: 4.6vh; margin: 1vh 0 3.5vh; color: var(--encre); }
.ecran .barres { gap: 2.4vh; }
.ecran .barre .libelle { font-size: 2.7vh; }
.ecran .barre .piste { height: 4.2vh; }
.ecran .explication { margin-top: 3vh; font-size: 2.6vh; }
.ecran .colonne-qr { width: 24vh; text-align: center; flex-shrink: 0; }
.ecran .colonne-qr img { width: 22vh; height: 22vh; background: var(--blanc); border-radius: 14px; padding: 1vh; box-shadow: var(--ombre); }
.ecran .colonne-qr p { font-size: 1.9vh; margin-top: 1vh; }
.ecran .etat { font-size: 2.2vh; }

/* ---------- Animateur ---------- */
.anim { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.anim header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.anim header img { height: 38px; }
.anim .grille { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.anim ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.anim ol button {
  font: inherit; width: 100%; text-align: left; cursor: pointer; background: transparent;
  border: 0; border-radius: 10px; padding: 10px 12px; color: var(--encre);
}
.anim ol button:hover { background: var(--gris-fond); }
.anim ol button.actuelle { background: var(--jaune-pale); font-weight: 700; }
.anim ol .num { color: var(--texte); font-weight: 700; margin-right: 6px; }
.anim .commandes { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.anim .commandes .btn { padding: 12px 18px; font-size: .95rem; }
.anim .infos { display: flex; gap: 20px; flex-wrap: wrap; font-weight: 500; color: var(--texte); margin-bottom: 12px; }
.anim .infos b { color: var(--encre); }
.anim textarea {
  width: 100%; min-height: 360px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 2px solid var(--ligne); border-radius: 12px; padding: 12px; color: var(--encre); background: var(--blanc);
}
.anim details { margin-top: 20px; }
.anim summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.connexion { max-width: 420px; margin: 12vh auto; padding: 0 16px; }
.connexion input {
  font: inherit; width: 100%; padding: 14px 16px; border: 2px solid var(--ligne); border-radius: 12px; margin: 8px 0 14px;
}
@media (max-width: 760px) { .anim .grille { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }
.logo-connexion { height: 44px; width: auto; }
a.btn { display: inline-block; text-decoration: none; }
.vote header img, .ecran header img, .anim header img, .logo-connexion { border-radius: 8px; }

/* ---------- Éditeur de questions ---------- */
.ed-label { display: block; font-weight: 700; font-size: .9rem; margin: 14px 0 6px; color: var(--encre); }
.ed-champ { font: inherit; width: 100%; padding: 10px 12px; border: 2px solid var(--ligne); border-radius: 10px; color: var(--encre); background: var(--blanc); }
textarea.ed-champ { resize: vertical; min-height: 0; }
.ed-champ:focus-visible { outline: 3px solid var(--encre); outline-offset: 1px; }
.ed-champ[readonly] { background: var(--gris-fond); }
.ed-liste { display: grid; gap: 14px; margin: 16px 0; }
.ed-question { border: 2px solid var(--ligne); border-radius: 14px; padding: 14px; background: var(--creme); min-width: 0; }
.ed-entete { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ed-num { font-weight: 700; }
.ed-type { width: auto; flex: 1 1 180px; padding: 8px 10px; }
.ed-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ed-mini { font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; border-radius: 999px; padding: 7px 12px;
  background: var(--blanc); color: var(--encre); border: 2px solid var(--ligne); }
.ed-mini:hover:not(:disabled) { border-color: var(--encre); }
.ed-mini:disabled { color: var(--gris-doux); cursor: not-allowed; }
.ed-mini:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
.ed-suppr { color: var(--erreur); border-color: var(--erreur); }
.ed-suppr.arme { background: var(--erreur); color: var(--blanc); }
.ed-choix { display: grid; gap: 8px; }
.ed-ligne { display: flex; gap: 8px; align-items: center; min-width: 0; }
.ed-ligne .ed-champ { flex: 1; min-width: 0; }
.ed-ligne input[type="radio"] { width: 22px; height: 22px; accent-color: var(--vert); flex-shrink: 0; }
.ed-ajout-choix { margin-top: 10px; }
.ed-case { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-weight: 500; }
.ed-case input { width: 20px; height: 20px; accent-color: var(--encre); }
.ed-barre { display: flex; flex-wrap: wrap; gap: 10px; position: sticky; bottom: 0; background: var(--blanc); padding: 12px 0; }
.anim textarea.ed-champ { font: inherit; min-height: 0; padding: 10px 12px; }
.ed-retirer { padding: 6px 0; width: 36px; height: 36px; font-size: 1.1rem; line-height: 1; flex-shrink: 0; }

/* ---------- Bilan de fin de quiz ---------- */
.bilan-chiffres { display: flex; flex-wrap: wrap; gap: 16px; margin: 8px 0 18px; }
.bilan-chiffre { background: var(--blanc); border-radius: 14px; box-shadow: var(--ombre); padding: 12px 18px; display: grid; min-width: 0; }
.bilan-chiffre b { font-size: 1.8rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.bilan-chiffre span { color: var(--texte); font-weight: 500; font-size: .9rem; }
.bilan-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; }
.bilan-col, .bilan-sondage { min-width: 0; }
.zone-bilan h2 { font-size: 1.05rem; margin-bottom: 12px; }
.bilan-sondages { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.bilan-meta { font-size: .85rem; margin: -6px 0 10px; }
.bilan-tete { font-weight: 700; color: var(--encre); margin-top: 12px; font-size: .9rem; }
.zone-bilan .barres { gap: 10px; }
.zone-bilan .barre .libelle { font-size: .9rem; }
.zone-bilan .barre .piste { height: 14px; }
.anim-bilan { margin-top: 8px; }
.anim-bilan .bilan-cols { grid-template-columns: 1fr; }
@media (max-width: 760px) { .bilan-cols { grid-template-columns: 1fr; } }

/* Écran de salle : tailles relatives à l'écran */
.ecran .zone-bilan { flex: 1; min-width: 0; align-self: center; }
.ecran .zone-bilan h1 { font-size: 4.6vh; margin: 0.6vh 0 2vh; }
.ecran .zone-bilan h2 { font-size: 2.3vh; margin-bottom: 1.4vh; }
.ecran .bilan-chiffres { gap: 2vw; margin: 0 0 3vh; }
.ecran .bilan-chiffre { padding: 1.4vh 2vw; border-radius: 1.6vh; }
.ecran .bilan-chiffre b { font-size: 5vh; }
.ecran .bilan-chiffre span { font-size: 1.9vh; }
.ecran .bilan-cols { gap: 4vw; }
.ecran .bilan-sondages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3vw; }
.ecran .zone-bilan .barres { gap: 1.3vh; }
.ecran .zone-bilan .barre .libelle { font-size: 1.9vh; margin-bottom: .5vh; }
.ecran .zone-bilan .barre .piste { height: 1.8vh; }
.ecran .bilan-meta { font-size: 1.7vh; margin: -.8vh 0 1.4vh; }
.ecran .bilan-tete { font-size: 1.9vh; margin-top: 1.6vh; }

/* Téléphone : corrections personnelles */
.bilan-perso { display: grid; gap: 10px; margin-top: 12px; }
.bilan-ligne { background: var(--blanc); border-radius: 12px; padding: 12px 14px; border-left: 0; box-shadow: var(--ombre); }
.bilan-etat { font-weight: 700; font-size: .85rem; }
.bilan-ligne.ok .bilan-etat { color: var(--vert); }
.bilan-ligne.ko .bilan-etat { color: var(--erreur); }
.bilan-q { color: var(--encre); font-weight: 500; margin: 4px 0; }
.bilan-r { margin: 0; font-size: .9rem; }

/* ---------- Histogrammes du bilan ---------- */
.histo { display: flex; align-items: stretch; gap: 10px; height: 220px; padding-top: 22px; }
.histo-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.histo-zone { position: relative; flex: 1; border-bottom: 2px solid var(--encre); }
.histo-barre { position: absolute; bottom: 0; left: 12%; right: 12%; background: var(--encre); border-radius: 6px 6px 0 0; transition: height .5s ease; min-height: 2px; }
.histo-barre.juste { background: var(--vert); }
.histo-val { position: absolute; left: 0; right: 0; text-align: center; font-weight: 700; font-size: .85rem; margin-bottom: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.histo-lib { text-align: center; font-weight: 700; font-size: .8rem; padding-top: 6px; }
.histo { margin-bottom: 12px; }
.histo-note { font-size: .8rem; margin: 0; }
.histo-legende { list-style: none; padding: 0; margin: 0; display: grid; gap: 3px; font-size: .82rem; color: var(--texte); }
.histo-legende b { color: var(--encre); display: inline-block; min-width: 1.9em; }
@media (prefers-reduced-motion: reduce) { .histo-barre { transition: none; } }

.ecran .histo { height: 30vh; gap: 1vw; padding-top: 3vh; margin-bottom: 1.6vh; }
.ecran .histo-zone { border-bottom-width: .25vh; }
.ecran .histo-val { font-size: 1.9vh; margin-bottom: .5vh; }
.ecran .histo-lib { font-size: 1.8vh; padding-top: .8vh; }
.ecran .histo-barre { border-radius: .8vh .8vh 0 0; }
.ecran .histo-note { font-size: 1.6vh; }
.ecran .histo-legende { font-size: 1.65vh; gap: .4vh; }
.ecran .bilan-sondages .histo { height: 28vh; }
.ecran .bilan-sondage h2 { min-height: 2.4em; }
