/* Carnet de révisions — un cahier à petits carreaux, une marge rouge, le stylo du prof. */
:root {
  --paper: #fafbfd;
  --sheet: #ffffff;
  --grid: #e6ecf5;
  --grid-strong: #d5deec;
  --text: #182033;
  --muted: #5b6680;
  --ink: #1c2e8c;          /* stylo bleu */
  --ink-soft: #e9edfb;
  --red: #c8323a;          /* stylo rouge du prof */
  --red-soft: #fbe9ea;
  --hl: #fff1a1;           /* surligneur jaune */
  --hl-strong: #ffe45c;
  --teal: #0f7f77;         /* surligneur turquoise */
  --teal-hl: #c9f2ee;
  --gold: #a26a00;
  --line: #cfd7e6;
  --focus: #3b5bff;
  --shadow: 0 1px 0 rgba(28, 46, 140, .06), 0 8px 24px -16px rgba(28, 46, 140, .35);
  --radius: 10px;
  --rail-w: 268px;
  --font: 'Lexend', system-ui, sans-serif;
  --hand: 'Kalam', 'Segoe Print', cursive;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f1529; --sheet: #151c34; --grid: #1a2340; --grid-strong: #222d50;
    --text: #e4e8f4; --muted: #9aa5c2; --ink: #a9b8ff; --ink-soft: #1f2a52;
    --red: #ff7d84; --red-soft: #3a1c27; --hl: rgba(255, 226, 92, .22); --hl-strong: rgba(255, 226, 92, .4);
    --teal: #5fd6cb; --teal-hl: rgba(95, 214, 203, .2); --gold: #f0b54a; --line: #2b3760; --focus: #8ea2ff;
    --shadow: 0 8px 24px -16px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f1529; --sheet: #151c34; --grid: #1a2340; --grid-strong: #222d50;
  --text: #e4e8f4; --muted: #9aa5c2; --ink: #a9b8ff; --ink-soft: #1f2a52;
  --red: #ff7d84; --red-soft: #3a1c27; --hl: rgba(255, 226, 92, .22); --hl-strong: rgba(255, 226, 92, .4);
  --teal: #5fd6cb; --teal-hl: rgba(95, 214, 203, .2); --gold: #f0b54a; --line: #2b3760; --focus: #8ea2ff;
  --shadow: 0 8px 24px -16px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
b, strong { font-weight: 600; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
code { font-family: var(--mono); font-size: .86em; background: var(--ink-soft); padding: .1em .35em; border-radius: 4px; }
pre code { background: none; padding: 0; }
h1, h2, h3, h4 { font-weight: 500; line-height: 1.25; color: var(--text); }
h1 { font-size: 2.1rem; margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.45rem; margin: 2em 0 .6em; }
h3 { font-size: 1.15rem; margin: 1.6em 0 .5em; }
p { margin: .7em 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.muted { color: var(--muted); }
.hand { font-family: var(--hand); }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sheet);
  border-right: 1px solid var(--line);
  padding: 22px 18px 28px;
  display: flex; flex-direction: column; gap: 6px;
}
.page { padding: 40px clamp(16px, 4vw, 56px) 80px; min-width: 0; }
.page:focus { outline: none; }
.loading { color: var(--muted); }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-bottom: 14px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand span { font-family: var(--hand); font-size: 1.35rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.rail-subject { font-size: .8rem; color: var(--muted); margin: 14px 8px 4px; }
.rail-subject b { color: var(--text); display: block; font-size: .98rem; font-weight: 500; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-size: .95rem;
}
.nav-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-link:hover { background: var(--ink-soft); }
.nav-link[aria-current="page"] { background: var(--ink-soft); color: var(--ink); font-weight: 500; }
.nav-link[aria-current="page"] svg { color: var(--ink); }
.nav-chapters { margin: 2px 0 6px 28px; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.nav-chapters a { display: block; padding: 4px 10px; font-size: .85rem; color: var(--muted); text-decoration: none; border-radius: 0 6px 6px 0; }
.nav-chapters a:hover { color: var(--text); background: var(--ink-soft); }
.nav-chapters a[aria-current="page"] { color: var(--ink); font-weight: 500; border-left: 2px solid var(--ink); margin-left: -1px; }
.rail-foot { margin-top: auto; padding-top: 18px; font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 4px 10px; font: inherit; cursor: pointer; }
.rail-compte { padding-top: 8px; font-size: .78rem; display: flex; justify-content: space-between; gap: 8px; }
.rail-compte form { margin: 0; }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Connexion, inscription, mot de passe ---------- */
.porte {
  width: calc(100% - 32px); max-width: 440px; margin: clamp(24px, 10vh, 96px) auto; padding: 28px clamp(16px, 5vw, 32px);
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.porte h1 { font-size: 1.6rem; }
.porte-titre { margin: 0; color: var(--red); font-size: 1.2rem; }
.porte-champ { display: block; margin-top: 14px; font-size: .92rem; color: var(--muted); }
.porte-champ .answer-input { margin-top: 6px; }
.porte-ok { padding: 14px 18px; border: 1.5px solid var(--teal); border-radius: 8px; color: var(--teal); background: var(--teal-hl); }
.menu-btn { display: none; }

/* La feuille : colonne de lecture avec marge rouge à gauche */
.sheet {
  position: relative;
  max-width: 820px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 40px 40px 64px;
}
.sheet::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 40px;
  border-left: 2px solid var(--red); opacity: .55;
}
.sheet.wide { max-width: 1100px; }
.page-head { max-width: 1100px; margin-bottom: 26px; }
.page-head p { color: var(--muted); max-width: 64ch; margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 500; font-size: .95rem;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--sheet);
  text-decoration: none; line-height: 1.2;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink-soft); filter: none; }
.btn.red { background: var(--red); border-color: var(--red); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }

/* ---------- Tableau de bord ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; max-width: 1100px; }
.dash-main { min-width: 0; }
.resume {
  position: relative; overflow: hidden;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px 28px 26px 64px; margin-bottom: 28px;
}
.resume::before { content: ""; position: absolute; top: 0; bottom: 0; left: 40px; border-left: 2px solid var(--red); opacity: .55; }
.resume .prof-says { font-family: var(--hand); color: var(--red); font-size: 1.45rem; line-height: 1.3; margin: 0 0 6px; }
.resume p { margin: 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; font-weight: 500; color: var(--ink); line-height: 1.1; }
.stat span { font-size: .82rem; color: var(--muted); }
.panel { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.panel h2, .panel h3 { margin: 0 0 10px; font-size: 1.02rem; font-weight: 500; }

/* Carte des notions : des mots surlignés selon la maîtrise */
.notion-map { display: grid; gap: 22px; }
.chap-block h3 { margin: 0 0 8px; font-size: .98rem; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.chap-block h3 a { color: var(--text); text-decoration: none; }
.chap-block h3 a:hover { color: var(--ink); }
.chap-block h3 small { color: var(--muted); font-weight: 300; font-size: .8rem; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.chip {
  --m: 0;
  position: relative; display: inline-block;
  font: inherit; font-size: .9rem; line-height: 1.35; text-align: left;
  color: var(--text); background: transparent; border: 0; cursor: pointer;
  padding: 3px 4px; border-radius: 3px;
  background-image: linear-gradient(var(--chip-hl, var(--hl)), var(--chip-hl, var(--hl)));
  background-repeat: no-repeat;
  background-size: calc(var(--m) * 100%) 72%;
  background-position: 0 70%;
  border-bottom: 2px dotted var(--line);
}
.chip:hover { color: var(--ink); }
.chip.unseen { color: var(--muted); }
.chip.weak { border-bottom: 2px solid var(--red); }
.chip.strong { --chip-hl: var(--teal-hl); border-bottom-color: var(--teal); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--muted); margin: 6px 0 18px; }
.legend i { display: inline-block; width: 26px; height: 10px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }

/* Activité (barres) */
.activity svg { width: 100%; height: auto; display: block; }
.activity .bar { fill: var(--ink); opacity: .8; }
.activity .bar-ok { fill: var(--teal); }
.activity text { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.activity .axis { stroke: var(--line); }

/* ---------- Cours ---------- */
.course { display: grid; grid-template-columns: minmax(0, 820px) 220px; gap: 32px; align-items: start; }
.toc { position: sticky; top: 24px; font-size: .85rem; }
.toc h2 { font-size: .9rem; margin: 0 0 8px; color: var(--muted); font-weight: 400; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 4px 10px; color: var(--muted); text-decoration: none; }
.toc li.l3 a { padding-left: 22px; font-size: .8rem; }
.toc li a:hover { color: var(--ink); }
.prose { max-width: 70ch; }
.prose h1 { font-size: 1.9rem; }
.prose h2 { padding-top: .2em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--muted); }
.prose .math-block { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.katex { font-size: 1.06em; }
.table-wrap { overflow-x: auto; margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--muted); border-bottom: 1.5px solid var(--text); }
pre.code {
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; font-size: .86rem; line-height: 1.55;
  font-family: var(--mono);
}
.hljs-keyword, .hljs-built_in { color: var(--ink); font-weight: 400; }
.hljs-string { color: var(--teal); }
.hljs-number, .hljs-literal { color: var(--gold); }
.hljs-comment { color: var(--muted); font-style: italic; }
.hljs-title, .hljs-title.function_ { color: var(--red); }
.hljs-params { color: var(--text); }
.hljs-type, .hljs-meta { color: var(--teal); }

/* Encadrés */
.callout { margin: 1.3em 0; padding: 12px 18px 12px 18px; border-radius: 8px; border-left: 4px solid var(--ink); background: var(--ink-soft); }
.callout > :last-child { margin-bottom: 0; }
.callout > p:first-of-type { margin-top: 4px; }
.callout-title { font-weight: 500; font-size: .92rem; color: var(--ink); }
.callout-retenir { background: var(--hl); border-left-color: var(--hl-strong); }
.callout-retenir .callout-title { color: var(--text); }
.callout-piege, .callout-attention { background: var(--red-soft); border-left-color: var(--red); }
.callout-piege .callout-title, .callout-attention .callout-title { color: var(--red); }
.callout-methode { background: var(--teal-hl); border-left-color: var(--teal); }
.callout-methode .callout-title { color: var(--teal); }
.callout-exemple { background: transparent; border: 1px dashed var(--line); border-left: 4px solid var(--line); }
.callout-exemple .callout-title { color: var(--muted); }
.callout-def, .callout-prop { background: transparent; border: 1.5px solid var(--ink); border-left-width: 4px; }
.callout-prof { background: transparent; border-left: 0; padding-left: 0; font-family: var(--hand); color: var(--red); font-size: 1.12rem; line-height: 1.45; }
.callout-prof .callout-title { font-family: var(--hand); font-weight: 700; color: var(--red); font-size: 1.15rem; }
.callout-prof::before { content: "✎ "; }
.callout-prof .callout-title { display: inline; }
.callout-prof code { font-family: var(--mono); font-size: .8em; color: var(--text); }

figure.diagram { margin: 1.6em 0; }
figure.slide { margin: 1.6em 0; }
figure.slide img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
figure.slide a { display: inline-block; cursor: zoom-in; }
figure.slide figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) figure.slide img { filter: brightness(.92); } }
:root[data-theme="dark"] figure.slide img { filter: brightness(.92); }
figure.diagram svg { width: 100%; height: auto; display: block; max-width: 680px; }
figure.diagram figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }
/* Classes des schémas SVG */
.d-text { fill: var(--text); font-family: var(--font); }
.d-muted { fill: var(--muted); font-family: var(--font); }
.d-mono { fill: var(--text); font-family: var(--mono); }
.d-red { fill: var(--red); font-family: var(--font); }
.d-gold { fill: var(--gold); font-family: var(--font); }
.d-box { fill: var(--sheet); stroke: var(--text); stroke-width: 1.2; }
.d-box-soft { fill: var(--paper); stroke: var(--line); stroke-width: 1; }
.d-box-red { fill: var(--red-soft); stroke: var(--red); stroke-width: 1.6; }
.d-box-teal { fill: var(--teal-hl); stroke: var(--teal); stroke-width: 1.6; }
.d-hl { fill: var(--hl-strong); stroke: var(--text); stroke-width: 1; }
.d-line { stroke: var(--text); stroke-width: 1.3; }
.d-line-red { stroke: var(--red); stroke-width: 2; }
.d-line-gold { stroke: var(--gold); stroke-width: 2; }
.d-line-thick { stroke: var(--muted); stroke-width: 6; }
.d-line-red-thick { stroke: var(--red); stroke-width: 6; }
.d-fill-ink { fill: var(--text); }
.d-fill-red { fill: var(--red); }
.d-axis { stroke: var(--muted); stroke-width: 1.3; }
.d-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.d-dot { fill: var(--red); }
.d-dot-teal { fill: var(--teal); }
.d-c1, .d-c2, .d-c3, .d-c4, .d-c5 { stroke-width: 2.4; }
.d-c1 { stroke: var(--teal); } .d-c1-t { fill: var(--teal); font-family: var(--font); }
.d-c2 { stroke: var(--ink); } .d-c2-t { fill: var(--ink); font-family: var(--font); }
.d-c3 { stroke: var(--gold); } .d-c3-t { fill: var(--gold); font-family: var(--font); }
.d-c4 { stroke: var(--muted); } .d-c4-t { fill: var(--muted); font-family: var(--font); }
.d-c5 { stroke: var(--red); } .d-c5-t { fill: var(--red); font-family: var(--font); }

