/* =============================================================================
   Suivi des compétences — feuille de style unique (design system PROJET.md §10.3)
   Thèmes : <html data-theme="carnet"> (défaut) / "nocturne" ; <html data-role="teacher"> pour le prof.
   Pas de coins arrondis (sauf pastilles/avatars), bordures 1,5 px, ombres papier 4 px sans flou.
   ========================================================================== */

:root {
  --font-hand: 'Caveat', cursive;
  --font-text: 'Lora', Georgia, serif;

  --paper: #f3ead8;
  --paper-lines: rgba(120, 90, 40, 0.06);
  --card: #fff8e8;
  --card-focus: #fffdf5;
  --ink: #3b2a16;
  --ink-2: #5a4a2f;
  --brown: #7c4a1e;
  --brown-hover: #5a3413;
  --tan: #b89b6d;
  --muted: #8a6d45;
  --folded: #e6d7b8;
  --dim: #efe4cc;
  --shadow: #d9c7a2;
  --red: #b3402f;
  --red-bg: #f4dcd6;
  --teal: #5b8c85;
  --teal-dark: #2f5a53;
  --teal-bg: #dfe9e4;
  --orange: #c9713f;
  --orange-dark: #8a4b1f;
  --on-brown: #fff8e8;
  --parch: #fffdf8; --parch-2: #f7f0e0; --parch-edge: #c4ad80; --parch-roll: #e3d2ad; --parch-ink: #6b4a22;
  --on-accent: #fff8e8;
  --m-hl: rgba(240, 190, 50, 0.42);   /* surligneur : là où l'élève écrit (exposant, numérateur…) (Q-189) */
  --rose: #b4436c; --rose-bg: #f9e3ea; --rose-edge: #e4a7bb;   /* chapitre masqué aux élèves (Q-323) */
}

[data-theme="nocturne"] {
  --paper: #14122e;
  --paper-lines: rgba(255, 255, 255, 0.05);
  --card: #1f1c48;
  --card-focus: #26235c;
  --ink: #e9e6ff;
  --ink-2: #c4c0ea;
  --brown: #5eead4;
  --brown-hover: #99f6e4;
  --tan: #4a4590;
  --muted: #8f8ac2;
  --folded: #26235c;
  --dim: #1a1840;
  --shadow: #0c0b1f;
  --red: #fbbf24;
  --red-bg: #3a3320;
  --teal: #5eead4;
  --teal-dark: #99f6e4;
  --teal-bg: #1d3a3a;
  --orange: #f59e0b;
  --orange-dark: #fbbf24;
  --on-brown: #14122e;
  --parch: #f4efe4; --parch-2: #e2d8c2; --parch-edge: #b8a47c; --parch-roll: #d3c4a2; --parch-ink: #4a3418;
  --on-accent: #14122e;
  --m-hl: rgba(251, 191, 36, 0.28);
  --rose: #f9a8c9; --rose-bg: #3a1d36; --rose-edge: #8a3f6b;
}

[data-role="teacher"] {
  --paper: #f6efe0;
  --paper-lines: transparent;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  background-image: repeating-linear-gradient(0deg, var(--paper-lines) 0px, var(--paper-lines) 1px, transparent 1px, transparent 28px);
  display: flex;
  flex-direction: column;
}
a { color: var(--brown); }
a:hover { color: var(--brown-hover); }
h1, h2, h3 { margin: 0; font-family: var(--font-hand); font-weight: 700; line-height: 1.1; }
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 24px; }
p { margin: 0 0 12px; }
svg { flex-shrink: 0; }
button { font: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- barre du haut (élève) */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 32px;
  border-bottom: 2px solid var(--tan);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand__title { font-family: var(--font-hand); font-weight: 700; font-size: 28px; white-space: nowrap; }
.brand svg { stroke: var(--brown); }
.tabs { display: flex; gap: 4px; margin-left: 24px; }
.tabs a {
  padding: 8px 18px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { border-bottom-color: var(--brown); color: var(--ink); font-weight: 600; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar__status { font-family: var(--font-hand); font-size: 22px; color: var(--brown); white-space: nowrap; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--brown);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

/* menu de l'avatar (details/summary, sans JS) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  min-width: 220px;
  background: var(--card);
  border: 1.5px solid var(--tan);
  box-shadow: 4px 4px 0 var(--shadow);
  display: flex; flex-direction: column;
}
.menu__panel a, .menu__panel button {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 14px;
  font-size: 13px; color: var(--ink); text-decoration: none;
  background: none; border: 0; border-bottom: 1px dashed var(--tan); cursor: pointer; text-align: left; width: 100%;
}
.menu__panel > :last-child { border-bottom: 0; }
.menu__panel a:hover, .menu__panel button:hover { background: var(--dim); }
.menu__head { padding: 10px 14px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); border-bottom: 1px dashed var(--tan); }

/* ---------------------------------------------------------------- barre du haut (prof) */
.topbar--teacher {
  gap: 18px;
  padding: 12px 28px 0;
  background: var(--card);
  align-items: flex-end;
  position: sticky; top: 0; z-index: 40;   /* toujours visible, même en bas d'une longue page (Q-263) */
}
.topbar--teacher .brand { padding-bottom: 8px; gap: 8px; }
.topbar--teacher .brand__title { font-size: 24px; }
.topbar--teacher .tabs { gap: 2px; margin-left: 10px; overflow-x: auto; scrollbar-width: none; }
.topbar--teacher .tabs::-webkit-scrollbar { display: none; }
.topbar--teacher .tabs a { padding: 8px 14px; font-size: 14px; }
.topbar--teacher .topbar__right { gap: 10px; padding-bottom: 8px; }

/* ---------------------------------------------------------------- barre du bas (smartphone) */
.bottombar {
  display: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  border-top: 2px solid var(--tan);
  background: var(--folded);
  position: sticky; bottom: 0; z-index: 10;
}
.bottombar a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 44px; padding: 10px 4px 12px;
  color: var(--muted); font-size: 11px; text-decoration: none;
}
.bottombar a[aria-current="page"] { background: var(--card); color: var(--ink); font-weight: 600; }
.bottombar a[aria-current="page"] svg { stroke: var(--brown); }

/* ---------------------------------------------------------------- contenu */
.page { flex: 1; padding: 24px 40px; display: flex; flex-direction: column; gap: 12px; }
.page--narrow { max-width: 760px; }
.page__head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.page__lead { font-size: 14px; font-style: italic; color: var(--muted); }
.teacher .page { padding: 20px 28px; }

/* ---------------------------------------------------------------- composants */
.card {
  background: var(--card);
  border: 1.5px solid var(--tan);
  display: flex; flex-direction: column;
}
.card--paper { box-shadow: 4px 4px 0 var(--shadow); }
.card__head {
  padding: 10px 14px;
  border-bottom: 1px dashed var(--tan);
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
}
.card__body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.card__body--lg { padding: 20px 22px; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 14px;
  font-family: var(--font-text); font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--brown); background: var(--card); color: var(--brown);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--dim); color: var(--brown); }
.btn--primary { background: var(--brown); color: var(--on-brown); }
.btn--primary:hover { background: var(--brown-hover); color: var(--on-brown); }
.btn--accent { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.btn--accent:hover { background: var(--red); color: var(--on-accent); filter: brightness(0.92); }
.btn--ghost { border-color: var(--tan); color: var(--ink-2); font-weight: 400; }
.btn--danger { border-color: var(--red); color: var(--red); }
.btn--danger:hover { background: var(--red-bg); color: var(--red); }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.btn--block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); }
.input {
  width: 100%;
  min-height: 44px; padding: 8px 12px;
  font-family: var(--font-text); font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--tan); background: var(--card-focus);
}
.input::placeholder { color: var(--tan); font-style: italic; }
.input:focus { outline: 2px solid var(--brown); outline-offset: -2px; }
.help { font-size: 12px; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.form__links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px;
  border: 1.5px solid var(--tan); background: var(--card);
  font-size: 14px;
}
.alert svg { margin-top: 2px; }
.alert--success { border-color: var(--teal); background: var(--teal-bg); color: var(--teal-dark); }
.alert--error { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.alert--info { border-color: var(--tan); background: var(--dim); color: var(--ink-2); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 12px;
  border: 1px solid var(--tan); background: var(--dim); color: var(--ink-2);
}
.badge--teal { background: var(--teal-bg); border-color: var(--teal); color: var(--teal-dark); }

.list { display: flex; flex-direction: column; }
.list__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px dashed var(--tan); }
.list__row:last-child { border-bottom: 0; }
.list__grow { flex: 1; min-width: 200px; word-break: break-all; }

.toggle {
  display: inline-block; width: 30px; height: 16px; border-radius: 8px;
  background: var(--tan); position: relative; vertical-align: middle; flex-shrink: 0;
}
.toggle::after { content: ''; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); }
.toggle--on { background: var(--teal); }
.toggle--on::after { left: auto; right: 2px; }
/* Interrupteur en attente du serveur (Q-140) : le bouton devient un petit spinner */
.is-busy > .toggle::after, .toggle.is-busy::after { background: transparent; border: 2px solid var(--card); border-top-color: transparent; box-sizing: border-box; animation: spin 0.8s linear infinite; }
.switch.is-busy { pointer-events: none; }

.empty {
  padding: 40px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--muted); font-style: italic;
}
.empty svg { stroke: var(--tan); }

.hand { font-family: var(--font-hand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* Toasts (sauvegarde asynchrone, lots suivants) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 14px; background: var(--ink); color: var(--paper); font-size: 13px; box-shadow: 4px 4px 0 var(--shadow); }

/* Illustration du magicien */
.wizard { width: 160px; max-width: 40vw; height: auto; }

/* ---------------------------------------------------------------- page de connexion */
.auth {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 16px;
}
.auth__box { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; margin: auto; } /* centré, le pied de page reste en bas */
.auth__brand { display: flex; align-items: center; gap: 10px; justify-content: center; text-decoration: none; color: var(--ink); }
.auth__brand svg { stroke: var(--brown); }
.auth__brand span { font-family: var(--font-hand); font-weight: 700; font-size: 32px; }
.auth h2 { font-size: 26px; }

/* ---------------------------------------------------------------- tableaux (tableurs prof) */
.table-wrap { border: 1.5px solid var(--tan); overflow: auto; background: var(--card); }
.table { border-collapse: collapse; width: 100%; font-size: 13px; }
.table th {
  padding: 8px 10px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 400; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted);
  background: var(--dim); border-bottom: 1.5px solid var(--tan); border-right: 1px solid var(--dim);
}
/* ordre des colonnes à copier dans un tableur : de vraies tabulations, espacées régulièrement à l'écran */
.cols-order { user-select: all; color: var(--ink); }
.cols-order__tab { display: inline-block; width: 18px; white-space: pre; overflow: hidden; vertical-align: bottom; }
/* corbeille d'un tableur toujours visible au bord droit, même quand le tableau défile (Composition des classes) */
.table .sheet__del { position: sticky; right: 0; z-index: 1; background: var(--card); box-shadow: -1px 0 0 var(--dim); }
.table th.sheet__del { background-image: linear-gradient(var(--dim), var(--dim)); }
.table td { padding: 7px 10px; border-bottom: 1px solid var(--dim); border-right: 1px solid var(--dim); vertical-align: middle; }
.table th:last-child, .table td:last-child { border-right: 0; }
.table tr:last-child td { border-bottom: 0; }
.table .c { text-align: center; }
.table tr.is-error td { background: var(--red-bg); }
.table tr.is-off td { color: var(--muted); background: var(--dim); }
.cell { width: 100%; min-width: 0; padding: 4px 6px; margin: -4px -6px; font: inherit; color: inherit; background: transparent; border: 0; }
.cell:focus { outline: 2px solid var(--brown); outline-offset: -2px; background: var(--card-focus); }
.cell--error { outline: 2px solid var(--red); outline-offset: -2px; background: var(--card-focus); }
.cell-select { font: inherit; font-size: 13px; color: var(--ink); background: var(--card); border: 1.5px solid var(--tan); padding: 3px 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--red); background: var(--dim); }

/* Bouton-interrupteur (les toggles sont de vrais boutons) */
.switch { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px; cursor: pointer; font: inherit; color: var(--ink); }
.switch:focus-visible { outline: 2px solid var(--brown); }

/* Ligne de réglage : libellé + aide à gauche, contrôle à droite */
.setting { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--dim); }
.setting:last-child { border-bottom: 0; }
.setting--stack { flex-direction: column; align-items: stretch; }
.setting--stack .setting__ctl { justify-content: flex-start; }
.setting__text { flex: 1; min-width: 0; }
.setting__label { font-size: 13px; }
.setting__help { font-size: 11px; color: var(--muted); margin-top: 2px; }
.setting__ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; font-size: 12px; }
.input--sm { min-height: 34px; padding: 4px 8px; font-size: 13px; width: auto; }
.unit { display: inline-flex; align-items: center; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--tan); font-size: 11px; background: var(--paper); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
textarea.input { min-height: 90px; resize: vertical; font-size: 13px; line-height: 1.45; }
.count { display: inline-block; padding: 2px 8px; background: var(--red); color: var(--on-accent); font-size: 12px; font-weight: 600; }

/* Liste de comp : barre des chapitres et tableur */
.chapters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chapters__label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.chip--chapter { gap: 8px; padding: 6px 10px; font-size: 12px; border-width: 1.5px; background: var(--card); cursor: pointer; font-family: var(--font-text); color: var(--ink); }
.chip--chapter.is-hidden { background: var(--dim); color: var(--muted); }
.chip--chapter.is-active { border-color: var(--brown); }
.chip--chapter b { font-weight: 600; }
.chip--chapter .muted { font-size: 11px; }
.chip--chapter .toggle { width: 26px; height: 14px; }
.chip--chapter .toggle::after { width: 10px; height: 10px; }
.chip--add { padding: 6px 10px; border: 1.5px dashed var(--tan); color: var(--muted); background: none; cursor: pointer; font-family: var(--font-text); font-size: 12px; gap: 6px; }
.chip--add:hover { color: var(--brown); border-color: var(--brown); }
.card__foot { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-top: 1.5px solid var(--tan); background: var(--dim); font-size: 12px; color: var(--muted); }
.table--comp td { padding: 5px 8px; }
.table--comp .ref { font-family: var(--font-hand); font-size: 18px; font-weight: 700; }
.table--comp tr.is-selected td { background: var(--card-focus); }
.table--comp tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--brown); }
.table--comp tr.is-dragging { opacity: 0.4; }
.table--comp tr.is-drop-before td { border-top: 2px solid var(--brown); }
.table--comp tr.is-drop-after td { border-bottom: 2px solid var(--brown); }
.table--comp textarea.cell { resize: none; overflow: hidden; line-height: 1.35; display: block; }
/* éditeur des choix d'un trou (question-modal.js) : texte et message lisibles en entier pendant qu'on les écrit */
.table--choices { table-layout: fixed; width: 100%; }
.table--choices td { vertical-align: top; }
.cell--grow { display: block; resize: none; overflow: hidden; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.table--comp .chapter-row td { background: var(--folded); font-family: var(--font-hand); font-size: 18px; font-weight: 700; padding: 6px 10px; }
.handle { cursor: grab; color: var(--tan); display: inline-flex; padding: 4px; touch-action: none; }
.handle:active { cursor: grabbing; }
.link-icons { display: inline-flex; gap: 4px; margin-right: 6px; color: var(--brown); vertical-align: middle; }
.link-icons--inherited { color: var(--muted); }
/* cellule « Lien d'aide » : bouton qui ouvre la modale des liens (Q-254) */
.link-cell { display: inline-flex; align-items: center; gap: 2px; min-height: 28px; max-width: 100%; padding: 2px 6px; border: 1px dashed transparent; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.link-cell:hover, .link-cell:focus-visible { border-color: var(--tan); color: var(--brown); }
.link-cell .link-icons { margin-right: 4px; }
.links-add { display: flex; flex-wrap: wrap; gap: 6px; }
.link-row { display: flex; align-items: center; gap: 6px; }
.link-row select { width: 96px; flex-shrink: 0; }
.link-row input { flex: 1; min-width: 0; }
/* Compétence d'origine (Q-125) : pastille « = 3SG 1.17 » sous la référence */
.src-chip { display: block; margin: 2px auto 0; padding: 1px 5px; border: 1px solid var(--tan); background: var(--paper); font-family: var(--font-text); font-size: 10px; line-height: 1.3; color: var(--brown); cursor: pointer; white-space: nowrap; }
.src-chip:hover { border-color: var(--brown); }
.src-chip--empty { border-style: dashed; color: var(--tan); opacity: 0; }
tr:hover .src-chip--empty, .src-chip--empty:focus { opacity: 1; }
.src-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; border: 1.5px solid var(--tan); padding: 4px; }
.src-list__item { display: flex; gap: 10px; align-items: baseline; padding: 5px 8px; border: 0; background: none; text-align: left; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; width: 100%; }
.src-list__item:hover { background: var(--card-focus); }
.src-list__item.is-current { background: var(--teal-bg); }
.src-list__item .ref { font-family: var(--font-hand); font-size: 16px; font-weight: 700; min-width: 40px; }
.src-list__chapter { padding: 8px 8px 2px; font-family: var(--font-hand); font-size: 15px; font-weight: 700; color: var(--muted); }
.badge--sm { padding: 1px 6px; font-size: 11px; }
.comp__dep { text-indent: 0; vertical-align: middle; margin-left: 4px; font-family: var(--font-text); font-weight: 400; color: var(--muted); border-style: dashed; }
.old-ref { font-family: var(--font-hand); font-size: 18px; color: var(--muted); text-decoration: line-through; }
.new-ref { font-family: var(--font-hand); font-size: 18px; font-weight: 700; color: var(--red); }

.chapter-row td { cursor: pointer; }
.chapter-row__chev { display: inline-block; margin-right: 8px; transition: transform 0.15s; }
.chapter-row.is-collapsed .chapter-row__chev { transform: rotate(-90deg); }
.chapter-row__edit { float: right; width: 26px; height: 26px; }
/* œil du chapitre (Q-323) : visible par les élèves ou masqué (titre et ligne rosés) */
.chapter-row__eye { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-right: 8px; vertical-align: middle; border: 1.5px solid var(--tan); border-radius: 50%; background: var(--card); color: var(--teal-dark); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.chapter-row__eye:hover { border-color: var(--brown); }
.chapter-row__eye:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
.table--comp .chapter-row.is-hidden td { background: var(--rose-bg); color: var(--rose); box-shadow: inset 4px 0 0 var(--rose); }
.chapter-row.is-hidden .chapter-row__eye { background: var(--rose); border-color: var(--rose); color: var(--rose-bg); }
.chapter-row.is-hidden .muted { color: var(--rose); opacity: 0.8; }
.chapter-row__path { display: inline-flex; align-items: center; gap: 5px; margin: 0 6px 0 4px; padding: 2px 9px; vertical-align: middle; border: 1.5px solid var(--tan); border-radius: 999px; background: var(--card); color: var(--teal-dark); font-family: var(--font-text); font-size: 12px; font-weight: 600; cursor: pointer; }
.chapter-row__path:hover { border-color: var(--brown); }
.chapter-row__path[aria-pressed="false"] { background: var(--rose); border-color: var(--rose); color: var(--rose-bg); }
.chapter-row__hidden { display: inline-block; margin-left: 10px; padding: 1px 9px; border: 1.5px solid var(--rose-edge); border-radius: 999px; font-family: var(--font-text); font-size: 12px; font-weight: 600; color: var(--rose); vertical-align: middle; }

/* Banque de questions */
.qb { display: flex; gap: 16px; flex: 1; min-height: 0; align-items: stretch; }
.qb__tree { width: 400px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.qb__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.qb__bar { display: flex; align-items: center; gap: 10px; font-size: 12px; min-height: 30px; }
.switch-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tree__item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--dim); font-size: 13px; cursor: pointer; user-select: none; }
.tree__item:hover { background: var(--dim); }
.tree__item.is-selected { background: var(--card-focus); outline: 2px solid var(--brown); outline-offset: -2px; }
.tree__item.is-root { font-weight: 600; }
.tree__item.is-collapsed .tree__chev { transform: rotate(-90deg); }
.tree__chev { color: var(--muted); display: inline-flex; transition: transform 0.15s; width: 16px; }
.tree__chev.is-leaf { visibility: hidden; }
.tree__name { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tree__comp { font-family: var(--font-hand); font-size: 15px; color: var(--brown); padding: 0 6px; border: 1px solid var(--tan); white-space: nowrap; }
.tree__comp--inherited { color: var(--muted); border-style: dashed; }
.tree__none { font-size: 11px; color: var(--tan); font-style: italic; white-space: nowrap; }
.tree__n { width: 34px; text-align: right; font-size: 12px; color: var(--muted); }
.tree__item.is-dragging { opacity: 0.4; }
.tree__item.is-drop-before { box-shadow: inset 0 2px 0 var(--brown); }
.tree__item.is-drop-after { box-shadow: inset 0 -2px 0 var(--brown); }
.tree__item.is-drop-into { background: var(--teal-bg); outline: 2px dashed var(--teal); outline-offset: -2px; }
.tree--reorder .tree__item { cursor: grab; }
.type-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.type-dot::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--tan)); flex-shrink: 0; }
.bar { display: inline-flex; align-items: center; gap: 6px; }
.bar__track { width: 50px; height: 7px; border: 1px solid var(--brown); background: var(--paper); }
.bar__fill { height: 100%; background: var(--teal); }
.bar__fill--low { background: var(--orange); }
.q-nav { display: flex; align-items: center; gap: 2px; flex-shrink: 0; margin-right: 4px; }
.q-nav__pos { font-family: var(--font-hand); font-size: 17px; color: var(--brown); min-width: 54px; text-align: center; }
.q-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.q-solution .question__verdict { display: none; }
.q-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); padding-bottom: 8px; border-bottom: 1px dashed var(--tan); }
.q-meta__id { font-family: var(--font-hand); font-size: 18px; color: var(--brown); white-space: nowrap; }
.q-meta__comp { flex: 1 1 240px; }
.q-verify { margin-left: auto; }
.q-verify.is-on { background: var(--teal-bg); border-color: var(--teal); color: var(--teal-dark); }
.q-ok { color: var(--teal); font-weight: 700; }
.badge--bug { background: #fbe4e1; border-color: var(--red); color: var(--red); }
/* pastille « signalements à traiter » sur l'avatar du prof (Q-160) */
.avatar-wrap { position: relative; display: inline-flex; }
.bug-badge { position: absolute; top: -7px; right: -7px; z-index: 2; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 2px solid var(--paper); box-shadow: 0 0 0 0 rgba(179, 64, 47, 0.6); animation: bug-pulse 1.6s ease-out infinite; }
.bug-badge:hover { animation: none; transform: scale(1.15); }
@keyframes bug-pulse { 0% { box-shadow: 0 0 0 0 rgba(179, 64, 47, 0.6); } 70% { box-shadow: 0 0 0 9px rgba(179, 64, 47, 0); } 100% { box-shadow: 0 0 0 0 rgba(179, 64, 47, 0); } }
@media (prefers-reduced-motion: reduce) { .bug-badge { animation: none; } }
/* demandes d'exercices supplémentaires (Q-177) : même pastille, en orange, décalée sous celle des bugs */
.bug-badge--exos { top: 16px; right: -9px; background: var(--orange); animation: none; }
.exo-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; }
.bug-dot { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; }
.btn.has-bug { border-color: var(--red); }
.q-reports { border: 1.5px solid var(--red); background: #fff7f5; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.q-reports__title { font-family: var(--font-hand); font-size: 18px; color: var(--red); }
.q-report { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.q-report__who { color: var(--muted); white-space: nowrap; }
.q-report__msg { flex: 1 1 200px; }
.q-report.is-done { opacity: .6; }
.q-report.is-done .q-report__msg { text-decoration: line-through; }
.q-report__xp { font-size: 12px; color: var(--muted); white-space: nowrap; }
.q-report__hide { color: var(--teal-dark); border: 1.5px solid var(--tan); border-radius: 50%; width: 26px; height: 26px; flex-shrink: 0; }
.q-report__hide:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.q-report.is-archived { opacity: .5; }
.q-reports__sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 4px; }
.q-reports__archived-only { display: flex; }
.q-reports:has(.q-reports__archived-only) { border-color: var(--tan); background: var(--card); }
/* « Bug ? » côté élève (Q-107) */
.bug-btn { font-size: 13px; color: var(--muted); }
.bug-btn:hover { color: var(--red); border-color: var(--red); }
.q-solution .q-choice.is-checked { outline: 2px solid var(--teal); outline-offset: -2px; }
.q-solution--wrong .q-choice.is-checked { outline-color: var(--red); }
.q-solution--wrong .question__verdict { display: block; }
.q-fb { border-top: 1.5px dashed var(--tan); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.q-fb__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.q-fb__title { font-family: var(--font-hand); font-size: 20px; color: var(--brown); }
.q-fb__text { width: 100%; min-height: 0; font-size: 14px; line-height: 1.45; resize: vertical; }
/* Options d'une question « expression mathématique » dans l'onglet Réponses (Q-314) */
.q-mathopts { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 10px 14px 12px; border: 1.5px solid var(--tan); background: var(--card); }
.q-mathopts legend { padding: 0 6px; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.q-mathopts__row { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; }

.q-fb__view { padding: 8px 12px; border: 1.5px dashed var(--tan); background: var(--card); font-size: 14px; line-height: 1.45; cursor: text; min-height: 38px; }
.q-fb__view:hover { border-color: var(--brown); }
.q-fb__view p { margin: 0 0 4px; }
.q-fb__view img, .q-fb__view video { max-width: 100%; max-height: 200px; }
.q-fb__view--empty { color: var(--muted); font-style: italic; }
.q-fb__hint { font-size: 12px; color: var(--muted); }
.q-expected-note { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--tan); }
/* Listes et lignes des énoncés / correctifs générés (formatif.md) : une idée par ligne, puces claires, espace */
.q-list { margin: 6px 0 10px; padding-left: 22px; }
.q-list li { margin: 4px 0; }
.q-line { margin: 10px 0; }
/* Réponses des élèves (Q-253) */
.qr-head { font-size: 14px; color: var(--ink-2); }
.qr-pct { font-family: var(--font-hand); font-size: 24px; color: var(--brown); font-weight: 400; }
.qr-group { border-top: 1px dashed var(--tan); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.qr-group__title { margin: 0; font-family: var(--font-hand); font-size: 18px; font-weight: 400; color: var(--brown); }
.qr-ans { border: 1px solid var(--tan); background: var(--card); padding: 6px 10px; }
.qr-ans__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qr-ans__text { font-weight: 600; overflow-wrap: anywhere; }
.qr-ans--bad .qr-ans__text { color: var(--red); }
.qr-ans--ok .qr-ans__text { color: var(--teal-dark); }
.qr-ans--part .qr-ans__text { color: var(--orange-dark); }
.qr-ans__n { color: var(--muted); font-size: 13px; }
.qr-ans__top .btn { margin-left: auto; min-height: 26px; padding: 2px 8px; }
.qr-who { margin: 4px 0 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); }
.qr-good summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 4px 0; }
.qr-good .qr-ans { margin-top: 6px; }
.qtabs { display: flex; gap: 2px; margin-left: 12px; flex-shrink: 0; }
#q-title { white-space: normal; font-size: 22px; line-height: 1.15; }
.qtab { white-space: nowrap; padding: 6px 12px; border: 0; border-bottom: 3px solid transparent; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.qtab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--brown); }
.qtab[disabled] { opacity: 0.4; cursor: default; }

