/* FL100 — un écran de cockpit de nuit : fond bleu nuit, titres et niveaux de vol en B612 (la police
   des écrans d'Airbus), calculs en Atkinson Hyperlegible Mono (parenthèses bien rondes, signes nets),
   magenta pour la cible en cours, vert pour l'acquis, ambre pour la vigilance. */
@font-face { font-family: "B612"; src: url("polices/b612-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "B612 Mono"; src: url("polices/b612-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; src: url("polices/atkinson-hyperlegible-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; src: url("polices/atkinson-hyperlegible-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("polices/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("polices/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --nuit: #050b17;
  --fond: #0a1427;
  --panneau: #0f1d36;
  --panneau-2: #14284a;
  --trait: #22375c;
  --trait-fort: #36527f;
  --texte: #eef3fb;
  --discret: #97abcc;
  --cyan: #63d6ec;
  --vert: #48d480;
  --vert-sombre: #0f2e1d;
  --ambre: #f2b441;
  --ambre-sombre: #33260d;
  --rouge: #ff6b6b;
  --rouge-sombre: #3b1719;
  --magenta: #f26abd;
  --magenta-sombre: #3a1630;
  --magenta-encre: #1f0718;
  --f-titre: "B612", "Segoe UI", system-ui, sans-serif;
  --f-texte: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-chiffres: "Atkinson Hyperlegible Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --f-fl: "B612 Mono", "Atkinson Hyperlegible Mono", ui-monospace, monospace;
  --rayon: 14px;
  --onglets: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--f-texte);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-titre); margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--cyan); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-chiffres); font-variant-numeric: tabular-nums; }
.discret { color: var(--discret); }
.petit { font-size: 14px; }
.etiquette { font: 700 11px/1.3 var(--f-titre); letter-spacing: 0.12em; text-transform: uppercase; color: var(--discret); }
.v { color: var(--cyan); font-weight: 700; }
.noscript { padding: 24px; }

/* ---------- Démarrage ---------- */
.demarrage { min-height: 70vh; display: grid; place-content: center; gap: 12px; text-align: center; color: var(--discret); }
.logo-fl { display: inline-block; font: 700 22px/1 var(--f-fl); color: var(--magenta); border: 2px solid var(--magenta); border-radius: 6px; padding: 8px 12px; letter-spacing: 0.06em; }