.chapter-notions { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 22px; }
.chapter-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Séance (quiz) ---------- */
.setup { max-width: 820px; }
.setup fieldset { border: 0; padding: 0; margin: 0 0 26px; }
.setup legend { font-weight: 500; margin-bottom: 10px; font-size: 1rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice label {
  display: block; height: 100%;
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--sheet); cursor: pointer;
}
.choice label b { display: block; font-weight: 500; }
.choice label span { font-size: .85rem; color: var(--muted); }
.choice input:checked + label { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.chapter-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--sheet); cursor: pointer; font-size: .88rem; }
.pill input { accent-color: var(--ink); margin: 0; }
.pill:has(input:checked) { border-color: var(--ink); color: var(--ink); }

.quiz { display: grid; grid-template-columns: minmax(0, 820px) 280px; gap: 28px; align-items: start; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; font-size: .88rem; color: var(--muted); max-width: 820px; flex-wrap: wrap; }
.progress { flex: 1; min-width: 160px; height: 6px; background: var(--grid-strong); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .4s ease; }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .82rem; color: var(--muted); margin-bottom: 14px; }
.q-meta .tag { background: var(--hl); color: var(--text); padding: 1px 6px; border-radius: 3px; }
.diff { letter-spacing: 2px; color: var(--ink); }
.q-context { margin: 0 0 18px; padding: 12px 16px; border: 1px dashed var(--line); border-radius: 8px; font-size: .92rem; }
.q-context summary { cursor: pointer; color: var(--muted); }
.q-prompt { font-size: 1.06rem; }
.q-prompt > :first-child { margin-top: 0; }
.options { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.option {
  display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start;
  width: 100%; text-align: left; font: inherit; color: var(--text);
  padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--sheet); cursor: pointer;
}
.option:hover { border-color: var(--ink); }
.option .letter { font-weight: 500; color: var(--ink); width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; font-size: .8rem; }
.option[aria-pressed="true"] { border-color: var(--ink); background: var(--ink-soft); }
.option[aria-pressed="true"] .letter { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.option.is-right { border-color: var(--teal); background: var(--teal-hl); }
.option.is-right .letter { background: var(--teal); border-color: var(--teal); color: var(--sheet); }
.option.is-wrong { border-color: var(--red); background: var(--red-soft); }
.option.is-wrong .letter { background: var(--red); border-color: var(--red); color: var(--sheet); }
.option:disabled { cursor: default; }
.option p { margin: 0; }
.answer-input { width: 100%; font: inherit; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--text); margin-top: 16px; }
.answer-input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--ink-soft); }
textarea.answer-input { min-height: 160px; resize: vertical; line-height: 1.5; }
textarea.answer-input.code { font-family: var(--mono); font-size: .88rem; tab-size: 4; min-height: 240px; }
.hint-box { margin-top: 12px; font-size: .92rem; }
.hint-box summary { cursor: pointer; color: var(--muted); }