/* Rendu des questions (moteur, réutilisé côté élève) */
.question { display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.5; }
.question__text img, .q-matching__q img { max-width: 100%; height: auto; max-height: 340px; width: auto; cursor: zoom-in; }
.question__text img.is-zoomed, .q-matching__q img.is-zoomed { max-height: none; cursor: zoom-out; }
.q-choice img { display: block; max-width: 100%; width: auto; height: auto; max-height: 160px; }
.question__text p:last-child { margin-bottom: 0; }
.question__text table { max-width: 100%; }
.q-choices { display: flex; flex-direction: column; gap: 6px; }
.q-choices--row { flex-direction: row; gap: 12px; align-items: center; flex-wrap: wrap; }
.q-choices--inline { display: inline-flex; flex-direction: row; gap: 10px; flex-wrap: wrap; vertical-align: middle; }
.q-choice { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border: 1.5px solid var(--tan); background: var(--card); cursor: pointer; min-height: 44px; }
.q-choice input { margin-top: 4px; accent-color: var(--brown); }
.q-choice p { margin: 0; }
.q-choice.is-checked { border-color: var(--brown); background: var(--card-focus); }
.q-choices--inline .q-choice { padding: 2px 8px; min-height: 0; }
.q-choices--images { flex-direction: row; flex-wrap: wrap; gap: 10px; }
.q-choices--images .q-choice { flex: 1 1 180px; max-width: 320px; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.q-choices--images .q-choice input { margin-top: 0; }
.q-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-input { max-width: 320px; }
.q-input--inline { display: inline-block; min-height: 34px; padding: 4px 8px; margin: 0 4px; vertical-align: middle; font-size: 15px; }
.q-cloze .q-essay, .q-essay { font-family: inherit; display: block; width: 100%; box-sizing: border-box; min-height: 320px; padding: 10px 12px; font-size: 17px; line-height: 1.5; resize: vertical; white-space: pre-wrap; }   /* réponse rédigée (Q-319) */
.q-essay__note { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); font-style: italic; }
.q-cloze .q-select { display: inline-block; vertical-align: middle; margin: 0 4px; max-width: calc(100% - 8px); }
/* Menus des questions (Q-323) : liste des choix lisible là où le navigateur le permet (Chrome ≥ 135, chromebooks) —
   choix espacés et séparés, puce au début de chacun, liste détachée de la page ; ailleurs, le menu habituel. */
@supports (appearance: base-select) {
  .q-select, .q-select::picker(select) { appearance: base-select; }
  .q-select, .q-cloze .q-select { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 7em; min-height: 34px; padding: 4px 10px; font-size: 15px; line-height: 1.3; text-align: left; border-radius: 4px; cursor: pointer; }
  .q-select::picker-icon { color: var(--brown); transition: rotate 0.15s; }
  .q-select:open::picker-icon { rotate: 180deg; }
  .q-select:open { border-color: var(--brown); }
  .q-select::picker(select) { margin-top: 4px; padding: 6px; max-width: min(680px, calc(100vw - 24px)); background: var(--card-focus); border: 1.5px solid var(--brown); border-radius: 8px; box-shadow: 0 10px 28px rgba(40, 25, 5, 0.28); }
  .q-select option { position: relative; display: block; padding: 10px 14px 10px 32px; font-size: 15px; line-height: 1.4; white-space: normal; color: var(--ink); border-radius: 5px; cursor: pointer; }
  .q-select option + option { margin-top: 4px; }
  .q-select option:not([value=""]) { border: 1.5px solid var(--folded); background: var(--card); }
  .q-select option:not([value=""])::before { content: ""; position: absolute; left: 13px; top: calc(10px + 0.7em - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--tan); }
  .q-select option[value=""] { padding-left: 14px; color: var(--muted); font-style: italic; }
  .q-select option:hover, .q-select option:focus-visible { border-color: var(--brown); background: var(--teal-bg); outline: none; }
  .q-select option:checked { border-color: var(--teal-dark); background: var(--teal-bg); font-weight: 600; }
  .q-select option:checked::before { background: var(--teal-dark); }
  .q-select option::checkmark { display: none; }
}
.q-matching { display: flex; flex-direction: column; gap: 8px; }
.q-matching__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.q-matching__q { flex: 1; min-width: 180px; }
.q-matching__q p { margin: 0; }
/* passage surligné dans l'énoncé (Q-332) : ce que l'élève doit faire, visible aussi en s'exerçant */
mark.q-hl { background: var(--m-hl); color: inherit; padding: 0 2px; }
.q-steps { margin: 6px 0; font-size: 18px; }   /* les étapes de l'élève, l'étape fautive surlignée (Q-332) */
.q-guided__start { font-size: 20px; margin: 8px 0 4px; }   /* calcul guidé (Q-377) */
.q-guided__steps { list-style: none; margin: 0 0 8px; padding: 0; }
.q-guided__step { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 0 6px 10px; border-left: 3px solid var(--tan); margin: 4px 0; }
.q-guided__step--ok { border-left-color: var(--teal); }
.q-guided__step--ko { border-left-color: var(--red); }
.q-guided__what { color: var(--ink-2); font-style: italic; }
.q-guided__res { font-size: 19px; }
.q-guided__undo { margin-left: auto; padding: 4px 8px; }
.q-guided__ask { margin: 10px 0 4px; font-weight: 600; }
.q-guided__act { display: block; width: 100%; text-align: left; margin: 4px 0; white-space: normal; }
.q-guided__end { margin: 10px 0 0; color: var(--teal-dark); font-weight: 600; }
.q-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 13px; margin-left: 6px; color: var(--on-brown); flex-shrink: 0; }
.q-mark--ok { background: var(--teal); }
.q-mark--ko { background: var(--red); }
.q-mark--partial { background: var(--orange); }
.q-expected { font-size: 13px; color: var(--teal-dark); background: var(--teal-bg); padding: 1px 8px; border: 1px solid var(--teal); }
/* correction case par case d'un texte à trous (Q-364, design/correction-par-case.html) : A sous la ligne, B en cartes */
.q-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font: 600 13px var(--font-text); color: var(--on-brown); flex: none; margin: 0 4px; vertical-align: middle; }
.q-num--ko { background: var(--red); }
.q-num--ok { background: var(--teal); }
.q-fix { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 12px 8px; padding: 8px 12px; border-left: 4px solid var(--red); background: var(--card-focus); font-size: 15px; }
.q-fix > div > p { margin: 2px 0; }
.q-fix__ta { color: var(--red); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.q-fix__it { color: var(--teal-dark); font-weight: 600; }
.q-cards { margin: 10px 0; display: flex; flex-direction: column; gap: 10px; }
.q-card { border: 1.5px solid var(--folded); background: var(--card-focus); border-radius: 4px; overflow: hidden; }
.q-card h4 { margin: 0; padding: 6px 10px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font: 600 15px var(--font-text); background: var(--folded); }
.q-card h4 > span:last-child { margin-left: 6px; }
.q-card__row { display: grid; grid-template-columns: 84px 1fr; gap: 8px; padding: 6px 10px; border-top: 1px solid var(--folded); font-size: 15px; }
.q-card__row > span { font-size: 12px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.q-card__row > div > p { margin: 0 0 4px; }
.q-card__row--toi { background: var(--red-bg); }
.q-card__row--fallait { background: var(--teal-bg); }
@media (max-width: 480px) { .q-card__row { grid-template-columns: 1fr; gap: 2px; } }
.question__verdict { font-family: var(--font-hand); font-size: 24px; font-weight: 700; }
.question__verdict--ok { color: var(--teal); }
.question__verdict--ko { color: var(--red); }
.question__verdict--partial { color: var(--orange); }
.question__feedback { padding: 10px 14px; border: 1.5px dashed var(--tan); background: var(--dim); font-size: 14px; }
.question__feedback p:last-child { margin-bottom: 0; }
.q-marker__img { position: relative; display: inline-block; max-width: 100%; cursor: crosshair; }
.q-marker__img img { display: block; max-width: 100%; height: auto; }
.q-marker__pin { position: absolute; transform: translate(-50%, -100%); padding: 2px 8px; background: var(--brown); color: var(--on-brown); font-size: 12px; white-space: nowrap; border: 1.5px solid var(--card); box-shadow: 2px 2px 0 var(--shadow); pointer-events: none; }
.q-marker__pin::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 0; height: 0; border: 4px solid transparent; border-top-color: var(--brown); transform: translateX(-50%); }
.q-marker__pin--ok { background: var(--teal); }
.q-marker__pin--ko { background: var(--red); }
.q-marker__list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.q-marker__choose.is-active { background: var(--brown); color: var(--on-brown); }
.q-marker__choose.is-placed { border-style: dashed; }
.q-math sup, .q-math sub { font-size: 0.75em; }
/* zones cliquables d'un dessin (Q-362) : trait (arc) ou aire (secteur d'angle) invisibles, fluo au survol et une fois choisis */
.q-zone { cursor: pointer; pointer-events: visible; fill: none; stroke: transparent; stroke-width: 16; stroke-linecap: round; transition: stroke 0.12s, fill 0.12s; }
.q-zone--aire { fill: transparent; stroke-width: 0; }
.q-zone:hover:not(.is-ro), .q-zone.is-on { stroke: rgba(240, 190, 50, 0.72); }
.q-zone--aire:hover:not(.is-ro), .q-zone--aire.is-on { fill: rgba(240, 190, 50, 0.6); stroke: none; }
.q-zone.is-ro { cursor: default; }
/* \widehat{ABC} : chapeau en couleur du texte (thème sombre compris), sur toute la largeur des lettres (Q-361) */
.q-angle { position: relative; display: inline-block; padding-top: 0.34em; line-height: 1; }
.q-angle::before { content: ""; position: absolute; left: 0.04em; right: 0.04em; top: 0; height: 0.36em; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpolyline points='1,9 50,1.5 99,9' fill='none' stroke='black' stroke-width='1.6' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpolyline points='1,9 50,1.5 99,9' fill='none' stroke='black' stroke-width='1.6' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }

/* Expressions mathématiques (Q-189) : rendu commun des énoncés et du champ d'écriture (public/assets/js/math-input.js).
   Les barres de fraction, parenthèses et racines sont ajustées en JS (layoutMath) ; les valeurs CSS servent de repli. */
.m-expr { white-space: nowrap; }
.m-expr .v, .q-mathfield .v { font-style: italic; }
.m-expr .o, .q-mathfield .o { margin: 0 0.2em; }
.m-expr .o.u, .q-mathfield .o.u { margin: 0 0.04em 0 0; }
.m-expr .sup, .q-mathfield .sup { display: inline-block; font-size: 0.68em; vertical-align: 0.85em; line-height: 1; padding: 0 0.06em; }
.m-expr .bl, .q-mathfield .bl { display: inline-block; width: 0; height: 0; }
.m-expr .fw, .m-expr .pg, .m-expr .sqrt, .q-mathfield .fw, .q-mathfield .pg, .q-mathfield .sqrt { display: inline; }
.m-expr .frac, .q-mathfield .frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: -0.6em; margin: 0 0.1em; font-size: 0.92em; line-height: 1.1; }
.m-expr .num, .m-expr .den, .q-mathfield .num, .q-mathfield .den { display: block; padding: 0 0.2em; text-align: center; }
.m-expr .bar, .q-mathfield .bar { align-self: stretch; border-top: 1.5px solid currentColor; margin: 0.06em 0; }
.m-expr .pin, .q-mathfield .pin { display: inline-block; line-height: 1.15; min-width: 0.3em; }
.m-expr .rc, .q-mathfield .rc { display: inline-block; border-top: 1.5px solid currentColor; padding: 0.1em 0.12em 0; line-height: 1.15; }
.st { display: inline-block; overflow: visible; vertical-align: -0.22em; height: 1.15em; }
.st-lp, .st-rp { width: 0.34em; }
.st-lp { margin-right: 0.03em; }
.st-rp { margin-left: 0.03em; }
.st-rad { width: 0.62em; margin-right: -1px; }
.st path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.question__text .m-expr { font-size: 1.15em; }

/* champ d'écriture : papier quadrillé, la zone où l'on écrit est surlignée */
.q-mathfield { position: relative; flex: 1 1 240px; min-width: 0; max-width: 520px; min-height: 52px; padding: 4px 12px; border: 1.5px solid var(--tan); display: flex; align-items: center; overflow-x: auto; overflow-y: hidden; cursor: text; font-size: 22px; background-color: var(--card-focus); background-image: linear-gradient(var(--paper-lines) 1px, transparent 1px), linear-gradient(90deg, var(--paper-lines) 1px, transparent 1px); background-size: 14px 14px; -webkit-tap-highlight-color: transparent; }
.q-mathfield.is-focus { border-color: var(--brown); box-shadow: 3px 3px 0 var(--shadow); }
.q-mathfield.is-ro { flex: 0 1 auto; cursor: default; background-image: none; }
.q-mathfield .fview { white-space: nowrap; line-height: 1.25; padding-block: 0.35em; user-select: none; -webkit-user-select: none; }
.q-mathfield .ghost { position: absolute; left: 0; top: 0; width: 1px; height: 100%; opacity: 0; border: 0; padding: 0; margin: 0; font-size: 16px; caret-color: transparent; pointer-events: none; background: transparent; color: transparent; }
.q-mathfield .row.on { background: var(--m-hl); box-shadow: 0 0 0 0.1em var(--m-hl); }
.q-mathfield .ph { display: inline-block; width: 0.62em; height: 0.8em; border: 1.5px dashed var(--muted); vertical-align: -0.05em; }
.q-mathfield .ph-root { font-size: 15px; color: var(--muted); font-style: italic; }
.q-mathfield .caret { display: inline-block; width: 0; height: 1.05em; border-left: 2px solid var(--brown); margin-right: -2px; vertical-align: -0.16em; animation: m-blink 1.05s steps(1) infinite; }
@keyframes m-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .q-mathfield .caret { animation: none; } }
.m-mode { min-height: 1.35em; font-size: 13px; color: var(--muted); }
.m-mode:empty { min-height: 0; }
.m-mode b { background: var(--m-hl); color: var(--ink); padding: 0 5px; }

