/* Lesson page. Interface is ink and paper only; colour lives in the illustrations (Icons8 «Pastel hand-drawn»).
   Everything below is built on the tokens in :root — see site/design/GRID.md for the rules. */
:root {
  /* colour */
  --ink: #1C1A19; --ink-2: #3D3935; --muted: #6E6A66; --on-ink-2: #D8D3CD; --on-ink-3: #A9A39D;
  --bg: #FFFFFF; --surface: #F5F4F2; --line: #E6E3DF; --stroke: 1.5px;
  /* course colour: the only colour outside illustrations — watercolour washes, the logo marker, highlights.
     One per course, all pastel with the same lightness (relative luminance 0.50–0.60, ink on it ≥ 9:1). See GRID.md «Course colour». */
  --accent: #FFAE96;
  --sans: "Onest", system-ui, sans-serif;

  /* spacing: 4px base */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* type: seven roles, nothing in between (see GRID.md «Type roles»)
     display 48/52 · title 27/32 · heading 21/28 · body 18/30 · ui 15/22 · small 13/20 · label 13/20 600 caps.
     Weights: 400 text, 600 emphasis and controls, 700 headings only. */
  --t-xs: 13px;  --lh-xs: 20px;    /* small and label */
  --t-sm: 15px;  --lh-sm: 22px;    /* ui: controls, cards, captions, options */
  --t-md: var(--t-sm); --lh-md: var(--lh-sm);   /* legacy alias of ui, kept for pages.css */
  --t-body: 18px; --lh-body: 30px;
  --t-lg: 21px;  --lh-lg: 28px;
  --t-xl: 27px;  --lh-xl: 32px;
  --t-2xl: 48px; --lh-2xl: 52px;
  --t-3xl: 56px; --lh-3xl: 60px;

  /* radii: controls / cards / large surfaces */
  --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

  /* layout */
  --topbar-h: 56px; --sidebar-w: 288px; --panel-w: 440px;
  --measure: 688px;            /* reading column: ~70 characters at 18px */
  --wide: 960px;               /* wide blocks: the reading column + 136px each side */
  --gutter: var(--s-6);        /* page side padding */
  --col-offset: max(var(--s-5), calc((min(100%, var(--wide)) - var(--measure)) / 2));   /* aligns wide-block content to the reading column */
}
body { font: var(--t-body)/var(--lh-body) var(--sans); color: var(--ink); }
::selection { background: var(--ink); color: #fff; }

/* ---------- Top bar: 56px, pills 32px ---------- */
.topbar { height: var(--topbar-h); padding: 0 var(--s-5); gap: var(--s-3); background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
  border-bottom: var(--stroke) solid var(--ink); font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
/* «Маркер»: the p is ink, the swash takes the course colour (--accent); sized so the p reads with the 15px name */
.brand .mk { flex: none; width: 30px; height: 30px; margin: -2px 0 0 -4px; }
.crumbs .sep { opacity: .4; }
.course-name { color: var(--ink); font-weight: 400; }
.resume, .dict-counter, .ask-agnes { height: 32px; display: inline-flex; align-items: center; padding: 0 var(--s-3); border-radius: var(--r-pill);
  border: var(--stroke) solid var(--ink); font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; white-space: nowrap; }
.resume, .dict-counter { background: #fff; color: var(--ink); }
.resume { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 400; }
.resume b { font-weight: 400; }
.dict-counter b { background: var(--ink); color: #fff; border-radius: var(--r-pill); padding: 0 7px; margin-left: 6px; font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 400; }
.ask-agnes { background: var(--ink); color: #fff; padding: 0 var(--s-4); }
.ask-agnes::before { content: "✦"; margin-right: 6px; }
.topbar .avatar { width: 32px; height: 32px; background: #fff; color: var(--ink); font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; box-shadow: inset 0 0 0 var(--stroke) var(--ink); }
.progress { height: 3px; bottom: -1.5px; }
.progress-bar { background: var(--ink); }

/* ---------- Shell: sidebar 288 + content ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); max-width: none; }
/* Course map: progress, lessons as links with status circles, sections of the current lesson on a thin line */
.outline { display: flex; flex-direction: column; gap: var(--s-5); position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow: auto;
  background: #fff; border-right: 1px solid var(--line); padding: var(--s-6) var(--s-4) var(--s-5); font-size: var(--t-sm); line-height: var(--lh-sm); }
.ol-course { padding: 0 var(--s-2); }
.ol-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.ol-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.seg { display: flex; gap: 3px; margin: var(--s-2) 0 var(--s-1); }
.seg i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); }
.seg i.d { background: var(--ink); }
.seg i.c { background: linear-gradient(90deg, var(--ink) 45%, var(--line) 45%); }
.ol-meta { color: var(--muted); font-size: var(--t-xs); line-height: var(--lh-xs); }
.ol-results { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3); padding: var(--s-2); border-radius: var(--r-md); color: var(--ink); font-weight: 600; text-decoration: none; box-shadow: inset 0 0 0 var(--stroke) var(--ink); }
.ol-results[hidden] { display: none; }
.ol-results:hover { background: var(--surface); }
.ol-lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.ol-lessons > li > a { display: flex; align-items: center; gap: var(--s-3); padding: 6px var(--s-2); border-radius: var(--r-md); color: var(--ink-2); text-decoration: none; }
.ol-lessons > li > a:hover { background: var(--surface); }
.st { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: var(--t-xs); line-height: 1; box-shadow: inset 0 0 0 var(--stroke) var(--line); color: var(--muted); }
.ol-lessons .done .st, .ol-results .st { background: var(--ink); color: #fff; box-shadow: none; }
.ol-lessons .cur > a { color: var(--ink); font-weight: 600; background: var(--surface); }
.ol-lessons .cur .st { box-shadow: inset 0 0 0 2px var(--ink); color: var(--ink); font-weight: 600; }
.ol-lessons .cur.done .st { background: var(--ink); color: #fff; }
.ol-secs { list-style: none; margin: var(--s-1) 0 var(--s-2) 19px; padding: 0 0 0 var(--s-4); border-left: 1.5px solid var(--line); display: grid; gap: 2px; }
.ol-secs li { position: relative; }
.ol-secs li::before { content: ""; position: absolute; left: calc(-1 * var(--s-4) - 4.5px); top: 9px; width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); }
.ol-secs a { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; font-size: var(--t-xs); line-height: var(--lh-xs); }
.ol-secs a:hover { color: var(--ink); }
.ol-secs li.read::before { background: var(--ink); box-shadow: none; }
.ol-secs li.read a { color: var(--ink-2); }
.ol-secs li.now::before { box-shadow: inset 0 0 0 2px var(--ink); }
.ol-secs li.now a { color: var(--ink); }
.map-btn, .map-backdrop { display: none; }

/* ---------- Lesson columns: wide (960) and reading (688), both centred on one axis ---------- */
.lesson { position: relative; width: 100%; max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter);
  container-type: inline-size; container-name: lesson; }   /* the cover adapts to this column, which narrows when Agnes is open */
#article, .quiz, .lesson-nav { max-width: var(--measure); margin-left: auto; margin-right: auto; }

/* ---------- Lesson head: black card on the wide column; its text starts on the reading column's edge ---------- */
.kicker { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-4); }
h1 { font-size: var(--t-2xl); line-height: var(--lh-2xl); letter-spacing: -.035em; font-weight: 700; margin: 0; }
.lesson-head { position: relative; max-width: var(--wide); margin: var(--s-9) auto var(--s-8); background: var(--ink); color: #fff; border-radius: var(--r-xl);
  padding: var(--s-8) calc(232px + var(--s-7) + var(--s-6)) var(--s-7) var(--col-offset); }
.lesson-head .kicker { color: var(--on-ink-3); }
.lesson-head h1 { color: #fff; }
.lesson-lead { margin: var(--s-4) 0 0; color: var(--on-ink-2); font-size: var(--t-body); line-height: var(--lh-body); max-width: 30em; }
.lesson-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.btn-light, .btn-ghost-light { height: 48px; display: inline-flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-5); border-radius: var(--r-md);
  font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; text-decoration: none; }
.btn-light { background: #fff; color: var(--ink); border: var(--stroke) solid #fff; }
.btn-light::after { content: "↓"; font-weight: 400; }
.btn-ghost-light { background: transparent; color: #fff; border: var(--stroke) solid rgba(255,255,255,.45); }
.btn-ghost-light:hover { border-color: #fff; }
.hero-plate { position: absolute; top: calc(-1 * var(--s-7)); right: var(--s-7); width: 232px; height: 232px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; box-shadow: 0 0 0 var(--stroke) var(--ink), 0 24px 40px -18px rgba(0,0,0,.45); }
.lesson-hero { width: 200px; height: 200px; object-fit: contain; }
/* A narrow lesson column (a laptop with Agnes open, a tablet): the plate moves to the corner and the text takes the full width.
   Phones keep their own full-bleed rules below (@media 640px), which come later and win. */
@container lesson (max-width: 820px) {
  .lesson-head { padding: var(--s-7) var(--s-6) var(--s-6); }
  .hero-plate { top: calc(-1 * var(--s-8)); right: var(--s-4); width: 120px; height: 120px; }
  .lesson-hero { width: 100px; height: 100px; }
  .lesson-cta { margin-top: var(--s-5); }
}
@container lesson (max-width: 560px) {
  .lesson-head h1 { font-size: 34px; line-height: 38px; }
}

/* ---------- Reading rhythm: 30px lines, 24px between paragraphs, 64px above sections ---------- */
article p, .quiz p { margin: 0 0 var(--s-5); }
h2 { font-size: var(--t-xl); line-height: var(--lh-xl); letter-spacing: -.02em; font-weight: 700; margin: var(--s-8) 0 var(--s-4); }
#article > section:first-child h2 { margin-top: 0; }
strong, b { font-weight: 600; }   /* emphasis is semibold; 700 belongs to headings */

/* ---------- Data example: drawn frame + ink/watercolour bars (content, so hand-drawn) ---------- */
.prob-table { position: relative; margin: var(--s-6) 0; border: var(--stroke) solid transparent; border-radius: var(--r-lg); padding: var(--s-5); font-size: var(--t-sm); line-height: var(--lh-sm); }
.prob-table figcaption { font-weight: 600; margin-bottom: var(--s-2); }
.prob-table table { width: 100%; table-layout: fixed; }   /* fixed columns, so bar lengths are computed from a stable cell width */
.prob-table thead th:first-child { width: 42%; }
.prob-table th { color: var(--muted); font-weight: 400; font-size: var(--t-xs); line-height: var(--lh-xs); border-bottom: 0; padding: var(--s-1) var(--s-3) var(--s-1) 0; }
.prob-table td { border-bottom: 1px dashed var(--line); padding: var(--s-2) var(--s-3) var(--s-2) 0; }
.prob-table tr:last-child td { border-bottom: 0; }
.prob-table .wbar { vertical-align: middle; margin: 0 var(--s-2) 0 -4px; overflow: visible; }
.wbar .wash { fill: var(--accent); opacity: .9; transform-box: fill-box; transform-origin: left center; transform: scaleX(0);
  transition: transform .7s cubic-bezier(.3, .7, .3, 1) calc(var(--i) * .12s + .75s); }
.wbar .ink { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: var(--len, 9999); stroke-dashoffset: var(--len, 9999); transition: stroke-dashoffset .8s cubic-bezier(.55, .05, .3, 1) calc(var(--i) * .12s + .45s); }
.prob-table.drawn .wbar .wash { transform: scaleX(1); }
.prob-table.drawn .wbar .ink { stroke-dashoffset: 0; }
@media (prefers-reduced-motion: reduce) { .wbar .wash, .wbar .ink { transition: none; } }

/* ---------- Term card (content, so hand-drawn) ---------- */
.term-card { position: relative; margin: var(--s-6) 0; background: #fff; border: var(--stroke) solid transparent; border-radius: var(--r-lg); padding: var(--s-5); font-size: var(--t-sm); line-height: var(--lh-sm); }
.sketch { position: absolute; left: -5.5px; top: -5.5px; width: calc(100% + 11px); height: calc(100% + 11px); pointer-events: none; overflow: visible; }
.sketch path { fill: none; stroke: var(--ink); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: stroke-dashoffset 1.2s cubic-bezier(.55, .05, .3, 1); }
.term-label { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2); }
.term-name { font-size: var(--t-lg); line-height: var(--lh-lg); font-weight: 700; letter-spacing: -.01em; }
.term-card .term-def { color: var(--ink-2); margin: var(--s-3) 0 var(--s-4); }
/* encyclopedia entry: stress marks, the English name and how it sounds, other names */
.stress { position: relative; }
.stress::after { content: "\00B4"; content: "\00B4" / ""; position: absolute; left: 0; right: 0; top: .02em; text-align: center; font-weight: 400; line-height: inherit; pointer-events: none; }
.term-en { display: block; margin-top: 2px; color: var(--ink-2); }
.term-en [lang="en"] { font-style: italic; }
.term-lang, .term-say { color: var(--muted); }
.term-card .term-def:has(+ .term-aka) { margin-bottom: var(--s-2); }
.term-aka { margin: 0 0 var(--s-4); color: var(--ink-2); }
.term-aka span, .term-aka i { color: var(--muted); font-style: normal; }
.term-add { position: relative; height: 40px; display: inline-flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-4) 0 var(--s-3); background: #fff; color: var(--ink);
  border: var(--stroke) solid transparent; border-radius: var(--r-pill); font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; transition: background .15s; }
.term-add:hover { background: var(--surface); }
.term-add:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.term-add .ico { width: 14px; height: 14px; overflow: visible; flex: none; }
.term-add .ico path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.term-add .ico-check { display: none; }
.term-add.added .ico-plus { display: none; }
.term-add.added .ico-check { display: inline; stroke-dasharray: 20; stroke-dashoffset: 0; }
.term-add.just-added .ico-check { animation: draw-check .5s cubic-bezier(.55, .05, .3, 1) both; }
.term-add.added .lbl { font-weight: 400; }
@keyframes draw-check { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .term-add.just-added .ico-check { animation: none; } }
.term-hl { text-decoration: underline; text-decoration-style: dotted; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.term-hl:hover { background: var(--surface); border-radius: 3px; }
.tooltip { padding: var(--s-3) var(--s-4); background: var(--ink); color: #fff; border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.tooltip b { color: #fff; }
.tooltip span { color: #D9D6D2; }
.tooltip .term-en, .tooltip .term-lang, .tooltip .term-say { color: #B5B1AC; }
.tooltip > span:last-child { display: block; margin-top: var(--s-1); }

/* ---------- Inline illustration ---------- */
.illustration { margin: var(--s-6) 0; text-align: center; }
.illustration video { width: 256px; height: 256px; object-fit: contain; }
.illustration figcaption { color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-sm); }

/* ---------- Selection marks the Agnes button and the report button ---------- */
.ask-agnes .sel-hint { display: none; margin-left: var(--s-2); padding-left: var(--s-2); border-left: 1px solid rgba(255,255,255,.35); font-weight: 400; opacity: .85; }
body.has-sel .ask-agnes .sel-hint { display: inline; }
body.has-sel .ask-agnes { box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px var(--ink); }

/* ---------- Report button (serious UI: clean line) ---------- */
/* Icon only on every screen; the label stays for screen readers and the title shows it on hover */
.report-fab { position: fixed; left: var(--s-5); bottom: var(--s-5); z-index: 30; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: #fff; color: var(--ink); border: var(--stroke) solid var(--ink); border-radius: var(--r-pill); font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; }
.report-fab .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.report-fab:hover { background: var(--surface); }
.report-fab .ico { width: 16px; height: 16px; overflow: visible; }
.report-fab .ico path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.has-sel .report-fab { background: var(--ink); color: #fff; }

/* ---------- Agnes panel (serious UI) ---------- */
.agnes { position: fixed; z-index: 40; top: var(--topbar-h); right: 0; bottom: 0; width: var(--panel-w); display: flex; flex-direction: column;
  background: #fff; border-left: var(--stroke) solid var(--ink); font-size: var(--t-sm); line-height: var(--lh-sm); }
.agnes-head { height: 64px; display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-5); border-bottom: 1px solid var(--line); }
.agnes-id { flex: 1; display: flex; flex-direction: column; line-height: 20px; }
.agnes-id b { font-size: var(--t-sm); line-height: var(--lh-sm); }
.agnes-id span { font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--muted); }
.agnes-new { border: 0; background: none; color: var(--muted); font-size: var(--t-xs); text-decoration: underline; text-underline-offset: 3px; }
.agnes-close { width: 32px; height: 32px; border: 0; background: none; font-size: 24px; line-height: 1; color: var(--ink); }
.agnes-thread { flex: 1; overflow: auto; padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.agnes-empty { margin: auto 0; text-align: center; color: var(--ink-2); }
.agnes-empty img { width: 144px; height: 144px; object-fit: contain; }
.agnes-empty p { font-size: var(--t-sm); line-height: var(--lh-sm); margin: var(--s-2) var(--s-3) var(--s-4); }
.agnes-suggest { display: flex; flex-direction: column; gap: var(--s-2); align-items: center; }
.agnes-suggest button, .chip { height: 32px; padding: 0 var(--s-4); border: var(--stroke) solid var(--line); background: #fff; border-radius: var(--r-pill); font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--ink); }
.agnes-suggest button:hover, .chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.msg { max-width: 92%; }
.msg-user { align-self: flex-end; background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 4px var(--r-lg); padding: var(--s-3) var(--s-4); }
.msg-quote { font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--muted); font-style: italic; border-left: 2px solid var(--ink); padding-left: var(--s-2); margin-bottom: var(--s-2); }
.msg-agnes { align-self: flex-start; }
.msg-agnes .msg-text p { margin: 0 0 var(--s-2); }
.msg-agnes .msg-text p:last-child { margin-bottom: 0; }
.msg-agnes .msg-text ul { margin: 0 0 var(--s-2); padding-left: 1.2em; }
.msg-agnes .msg-text li + li { margin-top: 2px; }
.msg-agnes .msg-text b { font-weight: 600; }
.msg-error { color: var(--ink-2); font-size: var(--t-sm); line-height: var(--lh-sm); }
a.ref { font-size: var(--t-xs); }
.msg-actions .chip:disabled { cursor: default; opacity: .6; }
.msg-actions .chip.on:disabled { opacity: 1; }
.msg-status { color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-sm); }
.msg-status::before { content: "✦ "; display: inline-block; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.msg-refs { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-3); font-size: var(--t-xs); line-height: var(--lh-xs); }
.refs-label { color: var(--muted); }
.ref { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; font-size: var(--t-xs); }
.msg-actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.msg-actions .chip { height: 28px; font-size: var(--t-xs); padding: 0 var(--s-3); }
.agnes-composer { padding: var(--s-3) var(--s-5) var(--s-5); }
.agnes-context { margin: 0 0 var(--s-3); }
.ctx-source { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--ink-2); }
.ctx-source span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-ico { width: 16px; height: 16px; flex: none; }
.ctx-ico path { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ctx-remove { border: 0; background: none; font-size: 18px; line-height: 1; color: var(--muted); }
.ctx-quote { margin: var(--s-1) 0 0 var(--s-5); font-style: italic; color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.agnes-input { position: relative; display: flex; align-items: flex-end; gap: var(--s-2); border: var(--stroke) solid var(--ink); border-radius: var(--r-lg); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); }
.agnes-input textarea { flex: 1; border: 0; outline: 0; resize: none; font: inherit; font-size: var(--t-sm); line-height: var(--lh-sm); padding: var(--s-1) 0; background: transparent; max-height: 160px; }
.agnes-send { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.agnes-send svg { width: 16px; height: 16px; }
.agnes-send path { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.agnes-open .shell { padding-right: var(--panel-w); }
@media (max-width: 1560px) {
  body.agnes-open .shell { grid-template-columns: 1fr; }
  body.agnes-open .outline { display: none; }
}
section.flash { animation: flash 1.6s ease-out; border-radius: var(--r-md); }
@keyframes flash { 0% { background: var(--surface); box-shadow: 0 0 0 var(--s-3) var(--surface); } 100% { background: transparent; box-shadow: 0 0 0 var(--s-3) transparent; } }

/* ---------- Modal (serious UI) ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: var(--s-5); background: rgba(28,26,25,.28); }
.modal-card { position: relative; width: min(520px, 100%); background: #fff; border: var(--stroke) solid var(--ink); border-radius: var(--r-xl); padding: var(--s-5) var(--s-6) var(--s-6); font-size: var(--t-sm); line-height: var(--lh-sm); }
.modal-head { height: 40px; display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s-4); }
.modal-title { font-size: var(--t-lg); line-height: var(--lh-lg); font-weight: 700; }
.modal-close { width: 32px; height: 32px; border: 0; background: none; font-size: 24px; line-height: 1; }
.ctx-card { border-left: 2px solid var(--ink); padding: 2px 0 2px var(--s-3); margin-bottom: var(--s-4); }
.ctx-source-line { font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--muted); }
.ctx-card .ctx-quote { margin: var(--s-1) 0 0; }
.report-hint { color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-sm); margin: 0 0 var(--s-4); }
.report-kinds { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-4); }
.report-kinds label { cursor: pointer; }
.report-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.report-kinds span { height: 32px; display: inline-flex; align-items: center; padding: 0 var(--s-3); border: var(--stroke) solid var(--line); border-radius: var(--r-pill); font-size: var(--t-sm); line-height: var(--lh-sm); }
.report-kinds input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.report-kinds input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.report-form textarea { width: 100%; font: inherit; border: var(--stroke) solid var(--ink); border-radius: var(--r-md); padding: var(--s-3) var(--s-4); resize: vertical; }
.report-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-4); }
.report-note { font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--muted); }
.btn-ink { height: 40px; border: 0; background: var(--ink); color: #fff; border-radius: var(--r-md); padding: 0 var(--s-5); font-weight: 600; font-size: var(--t-sm); line-height: var(--lh-sm); }
.modal .dict-list li { border-bottom: 1px solid var(--line); padding: var(--s-3) 0; }
.modal .dict-list li > span { display: block; color: var(--ink-2); font-size: var(--t-sm); line-height: var(--lh-sm); }
.modal .dict-list li .term-aka { margin: var(--s-1) 0 0; }

.toast { padding: var(--s-3) var(--s-5); background: var(--ink); color: #fff; border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); }

/* ---------- Quiz (serious UI): states by shape and weight ---------- */
.quiz { margin-top: var(--s-8); margin-bottom: var(--s-7); border: var(--stroke) solid var(--ink); border-radius: var(--r-xl); padding: var(--s-6); }
.quiz h2 { margin: 0; font-size: var(--t-lg); line-height: var(--lh-lg); }
/* Head and question are separate layers: the section title with a progress strip, a rule, then «Вопрос N из M» and the question */
.quiz-head { align-items: center; padding-bottom: var(--s-4); margin-bottom: var(--s-5); border-bottom: 1px solid var(--line); }
.quiz-steps { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; flex: none; }
.quiz-steps li { width: 18px; height: 6px; border-radius: 3px; background: var(--line); }
.quiz-steps li.current { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink); }
.quiz-steps li.done { background: var(--ink); }
.quiz-num { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2); }
.quiz-q { font-size: var(--t-body); line-height: var(--lh-body); font-weight: 600; margin: 0 0 var(--s-5); }
.quiz-options { gap: var(--s-2); margin: 0 0 var(--s-4); }
.opt { position: relative; min-height: 56px; background: #fff; border: var(--stroke) solid var(--line); border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm);
  color: var(--ink); padding: var(--s-4) var(--s-4) var(--s-4) var(--s-7); }
.opt::before { content: ""; position: absolute; left: var(--s-4); top: 50%; width: 20px; height: 20px; margin-top: -10px; border: var(--stroke) solid var(--ink); border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; line-height: 1; }
.opt:hover { border-color: var(--ink); }
.quiz.answered .opt:not(.right):not(.wrong), .quiz-item.answered .opt:not(.right):not(.wrong) { color: var(--muted); }
.opt.right { border: 2px solid var(--ink); font-weight: 600; }
.opt.right::before { content: "✓"; background: var(--ink); color: #fff; }
.opt.wrong { border-style: dashed; border-color: var(--muted); color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.opt.wrong::before { content: "×"; border-color: var(--muted); color: var(--muted); font-size: 14px; }
.quiz-explain { border-radius: var(--r-md); padding: var(--s-4); font-size: var(--t-sm); line-height: var(--lh-sm); background: var(--surface); }
.quiz-explain p { margin: 0 0 var(--s-2); }
.quiz-explain p:last-child { margin-bottom: 0; }
.quiz-explain .right-why { font-weight: 600; }
.quiz-explain.is-wrong p:first-child::before { content: "Не совсем. "; font-weight: 700; }
.quiz-foot { margin-top: var(--s-5); gap: var(--s-4); justify-content: flex-end; }
.quiz-next { height: 40px; padding: 0 var(--s-5); background: var(--ink); color: #fff; border-radius: var(--r-md); font-weight: 600; font-size: var(--t-sm); line-height: var(--lh-sm); }

/* ---------- Lesson navigation ---------- */
.lesson-nav { margin-top: 0; margin-bottom: var(--s-9); padding-top: var(--s-5); border-top: 1px solid var(--line); font-size: var(--t-sm); line-height: var(--lh-sm); }
.lesson-status { color: var(--muted); font-size: var(--t-xs); line-height: var(--lh-xs); text-decoration: none; text-align: center; }
a.lesson-status:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.lesson-status.is-done { color: var(--ink); font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; }
.lesson-nav .next { font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.lesson-nav .prev { color: var(--muted); text-decoration: none; }
.lesson-nav .prev:hover { color: var(--ink); }

/* ---------- Quiz summary (several questions) ---------- */
/* Two text styles only: the question style for the title, option text for the result line */
.quiz-done .quiz-q { margin-bottom: var(--s-1); }
.quiz-result { margin: 0; font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--ink-2); }
.quiz-foot[hidden] { display: none; }

/* ---------- Grid overlay: ?grid=1 or press «g» ---------- */
body.show-grid .lesson::before, body.show-grid .lesson::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); pointer-events: none; z-index: 60; }
body.show-grid .lesson::before { width: min(calc(100% - 2 * var(--gutter)), var(--wide)); background: rgba(225, 60, 40, .05); outline: 1px dashed rgba(225, 60, 40, .5); }
body.show-grid .lesson::after { width: min(calc(100% - 2 * var(--gutter)), var(--measure)); background: rgba(40, 90, 225, .06); outline: 1px dashed rgba(40, 90, 225, .55); }

/* ---------- Responsive ---------- */
/* The full «Продолжить с раздела «…»» chip only fits next to Словарь and Агнес on wide screens */
@media (max-width: 1100px) {
  .resume { font-size: 0; padding: 0 var(--s-3); }
  .resume::before { content: "Продолжить"; font-size: var(--t-xs); }
  .resume b { display: none; }
}
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .topbar .crumbs { display: none; }
  /* the same course map slides in from the left, opened by «Урок N из 8 ▾» in the topbar */
  .map-btn { display: inline-flex; align-items: center; gap: var(--s-1); height: 32px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-pill); background: #fff;
    box-shadow: inset 0 0 0 var(--stroke) var(--line); color: var(--ink); font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; white-space: nowrap; }
  .map-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 var(--stroke) var(--ink); }
  .outline { position: fixed; z-index: 45; top: var(--topbar-h); left: 0; bottom: 0; height: auto; width: min(320px, 86vw); transform: translateX(-105%); transition: transform .25s ease;
    box-shadow: 16px 0 40px -24px rgba(0,0,0,.35); }
  body.map-open .outline { transform: none; }
  .map-backdrop { position: fixed; z-index: 44; inset: var(--topbar-h) 0 0 0; background: rgba(28, 26, 25, .22); }
  body.map-open .map-backdrop { display: block; }
}
@media (prefers-reduced-motion: reduce) { .outline { transition: none; } }
@media (max-width: 640px) {
  :root { --gutter: 20px; --t-2xl: 34px; --lh-2xl: 38px; --t-xl: 24px; --lh-xl: 30px; }
  /* full-bleed cover on phones, so its text sits on the same 20px edge as the paragraphs */
  .lesson-head { margin: var(--s-9) calc(-1 * var(--gutter)) var(--s-7); padding: var(--s-7) var(--gutter) var(--s-6); border-radius: 0; }
  .hero-plate { top: calc(-1 * var(--s-8)); right: var(--s-4); width: 120px; height: 120px; }
  .lesson-hero { width: 100px; height: 100px; }
  .lesson-cta { margin-top: var(--s-5); }
  .quiz { padding: var(--s-5); }
  .topbar { gap: var(--s-2); padding: 0 var(--s-4); }
  .brand { white-space: nowrap; }
  .dict-counter { display: none; }
}
@media (max-width: 480px) {
  /* phones, lesson topbar (map button + Agnes): the mark alone, the name stays for screen readers */
  [data-lesson] .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 640px) {
  .ask-agnes { padding: 0 var(--s-3); }
  .ask-agnes .sel-hint { display: none !important; }
  .report-fab { left: var(--s-4); bottom: var(--s-4); }
  .agnes { top: auto; height: 86vh; width: 100%; border-left: 0; border-top: var(--stroke) solid var(--ink); border-radius: var(--r-xl) var(--r-xl) 0 0; }
  body.agnes-open .shell { padding-right: 0; }
}

/* ---------- More lesson content: drawn figures, developer notes, links to the interactive ---------- */
.drawn-frame { position: relative; margin: var(--s-6) 0; padding: var(--s-5); border: var(--stroke) solid transparent; border-radius: var(--r-lg); background: #fff; }
.drawn-frame figcaption, .prob-table figcaption { font-size: var(--t-sm); line-height: var(--lh-sm); }
.tok-line figcaption { margin-top: var(--s-3); color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-sm); }
.tok-line .tok-out { padding: 0; align-items: center; gap: 6px; }
.tok-pair { display: inline-flex; align-items: center; gap: 6px; }
.tok-sep { display: inline-block; width: 1.6px; height: 22px; background: var(--ink); border-radius: 1px; transform: rotate(4deg); }
.tok-pair:nth-child(2n) .tok-sep { transform: rotate(-3deg); height: 20px; }
.fig-note { margin: var(--s-3) 0 0 !important; color: var(--muted); font-size: var(--t-xs); line-height: var(--lh-xs); }
.prob-table .bar-cell { white-space: nowrap; }
.prob-table td.grp { font-weight: 600; padding-top: var(--s-4); border-bottom: 1px solid var(--line); white-space: normal; width: auto; }
.prob-table tr:first-child td.grp { padding-top: var(--s-2); }
.prob-table td.grp small { font-weight: 400; color: var(--muted); font-size: var(--t-sm); line-height: var(--lh-sm); margin-left: var(--s-2); }

.ctx-window figcaption { font-weight: 600; margin-bottom: var(--s-4); }
.cw-bar { display: flex; height: 40px; gap: 4px; }
.cw-svg { display: block; overflow: visible; margin: 0 -4px; }
.cw-wash { fill: var(--accent); }
.cw-ink { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cw-ink.free { stroke: var(--muted); stroke-dasharray: 4 5; }
.cw-legend { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-5); font-size: var(--t-sm); line-height: var(--lh-sm); }
.cw-legend li { display: flex; gap: var(--s-2); align-items: baseline; }
.cw-legend small { color: var(--muted); font-size: var(--t-xs); line-height: var(--lh-xs); }
.cw-sw { position: relative; flex: none; width: 14px; height: 14px; border-radius: 4px; isolation: isolate; transform: translateY(2px); border: 1.5px solid var(--ink); }
.cw-sw::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); }
.cw-sw.c1::before { opacity: .32; } .cw-sw.c2::before { opacity: .5; } .cw-sw.c3::before { opacity: .7; } .cw-sw.c4::before { opacity: .95; }
.cw-sw.free { border: 1.5px dashed var(--muted); }
.cw-sw.free::before { display: none; }

/* Developer notes are optional: a collapsed accordion with a clean line (UI, not lesson drawing) */
.dev-note { margin: var(--s-5) 0; border: var(--stroke) solid var(--line); border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); }
.dev-note[open] { border-color: var(--ink); }
.dev-note summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-2); min-height: 48px; padding: var(--s-2) var(--s-4); font-size: var(--t-sm); line-height: var(--lh-sm); }
.dev-note summary::-webkit-details-marker { display: none; }
.dev-note summary::after { content: "+"; margin-left: auto; font-size: 20px; font-weight: 400; line-height: 1; transition: transform .2s; }
.dev-note[open] summary::after { transform: rotate(45deg); }
.dev-note summary span { color: var(--muted); }
.dev-note summary:hover b { text-decoration: underline; text-underline-offset: 3px; }
.dev-note summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-md); }
.dev-body { padding: 0 var(--s-4) var(--s-4); }
.dev-body p { margin: 0 0 var(--s-3); }
.dev-body p:last-child { margin-bottom: 0; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88em; background: var(--surface); border-radius: 4px; padding: 1px 4px; }
.dev-body pre { background: var(--surface); border-color: transparent; }
pre { margin: 0 0 var(--s-3); padding: var(--s-4); background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); overflow-x: auto; font-size: var(--t-sm); line-height: var(--lh-sm); }
pre code { background: none; padding: 0; font-size: inherit; }