/* La correction du prof : stylo rouge */
.correction { margin-top: 24px; padding-top: 18px; border-top: 1.5px dashed var(--line); }
.verdict { font-family: var(--hand); font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; color: var(--red); }
.verdict.ok { color: var(--teal); }
.verdict .score { font-size: 1.1rem; margin-left: 8px; }
.why { font-family: var(--hand); color: var(--red); font-size: 1.12rem; line-height: 1.45; margin: 8px 0; padding-left: 14px; border-left: 2px solid var(--red); }
.why > b + p { display: inline; }
.why code { font-family: var(--mono); font-size: .78em; color: var(--text); }
.why.ok { color: var(--teal); border-left-color: var(--teal); }
.explain { margin-top: 10px; }
.explain > :first-child { margin-top: 0; }
.model { margin-top: 14px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.model h4 { margin: 0 0 6px; font-size: .9rem; color: var(--muted); font-weight: 400; }
.rubric { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.rubric label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.rubric label:hover { background: var(--ink-soft); }
.rubric input { margin-top: 5px; accent-color: var(--teal); width: 16px; height: 16px; flex: none; }
.rubric .ai-yes { color: var(--teal); } .rubric .ai-no { color: var(--red); }
.remediation { margin-top: 14px; font-size: .92rem; }
.remediation a { font-weight: 500; }
.ai-box { margin-top: 14px; padding: 14px 16px; border: 1.5px solid var(--ink); border-radius: 8px; }
.ai-box h4 { margin: 0 0 6px; font-size: .9rem; color: var(--ink); font-weight: 500; }
.ai-box textarea { width: 100%; font: inherit; min-height: 60px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--sheet); color: var(--text); }

/* Marge : le carnet de bord de la séance */
.margin { position: sticky; top: 24px; font-size: .88rem; }
.margin h2 { font-size: .9rem; color: var(--muted); font-weight: 400; margin: 0 0 8px; }
.log { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 4px; }
.log li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: baseline; }
.log .mark { font-family: var(--hand); font-weight: 700; font-size: 1.1rem; }
.log .mark.ok { color: var(--teal); } .log .mark.ko { color: var(--red); } .log .mark.mid { color: var(--gold); }
.log span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.delta { display: grid; gap: 8px; }
.delta-row { display: grid; gap: 3px; }
.delta-row b { font-weight: 400; font-size: .84rem; }
.meter { position: relative; height: 8px; border-radius: 99px; background: var(--grid-strong); overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 99px; transition: width .5s ease; }
.meter i.weak { background: var(--red); } .meter i.strong { background: var(--teal); }