/* touches du clavier unique (Q-298) */
.m-k { height: 44px; padding: 0; border: 1.5px solid var(--tan); background: var(--card); color: var(--ink); font: 19px/1 var(--font-text); display: flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; box-shadow: 2px 2px 0 var(--shadow); }
.m-k:active, .m-k.is-press { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); background: var(--m-hl); }
.m-k.is-hot { border-color: var(--brown); color: var(--brown); background: var(--card-focus); }
.m-k.is-nav { font-weight: 700; background: var(--folded); }
.m-k--kbd { font-size: 14px; font-weight: 600; }
.m-k .kx { font-style: italic; }
.m-k .kx sup { font-style: normal; font-size: 0.62em; vertical-align: 0.8em; margin-left: 1px; }
.m-k .kbox { display: inline-block; width: 0.48em; height: 0.52em; border: 1.5px solid currentColor; }
.m-k .kf { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.m-k .kf i { display: block; width: 0.55em; height: 0.42em; border: 1.5px solid currentColor; }
.m-k .kf b { display: block; width: 0.95em; border-top: 1.5px solid currentColor; }
/* équation chimique (Q-298) : lettres droites ; flèche de réaction, avec ce qui est écrit au-dessus */
.q-mathfield--chem .v, .q-chem .v { font-style: normal; }
.q-mathfield--chem .o, .q-chem .o { margin: 0 0.15em; }
.m-expr .arr, .q-mathfield .arr { display: inline-block; text-align: center; margin: 0 0.25em; line-height: 1; vertical-align: baseline; }
.m-expr .arr__a, .q-mathfield .arr__a { display: block; min-height: 0.2em; font-size: 0.62em; line-height: 1.15; white-space: nowrap; }
.m-expr .arr__g, .q-mathfield .arr__g { display: block; font-size: 1.1em; line-height: 0.9; }
.q-mathfield--chem:not(.is-ro) { display: inline-flex; flex: 0 1 auto; min-width: min(360px, 100%); max-width: 100%; vertical-align: middle; font-size: 20px; }
.q-mathfield--chem.is-ro { display: inline-flex; vertical-align: middle; font-size: 18px; padding: 2px 10px; min-height: 0; }

/* panneau d'écriture (téléphone) : copie de l'énoncé, réponse, Vérifier, boutons au plus près du clavier */
.m-dock { position: fixed; left: 0; right: 0; top: 0; z-index: 60; display: grid; gap: 8px; padding: 10px 12px; max-height: 80%; overflow: auto; overscroll-behavior: contain; background: var(--card); border-bottom: 2px solid var(--brown); box-shadow: 0 6px 0 var(--shadow); font-size: 15px; line-height: 1.5; }
.m-dock__head { display: flex; gap: 10px; align-items: flex-start; }
.m-dock__recap { flex: 1; min-width: 0; max-height: 24vh; overflow: auto; padding: 6px 10px; background: var(--dim); border: 1.5px dashed var(--tan); }
.m-dock__recap p { margin: 0 0 4px; }
.m-dock__recap img { max-height: 120px; width: auto; }
.m-dock .q-mathfield { max-width: none; }
.m-dock__check { justify-self: end; }
/* clavier unique des réponses écrites (Q-241, Q-298) : ordi sous la case, téléphone au-dessus du clavier ou dans le
   panneau d'écriture ; l'allure du clavier du champ mathématique (Q-189) */
.a-keys { position: fixed; z-index: 75; display: flex; flex-direction: column; gap: 6px; padding: 8px; max-width: calc(100vw - 8px); box-sizing: border-box; background: var(--dim); border: 1.5px solid var(--brown); box-shadow: 3px 3px 0 var(--shadow); }
.a-keys[hidden], .a-keys__row[hidden] { display: none; }
.a-keys__row { display: flex; flex-wrap: wrap; gap: 6px; }
.a-keys__close { position: absolute; top: -12px; right: -12px; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--card); background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.a-keys--docked .a-keys__close, .a-keys--phone .a-keys__close { display: none; }
.a-keys .m-k { min-width: 40px; height: 42px; padding: 0 6px; font-size: 19px; flex: none; }
.a-keys .m-k.is-sym { font-weight: 600; }
.a-keys .m-k--more { font-weight: 700; letter-spacing: 1px; }
.a-keys__more { padding-top: 6px; border-top: 1.5px dashed var(--tan); }
.a-keys--docked { position: static; max-width: none; box-shadow: none; }
.a-keys--flow { max-width: 640px; margin-top: 4px; }
.m-k.is-on { background: var(--m-hl); border-color: var(--brown); }
.a-keys .m-k .kx sub { font-style: normal; font-size: 0.62em; vertical-align: -0.3em; margin-left: 1px; }
.a-keys__hint { font-size: 12.5px; }
.a-keys__hint[hidden] { display: none; }
.a-keys--phone { left: 0; right: 0; max-width: none; border-width: 2px 0 0; box-shadow: 0 -4px 0 var(--shadow); }
.a-keys--phone .a-keys__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.a-keys--phone .m-k { min-width: 0; height: 42px; padding: 0; }
/* ---------------------------------------------------------------- calculatrice des exercices (Q-271) */
.a-keys .m-k.m-k--calc { width: auto; padding: 0 10px; gap: 6px; font-size: 13px; font-weight: 600; }
.calc { position: fixed; z-index: 80; width: 290px; box-sizing: border-box; padding: 10px; background: var(--parch); color: var(--ink); border: 1.5px solid var(--brown); box-shadow: 0 10px 28px rgba(59, 42, 22, 0.22); font-family: var(--font-text); }
.calc[hidden] { display: none; }
.calc__head { display: flex; align-items: center; margin-bottom: 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.calc__x { margin-left: auto; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--ink-2); cursor: pointer; }
.calc__screen { background: var(--parch-2); border: 1px solid var(--folded); padding: 6px 10px; text-align: right; }
.calc__in { width: 100%; box-sizing: border-box; border: 0; background: transparent; font: 15px/1.4 var(--font-text); color: var(--ink-2); text-align: right; padding: 0; outline: none; }
.calc__out { font-size: 24px; font-weight: 700; min-height: 30px; color: var(--ink); }
.calc__keys { margin-top: 8px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.calc__k { height: 40px; border: 1px solid var(--folded); background: var(--dim); color: var(--ink-2); font: 15px var(--font-text); cursor: pointer; touch-action: manipulation; }
.calc__k--n { background: var(--card); color: var(--ink); font-size: 17px; }
.calc__k--eq { grid-column: span 3; background: var(--brown); border-color: var(--brown); color: var(--on-brown); font-size: 19px; font-weight: 700; }
.calc__k:active { transform: translate(1px, 1px); }
.calc.is-shake { animation: calc-shake .3s; }
@keyframes calc-shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.calc--phone { left: 0; right: 0; bottom: 0; width: auto; border-width: 2px 0 0; box-shadow: 0 -8px 24px rgba(59, 42, 22, 0.18); padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }
.calc--phone .calc__k { height: 48px; font-size: 18px; }
@media (prefers-reduced-motion: reduce) { .calc.is-shake { animation: none; } }

/* couleur de la sous-compétence notée par un trou (vue du prof, Q-238) */
.q-crit { border-width: 2.5px !important; }
.q-crit-0 { border-color: #d62828 !important; background: #fde3e3 !important; }
.q-crit-1 { border-color: #1f9e4a !important; background: #ddf3e4 !important; }
.q-crit-2 { border-color: #d4a900 !important; background: #fff6c2 !important; }
.q-crit-3 { border-color: #2b6cb0 !important; background: #e0ecfa !important; }
.q-crit-4 { border-color: #7b3fa0 !important; background: #efe3f7 !important; }
/* case notée pour deux sous-compétences : moitié de chaque couleur */
.q-crit-0.q-crit2-1 { background: linear-gradient(135deg, #fde3e3 0 50%, #ddf3e4 50% 100%) !important; border-color: #d62828 #1f9e4a #1f9e4a #d62828 !important; }
.q-crit-0.q-crit2-2 { background: linear-gradient(135deg, #fde3e3 0 50%, #fff6c2 50% 100%) !important; border-color: #d62828 #d4a900 #d4a900 #d62828 !important; }
.q-crit-1.q-crit2-2 { background: linear-gradient(135deg, #ddf3e4 0 50%, #fff6c2 50% 100%) !important; border-color: #1f9e4a #d4a900 #d4a900 #1f9e4a !important; }
.crit-legend__note { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.crit-legend { margin: 8px 0 4px; border-collapse: collapse; font-size: 14px; }
.crit-legend td { padding: 5px 10px; border: 1.5px solid var(--tan); background: var(--card); }
.crit-legend td.crit-legend__sw { width: 28px; padding: 0; border-width: 2.5px; }
.crit-legend td.crit-legend__pts { text-align: center; width: 70px; }
.m-dock__ph { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--brown); color: var(--brown); font-size: 14px; }

/* ---------------------------------------------------------------- élève · Liste des compétences (§4.4, disposition Q-120) */
.chapters-list { display: flex; flex-direction: column; gap: 14px; }
/* Le chapitre est une carte fermée : bandeau plein, coins arrondis, ombre ; tout ce qui est dedans lui appartient */
.chap { border: 2px solid var(--tan); border-radius: 10px; overflow: hidden; background: var(--card); }
/* le menu d'autoévaluation de la dernière ligne était coupé par le coin arrondi du chapitre (Q-176) */
.chap:has(.sel__list:not([hidden])) { overflow: visible; }
.chap__head { border-radius: 8px 8px 0 0; }
.chap.is-open { border-color: var(--brown); box-shadow: 4px 4px 0 var(--shadow); }
.chap__head {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 12px 16px; border: 0; background: var(--folded);
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
/* Bandeau du chapitre déplié : le même beige que replié, titre en brun — plus de bandeau brun foncé (Q-178) */
.chap.is-open > .chap__head { border-bottom: 1.5px solid var(--tan); }
.chap__title { color: var(--brown); }
.chap__chev { display: inline-flex; color: var(--brown); transform: rotate(-90deg); transition: transform 0.15s; margin-top: 4px; }
.chap.is-open .chap__chev { transform: none; }
.chap__title { font-family: var(--font-hand); font-size: 24px; font-weight: 700; line-height: 1.1; flex: 1; }
.chap__meta { flex-basis: 100%; margin-left: 30px; font-size: 13px; font-style: italic; color: var(--muted); }
/* Le rappel « encore N compétences à voir · évalué dans … » ne sert qu'une fois le chapitre replié (Q-176) */
.chap.is-open .chap__meta { display: none; }
/* Tous les exercices faits (Q-128) : panneau dans la modale d'exercice */
.ex-done { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 8px 0; max-width: 560px; }
.ex-done__title { font-family: var(--font-hand); font-size: 26px; line-height: 1.15; margin: 0; }
.ex-done__lead { margin: 0; color: var(--muted); }
.ex-done__btn { text-align: left; white-space: normal; line-height: 1.25; }
.chap__head { flex-wrap: wrap; }
/* Document du chapitre (Q-127) : image de carnet à droite de l'en-tête, lien du prof + lien personnel de l'élève */
.chap__top { display: flex; align-items: stretch; background: var(--folded); }
.chap__top .chap__head { flex: 1; min-width: 0; background: transparent; }
.chap.is-open > .chap__top { border-bottom: 1.5px solid var(--tan); } /* bandeau clair, titre brun (Q-178) */
.chap-doc { display: flex; align-items: flex-start; gap: 6px; padding: 8px 12px 8px 0; flex-shrink: 0; }
.chap-doc__item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; border: 0; background: none; color: inherit; font: inherit; text-decoration: none; cursor: pointer; border-radius: 8px; }
.chap-doc__item:hover { background: rgba(0, 0, 0, 0.08); }
.chap.is-open .chap-doc__item:hover { background: rgba(0, 0, 0, 0.08); }
.chap-doc__cover { fill: rgba(0, 0, 0, 0.06); }
.chap.is-open .chap-doc__cover { fill: rgba(255, 255, 255, 0.14); }
.chap-doc__label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; white-space: nowrap; }
.chap-doc__item--add .chap-doc__book { stroke-dasharray: 3 3; opacity: 0.7; }
.chap-doc__item--mine { position: relative; }
.chap-doc__item--mine > a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: inherit; text-decoration: none; }
.chap-doc__edit { position: absolute; top: -2px; right: -6px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid currentColor; border-radius: 50%; background: var(--card); color: var(--brown); cursor: pointer; padding: 0; }
.chap.is-open .chap-doc__edit { background: var(--brown); color: var(--on-brown); }
.chap-doc__menu > summary { list-style: none; }
.chap-doc__menu > summary::-webkit-details-marker { display: none; }
.chap-doc__menu[open] > summary { background: rgba(0, 0, 0, 0.08); }
.chap-doc__menu .menu__panel { top: calc(100% + 4px); min-width: 210px; color: var(--ink); text-transform: none; }
.prog__doc { margin-left: auto; }
.prog__doc .chap-doc { padding: 0; }
.chap__body { display: flex; flex-direction: column; }
/* Une compétence : liseré de gauche = autoévaluation ; n° + intitulé ; verdicts ; pastille · lien · S'exercer (Q-121) */
/* Liseré de gauche : trait plein de 6 px qui se dissout vers la droite sur 220 px (Q-172) */
.comp { position: relative; display: flex; flex-direction: column; padding: 12px 16px 12px 20px; border-bottom: 1px dashed var(--tan); --comp-line: var(--shadow); --comp-veil: rgba(217, 199, 162, 0.28); }
.comp:last-child { border-bottom: 0; }
.comp::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 220px; pointer-events: none;
  background: linear-gradient(90deg, var(--comp-line) 0, var(--comp-line) 6px, var(--comp-veil) 7px, transparent 100%);
}
.comp > * { position: relative; }
.comp[data-state="ready"] { --comp-line: var(--teal); --comp-veil: rgba(91, 140, 133, 0.22); }
.comp[data-state="work"] { --comp-line: var(--orange); --comp-veil: rgba(201, 113, 63, 0.22); }
.comp[data-state="help"] { --comp-line: var(--red); --comp-veil: rgba(179, 64, 47, 0.20); }
.comp__head { margin: 0; font-size: 15px; line-height: 1.4; display: flex; align-items: baseline; gap: 6px; }
.comp__ref { flex: 0 0 auto; min-width: 40px; font-family: var(--font-hand); font-size: 22px; font-weight: 700; color: var(--brown); line-height: 1; }
.comp__title { flex: 1 1 auto; min-width: 0; }
.comp[data-state="help"] .comp__ref { color: var(--red); }
/* Chaîne « évaluations → autoévaluation » (Q-172) : les verdicts prolongent la pastille vers la gauche, coupés en
   oblique, 4 px entre les morceaux, petit arrondi tout à gauche. */
.comp__vds { display: flex; align-items: center; gap: 0; justify-content: flex-end; }
/* la coupe oblique creuse déjà 10 px : on remonte les morceaux pour ne laisser qu'un filet (Q-177) */
.comp__vds > * + * { margin-left: -7px; }
/* Flèche entre les verdicts et l'autoévaluation : il reste quelque chose à faire (Q-179).
   Rien quand la dernière évaluation est réussie : l'absence de flèche est un signal en soi. */
.comp__arrow { width: 26px; flex-shrink: 0; display: flex; justify-content: center; align-items: center; }
.comp[data-last="medium"] .comp__arrow { color: var(--orange); }
.comp[data-last="work"] .comp__arrow { color: var(--red); }
/* Colonne « autoévaluation » : sur grand écran, prolongement du bandeau du chapitre (Q-179) */
.comp__zone { display: flex; align-items: center; gap: 10px; }
.vd {
  height: 38px; box-sizing: border-box; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px; padding: 0 17px 0 11px;
  font-size: 12px; font-weight: 600; text-decoration: none; border: 0;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
.vd:first-child { border-radius: 8px 0 0 8px; clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.vd--master { background: var(--teal-bg); color: var(--teal-dark); }
.vd--medium { background: #f2e2cf; color: var(--orange-dark); }
.vd--work { background: var(--red-bg); color: var(--red); }
[data-theme="nocturne"] .vd--medium { background: #3a2c14; }
.vd:hover { filter: brightness(0.93); }
.comp__row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: flex-end; }
.comp__tools { display: flex; gap: 6px; align-items: center; width: 40px; flex-shrink: 0; justify-content: flex-end; }
.comp__row .btn { min-height: 38px; padding: 6px 12px; font-size: 13px; }
.comp__ex { white-space: nowrap; }
.comp__ex--none { display: none; } /* place gardée uniquement sur grand écran */
.comp__count { font-weight: 400; opacity: 0.9; margin-left: 2px; }
/* Un seul bouton d'aide par ligne : icône seule, la pastille rouge compte les aides (Q-172) */
.comp__tools .btn { width: 40px; min-width: 40px; padding: 6px 0; justify-content: center; position: relative; }
.comp__tools .btn__label { display: none; }
.comp__n { position: absolute; top: -7px; right: -7px; display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: var(--on-accent); font-size: 10px; font-weight: 700; }
.comp__links { display: none; }
.links-list { display: flex; flex-direction: column; gap: 8px; }
.links-list__item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--tan); background: var(--card-focus); color: var(--ink); text-decoration: none; font-size: 15px; }
.links-list__item svg { color: var(--brown); flex-shrink: 0; }
.links-list__item:hover { border-color: var(--brown); }
/* Titres de colonnes au-dessus de la chaîne (Q-176) : seulement sur grand écran, chapitre déplié */
.comp-head { display: none; }
.comp__extra { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comp__extra > :not([hidden]) { margin-top: 8px; }
/* Chromebook / ordinateur : tout sur une ligne, dans le même ordre que sur téléphone.
   Sous 1050 px, la colonne fixe (pastille + aide + S'exercer = 460 px) ne laisse plus assez de place à
   l'intitulé : on revient à la disposition repliée plutôt que de déborder (Q-185). */
@media (min-width: 1050px) {
  .comp { flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 8px 14px; padding: 10px 16px 10px 20px; }
  .comp__head { align-self: center; }
  .comp__row { align-self: stretch; }
  .comp__head { flex: 1 1 300px; min-width: 0; }
  .comp__row { margin-top: 0; }
  /* colonnes alignées d'une compétence à l'autre : la chaîne finit toujours au même endroit, puis aide · S'exercer */
  .comp__row { flex: 0 0 auto; flex-wrap: nowrap; gap: 10px; }
  .comp__ex { width: 148px; justify-content: center; flex-shrink: 0; }
  .comp__ex--none { display: block; height: 1px; }
  /* la colonne recouvre le pointillé de séparation et monte sur toute la hauteur : elle se lit d'un bloc (Q-184),
     avec un fondu léger à gauche qui s'éteint avant la flèche */
  .comp__zone { align-self: stretch; margin: -10px -16px -11px -10px; padding: 10px 16px 11px 22px;
    background: linear-gradient(90deg, rgba(230, 215, 184, 0) 0, var(--folded) 26px); }
  .comp-head { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 16px 0 20px;
    font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  .comp-head__vd { width: 203px; flex-shrink: 0; text-align: center; }
  .comp-head__arrow { width: 26px; flex-shrink: 0; }
  .comp-head__zone { width: 470px; flex-shrink: 0; box-sizing: border-box; margin-right: -16px; margin-left: -10px; margin-top: -2px;
    padding: 7px 16px 7px 22px; background: linear-gradient(90deg, rgba(230, 215, 184, 0) 0, var(--folded) 26px); }
  .comp-head__sel { display: inline-block; width: 224px; text-align: center; }
  .comp__extra { flex-basis: 100%; }
  .comp__extra > :not([hidden]) { margin-top: 0; }
}
.btn--link { border-color: var(--brown); color: var(--brown); }
.btn--help { border: 1.5px solid var(--red); color: var(--red); background: var(--red-bg); }
.btn--help:hover { background: var(--red-bg); color: var(--red); filter: brightness(0.95); }
.btn--help-none { border-color: var(--tan); background: var(--dim); color: var(--muted); font-weight: 400; }
.btn--help-none:hover { background: var(--dim); color: var(--ink-2); }
.btn__short { display: none; }
.badge--verdict { font-size: 12px; padding: 4px 10px; }
.badge--master { background: var(--teal-bg); border-color: var(--teal); color: var(--teal-dark); }
.badge--medium { background: #f2e2cf; border-color: var(--orange); color: var(--orange-dark); }
.badge--work { background: var(--red-bg); border-color: var(--red); color: var(--red); }
[data-theme="nocturne"] .badge--medium { background: #3a2c14; }

/* Sélecteur d'autoévaluation (Q-65) */
.comp__row .badge--verdict { text-decoration: none; }

.comp__row .badge--verdict:hover { outline: 2px solid var(--brown); outline-offset: -2px; }
.eval__more { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--brown); font-style: italic; }
details.eval[open] .eval__more { display: none; }
.next-eval { margin-bottom: 18px; }
.next-eval .chap__body { border: 1.5px solid var(--brown); }
.sel { position: relative; flex-shrink: 0; width: 224px; }
.sel__btn {
  width: 100%; min-height: 38px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px dashed var(--tan); background: var(--card-focus);
  font: inherit; font-size: 13px; font-style: italic; color: var(--muted); text-align: left;
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer;
}
.sel__label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sel__label--tiny { display: none; } /* remplace le libellé normal sur téléphone étroit (Q-187) */
/* La pastille ferme la chaîne : coupe oblique à gauche dès qu'il y a une évaluation (Q-172) */
.comp__zone .btn--help { width: 224px; flex-shrink: 0; }
.sel__btn > svg:last-child { margin-left: 2px; }
.sel__btn .sel__dot { display: none; } /* la couleur du liseré et de la pastille suffisent (Q-122) */
.sel__list { min-width: 320px; }
.sel__dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--tan); flex-shrink: 0; }
.comp[data-state] .sel__btn { font-style: normal; font-weight: 600; border-style: solid; }
/* Fond teinté de l'état choisi : lisible d'un coup d'œil sur toutes les tailles d'écran (Q-172) */
.comp[data-state="work"] .sel__btn { border-color: var(--orange); color: var(--orange-dark); background: #f2e2cf; }
.comp[data-state="help"] .sel__btn { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.comp[data-state="ready"] .sel__btn { border-color: var(--teal); color: var(--teal-dark); background: var(--teal-bg); }
[data-theme="nocturne"] .comp[data-state="work"] .sel__btn { background: #3a2c14; }
.comp[data-state=""] .sel__btn { font-style: italic; font-weight: 400; border-style: dashed; color: var(--muted); }
.comp[data-state="work"] .sel__btn .sel__dot, .sel__opt[data-state="work"] .sel__dot { background: var(--orange); border-color: var(--orange); }
.comp[data-state="help"] .sel__btn .sel__dot, .sel__opt[data-state="help"] .sel__dot { background: var(--red); border-color: var(--red); }
.comp[data-state="ready"] .sel__btn .sel__dot, .sel__opt[data-state="ready"] .sel__dot { background: var(--teal); border-color: var(--teal); }
.sel__list { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 20; margin: 0; padding: 0; list-style: none; background: var(--card); border: 1.5px solid var(--tan); box-shadow: 4px 4px 0 var(--shadow); }
.sel__opt { min-height: 40px; padding: 8px 12px; font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sel__opt:hover { background: var(--dim); }
.sel__opt[aria-selected="true"] { background: var(--paper); font-weight: 600; }
.sel__opt[data-state="work"][aria-selected="true"] { color: var(--orange-dark); }
.sel__opt[data-state="help"][aria-selected="true"] { color: var(--red); }
.sel__opt[data-state="ready"][aria-selected="true"] { color: var(--teal-dark); }

/* Modale exercices : quasi plein écran */
.modal--full { width: min(1100px, calc(100vw - 32px)); height: calc(100vh - 32px); }
.modal--full .modal__body { padding: 20px 28px; }
.helpers { display: flex; flex-wrap: wrap; gap: 8px; }
.helpers__name { padding: 8px 14px; border: 1.5px solid var(--teal); background: var(--teal-bg); color: var(--teal-dark); font-weight: 600; font-size: 14px; }

/* ---------------------------------------------------------------- modale « Créer une évaluation » (3 étapes) */
.steps { display: flex; align-items: center; gap: 8px; margin: 0 0 0 12px; padding: 0; list-style: none; }
.steps__item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.steps__item + .steps__item::before { content: ''; width: 40px; height: 1.5px; background: var(--tan); margin-right: 8px; }
.steps__n { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--tan); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.steps__item.is-active { color: var(--ink); font-weight: 600; }
.steps__item.is-active .steps__n { background: var(--brown); border-color: var(--brown); color: var(--on-brown); }
.steps__item.is-done .steps__n { background: var(--teal); border-color: var(--teal); color: var(--on-brown); }
.radios { display: flex; gap: 16px; }
.radio { flex: 1; display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--tan); background: var(--card); cursor: pointer; font-size: 13px; }
.radio.is-on { border-color: var(--brown); background: var(--card-focus); }
.radio input { margin-top: 3px; accent-color: var(--brown); }
.radio small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip--check { padding: 6px 10px; font-size: 12px; cursor: pointer; border-width: 1.5px; background: var(--card); }
.chip--check.is-on { border-color: var(--brown); background: var(--card-focus); font-weight: 600; }
.chip--check input { accent-color: var(--brown); margin: 0; }
.qrow { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border: 1.5px solid var(--tan); background: var(--card); flex-wrap: wrap; }
.qrow.is-dragging { opacity: 0.4; }
.qrow.is-drop { border-color: var(--brown); box-shadow: 4px 4px 0 var(--shadow); }
.qrow__n { width: 26px; height: 26px; border-radius: 50%; background: var(--brown); color: var(--on-brown); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.qrow__ref { font-size: 20px; font-weight: 700; width: 50px; }
/* Groupes d'une évaluation (Q-105) et horaire du prof */
.evg { display: flex; flex-direction: column; gap: 6px; }
.evg__row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1.5px solid var(--tan); background: var(--card); flex-wrap: wrap; }
.evg__row.is-off { opacity: 0.55; background: var(--dim); }
.evg__row.is-done { background: #dcefe4; border-color: #5a9a78; }   /* groupe qui a fini l'évaluation (Q-311) */
.evg__count { margin-left: 8px; padding: 1px 6px; font-size: 12px; background: #fdecc8; color: #7a4d00; border-radius: 4px; }
.evg__row.is-off .evg__date, .evg__row.is-off .evg__free { visibility: hidden; }
.evg__free { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 100%; }
.evg__free .evg__custom { width: 150px; }
.evg__row.is-focus { border-color: var(--brown); box-shadow: 0 0 0 2px var(--tan); }
.evg__name { min-width: 120px; font-size: 14px; }
.evg__date { min-width: 190px; }
.evg__hour { width: 130px; }
.horaire th, .horaire td { padding: 4px 6px; vertical-align: middle; }
.horaire__h { white-space: nowrap; font-family: var(--font-hand); font-size: 18px; }
.horaire__h small { display: block; font-family: var(--font-text); font-size: 11px; font-weight: 400; color: var(--muted); }
.horaire__cell { min-width: 150px; }
.horaire__sel { width: 100%; }
.horaire__free { width: 100%; margin-top: 4px; }
.qrow--sub { margin-left: 28px; border-left: 4px solid var(--tan); }
.qrow--sub .qrow__n { background: var(--tan); }
.qrow__link.is-on { color: var(--red); }
.qrow__title { font-size: 13px; width: 260px; }
.qrow__detail { flex: 1; font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; border: 1.5px solid var(--tan); }
.seg__btn { padding: 5px 10px; font: inherit; font-size: 12px; border: 0; background: var(--card); color: var(--muted); cursor: pointer; }
.seg__btn.is-on { background: var(--brown); color: var(--on-brown); font-weight: 600; }
.seg__btn[disabled] { opacity: 0.4; cursor: default; }

.qrow--detail { flex-wrap: wrap; }
.qrow__sub { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 4px 0 0 44px; font-size: 12px; color: var(--muted); }
.icon-btn.is-on { color: var(--brown); background: var(--dim); }

/* ---------------------------------------------------------------- Encodage (Q-72) */
.enc-wrap { max-height: calc(100vh - 230px); }
.table--enc { width: auto; min-width: 0; }
.table--enc th { position: sticky; top: 0; z-index: 2; }
.enc-eval { width: 160px; min-width: 160px; }
.enc-hide { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 6px; font: inherit; font-size: 11px; color: var(--muted); background: none; border: 1px dashed var(--tan); cursor: pointer; }
.enc-hide.is-on { color: var(--brown); border-style: solid; border-color: var(--brown); }
.enc-publish { display: block; margin-top: 6px; }
.enc-publish:disabled { background: var(--dim); border-color: var(--tan); color: var(--muted); cursor: not-allowed; }
/* Les 3 premières colonnes restent visibles quand on fait défiler les élèves (Q-93) */
.enc-fix { position: sticky; background: var(--card); z-index: 1; }
.table--enc th.enc-fix { z-index: 3; background: var(--dim); }
.enc-fix-1 { left: 0; }
.enc-fix-2 { left: 44px; }
.enc-fix-3 { left: 204px; box-shadow: 2px 0 0 var(--tan); }
tr:not(.enc-first) .enc-fix-3 { left: 204px; }
.table--enc td { padding: 4px 6px; }
.table--enc .enc-first td { border-top: 2px solid var(--tan); }
.enc-student { width: 36px; min-width: 36px; height: 78px; position: relative; padding: 0 !important; }
.enc-student span { position: absolute; left: 8px; bottom: 6px; transform-origin: left bottom; transform: rotate(-60deg); white-space: nowrap; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
.enc-cell { width: 36px; min-width: 36px; padding: 0 !important; }
.enc-input { width: 36px; min-width: 36px; height: 32px; margin: 0; padding: 0 2px; text-align: center; font-size: 13px; }
/* Repérage des colonnes (Q-168) : trois nuances qui tournent sur les colonnes VISIBLES (donc toujours alternées,
   même quand on masque les élèves déjà encodés), le nom de l'élève dans la nuance de sa colonne, et la colonne de la
   case active surlignée plus franchement. */
.enc-cell.enc-sh0, .enc-cell.enc-sh0 .enc-input, .enc-student.enc-sh0 { background: var(--card); }
.enc-cell.enc-sh1, .enc-cell.enc-sh1 .enc-input, .enc-student.enc-sh1 { background: var(--paper); }
.enc-cell.enc-sh2, .enc-cell.enc-sh2 .enc-input, .enc-student.enc-sh2 { background: var(--dim); }
/* demande de points d'un élève (Q-301) : case orangée + petite main pour ouvrir sa réponse */
.enc-cell.enc-claim, .enc-cell.enc-claim .enc-input { background: #ffd9a8; }
.enc-cell.enc-claim { position: relative; }
.enc-claim__btn { position: absolute; top: 0; right: 0; padding: 1px; border: 0; background: #e8892b; color: #fff; line-height: 0; cursor: pointer; }
.enc-claims { display: inline-flex; gap: 4px; align-items: center; border: 0; background: #ffd9a8; color: #7a3d00; padding: 2px 6px; font-size: 12px; cursor: pointer; }
.enc-claim__fb { background: var(--paper); padding: 8px 12px; font-size: 14px; }
.enc-claim__lines { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.enc-claim__line { display: inline-flex; gap: 6px; align-items: center; }
.enc-claim__line:has(.enc-claim__crit) { display: flex; width: 100%; align-items: baseline; }   /* réponse rédigée (Q-319) : critère en face des points */
.enc-claim__crit { font-size: 14px; color: var(--muted); }
.enc-claim__max, .enc-claim__line .enc-mini { white-space: nowrap; flex-shrink: 0; }
.enc-cell.is-col, .enc-cell.is-col .enc-input { background: var(--folded); }
.enc-student.is-col { background: var(--folded); }
.enc-student.is-col span { color: var(--brown); font-weight: 700; }
.enc-input.is-low { color: var(--red); }
.enc-input.is-abs { color: var(--muted); font-style: italic; }
.enc-input.is-invalid { background: var(--red-bg); color: var(--red); outline: 2px solid var(--red); outline-offset: -2px; }
.enc-pts { width: 44px; }
/* libellé d'un critère de grille : passe à la ligne au lieu d'être coupé (Q-215) */
textarea.cell--wrap { display: block; width: 100%; resize: none; overflow: hidden; white-space: pre-wrap; field-sizing: content; min-height: 2.2em; font: inherit; line-height: 1.35; }
.enc-pts.is-grid-off { background: #fdebd3; border-color: var(--orange); color: #9c4a00; } /* grille critériée ≠ points de la question (Q-214) */
.enc-qlabel { font: inherit; background: none; border: 0; padding: 2px 6px; color: var(--ink); cursor: pointer; }
.enc-qlabel:hover { color: var(--brown); text-decoration: underline; }
.enc-mark-cell { border-bottom: 4px solid var(--ink) !important; }
.enc-input::placeholder { color: var(--tan); }
.enc-eval { vertical-align: top; white-space: normal; }
.enc-eval__name { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-align: left; }
.enc-eval__name:hover { color: var(--brown); text-decoration: underline; }
.enc-eval__sub { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.enc-mini { width: 40px; min-width: 0; margin: 0; padding: 1px 4px; text-align: center; font-size: 12px; border: 1px solid var(--tan); background: var(--card-focus); }

/* ---------------------------------------------------------------- Période active */
.per { display: flex; gap: 16px; flex: 1; min-height: 0; align-items: stretch; }
.per__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.per__side { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.table--per tr { cursor: pointer; }
.table--per tr.is-selected td { background: var(--card-focus); box-shadow: inset 3px 0 0 var(--brown); }
.per-comment { min-width: 320px; }
.per-textarea { resize: none; overflow: hidden; line-height: 1.35; font-style: italic; display: block; }
.per-draft { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; font-size: 12px; font-style: italic; color: var(--muted); }
.hist { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--dim); }
.hist:last-child { border-bottom: 0; }
.hist__meta { width: 130px; flex-shrink: 0; }
.hist__comment { font-size: 12px; font-style: italic; line-height: 1.4; }
.chip--status { gap: 6px; padding: 6px 10px; font-size: 12px; color: var(--muted); background: var(--dim); border-width: 1.5px; cursor: pointer; font-family: var(--font-text); }
.chip--status.is-on { color: var(--ink); background: var(--card); border-color: var(--brown); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot--green { background: #5b8c5b; }
.dot--orange { background: var(--orange); }
.dot--grey { background: #9a9a9a; }
.dot--red { background: var(--red); }
@media (max-width: 1100px) { .per { flex-direction: column; } .per__side { width: auto; } }

/* ---------------------------------------------------------------- Période active : liste d'évaluations (Q-270) */
.pev { margin-top: 26px; }
.pev__title { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; min-height: 44px; cursor: pointer; color: var(--ink); font-family: var(--font-hand); font-size: 30px; font-weight: 700; }
.pev__title svg { color: var(--brown); transform: rotate(-90deg); transition: transform .15s; }
.pev.is-open .pev__title svg { transform: none; }
.pev__body { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.pev__wait { padding: 20px; }
.pev__empty { padding: 12px 0; margin: 0; }
.pev__bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pev-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pev-chip { padding: 6px 13px; min-height: 34px; border-radius: 999px; border: 1px solid var(--parch-edge); background: var(--card); color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.pev-chip.is-on { background: var(--brown); border-color: var(--brown); color: var(--on-brown); }
.pev-cmp { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-left: auto; }
.pev-seg { display: flex; border: 1px solid var(--parch-edge); border-radius: 6px; overflow: hidden; margin-left: auto; }
.pev-cmp + .pev-seg { margin-left: 0; }
.pev-seg button, .pev-sort button { font: inherit; font-size: 13px; padding: 6px 12px; min-height: 32px; border: 0; background: var(--card); color: var(--ink-2); cursor: pointer; }
.pev-seg button.is-on, .pev-sort button.is-on { background: var(--brown); color: var(--on-brown); }
.pev-sort { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pev-sort button { border: 1px solid var(--parch-edge); border-radius: 4px; text-transform: none; letter-spacing: 0; }
.pev__wrap { border: 1px solid var(--parch-edge); background: var(--card); max-width: 100%; overflow-x: auto; }
.pev-table { border-collapse: collapse; width: 100%; }
.pev-table th, .pev-table td { border-bottom: 1px solid var(--folded); border-left: 1px solid var(--folded); padding: 0; height: 40px; }
.pev-table thead th { background: var(--dim); vertical-align: bottom; }
.pev-table tfoot th, .pev-table tfoot td { background: var(--dim); font-weight: 600; color: var(--ink-2); }
.pev-table .pev-name { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; padding: 0 12px; font-weight: 600; white-space: nowrap; min-width: 130px; border-left: 0; }
.pev-table thead .pev-name, .pev-table tfoot .pev-name { background: var(--dim); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.pev-table .pev-ev { padding: 7px 6px; text-align: center; min-width: 72px; font-weight: 400; }
.pev-table .pev-ev.is-cmp { background: var(--folded); }
.pev-ev__d { display: block; font-size: 11px; color: var(--muted); }
.pev-ev__n { display: block; font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.25; margin: 2px 0 1px; text-transform: none; letter-spacing: 0; }
.pev-table tbody .pev-name { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); font-weight: 600; }
.pev-table td.pev-evo { width: 150px; }
.pev-cell { text-align: center; font-size: 14px; white-space: nowrap; }
span.pev-cell { display: block; font-size: 12px; padding: 4px 0; border-radius: 3px; }
.pev-c1 { background: var(--red-bg); color: var(--red); font-weight: 600; }
.pev-c2 { background: var(--parch-2); color: var(--ink-2); }
.pev-c3 { background: var(--teal-bg); color: var(--teal-dark); }
.pev-c4 { background: color-mix(in srgb, var(--teal) 45%, var(--teal-bg)); color: var(--ink); font-weight: 600; }
.pev-abs { background: repeating-linear-gradient(45deg, var(--dim) 0 3px, var(--card) 3px 6px); color: var(--muted); font-style: italic; font-size: 12px; }
.pev-table .pev-evo { padding: 0 10px; white-space: nowrap; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 400; text-align: left; }
.pev-table td.pev-evo { text-transform: none; letter-spacing: 0; }
.pev-table td.pev-evo > * { vertical-align: middle; }
.pev-spark polyline { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pev-spark circle { fill: var(--muted); }
.pev-spark.is-up polyline { stroke: var(--teal-dark); }
.pev-spark.is-up circle { fill: var(--teal-dark); }
.pev-spark.is-down polyline { stroke: var(--red); }
.pev-spark.is-down circle { fill: var(--red); }
.pev-trend { display: inline-block; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 28px; margin-left: 6px; }
.pev-trend.is-up { color: var(--teal-dark); }
.pev-trend.is-down { color: var(--red); }
.pev-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--ink-2); }
.pev-legend span { display: flex; align-items: center; gap: 6px; }
.pev-legend i { width: 18px; height: 12px; border: 1px solid var(--folded); display: inline-block; }
.pev-ch { display: flex; gap: 16px; align-items: flex-start; }
.pev-ch .pev__wrap { flex: 1; min-width: 0; }
.pev-table .pev-bar-h, .pev-table .pev-an { padding: 8px 10px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 400; text-align: left; white-space: nowrap; }
.pev-table td.pev-an { text-transform: none; letter-spacing: 0; padding: 4px 10px; }
.pev-table td.pev-an .pev-tag + .pev-tag { margin-left: 4px; }
.pev-thr { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink-2); margin-left: 6px; }
.pev-thr input { width: 56px; font: inherit; padding: 3px 4px; border: 1px solid var(--parch-edge); background: var(--card-focus); color: var(--ink); }
.pev-table td.pev-bar { padding: 0 10px; min-width: 150px; font-size: 13px; white-space: nowrap; }
.pev-meter { display: inline-block; vertical-align: middle; width: 80px; height: 8px; background: var(--dim); border-radius: 4px; overflow: hidden; margin-right: 8px; }
.pev-meter i { display: block; height: 100%; background: var(--brown); border-radius: 4px; }
.pev-meter--ready i { background: var(--teal); }
.pev-tag { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pev-tag--ok { background: var(--teal-bg); color: var(--teal-dark); }
.pev-tag--miss { background: color-mix(in srgb, var(--orange) 22%, var(--card)); color: var(--orange-dark); }
.pev-tag--lucky { background: var(--dim); color: var(--ink-2); }
.pev-tag--none { background: var(--red-bg); color: var(--red); }
.pev-tag--opt { border: 1px dashed var(--orange); color: var(--orange-dark); border-radius: 4px; }
.pev-plot__area { position: relative; margin: 14px 18px 0 36px; border-left: 1px solid var(--tan); border-bottom: 1px solid var(--tan); }
.pev-q { position: absolute; font-size: 11px; padding: 5px 7px; box-sizing: border-box; overflow: hidden; }
.pev-q--lucky { background: var(--parch-2); color: var(--muted); }
.pev-q--ok { background: var(--teal-bg); color: var(--teal-dark); text-align: right; }
.pev-q--none { background: var(--red-bg); color: var(--red); display: flex; align-items: flex-end; }
.pev-q--miss { background: color-mix(in srgb, var(--orange) 16%, var(--card)); color: var(--orange-dark); display: flex; align-items: flex-end; justify-content: flex-end; }
.pev-plot__axes { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); padding: 6px 18px 12px 36px; }
.pev-cards { display: flex; flex-direction: column; gap: 8px; }
.pev-card { background: var(--card); border: 1px solid var(--parch-edge); padding: 9px 12px; display: flex; flex-direction: column; gap: 7px; }
.pev-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pev-card__evo { display: flex; align-items: center; }
.pev-card__cells { display: grid; gap: 3px; }
/* liste d'évaluations : tri, exercices faits / justes, analyse, prénoms masqués, étiquettes du nuage (Q-276) */
.pev-sortlink { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--tan); text-underline-offset: 3px; }
.pev-sortlink:hover, .pev-sortlink.is-on { color: var(--brown); text-decoration-color: var(--brown); }
.pev-sortlink.is-on { font-weight: 700; }
.pev-hide { display: inline-flex; align-items: center; gap: 6px; }
.pev-hide[aria-pressed="true"] { background: var(--brown); color: var(--on-brown); border-color: var(--brown); }
.pev-table td.pev-exo { padding: 4px 10px; min-width: 130px; vertical-align: middle; }
.pev-exo__pct { font-size: 15px; font-weight: 700; line-height: 1.1; }
.pev-meter2 { display: flex; height: 8px; margin: 4px 0 3px; background: var(--dim); border-radius: 4px; overflow: hidden; width: 110px; }
.pev-meter2 i { display: block; height: 100%; }
.pev-meter2 .is-ok { background: var(--teal); }
.pev-meter2 .is-ko { background: var(--orange); }
.pev-exo__sub { font-size: 12px; color: var(--teal-dark); line-height: 1.1; min-height: 13px; }
.pev-table td.pev-an { font-size: 13px; min-width: 250px; max-width: 420px; padding: 6px 10px; }
.pev-an__why { display: block; margin-top: 3px; font-size: 12px; font-style: italic; color: var(--ink-2); line-height: 1.3; }
.pev-an--ok { background: var(--teal-bg); }
.pev-an--miss { background: color-mix(in srgb, var(--orange) 18%, var(--card)); }
.pev-an--lucky { background: var(--dim); }
.pev-an--none { background: var(--red-bg); }
.pev-an__prep { font-weight: 600; color: var(--ink-2); }
.pev-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 6px; border-radius: 999px; background: var(--card); font-weight: 600; }
.pev-pill i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pev-pill.is-ok { color: var(--teal-dark); }
.pev-pill.is-ok i { background: var(--teal); }
.pev-pill.is-ko { color: var(--red); }
.pev-pill.is-ko i { background: var(--red); }
.pev-plot { width: 400px; flex-shrink: 0; }
.pev-plot__lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.pev-plot__lines line { stroke: var(--muted); stroke-width: 1; }
.pev-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--brown); border: 2px solid var(--card); box-sizing: content-box; }
.pev-lbl { position: absolute; height: 14px; line-height: 14px; padding: 0 3px; font-size: 11px; color: var(--ink); background: color-mix(in srgb, var(--card) 70%, transparent); border-radius: 3px; white-space: nowrap; }
.pev-table tbody tr.is-hot td { box-shadow: inset 0 0 0 999px rgba(59, 42, 22, 0.07); }
.pev-table tbody tr.is-hot .pev-name { background: var(--brown); color: var(--on-brown); }
.pev-dot.is-hot { background: var(--orange); transform: scale(1.5); z-index: 3; }
.pev-lbl.is-hot { background: var(--brown); color: var(--on-brown); z-index: 3; font-weight: 700; }
.pev-ch--big { flex-direction: column; }
.pev-ch--big .pev-plot { width: 700px; max-width: 100%; overflow-x: auto; }
@media (max-width: 1500px) { .pev-ch { flex-direction: column; } .pev-ch .pev__wrap { width: 100%; } .pev-plot { max-width: 100%; overflow-x: auto; } }
@media (max-width: 700px) { .pev__title { font-size: 26px; } .pev-cmp { margin-left: 0; width: 100%; } .pev-cmp select { flex: 1; min-width: 0; } .pev-seg { margin-left: 0; } }

/* ---------------------------------------------------------------- élève · Résultats (§4.5) */
.results { display: flex; gap: 28px; align-items: flex-start; }
.results__left { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; gap: 14px; }
.results__right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.bulletin { padding: 16px 18px; gap: 10px; }
.bulletin__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.bulletin__cell { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; background: var(--dim); border: 1.5px dashed var(--tan); font: inherit; color: var(--muted); cursor: pointer; }
.bulletin__cell.has-grade { background: var(--folded); border-style: solid; color: var(--ink-2); }
.bulletin__cell.is-active { border-color: var(--brown); }
.bulletin__code { font-size: 11px; }
.bulletin__grade { font-family: var(--font-hand); font-size: 26px; font-weight: 700; line-height: 1; color: var(--tan); }
.bulletin__cell.has-grade .bulletin__grade { color: var(--ink); }
.bulletin__max { font-size: 10px; }
.bulletin__head { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.bulletin__comment { font-size: 14px; font-style: italic; line-height: 1.5; }
.uaa__summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--brown); cursor: pointer; }
.uaa__summary::-webkit-details-marker { display: none; }
.uaa[open] .uaa__summary svg { transform: rotate(90deg); }
.uaa__info { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--tan); color: var(--muted); font-size: 11px; font-style: italic; font-weight: 400; display: inline-flex; align-items: center; justify-content: center; }
.uaa__row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.uaa__name { width: 52px; }
.uaa__bar { flex: 1; height: 10px; border: 1px solid var(--brown); background: var(--paper); }
.uaa__fill { height: 100%; background: var(--teal); }
.uaa__fill--low { background: var(--orange); }
.uaa__val { width: 96px; text-align: right; font-weight: 600; color: var(--teal-dark); }
.uaa__val.is-low { color: var(--orange-dark); }
.eval { background: var(--folded); border: 1.5px solid var(--tan); }
.eval--recent, .eval[open] { background: var(--card); }
.eval--recent { border-color: var(--brown); }
.eval__head { list-style: none; display: flex; align-items: center; gap: 14px; padding: 12px 18px; cursor: pointer; flex-wrap: wrap; }
.eval__head::-webkit-details-marker { display: none; }
.eval[open] .eval__head { border-bottom: 1px dashed var(--tan); }
.eval__name { font-family: var(--font-hand); font-size: 26px; font-weight: 700; line-height: 1.1; }
.eval:not([open]) .eval__name { font-size: 22px; }
.eval__type { font-size: 16px; font-weight: 500; }
.eval__date { font-size: 13px; color: var(--muted); }
.eval__copy { padding: 7px 14px; border: 1.5px dashed var(--tan); color: var(--muted); font-size: 13px; font-style: italic; }
.eval__summary { margin-left: auto; width: 260px; display: flex; flex-direction: column; gap: 4px; }
.eval[open] .eval__summary { display: none; }
.eval__body { display: flex; flex-direction: column; }
.eval__row { display: grid; grid-template-columns: 46px 26px minmax(0, 1fr) 262px 190px; gap: 10px; padding: 10px 18px; border-bottom: 1px dashed var(--shadow); align-items: center; font-size: 13px; }
.eval__row:last-child { border-bottom: 0; }
.eval__row--head { padding: 6px 18px; background: var(--dim); border-bottom: 1.5px solid var(--tan); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.eval__row--head > :last-child { text-align: right; }
.eval__ref { font-family: var(--font-hand); font-size: 20px; font-weight: 700; }
/* Type de compétence : la lettre seule, le sens au survol (Q-173) */
.eval__type { width: 26px; height: 26px; border: 1.5px solid var(--tan); border-radius: 50%; background: var(--dim); font-family: var(--font-hand); font-size: 18px; font-weight: 700; color: var(--brown); display: inline-flex; align-items: center; justify-content: center; cursor: help; }
/* « Ce que tu pensais → le résultat » : une seule barre coupée en deux (Q-173) */
.eval__pill { display: flex; align-items: stretch; border: 1.5px solid var(--tan); border-radius: 8px; overflow: hidden; }
.eval__pill--warn { border: 2px solid var(--red); }
.eval__was { flex: 1; display: flex; align-items: center; padding: 6px 10px; font-size: 12px; background: var(--card-focus); color: var(--muted); }
/* l'avis de l'élève, aux couleurs de la Liste des compétences (Q-293) */
.eval__was--ready { background: var(--teal-bg); color: var(--teal-dark); font-weight: 600; }
.eval__was[class*="eval__was--"] { border-right: 1px solid rgba(0, 0, 0, 0.12); }
.eval__was--work { background: #f2e2cf; color: var(--orange-dark); font-weight: 600; }
.eval__was--help { background: var(--red-bg); color: var(--red); font-weight: 600; }
[data-theme="nocturne"] .eval__was--work { background: #3a2c14; }
.eval__got { flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.eval__got--master { background: var(--teal-bg); color: var(--teal-dark); }
.eval__got--medium { background: #f2e2cf; color: var(--orange-dark); }
.eval__got--work { background: var(--red-bg); color: var(--red); }
[data-theme="nocturne"] .eval__got--medium { background: #3a2c14; }
/* Exercices faits avant l'évaluation → aujourd'hui, et une invitation à en refaire (Q-173) */
.eval__exo { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.eval__exo-note { font-size: 12px; font-style: italic; color: var(--muted); }
.eval__exo-none { font-size: 12px; font-style: italic; color: var(--muted); }
/* Boutons de la colonne exercices (Q-177) : coins arrondis et petite ombre, comme la maquette */
.eval__go, .eval__ask { white-space: nowrap; border-radius: 8px; box-shadow: 2px 2px 0 var(--shadow); }
.eval__ask { border-color: var(--tan); color: var(--ink-2); background: var(--card-focus); }
.eval__ask:hover { border-color: var(--brown); color: var(--brown); }
.eval__ask[disabled] { border-style: dashed; color: var(--teal-dark); background: var(--teal-bg); box-shadow: none; cursor: default; }
.eval__meta { font-style: italic; color: var(--muted); }
.eval__total { padding: 8px 18px; font-size: 13px; text-align: right; border-top: 1px dashed var(--shadow); }
/* Le bulletin passe au-dessus tant que la colonne des évaluations n'a pas la place (Q-185) */
@media (max-width: 1279px) {
  .results { flex-direction: column; }
  .results__left { width: 100%; }
}
@media (max-width: 900px) {
  /* téléphone : le compte d'exercices disparaît, on ne garde que le bouton (Q-173) */
  .eval__row { grid-template-columns: 40px 26px 1fr; gap: 6px 8px; }
  .eval__row--head { display: none; }
  .eval__pill, .eval__exo { grid-column: 1 / -1; }
  .eval__exo-note { display: none; } /* sur téléphone, on ne garde que le bouton (Q-173) */
  .eval__exo:empty { display: none; }
  .eval__meta { grid-column: 2 / -1; }
  .eval__summary { width: 100%; margin-left: 0; }
  .eval__name { font-size: 22px; }
}

/* ---------------------------------------------------------------- élève · Progression (§4.3, Q-38, Q-67) */
.prog { flex: 1; display: flex; gap: 16px; min-height: 0; margin: -6px 0 -8px; }
.prog__page { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.prog__head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.prog__head h1 { font-size: 40px; line-height: 1.1; }
.prog__count { font-size: 14px; font-style: italic; color: var(--muted); }
.prog__chips { display: none; }
.prog__trail { flex: 1; min-height: 240px; overflow: visible; }
.prog__trail svg { display: block; overflow: visible; }
.prog__note { display: flex; align-items: flex-end; gap: 16px; margin-top: auto; padding-top: 12px; position: sticky; bottom: 8px; z-index: 4; }
.note { backdrop-filter: blur(2px); }
.prog__wizard { width: 176px; max-width: 30vw; height: auto; flex-shrink: 0; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.18)); }
.note { max-width: 560px; padding: 18px 22px; background: var(--card); border: 1.5px solid var(--tan); box-shadow: 4px 4px 0 var(--shadow); transform: rotate(-1deg); }
.note__title { font-family: var(--font-hand); font-size: 24px; font-weight: 700; }
.note__text { font-size: 15px; line-height: 1.55; font-style: italic; margin-top: 4px; }
.note__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.note__actions:empty { display: none; }

/* Sentier */
.trail__path { fill: none; stroke: var(--brown); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 11; }
.trail__path--done { stroke-dasharray: none; stroke-width: 3.5; }
.node { cursor: pointer; outline: none; }
.node--upcoming { cursor: default; }
.node:focus-visible .node__seal, .node:focus-visible .node__here, .node:focus-visible .node__todo { stroke: var(--ink); stroke-width: 3; }
.node__seal { fill: var(--red); }
.node__seal-ring { fill: none; stroke: var(--paper); stroke-width: 1.5; stroke-dasharray: 3 3; }
.node__icon { fill: none; stroke: var(--paper); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.node__icon--here { stroke: var(--brown); stroke-width: 2; }
.node__review-ring { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-dasharray: 5 4; }
.node--review .node__seal { fill: var(--orange); }
.node__here { fill: var(--card); stroke: var(--brown); stroke-width: 3; }
.node__here-ring { fill: none; stroke: var(--brown); stroke-width: 1.5; stroke-dasharray: 6 4; animation: turn 24s linear infinite; }
@keyframes turn { to { transform: rotate(372deg); } }
@media (prefers-reduced-motion: reduce) { .node__here-ring { animation: none; } }
.node__todo { fill: none; stroke: var(--tan); stroke-width: 2.5; stroke-dasharray: 4 4; }
.node__later { fill: var(--dim); stroke: var(--tan); stroke-width: 2.5; stroke-dasharray: 4 4; }
.node__icon--later { stroke: var(--muted); stroke-width: 2; }
.node__label--later { font-size: 20px; fill: var(--muted); font-style: italic; }
.node__label { font-family: var(--font-hand); pointer-events: none; }
.node__label--current { font-size: 23px; font-weight: 700; fill: var(--red); }
.node__label--current .node__here-text { font-size: 17px; font-weight: 500; }
.node__label--upcoming { font-size: 20px; fill: var(--muted); }
.node__ref { font-family: var(--font-hand); font-size: 17px; fill: var(--muted); pointer-events: none; }
.node__ref--current { fill: var(--red); font-weight: 700; font-size: 19px; }
.node__ref--passed, .node__ref--review { fill: var(--ink-2); }
.trail__avatar { pointer-events: none; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.2)); }
.prog.has-modal .prog__note { visibility: hidden; }
.prog__wizard { display: none; }
.note__portrait { float: right; width: 54px; height: 54px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; border: 1.5px solid var(--brown); background: var(--paper); margin: -4px -6px 6px 12px; }

/* Carte d'énigmes (Q-99) : décor par chapitre — couleurs de parchemin, retouchées pour le thème nocturne */
:root { --map-water: #9fc2cf; --map-water-line: #d8ecf2; --map-tree: #8ea38a; --map-tree-line: #5f7a5e; --map-reed: #6f8f6a; --map-mount: #e3d5b6; --map-mount-line: #c9b58c; --map-snow: #fffdf5; --map-hut: #e6d7b8; --map-roof: #8a4b1f; --map-crystal: #9fd8d0; --map-crystal-line: #2f5a53; --map-cave-1: #e2d5b8; --map-cave-2: #d3c39f; --map-cave-3: #c2ad84; --map-island: #d6c79f; --map-potion: #5eead4; --map-cauldron: #3b2a16; }
[data-theme="nocturne"] { --map-water: #2a3f6b; --map-water-line: #4b6aa5; --map-tree: #2d4a52; --map-tree-line: #5eead4; --map-reed: #3f6b6b; --map-mount: #1f1c48; --map-mount-line: #4a4590; --map-snow: #c4c0ea; --map-hut: #3a3670; --map-roof: #5eead4; --map-crystal: #5eead4; --map-crystal-line: #99f6e4; --map-cave-1: #1b1940; --map-cave-2: #221f52; --map-cave-3: #2b2764; --map-island: #26235c; --map-potion: #5eead4; --map-cauldron: #0c0b1f; }
.deco-water { fill: none; stroke: var(--map-water); stroke-width: 34px; stroke-linecap: round; stroke-linejoin: round; opacity: 0.5; }
.deco-water-line { fill: none; stroke: var(--map-water-line); stroke-width: 2.5px; stroke-dasharray: 14 18; opacity: 0.9; }
.deco-tree { fill: var(--map-tree); stroke: var(--map-tree-line); stroke-width: 1px; }
.deco-trunk { fill: var(--brown); }
.deco-reed { fill: none; stroke: var(--map-reed); stroke-width: 1.5px; }
.deco-mount { fill: var(--map-mount); stroke: var(--map-mount-line); }
.deco-snow { fill: var(--map-snow); opacity: 0.85; }
.deco-hut-wall { fill: var(--map-hut); stroke: var(--ink); stroke-width: 1.5px; }
.deco-hut-roof { fill: var(--map-roof); stroke: var(--ink); stroke-width: 1.5px; }
.deco-tower { fill: var(--map-hut); stroke: var(--ink); stroke-width: 1.5px; }
.deco-tower-roof { fill: var(--brown); stroke: var(--ink); stroke-width: 1.5px; }
.deco-window { fill: #fbbf24; }
.deco-crystal { fill: var(--map-crystal); stroke: var(--map-crystal-line); stroke-width: 1px; }
.deco-cave-1 { fill: var(--map-cave-1); }
.deco-cave-2 { fill: var(--map-cave-2); }
.deco-cave-3 { fill: var(--map-cave-3); }
.deco-island { fill: var(--map-island); stroke: var(--tan); }
.map__hint { font-family: var(--font-hand); fill: var(--muted); font-style: italic; pointer-events: none; }
.deco-sprite { pointer-events: none; }
.deco-fond { opacity: 0.9; }
[data-theme="nocturne"] .deco-sprite { filter: brightness(0.55) saturate(0.8) hue-rotate(200deg); }
[data-theme="nocturne"] .trail__avatar { filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.5)); }
.finale { cursor: pointer; outline: none; }
.finale:focus-visible .cauldron__body { stroke: var(--ink); stroke-width: 3px; }
.cauldron__shadow { fill: var(--ink); opacity: 0.18; }
.cauldron__body { fill: var(--map-cauldron); stroke: var(--tan); stroke-width: 1px; }
.cauldron__rim { stroke: var(--map-cauldron); stroke-width: 5px; stroke-linecap: round; }
.cauldron__liquid { fill: var(--muted); stroke: var(--map-cauldron); stroke-width: 2px; opacity: 0.7; }
.cauldron__liquid--ready, .cauldron__liquid--brewed { fill: var(--map-potion); opacity: 1; }
.cauldron__bubble { fill: var(--map-potion); opacity: 0.8; transform-box: fill-box; transform-origin: center; animation: bubble 2.2s ease-in infinite; }
.cauldron__bubble--1 { animation-delay: 0.5s; } .cauldron__bubble--2 { animation-delay: 1.1s; } .cauldron__bubble--3 { animation-delay: 1.6s; }
@keyframes bubble { 0% { transform: translateY(6px) scale(0.6); opacity: 0.9; } 100% { transform: translateY(-16px) scale(1.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cauldron__bubble { animation: none; } }
.finale--ready .cauldron__body { filter: drop-shadow(0 0 6px var(--map-potion)); }
.cauldron__glass { fill: var(--card); stroke: var(--ink); stroke-width: 1.5px; }
.cauldron__potion { fill: var(--map-potion); }
.outcome__scroll { margin: 10px 0 0; padding: 10px 14px; background: var(--paper); border: 1px dashed var(--tan); font-size: 14px; line-height: 1.5; }
.outcome__scroll b { font-family: var(--font-hand); font-size: 22px; }
.rail__grimoire { margin: 0 24px 0 10px; padding: 12px 14px; border: 1.5px solid var(--tan); background: var(--card); cursor: pointer; }
.rail__grimoire:hover, .rail__grimoire:focus-visible { border-color: var(--brown); outline: none; }
.rail__grimoire .rail__grade-title { display: flex; align-items: center; gap: 6px; }
.rail__grimoire svg { color: var(--brown); }
.rail__grim-line { font-size: 12px; color: var(--ink-2); margin-top: 6px; border-top: 1px dashed var(--shadow); padding-top: 6px; }
.grim { list-style: none; margin: 0; padding: 0; }
.grim__btn { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 4px; border: 0; border-bottom: 1px dashed var(--shadow); background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.grim__btn:hover { background: var(--paper); }
.grim__row.is-brewed .grim__btn > span:first-child { font-weight: 600; }
.grim__ok { color: var(--teal-dark); white-space: nowrap; }
.grim__mid { color: var(--muted); white-space: nowrap; }
.grim__off { color: var(--tan); white-space: nowrap; }
.chip--grim { gap: 4px; }
.note.is-pulse { animation: pulse 0.6s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--red); } 100% { box-shadow: 4px 4px 0 var(--shadow); } }
.btn--potion-green svg .liquid { fill: #3f9a6a; }
.btn--potion-blue svg .liquid { fill: #3b7dd8; }
.sel--note { position: relative; display: inline-flex; }
.sel__list--note { position: absolute; left: 0; top: auto; bottom: calc(100% + 6px); z-index: 6; min-width: 320px; box-shadow: 4px 4px 0 var(--shadow); }
.node__self-bg { fill: var(--card); stroke: var(--brown); stroke-width: 1.5; }
.node__stele { fill: var(--red); stroke: var(--ink); stroke-width: 1; }
.node__self-icon { fill: none; stroke: var(--orange-dark); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.node__wave { fill: none; stroke: var(--red); stroke-width: 1.5; transform-origin: center; transform-box: fill-box; animation: wave 2.4s ease-out infinite; opacity: 0; }
.node__wave--2 { animation-delay: 1.2s; }
@keyframes wave { 0% { transform: scale(0.45); opacity: 0.9; } 100% { transform: scale(1.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .node__wave { animation: none; opacity: 0.5; transform: scale(0.8); } }
.node__tip { opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.node:hover .node__tip, .node:focus-visible .node__tip, .node.is-tipped .node__tip { opacity: 1; }
.node__tip-box { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; }
.node__tip-fill { fill: var(--card); }
.node__tip-text { font-family: var(--font-hand); font-size: 19px; font-weight: 700; fill: var(--ink); }

/* Onglets de carnet à droite */
.prog__rail { width: 210px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; margin-right: -40px; padding: 4px 0 0; }
.rail__tabs { display: flex; flex-direction: column; gap: 8px; }
.rail__tab {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-left: 10px; padding: 10px 16px; text-align: left;
  font-family: var(--font-text); font-size: 13px; color: var(--ink-2);
  background: var(--folded); border: 1.5px solid var(--tan); border-right: none; border-radius: 10px 0 0 10px; cursor: pointer;
}
.rail__tab span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__tab svg { flex-shrink: 0; color: var(--brown); }
.rail__tab.is-todo { background: var(--dim); border-style: dashed; color: var(--muted); }
.rail__tab.is-current { margin-left: 0; padding: 12px 16px; background: var(--card); border-color: var(--brown); font-weight: 600; color: var(--ink); }
.rail__tab:hover:not(.is-current) { background: var(--card); }
.rail__grade { margin: auto 24px 0 10px; padding: 14px; border: 1.5px solid var(--tan); background: var(--card); }
.rail__grade-title { font-family: var(--font-hand); font-size: 20px; font-weight: 700; line-height: 1.15; }
.rail__bar { height: 8px; border: 1px solid var(--brown); margin-top: 8px; }
.rail__bar div { height: 100%; background: var(--red); }
.rail__hint { font-size: 12px; color: var(--muted); margin-top: 6px; font-style: italic; }

/* Défi et issue */
.defi__dots { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; }
.defi__dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--tan); background: var(--dim); }
.defi__dot.is-ok { background: var(--teal); border-color: var(--teal); }
.defi__dot.is-ko { background: var(--red); border-color: var(--red); }
.outcome__body { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; }
.outcome__wizard { width: 110px; height: auto; flex-shrink: 0; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.18)); }
.outcome__text { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; }
#outcome-text { white-space: pre-line; }
.outcome__title { font-size: 34px; font-weight: 700; line-height: 1; margin-bottom: 8px; color: var(--brown); }
.outcome--fail .outcome__title { color: var(--red); }
.outcome__xp { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-family: var(--font-hand); font-size: 22px; font-weight: 700; color: var(--red); }
.outcome__xp:empty { display: none; }
.seal { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--red); color: var(--paper); flex-shrink: 0; }

/* ---------------------------------------------------------------- Activité des élèves (Q-45, Q-47) */
.act { display: flex; gap: 16px; flex: 1; min-height: 0; }
.act__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.act__legend { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.act__legend select { width: 240px; }
.act__key { display: inline-flex; align-items: center; gap: 5px; }
.dot--ready { background: var(--teal); }
.dot--work { background: var(--orange); }
.dot--help { background: var(--red); }
.dot--none { background: transparent; border: 1.5px solid var(--tan); }
.act__wrap { max-height: calc(100vh - 220px); }
.table--act { width: auto; min-width: 0; }
.table--act th { position: sticky; top: 0; z-index: 2; background: var(--dim); }
.act__comp-h { width: 260px; min-width: 260px; }
.act__comp { width: 260px; min-width: 260px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0; background: var(--card); z-index: 1; }
.act__comp-h { position: sticky; left: 0; z-index: 3 !important; }
.act__chapter td { background: var(--paper); font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); padding: 6px 8px; position: sticky; left: 0; }
.act__student { cursor: pointer; }
.act__student:hover span { color: var(--brown); text-decoration: underline; }
.act__student.is-current, .act__cell.is-current { background: var(--card-focus); }
.act__cell { width: 36px; min-width: 36px; text-align: center; padding: 6px 0 !important; border-right: 1px solid var(--dim); }
.act__cell .dot { width: 12px; height: 12px; }
.act__side { width: 440px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.act__search { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1.5px solid var(--brown); background: var(--card-focus); font-size: 13px; color: var(--muted); }
.act__search-input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 13px; color: var(--ink); outline: none; padding: 4px 0; }
.act__suggest { position: absolute; left: -1.5px; right: -1.5px; top: calc(100% + 2px); z-index: 5; background: var(--card); border: 1.5px solid var(--tan); box-shadow: 4px 4px 0 var(--shadow); display: flex; flex-direction: column; }
.act__opt { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px; border: 0; border-top: 1px solid var(--dim); background: none; font: inherit; font-size: 13px; color: var(--ink); text-align: left; cursor: pointer; }
.act__opt:first-child { border-top: 0; }
.act__opt:hover { background: var(--dim); }
.act__rows { display: flex; flex-direction: column; max-height: 46vh; overflow: auto; }
.act__row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--dim); font-size: 13px; }
.act__row .dot { width: 12px; height: 12px; flex-shrink: 0; }
.act__row-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act__ok { color: var(--teal-dark); } .act__ko { color: var(--red); } .act__mid { color: var(--orange-dark); }
.act__ok svg, .act__ko svg, .act__mid svg { width: 15px; height: 15px; stroke-width: 3; }
/* Chapitres repliables, résumés, vue « un seul élève » (Q-103) */
.act--solo .act__main { display: none; }
.act--solo .act__side { width: 100%; }
.act--solo .act__rows { max-height: none; }
.act__chev { flex-shrink: 0; margin-right: 6px; transition: transform 0.15s; vertical-align: -1px; }
.act__chev.is-open { transform: rotate(90deg); }
.act__chapter td { cursor: pointer; user-select: none; }
.act__chapter td:hover { color: var(--brown); }
.act__comp-h[data-toggle-all] { cursor: pointer; }
.act__sums { display: inline-flex; align-items: center; gap: 10px; margin-left: 14px; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.act__sums-dots, .act__sums-ev { display: inline-flex; align-items: center; gap: 10px; }
.act__sum { display: inline-flex; align-items: center; gap: 4px; }
/* Résumé de chapitre d'un élève : pastilles à gauche, exercices au centre, évaluations à droite */
.act__sums--student { width: 100%; margin-left: 0; font-size: 13px; }
.act__sums--student .act__sums-dots { gap: 16px; }
.act__sums--student .act__sums-ex { flex: 1; text-align: center; }
.act__sums--student .act__sums-ev { gap: 14px; margin-left: auto; }
.act--solo .act__sums--student { width: auto; gap: 40px; }
.act--solo .act__sums--student .act__sums-dots { gap: 20px; }
.act--solo .act__sums--student .act__sums-ex { flex: none; }
.act--solo .act__sums--student .act__sums-ev { margin-left: 0; gap: 18px; }
.act__sum .dot { width: 10px; height: 10px; }
/* Vue « barres » de la classe (Q-216, maquette C) : bandeau de la classe, tri, un élève par case, couleurs vives */
.act { --act-help: #cf3b2a; --act-work: #ee8a24; --act-ready: #3fae49; --act-track: #f7efdd; }
[data-theme="nocturne"] .act { --act-help: #f87171; --act-work: #fb923c; --act-ready: #4ade80; --act-track: var(--dim); }
.act .dot--ready { background: var(--act-ready); }
.act .dot--work { background: var(--act-work); }
.act .dot--help { background: var(--act-help); }
.act--bars .act__legend > .act__key { display: none; }
.act__bars { display: flex; flex-direction: column; gap: 12px; }
.act__bar { position: relative; display: flex; flex: 1; min-width: 0; height: 12px; background: var(--act-track); box-shadow: inset 0 0 0 1px var(--tan); overflow: hidden; }
.act__bar--class { flex: none; height: 26px; }
.act__bar-seg { height: 100%; }
.act__bar-seg--help { background: var(--act-help); }
.act__bar-seg--work { background: var(--act-work); }
.act__bar-seg--ready { background: var(--act-ready); }
.act__class { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border: 1.5px solid var(--tan); background: var(--card); box-shadow: 4px 4px 0 var(--shadow); }
.act__class-pct { display: flex; flex-direction: column; width: 120px; flex-shrink: 0; }
.act__class-pct span { font-size: 11px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; }
.act__class-pct b { font-family: var(--font-hand); font-size: 34px; line-height: 1; }
.act__class-mid { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.act__class-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.act__class-keys b { color: var(--ink); }
.act__class-alerts { display: flex; flex-direction: column; gap: 2px; width: 200px; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.act__alert { color: var(--act-help); }
.act__bars-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.act__sort { display: inline-flex; align-items: center; gap: 6px; }
.act__sort-btn { font: inherit; font-size: 12px; padding: 3px 10px; border: 1.5px solid var(--tan); background: var(--card); color: var(--ink-2); cursor: pointer; }
.act__sort-btn.is-on { background: var(--brown); border-color: var(--brown); color: var(--on-brown); font-weight: 600; }
.act__cells { display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows), 30px); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; }
.act__cell-bar { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 10px; border: 1px solid var(--dim); background: var(--card); font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.act__cell-bar:hover { border-color: var(--tan); }
.act__cell-bar:hover .act__cell-name { color: var(--brown); text-decoration: underline; }
.act__cell-bar.has-help { box-shadow: inset 3px 0 0 var(--act-help); }
.act__cell-bar.is-current { background: var(--card-focus); border-color: var(--brown); }
.act__cell-name { width: 84px; flex-shrink: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act__cell-pct { width: 46px; flex-shrink: 0; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act__cell-pct.is-old { color: var(--act-help); }
/* jamais connecté (Q-221) : case grisée */
.act__cell-bar.is-never { background: var(--folded); border-color: var(--tan); color: var(--muted); }
.act__cell-bar.is-never .act__cell-pct { font-weight: 400; font-style: italic; }
/* Vue détaillée ouverte (moins de place) : deux colonnes ; téléphone : une */
.act:not(.act--nodetail) .act__cells { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.act:not(.act--nodetail) .act__class { flex-wrap: wrap; row-gap: 8px; }
.act:not(.act--nodetail) .act__class-alerts { width: auto; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; gap: 2px 14px; }
@media (max-width: 700px) {
  .act .act__cells { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: minmax(0, 1fr); }
  .act .act__class { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  .act .act__class-pct { width: auto; flex-direction: row; align-items: baseline; gap: 10px; flex-basis: 100%; }
  .act .act__class-mid { flex-basis: 100%; }
  .act .act__class-alerts { width: auto; flex-basis: 100%; }
}
.act--nodetail .act__side { display: none; }
.act__legend .act__search { margin-left: auto; width: 230px; max-width: 100%; padding: 2px 12px; }
.act__legend .act__search .help { display: none; }
.act__legend .act__search .act__suggest { width: 460px; max-width: calc(100vw - 32px); }
.act--nodetail #act-chapter { margin-left: 0 !important; }
@media (max-width: 600px) { .act__legend .act__search { width: 100%; } }
.act__detail-head { display: flex; align-items: center; gap: 8px; }
.act__detail-head > span { flex: 1; min-width: 0; }
.act__sum svg { width: 13px; height: 13px; stroke-width: 3; }
.act__chap { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 4px; margin-top: 6px; border-bottom: 1.5px solid var(--tan); background: var(--paper); font-size: 13px; cursor: pointer; user-select: none; }
.act__chap:first-child { margin-top: 0; }
.act__chap-head { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.act__chap-title { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.act__chap .act__sums { margin-left: 0; }
.act__chap:hover .act__chap-head { color: var(--brown); }
.act__xp .cell { font-weight: 600; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--dim); font-size: 13px; }
.hist-row__day { width: 64px; flex-shrink: 0; color: var(--muted); }
.hist-row__time { width: 44px; flex-shrink: 0; color: var(--muted); }
.hist-row__what { flex: 1; min-width: 0; }
.hist-row__extra { width: 90px; flex-shrink: 0; color: var(--muted); font-size: 12px; }
.hist-row__res { width: 110px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-align: right; }
.hist-row__res--ok { color: var(--teal-dark); } .hist-row__res--ko { color: var(--red); }

/* ---------------------------------------------------------------- Mail parents (Q-56) */
.mailp { display: flex; gap: 16px; flex: 1; min-height: 0; }
.mailp__side { width: 400px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; }
.mailp__preview { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.mailp__frame, .mbox__frame { flex: 1; min-height: 560px; width: 100%; border: 1.5px solid var(--tan); background: #fbf4e3; }
/* Mail parents : boîte d'envoi (Q-223) — à gauche ce qui part, au centre l'aperçu / le modèle / l'historique */
.mbox { display: flex; gap: 18px; flex: 1; min-height: 0; }
.mbox__side { width: 320px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.mbox--edit .mbox__side { display: none; }
.mbox__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mbox__view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.mbox__label { font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.mbox__items { display: flex; flex-direction: column; gap: 8px; }
.mbox__item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; font: inherit; color: var(--ink); cursor: pointer; border: 1.5px solid var(--tan); background: var(--card); }
.mbox__item:hover { border-color: var(--brown); }
.mbox__item.is-on { border-color: var(--brown); background: var(--card-focus); box-shadow: 3px 3px 0 var(--shadow); }
.mbox__item--link { flex-direction: row; align-items: center; gap: 8px; border-style: dashed; color: var(--brown); }
.mbox__item--link .mbox__item-sub { margin-left: auto; }
.mbox__item-row { display: flex; align-items: center; gap: 8px; }
.mbox__item-title { font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.mbox__item-sub { font-size: 12px; color: var(--muted); }
.mbox__badge { font-size: 11px; padding: 1px 7px; border: 1px solid var(--teal); color: var(--teal-dark); white-space: nowrap; }
.mbox__badge.is-todo { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.mbox__badge.is-sent { border-color: #9bd3a9; background: #e9f5ea; color: #2f6b35; }
.mbox__badge.is-off { border-color: var(--tan); color: var(--muted); }
.mbox__note { padding: 4px 2px; }
.mbox__settings { margin-top: auto; }
.mbox__settings .card__body { gap: 10px; font-size: 13px; }
.mbox__setting { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.mbox__setting > span:not(.toggle) { min-width: 0; }
.mbox__toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mbox__spacer { flex: 1; }
.mbox__nav { min-width: 34px; padding: 0 8px; }
.mbox__student { width: 280px; min-height: 34px; }
.mbox__sendbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1.5px solid var(--tan); background: var(--card); font-size: 13px; flex-wrap: wrap; }
.mbox__sendbar > svg { flex-shrink: 0; color: var(--teal-dark); }
.mbox__subject { font-size: 13px; color: var(--muted); }
.mbox__subject b { color: var(--ink); font-weight: 600; }
.mbox__err { color: var(--red); }
.mbox__ok { color: #2f6b35; display: inline-flex; align-items: center; gap: 3px; }
.mbox__nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* modèle en blocs */
.mbox__tpl { flex-direction: row; gap: 18px; }
.mbox__tpl-edit { width: 500px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.mbox__tpl-preview { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.mbox__vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.mbox__var { font: inherit; font-size: 12px; padding: 2px 8px; border: 1px solid #9fb4dd; background: #e7eefc; color: #2b4c8c; cursor: pointer; }
.mbox__var:hover { border-color: #2b4c8c; }
.mbox__blocks { display: flex; flex-direction: column; gap: 8px; overflow: auto; max-height: calc(100vh - 340px); padding-right: 4px; }
.mbox__block { display: flex; gap: 8px; padding: 8px 10px; border: 1.5px solid var(--tan); background: var(--card); }
.mbox__block.is-off { background: var(--dim); opacity: 0.7; }
.mbox__block.is-over { border-color: var(--brown); border-style: dashed; }
.mbox__grip { color: var(--tan); cursor: grab; padding-top: 4px; }
.mbox__block-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mbox__block-head { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.mbox__block-head b { flex: 1; min-width: 0; }
.mbox__block-note { font-size: 11px; color: var(--muted); margin-right: 4px; }
.mbox__block-head .icon-btn { width: 26px; height: 26px; }
.mbox__block-head .icon-btn[disabled] { opacity: 0.3; cursor: default; }
.mbox__fields { font-size: 13px; }
.mbox__fields > summary { cursor: pointer; color: var(--brown); font-weight: 600; padding: 2px 0; }
.mbox__fields[open] > summary { margin-bottom: 6px; }
.mbox__field { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.mbox__field-label { font-size: 12px; font-weight: 600; color: var(--brown); }
textarea.mbox__text { width: 100%; min-height: 0; field-sizing: content; max-height: 220px; font-size: 13px; line-height: 1.45; resize: vertical; }
.mbox__scope { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.mbox__scope label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.mbox__tpl-foot { margin-top: auto; padding-top: 6px; border-top: 1.5px dashed var(--tan); }
/* historique */
.mbox__hist { max-height: 46vh; }
.mbox__type { font-size: 11px; padding: 2px 7px; border: 1px solid var(--brown); color: var(--brown); white-space: nowrap; }
.mbox__type--pre_eval { border-color: var(--teal); color: var(--teal-dark); }
.mbox__type--test { border-color: var(--tan); color: var(--muted); }
#hist-table tr.is-current td { background: var(--card-focus); }
.mbox__detail-head { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; }
.mbox__detail-head > span { flex: 1; }
/* Invitations (Q-158) : liste des élèves, ligne de l'aperçu surlignée */
.inv__wrap { overflow: auto; }
.inv__search { display: flex; gap: 8px; }
.inv__search .input { flex: 1; min-width: 0; min-height: 40px; }
.inv__wrap tr[data-id] { cursor: pointer; }
.inv__wrap tr[data-id]:hover td { background: var(--card-focus); }
.inv__wrap tr.is-current td { background: var(--dim); }
.btn.is-busy { opacity: 0.85; cursor: progress; }
.btn.is-busy > svg { display: none; } /* l'icône laisse la place au spinner (Q-187) */
.btn.is-busy::before { content: ''; width: 15px; height: 15px; flex-shrink: 0; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }

/* Assistant IA (Q-74) : brouillons */
.per-comment__row { display: flex; align-items: flex-start; gap: 4px; }
.per-comment__row textarea { flex: 1; }
.per-ai { width: 26px; height: 26px; color: var(--tan); flex-shrink: 0; margin-top: 4px; }
.per-ai:hover { color: var(--brown); }
.per-ai.is-busy svg { animation: spin 1.2s linear infinite; }
.per-draft { flex-direction: column; gap: 6px; padding: 8px 10px; margin-top: 6px; background: var(--paper); border: 1px dashed var(--tan); }
.per-draft__text { font-style: italic; font-size: 13px; color: var(--ink); line-height: 1.4; }
.per-draft__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn--xs { min-height: 26px; padding: 2px 8px; font-size: 11px; }

/* Tableau périodique (Q-85) */
.tp__body { padding: 0; overflow: auto; background: #fff; }
.tp__img { display: block; width: 100%; max-width: 1400px; height: auto; margin: 0 auto; }
.q-tp { margin: 4px 0; }
.show-mobile { display: none; }

/* Entraide (Q-89) : camarades, demande scintillante, notifications */
.comp__help { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--teal-dark); }
.mates { display: flex; flex-direction: column; gap: 8px; }
.mate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 10px; border: 1.5px solid var(--tan); background: var(--card); }
.mate__name { font-family: var(--font-text); font-size: 15px; font-weight: 600; color: var(--teal-dark); background: var(--teal-bg); border: 1.5px solid var(--teal); padding: 8px 14px; cursor: pointer; }
.mate__name:hover:not(:disabled) { background: var(--teal); color: var(--card); }
.mate__name:disabled { cursor: default; }
.mate__status { font-size: 13px; color: var(--muted); font-style: italic; }
.mate.is-asked .mate__name { animation: bob 1.6s ease-in-out infinite; background: linear-gradient(110deg, var(--teal-bg) 40%, #fff8e8 50%, var(--teal-bg) 60%); background-size: 240% 100%; animation: bob 1.6s ease-in-out infinite, shimmer 2.2s linear infinite; }
.mate.is-yes { border-color: var(--teal); }
.mate.is-yes .mate__status { color: var(--teal-dark); font-style: normal; font-weight: 600; }
.mate.is-no .mate__name { opacity: 0.6; }
.mate.is-done { border-color: var(--teal); background: var(--teal-bg); }
.mate.is-done .mate__status { color: var(--teal-dark); font-weight: 600; font-style: normal; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .mate.is-asked .mate__name { animation: none; } }
.notif__body { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; }
.notif__wizard { width: 90px; height: auto; flex-shrink: 0; }
.notif__text { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; }
.notif__title { font-size: 30px; font-weight: 700; line-height: 1.05; margin-bottom: 8px; color: var(--brown); }

/* Indicateur de sauvegarde (spinner / ✓ / ✗) */
@keyframes spin { to { transform: rotate(360deg); } }
.save-state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; min-height: 34px; padding: 4px 12px; border: 1.5px solid var(--brown); background: var(--brown); color: var(--on-brown); }
.save-state[data-state="saving"] { background: var(--card); color: var(--brown); }
.save-state--inline { min-height: 0; padding: 0; border: 0; background: none; color: var(--teal); font-size: 12px; }
.save-state--inline[data-state="saving"] { color: var(--muted); }
.save-state--inline[data-state="error"] { background: none; color: var(--red); }
.save-state[data-state="error"] { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.save-state[data-state="saving"] > svg { display: none; }
.save-state[data-state="saving"]::before { content: ''; width: 12px; height: 12px; border: 2px solid var(--dim); border-top-color: var(--brown); border-radius: 50%; animation: spin 0.9s linear infinite; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--dim); border-top-color: var(--brown); border-radius: 50%; animation: spin 0.9s linear infinite; }

/* Modale (<dialog>) */
.modal { padding: 0; border: 1.5px solid var(--brown); background: var(--card); color: var(--ink); box-shadow: 6px 6px 0 var(--shadow); width: min(1000px, calc(100vw - 32px)); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal:not([open]) { display: none; }
.modal::backdrop { background: rgba(59, 42, 22, 0.45); }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1.5px solid var(--tan); }
.modal__head h2 { font-size: 30px; white-space: nowrap; }
.modal__head .save-state { margin-left: auto; }
.modal__body { flex: 1; min-height: 0; overflow: auto; padding: 14px 24px; display: flex; flex-direction: column; gap: 10px; }
.modal__foot { padding: 12px 24px; border-top: 1.5px solid var(--tan); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal__foot .right { margin-left: auto; display: flex; gap: 8px; }
.ex-next { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; } /* choix du niveau après la réponse (Q-373) */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .right { margin-left: auto; }

/* ---------------------------------------------------------------- chromebook (≤ 1400 px) : la barre prof se resserre */
@media (max-width: 1400px) {
  .topbar--teacher { gap: 12px; padding-left: 16px; padding-right: 16px; }
  .topbar--teacher .tabs { margin-left: 0; }
  .topbar--teacher .tabs a { padding: 8px 10px; font-size: 13px; }
  .topbar--teacher .btn__label { display: none; }
}
/* 8 onglets depuis le Journal (Q-256) : encore un cran plus serré sur chromebook */
@media (max-width: 1320px) {
  .topbar--teacher { gap: 10px; }
  .topbar--teacher .tabs a { padding: 8px 7px; }
  .topbar--teacher .brand__title { font-size: 21px; }
}
.btn--icon { width: 34px; padding: 0; justify-content: center; }
/* Entre 768 et 1049 px, « Prénom · titre · XP » pousse la barre du haut hors de l'écran : on ne garde
   que les XP à côté de l'avatar (Q-185) */
@media (max-width: 1049px) {
  .topbar__status .hide-mobile { display: none; }
}
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .qb { flex-direction: column; }
  .qb__tree { width: auto; }
  .qb__tree .card { max-height: 320px; }
}

/* ---------------------------------------------------------------- smartphone (< 768 px) */
@media (max-width: 767px) {
  h1 { font-size: 30px; }
  .topbar { gap: 10px; padding: 14px 18px 10px; }
  .topbar .tabs { display: none; }
  .brand__title { font-size: 24px; }
  .brand svg { width: 24px; height: 24px; }
  .topbar__status { font-size: 18px; }
  .avatar { width: 32px; height: 32px; font-size: 14px; }
  .bottombar { display: grid; }
  .hide-mobile { display: none; }
  .show-mobile { display: inline; }
  .tp__img { width: auto; max-width: none; min-width: 900px; }
  .chap__head { gap: 10px; padding: 12px 14px; }
  .chap-doc { padding: 6px 8px 6px 0; gap: 2px; }
  .chap-doc__book { width: 36px; height: 43px; }
  .chap-doc__label { display: none; }
  .prog__doc { margin-left: 0; }
  .chap__title { font-size: 21px; }
  .chap__meta { margin-left: 28px; font-size: 12px; }
  .comp { padding: 12px 14px 12px 12px; }
  .comp__row { margin-top: 10px; }
  .comp__head { font-size: 15px; }
  .comp__ref { min-width: 38px; }
  .sel__btn { min-height: 40px; }
  /* la chaîne occupe sa propre ligne, alignée à droite au-dessus de « S'exercer » (Q-172) */
  /* téléphone : pas de colonne ; la pastille reprend sa place à côté des verdicts (Q-182) */
  /* Téléphone (Q-187) : verdicts + pastille sur une ligne, aide + « S'exercer » sur la suivante.
     Le ::after à 100 % force le retour à la ligne entre les deux groupes (order 0 puis order 2). */
  .comp__zone { display: contents; }
  .comp__row::after { content: ''; flex-basis: 100%; height: 0; order: 1; }
  .comp__vds, .comp__arrow, .comp__row .sel, .comp__row .btn--help { order: 0; }
  .comp__tools, .comp__ex, .comp__exw { order: 2; }
  .comp__tools:empty { display: none; }
  .comp__row .sel, .comp__row .btn--help { width: auto; flex: 1 1 130px; max-width: 224px; } /* la pastille et le bouton d'entraide restent sur la ligne des verdicts (Q-188) */
  .comp__arrow { width: 20px; }
  .sel__btn { padding: 6px 10px; }
  .comp::before { width: 140px; } /* liseré plus court : la ligne est étroite */
  .sel__list { left: auto; right: 0; min-width: 300px; max-width: calc(100vw - 60px); }
  .comp__row .btn { min-height: 40px; }
  .comp__ex-icon { display: none; } /* pas de symbole sur le bouton S'exercer en mobile */
  .comp__ex { flex-shrink: 0; }
  .btn__label, .btn__long { display: none; }
  /* … sauf le bouton d'entraide, qui serait vide sans son libelle (Q-188) */
  .comp__row .btn--help .btn__label { display: inline; }
  .btn__short { display: inline; }
}
@media (max-width: 767px) {
  /* Petites modales sur téléphone (Q-122, Q-128, Q-132) : la <dialog> couvre tout l'écran, transparente, et centre
     elle-même ses enfants (en-tête / corps / pied, parfois dans un <form>) qui forment la boîte — aucun navigateur
     n'a plus à centrer la boîte lui-même (Safari iOS la laissait au milieu de la page ou derrière la barre d'adresse). */
  .modal[open]:not(.modal--full) { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 16px; box-sizing: border-box; border: 0; border-radius: 0; background: transparent; box-shadow: none; display: flex; flex-direction: column; justify-content: center; align-items: stretch; }
  .modal:not(.modal--full) > form { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
  .modal:not(.modal--full) > .modal__head, .modal:not(.modal--full) > .modal__body, .modal:not(.modal--full) > .modal__foot, .modal:not(.modal--full) > form > * { background: var(--card); flex-shrink: 0; border-left: 1.5px solid var(--brown); border-right: 1.5px solid var(--brown); }
  .modal:not(.modal--full) > :first-child, .modal:not(.modal--full) > form > :first-child { border-top: 1.5px solid var(--brown); border-radius: 12px 12px 0 0; }
  .modal:not(.modal--full) > :last-child, .modal:not(.modal--full) > form > :last-child { border-bottom: 1.5px solid var(--brown); border-radius: 0 0 12px 12px; box-shadow: 5px 5px 0 var(--shadow); }
  .modal:not(.modal--full) > form { border: 0; border-radius: 12px; background: transparent; }
  .modal:not(.modal--full) > form > :last-child { box-shadow: none; }
  .modal:not(.modal--full) .modal__body { flex: 0 1 auto; min-height: 0; max-height: 60dvh; overflow: auto; padding: 12px 16px 16px; }
  .modal:not(.modal--full) .modal__head { padding: 12px 16px; }
  .modal:not(.modal--full) .modal__head h2 { font-size: 24px; }
  /* notifications élève : un seul bloc, sans en-tête ni pied → il porte lui-même le fond et le bord (Q-210) */
  .modal.notif > .notif__body { background: var(--card); border: 1.5px solid var(--brown); min-height: 0; overflow: auto; }
}
@media (max-width: 430px) {
  /* pas la place du libellé complet à côté des verdicts : « Prêt pr l'éval » (Q-187) */
  .sel__label:not(.sel__label--tiny) { display: none; }
  .sel__label--tiny { display: block; }
}
@media (max-width: 400px) {
  /* la chaîne occupe toute la ligne (Q-172) : la pastille garde sa flèche et son libellé entier */
  .comp__zone .sel, .comp__zone .btn--help { max-width: 100%; }
}
@media (max-width: 767px) {
  .modal--full .modal__body { padding: 12px 14px; }
  .page { padding: 14px; gap: 10px; }
  .btn { min-height: 44px; }

  .act, .mailp, .mbox, .mbox__tpl { flex-direction: column; }
  .act__side, .mailp__side, .mbox__side, .mbox__tpl-edit { width: auto; }
  .mbox__student { width: auto; flex: 1; min-width: 0; }
  .mbox__blocks { max-height: none; }
  .act__wrap { max-height: 60vh; }
  .act__comp, .act__comp-h { width: 160px; min-width: 160px; max-width: 160px; }
  .mailp__frame, .mbox__frame { min-height: 480px; }
  .hist-row { flex-wrap: wrap; gap: 4px 10px; }
  .hist-row__what { flex-basis: 100%; }

  /* Progression : chapitres en pastilles, note du maître avant le sentier, pas d'onglets à droite */
  .prog { flex-direction: column; gap: 8px; margin: 0; }
  .prog__rail { display: none; }
  .prog__head { gap: 4px; }
  .prog__head h1 { font-size: 28px; }
  .prog__count { font-size: 12px; }
  .prog__chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px 6px; order: -1; }
  .prog__chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font-family: var(--font-text); font-size: 13px; color: var(--ink-2); background: var(--folded); border: 1.5px solid var(--tan); cursor: pointer; }
  .chip svg { color: var(--brown); }
  .chip.is-todo { background: var(--dim); border-style: dashed; color: var(--muted); }
  .chip.is-current { background: var(--card); border-color: var(--brown); font-weight: 600; color: var(--ink); }
  .prog__note { order: 0; margin: 4px 0 0; padding-top: 0; gap: 8px; }
  .prog__trail { order: 1; min-height: 0; }
  .prog__wizard { width: 84px; }
  .note { transform: none; padding: 12px 14px; flex: 1; min-width: 0; }
  .note__portrait { width: 40px; height: 40px; margin: -2px -4px 4px 8px; }
  .deco-water { stroke-width: 26px; }
  .note__title { font-size: 20px; }
  .note__text { font-size: 13px; line-height: 1.45; margin-top: 2px; }
  .note__actions { gap: 8px; margin-top: 10px; }
  .note__actions .btn--primary { flex: 1; }
  .node__label--current { font-size: 20px; }
  .node__label--upcoming { font-size: 18px; }
  .outcome__body { padding: 16px; gap: 12px; }
  .outcome__wizard { width: 72px; }
  .notif__wizard { width: 56px; }
  .notif__body { padding: 16px; gap: 12px; }
  .notif__title { font-size: 26px; }
  .outcome__title { font-size: 28px; }

  .topbar--teacher { flex-wrap: wrap; padding: 10px 14px 0; gap: 8px; align-items: center; }
  .topbar--teacher .tabs { display: flex; order: 3; width: 100%; margin: 0; }
  .topbar--teacher .topbar__right { padding-bottom: 0; }
  .teacher .page { padding: 14px; }
  .modal__head { padding: 12px 14px; }
  .modal__head h2 { font-size: 24px; }
  .modal__body, .modal__foot { padding: 10px 14px; }
  /* exercices : les deux choix de niveau (Q-373) sur leur ligne, pleine largeur, sous « Arrêter » */
  #exercise-modal .modal__foot .right { flex-wrap: wrap; justify-content: flex-end; align-items: center; }
  #exercise-modal .ex-next { width: 100%; flex-wrap: nowrap; }
  #exercise-modal .ex-next .btn { flex: 1 1 0; justify-content: center; padding-left: 8px; padding-right: 8px; }
  /* modale question : titre sur sa ligne, navigation + onglets en dessous */
  #q-modal .modal__head { flex-wrap: wrap; gap: 6px 10px; }
  #q-modal .modal__head h2 { font-size: 20px !important; white-space: normal; flex: 1 1 200px; order: -1; }
  #q-modal .modal__head [data-modal-close] { order: -1; }
  #q-modal .qtabs { margin-left: 0; overflow-x: auto; max-width: 100%; }
  .question__text img, .q-matching__q img { max-height: 220px; }
  .q-choice img { max-height: 120px; }
}

/* Éléments cliquables de l'énoncé liés à une réponse ([data-choice], Q-119) */
.q-pick { cursor: pointer; border: 2px solid transparent; border-radius: 8px; padding: 4px; transition: border-color 0.15s, background 0.15s; }
.q-pick:hover:not(.is-locked) { border-color: var(--tan); }
.q-pick.is-selected { border-color: var(--brown); background: var(--card-focus); }
.q-pick.is-ok { border-color: var(--teal); background: rgba(47, 133, 90, 0.08); }
.q-pick.is-ko { border-color: var(--red); background: rgba(197, 48, 48, 0.06); }
.q-pick.is-expected { border-color: var(--teal); border-style: dashed; }
.q-pick.is-locked { cursor: default; }
.q-pick:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
/* croix « éliminer » sur chaque figure : la figure éliminée est grisée et barrée, sa réponse aussi (Q-156) */
.q-pick { position: relative; }
.q-pick__x { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 1.5px solid var(--brown); background: var(--card); color: var(--brown); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0.8; z-index: 1; }
.q-pick__x:hover, .q-pick__x:focus-visible { opacity: 1; background: var(--red); border-color: var(--red); color: #fff; outline: none; }
.q-pick.is-out > :not(.q-pick__x) { opacity: 0.35; filter: grayscale(1); }
.q-pick.is-out::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top right, transparent calc(50% - 1.5px), var(--red) calc(50% - 1.5px), var(--red) calc(50% + 1.5px), transparent calc(50% + 1.5px)); }
.q-pick.is-out .q-pick__x { opacity: 1; background: var(--red); border-color: var(--red); color: #fff; }
.q-pick.is-locked .q-pick__x { display: none; }
.q-choice.is-out { opacity: 0.45; }
.q-choice.is-out span { text-decoration: line-through; }

/* Partie de l'énoncé à afficher sur demande (details/summary, sans JS) : « fais-le au brouillon, puis affiche » (Q-153) */
.q-reveal { margin: 10px 0; }
.q-reveal > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1.5px solid var(--brown); border-radius: 8px; background: var(--brown); color: var(--on-brown); font-weight: 600; font-size: 14px; cursor: pointer; user-select: none; }
.q-reveal > summary::-webkit-details-marker { display: none; }
.q-reveal > summary:hover { filter: brightness(1.1); }
.q-reveal > summary:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
.q-reveal[open] > summary { display: none; }

/* Menu « Voir comme un élève » : ligne élève + bouton « à zéro » (admin) */
.menu__row { display: flex; align-items: stretch; border-bottom: 1px dashed var(--tan); }
.menu__row form:first-child { flex: 1; }
.menu__row button { border-bottom: 0; }
.menu__panel .menu__aside { width: auto; font-size: 12px; color: var(--ink-2); padding: 8px 12px; border-left: 1px dashed var(--tan); }
.menu__panel .menu__aside:hover { color: #b3261e; }

/* Pied de page « Créé par … » (en blanc, discret) */
.credit { margin-top: auto; text-align: right; color: var(--ink); font-size: 12px; padding: 22px 0 8px; }
.credit a { color: #ab5b5b; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.credit a:hover { text-decoration-style: solid; }
.auth .credit { width: 100%; text-align: center; margin-top: 0; }
@media (max-width: 767px) { .credit { text-align: center; } }

/* Statistiques (Q-146) */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; }
.stat__n { font-family: var(--font-hand); font-size: 38px; line-height: 1; color: var(--brown); }
.stat__l { margin-top: 6px; font-size: 14px; line-height: 1.3; }
/* infobulle « qui ? » des cases en ligne / aujourd'hui (Q-244) : au survol ou au focus (clavier, toucher) */
.exos-intro { display: flex; align-items: flex-start; gap: 12px; }   /* demandes d'exercices : texte + « Copier pour Claude » (Q-247) */
.exos-intro .btn { flex-shrink: 0; }
.msel { position: relative; }   /* sélecteur à choix multiples (chapitres de l'évaluation, Q-251) */
.msel__sum { display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; cursor: pointer; min-height: 34px; padding: 4px 10px; border: 1.5px solid var(--tan); background: var(--card-focus); font-size: 14px; }
.msel__sum::-webkit-details-marker { display: none; }
.msel__panel { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px); max-height: 260px; overflow: auto; background: var(--card); border: 1.5px solid var(--brown); box-shadow: 3px 3px 0 var(--tan); padding: 4px 0; }
.msel__opt { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.msel__opt:hover { background: var(--m-hl); }
.eval-rank { width: 44px; text-align: center; }
#eval-comps tbody tr[data-k] { cursor: pointer; }
/* « sur papier » (Q-251) : le bouton lui-même est un parchemin — feuille claire, deux rouleaux aux extrémités */
.qrow--paper, .qrow__sub .is-paper { background: var(--parch); }
.qrow__pc { width: 24px; height: 24px; margin-right: 4px; }
.btn.is-paper, .icon-btn.is-on[data-paper], .icon-btn.is-on[data-pcrit] {
  position: relative; margin: 0 7px; border: 1px solid var(--parch-edge); border-radius: 1px;
  background: linear-gradient(180deg, var(--parch) 0%, var(--parch) 55%, var(--parch-2) 100%); color: var(--parch-ink);
  box-shadow: inset 0 0 6px rgba(150, 120, 60, 0.12);
}
.btn.is-paper::before, .btn.is-paper::after,
.icon-btn.is-on[data-paper]::before, .icon-btn.is-on[data-paper]::after,
.icon-btn.is-on[data-pcrit]::before, .icon-btn.is-on[data-pcrit]::after {
  content: ''; position: absolute; top: -4px; bottom: -4px; width: 7px; border: 1px solid var(--parch-edge); border-radius: 3px;
  background: linear-gradient(90deg, var(--parch-2) 0%, var(--parch) 45%, var(--parch-roll) 100%);
}
.btn.is-paper::before, .icon-btn.is-on[data-paper]::before, .icon-btn.is-on[data-pcrit]::before { left: -7px; }
.btn.is-paper::after, .icon-btn.is-on[data-paper]::after, .icon-btn.is-on[data-pcrit]::after { right: -7px; }
.btn.is-paper:hover, .icon-btn.is-on[data-paper]:hover, .icon-btn.is-on[data-pcrit]:hover { background: var(--parch); color: var(--parch-ink); filter: brightness(0.98); }
.icon-btn.is-on[data-paper], .icon-btn.is-on[data-pcrit] { height: 22px; }
.stat--tip { position: relative; cursor: help; }
.stat__tip { display: none; position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: max-content; min-width: 100%; max-width: min(380px, calc(100vw - 32px)); max-height: 340px; overflow-y: auto; padding: 8px 12px 10px; background: var(--card); border: 1.5px solid var(--brown); box-shadow: 3px 3px 0 var(--tan); font-size: 13.5px; line-height: 1.35; }
.stat--tip:hover .stat__tip, .stat--tip:focus-within .stat__tip { display: block; }
.stat__tip-head { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.stat__tip ul { margin: 0; padding-left: 18px; }
.stat__tip li { margin: 2px 0; }
.stats-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.bars__stack { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bars__bar { width: 45%; background: var(--brown); border-radius: 3px 3px 0 0; min-height: 1px; }
.bars__bar--light { background: var(--tan); }
.bars--hours .bars__bar { width: 80%; }
.bars__n { font-size: 11px; color: var(--muted); line-height: 1.2; }
.bars__x { font-size: 10px; color: var(--muted); line-height: 1.2; white-space: nowrap; }
.hbar { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.hbar__track { height: 10px; background: var(--dim); border-radius: 5px; overflow: hidden; }
.hbar__fill { display: block; height: 100%; background: var(--teal); }
.hbar__n { text-align: right; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------- rappel des présences (Q-200) */
.modal.presences--alarme { width: min(480px, calc(100vw - 32px)); border: 3px solid var(--orange); box-shadow: 0 30px 90px -20px var(--orange); }
.modal.presences--alarme::backdrop { background: rgba(16, 20, 28, .82); backdrop-filter: blur(3px); }
.presences__corps { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 24px 24px; text-align: center; }
.presences__cloche { color: var(--orange); animation: presences-cloche 1s ease-in-out infinite; }
@keyframes presences-cloche { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.presences__titre { font-size: 34px; line-height: 1.1; color: var(--brown); }
.presences__corps p { margin: 0 0 6px; font-size: 16px; }
.presences__ok { min-height: 56px; font-size: 17px; padding: 12px 24px; white-space: normal; animation: presences-pouls 1.2s ease-in-out infinite; }
@keyframes presences-pouls { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }
.presences__liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.presences__liste button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--tan); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.presences__liste button:hover:not([disabled]) { border-color: var(--brown); background: var(--card-focus); }
.presences__liste button[disabled] { cursor: default; color: var(--muted); }
.presences__liste li.is-courant button { border-color: var(--brown); border-width: 2px; font-weight: 600; }
.presences__liste li.is-choisi button { background: var(--teal-bg); border-color: var(--teal); }
.presences__heure { width: 118px; white-space: nowrap; flex: none; font-variant-numeric: tabular-nums; color: var(--muted); }
.presences__nom { flex: 1; }
.presences__maintenant { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--on-brown); background: var(--brown); padding: 2px 8px; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .presences__cloche, .presences__ok { animation: none; } }
/* Réponse du prof à un signalement (Q-210) */
.q-report__reply { flex: 1 1 100%; margin-left: 12px; padding: 6px 10px; border-left: 3px solid var(--teal); background: var(--card); font-size: 14px; }
.q-report__reply-who { display: block; font-size: 12px; color: var(--muted); }
.q-report__reply img { display: block; max-width: 220px; max-height: 160px; margin-top: 6px; border: 1px solid var(--tan); }
.q-reply { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1.5px solid var(--tan); background: var(--card); }
.q-reply textarea { width: 100%; resize: vertical; }
.q-reply__img { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.q-reply__img:empty { display: none; }
.q-reply__img img { max-width: 260px; max-height: 180px; border: 1px solid var(--tan); }
.q-reply__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-reply__actions .right { flex: 1; }
.q-reply .help { margin: 0; }
/* Réponse du prof dans la notification de l'élève */
.notif-reply { margin: 10px 0 0; padding: 8px 12px; border-left: 3px solid var(--teal); background: var(--card); }
.notif-reply img { display: block; max-width: 100%; max-height: 50vh; margin-top: 8px; border: 1px solid var(--tan); }
/* Évaluation écrite (Q-211) : lien vers la feuille dans l'Encodage, badge et aperçu des questions papier dans la banque */
.enc-paper { display: inline-block; margin: 2px 0; font-size: 12px; color: var(--teal-dark); text-decoration: underline; }
.enc-online { display: block; font-size: 12px; color: var(--muted); }
.enc-links { display: grid; grid-template-columns: auto 1fr; gap: 1px 6px; margin: 4px 0; font-size: 12px; align-items: baseline; }
.enc-links__k { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.enc-links .enc-paper { margin: 0; }
.badge--eval { background: #e8eefb; border-color: #2b6cb0; color: #2b6cb0; }
.question--paper .pq { display: flex; gap: 16px; }
.question--paper .pq--col { flex-direction: column; }
.question--paper .pq--row .pq-main { flex: 1; min-width: 0; }
.question--paper .pq-figure--below, .question--paper .pq-figure--above { align-self: center; }
.question--paper .pq-figure svg { max-width: 320px; height: auto; }
.question--paper .pq-line { display: flex; align-items: baseline; gap: 4px; }
.question--paper .pq-dots { flex: 1; min-width: 120px; border-bottom: 1px dotted var(--muted); height: 1em; }
.question--paper .pq-space { border: 1px dashed var(--tan); }
.question--paper .pq-answer { color: #c53030; }
/* Paramètres, cours : colonne des groupes étroite, pour que chaque switch tienne sur une ligne (Q-223) */
.courses__groups { max-width: 220px; min-width: 120px; white-space: normal; line-height: 1.35; }
/* Encodage : mail parents avant l'évaluation, en bas à droite de la case (Q-223) */
.enc-premail { display: flex; justify-content: flex-end; margin-top: 8px; }
.enc-premail__chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; font-size: 11px; line-height: 1.3; color: var(--teal-dark); border: 1px solid var(--teal); background: var(--card-focus); text-decoration: none; white-space: nowrap; }
.enc-premail__chip:hover { border-color: var(--teal-dark); }
.enc-premail__chip.is-sent { color: #2f6b35; border-color: #9bd3a9; background: #e9f5ea; }
.enc-premail__btn { min-height: 26px; padding: 2px 9px; font-size: 11.5px; gap: 5px; }
/* demandes « plus d'exos » (Q-235) */
.exos-req { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1.5px solid var(--tan); background: var(--card); }
.exos-req__act { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
button.bug-badge { cursor: pointer; font-family: inherit; }

/* ============================================================================
   Journal de classe (Q-256, JOURNAL-DE-CLASSE.md, maquettes design/gen_jdc.py)
   ========================================================================== */
.jdc { display: flex; flex-direction: column; gap: 14px; }
.jdc-top { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
/* largeur du titre le plus long (« Mercredi 30 septembre », « Semaine du lundi 28 septembre ») : les flèches ne bougent pas d'un jour à l'autre */
@media (min-width: 768px) {
  .jdc-top__title { min-width: 310px; }
  .jdc-top__title.is-week { min-width: 410px; }
}
.jdc-kicker { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.jdc-title { margin: 0; font-family: var(--font-hand); font-size: 38px; line-height: 1; }
.jdc-subtitle { margin: 6px 0 0; font-family: var(--font-hand); font-size: 26px; line-height: 1; color: var(--brown); }
.jdc-switch { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.jdc-switch .seg { border-color: var(--brown); }
.jdc-switch .seg a { padding: 6px 14px; font-size: 13px; color: var(--brown); background: var(--card); text-decoration: none; }
.jdc-switch .seg a[aria-current="page"] { background: var(--brown); color: var(--on-brown); font-weight: 600; }
.jdc-lasttoggle { border-color: var(--brown); color: var(--brown); }
.jdc-lasttoggle[aria-pressed="true"] { background: var(--brown); color: var(--on-brown); }
.jdc-nav { display: flex; gap: 8px; align-items: center; }
.jdc--roue .jdc-nav { margin-left: auto; }
.jdc-roue-ic { color: var(--brown); align-self: center; }
.jdc-body { display: flex; gap: 20px; align-items: flex-start; }
.jdc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.jdc-side { width: 300px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.jdc-off { padding: 18px; display: flex; gap: 10px; align-items: center; color: var(--muted); }
.jdc-banner { border-color: var(--orange); background: #fbe9d6; align-items: center; }
.jdc-banner > svg { color: var(--orange); }
.jdc-banner > span { flex: 1; }

/* carte d'une séance */
.jdc-seance { background: var(--card); border: 1.5px solid var(--tan); box-shadow: 4px 4px 0 var(--shadow); }
.jdc-seance.is-now { background: var(--folded); border-color: var(--brown); }
.jdc-seance.is-incomplete { border-color: var(--orange); }
.jdc-seance.is-cancelled { opacity: .7; }
.jdc-seance__head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; border-bottom: 1.5px solid var(--dim); }
.jdc-h { font-family: var(--font-hand); font-weight: 700; font-size: 24px; line-height: 1; color: var(--brown); }
.jdc-seance__group { font-size: 15px; }
.jdc-seance__mark { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.jdc-ok { color: var(--teal); display: inline-flex; }
.jdc-todo { background: var(--orange); border-color: var(--orange); color: #fff8e8; gap: 4px; }
.jdc-seance__menu > summary { list-style: none; }
.jdc-seance__menu > summary::-webkit-details-marker { display: none; }
.jdc-seance__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.jdc-show-last .jdc-seance__cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.jdc-seance__cols.is-single { grid-template-columns: minmax(0, 1fr); }
.jdc-col { padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.jdc-col + .jdc-col { border-left: 1.5px solid var(--dim); }
.jdc-col--last { display: none; background: rgba(239, 228, 204, .45); }
.jdc-show-last .jdc-col--last { display: flex; }
.jdc-label { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.jdc-when { font-size: 12px; color: var(--muted); font-weight: 600; }
.jdc-text { font-size: 14px; line-height: 1.4; }
.jdc-empty { font-size: 13px; font-style: italic; color: var(--muted); }
.jdc-prep { display: flex; flex-direction: column; gap: 5px; padding-bottom: 8px; border-bottom: 1.5px dashed var(--dim); }
.jdc-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.35; }
.jdc-line > svg { flex-shrink: 0; margin-top: 2px; }
.jdc-line > span { flex: 1; min-width: 0; }
.jdc-line.is-eval, .jdc-item.is-eval > svg, .jdc-annonce__ic.is-eval { color: var(--red); }
.jdc-field { display: flex; gap: 6px; align-items: flex-start; }
.jdc-done { flex: 1; min-width: 0; resize: none; overflow: hidden; min-height: 36px; padding: 7px 10px; border: 1.5px dashed var(--tan); background: transparent; font: inherit; font-size: 14px; line-height: 1.4; color: var(--ink); }
.jdc-done:focus { outline: none; border-style: solid; border-color: var(--brown); background: #fff; box-shadow: 0 0 0 3px var(--dim); }
.jdc-done:not(:placeholder-shown) { border-color: transparent; padding-left: 0; }
.jdc-done:not(:placeholder-shown):focus { border-color: var(--brown); padding-left: 10px; }
.jdc-done::placeholder { font-style: italic; color: var(--muted); }
.jdc-mic { width: 32px; height: 32px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--tan); background: var(--card); color: var(--brown); cursor: pointer; }
.jdc-mic.is-listening { background: var(--red); border-color: var(--red); color: #fff8e8; }
.jdc-items { display: flex; flex-direction: column; gap: 6px; }
.jdc-items:empty { display: none; }
.jdc-item { display: flex; gap: 8px; align-items: flex-start; }
.jdc-item > svg { flex-shrink: 0; margin-top: 7px; }
.jdc-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.jdc-item__text, .jdc-add__text { width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1.5px solid transparent; border-bottom: 1.5px dashed var(--tan); background: transparent; font: inherit; font-size: 14px; color: var(--ink); }
.jdc-item__text:focus, .jdc-add__text:focus { outline: none; border: 1.5px solid var(--brown); background: #fff; }
.jdc-item__meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.jdc-item__due, .jdc-add__due { padding: 2px 4px; border: 1.5px solid var(--dim); background: var(--card); font: inherit; font-size: 12px; color: var(--muted); max-width: 100%; }
.jdc-vis { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; border: 1.5px solid var(--teal); background: var(--card); color: var(--teal-dark); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.jdc-vis.is-private { border-color: var(--muted); background: var(--dim); color: var(--muted); }
.jdc-item__del { width: 28px; height: 28px; }
.jdc-add { display: flex; flex-direction: column; gap: 4px; }
.jdc-add__text { border-bottom-style: dotted; }
.jdc-add__eval { font-size: 12px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.jdc-nothing { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.jdc-annonces { margin: 0 14px 14px; padding: 10px 14px 4px; background: #fbe9d6; border: 1.5px solid var(--orange); display: flex; flex-direction: column; }
.jdc-annonces > .jdc-label { color: var(--orange-dark); padding-bottom: 6px; }
.jdc-annonce { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1.5px dashed #f0cfae; font-size: 14px; }
.jdc-annonce__txt { flex: 1; min-width: 0; }
.jdc-annonce label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; }
.jdc-annonce input[type="checkbox"], .jdc-task input[type="checkbox"], .jdc-nothing input, .jdc-add__eval input { accent-color: var(--brown); width: 18px; height: 18px; margin: 0; }

/* colonne de droite */
.jdc-panel { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.jdc-panel__title { margin: 0; display: flex; align-items: center; gap: 8px; font-family: var(--font-hand); font-size: 24px; font-weight: 700; line-height: 1; }
.jdc-panel__title svg { color: var(--brown); }
.jdc-tasks { display: flex; flex-direction: column; gap: 6px; }
/* même liseré en dégradé que l'autoévaluation des élèves (Q-172) : rouge = en retard, orange = dans les 3 jours (Q-263) */
.jdc-task { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px 8px 14px; background: var(--card); border: 1.5px solid var(--dim); font-size: 13.5px; line-height: 1.3; cursor: pointer; transition: opacity .3s;
  --task-line: var(--shadow); --task-veil: rgba(217, 199, 162, 0.28); }
.jdc-task::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 180px; max-width: 100%; pointer-events: none;
  background: linear-gradient(90deg, var(--task-line) 0, var(--task-line) 5px, var(--task-veil) 6px, transparent 100%); }
.jdc-task > * { position: relative; }
.jdc-task__main { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.jdc-task__date { flex-shrink: 0; display: inline-flex; align-items: center; }
.jdc-task__date .input { width: 132px; }
.jdc-task__cal { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--tan); background: var(--card); color: var(--brown); cursor: pointer; }
.jdc-task__cal:hover { border-color: var(--brown); }
.jdc-task.lvl-2 { --task-line: var(--orange); --task-veil: rgba(201, 113, 63, 0.22); }
.jdc-task.lvl-2 b { color: var(--orange-dark); }
.jdc-task.lvl-3 { --task-line: var(--red); --task-veil: rgba(179, 64, 47, 0.20); }
.jdc-task.lvl-3 b { color: var(--red); }
.jdc-later > summary { list-style: none; display: inline-flex; }
.jdc-later > summary::-webkit-details-marker { display: none; }
.jdc-later[open] > summary { margin-bottom: 6px; }
.jdc-task.is-done { opacity: .3; text-decoration: line-through; }
.jdc-miniform { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.jdc-miniform > .input:first-child { flex: 1 1 100%; }
.jdc-miniform .input { min-width: 0; flex: 1; }
.jdc-miniform input[type="date"] { flex: 1 1 auto; }
.jdc-miniform--col { flex-direction: column; align-items: stretch; margin-top: 8px; }
.jdc-miniform__row { display: flex; gap: 6px; }
.jdc-more > summary { list-style: none; display: inline-flex; }
.jdc-more > summary::-webkit-details-marker { display: none; }

/* Ma semaine */
.jdc-week { display: grid; grid-template-columns: 44px repeat(var(--days), minmax(0, 1fr)); grid-auto-rows: minmax(58px, auto); gap: 6px; }
.jdc-week__day { padding: 6px 8px; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; }
.jdc-week__day a { color: var(--muted); text-decoration: none; }
.jdc-week__day.is-today { border-bottom-color: var(--brown); }
.jdc-week__ev { margin-top: 4px; padding: 2px 6px; font-size: 11.5px; font-weight: 400; line-height: 1.25; color: var(--teal-dark); background: var(--teal-bg); border-radius: 5px; }
.jdc-events { padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; color: var(--teal-dark); background: var(--teal-bg); }
.jdc-week__day.is-today a { color: var(--ink); }
.jdc-week__h { font-family: var(--font-hand); font-weight: 700; font-size: 20px; color: var(--brown); text-align: right; padding: 6px 4px; grid-column: 1; }
.jdc-week__off { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; font-size: 13px; color: var(--muted); border: 1.5px dashed var(--tan); background: repeating-linear-gradient(135deg, var(--dim) 0 8px, transparent 8px 16px); }
.jdc-week__cell { background: var(--card); border: 1.5px solid var(--dim); border-left: 5px solid var(--tan); padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; box-shadow: 2px 2px 0 var(--shadow); min-width: 0; }
.jdc-week__cell.is-empty { background: none; border: 1.5px dashed var(--dim); box-shadow: none; }
.jdc-week__cell.is-ok { border-left-color: var(--teal); }
.jdc-week__cell.is-warn { border-left-color: var(--orange); }
.jdc-week__cell.is-now { background: var(--folded); border-left-color: var(--brown); }
.jdc-week__cell.is-target { outline: 2px dashed var(--brown); outline-offset: 1px; }
.jdc-week__cell.is-over { background: var(--dim); }
.jdc-week__head { display: flex; align-items: center; gap: 5px; font-size: 14px; min-width: 0; }
.jdc-week__head .muted { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jdc-week__mark { margin-left: auto; display: inline-flex; }
.is-ok .jdc-week__mark { color: var(--teal); }
.is-warn .jdc-week__mark { color: var(--orange); }
.jdc-week__txt { font-size: 12px; line-height: 1.3; }
.jdc-editable { cursor: default; user-select: none; }
.jdc-alert { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.jdc-alert > span { flex: 1; }
.jdc-alert:hover { border-color: var(--brown); }
/* « pas encore écrite » : rouge, avec un halo qui apparaît et disparaît (Q-321) */
.jdc-unwritten { color: var(--red); font-weight: 600; animation: jdc-unwritten 1.6s ease-in-out infinite; }
@keyframes jdc-unwritten { 0%, 100% { text-shadow: 0 0 0 transparent; } 50% { text-shadow: 0 0 6px var(--red), 0 0 12px rgba(179, 64, 47, 0.6); } }
@media (prefers-reduced-motion: reduce) { .jdc-unwritten { animation: none; } }
.jdc-evbadge { align-self: flex-start; display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; background: var(--red); color: #fff8e8; font-size: 11px; font-weight: 600; cursor: grab; }
.jdc-legend { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.jdc-legend > svg:first-child { color: var(--teal); }

/* côté élève */
.jdc-eleve { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.jdc-eleve__done { display: flex; flex-direction: column; gap: 8px; }
.jdc-eleve__day { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }

@media (max-width: 1100px) {
  .jdc-body { flex-direction: column; align-items: stretch; }
  .jdc-side { width: auto; }
}
@media (max-width: 767px) {
  .jdc-title { font-size: 30px; }
  .jdc-nav { margin-left: 0; }
  .jdc-seance__cols, .jdc-show-last .jdc-seance__cols { grid-template-columns: minmax(0, 1fr); }
  .jdc-col + .jdc-col { border-left: 0; border-top: 1.5px solid var(--dim); }
  .jdc-annonce { flex-wrap: wrap; }
  .jdc-annonce__txt { flex-basis: calc(100% - 40px); }
  .jdc-week { grid-template-columns: 30px repeat(var(--days), minmax(96px, 1fr)); overflow-x: auto; }
  .jdc-mic { width: 40px; height: 40px; }
}

/* Ion, l'assistant du journal (Q-257) : l'orbe (JDC-30). Immobile au repos, s'anime seulement quand il écoute,
   réfléchit ou parle ; rien ne bouge si l'utilisateur a demandé moins d'animations. */
.ion-btn { width: 38px; height: 38px; padding: 0; border: 0; background: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ion-orb { position: relative; display: inline-block; width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 38% 32%, #fff8e8 0 14%, #a8845a 42%, var(--brown) 100%);
  border: 1.5px solid var(--brown); box-shadow: 2px 2px 0 var(--shadow); }
.ion-orb--lg { width: 34px; height: 34px; }
.ion-btn:hover .ion-orb { animation: ion-breathe 2s ease-in-out infinite; }
.ion-orb[data-mode="ecoute"], .ion-orb[data-mode="parle"] { background: radial-gradient(circle at 38% 32%, #fff8e8 0 14%, var(--teal) 42%, var(--brown) 100%); }
.ion-orb[data-mode="ecoute"]::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--teal); animation: ion-ring 1.4s ease-out infinite; }
.ion-orb[data-mode="reflechit"]::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px dashed var(--brown); animation: ion-orbit 2.4s linear infinite; }
.ion-orb[data-mode="parle"] { animation: ion-breathe .6s ease-in-out infinite; }
.ion-orb[data-mode="question"]::after { content: "?"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff8e8; font-family: var(--font-hand); font-weight: 700; font-size: 20px; }
@keyframes ion-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes ion-ring { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.8); opacity: 0; } }
@keyframes ion-orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ion-orb, .ion-orb::after, .ion-btn:hover .ion-orb { animation: none !important; } }

.ion { width: min(820px, calc(100vw - 32px)); }
.ion-text { flex: 1; min-height: 110px; resize: vertical; font-size: 15px; line-height: 1.45; }
.ion-summary { margin: 0; font-size: 15px; }
.ion-sec { display: flex; flex-direction: column; gap: 5px; }
.ion-row { display: flex; gap: 10px; align-items: center; padding: 7px 10px; background: var(--card); border: 1.5px solid var(--dim); }
.ion-row input[data-keep] { width: 18px; height: 18px; margin: 0; accent-color: var(--brown); flex-shrink: 0; }
.ion-row__ic { display: inline-flex; color: var(--brown); flex-shrink: 0; }
.ion-row--evaluation .ion-row__ic { color: var(--red); }
.ion-row--competences .ion-row__ic { color: var(--teal); }
.ion-row--rappel .ion-row__ic, .ion-row--tache .ion-row__ic, .ion-row--exercices .ion-row__ic { color: var(--orange); }
.ion-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ion-row__txt { font-size: 14px; }
.ion-date { min-height: 26px; padding: 1px 6px; font-size: 12px; margin-left: 4px; }
.ion-q { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 12px; background: #fbe9d6; border: 1.5px solid var(--orange); font-size: 14px; }
.ion-q > span { flex: 1 1 200px; }
@media (max-width: 767px) {
  .ion-row { flex-wrap: wrap; }
  .ion-row__main { flex-basis: calc(100% - 60px); }
}

/* Fenêtre de conversation avec Ion (Q-258) */
.ion-window { background: var(--paper); min-height: 100vh; }
.ion-page { display: flex; flex-direction: column; height: 100vh; }
.ion-page__head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--card); border-bottom: 2px solid var(--tan); }
.ion-call { width: 64px; height: 64px; border-radius: 50%; border: 1.5px solid var(--brown); background: var(--card); box-shadow: 4px 4px 0 var(--shadow); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.ion-call[disabled] { cursor: default; opacity: .6; }
.ion-orb--xl { width: 42px; height: 42px; }
.ion-page__who { flex: 1; min-width: 0; }
.ion-page__name { font-family: var(--font-hand); font-size: 30px; font-weight: 700; line-height: 1; }
.ion-hangup { border-color: var(--red); color: var(--red); }
.ion-transcript { max-height: 30vh; overflow-y: auto; padding: 10px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.ion-transcript:empty { display: none; }
.ion-say { margin: 0; max-width: 85%; padding: 7px 10px; font-size: 14px; line-height: 1.35; }
.ion-say--prof { align-self: flex-end; background: var(--dim); }
.ion-say--ion { align-self: flex-start; background: var(--card); border: 1.5px solid var(--tan); }
.ion-page__body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.ion-page__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-top: 1.5px solid var(--tan); background: var(--card); }
.ion-usage.is-over { color: var(--red); font-weight: 600; }

/* Journal (Q-262) : texte de la semaine modifiable sur place, avertissement cliquable, agenda en fenêtre */
.jdc-week__edit { width: 100%; box-sizing: border-box; resize: none; overflow: hidden; min-height: 22px; padding: 2px 3px; border: 1px dashed transparent; background: transparent; font: inherit; font-size: 12px; line-height: 1.3; color: var(--ink); cursor: text; }
.jdc-week__edit:hover { border-color: var(--tan); }
.jdc-week__edit:focus { outline: none; border: 1px solid var(--brown); background: #fff; }
.jdc-week__edit::placeholder { font-style: italic; color: var(--muted); }
.jdc-week__warn { display: inline-flex; padding: 0; border: 0; background: none; color: var(--orange); cursor: pointer; }
.jdc-panel__open { width: 100%; border: 0; background: none; padding: 0; color: var(--ink); cursor: pointer; text-align: left; }
.jdc-panel__open > svg:last-child { margin-left: auto; color: var(--muted); }
.jdc-panel__open:hover > svg:last-child { color: var(--brown); }

/* Vue élève du journal, à projeter (Q-263) : un peu plus grand */
.jdc--eleves .jdc-eleve { max-width: 900px; font-size: 17px; }
.jdc--eleves .jdc-line { font-size: 17px; }
.jdc--eleves .jdc-panel__title { font-size: 30px; }
.mbox__postpone { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.mbox__postpone label { display: inline-flex; gap: 6px; align-items: center; }

/* Fenêtre « Signalements » ouverte par la pastille Bug ? (Q-266) */
.sig { width: min(860px, calc(100vw - 32px)); }
.sig__nav { display: inline-flex; align-items: center; gap: 8px; margin-left: 12px; }
.sig__pos { font-size: 13px; color: var(--muted); min-width: 44px; text-align: center; }
.sig__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sig__head .btn { margin-left: auto; }
.sig__q { padding: 12px 14px; border: 1.5px solid var(--dim); background: var(--card-focus); max-height: 46vh; overflow: auto; pointer-events: none; }
.sig__msg, .sig__reply { padding: 8px 12px; border-left: 4px solid var(--red); background: var(--red-bg); font-size: 14px; }
.sig__reply { border-left-color: var(--teal); background: var(--teal-bg); }
.sig__img:empty { display: none; }
.sig__img { display: flex; gap: 8px; align-items: flex-start; }
.sig__img img, .sig__reply img { max-width: 260px; max-height: 180px; border: 1.5px solid var(--dim); display: block; margin-top: 6px; }
.sig__who { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.sig__form { display: flex; flex-direction: column; gap: 8px; }
.sig__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sig__spacer { flex: 1; }

/* Bugs résolus (Q-285) */
.bugs { display: flex; flex-direction: column; gap: 12px; max-width: 900px; }
.bugs__tools { display: flex; gap: 8px; flex-wrap: wrap; }
.bugs__tools input { flex: 1; min-width: 200px; }
.bugs__tools select { width: auto; }
.bug { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.bug__head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.bug__date { margin-left: auto; font-size: 12px; }
.bug__foot { display: flex; gap: 12px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.bug__seen { display: inline-flex; gap: 6px; align-items: center; color: var(--red); font-weight: 600; }
.bug__seen.is-seen { color: var(--teal-dark); font-weight: 400; }

/* Notation ᴬZX : A au-dessus de Z, à gauche du symbole (Q-267) */
.nuc { display: inline-flex; align-items: center; white-space: nowrap; }
.nuc__az { display: inline-flex; flex-direction: column; align-items: flex-end; font-size: 0.62em; line-height: 1.05; margin-right: 1px; }
.nuc-layer { position: absolute; pointer-events: none; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: border-box; color: var(--ink); }
textarea.has-nuc-layer:not(:focus) { color: transparent; }
.q-cloze td .q-input--inline { max-width: 100%; }   /* case écrite dans un tableau : jamais plus large que sa colonne (390 px) */

/* ---------------------------------------------------------------- parcours par niveaux (Q-272) */
.comp__exw { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.comp__exw > .comp__lvl { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.comp__pips { display: flex; gap: 3px; }
.comp__pips i { display: block; width: 18px; height: 6px; border-radius: 3px; background: var(--card); box-shadow: inset 0 0 0 1px var(--tan); }
.comp__pips i.on { background: var(--orange); box-shadow: none; }
.comp__lvl-t { font-size: 12px; color: var(--orange-dark); white-space: nowrap; }
.comp__lvl.is-done .comp__pips i.on { background: var(--teal); }
.comp__lvl.is-done .comp__lvl-t { color: var(--teal-dark); font-weight: 600; }
.lvl-change { margin-top: 14px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--orange); background: color-mix(in srgb, var(--orange) 10%, var(--card)); color: var(--orange-dark); }
.lvl-change.is-down { border-color: var(--tan); background: var(--dim); color: var(--ink-2); }
.lvl-change__t { font-family: var(--font-hand); font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.lvl-change .comp__pips i { width: 24px; height: 7px; }
.lvl-change.is-down .comp__pips i.on { background: var(--tan); }
@media (max-width: 700px) { .comp__pips i { width: 14px; } }
.lvl-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--orange-dark); }
.lvl-cell .comp__pips i { width: 10px; height: 5px; }
.badge--level { border-color: var(--orange); color: var(--orange-dark); white-space: nowrap; }

/* « prêt » à confirmer par les exercices (Q-278) */
.comp__confirm { display: flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1.5px dashed var(--teal); border-radius: 999px; background: var(--teal-bg); color: var(--teal-dark); font-size: 12px; font-weight: 600; white-space: nowrap; }
.comp__confirm[hidden] { display: none; }
.comp__confirm-dots, .confirm-box__dots { display: inline-flex; gap: 3px; }
.comp__confirm-dots i, .confirm-box__dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--teal); box-sizing: border-box; display: inline-block; }
.comp__confirm-dots i.is-ok { background: var(--teal); }
.comp__confirm-dots i.is-ko { background: var(--orange); border-color: var(--orange); }
.confirm-box { gap: 12px; font-size: 16px; line-height: 1.5; }
.confirm-box p { margin: 0; }
.confirm-box__goal { border: 1.5px dashed var(--teal); background: var(--teal-bg); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.confirm-box__ref { font-size: 22px; color: var(--brown); margin-right: 6px; }
.confirm-box__row { display: flex; align-items: center; gap: 12px; color: var(--teal-dark); flex-wrap: wrap; }
.confirm-box__dots i { width: 22px; height: 22px; border-width: 2px; background: var(--card); }
.ex-confirm { border: 1.5px dashed var(--teal); color: var(--teal-dark); background: var(--teal-bg); white-space: nowrap; }
.ex-confirm[hidden] { display: none; }
.pev-check { display: inline-flex; vertical-align: -2px; margin-left: 4px; color: var(--teal-dark); }
.confirm-foot .right { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .confirm-foot .right { flex-direction: column-reverse; width: 100%; } .confirm-foot .btn { width: 100%; justify-content: center; } }
@media (max-width: 700px) { #exercise-modal .modal__head { flex-wrap: wrap; } #exercise-modal .ex-confirm { order: 10; flex-basis: 100%; white-space: normal; text-align: center; } }
/* place choisie, sur le plan et dans la fenêtre de confirmation (Q-279) */
#ee .plan__seat.is-mine, #ee-confirm .plan__seat.is-mine { background: var(--brown); color: var(--on-brown); border-color: var(--brown); font-weight: 700; box-shadow: 0 0 0 3px var(--orange); position: relative; z-index: 1; }
.ee-seat__mini { margin-top: 12px; display: flex; justify-content: center; }
.ee-seat__mini .plan__seat { font-size: 10px; }
.mbox__cron { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mbox__cron.is-err { color: var(--red); font-weight: 600; }

/* clavier de l'élève dans la fiche d'une question (Q-298) : les symboles dont la réponse a besoin */
.kpick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpick[hidden] { display: none; }
.kpick__label { font-weight: 600; }
.kpick__list { display: flex; gap: 4px; flex-wrap: wrap; }
.kpick__key { width: 34px; height: 34px; border: 1.5px solid var(--tan); background: var(--card); color: var(--muted); font: 600 17px var(--font-text); cursor: pointer; opacity: 0.55; }
.kpick__key.is-on { border-color: var(--brown); color: var(--ink); background: var(--m-hl); opacity: 1; }
.kpick__key:disabled { cursor: default; }

/* Mise à jour : tes questions gardées (Q-343) — ta version / celle de la mise à jour, côte à côte */
.qcf { margin-bottom: 16px; }
.qcf__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qcf__num { font-family: var(--font-hand); font-size: 20px; color: var(--brown); }
.qcf__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.qcf__label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.qcf__q { border: 1.5px dashed var(--tan); padding: 12px; background: var(--card); overflow-x: auto; }
@media (max-width: 760px) { .qcf__cols { grid-template-columns: 1fr; } }
/* Vérifier les notes automatiques (Q-345) */
.vn { width: min(1080px, calc(100vw - 32px)); }
.modal.vn .vn__head { flex-wrap: wrap; gap: 12px; position: relative; padding-right: 52px; }
.modal.vn .vn__head h2 { flex: 1 1 auto; font-size: 26px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.vn__head [data-modal-close] { position: absolute; top: 12px; right: 12px; }
.vn__tabs { display: flex; gap: 4px; margin-left: auto; }
.vn__badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; padding: 0 7px; border-radius: 99px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; }
.vn__nav { position: sticky; top: -16px; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0; background: var(--card); border-bottom: 1px dashed var(--tan); margin-bottom: 12px; }
.vn__nav select { min-width: 220px; max-width: 60vw; }
.vn-comp { display: flex; gap: 10px; align-items: baseline; font-size: 15px; margin-bottom: 10px; }
.vn-comp__ref { font-family: var(--font-hand); font-size: 22px; font-weight: 700; color: var(--brown); }
.vn-ver { border: 1.5px solid var(--tan); padding: 12px; margin-bottom: 14px; background: var(--card); }
.vn-ver__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.vn-ver__head .btn { margin-left: auto; }
.vn-ver__q { border: 1px dashed var(--tan); padding: 10px; margin-bottom: 10px; overflow-x: auto; }
.vn-hole { padding: 8px 0; border-top: 1px dashed var(--tan); }
.vn-hole__label { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.vn-row { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0; }
.vn-row__t { flex: 0 0 190px; font-size: 13px; color: var(--muted); padding-top: 3px; }
.vn-row__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.vn-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border: 1.5px solid var(--tan); border-radius: 99px; font-size: 13px; background: var(--paper); }
.vn-chip b { font-weight: 700; color: var(--muted); }
.vn-chip--good { border-color: var(--teal); background: var(--teal-bg); }
.vn-chip--ok { border-color: var(--teal); border-style: dashed; }
.vn-chip--wrong { border-color: var(--rose-edge, #d9a0a0); }
.vn-chip__tag { font-size: 11px; color: var(--orange-dark); }
.vn-chip__hand { display: inline-flex; align-items: center; gap: 2px; color: var(--orange-dark); font-weight: 700; }
.vn-claims__title { display: flex; align-items: center; gap: 8px; font-family: var(--font-hand); font-size: 24px; margin: 18px 0 8px; }
.vn-claim { border: 1.5px solid var(--orange); padding: 12px; margin-bottom: 12px; background: var(--card); display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 60px; }
.vn-claim__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vn-claim__why { padding: 8px 12px; border-left: 3px solid var(--orange); background: #fff6dc; font-style: italic; }
.vn-claim__copy { border: 1px dashed var(--tan); padding: 10px; overflow-x: auto; }
.vn-claim__reply { width: 100%; resize: vertical; }
.vn-claim__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vn-claim__actions .right { margin-left: auto; display: flex; gap: 8px; }
.vn-state { margin-left: auto; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #fff3cf; color: var(--orange-dark); }
.vn-state--ok { background: var(--teal-bg); color: var(--teal-dark); }
.vn-state--ko { background: var(--dim); color: var(--muted); }
@media (max-width: 640px) { .vn-row { flex-direction: column; gap: 4px; } .vn-row__t { flex-basis: auto; } .vn__tabs { margin-left: 0; } .modal.vn .vn__head h2 { font-size: 21px; flex-basis: 100%; } .vn__nav select { min-width: 0; flex: 1; } }
/* Vérifier les notes automatiques : barème, demandes rangées case par case, clic sur une réponse (Q-353) */
.vn { position: relative; }
.vn-chip.is-click { cursor: pointer; font: inherit; font-size: 13px; color: inherit; }
.vn-chip.is-click:hover, .vn-chip.is-click:focus-visible { border-color: var(--brown); box-shadow: 0 0 0 2px #f1d58a; }
.vn-chip--part { border-color: #d9a521; background: #fdf3d6; }
.vn-chip--wrong { background: #f7ece6; }
.vn-mark { display: inline-block; padding: 0 4px; border-radius: 3px; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.4; }
.vn-mark.is-off { background: none; color: var(--muted); border: 1px solid var(--tan); text-decoration: line-through; }
.vn-bar { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; padding: 8px 12px; border: 1.5px solid var(--tan); background: var(--paper); font-size: 14px; margin-bottom: 12px; }
.vn-bar__more { margin-left: auto; border: 0; background: none; padding: 0; color: var(--brown); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; }
.vn-stale { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 12px; border: 1.5px solid var(--orange); background: #fff3cf; margin-bottom: 12px; }
.vn-hole__head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.vn-hole__head .btn { margin-left: auto; }
.vn-hole__sum { font-size: 13px; }
.vn-hole.is-closed { padding: 6px 0; }
.vn-pt { padding: 0 7px; border: 1px solid var(--tan); background: var(--dim); font-size: 12px; font-weight: 600; white-space: nowrap; }
.vn-row__t--hand { color: var(--orange-dark); font-weight: 700; display: flex; gap: 4px; align-items: flex-start; }
.vn-claims { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.vn-claims .vn-claim { margin-bottom: 0; background: #fff6dc; border-color: #d9a521; }
.vn-claim.is-done { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 12px; border-style: dashed; background: var(--card); font-size: 13px; }
.vn-claim.is-done .btn { margin-left: auto; }
.vn-ok { color: var(--teal-dark); font-weight: 700; }
.vn-ko { color: var(--red); font-weight: 700; }
.vn-kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.vn-kv__k { color: var(--muted); font-size: 13px; }
.vn-kv .vn-claim__why { border: 0; padding: 0; background: none; }
.vn-same { font-size: 12px; align-self: center; }
.vn-who { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.vn-grid { display: grid; grid-template-columns: 14px auto 64px auto minmax(0, 1fr); gap: 6px 8px; align-items: center; }
.vn-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.vn-pop { position: absolute; z-index: 20; display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1.5px solid var(--brown); background: var(--card); box-shadow: 0 4px 0 var(--shadow); max-width: 280px; }
.vn-pop__t { font-weight: 700; overflow-wrap: anywhere; }
.vn-prev { position: absolute; z-index: 20; width: min(560px, calc(100% - 16px)); max-height: 60vh; overflow: auto; padding: 12px; border: 1.5px solid var(--tan); background: var(--card); box-shadow: 0 4px 0 var(--shadow); }
.vn-prev__s { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 6px 0; }
.vn-prev__crit { margin: 6px 0 0; padding-left: 22px; }
.vn-prevq, .vn-prevk { cursor: help; border-bottom: 1px dotted var(--tan); }
.vn-bhead { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; margin-bottom: 12px; }
.vn-btot { font-size: 17px; }
.vn-bl { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.vn-btable td { vertical-align: top; }
.vn-btable tr.is-paper td { background: var(--paper); }
.vn-benc .vn-bl { display: flex; justify-content: space-between; margin: 2px 0; }
.vn-btotal { display: block; font-size: 12px; text-align: right; }
.vn-bcases { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.vn-bcase { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.vn-bcase__l { min-width: 190px; }
.vn-bcase .vn-pt { margin-left: auto; }
.vn-paper { padding: 0 6px; border: 1px solid var(--tan); background: var(--dim); font-size: 12px; }
.vn-link { border: 0; background: none; padding: 0; margin-right: 10px; color: var(--brown); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; }
.vn-bfoot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; position: sticky; bottom: -16px; background: var(--card); padding: 10px 0; border-top: 1px dashed var(--tan); }
.vn-bfoot .muted { margin-right: auto; }
.table tr.is-new td { background: #fff3c4; }
@media (max-width: 640px) {
  .vn-kv { grid-template-columns: 1fr; gap: 4px; }
  .vn-grid { grid-template-columns: 14px auto 64px minmax(0, 1fr); }
  .vn-grid > span:nth-child(5n) { grid-column: 1 / -1; font-size: 13px; }
  .vn-bcase__l { min-width: 0; flex-basis: 100%; }
  .vn-bar__more { margin-left: 0; }
  .vn__tabs { flex-wrap: wrap; }
  .vn__tabs .qtab { padding: 4px 8px; }
}
/* « Stat » d'une évaluation (Q-354) */
.evstat { width: min(1240px, calc(100vw - 32px)); }
.modal.evstat .st__head { flex-wrap: wrap; gap: 10px 16px; position: relative; padding-right: 52px; }
.modal.evstat .st__head h2 { font-size: 26px; margin: 0; }
.st__head [data-modal-close] { position: absolute; top: 12px; right: 12px; }
.st__group { display: inline-flex; gap: 8px; align-items: center; }
.st__sum { font-size: 15px; }
.st__body { display: flex; flex-direction: column; gap: 16px; flex: 1 1 auto; min-height: 0; }
.st__body > * { flex-shrink: 0; }
.st-card { margin: 0; }
.st-pad { padding: 12px 16px; }
.st__two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.st-scatter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; padding: 16px; }
.st-plot { position: relative; height: 400px; border-left: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); overflow: hidden; }
.st-zone { position: absolute; }
.st-zone.is-lucky { background: #f3ead8; } .st-zone.is-ok { background: #dde8e2; } .st-zone.is-none { background: #f2dcd6; } .st-zone.is-miss { background: #f5e1cc; }
.st-ql { position: absolute; font-size: 13px; color: var(--muted); z-index: 1; }
.st-ql.is-ok, .st-big.is-ok { color: #2f6f62; } .st-ql.is-none, .st-big.is-none { color: #a33a2a; } .st-ql.is-miss, .st-big.is-miss { color: #8a5a00; }
.st-big { position: absolute; transform: translate(-50%, -50%); font-family: var(--font-hand); font-size: 96px; font-weight: 700; line-height: 1; opacity: .28; color: var(--brown); pointer-events: none; z-index: 1; }
.st-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--brown); border: 1.5px solid var(--card); z-index: 2; }
.st-axes { display: flex; justify-content: space-between; font-size: 14px; grid-column: 1; }
.st-legend { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.st-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.st-pie { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.st-pie__disc { width: 210px; height: 210px; border-radius: 50%; flex: 0 0 auto; }
.st-pie__leg { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.st-time { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.st-time__plot { flex: 1 1 560px; min-width: 0; }
.st-time__plot svg { width: 100%; height: auto; display: block; overflow: visible; font-family: inherit; }
.st-time__leg { display: flex; flex-direction: column; gap: 8px; font-size: 14px; padding-bottom: 8px; }
.st-bar { fill: #e6d3ae; }
.st-curve { fill: none; stroke: #2b6cb0; stroke-width: 2.5; }
.st-axis { stroke: var(--muted); stroke-width: 1.5; }
line.st-mean { stroke: #2b6cb0; stroke-width: 2; } text.st-mean { fill: #2b6cb0; font-size: 13px; }
line.st-plan { stroke: #a33a2a; stroke-width: 2; stroke-dasharray: 6 4; } text.st-plan { fill: #a33a2a; font-size: 13px; }
.st-ticks text { fill: var(--muted); font-size: 12px; }
.st-table tr.is-gap td { background: #fff3c4; }
.st-pc { display: inline-block; min-width: 50px; padding: 2px 8px; text-align: center; font-weight: 600; }
.st-c1 { background: #f2d1cb; color: #7a2418; } .st-c2 { background: #f6e3c4; color: #7a4a00; } .st-c3 { background: #e3ecd2; color: #3d5a1a; } .st-c4 { background: #cfe6df; color: #1f5f54; }
.st-empty { color: #a33a2a; }
.st-gap { padding: 2px 8px; }
.st-gap.is-low { background: #f2d1cb; color: #7a2418; font-weight: 700; }
.olp-flash, .pf.olp-flash { outline: 3px solid #d9a521; outline-offset: 2px; transition: outline-color 1.5s; }
@media (max-width: 760px) {
  .st__two { grid-template-columns: 1fr; }
  .st-scatter { grid-template-columns: 1fr; }
  .st-legend { grid-column: 1; grid-row: auto; flex-direction: row; flex-wrap: wrap; }
  .st-plot { height: 300px; }
  .st-big { font-size: 64px; }
}
.enc-stat { display: inline-flex; align-items: center; gap: 4px; }
/* barre réussis / ratés sous « S'exercer » (Q-355) : sauge, fondu, corail ; le reste transparent dans le contour */
.exo-bar { order: 3; display: block; width: 100%; height: 9px; box-sizing: border-box; border: 1.5px solid var(--brown); border-radius: 6px; }
.comp__exw:has(.exo-bar) { align-items: stretch; }
.comp__exw:has(.exo-bar) > .comp__ex, .comp__exw:has(.exo-bar) > .comp__lvl { align-self: flex-end; }
.exo-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; font-size: 14px; color: var(--ink-2); margin: 0 4px 8px; }
.exo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.exo-legend__sw { display: inline-block; width: 22px; height: 9px; box-sizing: border-box; border: 1.5px solid var(--brown); border-radius: 6px; }
.exo-legend__sw.is-ok { background: #6fae8c; } .exo-legend__sw.is-ko { background: #e08a74; }
.menu__switch { display: flex; align-items: center; gap: 8px; }
.menu__toggle { position: relative; margin-left: auto; width: 38px; height: 22px; border-radius: 11px; background: var(--tan); flex: 0 0 auto; }
.menu__toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); transition: left .15s; }
.menu__toggle.is-on { background: #6fae8c; }
.menu__toggle.is-on::after { left: 19px; }
/* ---------------------------------------------------------------- jeu du grimoire : molécules à construire (Q-326)
   Scène large (ordi, 1200 × 640) ou haute (téléphone, 360 × 630), mise à l'échelle par molecules.js. */
.mol { position: relative; width: 100%; min-height: 200px; user-select: none; -webkit-user-select: none; }
.mol__stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; overflow: hidden; touch-action: none; border-radius: 10px; font-family: var(--font-text); color: #3b2a1a; }
.mol--wide .mol__stage { width: 1200px; height: 600px; }
.mol--tall .mol__stage { width: 360px; height: 630px; }
.mol__wall { position: absolute; inset: 0; background: linear-gradient(180deg, #f4ead2 0%, #e9d8b4 75%, #dcc497 100%); }
.mol__table { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #8a5a33 0%, #6e4426 12%, #5c3820 100%); box-shadow: inset 0 3px 0 #a87447, 0 -4px 12px rgba(60, 30, 10, .3); }
.mol--wide .mol__table { top: 430px; }
.mol--tall .mol__table { top: 520px; }
.mol__book { position: absolute; pointer-events: none; }
.mol--wide .mol__book { left: 6px; top: -18px; width: 640px; }
.mol--tall .mol__book { left: -40px; top: 22px; width: 430px; }
/* Le texte est écrit DANS les pages : chaque page est un parallélogramme (perspective du grimoire). La boîte de texte
   est posée sur le coin haut-gauche de la page puis inclinée par matrix(), mesurée sur l'image (grimoire.webp, 890 px) :
   gauche (112, 118) → (392, 100) et (140, 445) ; droite (452, 105) → (718, 62) et (498, 425), marge comprise. */
.mol__page { position: absolute; display: flex; flex-direction: column; transform-origin: 0 0; overflow-wrap: break-word; }
.mol__page--left { transform: matrix(.9979, -.0641, .0853, .9963, 0, 0); }
.mol__page--right { transform: matrix(.9872, -.1596, .1423, .9898, 0, 0); }
.mol--wide .mol__page--left { left: 86.5px; top: 66.9px; width: 201.8px; height: 236px; font-size: 16px; }
.mol--wide .mol__page--right { left: 331px; top: 57.5px; width: 193.8px; height: 232.5px; }
.mol--tall .mol__page--left { left: 14.1px; top: 79px; width: 135.6px; height: 158.6px; font-size: 12.5px; }
.mol--tall .mol__page--right { left: 179.3px; top: 78.6px; width: 128px; height: 150px; }
.mol__page--left { gap: .7em; line-height: 1.3; justify-content: center; }
.mol__page p { margin: 0; }
.mol__lead { margin: 0; font-weight: 600; line-height: 1.25; }
.mol--wide .mol__lead { font-size: 15px; }
.mol--tall .mol__lead { font-size: 12px; }
.mol__ask { margin: 0; font-weight: 700; line-height: 1.25; text-align: center; }
.mol--wide .mol__ask { font-size: 14px; }
.mol--tall .mol__ask { position: absolute; left: 12px; top: 338px; width: 336px; font-size: 13px; }
.mol__page--right { align-items: center; justify-content: center; gap: 6px; text-align: center; }
.mol__formula { font-weight: 700; line-height: 1.1; white-space: nowrap; text-align: center; }
.mol--wide .mol__formula { font-size: 46px; }
.mol--tall .mol__formula { font-size: 30px; }
.mol__formula sub { font-size: .6em; }
.mol__name { font-weight: 600; line-height: 1.2; }
.mol--wide .mol__name { font-size: 16px; }
.mol--tall .mol__name { font-size: 13px; }
.mol--label .mol__formula { padding-bottom: 24px; }
.mol--wide.mol--label .mol__formula { font-size: 40px; }
.mol--tall.mol--label .mol__formula { font-size: 28px; }
.mol__digit { position: relative; display: inline-block; vertical-align: baseline; margin: 0 2px; padding: 0 5px; min-width: 32px; min-height: 44px; border: 2px dashed #b8892f; border-radius: 8px; background: transparent; font: inherit; color: inherit; cursor: pointer; line-height: 1; }
.mol__digit--sub { font-size: .6em; vertical-align: -.45em; }
.mol__digit.is-set { background: #fff3cf; border-style: solid; }
.mol__digit:disabled { cursor: default; }
.mol__tag { position: absolute; left: 50%; top: 100%; margin-top: 5px; transform: translateX(-50%); white-space: nowrap; font: 600 13px/1 var(--font-text); padding: 4px 7px; border-radius: 10px; background: #e9dcc0; color: #5a4528; }
.mol__digit.is-set .mol__tag { background: #2f6b3a; color: #fdf6e3; }
.mol--tall .mol__tag { font-size: 12px; padding: 3px 6px; }
.mol__frame { position: absolute; box-sizing: border-box; background: #000; border: 5px solid #e6e6e6; border-radius: 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, .3); transition: border-color .3s, box-shadow .3s; }
.mol--wide .mol__frame { left: 664px; top: 30px; width: 512px; height: 318px; }
.mol--tall .mol__frame { left: 12px; top: 342px; width: 336px; height: 126px; }
.mol--tall.mol--label .mol__frame { top: 360px; height: 108px; }
.mol.is-ok .mol__frame { border-color: #f2d200; box-shadow: 0 0 24px rgba(242, 210, 0, .75); }
.mol__check { position: absolute; transform: translateX(-50%); min-height: 44px; font-size: 17px; z-index: 4; }
.mol--wide .mol__check { left: 920px; top: 362px; }
.mol--tall .mol__check { left: 180px; top: 474px; }
.mol__jar { position: absolute; z-index: 2; }
.mol--wide .mol__jar { top: 442px; width: 140px; }
.mol--tall .mol__jar { top: 526px; width: 84px; }
.mol--wide .mol__jar--0 { left: 150px; } .mol--wide .mol__jar--1 { left: 410px; } .mol--wide .mol__jar--2 { left: 670px; } .mol--wide .mol__jar--3 { left: 930px; }
.mol--tall .mol__jar--0 { left: 6px; } .mol--tall .mol__jar--1 { left: 94px; } .mol--tall .mol__jar--2 { left: 182px; } .mol--tall .mol__jar--3 { left: 270px; }
.mol__jar img { display: block; width: 100%; pointer-events: none; }
.mol__pile { position: absolute; inset: 0; pointer-events: none; }
.mol__pile i, .mol__expected i { position: absolute; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 600 12px/1 var(--font-text); font-style: normal; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.mol__grab { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 420 / 364; padding: 0; border: 0; background: transparent; cursor: grab; touch-action: none; }
.mol__label { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px auto 0; height: 29px; box-sizing: border-box; background: #f6ead0; border: 2px solid #9b7433; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, .35); font-size: 15px; white-space: nowrap; }
.mol--tall .mol__label { margin-top: 3px; height: 26px; font-size: 12px; gap: 3px; border-width: 1.5px; }
.mol--tall .mol__dot { width: 11px; height: 11px; }
.mol__dot { flex: none; width: 13px; height: 13px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.mol__atoms { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.mol__atom { position: absolute; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; line-height: 1; box-shadow: 0 3px 6px rgba(0, 0, 0, .35); cursor: grab; pointer-events: auto; touch-action: none; }
.mol__atom.is-drag { cursor: grabbing; z-index: 2; box-shadow: 0 12px 18px rgba(0, 0, 0, .45); }
.mol__bond { position: absolute; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; pointer-events: auto; z-index: 3; }
.mol__bond svg { position: absolute; left: 3px; top: 3px; pointer-events: none; filter: drop-shadow(0 0 2px #fff); }
.mol__glow { position: absolute; left: -18px; top: -18px; width: 68px; height: 68px; border-radius: 50%; background: radial-gradient(circle, #fff 0 14%, rgba(255, 240, 150, .95) 28%, rgba(255, 214, 90, .5) 52%, rgba(255, 214, 90, 0) 72%); animation: mol-lueur 1.1s ease-in-out infinite; pointer-events: none; }
@keyframes mol-lueur { 0%, 100% { transform: scale(.85); opacity: .7; } 50% { transform: scale(1.12); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mol__glow { animation: none; } }
.mol__bubble { position: absolute; z-index: 30; box-sizing: border-box; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: #fffaf0; border: 2px solid #b8892f; border-radius: 18px; box-shadow: 0 8px 24px rgba(40, 25, 10, .35); font-size: 16px; line-height: 1.4; }
.mol--wide .mol__bubble { left: 60px; top: 40px; width: 540px; }
.mol--tall .mol__bubble { left: 8px; top: 30px; width: 344px; font-size: 14px; }
.mol__bubble p { margin: 0; }
.mol__fb .q-expected-note { margin-top: 8px; }
.mol__bravo { font-family: var(--font-hand); font-size: 34px; font-weight: 700; color: #2f6b3a; }
.mol__expected { position: relative; align-self: center; background: #000; border: 4px solid #e6e6e6; border-radius: 4px; }
.modal:has(.mol:not([data-ro])) [data-q-submit] { display: none; }
.modal--full:has(.mol) { width: calc(100vw - 32px); }
.modal__body:has(.mol) { padding: 8px 12px; }
.mol--wide .mol__short, .mol--tall .mol__long { display: none; }
@media (max-width: 767px) { .modal:has(.mol) #ex-type { display: none; } }   /* une ligne d'en-tête de plus pour la scène */   /* le jeu a son propre « Vérifier », sous le cadre */
/* =============================================================================
   Jeu des tests de gaz (type de question « gaz », Q-327) — copie de la maquette design/maquettes/jeu-gaz.html.
   Scène large (1200 × 600) ou haute (téléphone, 360 × 600), mise à l'échelle par gaz.js ; la scène garde ses
   couleurs dans les deux thèmes (c'est une image), les commandes dessous suivent le thème.
   ========================================================================== */
.gz { width: 100%; }
.gz__box { position: relative; width: 100%; user-select: none; -webkit-user-select: none; }
.gz__stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; border-radius: 10px; background: #e9d8b4; font-family: var(--font-text); color: #3b2a16; }
.gz__bg { position: absolute; max-width: none; pointer-events: none; }
.gz__wiz { position: absolute; overflow: hidden; }
.gz__wiz img { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; }
.gz__tubes { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: 12px; }
.gz__tubes:hover, .gz__tubes:focus-visible { box-shadow: 0 0 0 3px rgba(242, 210, 0, .8), 0 0 18px rgba(242, 210, 0, .6); outline: none; }
.gz__tubes[disabled] { cursor: default; box-shadow: none; }
.gz__blouse { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; }
.gz__blouse img { display: block; width: 100%; pointer-events: none; }
.gz__blouse:hover img, .gz__blouse:focus-visible img { filter: drop-shadow(0 0 10px rgba(242, 210, 0, .9)); }
.gz__blouse:focus-visible { outline: none; }
.gz__book { position: absolute; pointer-events: none; }
.gz__book > img { display: block; width: 100%; }
.gz__page { position: absolute; transform-origin: 0 0; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 6px; overflow: hidden; }
.gz__lvl { font-family: var(--font-hand); font-weight: 700; line-height: 1; }
.gz__tests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.gz__tests li { display: flex; align-items: center; gap: 6px; }
.gz__tests li.is-done { color: #2f5a53; }
.gz__tests li.is-cur { font-weight: 700; }
.gz__gas { font-weight: 700; line-height: 1; }
.gz__gas sub { font-size: .6em; }
.gz__gasname { font-weight: 600; }
.gz__tubesleft { display: flex; justify-content: center; gap: 3px; }
.gz__tubesleft i { display: block; width: 7px; height: 26px; border: 1.5px solid #6b5a3a; border-top-width: 4px; border-top-color: #c0543a; border-radius: 0 0 4px 4px; }
.gz__tubesleft i.is-used { opacity: .25; }

.gz__work { position: absolute; left: 0; top: 0; pointer-events: none; }
.gz__work.is-mirror { transform: scaleX(-1); }
.gz__item { position: absolute; pointer-events: none; transition: opacity .3s; }
.gz__item img { display: block; width: 100%; }
.gz__item.is-open img { clip-path: inset(21% 0 0 0); }
.gz__front { display: none; }
.gz__front.is-on { display: block; }
.gz__front img { clip-path: inset(30% 0 0 0); }
.gz__hand { position: absolute; pointer-events: none; max-width: none; }   /* placées par le script à chaque image */
.gz__hand.is-hidden { display: none; }
.gz__hand > img { position: relative; display: block; width: 100%; }
.gz__arm { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.gz__fx { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.gz__flame { transform-box: fill-box; transform-origin: 50% 100%; animation: gz-flicker .18s ease-in-out infinite alternate; }
@keyframes gz-flicker { from { transform: scale(1, 1); } to { transform: scale(.92, 1.08); } }

.gz__bubble { position: absolute; z-index: 30; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: #fffaf0; border: 2px solid #b8892f; border-radius: 18px; box-shadow: 0 8px 24px rgba(40, 25, 10, .35); line-height: 1.4; }
.gz__bubble p { margin: 0; }
.gz__bubble .gz__say { font-family: var(--font-hand); font-size: 1.6em; font-weight: 700; line-height: 1.1; color: #b3402f; }
.gz__bubble .gz__ok { align-self: flex-end; }
.gz__zoom { align-self: center; }

.gz__shelf { position: absolute; z-index: 25; max-height: calc(100% - 12px); display: flex; flex-direction: column; gap: 10px; padding: 14px; background: rgba(255, 250, 240, .97); border: 2px solid #b8892f; border-radius: 14px; box-shadow: 0 8px 24px rgba(40, 25, 10, .35); }
.gz__shelf h3 { margin: 0; font-size: 16px; }
.gz__items { display: grid; gap: 8px; overflow: auto; }
.gz__pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 2px solid #e2d3b2; border-radius: 10px; background: #fff; font: 600 12px/1.15 var(--font-text); color: #3b2a16; cursor: pointer; text-align: center; }
.gz__pick img { width: 100%; max-width: 86px; aspect-ratio: 1; object-fit: contain; pointer-events: none; }
.gz__lit { position: relative; width: 100%; max-width: 86px; aspect-ratio: 1; }
.gz__lit img { display: block; height: 100%; }
.gz__lit svg { position: absolute; width: 16%; transform: translate(-50%, -100%); overflow: visible; }
.gz__pick.is-on { border-color: #7c4a1e; background: #fff3cf; }
.gz__pick.is-bad { border-color: #b3402f; background: #f4dcd6; }
.gz__pick.is-miss { border-color: #5b8c85; border-style: dashed; background: #dfe9e4; }
.gz__pick em { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 8px; font: 700 11px/1 var(--font-text); font-style: normal; white-space: nowrap; color: #fff; }
.gz__pick.is-bad em { background: #b3402f; }
.gz__pick.is-miss em { background: #2f5a53; }
.gz__shelf .btn { align-self: center; }

/* commandes sous la scène (suivent le thème) */
.gz-ctrl { display: flex; flex-direction: column; gap: 10px; padding: 12px 2px 4px; }
.gz-ctrl__ask { margin: 0; font-size: 16px; font-weight: 700; }
.gz-ctrl__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gz-ctrl__groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.gz-ctrl__group { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; padding: 8px; border: 1.5px dashed var(--tan); }
.gz-ctrl__group > span { width: 100%; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.gz-ctrl__group .btn { min-height: 36px; padding: 6px 10px; }
.gz-ctrl__end { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }
.gz-concl { display: flex; flex-direction: column; gap: 8px; }
.gz-concl label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1.5px solid var(--tan); background: var(--card); cursor: pointer; font-size: 14px; }
.gz-concl label.is-on { border-color: var(--brown); background: var(--dim); }
.gz-concl input[type=text] { min-height: 36px; width: 190px; padding: 4px 8px; font: 15px var(--font-text); border: 1.5px solid var(--tan); background: var(--card-focus); color: var(--ink); }
.gz-fb { padding: 10px 12px; border: 1.5px solid var(--tan); background: var(--dim); font-size: 14px; line-height: 1.4; }
.gz-fb--ok { border-color: var(--teal); background: var(--teal-bg); color: var(--teal-dark); }
.gz-fb--ko { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.gz-fb p { margin: 0 0 4px; } .gz-fb p:last-child { margin: 0; }

.gz .btn.is-on { background: var(--dim); border-color: #b8892f; }

/* après la partie : la grille corrigée (App\Services\GasTests::gridHtml) */
.gz-res { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.gz-res__wiz { width: 110px; flex: none; }
.gz-res p { margin: 0 0 4px; }
.gz-res__total { font-family: var(--font-hand); font-size: 40px; font-weight: 700; line-height: 1; }
.gz-res__say { font-family: var(--font-hand); font-size: 26px; font-weight: 700; color: var(--red); }
.gz-grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.gz-grid th, .gz-grid td { padding: 6px 8px; border-bottom: 1px dashed var(--tan); text-align: left; vertical-align: top; }
.gz-grid th { font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding-top: 12px; }
.gz-grid__pt { width: 54px; text-align: right; white-space: nowrap; font-weight: 700; }
.gz-grid__ic { width: 28px; }
.gz-grid__ic.is-ok { color: var(--teal-dark); } .gz-grid__ic.is-ko { color: var(--red); } .gz-grid__ic.is-na { color: var(--muted); }
.gz-grid__why { display: block; margin-top: 2px; font-size: 13px; color: var(--red); }
.gz-grid__tot td { border-bottom: 0; font-size: 18px; font-weight: 700; padding-top: 12px; }
.modal:has(.gz:not([data-ro])) [data-q-submit] { display: none; }   /* le jeu envoie lui-même la réponse à la fin */
.modal--full:has(.gz) { width: calc(100vw - 32px); }
.modal__body:has(.gz) { padding: 8px 12px; }
@media (max-width: 599px) { .gz-ctrl__groups { grid-template-columns: 1fr; } .modal:has(.gz) #ex-type { display: none; } }

/* =============================================================================
   Jeu de l'électrolyse de l'eau (type de question « electrolyse », Q-328) — copie de la maquette
   design/maquettes/jeu-electrolyse.html. Scène large (1200 × 600) ou haute (360 × 600), mise à l'échelle par
   electrolyse.js ; la grille corrigée reprend les styles .gz-res / .gz-grid du jeu des gaz.
   ========================================================================== */
.el { width: 100%; }
.el__box { position: relative; width: 100%; user-select: none; -webkit-user-select: none; }
.el__stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; border-radius: 10px; background: #e9d8b4; color: #3b2a16; font-family: var(--font-text); }
.el__abs { position: absolute; pointer-events: none; max-width: none; }
.el__wiz { position: absolute; overflow: hidden; }
.el__wiz img { position: absolute; left: 0; top: 0; width: 100%; }
.el__blouse { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; }
.el__blouse img { display: block; width: 100%; pointer-events: none; }
.el__blouse:hover img, .el__blouse:focus-visible img { filter: drop-shadow(0 0 10px rgba(242, 210, 0, .9)); }
.el__blouse:focus-visible { outline: none; }
.el__book { position: absolute; pointer-events: none; }
.el__book > img { display: block; width: 100%; }
.el__page { position: absolute; transform-origin: 0 0; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 5px; overflow: hidden; }
.el__pol { position: absolute; transform: translate(-50%, -50%); font: 700 1em/1 Georgia, 'Times New Roman', serif; text-shadow: 0 1px 0 rgba(255, 255, 255, .7), 0 -1px 0 rgba(0, 0, 0, .25); pointer-events: none; }
.el__pol--moins { color: #2a2420; }
.el__pol--plus { color: #a8231b; }
.el__sb { position: absolute; white-space: nowrap; font-size: 13px; min-height: 30px; padding: 2px 10px; }
.el__sb[hidden] { display: none; }
.el__lvl { font-family: var(--font-hand); font-weight: 700; line-height: 1; }
.el__steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.el__steps li { display: flex; align-items: center; gap: 5px; }
.el__steps li.is-done { color: #2f5a53; }
.el__steps li.is-cur { font-weight: 700; }
.el__count { font-weight: 700; line-height: 1.25; }
.el__count sub { font-size: .65em; }
.el__fx { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.el__hand { position: absolute; pointer-events: none; max-width: none; }
.el__hand.is-hidden { display: none; }
.el__hand > img { position: relative; display: block; width: 100%; }
.el__arm { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.el__flame { transform-box: fill-box; transform-origin: 50% 100%; animation: el-flicker .18s ease-in-out infinite alternate; }
@keyframes el-flicker { from { transform: scale(1, 1); } to { transform: scale(.92, 1.08); } }

.el__bubble { position: absolute; z-index: 30; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: #fffaf0; border: 2px solid #b8892f; border-radius: 18px; box-shadow: 0 8px 24px rgba(40, 25, 10, .35); line-height: 1.4; }
.el__bubble p { margin: 0; }
.el__bubble .el__say { font-family: var(--font-hand); font-size: 1.6em; font-weight: 700; line-height: 1.1; color: #b3402f; }
.el__bubble .el__ok { align-self: flex-end; }
.el__bubble svg { align-self: center; max-width: 100%; height: auto; }

.el-ctrl { display: flex; flex-direction: column; gap: 10px; padding: 12px 2px 4px; }
.el__thermo { transform: rotate(43deg) translateY(-70px); opacity: 0; transition: transform .7s ease-out, opacity .3s; pointer-events: none; }
.el__thermo.is-in { transform: rotate(43deg); opacity: 1; }
.el__thermo[hidden] { display: none; }
.el__tt { position: absolute; padding: 0; border: 0; background: transparent; cursor: pointer; }
.el__tt svg { display: block; pointer-events: none; }
.el__tt:hover, .el__tt:focus-visible { outline: none; filter: drop-shadow(0 0 8px rgba(242, 210, 0, .95)); }
.el__tt[hidden] { display: none; }
.el-trials { float: right; align-self: flex-end; width: auto; margin: 0 0 8px 12px; border-collapse: collapse; font-size: 13px; background: var(--card-focus); }
.el-trials caption { font-weight: 700; text-align: left; padding-bottom: 4px; }
.el-trials th, .el-trials td { border: 1px solid var(--tan); padding: 3px 8px; text-align: center; min-width: 54px; }
.el-trials th:first-child { text-align: left; }
.el-verdict { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.el-verdict svg { flex: none; }
@media (max-width: 600px) { .el-trials { float: none; align-self: stretch; margin: 0 0 8px; } }
.el-opts { display: flex; flex-direction: column; gap: 6px; }
.el-opt { text-align: left; padding: 8px 12px; border: 1.5px solid var(--tan); background: var(--card-focus); color: var(--ink); font: 14px var(--font-text); cursor: pointer; }
.el-opt:hover:not(:disabled) { border-color: var(--brown); }
.el-opt.is-barred { color: var(--muted); background: transparent; cursor: default; }
.el-eq { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
.el-eq__at { transition: transform .9s ease-in-out, opacity .5s; }
.el-form .eq--big, .el-ctrl .eq--big { display: flex; justify-content: center; gap: 10px; font-size: 22px; }
.el-ctrl .eq--big sub { font-size: .65em; }
.el-ctrl__ask { margin: 0; font-size: 16px; font-weight: 700; }
.el-ctrl__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.el-ctrl__groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.el-ctrl__group { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; padding: 8px; border: 1.5px dashed var(--tan); }
.el-ctrl__group > span { width: 100%; font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.el-ctrl__group .btn { min-height: 36px; padding: 6px 10px; }
.el-ctrl__end { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.el-ctrl__end .btn--ghost { margin-right: auto; }
.el-form { display: flex; flex-direction: column; gap: 12px; }
.el-form fieldset { margin: 0; padding: 10px 12px; border: 1.5px solid var(--tan); display: flex; flex-direction: column; gap: 6px; }
.el-form legend { padding: 0 4px; font-weight: 700; font-size: 14px; }
.el-form label { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; cursor: pointer; }
.el-form label input[type=radio] { margin-top: 3px; }
.el-form input[type=text], .form select { min-height: 36px; padding: 4px 8px; font: 15px var(--font-text); border: 1.5px solid var(--tan); background: var(--card-focus); color: var(--ink); }
.el-form .num { width: 64px; text-align: center; }
.el-form .eq { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 18px; }
.el-form .eq sub { font-size: .65em; }
.el-fb { padding: 10px 12px; border: 1.5px solid var(--tan); background: var(--dim); font-size: 14px; line-height: 1.4; }
.el-fb--ok { border-color: var(--teal); background: var(--teal-bg); color: var(--teal-dark); }
.el-fb--ko { border-color: var(--red); background: var(--red-bg); color: var(--red); }
.el-fb p { margin: 0 0 4px; } .el-fb p:last-child { margin: 0; }
.el-fb p { display: flex; gap: 6px; align-items: flex-start; } .el-fb p svg { flex: none; margin-top: 2px; }

.el .btn.is-on { background: var(--dim); border-color: #b8892f; }
.modal:has(.el:not([data-ro])) [data-q-submit] { display: none; }   /* le jeu envoie lui-même la réponse à la fin */
.modal--full:has(.el) { width: calc(100vw - 32px); }
.modal__body:has(.el) { padding: 8px 12px; }
@media (max-width: 599px) { .el-ctrl__groups { grid-template-columns: 1fr; } .modal:has(.el) #ex-type { display: none; } }

.lvl-ask { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ============================================================ jeu « H₂ ou O₂ ? » (type « utilites », Chimie 3 2.5)
   utilites.js ; scène dessinée en SVG sur le fond du labo ; la note après le jeu reprend .gz-res. */
.ut { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.ut__hud { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 15px; color: var(--muted); }
.ut__hud b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ut__streak { font-family: var(--font-hand); font-size: 24px; color: #c2552b; min-width: 7em; }
.ut__dots { display: flex; gap: 4px; }
.ut__dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--tan); }
.ut__dots i.ok { background: var(--teal-dark); border-color: var(--teal-dark); } .ut__dots i.ko { background: var(--red); border-color: var(--red); } .ut__dots i.now { border-color: var(--ink); border-width: 2.5px; }
.ut__tilt { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.ut__tilt[aria-pressed="true"] { background: var(--ink); color: var(--paper, #fff8e8); }
.ut__stage { position: relative; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--tan); user-select: none; -webkit-user-select: none; }
.ut__stage svg { display: block; width: 100%; height: auto; touch-action: none; }
.ut__erlen, .ut__balloon { cursor: pointer; }
.ut__erlen:hover .ut__glass, .ut__erlen.is-hot .ut__glass, .ut__erlen:focus-visible .ut__glass { stroke-width: 5; }
.ut__erlen:focus { outline: none; }
.ut__stage--knife, .ut__stage--knife * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Cpath d='M3 31 L17 17' stroke='%235a3a1c' stroke-width='6' stroke-linecap='round'/%3E%3Cpath d='M15 19 L30 4 Q33 8 29 12 L19 22 Z' fill='%23e8ecf0' stroke='%233b2a16' stroke-width='1.6'/%3E%3Cpath d='M18 18 L29 7' stroke='%23ffffff' stroke-width='1'/%3E%3C/svg%3E") 30 4, crosshair; }
.ut__card { width: 100%; height: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: center; padding: 8px 12px; font-family: var(--font-text); font-size: 21px; line-height: 1.3; text-align: center; color: #3b2a16; text-wrap: balance; }
.ut__over { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 12px; align-items: center; background: #fff8e8; color: #3b2a16; border: 2px solid #b89b6d; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); padding: 10px 12px; }
.ut__over img { width: 84px; height: 84px; flex: none; }
.ut__over--ko { border-color: #b3402f; } .ut__over--ko b { color: #b3402f; }
.ut__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-size: 15px; line-height: 1.45; }
.ut__body p { margin: 0; }
.ut__endtitle { font-family: var(--font-hand); font-size: 30px; font-weight: 700; color: #7c4a1e; line-height: 1; }
.ut__endscore { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ut__flash { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); font-family: var(--font-hand); font-weight: 700; font-size: 40px; padding: 4px 16px; border-radius: 10px; background: #fff8e8; border: 2px solid; pointer-events: none; white-space: nowrap; }
.ut__flash.is-ok { color: #3f7a72; border-color: #3f7a72; } .ut__flash.is-ko { color: #b3402f; border-color: #b3402f; }
.ut-res { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.ut-res__note { margin: 0 0 6px; color: var(--red); }
@media (max-width: 560px) { .ut__card { font-size: 19px; } .ut__over img { width: 60px; height: 60px; } .ut__body { font-size: 14px; } .ut__flash { font-size: 30px; } }
@media (prefers-reduced-motion: reduce) { .ut__flash { transition: none; } }