.ix-try-row { margin-top: calc(-1 * var(--s-2)) !important; }
.ix-try { display: inline-flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-4); background: #fff; color: var(--ink); border: var(--stroke) solid var(--ink);
  border-radius: var(--r-pill); font: inherit; font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; cursor: pointer; }
.ix-try:hover { background: var(--ink); color: #fff; }
@media (max-width: 640px) { .cw-legend { grid-template-columns: minmax(0, 1fr); } .quiz-head { flex-wrap: wrap; row-gap: var(--s-3); } .quiz-head h2 { flex-basis: 100%; } }

/* Quoted model output inside the lesson text (e.g. what a base model would write) */
#article blockquote { margin: var(--s-5) 0; padding: var(--s-3) var(--s-5); border-left: 2px solid var(--ink); color: var(--ink-2); font-size: var(--t-body); line-height: var(--lh-body); font-style: italic; }
#article blockquote p { margin: 0; }
.illustration img { width: 256px; height: 256px; object-fit: contain; }

/* ---------- Lesson 3: drawn chat request, request stack, memory note ---------- */
.transcript figcaption, .req-stack figcaption, .memo figcaption { font-weight: 600; margin-bottom: var(--s-3); }
.tr-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.tr-lines li { position: relative; isolation: isolate; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); }
.tr-lines li::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); filter: url(#wc-filter); opacity: .18; }
.tr-lines li.a::before { opacity: .38; }
.tr-lines li.new { box-shadow: inset 0 0 0 var(--stroke) var(--ink); }
.tr-lines li.new::before { opacity: 0; }
.tr-role { font-weight: 600; }
.tr-tag { display: inline-block; margin-left: var(--s-2); padding: 0 var(--s-2); border-radius: var(--r-pill); background: var(--ink); color: #fff; font-size: var(--t-xs); line-height: var(--lh-xs); }
.req-stack ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.req-stack li { position: relative; isolation: isolate; display: flex; flex-wrap: wrap; gap: 0 var(--s-3); align-items: baseline; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); }
.req-stack li::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); filter: url(#wc-filter); }
.req-stack li.s0::before { opacity: .62; } .req-stack li.s1::before { opacity: .5; } .req-stack li.s2::before { opacity: .4; }
.req-stack li.s3::before { opacity: .3; } .req-stack li.s4::before { opacity: .2; } .req-stack li.s5::before { opacity: 0; }
.req-stack li.s5 { box-shadow: inset 0 0 0 var(--stroke) var(--ink); }
.req-stack li span { color: var(--ink-2); }
.memo ul { margin: 0; padding: 0 0 0 var(--s-5); font-size: var(--t-sm); line-height: var(--lh-sm); }
.memo li + li { margin-top: var(--s-1); }

/* ---------- Lesson 4: knowledge cutoff timeline, verdict table ---------- */
.kn-timeline figcaption, .verdicts figcaption { font-weight: 600; margin-bottom: var(--s-4); }
.kt-bar { position: relative; display: flex; align-items: stretch; height: 40px; }
.kt-known { position: relative; flex: 60 1 0; isolation: isolate; border-radius: 8px 0 0 8px; }
.kt-known::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); filter: url(#wc-filter);
  -webkit-mask-image: linear-gradient(90deg, #000 55%, rgba(0,0,0,.15)); mask-image: linear-gradient(90deg, #000 55%, rgba(0,0,0,.15)); }
.kt-cut { flex: none; width: 2px; margin: -6px 0; background: var(--ink); border-radius: 1px; transform: rotate(2deg); }
.kt-gap { flex: 40 1 0; display: grid; place-items: center; margin-left: 6px; border: var(--stroke) dashed var(--muted); border-radius: 0 8px 8px 0;
  color: var(--muted); font-size: var(--t-xs); line-height: var(--lh-xs); text-align: center; padding: 0 var(--s-2); }
.kt-labels { position: relative; display: flex; justify-content: space-between; margin-top: var(--s-2); font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--ink-2); }
.kt-labels .kt-l-cut { position: absolute; left: 60%; transform: translateX(-50%); color: var(--ink); white-space: nowrap; }
.verdicts table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: var(--t-sm); line-height: var(--lh-sm); }
.verdicts th, .verdicts td { text-align: left; vertical-align: top; padding: var(--s-2) var(--s-3) var(--s-2) 0; border-bottom: 1px dashed var(--line); }
.verdicts thead th { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 400; color: var(--muted); }
.verdicts thead th:first-child { width: 30%; }
.verdicts tbody th { font-weight: 600; }
.verdicts tr:last-child th, .verdicts tr:last-child td { border-bottom: 0; }
.vd { position: relative; isolation: isolate; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: var(--s-2); border-radius: 50%;
  font-size: var(--t-xs); line-height: 1; font-weight: 600; vertical-align: -4px; }