/* Bilan */
.bilan-head { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.big-score { font-family: var(--hand); font-size: 3.4rem; line-height: 1; color: var(--red); font-weight: 700; }
.big-score small { font-size: 1.4rem; }
.notion-rows { display: grid; gap: 12px; margin: 14px 0; }
.notion-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 14px; align-items: center; }
.notion-row .lab { font-size: .93rem; }
.notion-row .lab small { display: block; color: var(--muted); font-size: .78rem; }

/* Annales */
.ex-list { display: grid; gap: 12px; max-width: 900px; }
.ex-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 20px; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); }
.ex-item:hover { border-color: var(--ink); }
.ex-item b { font-weight: 500; display: block; }
.ex-item span { font-size: .85rem; color: var(--muted); }
.ex-dots { display: flex; gap: 4px; }
.ex-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--grid-strong); }
.ex-dots i.ok { background: var(--teal); } .ex-dots i.ko { background: var(--red); } .ex-dots i.mid { background: var(--gold); }
.section-title { font-size: 1.05rem; font-weight: 500; margin: 28px 0 12px; color: var(--muted); }
.part { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.part-title { font-size: .85rem; color: var(--muted); margin: 0 0 8px; }
.timer { font-family: var(--mono); font-size: .9rem; color: var(--muted); }

/* Points faibles */
.weak-list { display: grid; gap: 10px; }
.struggle { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.struggle p { margin: 0; font-size: .92rem; }
.struggle small { color: var(--red); font-family: var(--hand); font-size: 1rem; }

/* Fiches */
.fiche-chapter { break-inside: avoid-page; }
.fiche-chapter h2 { border-bottom: 1.5px solid var(--text); padding-bottom: 4px; }

/* Accueil (plusieurs matières) */
.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; max-width: 1100px; }
.subject-card { display: block; padding: 22px 24px 22px 50px; position: relative; background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.subject-card::before { content: ""; position: absolute; left: 30px; top: 0; bottom: 0; border-left: 2px solid var(--red); opacity: .55; }
.subject-card b { font-size: 1.15rem; font-weight: 500; display: block; }
.subject-card p { color: var(--muted); font-size: .9rem; }

.empty { color: var(--muted); font-style: normal; }
.error-box { padding: 14px 18px; border: 1.5px solid var(--red); border-radius: 8px; color: var(--red); background: var(--red-soft); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--sheet); padding: 10px 18px; border-radius: 999px; font-size: .9rem; z-index: 20; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .course { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .quiz { grid-template-columns: minmax(0, 1fr); }
  .margin { position: static; }
}
@media (max-width: 980px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(86vw, 300px); z-index: 30; transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .rail.open { transform: none; }
  .menu-btn { display: inline-flex; position: fixed; top: 12px; left: 12px; z-index: 25; background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: inherit; font-size: .9rem; box-shadow: var(--shadow); }
  .page { padding: 64px 16px 60px; }
  .sheet { padding: 22px 18px 26px 34px; }
  .sheet::before { left: 18px; }
  .resume { padding: 20px 18px 20px 34px; }
  .resume::before { left: 18px; }
  h1 { font-size: 1.6rem; }
  body { font-size: 16px; }
  .notion-row { grid-template-columns: minmax(0, 1fr) 90px; }
  .notion-row .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@media print {
  body { background: #fff; font-size: 11pt; }
  .rail, .menu-btn, .btn, .btn-row, .toc { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; }
  .sheet { border: 0; box-shadow: none; padding: 0 0 0 20px; max-width: none; }
  .sheet::before { left: 4px; }
  .callout { break-inside: avoid; }
}
.fiche-chapter:first-child h2 { margin-top: 0; }
