/* EPL2 Coach — « la planche et le carnet ».
   Light: millimetre paper, blue-black ink, one stroke of highlighter.
   Dark: the same sheet printed as a blueprint. One colour per course. */

:root {
  --bg: #eef2f0;
  --grid: rgba(40, 90, 110, .07);
  --grid-maj: rgba(40, 90, 110, .13);
  --surface: #fbfcfb;
  --surface-2: #e9eeec;
  --fg: #14213a;
  --muted: #55617a;
  --line: #d3dbd9;
  --line-strong: #9aa7b0;
  --accent: #2346c8;
  --accent-soft: #e3e9fb;
  --hl: #ffe14d;
  --hl-ink: #14213a;
  --hl-edge: #e9bf00;
  --mark-bg: #ffe14d;
  --note-bg: #fff7cf;
  --btn-bg: #14213a;
  --btn-fg: #fbfcfb;
  --btn-hover: #2346c8;
  --sel: #14213a;
  --focus: #2346c8;
  --ok: #17693f; --ok-soft: #dcefe3;
  --bad: #a8322a; --bad-soft: #fae4e0;
  --warn: #8a4f00; --warn-soft: #faecd0;
  --sig-red: #d4483c; --sig-orange: #e8922a;
  --shadow: rgba(20, 33, 58, .16);
  --hard: #14213a;
  --code-bg: #f2f5f4;
  --c-LEPL1103: #2a68a8; --c-LEPL1108: #7450ad; --c-LEPL1203: #b04a14; --c-LEPL1302: #177a4e; --c-LEPL1402: #b83166;
  --c-default: #55617a;
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --f-read: "STIX Two Text", "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 6px;
  --nav-h: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1829;
    --grid: rgba(130, 175, 235, .055);
    --grid-maj: rgba(130, 175, 235, .11);
    --surface: #122138;
    --surface-2: #1a2d49;
    --fg: #e7eef8;
    --muted: #a0b2cc;
    --line: #25395a;
    --line-strong: #4a6288;
    --accent: #9cc2ff;
    --accent-soft: #1b3258;
    --hl-edge: #ffe14d;
    --mark-bg: rgba(255, 225, 77, .3);
    --note-bg: rgba(255, 225, 77, .08);
    --btn-bg: #ffe14d;
    --btn-fg: #14213a;
    --btn-hover: #fff0a0;
    --sel: #ffe14d;
    --focus: #ffe14d;
    --ok: #74d9a4; --ok-soft: #123a2c;
    --bad: #ff9a8f; --bad-soft: #43201f;
    --warn: #f6b968; --warn-soft: #3d2c12;
    --sig-red: #ff8275; --sig-orange: #f6b968;
    --shadow: rgba(0, 0, 0, .45);
    --hard: #050c17;
    --code-bg: #0e1b30;
    --c-LEPL1103: #7fb6f2; --c-LEPL1108: #bca0f2; --c-LEPL1203: #f4a070; --c-LEPL1302: #66d2a0; --c-LEPL1402: #f48bb2;
    --c-default: #a0b2cc;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding: 72px 0 calc(var(--nav-h) + 20px); }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-maj) 1px, transparent 1px), linear-gradient(90deg, var(--grid-maj) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  color: var(--fg); font-family: var(--f-ui); font-size: 16px; line-height: 1.55;
  overflow-wrap: break-word; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-family: var(--f-head); font-size: clamp(30px, 5.200vw, 44px); font-weight: 700; letter-spacing: -.012em; line-height: 1.05; }
