/* TD3 interactif — feuille commune étudiant / enseignant.
   Mise en page : barre d'en-tête, navigation des questions à gauche, espace de travail à droite.
   Police très lisible (le TD passe en partage d'écran, souvent compressé). */
:root {
  --fond: #eef1f5;
  --papier: #ffffff;
  --encre: #17202d;
  --encre-2: #4b5567;
  --trait: #d3d9e2;
  --accent: #1d5aa8;
  --accent-doux: #e2ebf8;
  --jeton: #d9930f;
  --jeton-doux: #fbefd6;
  --parent: #7449b0;
  --enfant: #17836a;
  --visite: #7c8798;
  --ok: #1b7f45;
  --ok-doux: #e1f3e8;
  --ko: #b9420c;
  --ko-doux: #fbe9df;
  --aide: #a8520a;
  --ombre: 0 1px 2px rgba(23, 32, 45, .06), 0 4px 16px rgba(23, 32, 45, .06);
  --police: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "DejaVu Sans Mono", Consolas, monospace;
  --rayon: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #11161e; --papier: #19202b; --encre: #e7ecf3; --encre-2: #a7b1c0; --trait: #2f3a49;
    --accent: #79a8ea; --accent-doux: #1f3150; --jeton: #f0b443; --jeton-doux: #3b2f15;
    --parent: #b393e6; --enfant: #4fc6a4; --visite: #8a96a8; --ok: #5cc98a; --ok-doux: #173526;
    --ko: #f08a5d; --ko-doux: #3d2117; --aide: #f0a050;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #11161e; --papier: #19202b; --encre: #e7ecf3; --encre-2: #a7b1c0; --trait: #2f3a49;
  --accent: #79a8ea; --accent-doux: #1f3150; --jeton: #f0b443; --jeton-doux: #3b2f15;
  --parent: #b393e6; --enfant: #4fc6a4; --visite: #8a96a8; --ok: #5cc98a; --ok-doux: #173526;
  --ko: #f08a5d; --ko-doux: #3d2117; --aide: #f0a050;
  --ombre: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond); color: var(--encre); font-family: var(--police);
  font-size: 17px; line-height: 1.5;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
pre.algo {
  background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 12px 14px; overflow-x: auto; margin: 8px 0; line-height: 1.45; white-space: pre;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.bouton {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--trait);
  background: var(--papier); padding: 7px 14px; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: .95rem;
}
.bouton:hover { border-color: var(--accent); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: var(--papier); }
.bouton.principal:hover { filter: brightness(1.08); }
.bouton.discret { border-color: transparent; background: transparent; }
.bouton.aide-active { background: var(--ko-doux); border-color: var(--aide); color: var(--aide); }
.bouton:disabled { opacity: .5; cursor: not-allowed; }
.bouton.petit { padding: 3px 10px; font-size: .85rem; }

.entete {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 20px; background: var(--papier); border-bottom: 1px solid var(--trait);
}
.entete .marque { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.entete .marque small { color: var(--encre-2); font-size: .85rem; }
.entete .droite { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.pastille-co { width: 10px; height: 10px; border-radius: 50%; background: var(--visite); display: inline-block; }
.pastille-co.ok { background: var(--ok); }

.bandeau {
  margin: 12px 20px 0; padding: 10px 14px; border-radius: var(--rayon);
  background: var(--jeton-doux); border: 1px solid var(--jeton); font-weight: 700;
}

.carte {
  background: var(--papier); border: 1px solid var(--trait); border-radius: 12px;
  box-shadow: var(--ombre);
}
.etiquette {
  display: inline-block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  font-weight: 700; color: var(--encre-2);
}
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px; background: var(--fond); color: var(--encre-2);
  border: 1px solid var(--trait); white-space: nowrap;
}
.badge.ok { background: var(--ok-doux); color: var(--ok); border-color: transparent; }
.badge.ko { background: var(--ko-doux); color: var(--ko); border-color: transparent; }
.badge.accent { background: var(--accent-doux); color: var(--accent); border-color: transparent; }
.badge.jeton { background: var(--jeton-doux); color: var(--aide); border-color: transparent; }

.retour {
  border-radius: var(--rayon); padding: 10px 14px; font-weight: 700; display: flex; gap: 10px;
  align-items: flex-start;
}
.retour.ok { background: var(--ok-doux); color: var(--ok); }
.retour.ko { background: var(--ko-doux); color: var(--ko); }
.retour .texte { font-weight: 400; color: var(--encre); }

table.grille { border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.grille th, table.grille td {
  border: 1px solid var(--trait); padding: 4px 9px; text-align: center; min-width: 2.4em;
}
table.grille th { background: var(--fond); font-weight: 700; }
.defile-x { overflow-x: auto; max-width: 100%; }

input[type="text"], input[type="number"], select, textarea {
  border: 1px solid var(--trait); background: var(--papier); border-radius: 6px; padding: 6px 9px;
}
input.faux, select.faux { border-color: var(--ko); background: var(--ko-doux); }
textarea { width: 100%; min-height: 9em; font-family: var(--mono); font-size: .9rem; }

@media (prefers-reduced-motion: no-preference) {
  .apparait { animation: apparait .25s ease-out; }
  @keyframes apparait { from { transform: translateY(4px); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* Corrections : aérer les paragraphes, listes et tableaux explicatifs */
.correction > div > *, .apercu-corr > * { margin: 0 0 10px; }
.correction > div > *:last-child, .apercu-corr > *:last-child { margin-bottom: 0; }
.correction ul, .correction ol, .apercu-corr ul, .apercu-corr ol { padding-left: 1.3em; display: grid; gap: 4px; }
.correction table.grille td, .apercu-corr table.grille td { text-align: left; vertical-align: top; font-size: .92rem; }
.correction table.grille, .apercu-corr table.grille { background: var(--papier); }
