/* Fiches de révision animées (mapse.fr) — même principe que cap_B4_fiche_revision.html,
   police agrandie pour la lecture en classe et sur téléphone (demande de M. MECHERI, 10/11/2026). */
:root {
  --theme: #388e3c; --theme-dark: #1b5e20;
  --vert: #D8F3DC; --vert-b: #95CFA5;
  --ambre: #FFF1C1; --ambre-b: #E3C46B;
  --ciel: #D6EAF8; --ciel-b: #8DB9DE;
  --orange: #FFE5D0; --orange-b: #EDB48A;
  --gris: #ECEFF1; --gris-b: #B0BEC5;
  --rose: #FCE1F1; --rose-b: #E3A3C8;
  --violet: #E8DFF5; --violet-b: #B8A4DA;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: #1f2a30; min-height: 100vh; padding: 20px 16px 40px; line-height: 1.5; font-size: 18px;
}
.container { max-width: 880px; margin: 0 auto; }
#progression { position: fixed; top: 0; left: 0; height: 6px; width: 0; background: var(--theme); z-index: 10; transition: width .1s; }
header {
  background: linear-gradient(135deg, var(--theme), var(--theme-dark)); color: #fff;
  padding: 26px 24px; border-radius: 16px; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); margin-bottom: 20px;
}
.theme-tag { display: inline-block; background: rgba(255,255,255,.22); padding: 5px 14px; border-radius: 20px; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700; margin-bottom: 10px; }
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; margin-bottom: 6px; }
.subtitle { font-size: 1.1rem; opacity: .95; }
.barre-haut { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 22px; }
.bouton {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  background: var(--theme); color: #fff; border: 0; border-radius: 12px; padding: 13px 20px;
  font: inherit; font-weight: 700; font-size: 17px; box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.bouton.secondaire { background: #fff; color: var(--theme-dark); border: 2px solid var(--theme); }
.bouton:hover { filter: brightness(1.08); }
.bouton:focus-visible, .carte-tourne:focus-visible, .choix:focus-visible, .etiquette:focus-visible, input:focus-visible { outline: 3px solid #1565c0; outline-offset: 3px; }
.intro { background: #fff; border-radius: 14px; padding: 18px 22px; margin-bottom: 22px; box-shadow: 0 2px 8px rgba(0,0,0,.05); font-size: 18px; }

section.partie { background: #fff; border-radius: 18px; padding: 22px 20px 20px; margin-bottom: 24px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
h2 { font-size: 1.5rem; text-align: center; margin-bottom: 16px; color: #1f2a30; }
h3 { font-size: 1.2rem; text-align: center; margin: 18px 0 12px; color: #263238; }
.aide { text-align: center; font-size: 16.5px; color: #455a64; margin-bottom: 14px; }

.grille { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 680px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } }

.carte { border-radius: 16px; border-width: 2px; border-style: solid; padding: 16px; text-align: center; font-size: 17px; }
.carte img { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 8px; }
.carte .titre { font-weight: 800; margin-bottom: 6px; font-size: 19px; display: block; }
.vert { background: var(--vert); border-color: var(--vert-b); }
.ambre { background: var(--ambre); border-color: var(--ambre-b); }
.ciel { background: var(--ciel); border-color: var(--ciel-b); }
.orange { background: var(--orange); border-color: var(--orange-b); }
.gris { background: var(--gris); border-color: var(--gris-b); }
.rose { background: var(--rose); border-color: var(--rose-b); }
.violet { background: var(--violet); border-color: var(--violet-b); }
.note { border-radius: 12px; border: 2px solid var(--ciel-b); background: var(--ciel); padding: 12px 16px; margin-top: 14px; font-size: 17px; text-align: center; }
.note.grise { background: var(--gris); border-color: var(--gris-b); }
.note.orange { background: var(--orange); border-color: var(--orange-b); font-weight: 700; }
.note.verte { background: var(--vert); border-color: var(--vert-b); font-weight: 700; }

/* Apparition au défilement */
.apparait { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.apparait.vu { opacity: 1; transform: none; }
.grille .apparait:nth-child(2) { transition-delay: .12s; }
.grille .apparait:nth-child(3) { transition-delay: .24s; }
.grille .apparait:nth-child(4) { transition-delay: .36s; }
.grille .apparait:nth-child(5) { transition-delay: .48s; }

/* Cartes à retourner */
.carte-tourne { perspective: 900px; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; min-height: 190px; width: 100%; }
.carte-tourne .dedans { position: relative; width: 100%; height: 100%; min-height: 190px; transition: transform .6s; transform-style: preserve-3d; }
.carte-tourne[aria-pressed="true"] .dedans { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 16px; border-width: 2px; border-style: solid; padding: 14px; text-align: center; font-size: 17px; }
.face.dos { transform: rotateY(180deg); }
.face .titre { font-weight: 800; font-size: 19px; }
.face img { width: 64px; height: 64px; object-fit: contain; margin-bottom: 4px; }
.face .touche { font-size: 14px; color: #546e7a; margin-top: 6px; }
.carte-tourne.haute, .carte-tourne.haute .dedans { min-height: 230px; }

/* Boutons audio */
.audio-mini { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  background: #fff; color: var(--theme-dark); border: 2px solid var(--theme); border-radius: 20px; padding: 4px 12px; margin: 8px auto 0; }
.audio-mini:hover { background: var(--theme); color: #fff; }
.audio-mini:focus-visible { outline: 3px solid #1565c0; outline-offset: 2px; }
.carte > .audio-mini, .note > .audio-mini { display: flex; }
.question p .audio-mini { margin: 0 0 0 10px; vertical-align: middle; }
.explication .audio-mini { display: flex; margin-top: 6px; }
.case { display: flex; flex-direction: column; align-items: center; }
.etape-texte + .audio-mini { display: flex; }

/* Étapes animées (chaîne) */
.chaine { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 8px; }
.maillon { flex: 1 1 140px; border-radius: 14px; border: 2px solid var(--gris-b); background: var(--gris); padding: 12px 10px; text-align: center; font-size: 17px; opacity: .55; transform: scale(.96); transition: opacity .5s, transform .5s, box-shadow .5s; }
.maillon b { display: block; font-size: 18.5px; }
.maillon small { display: block; font-size: 15px; color: #455a64; }
.maillon.allume { opacity: 1; transform: none; box-shadow: 0 0 0 3px var(--theme); }
.maillon.final.allume { background: var(--vert); border-color: var(--vert-b); }
.commandes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.etape-texte { margin-top: 12px; text-align: center; font-size: 18px; min-height: 3em; background: var(--ambre); border: 2px solid var(--ambre-b); border-radius: 14px; padding: 12px; }

/* Calculateurs */
.calcul { background: #fafafa; border: 2px dashed #b0bec5; border-radius: 16px; padding: 16px; }
.calcul .champs { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: flex-end; }
.calcul label { display: flex; flex-direction: column; font-weight: 700; font-size: 16.5px; gap: 4px; }
.calcul input[type=number] { font: inherit; font-size: 20px; width: 9em; padding: 8px 10px; border: 2px solid #90a4ae; border-radius: 10px; }
.calcul .signe { font-size: 26px; font-weight: 900; padding-bottom: 8px; }
.resultat { margin-top: 14px; border-radius: 14px; padding: 14px; text-align: center; border: 2px solid; font-size: 18px; transition: background .4s, border-color .4s; }
.resultat .grand { display: block; font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.resultat.ok { background: var(--vert); border-color: var(--vert-b); }
.resultat.ko { background: var(--rose); border-color: var(--rose-b); }
.resultat.neutre { background: var(--ciel); border-color: var(--ciel-b); }
input[type=range] { width: 100%; height: 36px; accent-color: var(--theme); }

/* Jeu de tri */
.etiquettes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 14px; }
.etiquette { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 17px; font-weight: 700; background: #fff; border: 2px solid #90a4ae; border-radius: 30px; padding: 9px 16px; cursor: pointer; }
.etiquette.choisie { border-color: var(--theme); box-shadow: 0 0 0 3px var(--theme); }
.etiquette.rangee { display: none; }
.bacs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 680px) { .bacs { grid-template-columns: 1fr; } }
.bac { font: inherit; text-align: center; cursor: pointer; border-radius: 16px; border-width: 2px; border-style: dashed; padding: 12px; min-height: 140px; }
.bac .titre { display: block; font-weight: 800; font-size: 18.5px; }
.bac .contenu { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.bac .contenu span { background: #fff; border-radius: 20px; padding: 4px 12px; font-size: 16px; font-weight: 700; animation: pose .4s ease; }
@keyframes pose { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.message-tri { text-align: center; font-weight: 700; min-height: 1.6em; margin-top: 10px; font-size: 17.5px; }
.message-tri.ok { color: #2e7d32; } .message-tri.ko { color: #c62828; }

/* Quiz « Je vérifie mes acquis » */
.quiz { margin-top: 18px; border-top: 2px dashed #cfd8dc; padding-top: 14px; }
.quiz .entete { font-weight: 800; text-align: center; color: var(--theme-dark); margin-bottom: 10px; font-size: 19px; }
.question { margin-bottom: 14px; }
.question p { font-weight: 700; margin-bottom: 8px; font-size: 18px; }
.choix { display: block; width: 100%; text-align: left; font: inherit; font-size: 17.5px; background: #f5f7f8; border: 2px solid #cfd8dc; border-radius: 12px; padding: 11px 14px; margin-bottom: 8px; cursor: pointer; color: #1f2a30; }
.choix:hover:not(:disabled) { border-color: var(--theme); }
.choix.bon { background: #c8e6c9; border-color: #2e7d32; }
.choix.faux { background: #ffcdd2; border-color: #c62828; }
.choix:disabled { cursor: default; }
.retour { font-size: 17px; font-weight: 700; min-height: 1.3em; }
.retour.ok { color: #2e7d32; } .retour.ko { color: #c62828; }
.explication { display: block; margin-top: 6px; font-weight: 400; color: #1f2a30; background: #fffde7; border-left: 5px solid #fbc02d; padding: 8px 12px; border-radius: 8px; }

.score { position: sticky; bottom: 10px; margin: 0 auto 18px; max-width: 420px; background: #263238; color: #fff; border-radius: 30px; text-align: center; padding: 11px 18px; font-weight: 700; font-size: 17px; box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 5; }
.fin { text-align: center; }
.fin p { margin-top: 12px; }
footer { text-align: center; font-size: 14px; color: #555; padding: 18px 0; }
footer a { color: var(--theme-dark); text-decoration: none; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .apparait { opacity: 1; transform: none; transition: none; }
  .carte-tourne .dedans, .maillon { transition: none; }
  .bac .contenu span { animation: none; }
}
@media print {
  #progression, .barre-haut, .score, .quiz, .commandes, .fin { display: none; }
  .apparait { opacity: 1; transform: none; }
}