h2 { font-family: var(--f-head); font-size: 24px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 17px; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.300em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--hl); color: var(--hl-ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.mono { font-family: var(--f-mono); font-size: .88em; }
.eyebrow { font-family: var(--f-mono); font-size: 11.500px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 500; }
.mark { background: linear-gradient(transparent 52%, var(--mark-bg) 52%, var(--mark-bg) 92%, transparent 92%); padding: 0 .150em; margin: 0 -.150em; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.stack { display: grid; gap: 14px; min-width: 0; }

/* ---------------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line-strong); }
.topbar-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 22px; min-height: 58px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; min-height: 40px; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 4px; background: var(--hl-ink); color: #fbfcfb;
  font-family: var(--f-head); font-weight: 700; font-size: 19px; line-height: 1; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.brand-mark sup { color: var(--hl); font-size: .62em; margin: -9px 0 0 1px; }
.brand-name, .login h1 { font-family: var(--f-head); font-weight: 700; letter-spacing: .01em; }
.brand-name { font-size: 19px; white-space: nowrap; }
.brand-name em, .login h1 em { font-style: normal; font-weight: 500; color: var(--muted); }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; }
.nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 4px; color: var(--muted);
  text-decoration: none; font-weight: 500; font-size: 15px; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--surface-2); }
.nav a.active { color: var(--fg); font-weight: 600; background: linear-gradient(transparent 60%, var(--mark-bg) 60%, var(--mark-bg) 82%, transparent 82%) no-repeat 12px 0 / calc(100% - 24px) 100%; }
.nav .ico, .nav-short { display: none; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--hl); color: var(--hl-ink);
  font-family: var(--f-mono); font-size: 11.500px; font-weight: 600; box-shadow: 0 0 0 1px var(--hl-ink); }
.who { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; white-space: nowrap; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 2px; min-height: 40px; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { color: var(--fg); }

.main { max-width: 1120px; margin: 0 auto; display: grid; gap: 30px; min-width: 0;
  padding: 30px max(16px, env(safe-area-inset-right)) calc(72px + var(--nav-h)) max(16px, env(safe-area-inset-left)); }
.main > * { min-width: 0; }
.main { overflow-x: clip; }
.narrow { max-width: 760px; width: 100%; margin: 0 auto; display: grid; gap: 22px; min-width: 0; }
.narrow > * { min-width: 0; }
.page-head, .week-head { display: grid; gap: 8px; }
.section-head { display: flex; align-items: center; gap: 14px; }
.section-head::after { content: ""; flex: 1; height: 9px; order: 1; border: solid var(--line-strong); border-width: 0 1px;
  background: linear-gradient(var(--line-strong), var(--line-strong)) center / 100% 1px no-repeat; }
.section-head a { order: 2; font-size: 14px; white-space: nowrap; min-height: 40px; display: inline-flex; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; width: fit-content; color: var(--muted); text-decoration: none; font-size: 14.500px; font-weight: 500; }
.back:hover { color: var(--fg); }
.back .ico { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 15px; line-height: 1.2;
  text-decoration: none; color: var(--fg); text-align: center; }
.btn:hover { border-color: var(--fg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn.small { min-height: 40px; padding: 0 13px; font-size: 14px; }
.btn.quiet { border-color: transparent; background: none; color: var(--muted); font-weight: 500; padding: 0 10px; }
.btn.quiet:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.course-btn { border-left: 4px solid var(--cc, var(--line-strong)); font-family: var(--f-mono); font-weight: 500; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
input:not([type=radio]):not([type=checkbox]), textarea, select { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 10px 12px; width: 100%; min-height: 44px; font-size: 16px; font-weight: 400; }
textarea { display: block; line-height: 1.5; resize: vertical; }
input:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
::placeholder { color: var(--muted); opacity: .8; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.card > * { min-width: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.course-code { font-family: var(--f-mono); font-size: 12.500px; color: var(--cc, var(--muted)); font-weight: 600; letter-spacing: .04em; }
.course-code:not(:empty)::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; background: currentColor; }
.course-card { position: relative; padding-left: 28px; text-decoration: none; color: inherit; overflow: hidden; }
.course-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: var(--cc, var(--c-default)); }
.course-card .course-code::before { display: none; }
@media (hover: hover) { .course-card:hover { border-color: var(--cc); box-shadow: 4px 4px 0 var(--cc); transform: translate(-2px, -2px); } }
.course-card:active { border-color: var(--cc); }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .progress { flex: 1; }
.meter-val { font-family: var(--f-mono); font-size: 12.500px; font-weight: 500; min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
/* progress as a dimension line: end ticks, graduations every 10 %, a solid bar for what is done */
.progress { position: relative; height: 12px; border: solid var(--line-strong); border-width: 0 1px;
  background: linear-gradient(var(--line-strong), var(--line-strong)) center / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--line) calc(10% - 1px) 10%); }
