/* Espace de consultation — élèves et enseignants (§13.2).
   Lisible par de jeunes enfants (grands caractères, fort contraste, grandes cibles tactiles),
   léger (aucune bibliothèque, aucune police externe) pour les réseaux mobiles (§14).
   Mêmes couleurs que les diapositives, le PDF et le back-office (un seul modèle visuel, §2). */

:root {
  --vert: #0B6E4F;
  --vert-fonce: #084C37;
  --vert-nuit: #06291F;
  --vert-clair: #E6F2ED;
  --jaune: #F4C430;
  --jaune-clair: #FFF4D1;
  --rouge: #C8102E;
  --rouge-clair: #FDECEE;
  --fond: #FFF9EE;
  --carte: #FFFFFF;
  --texte: #1B1B1B;
  --discret: #5A5A5A;
  --bord: #EADFCB;
  --ombre: 0 2px 6px rgba(60, 40, 0, .08), 0 8px 24px rgba(60, 40, 0, .06);
  --rayon: 18px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 18px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
img, video { max-width: 100%; }
a { color: var(--vert); }
:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; border-radius: 6px; }
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- En-tête -------------------------------------------------------------------------------- */
.entete { background: var(--vert); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.entete-interieur { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: .8rem; padding: .65rem 1rem; }
.marque { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; font-weight: 800; line-height: 1.1; }
.marque img { width: 40px; height: 40px; border-radius: 10px; }
.marque small { display: block; font-weight: 500; font-size: .72rem; opacity: .85; }
.entete-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.lien-entete {
  display: inline-flex; align-items: center; gap: .35rem; color: #fff; text-decoration: none; font-size: .88rem; font-weight: 600;
  padding: .45rem .75rem; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 0; cursor: pointer; font-family: inherit;
}
.lien-entete:hover { background: rgba(255, 255, 255, .22); }
.lien-entete svg { width: 18px; height: 18px; }
.lisere { display: flex; height: 6px; }
.lisere span { flex: 1; }
.lisere span:nth-child(1) { background: #CE1126; }
.lisere span:nth-child(2) { background: #FCD116; }
.lisere span:nth-child(3) { background: #009460; }
.bandeau { margin: 0; padding: .6rem 1rem; text-align: center; font-weight: 600; font-size: .95rem; }
.bandeau-apercu { background: var(--jaune); color: var(--vert-nuit); }
.bandeau-hors-ligne { background: #33413B; color: #fff; display: none; }
body.hors-connexion .bandeau-hors-ligne { display: block; }
@media (max-width: 560px) { .lien-entete .libelle { display: none; } }

/* --- Mise en page ---------------------------------------------------------------------------- */
.page { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.fil { font-size: .9rem; color: var(--discret); margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.fil a { color: var(--discret); }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.15; color: var(--vert-fonce); margin: .2rem 0 .6rem; }
h2 { font-size: 1.3rem; color: var(--vert-fonce); margin: 0 0 .75rem; }
.chapeau { font-size: 1.1rem; color: var(--discret); margin: 0 0 1.5rem; max-width: 60ch; }
.carte { background: var(--carte); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 1.25rem; margin-bottom: 1.25rem; }
.discret { color: var(--discret); }
.centre { text-align: center; }
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

/* --- Héros d'accueil --------------------------------------------------------------------------- */
.heros {
  background: linear-gradient(135deg, var(--vert) 0%, #0F8A62 100%); color: #fff; border-radius: 24px;
  padding: clamp(1.4rem, 4vw, 2.5rem); margin-bottom: 1.75rem; position: relative; overflow: hidden;
}
.heros h1 { color: #fff; margin-top: 0; }
.heros p { font-size: 1.15rem; margin: 0; max-width: 46ch; opacity: .95; }
.heros::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  background: var(--jaune); opacity: .9;
}
.heros::before {
  content: ""; position: absolute; right: 90px; bottom: -70px; width: 150px; height: 150px; border-radius: 50%;
  background: #fff; opacity: .12;
}
.heros > * { position: relative; z-index: 1; }

/* --- Tuiles (classes, matières) --------------------------------------------------------------------- */
.tuile {
  display: flex; align-items: center; gap: 1rem; padding: 1.25rem; border-radius: var(--rayon); background: var(--carte);
  box-shadow: var(--ombre); text-decoration: none; color: var(--texte); border: 3px solid transparent;
  transition: transform .15s ease, border-color .15s ease; min-height: 112px;
}
.tuile:hover, .tuile:focus-visible { transform: translateY(-3px); border-color: var(--accent, var(--vert)); }
.tuile-pastille {
  flex: none; width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center;
  background: var(--accent, var(--vert)); color: #fff; font-weight: 800; font-size: 1.35rem;
}
.tuile-pastille svg { width: 38px; height: 38px; }
.tuile strong { display: block; font-size: 1.3rem; color: var(--vert-fonce); }
.tuile span { color: var(--discret); font-size: .95rem; }
.tuile.vide { opacity: .55; pointer-events: none; box-shadow: none; border: 2px dashed var(--bord); }

/* --- Liste des leçons ---------------------------------------------------------------------------- */
.lecons { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.lecon-ligne {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border-radius: var(--rayon); background: var(--carte);
  box-shadow: var(--ombre); text-decoration: none; color: var(--texte); border: 3px solid transparent;
}
.lecon-ligne:hover, .lecon-ligne:focus-visible { border-color: var(--vert); }
.numero {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--jaune); color: var(--vert-nuit); font-weight: 800; font-size: 1.25rem;
}
.lecon-ligne .titre { font-weight: 700; font-size: 1.12rem; color: var(--vert-fonce); }
.lecon-ligne .meta { color: var(--discret); font-size: .9rem; display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin-top: .15rem; }
.lecon-ligne .fleche { margin-left: auto; color: var(--vert); font-size: 1.6rem; }
.etiquette { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; }
.etiquette-hl { background: var(--vert-clair); color: var(--vert); }
.etiquette-apercu { background: var(--jaune-clair); color: #7A5900; }

/* --- Page leçon -------------------------------------------------------------------------------- */
.lecon-grille { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .lecon-grille { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; } }
.objectifs { background: var(--jaune-clair); border-left: 8px solid var(--jaune); }
.objectifs ul { margin: 0; padding-left: 1.3rem; }
.objectifs li { margin: .3rem 0; }
.retenons { background: var(--rouge-clair); border-left: 8px solid var(--rouge); }
.retenons p { margin: 0; }
.video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 16 / 9; display: block; }
audio { width: 100%; margin-top: .75rem; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.actions-colonne { display: grid; gap: .7rem; }
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .85rem 1.4rem; min-height: 52px;
  border-radius: 999px; border: 0; background: var(--vert); color: #fff; font: inherit; font-weight: 700; text-decoration: none;
  cursor: pointer; box-shadow: 0 3px 0 var(--vert-nuit); transition: transform .1s ease;
}
.bouton:hover { background: var(--vert-fonce); }
.bouton:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--vert-nuit); }
.bouton[disabled] { opacity: .5; cursor: not-allowed; }
.bouton svg { width: 22px; height: 22px; flex: none; }
.bouton-grand { font-size: 1.15rem; padding: 1rem 1.8rem; min-height: 60px; }
.bouton-jaune { background: var(--jaune); color: var(--vert-nuit); box-shadow: 0 3px 0 #B88E00; }
.bouton-jaune:hover { background: #E8B820; }
.bouton-clair { background: #fff; color: var(--vert); box-shadow: inset 0 0 0 2px var(--vert); }
.bouton-clair:hover { background: var(--vert-clair); }
.bouton-bloc { width: 100%; }
.petit { font-size: .85rem; }
.navigation-lecons { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; }
.navigation-lecons a { text-decoration: none; font-weight: 600; }
.jauge { height: 10px; background: #EFE6D3; border-radius: 999px; overflow: hidden; }
.jauge > span { display: block; height: 100%; background: var(--vert); width: 0; transition: width .3s ease; }

/* --- Quiz ------------------------------------------------------------------------------------- */
.quiz-entete { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.quiz-entete .jauge { flex: 1; height: 14px; }
.quiz-compteur { font-weight: 700; color: var(--vert-fonce); white-space: nowrap; }
.question legend, .question .enonce { font-size: 1.35rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.3; padding: 0; }
fieldset.question { border: 0; padding: 0; margin: 0; }
.choix { display: grid; gap: .7rem; }
.choix label, .choix button {
  display: flex; align-items: center; gap: .8rem; padding: 1rem 1.1rem; min-height: 60px; border: 3px solid var(--bord);
  border-radius: 16px; background: #fff; cursor: pointer; font: inherit; font-size: 1.15rem; text-align: left; width: 100%; color: var(--texte);
}
.choix label:hover, .choix button:hover { border-color: var(--vert); }
.choix input { width: 26px; height: 26px; accent-color: var(--vert); flex: none; }
.choix .lettre {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--vert-clair);
  color: var(--vert); font-weight: 800;
}
.choix .choisi { border-color: var(--vert); background: var(--vert-clair); }
.choix .juste { border-color: var(--vert); background: #D9F0E5; }
.choix .faux { border-color: var(--rouge); background: var(--rouge-clair); }
.saisie { width: 100%; padding: 1rem; font: inherit; font-size: 1.3rem; border: 3px solid var(--bord); border-radius: 16px; }
.saisie:focus { border-color: var(--vert); outline: none; }
.retour-reponse { margin-top: 1rem; padding: 1rem 1.1rem; border-radius: 16px; font-size: 1.05rem; }
.retour-reponse.juste { background: #D9F0E5; color: #0A4E39; }
.retour-reponse.faux { background: var(--rouge-clair); color: #7F0A1C; }
.retour-reponse strong { display: block; font-size: 1.15rem; margin-bottom: .2rem; }
.quiz-pied { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; flex-wrap: wrap; }
.score {
  text-align: center; padding: 2rem 1rem; border-radius: 24px; background: linear-gradient(135deg, var(--vert), #0F8A62); color: #fff;
  margin-bottom: 1.25rem;
}
.score .valeur { font-size: clamp(3rem, 12vw, 5rem); font-weight: 800; line-height: 1; }
.score .message { font-size: 1.3rem; margin-top: .5rem; }
.etoiles { font-size: 2.2rem; letter-spacing: .3rem; margin-top: .5rem; color: var(--jaune); }
.correction { border-left: 8px solid var(--vert); }
.correction.faux { border-left-color: var(--rouge); }
.correction h3 { margin: 0 0 .5rem; font-size: 1.1rem; }
.marque-resultat { display: inline-block; font-size: .8rem; font-weight: 800; padding: .15rem .6rem; border-radius: 999px; color: #fff; margin-right: .4rem; vertical-align: middle; }
.correction .marque-resultat { background: var(--vert); }
.correction.faux .marque-resultat { background: var(--rouge); }
.explication { background: var(--fond); padding: .75rem 1rem; border-radius: 12px; margin: .5rem 0 0; }
.sans-js-cache { display: none; }
.js .avec-js-cache { display: none; }
.js .sans-js-cache { display: block; }

/* --- Mode enseignant (projection) --------------------------------------------------------------- */
body.mode-enseignant { background: #0E1B16; color: #fff; }
.mode-enseignant .page { max-width: 1400px; }
.mode-enseignant h1, .mode-enseignant h2 { color: #fff; }
.mode-enseignant .carte { background: #16271F; box-shadow: none; }
.mode-enseignant .discret, .mode-enseignant .fil, .mode-enseignant .fil a { color: #A9C2B6; }
.projection { background: #000; border-radius: 16px; }
.projection:fullscreen { display: grid; place-items: center; padding: 2vw; background: #0E1B16; }
.projection:fullscreen .video { max-height: 92vh; width: auto; max-width: 100%; }
.quiz-classe { font-size: clamp(1.2rem, 2.2vw, 1.8rem); }
.quiz-classe .enonce { font-size: clamp(1.6rem, 3.2vw, 2.6rem); font-weight: 800; line-height: 1.25; margin: .5rem 0 1.25rem; }
.quiz-classe .choix button { background: #1F3A2E; color: #fff; border-color: #2F5544; font-size: inherit; cursor: default; }
.quiz-classe .choix .lettre { background: var(--jaune); color: var(--vert-nuit); }
.quiz-classe .choix .juste { background: var(--vert); border-color: #3FD08F; }
.quiz-classe .explication { background: #1F3A2E; color: #E6F2ED; }
.quiz-classe:fullscreen { background: #0E1B16; padding: 4vw; overflow: auto; }
.reponse-courte-classe { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; color: var(--jaune); }

/* --- Hors ligne ------------------------------------------------------------------------------- */
.progression-hl { margin-top: .75rem; display: none; }
.progression-hl.visible { display: block; }

/* --- Pied de page ------------------------------------------------------------------------------- */
.pied { text-align: center; color: var(--discret); font-size: .85rem; padding: 2rem 1rem 3rem; }
.pied a { color: var(--discret); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .entete, .lisere, .actions, .pied, video, audio, .navigation-lecons { display: none !important; }
  body { background: #fff; }
  .carte { box-shadow: none; border: 1px solid #ddd; }
}

/* Contrastes : texte des pastilles et compteur du mode enseignant. */
.tuile .tuile-pastille { color: #fff; }
.mode-enseignant .quiz-compteur { color: #CFE3DA; }
