/* Couleurs, polices et tailles : arcadia.css (chargée avant cette feuille). */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--fond); color: var(--encre); font: 18px/1.45 var(--police-texte); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Bouton soleil / lune : bascule entre mode clair et mode sombre (theme.js) ; forme commune dans arcadia.css. */
.bouton-theme.coin { position: fixed; top: 12px; right: 12px; z-index: 10; background: var(--fond); }
.logo-marque.coin-gauche { position: fixed; top: 12px; left: 16px; z-index: 10; }
.tache { position: relative; }
.tache .bouton-theme { position: absolute; top: -4px; right: 0; width: 32px; height: 32px; }
.tache:has(.pastille[hidden]) h1 { padding-right: 30px; } /* sans pastille, le titre est sur la ligne du bouton */
@media print { .bouton-theme { display: none !important; } }

/* ---------- Écran d'exercice (maquette validée le 26/10) ----------
   Colonne de gauche (type, titre, exercices, questions), question et réponses à droite, bande de combat en bas.
   Un écran = toute la hauteur, jamais de défilement de la page. */
.ecran { height: 100dvh; display: grid; grid-template-columns: 250px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.ecran[data-type="entrainement"] { --type: var(--entrainement); --sur-type: var(--sur-entrainement); }
.ecran[data-type="evaluation"] { --type: var(--evaluation); --sur-type: var(--sur-evaluation); }
.ecran[data-type="remediation"] { --type: var(--remediation); --sur-type: var(--sur-remediation); }

/* Colonne de gauche : fond teinté, bord droit = 5 filets de la bande arc-en-ciel */
.cote { position: relative; grid-row: 1; background: linear-gradient(90deg, var(--rouge) 0 20%, var(--orange) 0 40%, var(--jaune) 0 60%, var(--vert-bleu) 0 80%, var(--bleu) 0) right top / 10px 100% no-repeat scroll, var(--colonne); padding: 20px 26px 16px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.tache h1 { font-family: var(--police-titre); font-weight: 400; font-size: 1.35rem; line-height: 1.12; margin: 10px 0 0; overflow-wrap: anywhere; }
.eleve-moi { margin: 8px 0 0; font-size: 0.85rem; color: var(--discret); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.travaux { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.travaux a { display: inline-block; padding: 12px 18px; border-radius: var(--rayon); border: var(--trait-fort) solid var(--encre); border-left: 6px solid var(--trait); background: var(--carte); color: var(--encre); font-weight: 700; text-decoration: none; box-shadow: 3px 3px 0 var(--ombre-dure); }
.travaux a[data-type=entrainement] { border-left-color: var(--entrainement); }
.travaux a[data-type=evaluation] { border-left-color: var(--evaluation); }
.travaux a[data-type=remediation] { border-left-color: var(--remediation); }
.travaux small { color: var(--discret); margin-left: 8px; }
.copie-essai { font: inherit; color: var(--encre); background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon-petit); padding: 2px 6px; }
.eleve-sortie { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-size: inherit; }
/* Type de l'activité : étiquette à la couleur du type, trait d'encre ; mot japonais discret à côté (évaluation : 試験). */
.pastille { display: inline-block; background: var(--type); color: var(--sur-type, var(--sur-couleur)); border: 2px solid var(--encre); border-radius: 5px; padding: 1px 9px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.tache .jp { margin-left: 8px; font-size: 0.9rem; }
.cote-titre .jp { font-size: 0.85rem; margin-left: 4px; }
.btn-reglages { text-align: left; border: 2px solid var(--encre); background: var(--fond); color: var(--encre); border-radius: var(--rayon-petit); padding: 6px 10px; font-size: 0.85rem; font-weight: 700; box-shadow: 2px 2px 0 var(--ombre-dure); }
.resume { margin: 0; padding: 0; list-style: none; color: var(--discret); font-size: 0.8rem; line-height: 1.4; }
.resume li.formule { font-size: 0.95rem; color: var(--encre); }
/* Petits titres de la colonne : EXERCICES · B = BILAN, QUESTIONS 問題 */
.cote-titre { margin: 4px 0 -4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--discret); }
.cote-titre:has(+ [hidden]) { display: none; }
/* Exercices (option A) : carrés numérotés ; l'exercice courant est plein ; les exercices pas commencés sont en pointillés ;
   pastille de résultat dans le coin (réussi, partiel, à revoir) ; barre en bas = questions faites. */
.exos-eleve { list-style: none; margin: 0; padding: 4px 0 0; display: flex; flex-wrap: wrap; gap: 10px 8px; }
.exo-eleve { --etat: var(--encre); position: relative; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: var(--trait-fort) solid var(--encre); border-radius: 8px; background: var(--fond); color: var(--encre); font-family: var(--police-titre); font-size: 1.2rem; cursor: pointer; }
.exo-eleve::after { content: ""; position: absolute; left: 3px; bottom: 3px; height: 3px; width: calc(var(--avance, 0) * (100% - 6px)); background: var(--etat); }
.exo-eleve[data-etat=a-faire] { border-style: dashed; opacity: 0.75; }
.exo-eleve[data-etat=reussi], .exo-eleve[data-etat=partiel], .exo-eleve[data-etat=a-revoir], .exo-eleve[data-etat=termine] { --etat: transparent; }
.exo-eleve::before { position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; display: grid; place-items: center; border: 2px solid var(--encre); border-radius: 50%; font: 700 11px/1 var(--police-texte); color: var(--creme); }
.exo-eleve[data-etat=reussi]::before { content: "✓"; background: var(--juste); }
.exo-eleve[data-etat=a-revoir]::before { content: "✗"; background: var(--faux); }
.exo-eleve[data-etat=partiel]::before { content: ""; background: linear-gradient(90deg, var(--partiel) 50%, var(--creme) 0); }
.exo-eleve:hover:not(:disabled) { background: var(--doux); }
.exo-eleve.courant, .exo-eleve.courant:hover { background: var(--encre); color: var(--fond); border-width: 3px; border-style: solid; opacity: 1; cursor: default; --etat: var(--fond); }
.exo-eleve:disabled { opacity: 0.55; cursor: not-allowed; }
/* Questions : pastilles rondes par cinq */
.questions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 28px); justify-content: start; gap: 10px 12px; }
.questions li { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--encre) 60%, transparent); color: color-mix(in srgb, var(--encre) 70%, transparent); font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.questions li.revoir { cursor: pointer; }
.questions li.revoir:hover { background: var(--doux); }
.questions li.courante { background: var(--encre); border: 2px solid var(--encre); color: var(--fond); }
.questions li.juste, .questions li.faux, .questions li.partiel { border: 2px solid var(--encre); font-size: 0; color: var(--creme); }
.questions li.juste::before, .questions li.faux::before { font-size: 0.9rem; font-weight: 700; }
.questions li.juste { background: var(--juste); }
.questions li.juste::before { content: "✓"; }
.questions li.faux { background: var(--faux); }
.questions li.faux::before { content: "✗"; }
.questions li.partiel { background: linear-gradient(90deg, var(--partiel) 50%, var(--creme) 0); }
.questions li.repondue { border: 2px solid var(--encre); color: var(--encre); }
.questions li.courante.juste, .questions li.courante.faux, .questions li.courante.partiel { outline: 3px solid var(--encre); outline-offset: 2px; }
/* Score en texte : seulement quand la bande de combat n'est pas affichée (aperçu du professeur, petit écran) */
.score { margin: auto 0 0; color: var(--discret); font-size: 0.9rem; }
.ecran:has(.bande-combat:not([hidden])) .score { display: none; }