.progress > span { position: absolute; left: 0; top: 3px; height: 6px; background: var(--cc, var(--accent)); }
.stats { display: flex; gap: 4px 16px; flex-wrap: wrap; font-size: 13.500px; color: var(--muted); }
.stats b { color: var(--fg); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------------------------------------------------------------- dashboard */
.hero { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.550fr) minmax(0, 1fr); align-items: stretch; }
.hero-main { gap: 10px; padding: 26px; }
.hero-sub { font-size: 17px; }
.countdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 0; margin-top: 6px; }
.countdown > div { padding: 2px 16px; border-left: 1px solid var(--line-strong); font-size: 13.500px; line-height: 1.35; }
.countdown > div:first-child { padding-left: 0; border-left: 0; }
.countdown .n { font-family: var(--f-head); font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 4px; color: var(--fg); }

.ruler { margin: 12px 0 4px; font-family: var(--f-mono); font-size: 11px; }
.ruler-flags, .ruler-months { position: relative; height: 20px; }
.ruler-flag { position: absolute; bottom: 0; padding: 0 0 3px 6px; border-left: 1px solid var(--fg); white-space: nowrap; font-weight: 500; line-height: 1.2; }
.ruler-flag.flip { transform: translateX(-100%); border-left: 0; border-right: 1px solid var(--fg); padding: 0 6px 3px 0; }
.ruler-scale { position: relative; height: 38px; border: 1px solid var(--fg); border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.ruler-scale svg { position: absolute; inset: 0 0 auto 0; width: 100%; height: 20px; }
.ruler-scale line { stroke: var(--fg); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .4; }
.ruler-scale line.maj { opacity: .85; }
.ruler-zone { position: absolute; inset: 0 0 0 auto; border-left: 1px solid var(--fg);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--fg) 22%, transparent) 0 1px, transparent 1px 7px), var(--mark-bg); }
.ruler-now { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.ruler-pin { position: absolute; bottom: 5px; width: 11px; height: 11px; margin-left: -5.500px; background: var(--cc); border: 1.500px solid var(--surface); transform: rotate(45deg); }
.ruler-months span { position: absolute; top: 4px; color: var(--muted); white-space: nowrap; }
.ruler-months span:first-child { color: var(--fg); font-weight: 600; }

/* the one loud thing on the page: a highlighter-yellow label for what to do now */
.next-step { --fg: #14213a; --muted: #3c4863; --surface: transparent; --line-strong: rgba(20, 33, 58, .55); --btn-bg: #14213a; --btn-fg: #fff6c2;
  --btn-hover: #2346c8; --focus: #14213a; --accent: #14213a;
  background: var(--hl); color: var(--fg); border-color: var(--hl-ink); box-shadow: 6px 6px 0 var(--hard); padding: 26px; gap: 12px;
  align-content: center; margin: 0 6px 6px 0; }
.next-step h2 { font-size: 30px; }
.next-step .mark { background: var(--hl-ink); color: var(--hl); padding: 2px 10px 3px; margin: 0; border-radius: 3px; display: inline-block; font-size: .8em; letter-spacing: .02em; }
.next-title { font-family: var(--f-head); font-size: 24px; font-weight: 600; line-height: 1.2; text-wrap: balance; }
.next-step .btn:not(.primary) { background: rgba(255, 255, 255, .35); }
.next-step .btn:not(.primary):hover { background: rgba(255, 255, 255, .6); }
.next-extra { justify-self: start; }

/* ---------------------------------------------------------------- pills (small labels) */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 22px; padding: 1px 8px; border-radius: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.3; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }

/* ---------------------------------------------------------------- course page */
.exam-line .eyebrow { margin-right: 6px; }
.weeks { display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.week-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); align-items: center; }
.week-row:first-child { border-top: 0; }
.week-row:hover { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.week-row .s { font-family: var(--f-head); font-weight: 700; font-size: 24px; line-height: 1; color: var(--cc, var(--muted)); font-variant-numeric: tabular-nums; }
.week-row.soon .s { color: var(--muted); opacity: .7; }
.week-row .t { min-width: 0; display: grid; gap: 6px; }
.week-row .t a { color: var(--fg); text-decoration: none; font-weight: 600; font-size: 16.500px; line-height: 1.3; padding: 4px 0; }
.week-row .t a:hover { text-decoration: underline; text-decoration-color: var(--cc); text-decoration-thickness: 2px; }
.week-row .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.week-row .cm { font-size: 13px; }
details > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 8px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+"; font-family: var(--f-mono); font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 3px; flex: none; }
details[open] > summary::before { content: "–"; }
.fold[open] > summary { margin-bottom: 6px; }
.sources { font-size: 14px; }
.sources ul { margin-top: 6px; }

/* ---------------------------------------------------------------- reading */
.reading { font-family: var(--f-read); font-size: 18.500px; line-height: 1.68; min-width: 0; counter-reset: sec; font-variant-numeric: oldstyle-nums; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); border-top: 4px solid var(--cc, var(--fg));
  padding: clamp(22px, 5vw, 44px) clamp(18px, 8vw, 64px) clamp(22px, 5vw, 48px); }
.reading > :first-child { margin-top: 0; }
.reading > h2:first-child { padding-top: 0; border-top: 0; }
.reading > :last-child { margin-bottom: 0; }
.reading h1, .reading h2, .reading h3, .reading h4 { font-variant-numeric: normal; }
.reading h1 { font-size: 30px; margin: 0 0 16px; }
.reading h2 { font-size: 25px; margin: 42px 0 12px; padding-top: 16px; border-top: 1px solid var(--line-strong); }
.reading h3 { font-family: var(--f-ui); font-size: 17.500px; margin: 26px 0 8px; }
.sheet h2, #course-md h2 { counter-increment: sec; display: flex; align-items: baseline; gap: 12px; }
.sheet h2::before, #course-md h2::before { content: counter(sec, decimal-leading-zero); font-family: var(--f-mono); font-size: 13px; font-weight: 500; color: var(--cc, var(--muted)); letter-spacing: .04em; flex: none; }
.reading p, .reading ul, .reading ol, .reading blockquote, .reading table, .reading pre { margin: 0 0 16px; }
.reading li { margin: 5px 0; }
.reading li::marker { color: var(--cc, var(--muted)); font-family: var(--f-mono); font-size: .85em; }
.reading strong { font-weight: 600; }
.reading a { color: var(--accent); }
.reading hr { border: 0; border-top: 1px solid var(--line-strong); margin: 28px 0; }
.reading blockquote { border-left: 4px solid var(--hl-edge); padding: 12px 18px; background: var(--note-bg); border-radius: 0 var(--r) var(--r) 0; }
.reading blockquote > :last-child { margin-bottom: 0; }
.reading code { font-family: var(--f-mono); font-size: .8em; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; font-variant-numeric: normal; }
.reading pre { overflow-x: auto; background: var(--code-bg); border: 1px solid var(--line); border-left: 3px solid var(--cc, var(--line-strong)); border-radius: var(--r);
  padding: 14px 16px; font-size: 14px; line-height: 1.55; max-width: 100%; }