.vd::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); filter: url(#wc-filter); }
.vd-ok { box-shadow: inset 0 0 0 var(--stroke) var(--ink); } .vd-ok::before { opacity: 0; }
.vd-part::before { opacity: .45; }
.vd-bad::before { opacity: .95; }
.vd-refused { color: var(--muted); box-shadow: inset 0 0 0 var(--stroke) var(--muted); } .vd-refused::before { opacity: 0; }
@media (max-width: 640px) {
  .verdicts thead { display: none; }
  .verdicts tr { display: block; padding: var(--s-2) 0; border-bottom: 1px dashed var(--line); }
  .verdicts tr:last-child { border-bottom: 0; }
  .verdicts th, .verdicts td { display: block; border: 0; padding: var(--s-1) 0; }
  .verdicts td::before { content: attr(data-label) ": "; color: var(--muted); }
  .kt-labels .kt-l-cut { left: 60%; }
}

/* ---------- Lesson 5: tool call card, step cycle, agent steps ---------- */
.tool-call { max-width: 360px; }
.tool-call figcaption, .cycle figcaption { font-weight: 600; margin-bottom: var(--s-3); }
.tc-body { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: var(--t-sm); line-height: var(--lh-sm); }
.tc-k { color: var(--muted); }
.cy-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: var(--s-2); }
.cy-step { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); }
.cy-step::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); filter: url(#wc-filter); }
.cy-step.s0::before { opacity: .55; } .cy-step.s1::before { opacity: .35; } .cy-step.s2::before { opacity: .2; }
.cy-step span { color: var(--ink-2); }
.cy-arrow { align-self: center; font-size: var(--t-lg); line-height: var(--lh-lg); }
.cy-loop { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px dashed var(--line); font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--ink-2); }
.cy-loop span { font-size: var(--t-lg); vertical-align: -2px; margin-right: var(--s-1); color: var(--ink); }
.agent-steps thead th:first-child { width: 48px; }
.step-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 var(--stroke) var(--ink); font-size: var(--t-xs); line-height: 1; }
@media (max-width: 640px) {
  .cy-row { grid-template-columns: minmax(0, 1fr); }
  .cy-arrow { justify-self: center; transform: rotate(90deg); }
}