/* Zone principale : numéro de la question et chrono en haut, question, réponses, Valider juste dessous */
.zone { grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); min-height: 0; padding: 18px 28px 12px; gap: 12px; }
.zone-tete { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.q-numero { margin: 0; flex: none; background: var(--encre); color: var(--fond); border-radius: var(--rayon-petit); padding: 4px 14px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.q-numero:empty { display: none; }
/* Pastille « QUESTION 6/20 » et consigne sur la même ligne : la consigne ne répète pas le numéro. */
.q-ligne { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 16px; width: 100%; }
.q-ligne .consigne { flex: 1 1 280px; }
/* Sans chronomètre, la rangée du haut disparaît : tout le texte remonte d'une ligne. */
.zone:not(:has(.chrono:not([hidden]))) { grid-template-rows: 0 minmax(0, 1fr); row-gap: 0; }
.zone-tete:not(:has(.chrono:not([hidden]))) { display: none; }
.zone > .carte { grid-column: 1; grid-row: 2; background: none; border: none; border-radius: 0; padding: 6px 4px; }
.carte { flex: 1; min-height: 0; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 18px 24px; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 14px; overflow-y: auto; }
/* Évaluation : 試験 à côté de l'étiquette du type (練習 et 復習, prévus pour les deux autres types, attendent leur validation) */
.jp-evaluation { display: none; }
.ecran[data-type="evaluation"] .jp-evaluation { display: inline; }

/* ---------- Bande de combat : sol, score, personnage (bande-combat.js) ---------- */
.bande-combat { --bc-h: clamp(110px, 19dvh, 180px); --bc-sol: 30%; grid-column: 1 / -1; grid-row: 2; position: relative; height: var(--bc-h); overflow: hidden; background: var(--ciel); border-top: 3px solid var(--encre); }
/* Relief lointain (aplats), puis le sol sous un trait d'encre */
.bande-combat::before { content: ""; position: absolute; left: 0; right: 0; bottom: var(--bc-sol); height: 55%; background: var(--relief);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100L60 30h70l60 70zM260 100L360 10h90l100 90zM640 100L720 40h60l80 60zM900 100L1010 15h80l110 85z'/%3E%3C/svg%3E") 0 100% / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100L60 30h70l60 70zM260 100L360 10h90l100 90zM640 100L720 40h60l80 60zM900 100L1010 15h80l110 85z'/%3E%3C/svg%3E") 0 100% / 100% 100% no-repeat; }
.bande-combat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--bc-sol); background-color: var(--sol); border-top: 3.5px solid var(--encre);
  background-image: linear-gradient(90deg, var(--sol-motif) 0 24px, transparent 0), linear-gradient(90deg, transparent 0 18px, var(--sol-motif) 0 42px, transparent 0);
  background-size: 88px 4px, 88px 4px; background-position: 0 30%, 44px 65%; background-repeat: repeat-x; }
/* Score : boîte sombre à gauche, chiffres carrés jaunes ; il ne baisse jamais */
.bc-score { position: absolute; z-index: 2; left: 24px; top: 14px; margin: 0; min-width: 120px; padding: 6px 14px 4px; display: grid; background: var(--fiche); border: var(--trait-fort) solid var(--encre); border-radius: 8px; box-shadow: 3px 3px 0 var(--ombre-dure); }
.bc-libelle { color: var(--creme); opacity: 0.8; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.bc-valeur { color: var(--jaune); font-family: var(--police-pixel); font-size: clamp(1.6rem, 4.5dvh, 2.3rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
/* Le couple personnage / ennemi est centré sur l'axe du bouton Valider (--bc-axe, mesuré par bande-combat.js ; 50 % sans mesure) :
   chacun est centré à --bc-ecart de l'axe. Sans ennemi, le personnage se place sur l'axe.
   Pieds : la dernière ligne de pixels de chaque image (pieds.js, --pied) est calée au pixel près sur celle de l'avatar (--bc-pieds). */
.bande-combat { --bc-ecart: calc(var(--bc-h) * 0.58); --bc-axe: 50%;
  /* Les pieds de l'avatar sont à (4 + décalage) unités sous le trait du sol (unité = 1/240 de la bande), réglage de l'administrateur */
  --bc-pieds: calc(var(--bc-sol) - var(--bc-h) * (4 + var(--av-decalage, 17)) / 240); }
.bc-perso { position: absolute; z-index: 1; left: calc(var(--bc-axe) - var(--bc-ecart)); translate: -50% 0; bottom: var(--bc-pieds); display: flex; align-items: flex-end; transition: left 0.3s ease-out; }
.bande-combat:has(.bc-ennemi[hidden]) .bc-perso { left: var(--bc-axe); }
.bc-perso[data-qui="avatar"] { bottom: var(--bc-sol); }
/* Avatar : unités de la maquette (bande de 240 de haut) ; ses pieds (ligne 61 de 64) sont sous le trait du sol selon --av-decalage. */
.bc-perso .av-sprite { --u: calc(var(--bc-h) / 240); --px: calc(var(--u) * var(--av-taille, 3.5)); margin-bottom: calc(var(--u) * -1 * (2 * var(--av-taille, 3.5) + 4 + var(--av-decalage, 17))); }
.bc-heros { display: block; height: calc(var(--bc-h) * 0.62); width: auto; aspect-ratio: 13 / 16; image-rendering: pixelated; }
/* Images de 64 px (dragon, monstres) : la marge basse négative descend l'image des lignes vides sous les pieds (63 - --pied). */
.bc-dragon { --t: calc(var(--bc-h) * 0.9); width: var(--t); height: var(--t); margin-bottom: calc(var(--t) * -1 * (63 - var(--pied, 62)) / 64); background-repeat: no-repeat; background-size: calc(var(--t) * 16) var(--t); image-rendering: pixelated; animation: bc-dragon 2.4s steps(16) infinite; clip-path: var(--dragon-masque); } /* masque les colonnes 58 à 63 de l'image : bout de queue de l'image voisine */
/* Ennemi : en face du personnage, à droite de l'axe (images tournées vers la gauche, 16 images de 64 px). */
.bc-ennemi { position: absolute; z-index: 1; left: calc(var(--bc-axe) + var(--bc-ecart)); translate: -50% 0; bottom: var(--bc-pieds); }
.bc-ennemi[hidden] { display: none; }
.bc-monstre { --t: calc(var(--bc-h) * 0.9); width: var(--t); height: var(--t); margin-bottom: calc(var(--t) * -1 * (63 - var(--pied, 61)) / 64); background-repeat: no-repeat; background-size: calc(var(--t) * 16) var(--t); image-rendering: pixelated; animation: bc-dragon 1.9s steps(16) infinite; }
/* Nom du monstre : petite plaque pixel sur le sol, sous ses pieds (masquée quand la bande est trop basse : téléphone) */
.bc-nom { position: absolute; left: 50%; top: calc(100% + 2px); translate: -50% 0; margin: 0; max-width: calc(var(--bc-h) * 1.5); padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--fond); color: var(--encre); border: 2px solid var(--encre); border-radius: 4px; font-family: var(--police-pixel); font-size: 0.65rem; line-height: 1.1; pointer-events: none; }
@keyframes bc-dragon { from { background-position: 0 0; } to { background-position: calc(var(--t) * -16) 0; } }
/* Entrée en scène (bande-combat.js ajoute « entree » quand l'image du personnage ou de l'ennemi est prête) : fondu en glissant, de la gauche pour le personnage, de la droite pour l'ennemi */
.bc-perso.entree { animation: bc-entree-gauche 0.8s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.bc-ennemi.entree { animation: bc-entree-droite 0.8s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes bc-entree-gauche { from { opacity: 0; transform: translateX(calc(var(--bc-h) * -1.3)); } to { opacity: 1; transform: none; } }
@keyframes bc-entree-droite { from { opacity: 0; transform: translateX(calc(var(--bc-h) * 1.3)); } to { opacity: 1; transform: none; } }
/* Bulle « 正解 +1 » à côté du personnage quand des points sont gagnés */
.bc-gain { position: absolute; z-index: 3; left: calc(var(--bc-axe) - var(--bc-ecart) + var(--bc-h) * 0.3); bottom: calc(var(--bc-sol) + var(--bc-h) * 0.12); margin: 0; display: grid; justify-items: center; color: var(--jaune); font-family: var(--police-titre); font-size: 1.6rem; line-height: 1; -webkit-text-stroke: 1px var(--encre); paint-order: stroke fill; opacity: 0; pointer-events: none; }
.bc-gain .jp { opacity: 1; font-size: 1rem; display: none; }
.bc-gain.correcte .jp { display: block; }
.bc-gain.visible { animation: bc-gain 1.3s ease-out forwards; }
@keyframes bc-gain { 0% { opacity: 0; translate: 0 6px; } 20% { opacity: 1; translate: 0 -8px; } 70% { opacity: 1; } 100% { opacity: 0; translate: 0 -30px; } }
/* Combat (bande-combat.js, combat()) : réponse entièrement correcte = le personnage attaque, l'ennemi est touché puis disparaît ;
   sinon l'ennemi attaque et le personnage clignote. Rien ne change au score. Barre de vie sous le trait d'encre, au-dessus de l'ennemi. */
.bc-vie { position: absolute; z-index: 2; left: 50%; top: calc(var(--bc-h) * 0.1); translate: -50% 0; width: calc(var(--bc-h) * 0.5); height: 12px; box-sizing: border-box; border: 2.5px solid var(--encre); border-radius: 3px; background: var(--fiche); overflow: hidden; }
.bc-vie > span { display: block; height: 100%; width: calc(var(--vie, 1) * 100%); background: var(--vert-bleu); transition: width 0.45s steps(9) 0.3s; }
.bc-vie[data-niveau="moyenne"] > span { background: var(--orange); }
.bc-vie[data-niveau="basse"] > span { background: var(--rouge); }
.bc-perso.attaque { animation: bc-attaque-droite 0.7s ease-in-out; }
.bc-ennemi.attaque { animation: bc-attaque-gauche 0.7s ease-in-out; }
.bc-ennemi.touche { animation: bc-touche 0.5s ease-out 0.3s; }
.bc-perso.touche { animation: bc-clignote 0.9s steps(1, end) 0.3s; }
.bc-ennemi.vaincu { opacity: 0; transform-origin: 50% 100%; }
.bc-ennemi.touche.vaincu { animation: bc-touche 0.5s ease-out 0.3s, bc-fondre 0.7s ease-in 0.8s both; }
@keyframes bc-attaque-droite { 0%, 100% { transform: none; } 35%, 50% { transform: translateX(calc(var(--bc-h) * 0.45)); } }
@keyframes bc-attaque-gauche { 0%, 100% { transform: none; } 35%, 50% { transform: translateX(calc(var(--bc-h) * -0.45)); } }
@keyframes bc-touche { 0% { filter: brightness(2.4); transform: translateX(calc(var(--bc-h) * 0.04)); } 50% { filter: brightness(1); transform: translateX(calc(var(--bc-h) * -0.03)); } 100% { filter: none; transform: none; } }
@keyframes bc-clignote { 0%, 33%, 66%, 100% { opacity: 1; } 16%, 50%, 83% { opacity: 0.15; } }
@keyframes bc-fondre { 0% { opacity: 1; filter: brightness(1); transform: none; } 35% { opacity: 0.85; filter: brightness(2.4); } 100% { opacity: 0; filter: brightness(2.4); transform: scale(0.85); } }
@media (prefers-reduced-motion: reduce) {
  .bc-dragon, .bc-monstre { animation: none; }
  .bc-perso, .bc-ennemi { transition: none; }
  .bc-perso.entree, .bc-ennemi.entree { animation: none; }
  .bc-perso.attaque, .bc-ennemi.attaque, .bc-perso.touche, .bc-ennemi.touche, .bc-ennemi.touche.vaincu { animation: none; }
  .bc-vie > span { transition: none; }
  .bc-gain.visible { animation: none; opacity: 1; }
}
/* Aperçu du professeur (page Tester) et écrans peu hauts : pas de bande, le score reste en texte dans la colonne */
html.integre .bande-combat { display: none; }
@media (max-height: 500px) { .bande-combat { display: none; } .ecran:has(.bande-combat:not([hidden])) .score { display: block; } }

.consigne { margin: 0; color: var(--encre); font-family: var(--police-titre); font-size: 1.35rem; line-height: 1.25; text-align: center; }
.saisie { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; flex-shrink: 0; }

/* Résolution : une ligne par étape, les signes = alignés verticalement.
   L'équation de l'énoncé est la première ligne, à la même taille que les lignes de l'élève. */
.lignes { --taille: clamp(1.5rem, 4.8vmin, 2.6rem); font-size: var(--taille); display: grid; grid-template-columns: max-content auto max-content 1.2em; justify-content: center; align-items: center; column-gap: 0.35em; row-gap: 0.25em; max-width: 100%; flex-shrink: 0; padding: 4px; }
.lignes .katex { font-size: 1.21em; }
.membre.gauche { justify-self: end; }
.membre.droite { justify-self: start; }
.egal { font-family: "KaTeX_Main", "Times New Roman", serif; font-size: 1.21em; }
.marque { font-weight: 700; font-size: 0.8em; }
.marque.ok { color: var(--juste); }
.marque.ko { color: var(--faux); }
.suppr { border: none; background: transparent; color: var(--discret); font-size: 0.8em; padding: 0.25em; border-radius: 6px; display: inline-grid; place-items: center; }
.suppr:hover { color: var(--faux); background: var(--faux-fond); }

/* Case de saisie mathématique (champ-math.js) */
.champ-math { font-family: "KaTeX_Main", "Times New Roman", serif; font-size: 1.21em; min-width: 3.2em; min-height: 1.5em; padding: 0.05em 0.3em; border: 2px solid color-mix(in srgb, var(--encre) 55%, transparent); border-radius: 8px; background: var(--carte); display: inline-flex; align-items: center; cursor: text; white-space: nowrap; line-height: 1.2; }
.champ-math.focus { border-color: var(--encre); box-shadow: 3px 3px 0 var(--ombre-dure); outline: none; }
.membre.gauche .champ-math { justify-content: flex-end; }
.champ-math.bloque { border-color: transparent; background: transparent; cursor: default; min-width: 0; padding: 0; }
.champ-math.bloque.vide { border-color: var(--trait); border-style: dashed; }
/* L'inconnue (x, y, t...) s'écrit toujours en italique Times New Roman, y compris dans les formules KaTeX. */
.champ-math .mx, .var, .katex .mathnormal { font-family: "Inconnue", "Times New Roman", Times, "Liberation Serif", serif; font-style: italic; }
.var { font-size: 1.12em; }
.champ-math .mexp { font-size: 0.72em; position: relative; top: -0.55em; line-height: 1; } /* carré (calcul littéral) */
.champ-math .mo { margin: 0 0.15em; }
.mf { display: inline-flex; flex-direction: column; align-items: stretch; vertical-align: middle; margin: 0 0.1em; font-size: 0.9em; }
.mf-num, .mf-den { display: flex; justify-content: center; align-items: center; padding: 0 0.15em; min-height: 1.1em; }
.mf-num { border-bottom: 0.07em solid currentColor; }
.mf-vide { display: inline-block; width: 0.6em; height: 0.85em; border: 1px dashed var(--discret); border-radius: 3px; }
.curseur { display: none; width: 0; height: 1.1em; border-left: 2px solid var(--accent); margin: 0 -1px; animation: clignote 1s steps(1) infinite; }
.champ-math.focus .curseur { display: inline-block; }
@keyframes clignote { 50% { border-color: transparent; } }

.message { margin: 0; padding: 6px 14px; border-radius: var(--rayon-petit); background: color-mix(in srgb, var(--orange) 18%, var(--fond)); border: 2px solid var(--encre); font-size: 1rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
/* Boutons : arcadia.css. Valider (et les autres boutons principaux de l'exercice) : plus grands, juste sous les réponses. */
.zone .btn.principal { min-width: 170px; padding: 10px 26px; font-size: 1.15rem; }
/* Étapes libres : ligne en pointillés sous la dernière ligne, pour ajouter l'étape suivante. */
.ligne-attente { grid-column: 1 / -1; justify-self: stretch; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 1.6em; margin-top: 0.1em; padding: 0 12px; border: 2px dashed var(--trait); border-radius: 10px; background: transparent; color: var(--discret); font: inherit; font-size: max(0.5em, 0.85rem); font-weight: 600; cursor: pointer; }
.ligne-attente:hover, .ligne-attente:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.ligne-attente[hidden], .question.revue .ligne-attente { display: none; }
.ligne-attente svg { width: 1.2em; height: 1.2em; flex: none; }
.btn-clavier { border: var(--trait-fort) solid var(--encre); background: var(--fond); color: var(--encre); border-radius: var(--rayon); width: 50px; font-size: 1.3rem; box-shadow: 3px 3px 0 var(--ombre-dure); }
.aide { margin: 0; color: var(--discret); font-size: 1rem; }

/* Correction */
.retour { width: min(980px, 100%); display: flex; flex-direction: column; gap: 10px; }
.parties { list-style: none; margin: 0; padding: 12px 16px; border-radius: var(--rayon-petit); border: 2px solid var(--encre); display: flex; flex-direction: column; gap: 6px; }
.parties.juste { background: var(--juste-fond); }
.parties.faux { background: var(--faux-fond); }
.parties li::before { font-weight: 700; margin-right: 8px; }
.parties li.ok::before { content: "✓"; color: var(--juste); }
.parties li.ko::before { content: "✗"; color: var(--faux); }
.explication { margin: 0; padding: 0; list-style: none; counter-reset: etape; display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.explication li { counter-increment: etape; background: var(--doux); border-radius: var(--rayon-petit); padding: 8px 10px; }
.explication li:last-child { grid-column: span 2; }
.carte[data-forme="association"] .explication li:last-child { grid-column: auto; }
.btn-detail { display: block; margin-top: 4px; padding: 2px 10px; border: 2px solid var(--encre); border-radius: var(--rayon-petit); background: var(--fond); color: var(--encre); font-size: 0.75rem; font-weight: 700; }
.explication li.ouvert { grid-column: 1 / -1; }
.detail { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.detail-etape { background: var(--carte); border-radius: 8px; padding: 4px 8px; font-size: 0.85rem; }
.detail-etape .katex { font-size: 1em; }

.explication li::before { content: counter(etape) ". "; font-weight: 700; color: var(--accent); }
.explication .etape-texte { color: var(--discret); font-size: 0.9rem; }

/* Clavier réduit aux touches de l'exercice */
/* Pavé numérique à droite de la zone de saisie (en dessous sur écran étroit) */
.clavier { grid-column: 2; grid-row: 2; align-self: center; display: grid; grid-template-columns: repeat(4, 56px); gap: 8px; padding: 10px; background: var(--colonne); border: var(--trait-fort) solid var(--encre); border-radius: var(--rayon); }
.clavier[hidden] { display: none; }
.clavier button { min-width: 0; height: 46px; border-radius: 8px; border: 2px solid var(--encre); background: var(--fond); box-shadow: 2px 2px 0 var(--ombre-dure); font-size: 1.15rem; font-family: "KaTeX_Main", "Times New Roman", serif; }
.clavier button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.clavier button.large { grid-column: span 2; min-width: 0; font-family: inherit; font-size: 0.95rem; }
.clavier button.op { background: var(--doux); font-weight: 700; }
.champ-math .mx.symbole, .var.symbole, .clavier button.inconnue.symbole { font-family: system-ui, "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-style: normal; }
.clavier button.inconnue { font-family: "Inconnue", "Times New Roman", Times, "Liberation Serif", serif; font-style: italic; font-size: 1.35rem; }
.clavier button:disabled { opacity: 0.35; cursor: default; }

.bilan h2 { margin: 0; }
.bilan-score { font-size: 2rem; font-weight: 700; margin: 0; text-align: center; }

/* Écran d'ordinateur peu haut (navigateur à 100 % sur un portable, par exemple 1280 × 600) : textes, marges et bande de combat
   plus petits pour que « Valider » reste visible sans défilement. */
@media (min-width: 701px) and (min-height: 501px) and (max-height: 720px) {
  .bande-combat { --bc-h: clamp(96px, 15dvh, 130px); }
  .zone { padding: 10px 24px 8px; gap: 6px; }
  .zone > .carte { padding: 2px 4px; gap: 8px; }
  .q-numero { padding: 3px 12px; }
  .consigne { font-size: 1.15rem; line-height: 1.2; }
  .lignes { --taille: clamp(1.3rem, 3.8vmin, 2rem); }
  .big-math { margin-top: 4px; }
  .zone .outils { gap: 6px; }
  .zone .outil-r { padding: 3px 10px; font-size: 0.85rem; }
  .qcm { gap: 8px 16px; }
  .choix { min-height: 54px; padding: 4px 12px 4px 10px; gap: 10px; font-size: clamp(1.1rem, 3.2vmin, 1.5rem); box-shadow: 4px 4px 0 var(--ombre-dure); }
  .choix-partie .choix { min-height: 46px; font-size: 1.2rem; }
  .choix-partie.disp-cards .choix { min-height: 56px; }
  .zone .btn.principal { padding: 7px 22px; font-size: 1.05rem; }
  .aide { font-size: 0.9rem; }
  .parties { padding: 8px 12px; gap: 4px; }
}

/* Téléphone en portrait : la question en haut, le pavé numérique dans le tiers bas. */
@media (orientation: portrait) and (max-width: 600px) {
  body { font-size: 16px; }
  .ecran { display: flex; flex-direction: column; }
  .cote { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px 16px; gap: 8px 10px; overflow: visible; }
  .cote { background: var(--colonne); }
  .cote::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 8px; background: linear-gradient(var(--rouge) 0 20%, var(--orange) 0 40%, var(--jaune) 0 60%, var(--vert-bleu) 0 80%, var(--bleu) 0); }
  .cote-titre { display: none; }
  /* Une seule colonne d'explications : la dernière ne s'étale pas sur deux colonnes (elle créerait une colonne de trop, hors de l'écran) */
  .explication li:last-child { grid-column: auto; }
  .tache { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .tache h1 { font-size: 1.05rem; margin: 0; }
  .exos-eleve { padding: 6px 0 0; gap: 8px 6px; }
  .exo-eleve { width: 34px; height: 34px; font-size: 1rem; }
  .exo-eleve::before { width: 15px; height: 15px; top: -6px; right: -6px; font-size: 9px; }
  .zone-tete { gap: 8px; }
  .chrono { min-width: 0; }
  .chrono-texte { font-size: 1.15rem; padding: 2px 8px; }
  .bande-combat { --bc-h: 92px; }
  .bc-score { top: 8px; left: 12px; min-width: 88px; padding: 3px 10px 2px; }
  .bc-monstre { --t: calc(var(--bc-h) * 0.75); }
  .bc-nom { display: none; }
  /* Clavier ouvert : il prend la place de la bande ; le score revient en texte */
  .ecran:has(.clavier:not([hidden])) .bande-combat { display: none; }
  .ecran:has(.clavier:not([hidden])) .score { display: block; flex-basis: 100%; margin: 0; }
  .tache .bouton-theme { position: static; order: 3; width: 30px; height: 30px; }
  .eleve-moi { margin: 0; }
  .btn-reglages { padding: 3px 8px; font-size: 0.75rem; }
  .resume, .score { display: none; }
  /* Gagner des lignes : les pastilles disent déjà « question n sur N » ; titre et consigne plus petits */
  .q-numero { display: none; }
  .zone-tete { gap: 0; }
  .consigne { font-size: 1.05rem; line-height: 1.3; }
  .lim .lw { font-size: 0.95em; }
  .tache .libre-infos { margin: 0; }
  .zone .outils { gap: 6px; }
  .zone .outil-r { padding: 3px 10px; font-size: 0.85rem; }
  .zone .qcm { gap: 10px; padding: 0 5px 5px 0; }
  .zone .qcm.court:not([data-forme="intrus"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .zone .qcm .choix { min-height: 52px; gap: 8px; padding: 6px 8px 6px 8px; font-size: 1.2rem; box-shadow: 4px 4px 0 var(--ombre-dure); }
  .retour > .actions { flex-wrap: nowrap; gap: 10px; }
  .retour > .actions .btn { flex: 1 1 0; min-width: 0; padding: 10px 8px; font-size: 1rem; white-space: nowrap; }
  .questions { grid-template-columns: repeat(10, 24px); gap: 6px; }
  .questions li { width: 24px; height: 24px; font-size: 0.72rem; }
  .zone { flex: 1; display: flex; flex-direction: column; padding: 8px; gap: 8px; }
  .carte { padding: 10px; gap: 8px; border-radius: 12px; }
  .lignes { --taille: 1.15rem; }
  .clavier { align-self: stretch; grid-template-columns: repeat(4, 1fr); padding: 6px; gap: 5px; }
  .clavier button { height: clamp(34px, 5.2dvh, 50px); }
}

/* Téléphone en paysage : peu de hauteur, tout se resserre. */
@media (max-height: 500px) {
  body { font-size: 15px; }
  .ecran { grid-template-columns: 170px 1fr; }
  .cote { padding: 8px 18px 8px 8px; gap: 8px; }
  .exo-eleve { width: 32px; height: 32px; font-size: 0.95rem; }
  .questions { grid-template-columns: repeat(5, 22px); gap: 6px; }
  .questions li { width: 22px; height: 22px; font-size: 0.7rem; }
  .chrono-texte { font-size: 1rem; padding: 1px 8px; }
  .tache h1 { font-size: 1rem; }
  .btn-reglages { padding: 3px 6px; font-size: 0.75rem; }
  .resume { display: none; }
  .zone { padding: 6px 10px; gap: 6px; }
  .carte { padding: 8px 12px; gap: 6px; border-radius: 12px; }
  .lignes { --taille: 1.15rem; row-gap: 2px; }
  .champ-math { border-radius: 8px; }
  .message { padding: 2px 10px; font-size: 0.85rem; }
  .aide { display: none; }
  .clavier { padding: 4px; gap: 4px; grid-template-columns: repeat(4, 42px); }
  .clavier button { height: 34px; font-size: 1rem; }
  .btn { padding: 4px 14px; }
  .parties { padding: 6px 10px; gap: 2px; font-size: 0.9rem; }
  .explication { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 4px; }
  .explication li { padding: 4px 8px; }
  .explication .etape-texte { font-size: 0.8rem; }
}

/* Réglages du professeur : compact, curseurs à côté des noms */
.reglages { border: 1px solid var(--trait); border-radius: 16px; background: var(--carte); color: var(--encre); padding: 14px 20px; width: min(900px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
.reglages::backdrop { background: rgb(0 0 0 / 0.45); }
.r-entete { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.r-entete h2 { margin: 0; font-size: 1.2rem; }
.r-questions { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.95rem; }
/* Nombre modifiable (questions, temps) : boutons − et + autour d'une case où l'on tape la valeur. */
.r-compteur { display: inline-flex; align-items: center; border: 1.5px solid var(--trait); border-radius: 999px; background: var(--fond); overflow: hidden; }
.r-compteur .r-pas { border: none; background: none; color: var(--accent); font: inherit; font-weight: 700; font-size: 1rem; width: 28px; height: 28px; cursor: pointer; line-height: 1; padding: 0; }
.r-compteur .r-pas:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.r-compteur .r-nombre { width: 2.6em; border: none; background: none; color: var(--encre); font: inherit; font-weight: 700; font-size: 0.95rem; text-align: center; padding: 0; -moz-appearance: textfield; appearance: textfield; font-variant-numeric: tabular-nums; }
.r-compteur .r-nombre::-webkit-outer-spin-button, .r-compteur .r-nombre::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.r-compteur .r-nombre:focus { outline: none; }
.r-compteur:focus-within { border-color: var(--accent); }
.r-compteur .r-suffixe { font-size: 0.8rem; color: var(--discret); margin-left: -2px; }
.r-compteur.r-grise { opacity: 0.4; }
.r-compteur button:disabled, .r-compteur input:disabled { cursor: not-allowed; }
.reglages-grille { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.reglages fieldset { min-width: 0; border: 1px solid var(--trait); border-radius: 10px; margin: 0; padding: 4px 10px 10px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; }
.reglages fieldset.large { grid-column: span 4; }
.reglages legend { font-weight: 700; font-size: 0.9rem; padding: 0 4px; }
.reglages label { font-size: 0.95rem; cursor: pointer; }
.reglages small { color: var(--discret); font-size: 0.7rem; }
/* Choix des rubriques : pastilles sélectionnables (case cachée), cochées = teintées de la couleur d'accent, sans ✓ :
   la surbrillance suffit (règle de Fayçal, 20/10). */
.reglages .r-choix { position: relative; max-width: 100%; }
.reglages .r-choix input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.reglages .r-choix > span { display: inline-block; max-width: 100%; box-sizing: border-box; padding: 4px 12px; border: 1.5px solid var(--trait); border-radius: 16px; background: var(--fond); line-height: 1.35; transition: background 0.12s, border-color 0.12s; }
.reglages .r-choix:hover > span { border-color: var(--accent); }
.reglages .r-choix input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--fond)); }
.reglages .r-choix input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.reglages .r-choix .formule-texte { white-space: nowrap; } /* une formule ne se coupe jamais en deux */
.reglages label.indisponible { opacity: 0.4; cursor: not-allowed; }
.reglages label.indisponible input { cursor: not-allowed; pointer-events: none; }
.reglages label.indisponible > span { border-style: dashed; }
.reglages .formule-texte { font-size: inherit; } /* formules à la taille du texte autour (seules les lettres, en Times, sont un peu agrandies) */
.r-forme { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 10px; }
.r-forme + .r-personnaliser { margin-top: 12px; }
.boutons-forme { display: flex; flex-wrap: wrap; gap: 6px; }
.boutons-forme label { position: relative; }
.boutons-forme input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.boutons-forme span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 2px solid var(--trait); border-radius: 999px; font-weight: 700; font-size: 0.9rem; background: var(--fond); }
/* Formes des réglages d'un exercice : icône et nom en petit, boutons plus compacts. */
.r-forme .boutons-forme { gap: 5px; }
.r-forme .boutons-forme > label > span { gap: 5px; padding: 3px 10px 3px 8px; border-width: 1.5px; }
.r-forme .boutons-forme small { font-size: 0.75rem; font-weight: 600; color: inherit; }
.boutons-forme input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-encre); }
.boutons-forme input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.r-etiquette { font-weight: 700; }
.r-pastilles span { padding: 4px 10px; }
.r-perso { align-self: center; font-size: 0.85rem; color: var(--accent); }
/* Élément d'une liste (types d'équations, choix cochés…) : une pastille discrète, bien séparée de la suivante. */
.p-element { display: inline-block; padding: 0 8px; border: 1px solid var(--trait); border-radius: 999px; background: var(--fond); color: var(--encre); line-height: 1.6; white-space: nowrap; }
.r-personnaliser { margin-top: 8px; }
.r-personnaliser > summary { cursor: pointer; font-weight: 700; color: var(--accent); margin-bottom: 8px; }
.r-temps { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 1; min-width: 180px; max-width: 320px; }
.r-temps input[type=range] { flex: 1; min-width: 60px; }
.saisie-temps { width: 4.2em; font: inherit; font-size: 0.8rem; padding: 1px 4px; border: 1.5px solid var(--accent); border-radius: 6px; background: var(--fond); color: var(--encre); }
.r-temps output { cursor: text; font-size: 0.75rem; color: var(--discret); min-width: 3em; font-variant-numeric: tabular-nums; }
.sans-chrono { flex-basis: 100%; font-size: 0.8rem; color: var(--discret); }
/* Temps par question (réglages d'un exercice) : icône, nombre modifiable et « ∞ Sans chrono », sous les formes. */
.r-duree { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; flex-basis: 100%; }
.r-chrono { display: inline-flex; color: var(--discret); }
/* « ∞ Sans chrono » : bouton à bascule à côté du temps (case cachée). */
.r-sans-chrono { position: relative; }
.r-sans-chrono input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.r-sans-chrono > span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1.5px solid var(--trait); border-radius: 999px; background: var(--fond); font-size: 0.75rem; font-weight: 600; }
.r-sans-chrono b { font-size: 1.05rem; line-height: 1; }
.r-sans-chrono:hover > span { border-color: var(--accent); }
.r-sans-chrono input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-encre); }
.r-sans-chrono input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
/* Formes combinées : une ligne fine par forme cochée (à glisser pour l'ordre), de la plus facile à la plus difficile.
   Trait de gauche : rang parmi les formes cochées, du vert (plus facile) au rouge (plus difficile).
   Formes non cochées : petites icônes grisées en pointillés, sans texte, rangées après les lignes (un clic les coche). */
.r-blocs-entete { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; flex-basis: 100%; }
.r-blocs { list-style: none; margin: 0; padding: 0; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.r-bloc { display: flex; align-items: center; gap: 4px 10px; width: 100%; box-sizing: border-box; padding: 2px 8px 2px 6px; border: 1px solid var(--trait); border-left: 4px solid var(--rang, var(--trait)); border-radius: 8px; background: var(--fond); touch-action: none; user-select: none; }
.r-bloc, .r-bloc .r-bloc-nom, .r-bloc .r-bloc-nom input { cursor: grab; }
.r-bloc:hover { box-shadow: 0 0 0 1px var(--accent); }
/* Ligne saisie : elle suit le pointeur, légèrement soulevée ; sa place dans la liste reste vide (pointillés). */
.r-bloc-fantome { position: fixed; z-index: 1000; margin: 0; pointer-events: none; cursor: grabbing; transform: rotate(-1deg) scale(1.02); border: 2px solid var(--encre); box-shadow: 5px 5px 0 var(--ombre-dure); }
.r-bloc.r-bloc-place { background: color-mix(in srgb, var(--accent) 8%, transparent); border: 2px dashed var(--accent); }
.r-bloc.r-bloc-place > * { visibility: hidden; }
.r-bloc-nom { position: relative; cursor: pointer; flex: 1; min-width: 0; }
.r-bloc-nom input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.r-bloc-nom > span { display: inline-flex; align-items: center; gap: 6px; padding: 1px 6px 1px 2px; font-weight: 700; }
.r-bloc-nom small { font-size: 0.8rem; font-weight: 600; color: inherit; }
.r-bloc-nom input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; border-radius: 6px; }
.r-bloc-nom:hover > span { color: var(--accent); }
.r-bloc-t { display: inline-flex; align-items: center; gap: 3px; cursor: auto; font-size: 0.85rem; }
.r-temps-lib { border: none; background: none; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer; padding: 1px 4px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.r-temps-lib:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.r-bloc-t .r-compteur .r-pas { width: 22px; height: 22px; font-size: 0.9rem; }
.r-bloc-t .r-compteur .r-nombre { width: 2.2em; font-size: 0.85rem; }
.r-bloc-q { font-size: 0.72rem; color: var(--discret); min-width: 5.5em; text-align: right; }
.r-bloc-q.r-bloc-zero { text-align: right; font-style: italic; }
.r-bloc-note { flex-basis: 100%; font-size: 0.72rem; color: var(--discret); }
.r-bloc.indisponible { flex-wrap: wrap; }
.r-bloc.indisponible .r-bloc-nom > span { opacity: 0.6; }
/* Forme non cochée : petite icône grisée en pointillés, sans texte (nom en infobulle). */
.r-bloc.r-bloc-off { order: 1; width: auto; padding: 3px; border: 1.5px dashed var(--pointille); border-radius: 8px; background: none; touch-action: auto; opacity: 0.7; }
.r-bloc.r-bloc-off, .r-bloc.r-bloc-off .r-bloc-nom, .r-bloc.r-bloc-off .r-bloc-nom input { cursor: pointer; }
.r-bloc.r-bloc-off:hover { opacity: 1; box-shadow: none; border-color: var(--accent); }
.r-bloc.r-bloc-off .r-bloc-nom { flex: none; }
.r-bloc.r-bloc-off .r-bloc-nom > span { padding: 0 2px; filter: grayscale(1); }
.r-bloc.r-bloc-off small, .r-bloc.r-bloc-off .r-bloc-t, .r-bloc.r-bloc-off .r-bloc-q, .r-bloc.r-bloc-off .r-bloc-note { display: none; }
/* Une seule ligne de réglages : nombre de questions (icône liste), niveau, difficulté. */
.r-ligne-reglages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 10px; }
.r-ligne-reglages .r-questions { gap: 6px; color: var(--discret); }
.r-ligne-reglages .r-compteur { color: var(--encre); }
.r-ligne-reglages .boutons-forme { align-items: center; }
.r-ligne-reglages { gap: 6px 10px; }
.r-ligne-reglages .boutons-forme { gap: 3px; }
.r-ligne-reglages .boutons-forme > label > span { padding: 1px 7px; font-size: 0.8rem; border-width: 1.5px; letter-spacing: -0.5px; }
.r-niveau-seul { font-weight: 700; padding: 3px 4px; }
.r-personnaliser > summary { list-style: none; }
.r-personnaliser > summary::-webkit-details-marker { display: none; }
.r-personnaliser > summary::after { content: " ▾"; }
.r-personnaliser[open] > summary::after { content: " ▴"; }
.reglages input[type=range] { accent-color: var(--accent); }
.reglages input[type=range]:disabled { opacity: 0.35; }
.reglages .actions { margin-top: 10px; justify-content: flex-end; align-items: center; position: sticky; bottom: -14px; background: var(--carte); padding: 8px 0; }
.r-eleve { margin-right: auto; font-size: 0.75rem; color: var(--discret); display: flex; align-items: center; gap: 6px; }
.r-eleve select { font: inherit; padding: 2px 4px; border: 1px solid var(--trait); border-radius: 6px; background: var(--fond); color: var(--encre); }
.r-erreur { color: var(--faux); margin: 8px 0 0; }
@media (max-width: 760px) {
  .reglages-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reglages fieldset.large { grid-column: span 2; }
}
@media (max-height: 500px) {
  .reglages { padding: 8px 12px; }
  .reglages label { font-size: 0.8rem; }
  .reglages fieldset { padding: 2px 8px 4px; }
}

/* Chronomètre par question */
.chrono { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 200px; flex-wrap: wrap; justify-content: flex-end; }
/* Temps global : avertissement quand l'élève dépasse bientôt le temps prévu pour une question. */
.alerte-temps { flex-basis: 100%; margin: 0; padding: 8px 14px; border-radius: var(--rayon-petit); border: 2px solid var(--encre); background: color-mix(in srgb, var(--evaluation) 15%, var(--carte)); font-weight: 600; }
.alerte-temps[hidden] { display: none; }
.chrono-barre { flex: 1; max-width: 420px; height: 12px; border: 2px solid var(--encre); border-radius: 0; background: var(--fond); overflow: hidden; }
.chrono { --chrono: var(--entrainement); }
.chrono-reste { height: 100%; width: 100%; background: var(--chrono); transition: width 1s linear, background-color 1s linear; }
/* Chiffres carrés dans une boîte sombre, comme le score */
.chrono-texte { order: 2; min-width: 4.2em; padding: 4px 12px; background: var(--fiche); border: var(--trait-fort) solid var(--encre); border-radius: 8px; font-family: var(--police-pixel); font-size: 1.5rem; line-height: 1.2; text-align: center; color: var(--jaune); font-variant-numeric: tabular-nums; }
.chrono .alerte-temps { order: 3; }
.chrono.urgent .chrono-reste { animation: pulse 0.8s ease-in-out infinite alternate; }
@keyframes pulse { to { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .chrono.urgent .chrono-reste { animation: none; } }
@media (max-height: 500px) {
  .chrono-barre { height: 6px; }
  .chrono-texte { font-size: 0.8rem; min-width: 4em; }
}

/* QCM : grandes propositions à cocher */
/* Cartes de réponse : trait d'encre, ombre dure, lettre dans un carré plein ; la réponse choisie se teinte de jaune
   (sans coche : la surbrillance suffit) ; après correction, vert ou rouge. */
.qcm { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px 20px; width: min(820px, 100%); padding: 0 6px 6px 0; }
.choix { display: flex; align-items: center; justify-content: flex-start; gap: 14px; min-height: 68px; padding: 8px 16px 8px 12px; border: 3px solid var(--encre); border-radius: var(--rayon); background: var(--fond); color: var(--encre); box-shadow: 5px 5px 0 var(--ombre-dure); font-size: clamp(1.2rem, 3.6vmin, 1.8rem); text-align: left; transition: transform 0.08s; }
.choix:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--doux); }
.choix-lettre { font-family: var(--police-titre); font-size: 0.7em; color: var(--fond); background: var(--encre); border-radius: var(--rayon-petit); width: 1.75em; height: 1.75em; display: grid; place-items: center; flex: none; }
.choix[aria-pressed="true"] { background: var(--selection); border-width: 4px; transform: scale(1.02); }
.choix.ok { border-color: var(--juste); background: var(--juste-fond); }
.choix.ok .choix-lettre { background: var(--juste); color: var(--creme); }
.choix.ko { border-color: var(--faux); background: var(--faux-fond); }
.choix.ko .choix-lettre { background: var(--faux); color: var(--creme); }
.choix.manque { border-color: var(--juste); border-style: dashed; }
.choix.neutre { opacity: 0.55; }

/* Association : deux colonnes, chaque paire prend une couleur */
.association { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px 28px; width: min(900px, 100%); }
.asso-col { display: flex; flex-direction: column; gap: 8px; }
.asso-item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 4px 12px; border: var(--trait-fort) solid var(--encre); border-radius: var(--rayon); background: var(--fond); box-shadow: 4px 4px 0 var(--ombre-dure); font-size: clamp(1.15rem, 3.4vmin, 1.65rem); text-align: left; }
.asso-tag { font-size: 0.6em; font-weight: 700; color: var(--discret); min-width: 1.4em; }
.asso-marque { margin-left: auto; font-weight: 700; }
.asso-item.choisi { background: var(--selection); border-width: 4px; }
/* Couleurs des paires : celles de la bande, sans le rouge (réservé aux erreurs) */
.asso-item[data-paire="1"] { --p: var(--bleu); }
.asso-item[data-paire="2"] { --p: var(--orange); }
.asso-item[data-paire="3"] { --p: var(--vert-bleu); }
.asso-item[data-paire="4"] { --p: var(--jaune); }
.asso-item:not([data-paire=""]) { border-color: var(--p); background: color-mix(in srgb, var(--p) 18%, var(--fond)); }
.asso-item:not([data-paire=""]) .asso-tag { color: var(--encre); }
.asso-item.ok .asso-marque { color: var(--juste); }
.asso-item.ko .asso-marque { color: var(--faux); }
@media (max-height: 500px) {
  .choix { min-height: 40px; padding: 2px 8px; }
  .qcm { gap: 6px; }
  .asso-item { min-height: 34px; padding: 1px 8px; }
  .asso-col { gap: 4px; }
}

/* Intrus : quatre équations en grille */
.qcm[data-forme="intrus"] { grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(720px, 100%); }

/* Questions en plusieurs parties : figure à gauche, parties à remplir à droite */
.zone-parties { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); gap: 14px 22px; width: 100%; align-items: start; }
.zone-parties.sans-figure { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
@media (max-width: 760px) { .zone-parties { grid-template-columns: minmax(0, 1fr); } }
.figure-q { background: var(--fond); border: 1px solid var(--trait); border-radius: 12px; padding: 4px; }
.figure-q svg { display: block; width: 100%; height: auto; max-height: 52vh; }
.parties-q { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.partie { display: flex; flex-direction: column; gap: 6px; border-radius: 10px; padding: 2px 0; }
.partie.ok .partie-titre::after { content: " ✓"; color: var(--juste); font-weight: 700; }
.partie.ko .partie-titre::after { content: " ✗"; color: var(--faux); font-weight: 700; }
.partie-titre { margin: 0; font-weight: 700; font-size: 1.15rem; }
.saisie-partie { font: inherit; font-size: 1.3rem; padding: 6px 10px; width: 6.5em; border: 2px solid var(--trait); border-radius: 10px; background: var(--fond); color: var(--encre); letter-spacing: 0.06em; }
.saisie-partie:focus { border-color: var(--accent); outline: none; }
.partie-nombre, .partie-angle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.partie-nombre .unite { font-size: 1.3rem; }
.champs-partie { display: flex; flex-direction: column; gap: 6px; }
.champs-ligne { margin: 0; font-size: 1.25rem; line-height: 2.5; }
.champ-trou { font-size: 1.15rem; padding: 2px 8px; margin: 0 3px; text-align: center; vertical-align: middle; max-width: 100%; }
.champ-trou.ok { border-color: var(--juste); background: var(--juste-fond); }
.champ-trou.ko { border-color: var(--faux); background: var(--faux-fond); }

/* Tableau de conversion (Convertir des unités) : un chiffre par case, la virgule à droite de sa case.
   Forme notée (saisie), outil d'aide non noté et correction (tableau rempli). Trait épais entre deux unités. */
.tc-defile { max-width: 100%; overflow-x: auto; padding-bottom: 2px; }
.tab-conv { border-collapse: collapse; margin: 4px 0; font-variant-numeric: tabular-nums; }
.tab-conv th { padding: 4px 6px; border: 1.5px solid var(--trait); border-right-width: 3px; background: var(--doux); color: var(--encre); font-size: 0.95rem; font-weight: 700; white-space: nowrap; }
.tab-conv .tc-capa th { border-right-width: 1.5px; background: var(--carte); color: var(--discret); font-size: 0.8rem; font-weight: 600; min-width: 2.2em; }
.tab-conv .tc-capa th:empty { padding: 0; }
.tab-conv .tc-capa th.tc-fin { border-right-width: 3px; }
.tab-conv td.tc-case { position: relative; min-width: 2.2em; height: 2.3em; padding: 0; border: 1.5px solid var(--trait); text-align: center; font-size: 1.25rem; font-weight: 600; }
.tab-conv td.tc-fin { border-right-width: 3px; }
.explication li:has(.tab-conv) { grid-column: 1 / -1; }
.explication .tab-conv td.tc-case { color: var(--encre); }
.tab-conv td.tc-case.tc-zero { color: var(--accent); }
.tab-conv .tc-virg { position: absolute; right: -0.22em; bottom: -0.3em; z-index: 1; color: var(--centre); font-size: 2.3rem; font-weight: 800; line-height: 1; pointer-events: none; }
.tab-conv .tc-virg[hidden] { display: none; }
.tab-conv .tc-virg.ok { color: var(--juste); }
.tab-conv .tc-virg.ko { color: var(--faux); }
.tc-chiffre { width: 2.2em; height: 2.3em; box-sizing: border-box; padding: 0; border: 0; background: transparent; color: var(--encre); font: inherit; text-align: center; caret-color: var(--accent); }
.tc-chiffre:focus { outline: 2px solid var(--accent); outline-offset: -3px; }
.tab-conv td.tc-case.ok { background: var(--juste-fond); }
.tab-conv td.tc-case.ok .tc-chiffre { color: var(--juste); }
.tab-conv td.tc-case.ko { background: var(--faux-fond); }
.tab-conv td.tc-case.ko .tc-chiffre { color: var(--faux); }
.tc-virgules td { padding: 2px 0 0; border: 0; text-align: right; }
.tc-bv { width: 1.5em; height: 1.5em; margin-right: -0.75em; position: relative; z-index: 2; padding: 0; border: 1.5px dashed var(--trait); border-radius: 50%; background: var(--carte); color: var(--discret); font: inherit; font-size: 1.4rem; font-weight: 800; line-height: 1; cursor: pointer; }
.tc-bv:hover { border-color: var(--accent); color: var(--accent); }
.tc-bv[aria-pressed="true"] { border-style: solid; border-color: var(--centre); background: var(--centre); color: var(--sur-couleur); }
.tc-bv:disabled { cursor: default; opacity: 0.5; }
.tc-virgules td:last-child .tc-bv { margin-right: 0; }
/* Tableau : colonnes en plus (+ de chaque côté), lignes par mesure, « Effacer » collé sous le tableau. */
.tc { display: flex; flex-direction: column; align-items: stretch; width: fit-content; align-self: flex-start; max-width: 100%; }
.tc-rangee { display: flex; align-items: stretch; gap: 4px; max-width: 100%; }
.tc-rangee .tc-defile { min-width: 0; }
.tc-plus { flex: none; width: 28px; display: grid; place-items: center; padding: 0; border: 1.5px dashed var(--trait); border-radius: 8px; background: transparent; color: var(--discret); cursor: pointer; }
.tc-plus:hover, .tc-plus.tc-propose { border-color: var(--accent); color: var(--accent); }
.tc-plus.tc-propose { border-style: solid; background: var(--doux); animation: tc-pulse 1.2s ease-in-out 3; }
@keyframes tc-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); } }
.tc-pied { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: -2px; }
.tc-effacer, .tc-plus-mesure { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1.5px solid var(--trait); border-radius: 0 0 8px 8px; border-top: none; background: var(--carte); color: var(--discret); font: inherit; font-size: 0.85rem; cursor: pointer; }
.tc-effacer { margin-left: auto; }
.tc-effacer:hover:not(:disabled), .tc-plus-mesure:hover { border-color: var(--accent); color: var(--accent); }
.tc-effacer:disabled { opacity: 0.4; cursor: default; }
.tab-conv th.tc-etiq { padding: 4px 8px; background: var(--carte); font-size: 0.9rem; text-align: right; }
.tab-conv th.tc-coin { background: transparent; border: none; }
.tab-conv th.tc-extra { background: var(--carte); border-style: dashed; min-width: 2.2em; }
.aide-tableau { width: min(900px, 100%); display: flex; flex-direction: column; gap: 10px; }
.aide-tableau[hidden] { display: none; }
.aide-tableau-barre { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.aide-tableau-titre { margin: 0; color: var(--discret); font-size: 0.9rem; font-weight: 600; }
.partie-ecrire-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.partie-ecrire-ligne .prefixe { font-size: 1.2rem; }
.saisie-ecrire { width: 7em; }
.btn-valeur { min-width: 3.2em; padding: 6px 12px; font-size: 1.05rem; }
.partie.ok .saisie-ecrire { border-color: var(--juste); }
.partie.ko .saisie-ecrire { border-color: var(--faux); }
.apercu-angle { font-size: 1.4rem; min-width: 3em; }
.btn-chapeau[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.points-choisis { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-height: 34px; }
.puce-point { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--accent); background: var(--doux); font-family: 'Times New Roman', serif; font-style: italic; font-size: 1.15rem; }
.choix-partie { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.choix-partie.liste { grid-template-columns: minmax(0, 1fr); }
.choix-partie .choix { min-height: 52px; font-size: 1.35rem; justify-content: flex-start; text-align: left; }
.choix-partie.liste .choix { font-size: 1.15rem; line-height: 1.35; padding: 8px 12px; }
.choix-partie .choix:disabled { cursor: default; }

/* Figures de géométrie (SVG) */
.figure-q { --donne: var(--bleu); --cible: var(--orange); }
.figure-q .ln { stroke: var(--encre); stroke-width: 1.9; fill: none; stroke-linecap: round; }
/* Droites parallèles données : en couleur, jamais de flèches (usage français) */
.figure-q .ln.par { stroke: var(--parallele, var(--vert-bleu)); stroke-width: 2.4; }
.figure-q .px { stroke: var(--encre); stroke-width: 1.8; fill: none; }
.figure-q .mk { stroke: var(--encre); stroke-width: 1.9; fill: none; stroke-linejoin: round; }
.figure-q .pl { font: italic 600 24px 'Times New Roman', serif; fill: var(--encre); paint-order: stroke; stroke: var(--fond); stroke-width: 5px; stroke-linejoin: round; }
.figure-q .nm { font: italic 500 19px 'Times New Roman', serif; fill: var(--discret); paint-order: stroke; stroke: var(--fond); stroke-width: 4px; }
.figure-q .arc { stroke-width: 2; fill-opacity: 0.3; }
.figure-q .arc.given { fill: var(--donne); stroke: var(--donne); }
.figure-q .arc.target { fill: var(--cible); stroke: var(--cible); }
.figure-q .arc.good { fill: var(--juste); stroke: var(--juste); }
.figure-q .arc.bad { fill: var(--faux); stroke: var(--faux); }
.figure-q .arc.info { fill: var(--discret); stroke: var(--discret); fill-opacity: 0.2; }
.figure-q .alab { font: 700 17px system-ui, sans-serif; paint-order: stroke; stroke: var(--fond); stroke-width: 4px; }
.figure-q .alab.given { fill: var(--donne); } .figure-q .alab.target { fill: var(--cible); } .figure-q .alab.good { fill: var(--juste); } .figure-q .alab.info { fill: var(--discret); } .figure-q .alab.bad { fill: var(--faux); }
.figure-q .hit { fill: transparent; cursor: pointer; }
.figure-q .hit:hover { fill: color-mix(in srgb, var(--accent) 20%, transparent); }
.figure-q .hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 3; }
.figure-q .ring { fill: none; stroke: var(--accent); stroke-width: 2.6; pointer-events: none; }
.figure-q .ord { font: 700 14px system-ui, sans-serif; fill: var(--accent); pointer-events: none; }
@media (max-width: 700px) { .exos-eleve { flex-basis: 100%; } }

/* ---------- Exercices de limites (Tle) : écriture mathématique en HTML, courbes, tableaux ---------- */
.zone-parties, .consigne, .retour { --cible: var(--orange); --c0: var(--bleu); --c1: var(--vert-bleu); --c2: var(--rouge); }
.fr { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: 0.9em; margin: 0 0.12em; line-height: 1.15; }
.fr > span:first-child { padding: 0 0.22em 1px; border-bottom: 1.4px solid currentColor; }
.fr > span:last-child { padding: 1px 0.22em 0; }
.lim { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1; margin-right: 0.08em; }
.ls { font: 600 max(0.74em, 12px)/1.15 "KaTeX_Main", "Times New Roman", Times, serif; white-space: nowrap; margin-top: 2px; text-align: center; }
.ls i, .ls i.var { font-size: 1em; }
.sq { white-space: nowrap; }
.sq > span { border-top: 1.4px solid currentColor; padding: 0 1px; margin-left: 1px; }
.nowrap { white-space: nowrap; }
.big-math { display: block; font-size: 1.5rem; text-align: center; margin-top: 12px; color: var(--encre); }
.stmt { display: block; background: var(--doux); border-radius: 10px; padding: 12px 14px; font-size: 1.05rem; line-height: 1.9; color: var(--encre); }
.consigne i, .zone-parties i, .retour i { font-family: "KaTeX_Main", "Times New Roman", serif; font-size: 1.1em; }
/* La lettre d'une expression (calcul littéral) : Times New Roman italique, comme partout sur la plateforme. */
.consigne i.var, .zone-parties i.var, .retour i.var { font-family: "Inconnue", "Times New Roman", Times, "Liberation Serif", serif; font-size: 1.12em; }
.bk { display: inline-grid; place-items: center; min-width: 1.7em; height: 1.5em; padding: 0 4px; border: 1.6px dashed var(--cible); color: var(--cible); border-radius: 6px; font-style: normal; font-size: 0.9em; vertical-align: middle; }
.fn { display: block; color: var(--discret); font-size: 0.9rem; line-height: 1.6; }
.fl { margin-right: 4px; }
.plot { display: block; width: 100%; max-width: 440px; height: auto; background: var(--carte); border: 1px solid var(--trait); border-radius: 10px; margin: 0 auto; }
.plot .gr { stroke: var(--doux); stroke-width: 0.8; }
.plot .ax { stroke: var(--discret); stroke-width: 1.4; }
.plot .cv { stroke: var(--accent); stroke-width: 2.6; fill: none; stroke-linejoin: round; }
.plot.small .cv { stroke-width: 4.5; }
.plot.small .gr { stroke-width: 1.2; }
.plot .as { stroke: var(--cible); stroke-width: 2; stroke-dasharray: 6 5; }
.plot.small .as { stroke-width: 3; }
.plot .tk { fill: var(--discret); }
.plot.lisible .gr { stroke: var(--trait); stroke-width: 1; }
.plot.lisible .cv { stroke-width: 2.2; }
.plot.lisible .tk { fill: var(--encre); font-weight: 600; paint-order: stroke; stroke: var(--carte); stroke-width: 4px; stroke-linejoin: round; }
.plot .ctag { fill: var(--encre); font-weight: 800; paint-order: stroke; stroke: var(--carte); stroke-width: 5px; }
.figure-q:has(.vt) { overflow-x: auto; }
.vt { display: block; width: 100%; max-width: 560px; min-width: 300px; height: auto; margin: 0 auto; }
.vt .vtb { fill: var(--carte); stroke: var(--encre); stroke-width: 1.3; }
.vt .vtl { stroke: var(--encre); stroke-width: 1.3; }
.vt .vth { fill: var(--encre); font: italic 600 20px "KaTeX_Main", "Times New Roman", serif; }
.vt .vtx, .vt .vtv { fill: var(--encre); font: 500 18px "KaTeX_Main", "Times New Roman", serif; }
.vt .vta { stroke: var(--encre); stroke-width: 1.6; }
.vt .vth2 { fill: var(--encre); }

/* Propositions en ligne (sans lettre), en grille, en cartes, lignes numérotées */
.choix-partie.disp-inline { grid-template-columns: repeat(auto-fit, minmax(90px, max-content)); }
.choix-partie.disp-inline .choix { justify-content: center; }
.choix-partie.disp-grid, .choix-partie.disp-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.choix-partie.disp-cards .choix { min-height: 72px; }
.choix-partie .choix-texte { line-height: 1.8; }
.choix-partie.disp-lines .choix-lettre { border: none; width: auto; font-size: 0.95rem; }

/* Tableau : une ligne, ses propositions */
.lignes-partie { display: flex; flex-direction: column; gap: 8px; }
.ligne-partie { display: grid; grid-template-columns: 1.1em minmax(0, 1fr); grid-template-areas: "m l" "m p"; gap: 4px 6px; padding: 8px 10px; border: 1.5px solid var(--trait); border-radius: 10px; background: var(--carte); align-items: center; }
.ligne-partie.ok { border-color: var(--juste); }
.ligne-partie.ko { border-color: var(--faux); }
.marque-ligne { grid-area: m; font-weight: 700; }
.ligne-partie.ok .marque-ligne { color: var(--juste); }
.ligne-partie.ko .marque-ligne { color: var(--faux); }
.ligne-label { grid-area: l; line-height: 1.9; }
.puces { grid-area: p; display: flex; flex-wrap: wrap; gap: 6px; }
.puce { font: inherit; font-size: 0.95rem; min-height: 40px; min-width: 52px; padding: 2px 12px; border: 1.5px solid var(--trait); border-radius: 999px; background: var(--fond); color: var(--encre); cursor: pointer; }
.puce[aria-pressed="true"] { border-color: var(--accent); background: var(--doux); box-shadow: inset 0 0 0 1px var(--accent); }
.puce.ok { border-color: var(--juste); background: var(--juste-fond); }
.puce.ko { border-color: var(--faux); background: var(--faux-fond); }
.puce.manque { border-color: var(--juste); border-style: dashed; }
.puce.neutre { opacity: 0.5; }
.puce:disabled { cursor: default; }

/* Association fonctions et courbes */
.associer { display: flex; flex-direction: column; gap: 10px; }
.assoc-fonctions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.assoc-courbes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.assoc-f, .assoc-c { font: inherit; color: inherit; background: var(--fond); border: var(--trait-fort) solid var(--encre); border-radius: var(--rayon); box-shadow: 4px 4px 0 var(--ombre-dure); cursor: pointer; }
.assoc-f { display: flex; align-items: center; gap: 10px; padding: 8px 12px; text-align: left; line-height: 1.8; }
.assoc-nom { flex: 1; min-width: 0; }
.assoc-cible { font-weight: 700; color: var(--discret); white-space: nowrap; }
.assoc-c { display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.assoc-c .plot { border: none; }
.assoc-de { text-align: center; font-size: 0.95rem; min-height: 1.6em; }
.assoc-valeurs .assoc-courbes { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.assoc-valeurs .assoc-c { align-items: center; justify-content: center; padding: 10px 6px 4px; min-height: 76px; }
.assoc-val { font-size: 1.25rem; line-height: 1.4; }
.assoc-num { font-weight: 700; color: var(--discret); min-width: 1.2em; }
/* Tableaux de variations dans une carte d'intrus, une ligne ou une tuile d'association : ils se réduisent à la place disponible. */
.choix .vt, .assoc-f .vt, .assoc-c .vt { min-width: 0; max-width: 100%; }
.tuile-tag { align-self: flex-end; padding: 2px 8px 0; font-weight: 800; }
.choix-partie.disp-cards:has(.vt) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.assoc-fonctions:has(.vt) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.associer:not(.assoc-valeurs) .assoc-courbes:has(> .assoc-c:nth-child(4)) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
/* Paires d'une association : jamais de rouge (le rouge est réservé à la correction). */
.pc0 { --pc: var(--bleu); } .pc1 { --pc: var(--orange); } .pc2 { --pc: var(--vert-bleu); } .pc3 { --pc: var(--jaune); }
.assoc-f[class*=pc], .assoc-c[class*=pc] { border-color: var(--pc); border-width: 2px; background: color-mix(in srgb, var(--pc) 12%, var(--carte)); }
.assoc-f[class*=pc] .assoc-cible, .assoc-c[class*=pc] .assoc-de { color: var(--pc); font-weight: 700; }
.assoc-c[class*=pc] .plot .cv { stroke: var(--pc); }
.assoc-c:not([class*=pc]) .plot .cv { stroke: var(--encre); }
.assoc-f.sel, .assoc-c.sel { background: var(--selection); border-width: 4px; }
.assoc-f.ok { border-color: var(--juste); background: var(--juste-fond); }
.assoc-f.ko { border-color: var(--faux); background: var(--faux-fond); }
.assoc-f:disabled, .assoc-c:disabled { cursor: default; }

/* Démonstration à trous */
.preuve { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 8px; line-height: 2; }
.case-trou { display: inline-flex; align-items: center; justify-content: center; min-width: 3.2em; min-height: 1.9em; padding: 2px 8px; margin: 0 2px; border: 1.8px dashed var(--cible); border-radius: 8px; vertical-align: middle; cursor: pointer; line-height: 1.4; background: var(--carte); }
.case-lettre { color: var(--cible); font-size: 0.9em; }
.case-trou.pleine { border-style: solid; border-color: var(--accent); background: var(--doux); }
.case-trou.sel { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.case-trou.ok { border-style: solid; border-color: var(--juste); background: var(--juste-fond); cursor: default; }
.case-trou.ko { border-style: solid; border-color: var(--faux); background: var(--faux-fond); cursor: default; }
.banque { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 12px; background: var(--doux); }
.etiquette { font: inherit; font-size: 1.2rem; display: inline-flex; align-items: center; min-height: 40px; padding: 4px 14px; border-radius: 9px; background: var(--carte); color: var(--encre); border: 1.5px solid var(--trait); cursor: pointer; }
.etiquette.sel { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.partie.ko .etiquette, .partie.ok .etiquette { display: none; }
.preuve.sans-numeros { list-style: none; padding-left: 0; }
.trous.glisser .etiquette, .trous.glisser .case-trou.pleine { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.etiquette.glissee { opacity: 0.45; }
.etiquette.fantome { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%); border-color: var(--encre); box-shadow: 5px 5px 0 var(--ombre-dure); cursor: grabbing; }
.case-trou.survol { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.case-trou.tete .plus-tete { display: none; }
/* Calcul aligné (calcul littéral, étapes à compléter) : même taille que l'énoncé, signes = les uns sous les autres. */
.preuve.alignee { display: grid; grid-template-columns: max-content max-content minmax(0, 1fr); align-items: center; column-gap: 0.35em; row-gap: 10px; font-size: 1.5rem; line-height: 1.5; color: var(--encre); width: max-content; max-width: 100%; margin: 4px auto 14px; padding: 0; }
.preuve.alignee .pa-g { text-align: right; }
.preuve.alignee .pa-d { white-space: normal; }
.preuve.alignee .case-trou { min-width: 1.6em; min-height: 1.35em; padding: 0 6px; margin: 0 3px; line-height: 1.2; }
.preuve.alignee .case-trou:not(.pleine) { min-width: 1.9em; }
.partie-titre:empty { display: none; }
/* Bouton de signe (+ ou −) devant une case : à cliquer, « ± » en gris tant qu'aucun signe n'est choisi. */
.preuve.alignee .case-trou.signe { min-width: 1.15em; padding: 0 3px; margin: 0 2px 0 6px; border: 1.5px solid var(--trait); border-radius: 50%; background: var(--carte); color: var(--accent); font-weight: 600; aspect-ratio: 1; min-height: 0; height: 1.2em; font-size: 0.9em; }
.preuve.alignee .case-trou.signe:not(.choisi) { color: var(--discret); font-weight: 400; }
.preuve.alignee .case-trou.signe:hover { border-color: var(--accent); }
.preuve.alignee .case-trou.signe.ok, .preuve.alignee .case-trou.signe.ko { border-radius: 50%; }
.preuve.alignee .pa-d > .case-trou.signe:first-child { margin-left: 0; }
/* Étiquette vide (coefficient 1) : une étiquette sans rien dedans ; placée, sa case se resserre. */
.etiq-vide { display: inline-block; width: 1.1em; height: 1em; }
.etiquette:has(.etiq-vide) { border-style: dashed; }
.preuve.alignee .case-trou.pleine:has(.etiq-vide) { min-width: 0.7em; padding: 0 2px; border-style: dotted; }
.preuve.alignee .case-trou .etiq-vide { width: 0.3em; }
/* Signe × : plus petit et plus fin que la lettre x (Times italique). */
.fois { font-size: 0.78em; font-weight: 300; margin: 0 0.18em; position: relative; top: -0.04em; }
.trous.aligne .etiquette { font-size: 1.3rem; padding: 2px 12px; }
.trous.aligne .banque { justify-content: center; }
.partie-trous.ok .banque, .partie-trous.ko .banque { display: none; }
.retour .ordok { margin: 4px 0 0; }

/* ---------- Figures sur quadrillage (symétrie centrale) ---------- */
.figure-q .qg, .choix-texte .qg { stroke: var(--trait); stroke-width: 1; }
.figure-q .fg, .choix-texte .fg { stroke-width: 2.4; stroke-linejoin: round; fill-opacity: 0.18; }
.fg.donnee { stroke: var(--bleu); fill: var(--bleu); }
.fg.image { stroke: var(--orange); fill: var(--orange); }
.fg.bon { stroke: var(--juste); fill: var(--juste); stroke-dasharray: 7 4; }
.figure-q .sg { stroke: var(--discret); stroke-width: 1.6; }
.figure-q .sg.trace { stroke: var(--juste); stroke-dasharray: 5 4; }
.figure-q .sg.diag { stroke-dasharray: 6 5; }
.figure-q .pt { fill: none; stroke: var(--encre); stroke-width: 2.2; stroke-linecap: round; }
.figure-q .pt.cand { stroke: var(--accent); }
.figure-q .pt.bon { stroke: var(--juste); }
.figure-q .croix-eleve { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.figure-q .pn { font: italic 600 21px 'Times New Roman', serif; fill: var(--encre); paint-order: stroke; stroke: var(--fond); stroke-width: 5px; stroke-linejoin: round; }
.figure-q .pn.cand { fill: var(--accent); }
.figure-q .pn.bon { fill: var(--juste); }
.figure-q .cx, .choix-texte .cx { stroke: var(--centre); stroke-width: 2.6; stroke-linecap: round; }
.figure-q .pn.centre { fill: var(--centre); }
.figure-q .pn.cite { fill: var(--cite); }
.figure-q .pt.cite { stroke: var(--cite); stroke-width: 2.8; }
.figure-q .sg.cite { stroke: var(--cite); stroke-width: 4.5; stroke-linecap: round; stroke-dasharray: none; }
.figure-q .ang.cite { stroke: var(--cite); stroke-width: 3; fill: var(--cite); fill-opacity: 0.25; }
.figure-q .mes { font: 600 15px system-ui, sans-serif; fill: var(--encre); paint-order: stroke; stroke: var(--fond); stroke-width: 4px; stroke-linejoin: round; }
.figure-q .mes.cite { fill: var(--cite); }
.figure-q .ang.donne { stroke: var(--discret); stroke-width: 1.8; fill: var(--discret); fill-opacity: 0.15; }
.choix-texte .pt { fill: none; stroke: var(--encre); stroke-width: 2.2; stroke-linecap: round; }
.choix-texte .pt.donnee { stroke: var(--bleu); }
.choix-texte .pt.image { stroke: var(--orange); }
.nom-pt { font-family: 'Times New Roman', serif; font-style: italic; font-size: 1.15em; }
.figure-q .faux-pt { stroke: var(--faux); stroke-width: 3; stroke-linecap: round; }
.choix-partie.disp-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choix-partie.disp-figures .choix { align-items: flex-start; padding: 6px; }
.choix-partie.disp-figures .choix-texte { flex: 1; min-width: 0; }
.choix-partie.disp-figures svg { display: block; width: 100%; height: auto; background: var(--carte); border-radius: 8px; }
.partie-points[data-libre] .points-choisis { color: var(--discret); font-size: 0.95rem; }

/* Outils de construction (droite, cercle) : tracés en pointillé, non notés */
.outils-construction { display: flex; flex-wrap: wrap; gap: 6px; }
.outil { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 2px solid var(--encre); border-radius: 8px; background: var(--fond); color: var(--encre); box-shadow: 2px 2px 0 var(--ombre-dure); cursor: pointer; }
.outil:hover { background: var(--doux); }
.outil[aria-pressed="true"] { background: var(--encre); color: var(--fond); }
.outil:disabled { opacity: 0.4; cursor: default; }
.figure-q .trace-droite, .figure-q .trace-cercle { fill: none; stroke: var(--vert-bleu); stroke-width: 1.8; stroke-dasharray: 6 5; pointer-events: none; }
.figure-q .trace-segment, .figure-q .trace-polygone { fill: none; stroke: var(--vert-bleu); stroke-width: 2; stroke-linejoin: round; pointer-events: none; }
.figure-q .trace-debut { fill: var(--vert-bleu); fill-opacity: 0.35; stroke: var(--vert-bleu); stroke-width: 2; pointer-events: none; }
.figure-q.outil-trace .hit { cursor: crosshair; }
.figure-q .hit:focus:not(:focus-visible) { outline: none; }
.bloc-outils { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--trait); }

/* Outils de réflexion (tous les exercices) : barrer et brouillon pour l'intrus (+ noter pour les équations) ; brouillon seul pour le QCM et l'association. */
.outils { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; width: min(900px, 100%); }
.outil-r[hidden], .outils[hidden], .brouillon[hidden], .outils-aide[hidden] { display: none; }
/* Outils de réflexion (Barrer, Brouillon) : boutons secondaires */
.outil-r { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border: 2px solid var(--encre); border-radius: 8px; background: var(--fond); color: var(--encre); font: inherit; font-size: 0.9rem; font-weight: 700; box-shadow: 2px 2px 0 var(--ombre-dure); cursor: pointer; }
.outil-r:hover { background: var(--doux); }
.outil-r[aria-pressed="true"] { background: var(--encre); color: var(--fond); }
.outil-r:disabled { opacity: 0.45; cursor: default; }
.outil-r svg { width: 1.15em; height: 1.15em; flex: none; }
.outils-aide { margin: 0; color: var(--discret); font-size: 0.85rem; text-align: center; }

/* Barrer : la carte reste lisible, un trait la traverse. */
.choix.barre { position: relative; opacity: 0.5; }
.choix.barre::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; border-top: 3px solid var(--faux); transform: rotate(-4deg); pointer-events: none; }
.puce.barre { position: relative; opacity: 0.5; }
.puce.barre::after { content: ""; position: absolute; left: 8%; right: 8%; top: 50%; border-top: 2.5px solid var(--faux); transform: rotate(-8deg); pointer-events: none; }
.saisie.mode-barrer .choix, .saisie.mode-barrer .puce { cursor: crosshair; }

/* Noter : une petite case sous chaque équation de l'intrus. */
.annot { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.annot > .choix { flex: 1; }
.note { display: none; width: 100%; box-sizing: border-box; min-height: 1.9em; padding: 3px 8px; border: 1.5px dashed var(--trait); border-radius: 8px; background: var(--carte); color: var(--encre); font-family: "KaTeX_Main", "Times New Roman", serif; font-size: 1.1rem; line-height: 1.45; text-align: center; white-space: pre; overflow: hidden; cursor: text; }
.note:empty::before { content: attr(data-placeholder); color: var(--discret); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 0.95rem; }
.note-var { font-family: "Inconnue", "Times New Roman", Times, "Liberation Serif", serif; font-style: italic; font-size: 1.12em; }
.note:focus { outline: none; border-color: var(--accent); border-style: solid; }
.saisie.notes-visibles .note { display: block; }
.question.revue .note { pointer-events: none; border-style: solid; }
.question.revue .note:empty { display: none; }

/* Brouillon dessinable, sous les propositions : l'énoncé reste visible au-dessus. */
.brouillon { width: min(900px, 100%); display: flex; flex-direction: column; gap: 6px; }
.brouillon-barre { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.brouillon-feuille { position: relative; height: clamp(180px, 38vh, 340px); border: 2px solid var(--trait); border-radius: 12px; overflow: hidden;
  background-color: var(--carte);
  background-image: linear-gradient(var(--doux) 1px, transparent 1px), linear-gradient(90deg, var(--doux) 1px, transparent 1px);
  background-size: 22px 22px; }
.brouillon-feuille canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.question.revue .outils, .question.revue .outils-aide, .question.revue .brouillon, .question.revue .aide-tableau { display: none; }
@media (max-height: 500px) {
  .outil-r { padding: 2px 10px; font-size: 0.8rem; }
  .outils-aide { display: none; }
  .brouillon-feuille { height: 60vh; }
}

/* Fenêtre de réglages : bouton « Tester » (icône + mot), à côté d'« Ajouter ». */
.icone-forme { display: inline-flex; vertical-align: -0.2em; }
.icone-forme svg { width: 1.15em; height: 1.15em; }
.boutons-forme .icone-forme { padding: 0; border: none; background: none; }

/* Message bref (« Réponse enregistrée. ») en bas de l'écran. */
.annonce { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; margin: 0; padding: 10px 18px; border-radius: 12px; background: var(--encre); color: var(--carte); font-weight: 600; z-index: 20; box-shadow: 4px 4px 0 var(--ombre-dure); }
.bilan-revoir { display: block; margin-top: 8px; font-size: 0.9rem; color: var(--discret); font-weight: 400; }
.bilan-score.bilan-attente { font-size: 1.1rem; font-weight: 600; }
/* Travail en retard (« zone ») : cadre rouge autour de l'écran et temps écoulé depuis la date de fin. */
.ecran.en-retard { outline: 5px solid var(--faux); outline-offset: -5px; }
.retard { margin: 10px 0; padding: 8px 10px; border-radius: 12px; background: var(--faux-fond); border: 2px solid var(--faux); color: var(--faux); font-weight: 600; font-size: 0.9rem; }
.retard .retard-temps { font-variant-numeric: tabular-nums; }
.retard small { display: block; font-weight: 500; color: var(--encre); margin-top: 2px; }
.travaux small.travail-retard { color: var(--faux); font-weight: 700; white-space: nowrap; }
.exo-eleve.exo-bilan { border-style: dashed; }
/* Bilan verrouillé : petit cadenas dans le coin (au trait d'encre) */
.exo-eleve.verrouille::before { content: ""; top: -9px; right: -9px; width: 18px; height: 18px; border: none; border-radius: 0; background: var(--encre);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath d='M2 4V2h1V1h3v1h1v2h1v5H1V4zm1 0h3V2H3z' fill-rule='evenodd'/%3E%3C/svg%3E") center / 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9'%3E%3Cpath d='M2 4V2h1V1h3v1h1v2h1v5H1V4zm1 0h3V2H3z' fill-rule='evenodd'/%3E%3C/svg%3E") center / 100% no-repeat; }
/* Aperçu de la page « Tester l'exercice » : la question seule, sans la colonne de gauche (titre, numéros des questions). */
html.integre .cote { display: none; }
html.integre .ecran { grid-template-columns: minmax(0, 1fr); }
/* Aperçu : question en cours de remplacement (réglages modifiés). */
.question.chargement { opacity: 0.35; pointer-events: none; transition: opacity 0.15s; }

/* Bouton à bascule (oui / non) : la case est cachée, un interrupteur montre l'état. */
.p-bascule { position: relative; display: inline-flex !important; align-items: center; gap: 8px; cursor: pointer; }
.p-bascule > input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }
.p-interrupteur { flex: none; position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--trait); transition: background .15s; }
.p-interrupteur::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--carte); border: 1.5px solid var(--encre); transition: transform .15s; }
.p-bascule > input:checked + .p-interrupteur { background: var(--accent); }
.p-bascule > input:checked + .p-interrupteur::after { transform: translateX(16px); }
.p-bascule > input:focus-visible + .p-interrupteur { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.p-bascule:has(> input:disabled) { opacity: .5; cursor: not-allowed; }

/* ---------- Espace de l'élève : barre du haut et page « Mes travaux » ---------- */
body.eleve { display: flex; flex-direction: column; height: 100dvh; }
body.eleve .ecran { height: auto; flex: 1; min-height: 0; }
body.eleve .tache .bouton-theme { display: none; } /* le bouton est dans la barre du haut */
/* Barre du haut : logo à gauche, trait d'encre en bas */
.barre-eleve { flex: none; display: flex; align-items: center; gap: 10px; min-height: 62px; padding: 8px 18px; background: var(--fond); border-bottom: 3px solid var(--encre); font-size: 0.95rem; }
.be-titre { margin-right: auto; }
.be-moi { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.be-prenom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.be-classe { font-size: 0.75rem; font-weight: 700; color: var(--encre); border: 2px solid var(--encre); border-radius: 5px; padding: 0 8px; white-space: nowrap; }
.be-maison, .be-sortie { flex: none; width: 36px; height: 36px; display: inline-grid; place-items: center; border: var(--trait-fort) solid var(--encre); border-radius: 8px; background: none; color: var(--encre); padding: 0; }
.be-maison:hover, .be-sortie:hover { background: var(--doux); }
.be-maison svg, .be-sortie svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Niveau de l'élève (XP, lot 10) : couleurs en variables pour que le futur thème les remplace. */
:root { --xp-encre: var(--jaune); --xp-fond: var(--fiche); }
.be-xp { font-family: var(--police-pixel); font-size: 0.85rem; color: var(--xp-encre); background: var(--xp-fond); border: 2px solid var(--encre); border-radius: 5px; padding: 0 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.accueil-eleve { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 16px 40px; }
.ae-contenu { max-width: 780px; margin: 0 auto; display: grid; gap: 14px; }
.ae-bonjour { margin: 0; font-size: 1.45rem; line-height: 1.3; text-wrap: balance; }
.ae-consigne { margin: -6px 0 4px; color: var(--discret); }
.ae-section { display: grid; gap: 10px; }
.ae-titre { margin: 6px 0 0; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--discret); }
summary.ae-titre { cursor: pointer; width: max-content; }
.ae-note { margin: 0; font-size: 0.85rem; color: var(--discret); }
.ae-libre { border: 1px dashed var(--discret); border-radius: 12px; padding: 14px; }
.ae-bilan-lien { text-decoration: none; text-align: center; padding: 8px 18px; }
.bm-exo { margin: 0 0 6px; font-size: 1rem; }
.bm-notion { --c: var(--discret); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 10px 14px; }
.bm-notion[data-couleur=vert] { --c: var(--juste); }
.bm-notion[data-couleur=orange] { --c: var(--evaluation); }
.bm-notion[data-couleur=rouge] { --c: var(--faux); }
.bm-pastille { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.bm-peu { opacity: 0.7; }
.bm-peu .bm-pastille { background: none; border: 2px dashed var(--discret); box-sizing: border-box; }
.bm-nom { font-weight: 700; min-width: 0; }
.bm-etat { font-size: 0.85rem; color: var(--c); font-weight: 700; }
.bm-notion .btn { grid-column: 2 / -1; justify-self: start; text-decoration: none; padding: 6px 14px; }
.ae-libre-lien { justify-self: start; text-decoration: none; padding: 8px 18px; }
details.ae-section[open] > summary { margin-bottom: 0; }
.ae-deux { max-width: 1040px; grid-template-columns: 230px minmax(0, 1fr); align-items: start; gap: 14px 24px; }
.ae-entete { grid-column: 1 / -1; display: grid; gap: 8px; }
.ae-profil { display: grid; gap: 14px; align-content: start; position: sticky; top: 0; }
.ae-colonne { display: grid; gap: 14px; min-width: 0; }
.ae-moi { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; align-items: center; background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 12px 14px; }
.ae-initiale { grid-row: 1 / span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--sur-couleur); font-weight: 700; font-size: 1.2rem; }
.ae-moi-nom { font-weight: 700; }
.ae-moi-classe { font-size: 0.85rem; color: var(--discret); }
.ae-moi-classe:empty { display: none; }
.ae-pause { display: inline-flex; align-items: center; gap: 4px; font-size: 0.72rem; font-weight: 700; color: var(--discret); border: 1.5px solid currentColor; border-radius: 999px; padding: 0 8px; }
.ae-carte.en-pause { opacity: 0.8; border-left-style: dashed; }
.ae-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ae-carte { --t: var(--entrainement); --st: var(--sur-entrainement); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 16px; align-items: center; background: var(--carte); border: 1px solid var(--trait); border-left: 5px solid var(--t); border-radius: 12px; padding: 12px 16px; }
.ae-carte[data-type=evaluation] { --t: var(--evaluation); --st: var(--sur-evaluation); }
.ae-carte[data-type=remediation] { --t: var(--remediation); --st: var(--sur-remediation); }
.ae-haut, .ae-infos, .ae-barre { grid-column: 1; min-width: 0; }
.ae-haut { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ae-pastille { font-size: 0.72rem; font-weight: 700; background: var(--t); color: var(--st, var(--sur-couleur)); border-radius: 999px; padding: 2px 10px; }
.ae-nom { font-weight: 700; font-size: 1.05rem; }
.ae-nouveau { font-size: 0.72rem; font-weight: 700; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 999px; padding: 0 8px; }
.ae-infos { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 0.85rem; color: var(--discret); }
.ae-retard { color: var(--faux); font-weight: 700; }
.ae-barre { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--discret); font-variant-numeric: tabular-nums; }
.ae-jauge { flex: 1; max-width: 320px; height: 8px; border-radius: 999px; background: var(--doux); overflow: hidden; }
.ae-jauge b { display: block; height: 100%; background: var(--t); border-radius: 999px; }
.ae-action { grid-column: 2; grid-row: 1 / span 3; text-decoration: none; text-align: center; padding: 8px 18px; }
.ae-action.principal { border-color: var(--encre); background: var(--t); color: var(--st, var(--sur-couleur)); }
.ae-action:not(.principal) { border-color: var(--trait); color: var(--encre); }

/* Fin d'activité : encouragement, activité suivante, retour aux travaux. */
.bilan-encouragement { margin: 0; font-size: 1.05rem; color: var(--discret); text-align: center; }
.bilan-liens { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.bilan-liens .btn { text-decoration: none; }

@media (max-width: 600px) {
  .barre-eleve { gap: 6px; min-height: 52px; padding: 6px 10px; }
  .barre-eleve .logo-marque { --logo-hauteur: 24px; }
  .be-moi .be-classe { display: none; }
  .be-moi { margin-right: auto; font-size: 0.9rem; }
  .accueil-eleve { padding: 16px 12px 32px; }
  .ae-bonjour { font-size: 1.2rem; }
  .ae-deux { grid-template-columns: minmax(0, 1fr); }
  .ae-profil { position: static; order: 2; }
  .ae-colonne { order: 1; }
  .ae-carte { grid-template-columns: minmax(0, 1fr); padding: 10px 12px; }
  .ae-action { grid-column: 1; grid-row: auto; justify-self: start; }
}
@media (max-height: 500px) {
  .barre-eleve { min-height: 44px; padding: 3px 10px; }
  .barre-eleve .logo-marque { --logo-hauteur: 22px; }
  .be-maison, .be-sortie, .barre-eleve .bouton-theme { width: 32px; height: 32px; }
}

/* ---------- S'entraîner sans connexion (/?libre) ---------- */
/* Pendant le chargement : rien de la page d'exercice par défaut (choix : écran vide ; série : titre et réglages cachés). */
html.libre-choix .ecran { display: none; }
html.libre-serie .tache, html.libre-serie .btn-reglages, html.libre-serie .resume, html.libre-serie .zone { visibility: hidden; }
.be-connexion { flex: none; color: var(--encre); font-weight: 700; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; padding: 6px 8px; border-radius: var(--rayon-petit); }
.be-connexion:hover { background: var(--doux); }
body.sans-compte .be-titre { margin-right: auto; }
.libre { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 16px 40px; }
.libre [data-domaine] { --domaine: var(--trait); }
.libre [data-domaine="nombres-calculs"] { --domaine: var(--theme-nombres); }
.libre [data-domaine="espace-geometrie"] { --domaine: var(--theme-geometrie); }
.libre [data-domaine="donnees-probabilites"] { --domaine: var(--theme-donnees); }
.libre [data-domaine="proportionnalite-fonctions"] { --domaine: var(--theme-fonctions); }
.libre [data-domaine="pensee-informatique"] { --domaine: var(--theme-informatique); }
.li-pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.li-pastille { position: relative; }
.li-pastille input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.li-pastille > span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border: 1.5px solid var(--trait); border-radius: 999px; background: var(--carte); font-weight: 700; font-size: 0.9rem; }
.li-pastille:hover > span { border-color: var(--accent); }
.li-pastille input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-encre); }
.li-pastille input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }
.li-niveaux-choix .li-pastille > span { padding: 5px 16px; font-size: 1rem; }
.li-etoiles .li-pastille > span { color: var(--evaluation); letter-spacing: -1px; }
.li-ligne .li-etoiles { gap: 4px; }
@media (max-width: 600px) { .li-etoiles .li-pastille > span { padding: 3px 7px; } } /* « Options » tient sur la même ligne que les étoiles */
.li-etoiles .li-pastille input:checked + span { background: color-mix(in srgb, var(--evaluation) 16%, var(--carte)); border-color: var(--evaluation); color: var(--evaluation); }
.li-formes .li-pastille > span { font-weight: 600; font-size: 0.82rem; padding: 3px 10px 3px 7px; }
.li-formes .li-pastille > span small { font-size: inherit; font-weight: inherit; }
/* Forme non cochée : icône seule, grisée, en pointillés (comme dans les réglages du professeur). */
.li-formes .li-pastille input:not(:checked) + span { border-style: dashed; border-color: var(--pointille); background: none; opacity: 0.7; padding: 3px 7px; filter: grayscale(1); }
.li-formes .li-pastille input:not(:checked) + span small { display: none; }
.li-formes .li-pastille:hover input:not(:checked) + span { opacity: 1; border-color: var(--accent); }
.li-icone { display: inline-flex; min-width: 0; }
.li-formes .icone-forme { display: inline-flex; }
.li-formes .icone-forme svg { width: 16px; height: 16px; }
.li-exercices { display: grid; gap: 18px; }
.li-domaine { display: grid; gap: 10px; }
.li-titre-domaine { margin: 4px 0 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.li-titre-domaine::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--domaine); }
.li-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px; }
.li-carte { display: grid; grid-template-rows: auto auto auto 1fr auto; gap: 8px; background: var(--carte); border: 1px solid var(--trait); border-left: 6px solid var(--domaine); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.li-nom { margin: 0; font-size: 1.05rem; }
.li-notion { margin: 2px 0 0; font-size: 0.85rem; color: var(--discret); }
.li-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.li-etiquette { font-size: 0.85rem; font-weight: 700; color: var(--discret); min-width: 5.5em; }
.li-tete { position: relative; padding-right: 38px; }
.li-tete .mini-monstre { position: absolute; top: -2px; right: -4px; }
.li-contenu { margin: -2px 0 0; font-size: 0.8rem; color: var(--discret); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-contenu[hidden] { display: none; }
.li-meilleur { font-size: 0.82rem; color: var(--juste); font-weight: 600; }
.li-options { font-size: 0.9rem; display: grid; gap: 8px; align-content: start; }
.li-options summary { display: none; }
.li-bouton-options { margin-left: auto; padding: 0; border: 0; background: none; font: inherit; font-size: 0.9rem; cursor: pointer; color: var(--accent); font-weight: 700; }
.li-bouton-options::after { content: " ▾"; }
.li-bouton-options[aria-expanded="true"]::after { content: " ▴"; }
.li-options[open] { gap: 8px; }
.li-chrono, .li-adaptatif { font-size: 0.9rem; font-weight: 600; }
.li-bascules { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.li-aide-adaptatif { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--discret); }
.btn.li-commencer { justify-self: start; text-decoration: none; background: var(--entrainement); color: var(--sur-entrainement); padding: 8px 20px; }
.li-erreur { color: var(--faux); }
.libre-infos { margin: 4px 0 0; font-weight: 700; color: var(--discret); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.libre-copier { margin-left: 0; font-weight: 400; font-size: 0.85rem; }
.eleve-moi:empty { display: none; }
.bilan-libre { display: grid; gap: 10px; justify-items: center; }
.bilan-invite { margin: 0; padding-top: 10px; border-top: 1px solid var(--trait); font-size: 0.9rem; color: var(--discret); text-align: center; }
.bilan-invite a { color: var(--accent); font-weight: 700; }
@media (max-width: 600px) {
  .libre { padding: 16px 12px 32px; }
  .be-connexion { font-size: 0.82rem; padding: 4px 6px; }
}

/* Sans connexion : le choix du niveau occupe la place à droite du titre */
.li-entete { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: start; }
.li-choix-niveau { display: grid; gap: 6px; justify-items: end; padding-top: 4px; }
.li-choix-niveau .ae-titre { margin: 0; }
.li-choix-niveau .li-niveaux { justify-content: flex-end; }
@media (max-width: 800px) { .li-entete { grid-template-columns: minmax(0, 1fr); } .li-choix-niveau { justify-items: start; } .li-choix-niveau .li-niveaux { justify-content: flex-start; } }

/* Page de départ de l'activité */
.btn-consigne { text-align: left; border: 2px solid var(--encre); background: var(--encre); color: var(--fond); border-radius: var(--rayon-petit); padding: 6px 10px; font-size: 0.85rem; font-weight: 700; }
.btn-consigne[hidden] { display: none; }
dialog.depart { max-width: min(560px, 92vw); border: 1px solid var(--trait); border-radius: 16px; background: var(--carte); color: var(--encre); padding: 20px 24px; }
dialog.depart::backdrop { background: rgb(0 0 0 / 0.5); }
.depart-titre { margin: 0 0 10px; font-size: 1.25rem; }
.depart-message { white-space: pre-wrap; margin: 0 0 12px; line-height: 1.5; }
.depart-image { display: block; max-width: 100%; border-radius: 10px; margin: 0 0 12px; }
.depart-liens { margin: 0 0 12px; padding-left: 1.2em; }
.depart-liens a { color: var(--accent); font-weight: 600; word-break: break-word; }
.depart-humeur p { margin: 0 0 6px; font-weight: 600; }
.depart-visages { display: flex; gap: 8px; margin-bottom: 14px; }
.depart-visage { font-size: 1.8rem; line-height: 1; padding: 6px 10px; border-radius: 12px; border: 2px solid var(--trait); background: var(--fond); }
.depart-visage[aria-pressed="true"] { border-color: var(--accent); background: var(--doux); }
.depart .actions { display: flex; justify-content: flex-end; }

/* Vue élève du professeur */
.ae-vue-note { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--doux); color: var(--discret); font-size: 0.9rem; }
.be-retour-prof { margin-left: auto; }
.r-sc-horloge { display: inline-flex; font-style: normal; }

/* ---------- Écran de chargement (index.html, retiré par eleve.js) ---------- */
/* Fond : la page qui se construit derrière, légèrement floutée ; fond uni si le navigateur ne sait pas flouter, si l'appareil est lent
   (classe « sans-flou » posée par index.html) ou si l'élève réduit les animations. */
/* Invisible pendant le premier quart de seconde : une page prête tout de suite ne montre rien (pas de flash). */
.chargement { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center; gap: 22px; background: var(--fond); animation: chg-apparition 0.2s linear 0.3s both; }
.chg-mot { margin: 0; display: flex; align-items: center; gap: 0.5ch; color: var(--encre); font-family: var(--police-pixel); font-size: clamp(1.3rem, 5vw, 2rem); letter-spacing: 0.22em; text-transform: uppercase; }
.chg-curseur { width: 0.55em; height: 0.8em; background: var(--encre); animation: chg-clignote 0.9s steps(1) infinite; }
/* Barre en cases carrées, aux cinq couleurs de la bande ; elle suit l'avancement réel (--avance, de 0 à 1, posé par eleve.js) et est pleine quand le jeu commence */
.chg-barre { position: relative; width: min(340px, 78vw); padding: 5px; background: var(--fiche); border: var(--trait-fort) solid var(--encre); border-radius: var(--rayon-petit); box-shadow: var(--decalage) var(--decalage) 0 var(--ombre-dure); overflow: hidden; }
.chg-cases { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.chg-cases i { height: 18px; background: var(--rouge); }
.chg-cases i:nth-child(5n + 2) { background: var(--orange); }
.chg-cases i:nth-child(5n + 3) { background: var(--jaune); }
.chg-cases i:nth-child(5n + 4) { background: var(--vert-bleu); }
.chg-cases i:nth-child(5n) { background: var(--bleu); }
.chg-voile { position: absolute; inset: 0; background: var(--fiche); transform-origin: right; transform: scaleX(calc(1 - var(--avance, 0.1))); transition: transform 0.18s steps(4, end); }
/* Dernière étape : la barre finit de se remplir en 0,25 s, visiblement, avant que l'écran disparaisse */
.chargement.plein .chg-voile { transition: transform 0.25s linear; }
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .chargement:not(.sans-flou) { background: color-mix(in srgb, var(--fond) 55%, transparent); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
}
.chargement.sortie { opacity: 0; transition: opacity 0.2s linear; pointer-events: none; }
@keyframes chg-apparition { from { opacity: 0; } to { opacity: 1; } }
@keyframes chg-clignote { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chargement { animation: none; }
  .chargement.sortie { transition: none; }
  .chg-curseur { animation: none; }
  .chg-voile, .chargement.plein .chg-voile { transition: none; }
}