.reading pre code, .reading pre code.hljs { background: none; padding: 0; font-size: inherit; display: block; width: max-content; min-width: 100%; }
.reading table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; width: fit-content; font-family: var(--f-ui); font-size: 15px; line-height: 1.45; font-variant-numeric: normal; }
.reading th, .reading td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; min-width: 7.500em; }
.reading th { background: var(--surface-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.reading .katex { font-size: 1.080em; font-variant-numeric: normal; }
.reading .katex-display { overflow-x: auto; overflow-y: hidden; padding: 8px 2px; margin: 18px 0; }
.reading img { max-width: 100%; height: auto; }
.resume { font-size: 17px; }

.sticky-actions { position: sticky; bottom: calc(12px + var(--nav-h)); z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px; box-shadow: 0 10px 28px var(--shadow); width: fit-content; max-width: 100%; }
.sticky-actions:empty { display: none; }
.after-actions { justify-content: flex-end; margin-top: -10px; }

/* ---------------------------------------------------------------- quiz */
.quiz-top { display: grid; gap: 8px; }
.quiz-title { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.counter { font-family: var(--f-mono); font-size: 14px; color: var(--muted); white-space: nowrap; }
.counter b { color: var(--fg); font-size: 18px; font-weight: 600; }
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.steps i { height: 10px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--surface); }
.steps i.cur { background: var(--hl); border-color: var(--sel); }
.steps i.ok { background: var(--ok); border-color: var(--ok); }
.steps i.bad { border-color: var(--bad); background: repeating-linear-gradient(135deg, var(--bad) 0 2px, var(--bad-soft) 2px 5px); }
.qcard { background: var(--surface); border: 1px solid var(--line-strong); border-top: 4px solid var(--cc, var(--fg)); border-radius: var(--r);
  padding: clamp(16px, 4.500vw, 30px); display: grid; gap: 18px; min-width: 0; }
.qcard > * { min-width: 0; }
#fb:empty, #qactions:empty { display: none; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.qno { font-family: var(--f-mono); font-size: 12.500px; font-weight: 600; background: var(--fg); color: var(--surface); padding: 2px 8px; border-radius: 3px; }
.diff { display: inline-flex; gap: 3px; margin-left: auto; padding: 6px 0 6px 6px; }
.diff i { width: 9px; height: 9px; border: 1px solid var(--muted); border-radius: 1px; }
.diff i.on { background: var(--muted); }
.qprompt { font-size: 19px; line-height: 1.6; }
.hint { font-size: 14px; }
.choices { display: grid; gap: 10px; }
.choice { position: relative; display: flex; gap: 14px; align-items: center; min-height: 54px; padding: 10px 14px; border: 1.500px solid var(--line-strong);
  border-radius: 8px; cursor: pointer; background: var(--surface); font-size: 16.500px; line-height: 1.45; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.choice .key { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 1.500px solid var(--line-strong); border-radius: 4px;
  font-family: var(--f-mono); font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); }
.choice input[type=radio] + .key { border-radius: 50%; }
.choice .lbl { min-width: 0; overflow-x: auto; flex: 1; }
.choice:hover { border-color: var(--fg); background: color-mix(in srgb, var(--surface-2) 50%, var(--surface)); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice:has(input:checked) { border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel); background: var(--note-bg); }
.choice:has(input:checked) .key { background: var(--hl); border-color: var(--hl-ink); color: var(--hl-ink); }
.answered .choice { cursor: default; }
.answered .choice:not(.is-correct):not(.is-wrong) { opacity: .55; border-color: var(--line); box-shadow: none; background: var(--surface); }
.answered .choice.is-correct { border-color: var(--ok); background: var(--ok-soft); box-shadow: none; }
.answered .choice.is-correct:has(input:checked) { box-shadow: inset 0 0 0 1px var(--ok); }
.answered .choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: inset 0 0 0 1px var(--bad); }
.answered .choice.is-correct .key, .answered .choice.is-wrong .key { font-size: 0; border-color: transparent; color: var(--surface); }
.answered .choice.is-correct .key { background: var(--ok); }
.answered .choice.is-wrong .key { background: var(--bad); }
.answered .choice.is-correct .key::before { content: "✓"; font-size: 16px; font-family: var(--f-ui); }
.answered .choice.is-wrong .key::before { content: "✕"; font-size: 14px; font-family: var(--f-ui); }
.answered .choice.is-correct:not(:has(input:checked)) { background: var(--surface); border-style: dashed; }
.answered .choice.is-correct:not(:has(input:checked)) .key { background: none; border-color: var(--ok); color: var(--ok); }
.vf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vf .choice { min-height: 64px; font-weight: 600; font-size: 18px; }
.num-input { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.num-input .eq { font-family: var(--f-mono); font-size: 24px; color: var(--muted); }
.num-input input { max-width: 240px; min-height: 52px; font-family: var(--f-mono); font-size: 18px; border-width: 1.500px; }
.num-input input.is-correct { border-color: var(--ok); background: var(--ok-soft); opacity: 1; }
.num-input input.is-wrong { border-color: var(--bad); background: var(--bad-soft); opacity: 1; }
.num-input .unit { color: var(--muted); font-family: var(--f-read); font-size: 18px; }
.qcard textarea { min-height: 130px; }
.feedback { border-radius: 0 var(--r) var(--r) 0; border-left: 4px solid var(--line-strong); padding: 14px 18px; display: grid; gap: 8px; font-size: 16px; min-width: 0; }
.feedback > * { min-width: 0; }
.feedback.ok { background: var(--ok-soft); border-color: var(--ok); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad); }
.feedback.neutral { background: var(--surface-2); border-color: var(--accent); }
.fb-title { display: flex; align-items: center; gap: 8px; font-family: var(--f-head); font-size: 21px; font-weight: 600; }
.fb-title .ico { width: 22px; height: 22px; stroke-width: 2.500; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback .reading { font-size: 17px; line-height: 1.6; }
.feedback .self { margin-top: 4px; font-weight: 500; }

.result { grid-template-columns: auto minmax(0, 1fr); gap: 12px 30px; align-items: center; padding: 28px; }
.gauge { position: relative; width: 240px; max-width: 100%; }
.gauge svg { display: block; width: 100%; height: auto; overflow: visible; }
.gauge-ticks line { stroke: var(--muted); stroke-width: 1.500; }
.gauge-track, .gauge-fill { fill: none; stroke-width: 14; }
.gauge-track { stroke: var(--surface-2); }
.gauge-fill { stroke: var(--accent); }
.gauge.ok .gauge-fill { stroke: var(--ok); }
.gauge.warn .gauge-fill { stroke: var(--sig-orange); }
.result-big { position: absolute; inset: auto 0 -4px 0; text-align: center; font-family: var(--f-head); font-size: 58px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.result-big small { font-size: 24px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.result-text { display: grid; gap: 10px; }
.result-score { font-size: 17px; }
.result-msg { font-family: var(--f-head); font-size: 23px; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.result .steps { max-width: 320px; }
.miss .reading { font-size: 17px; }

/* ---------------------------------------------------------------- revisions */
.review.has-due { border-color: var(--line-strong); border-left: 4px solid var(--hl-edge); }
.intervals { display: flex; font-family: var(--f-mono); font-size: 11.500px; color: var(--muted); margin: 4px 0; }
.intervals span { flex: 1 1 0; border-top: 1px solid var(--line-strong); padding-top: 8px; position: relative; min-width: 34px; }
.intervals span:nth-child(3) { flex-grow: 2; } .intervals span:nth-child(4) { flex-grow: 3; } .intervals span:nth-child(5) { flex-grow: .6; border-top-style: dashed; }
.intervals i { position: absolute; top: -5px; left: 0; width: 9px; height: 9px; background: var(--surface); border: 2px solid var(--accent); border-radius: 50%; }

/* ---------------------------------------------------------------- tracking */
.alert { display: grid; grid-template-columns: 5px minmax(0, 1fr); gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.alert .bar { background: var(--muted); }
.alert.rouge .bar { background: var(--sig-red); } .alert.orange .bar { background: var(--sig-orange); } .alert.jaune .bar { background: var(--hl-edge); } .alert.vert .bar { background: var(--ok); }
.alert .body { padding: 14px 16px 14px 0; display: grid; gap: 4px; align-content: start; font-size: 14.500px; }
.alert .body strong { font-size: 16px; line-height: 1.3; }
.todo { list-style: none; padding: 0; display: grid; }
.todo li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); align-items: baseline; }
.todo li:first-child { border-top: 0; padding-top: 2px; }
.todo .pill { margin-left: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 0; }
.timeline time { font-family: var(--f-mono); font-size: 13px; color: var(--muted); padding: 9px 0; }
.timeline li > span { position: relative; padding: 8px 0 8px 20px; border-left: 1px solid var(--line-strong); }
.timeline li > span::before { content: ""; position: absolute; left: -4.500px; top: 16px; width: 8px; height: 8px; background: var(--surface); border: 1.500px solid var(--fg); border-radius: 50%; }
.h-note { font-family: var(--f-mono); font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 8px; letter-spacing: .04em; }
.heat { display: grid; grid-template-rows: repeat(7, 18px); grid-auto-flow: column; grid-auto-columns: 18px; gap: 4px; }
.heat span { border-radius: 2px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.heat span[data-l="1"] { background: color-mix(in srgb, var(--accent) 35%, var(--surface-2)); box-shadow: none; }
.heat span[data-l="2"] { background: color-mix(in srgb, var(--accent) 65%, var(--surface-2)); box-shadow: none; }
.heat span[data-l="3"] { background: var(--accent); box-shadow: none; }
.heat-legend { display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 11.500px; color: var(--muted); }
.heat-legend .heat { grid-template-rows: 12px; grid-auto-columns: 12px; gap: 3px; }
.table-wrap { overflow-x: auto; max-width: 100%; }
table.data { border-collapse: collapse; width: 100%; font-size: 14.500px; }
table.data th, table.data td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.wrap { white-space: normal; min-width: 220px; }
table.data td.mono { white-space: normal; min-width: 88px; max-width: 170px; }
table.data th { font-family: var(--f-mono); color: var(--muted); font-weight: 500; font-size: 11.500px; text-transform: uppercase; letter-spacing: .07em; border-bottom-color: var(--line-strong); }
td.num, th.num { text-align: right !important; font-variant-numeric: tabular-nums; }
#att-detail:not(:empty) { margin-top: 6px; padding: 4px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--code-bg); }

/* ---------------------------------------------------------------- admin editor */
.editor { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; min-height: 60vh; }
.filelist { max-height: 70vh; overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--code-bg); align-self: start; }
.filelist button { display: block; width: 100%; min-height: 40px; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 8px 12px;
  cursor: pointer; font-family: var(--f-mono); font-size: 12.500px; overflow-wrap: anywhere; }
.filelist button:first-child { border-top: 0; }
.filelist button:hover { background: var(--surface-2); }
.filelist button.sel { background: var(--note-bg); box-shadow: inset 4px 0 0 var(--hl-edge); font-weight: 600; }
.edit-pane { display: grid; gap: 10px; min-width: 0; align-content: start; }
.edit-bar { justify-content: space-between; }
.edit-bar strong { overflow-wrap: anywhere; min-width: 0; }
.editor textarea { font-family: var(--f-mono); font-size: 13.500px; line-height: 1.55; min-height: 60vh; background: var(--code-bg); tab-size: 2; }
.tabs { display: flex; }
.tabs .btn { border-radius: 0; margin-left: -1px; }
.tabs .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.tabs .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.tabs .btn.on { background: var(--fg); color: var(--surface); border-color: var(--fg); position: relative; }
.preview { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-height: 40vh; display: grid; gap: 12px; align-content: start; font-size: 17px; }
.preview > * { margin: 0 !important; }
.qprev { font-size: 16px; gap: 8px; }
.qprev .opt { display: flex; gap: 10px; align-items: baseline; font-family: var(--f-ui); font-size: 15px; }
.qprev .key { font-family: var(--f-mono); font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 3px; flex: none; color: var(--muted); }
.qprev .opt > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.qprev .opt.good { font-weight: 600; }
.qprev .opt.good .key { background: var(--ok); border-color: var(--ok); color: var(--surface); }

/* ---------------------------------------------------------------- login */
.login { max-width: 420px; width: 100%; margin: 7vh auto 0; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: 6px 6px 0 var(--hard); overflow: hidden; }
.login-plate { height: 150px; border-bottom: 1px solid var(--line-strong); background-color: var(--surface-2);
  background-image: linear-gradient(var(--grid-maj) 1px, transparent 1px), linear-gradient(90deg, var(--grid-maj) 1px, transparent 1px);
  background-size: 16px 16px; }
.login-plate svg { width: 100%; height: 100%; display: block; }
.login-plate path, .login-plate polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.login-plate .ax { stroke: var(--fg); stroke-width: 1; }
.login-plate .env { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.login-plate .curve { stroke: var(--accent); stroke-width: 2.200; }
.login-plate .dim { stroke: var(--fg); stroke-width: 1; }
.login-plate text { font-family: var(--f-mono); font-size: 9px; fill: var(--muted); }
.login-body { padding: 24px; display: grid; gap: 16px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.login-brand .brand-mark { width: 48px; height: 48px; font-size: 27px; }
.login-brand .brand-mark sup { margin-top: -13px; }
.login h1 { font-size: 30px; }
.login-brand p { font-size: 14px; }

/* ---------------------------------------------------------------- overlays */
.sheet-dialog { position: fixed; left: 16px; right: 16px; bottom: calc(16px + var(--nav-h)); max-width: 560px; margin: 0 auto; z-index: 40;
  border-color: var(--fg); box-shadow: 6px 6px 0 var(--hard), 0 18px 50px var(--shadow); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--nav-h) + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg);
  padding: 11px 18px; border-radius: var(--r); font-weight: 500; font-size: 15px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 8px 24px var(--shadow); text-align: center; }
.err { color: var(--bad); font-weight: 500; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .filelist { max-height: 34vh; }
}
@media (max-width: 760px) {
  :root { --nav-h: calc(60px + env(safe-area-inset-bottom)); }
  .topbar-inner { justify-content: space-between; min-height: 52px; gap: 12px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0;
    background: var(--surface); border-top: 1px solid var(--line-strong); padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left)); }
  .nav a { position: relative; flex-direction: column; justify-content: center; gap: 3px; min-height: 60px; padding: 0 2px; font-size: 11.500px; border-radius: 0; background: none !important; }
  .nav a.active::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 4px; background: var(--hl); box-shadow: 0 0 0 1px var(--hl-ink); }
  .nav .ico { display: block; width: 22px; height: 22px; stroke-width: 1.800; }
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10.500px; }
  .who { font-size: 13px; gap: 10px; min-width: 0; }
  #who-name { overflow: hidden; text-overflow: ellipsis; }
  .main { padding-top: 20px; gap: 24px; }
  .result { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 24px 18px; }
  .result-text { justify-items: center; }
  .result .steps { width: 100%; }
}
@media (max-width: 560px) {
  .main { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .card { padding: 18px 16px; }
  .course-card { padding-left: 24px; }
  .hero-main, .next-step { padding: 20px 16px; }
  .next-step { box-shadow: 4px 4px 0 var(--hard); margin: 0 4px 4px 0; }
  .countdown { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .countdown > div { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px 0; border-left: 0; border-top: 1px solid var(--line); }
  .countdown > div:first-child { border-top: 0; }
  .countdown .n { font-size: 34px; margin: 0; }
  .week-row { grid-template-columns: 44px minmax(0, 1fr); padding: 14px; gap: 6px 10px; }
  .week-row .act { grid-column: 2; }
  .week-row .act:empty { display: none; }
  .reading { font-size: 17.500px; line-height: 1.62; }
  .reading h2 { font-size: 22px; margin-top: 34px; }
  .qprompt { font-size: 18px; }
  .sticky-actions { width: 100%; }
  .sticky-actions .btn { flex: 1 1 auto; padding: 0 12px; }
  .wide-only { display: none; }
  .after-actions { justify-content: center; }
  .todo li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .timeline li { grid-template-columns: 84px minmax(0, 1fr); }
  .login { margin-top: 3vh; box-shadow: 4px 4px 0 var(--hard); }
  .login-plate { height: 120px; }
  #qactions .btn.primary { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: no-preference) {
  .btn, .choice, .choice .key, .course-card, .nav a, .week-row { transition: background-color .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s, opacity .2s; }
  .feedback { animation: rise .28s cubic-bezier(.2, .7, .3, 1) both; }
  .choice.is-correct .key { animation: pop .38s cubic-bezier(.3, 1.600, .5, 1) both; }
  .choice.is-wrong { animation: nudge .3s ease-out both; }
  .steps i.ok, .steps i.bad { animation: pop .3s ease-out both; }
  .gauge-fill { animation: sweep 1s cubic-bezier(.3, .7, .2, 1) .15s both; }
  .result-big { animation: rise .5s ease-out .5s both; }
  .toast, .sheet-dialog { animation: rise .2s ease-out both; }
  .toast { animation-name: rise-c; }
  .qcard { animation: rise .22s ease-out both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise-c { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.180); } 100% { transform: scale(1); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 65% { transform: translateX(3px); } }
@keyframes sweep { from { stroke-dasharray: 0 100; } }