/* ---------- Lesson 7: plain drawn table, method cards, cite check, check list ---------- */
.verdicts.plain thead th:first-child { width: 32%; }
.mini-cards figcaption, .cite-check figcaption { font-weight: 600; margin-bottom: var(--s-3); }
.mc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.mini-card { position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border-radius: var(--r-md); font-size: var(--t-sm); line-height: var(--lh-sm); }
.mini-card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); filter: url(#wc-filter); }
.mini-card.s0::before { opacity: .55; } .mini-card.s1::before { opacity: .42; } .mini-card.s2::before { opacity: .3; } .mini-card.s3::before { opacity: .18; }
.mini-card span { color: var(--ink-2); }
.cc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-4); }
.cc-col { font-size: var(--t-sm); line-height: var(--lh-sm); }
.cc-col p { margin: 0 0 var(--s-2); }
.cc-label { font-size: var(--t-xs); line-height: var(--lh-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--s-2); }
.cc-q { color: var(--muted); }
.cc-quote { padding-left: var(--s-3); border-left: 2px solid var(--ink); font-style: italic; color: var(--ink-2); }
.cc-doc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.cc-doc li { position: relative; isolation: isolate; padding: var(--s-1) var(--s-2); border-radius: 6px; color: var(--ink-2); }
.cc-doc li.hit { color: var(--ink); }
.cc-doc li.hit::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); opacity: .55; filter: url(#wc-filter); }
.lesson-list { margin: 0 0 var(--s-5); padding: 0; list-style: none; }
.lesson-list li { position: relative; padding-left: var(--s-6); margin-bottom: var(--s-2); }
.lesson-list li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 14px; height: 14px; border: var(--stroke) solid var(--ink); border-radius: 3px; }
@media (max-width: 640px) { .mc-grid, .cc-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Lesson 8: drawn request with part tags, two letters ---------- */
.prompt-card figcaption, .letters figcaption { font-weight: 600; margin-bottom: var(--s-3); }
.pp-body { white-space: pre-wrap; font-size: var(--t-sm); line-height: var(--lh-sm); }
.pp-tag { position: relative; isolation: isolate; display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 6px; font-weight: 600; }
.pp-tag::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--accent); opacity: .55; filter: url(#wc-filter); }
.lt-col { display: flex; flex-direction: column; font-size: var(--t-sm); line-height: var(--lh-sm); }
.lt-body { flex: 1; }
.lt-body p { margin: 0 0 var(--s-2); }
.lt-body mark { position: relative; isolation: isolate; background: none; color: var(--ink); padding: 0 2px; }
.lt-body mark::before { content: ""; position: absolute; inset: 1px -1px; z-index: -1; border-radius: 4px; background: var(--accent); opacity: .75; filter: url(#wc-filter); }
.lt-body u { text-decoration: underline wavy var(--ink-2); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.lt-foot { margin: var(--s-2) 0 0 !important; padding-top: var(--s-2); border-top: 1px dashed var(--line); font-weight: 600; }
.mc-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.verdicts.plain th a { color: var(--ink); text-underline-offset: 3px; }
@media (max-width: 640px) { .mc-grid.three { grid-template-columns: minmax(0, 1fr); } }

/* Phones: the map button is the course navigation, so the topbar drops «Продолжить» and shortens the button */
@media (max-width: 640px) {
  .topbar .resume { display: none !important; }
  .map-btn .mb-long { display: none; }
}

/* Course themes: one line per course. Course 2 (example): pastel blue, paired with the blue «ballpoint» illustration pack. */
[data-course="2"] { --accent: #AFC3F4; }
[data-course="platform"] { --accent: #E6E3DF; }

/* ---------- Email-free account: the key block (account.js) — lesson pages, profile, login ---------- */
.key-card { margin-top: var(--s-5); padding: var(--s-5); border: var(--stroke) solid var(--line); border-radius: var(--r-lg); background: #fff; }
.key-title { margin: 0; font-weight: 600; }
.key-text { margin: var(--s-1) 0 var(--s-4); font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--ink-2); }
.key-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.key-val { margin-right: auto; font-family: var(--sans); font-size: var(--t-lg); line-height: var(--lh-lg); font-weight: 600; letter-spacing: .04em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.key-btn, .key-main { height: 36px; padding: 0 var(--s-4); border-radius: var(--r-pill); border: var(--stroke) solid var(--ink); background: #fff; color: var(--ink);
  font: inherit; font-size: var(--t-sm); line-height: var(--lh-sm); font-weight: 600; cursor: pointer; white-space: nowrap; }
.key-main { background: var(--ink); color: #fff; }
.key-btn:focus-visible, .key-main:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.key-save { margin-top: var(--s-3); }
.key-save .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.key-saved { margin: var(--s-3) 0 0; font-size: var(--t-sm); line-height: var(--lh-sm); color: var(--ink-2); }
.key-qr { display: block; width: 136px; height: 136px; color: var(--ink); }
.topbar .avatar svg { width: 18px; height: 18px; display: block; }

/* the honest line under Agnes's prompt: questions go to a language model, their text is not stored */
.agnes-privacy { margin-top: var(--s-3) !important; font-size: var(--t-xs); line-height: var(--lh-xs); color: var(--muted); }
.agnes-privacy a { color: var(--ink-2); }