/* ---------- Cadre de page ---------- */
.ecran {
  max-width: 560px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);
  padding-bottom: calc(var(--onglets) + env(safe-area-inset-bottom, 0px) + 24px);
  display: grid; gap: 14px;
}
.ecran.sans-onglets { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.marque { display: flex; align-items: center; gap: 10px; min-width: 0; }
.marque .logo-fl { font-size: 14px; padding: 5px 7px; border-width: 1.5px; }
.marque-nom { font: 700 15px/1.2 var(--f-titre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entete-droite { display: flex; align-items: center; gap: 8px; }
.statut-sync { appearance: none; border: 1px solid var(--trait); background: var(--panneau); border-radius: 999px; min-height: 36px; padding: 6px 10px; display: inline-flex; align-items: center; gap: 7px; font: 400 12px/1 var(--f-chiffres); color: var(--discret); cursor: pointer; }
.point { width: 9px; height: 9px; border-radius: 50%; background: var(--vert); flex: none; }
.point.attente { background: var(--ambre); }
.point.horsligne { background: var(--discret); }
.point.erreur { background: var(--rouge); }

/* ---------- Barre d'onglets ---------- */
.onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(7, 14, 28, 0.96); border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.onglets-in { max-width: 560px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.onglet { appearance: none; border: 0; background: none; min-height: var(--onglets); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--discret); font: 700 11px/1 var(--f-titre); letter-spacing: 0.04em; cursor: pointer; text-decoration: none; }
.onglet svg { width: 24px; height: 24px; }
.onglet[aria-current="page"] { color: var(--magenta); }

/* ---------- Cartes et boutons ---------- */
.carte { background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.carte-tete { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--trait-fort);
  background: var(--panneau-2); color: var(--texte); font: 700 15px/1.15 var(--f-titre); cursor: pointer; text-align: center; text-decoration: none;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primaire { background: var(--magenta); border-color: var(--magenta); color: var(--magenta-encre); }
.btn-vert { background: var(--vert); border-color: var(--vert); color: #04210f; }
.btn-fantome { background: transparent; }
.btn-danger { background: transparent; border-color: var(--rouge); color: var(--rouge); }
.btn-petit { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.btn-large { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.lien { appearance: none; border: 0; background: none; padding: 6px 0; color: var(--cyan); font: 700 14px/1.3 var(--f-titre); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions > .btn { flex: 1 1 auto; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 12px; }
.champ { display: grid; gap: 6px; }
.champ > span { font: 700 12px/1.2 var(--f-titre); letter-spacing: 0.04em; color: var(--discret); }
.saisie {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--trait-fort);
  background: var(--nuit); color: var(--texte); font: 400 17px/1.2 var(--f-texte);
}
.saisie:focus { outline: none; border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(242, 106, 189, 0.25); }
.saisie.mono { font-family: var(--f-chiffres); }
.ligne-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.erreur-form { color: var(--rouge); font-size: 14px; min-height: 1.2em; }
.note { padding: 12px; border-radius: 10px; background: var(--panneau-2); border: 1px solid var(--trait); font-size: 15px; }
.note.ambre { background: var(--ambre-sombre); border-color: transparent; }
.note.vert { background: var(--vert-sombre); border-color: transparent; }

/* ---------- Écrans d'accès ---------- */
.acces { min-height: 100vh; display: grid; align-content: center; gap: 18px; }
.acces-tete { display: grid; gap: 10px; justify-items: start; }
.acces-tete h1 { font-size: 28px; }

/* ---------- Cockpit (accueil) ---------- */
.instruments { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.instrument { background: var(--nuit); border: 1px solid var(--trait); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; min-width: 0; }
.instrument .valeur { font: 700 22px/1 var(--f-titre); white-space: nowrap; }
.instrument.alt .valeur { color: var(--vert); }
.instrument .sous { font-size: 12px; color: var(--discret); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap { display: grid; gap: 8px; }
.cap-titre { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fl { display: inline-grid; place-items: center; min-width: 60px; height: 30px; padding: 0 8px; border-radius: 6px; border: 1.5px solid var(--trait-fort); font: 700 15px/1 var(--f-fl); color: var(--discret); background: var(--nuit); }
.fl.acquis { border-color: var(--vert); color: var(--vert); }
.fl.cible { border-color: var(--magenta); color: var(--magenta); box-shadow: 0 0 0 3px rgba(242, 106, 189, 0.18); }
.jauge { height: 10px; border-radius: 5px; background: var(--nuit); border: 1px solid var(--trait); overflow: hidden; }
.jauge > span { display: block; height: 100%; background: var(--magenta); border-radius: 5px; }
.criteres { display: flex; flex-wrap: wrap; gap: 6px; }
.critere { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; font: 400 12px/1.3 var(--f-chiffres); background: var(--nuit); border: 1px solid var(--trait); color: var(--discret); }
.critere.ok { color: var(--vert); border-color: rgba(72, 212, 128, 0.5); }

.express { background: linear-gradient(180deg, var(--panneau-2), var(--panneau)); border-color: var(--trait-fort); }
.duree-choix { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.duree { appearance: none; min-height: 56px; border-radius: 12px; border: 1.5px solid var(--trait-fort); background: var(--nuit); color: var(--texte); display: grid; place-items: center; gap: 2px; cursor: pointer; padding: 6px; }
.duree b { font: 700 22px/1 var(--f-chiffres); }
.duree span { font-size: 12px; color: var(--discret); }
.duree[aria-pressed="true"] { border-color: var(--magenta); background: var(--magenta-sombre); }
.plan { font-size: 14px; color: var(--discret); }
/* Choix du test (CM1, CM3…) en tête du cockpit, et « Tous les tests » de la séance express */
.choix-test { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.choix { appearance: none; min-height: 56px; border-radius: 12px; border: 1.5px solid var(--trait-fort); background: var(--panneau); color: var(--texte); display: grid; place-items: center; gap: 2px; cursor: pointer; padding: 6px; touch-action: manipulation; }
.choix b { font: 700 19px/1 var(--f-titre); }
.choix span { font: 400 12px/1 var(--f-chiffres); color: var(--discret); }
.choix[aria-pressed="true"] { border-color: var(--magenta); background: var(--magenta-sombre); }
.choix[aria-pressed="true"] span { color: var(--texte); }
.test-detail { margin-top: -4px; text-align: center; }
.choix-tous { appearance: none; justify-self: start; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--trait-fort); background: transparent; color: var(--texte); padding: 6px 14px 6px 36px; font: 600 14px/1.2 var(--f-texte); cursor: pointer; position: relative; text-align: left; }
.choix-tous::before { content: ""; position: absolute; left: 12px; top: 50%; width: 14px; height: 14px; margin-top: -8px; border-radius: 4px; border: 1.5px solid var(--trait-fort); }
.choix-tous[aria-pressed="true"] { border-color: var(--magenta); }
.choix-tous[aria-pressed="true"]::before { background: var(--magenta); border-color: var(--magenta); }
.decoller { min-height: 60px; font-size: 18px; letter-spacing: 0.02em; }

.defi-etat { display: flex; align-items: center; gap: 8px; font: 700 14px/1.2 var(--f-titre); }
.defi-etat.ok { color: var(--vert); }

.montee { list-style: none; margin: 0; padding: 0; display: grid; }
.palier { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--trait); cursor: pointer; }
.palier:first-child { border-top: 0; }
.palier-nom { font: 700 15px/1.25 var(--f-titre); }
.palier-sous { font-size: 13px; color: var(--discret); }
.palier.verrou .palier-nom { color: var(--discret); }
.pastille { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font: 700 11px/1.2 var(--f-titre); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; background: var(--nuit); color: var(--discret); border: 1px solid var(--trait); }
.pastille.ok { color: var(--vert); border-color: rgba(72, 212, 128, 0.45); }
.pastille.cible { color: var(--magenta); border-color: rgba(242, 106, 189, 0.5); }
.pastille.ambre { color: var(--ambre); border-color: rgba(242, 180, 65, 0.5); }
.pastille.rouge { color: var(--rouge); border-color: rgba(255, 107, 107, 0.5); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.badge { display: grid; justify-items: center; gap: 6px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--trait); background: var(--nuit); text-align: center; }
.badge svg { width: 34px; height: 34px; }
.badge b { font: 700 12px/1.2 var(--f-titre); }
.badge span { font-size: 11px; color: var(--discret); line-height: 1.25; }
.badge.non { opacity: 0.45; }
.badge.non svg { filter: grayscale(1); }

.calendrier { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: start; }
.jour { display: block; min-width: 0; width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: 4px; background: var(--nuit); border: 1px solid var(--trait); }
.jour.vole { background: var(--vert); border-color: var(--vert); }
.jour.auj { outline: 2px solid var(--magenta); outline-offset: 1px; }

/* ---------- Listes ---------- */
.liste { list-style: none; margin: 0; padding: 0; display: grid; }
.liste > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--trait); }
.liste > li:first-child { border-top: 0; }
.liste .titre { font: 700 14px/1.3 var(--f-titre); }
.liste .detail { font: 400 13px/1.4 var(--f-chiffres); color: var(--discret); overflow-wrap: anywhere; }
.tableau-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 700 11px/1.2 var(--f-titre); letter-spacing: 0.08em; text-transform: uppercase; color: var(--discret); padding: 8px 6px; border-bottom: 1px solid var(--trait); }
td { padding: 9px 6px; border-bottom: 1px solid var(--trait); }
td.n, th.n { text-align: right; font-family: var(--f-chiffres); }

.barres { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.barre { display: grid; grid-template-columns: 104px minmax(0, 1fr) 28px; gap: 10px; align-items: center; font-size: 14px; }
.barre-fond { height: 10px; border-radius: 5px; background: var(--nuit); border: 1px solid var(--trait); overflow: hidden; }
.barre-fond > span { display: block; height: 100%; background: var(--discret); }
.barre.dom .barre-fond > span { background: var(--magenta); }
.barre.dom { font-weight: 700; }
.barre .mono { text-align: right; }

.puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { appearance: none; min-height: 40px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--trait-fort); background: var(--nuit); color: var(--texte); font: 700 14px/1 var(--f-titre); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.puce[aria-pressed="true"] { background: var(--texte); color: var(--fond); border-color: var(--texte); }
.puce .touche { font: 400 11px/1 var(--f-chiffres); color: var(--discret); border: 1px solid var(--trait-fort); border-radius: 4px; padding: 2px 4px; }
.puce[aria-pressed="true"] .touche { color: var(--fond); border-color: var(--fond); }
.err-item { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--trait); }
.err-item:first-child { border-top: 0; }
.err-enonce { font: 400 14px/1.55 var(--f-chiffres); overflow-wrap: anywhere; }

/* ---------- Écran de vol (séance) ---------- */
.vol { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--nuit); }
.vol-in {
  flex: 1; width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px;
  padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px));
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
}
.vol-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vol-titre { font: 700 15px/1.2 var(--f-titre); }
.vol-sous { font: 400 12px/1.3 var(--f-chiffres); color: var(--discret); margin-top: 2px; }
.quitter { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; }
.affichage { background: var(--fond); border: 1px solid var(--trait); border-radius: 16px; padding: 14px 14px 16px; display: grid; gap: 12px; }
.temps { display: grid; gap: 6px; }
.ruban { height: 6px; border-radius: 3px; background: var(--trait); overflow: hidden; }
.ruban > span { display: block; height: 100%; width: 0; background: var(--vert); border-radius: 3px; }
.ruban > span.ambre { background: var(--ambre); }
.ruban > span.rouge { background: var(--rouge); }
.temps-ligne { display: flex; justify-content: space-between; gap: 10px; font: 400 12px/1 var(--f-chiffres); color: var(--discret); font-variant-numeric: tabular-nums; }
.combo { color: var(--magenta); font-weight: 700; }
.donnees { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.donnee { font: 400 clamp(15px, 4vw, 19px)/1 var(--f-chiffres); padding: 7px 10px; border: 1px solid var(--trait); border-radius: 6px; background: var(--panneau); }
.equations { display: grid; grid-template-columns: max-content max-content max-content; justify-content: center; column-gap: 0.55ch; row-gap: 0.45em; font: 400 clamp(15px, 4.2vw, 24px)/1.3 var(--f-chiffres); overflow-x: auto; padding: 2px 0; }
.eq { display: contents; }
.eq .g { justify-self: end; white-space: nowrap; }
.eq .e { color: var(--discret); }
.eq .d { justify-self: start; white-space: nowrap; }
.question { text-align: center; font: 700 clamp(16px, 4.4vw, 21px)/1 var(--f-chiffres); color: var(--discret); }
.question .v { color: var(--magenta); }
/* CM2 : intervalles en gros boutons (deux colonnes), réponse choisie bien marquée */
.options { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.option { appearance: none; position: relative; min-height: 48px; border-radius: 12px; border: 1.5px solid var(--trait-fort); background: var(--panneau); color: var(--texte); font: 700 clamp(15px, 4.4vw, 19px)/1.1 var(--f-chiffres); font-variant-numeric: tabular-nums; display: grid; place-items: center; padding: 6px 4px; cursor: pointer; touch-action: manipulation; white-space: nowrap; -webkit-user-select: none; user-select: none; }
.oui-non .option { min-height: 64px; font-family: var(--f-titre); white-space: normal; }
span.option { cursor: default; min-height: 0; padding: 6px; font-size: 15px; }
.option[aria-pressed="true"] { border-color: var(--magenta); background: var(--magenta-sombre); box-shadow: 0 0 0 3px rgba(242, 106, 189, 0.3); }
.option[aria-pressed="true"]::after { content: "✓"; position: absolute; right: 6px; top: 3px; color: var(--magenta); font: 700 12px/1 var(--f-texte); }
.option.ok { border-color: var(--vert); color: var(--vert); }
.option.faux { border-color: var(--rouge); color: var(--rouge); }
.option.oubli { border: 2px dashed var(--vert); color: var(--vert); }
/* Après la réponse, le vert et le rouge priment sur le fond « choisi » ; la coche reste */
.option.ok, .option.faux, .option.oubli { background: var(--panneau); box-shadow: none; }
.option.oubli::before { content: "oublié"; position: absolute; left: 0; right: 0; bottom: 2px; font: 600 10px/1 var(--f-texte); text-align: center; }
.option.aucun { font: 700 15px/1.1 var(--f-titre); }
.multi .option[aria-pressed="true"]::after { content: "☑"; }
.option:disabled { cursor: default; }
.option .touche { position: absolute; left: 6px; top: 4px; font: 400 10px/1 var(--f-chiffres); color: var(--discret); }
body.pave-actif .option .touche { display: none; }
.valider-choix { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); z-index: 2; }
.reponse.calcul .num.rep { width: 7.2ch; font-size: clamp(20px, 5.5vw, 26px); }
.reponse.calcul .num.rep::placeholder { font: 400 14px/1 var(--f-texte); color: var(--discret); }
.vol.mode-choix .chaine { font-size: clamp(19px, 5.4vw, 28px); }
/* Calcul facultatif : le pavé s'ouvre en touchant le champ, à la place des intervalles */
.vol.mode-choix .pave { display: none; }
body.pave-actif .vol.mode-choix.calcul-ouvert .pave { display: grid; }
.vol.mode-choix.calcul-ouvert .options, .vol.mode-choix.calcul-ouvert .valider-choix { display: none; }
.secoue { animation: secoue 0.3s; }
@keyframes secoue { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .secoue { animation: none; } }

/* Chaîne du CM1 : passe à la ligne entre deux termes */
.chaine { text-align: center; font: 700 clamp(22px, 6.4vw, 34px)/1.35 var(--f-chiffres); padding: 4px 0; }
.chaine .terme { white-space: nowrap; }
.exemple .chaine { text-align: left; font-size: clamp(18px, 5vw, 24px); }
.grand { text-align: center; font: 700 clamp(30px, 9vw, 48px)/1.1 var(--f-chiffres); white-space: nowrap; overflow-x: auto; padding: 4px 0; }
.notes { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 14px; padding-top: 10px; border-top: 1px dashed var(--trait); }
.notes-titre { width: 100%; text-align: center; }
.note-champ { display: inline-flex; align-items: center; gap: 6px; font: 400 18px/1 var(--f-chiffres); }
.reponse { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.reponse-lettre { font: 700 clamp(20px, 5.5vw, 28px)/1 var(--f-chiffres); white-space: nowrap; }
.num { font-family: var(--f-chiffres); font-variant-numeric: tabular-nums; background: var(--panneau); color: var(--texte); border: 1.5px solid var(--trait-fort); border-radius: 10px; padding: 8px 10px; outline: none; min-width: 0; text-align: right; }
.num:focus { border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(242, 106, 189, 0.25); }
.num.rep { width: 7.2ch; font-size: clamp(24px, 6.5vw, 32px); font-weight: 700; }
.num.petit-num { width: 5.4ch; font-size: 18px; }
.num.ok { border-color: var(--vert); color: var(--vert); }
.num.faux { border-color: var(--rouge); color: var(--rouge); }
.eclair { text-align: center; min-height: 1.4em; font: 700 16px/1.3 var(--f-chiffres); }
.eclair.ok { color: var(--vert); }
.eclair.faux { color: var(--rouge); }
.pave {
  display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: auto;
  position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); z-index: 2;
  background: var(--nuit); padding-top: 6px; box-shadow: 0 -10px 12px -6px var(--nuit);
}
.touche-pave { min-height: 56px; border-radius: 12px; border: 1px solid var(--trait-fort); background: var(--panneau-2); color: var(--texte); font: 700 24px/1 var(--f-chiffres); cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; display: grid; place-items: center; }
.touche-pave:active { background: var(--trait-fort); }
.touche-pave svg { width: 26px; height: 26px; }
.touche-ok { grid-column: 1 / -1; background: var(--magenta); border-color: var(--magenta); color: var(--magenta-encre); font: 700 18px/1 var(--f-titre); }
/* Mode pavé (classe posée par app.js) : champs en lecture seule, curseur clignotant simulé */
body.pave-actif .pave { display: grid; }
body.pave-actif .pave[hidden] { display: none; }
body.pave-actif .valider-clavier { display: none; }
body.pave-actif .puce .touche { display: none; }
body.pave-actif .num { caret-color: transparent; cursor: pointer; -webkit-user-select: none; user-select: none; }
body.pave-actif .num:focus:not([data-fige]) {
  background-image: linear-gradient(var(--magenta), var(--magenta)); background-repeat: no-repeat;
  background-size: 2px 1.1em; background-position: right 6px center; animation: curseur 1s steps(1) infinite;
}
@keyframes curseur { 50% { background-size: 0 1.1em; } }
/* Petits écrans (iPhone SE, 667 px) : on resserre pour que l'énoncé, le champ et le pavé tiennent sans défiler */
@media (max-height: 760px) {
  body.pave-actif .vol-in { gap: 8px; padding-top: calc(env(safe-area-inset-top, 0px) + 6px); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); }
  body.pave-actif #retour:empty { display: none; }
  body.pave-actif .affichage { gap: 8px; padding: 10px 12px; }
  body.pave-actif .eclair:empty { display: none; }
  body.pave-actif .notes-titre { display: none; }
  body.pave-actif .notes { padding-top: 8px; }
  body.pave-actif .pave { gap: 6px; padding-top: 4px; bottom: calc(env(safe-area-inset-bottom, 0px) + 6px); }
}
@media (prefers-reduced-motion: reduce) { body.pave-actif .num:focus:not([data-fige]) { animation: none; } }
.correction { background: var(--panneau); border: 1px solid var(--rouge); border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
.correction.ok { border-color: var(--vert); }
.verdict { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.verdict b { font: 700 20px/1.2 var(--f-titre); color: var(--rouge); }
.correction.ok .verdict b { color: var(--vert); }
.etapes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.etapes ul { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.etapes li li { font: 400 14px/1.5 var(--f-chiffres); overflow-wrap: anywhere; }
.intro-vol { display: grid; gap: 14px; }
.reflexe { font: 700 clamp(19px, 5vw, 24px)/1.3 var(--f-titre); }
.astuces { display: grid; gap: 4px; }
.astuces ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.astuces li { font: 400 15px/1.45 var(--f-texte); overflow-wrap: anywhere; }
.exemple { background: var(--fond); border: 1px solid var(--trait); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.exemple .equations { font-size: clamp(14px, 3.8vw, 18px); justify-content: start; }
.exemple .grand { font-size: clamp(22px, 6vw, 30px); text-align: left; }

/* ---------- Résultats ---------- */
.chiffres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chiffre { background: var(--nuit); border: 1px solid var(--trait); border-radius: 12px; padding: 10px; display: grid; gap: 4px; }
.chiffre b { font: 700 24px/1 var(--f-titre); }
.chiffre span { font-size: 12px; color: var(--discret); }
.annonce { border-radius: 14px; padding: 14px; display: grid; gap: 6px; border: 1px solid; }
.annonce.montee-ok { border-color: var(--vert); background: var(--vert-sombre); }
.annonce.badge-ok { border-color: var(--magenta); background: var(--magenta-sombre); }
.annonce.record { border-color: var(--cyan); background: #0c2a35; }
.annonce b { font: 700 17px/1.25 var(--f-titre); }
.revue details { border: 1px solid var(--trait); border-radius: 10px; padding: 10px 12px; background: var(--fond); }
.revue details + details { margin-top: 8px; }
.revue summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.revue .corps { display: grid; gap: 10px; margin-top: 10px; }
.lignes { font: 400 14px/1.6 var(--f-chiffres); overflow-x: auto; white-space: nowrap; }

/* ---------- Toast et célébration ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(var(--onglets) + env(safe-area-inset-bottom, 0px) + 14px);
  width: max-content; max-width: calc(100% - 32px);
  background: var(--texte); color: var(--fond); padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
.montee-anim { display: flex; gap: 4px; justify-content: center; }
.montee-anim span { width: 16px; height: 10px; border-left: 3px solid var(--vert); border-top: 3px solid var(--vert); transform: rotate(45deg); opacity: 0.25; animation: grimper 1.2s infinite; }
.montee-anim span:nth-child(2) { animation-delay: 0.15s; }
.montee-anim span:nth-child(3) { animation-delay: 0.3s; }
@keyframes grimper { 0%, 100% { opacity: 0.25; transform: translateY(4px) rotate(45deg); } 50% { opacity: 1; transform: translateY(-2px) rotate(45deg); } }

@media (max-width: 380px) {
  .instruments { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .instrument.alt { grid-column: 1 / -1; }
  .chiffres { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .equations { display: flex; flex-direction: column; align-items: flex-start; }
  .eq { display: block; white-space: nowrap; }
  .eq .e { margin: 0 0.5ch; }
}
@media (min-width: 700px) {
  .ecran { max-width: 620px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
