/* ============================================================================
   vedai — единый CSS. Визуальная система описана в docs/DESIGN.md,
   разметка — в docs/DOM-CONTRACT.md. Без препроцессоров, без внешних ресурсов:
   локальные EB Garamond и Geist; KaTeX — vendor/katex/katex.min.css.
   ============================================================================ */

/* ---------- 1. Токены ---------- */
:root {
  color-scheme: light;
  --bg: #f7f5f3; --fg: #343230; --muted: #73706d; --line: #e7e2de; --surface: #eeebe7; --card: #faf9f7;
  --shadow: none; --plot-line: #8c9297;
  --band-cream: var(--bg); --band-mint: var(--surface); --band-sky: var(--surface); --band-butter: var(--surface);
  --accent: #3e647c; --cta: #292b2d; --cta-hover: #434649; --cta-fg: #ffffff;
  /* Цвет в диаграммах различает данные; навигация и уровни остаются нейтральными. */
  --ink-red: #967267; --ink-coral: #967267; --ink-sun: #a39676; --ink-sun-dark: #857753; --ink-sea: #527c94; --ink-teal: #68877f;
  /* Teaching scenes: the saturated palette of the foundations presentation. */
  --demo-purple: #7634df; --demo-blue: #2563eb; --demo-green: #05845e; --demo-red: #da4b50; --demo-amber: #b97712;
  --lv1: var(--fg); --lv2: var(--fg); --lv3: var(--fg);
  --lv1-soft: var(--surface); --lv2-soft: var(--surface); --lv3-soft: var(--surface);
  --ok: #48745e; --warn: #887346; --assisted: #887346; --err: #a45151;
  --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-display: "EB Garamond", Georgia, "Times New Roman", serif;
  --font-label: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-body: 1rem; --lh-body: 1.7;
  --fs-note: .875rem; --fs-small: .8125rem; --fs-label: .8125rem; --ls-label: 0;
  --fs-svg-label: 13px; --fs-svg-tick: 12px;
  --radius-sm: 5px; --radius-md: 9px; --radius-lg: 12px; --radius-xl: 16px; --radius-pill: 999px;
  --nav-h: 64px; --prose: 680px; --margin-w: clamp(220px, 24vw, 280px); --gap: 64px; --shell: 1200px;
  --shell-pad: clamp(24px, 4vw, 64px);
  --focus: 2px solid var(--accent);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #212223; --fg: #e9e9e7; --muted: #a2a4a6; --line: #393b3c; --surface: #2b2d2e; --card: #252728;
  --plot-line: #747a80; --accent: #9cb6c6; --cta: #e9e9e7; --cta-hover: #ffffff; --cta-fg: #242628;
  --ink-red: #be9488; --ink-coral: #be9488; --ink-sun: #bfb18e; --ink-sun-dark: #c1b28b; --ink-sea: #8badc2; --ink-teal: #95b3a8;
  --demo-purple: #b790ff; --demo-blue: #79a8ff; --demo-green: #53d7a7; --demo-red: #ff959a; --demo-amber: #efc465;
  --ok: #91b4a0; --warn: #c1b28b; --assisted: #c1b28b; --err: #d99898;
}

/* ---------- 2. База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
body > main { flex: 1 0 auto; }
[hidden] { display: none !important; }
img, svg, video, canvas { max-width: 100%; height: auto; }
figure { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.18; letter-spacing: -.012em; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 4vw, 3rem); font-weight: 400; }
h2 { font-size: 1.875rem; font-weight: 400; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }
p, ul, ol, table, blockquote, pre { margin: 0 0 1.1em; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: .3em; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
strong, b { font-weight: 600; }
em { font-style: italic; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: .9em; }
/* Моно (--font-mono) — только настоящий код: этот блок и .pylab-code/.pylab-out (§11) ниже.
   Всё остальное (readout, номера, счётчики) — текстовый --font-label/--font-body с выровненными
   по ширине цифрами: меняющееся число не должно «дрожать» построчно (docs/TYPOGRAPHY.md
   §«Итоговая система», решение заказчика 15.09.2026 — моно в интерфейсе «выдаёт ИИ»). */
.step-num, .lesson-num, .minutes, .check-input input, .check-explain .check-answer,
.homework > ol > li::before, .checklist > ol > li::before,
.field input[name="code"], .class-code, .class-list .class-count, .class-list .class-code-sm,
.bar-label, .cell-pro, .cell-epic, .cell-hw,
.detail-checks .detail-id, .detail-checks .detail-answer, .detail-password,
.map-section h2 .map-n, .map-tile .map-id,
.practice-progress, .practice-stat strong,
.teach-meta, .teach-answer b, .profile-meta,
.w-tick, .w-readout, .w-range-value, .w-table, .w-matrix, .w-val,
.report { font-variant-numeric: tabular-nums; }
code { background: var(--surface); padding: .1em .35em; border-radius: var(--radius-sm); }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: .9rem 1rem; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; font-size: .85rem; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--radius-sm); padding: 0 .3em; background: var(--card); }
blockquote { margin: 1.2em 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--line); color: var(--fg); font-family: var(--font-display); font-style: italic; font-size: 1.05em; }
blockquote p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .45em .7em; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-label); font-weight: 700; font-size: .8rem; letter-spacing: 0; text-transform: none; color: var(--muted); }
/* text-transform:uppercase поднимает регистр и внутри формул: KaTeX-разметку .katex это не ломает
   визуально (она не текстовые узлы, а глифы), но необрендеренный/провалившийся .math[data-tex] — сырой
   LaTeX-текст — портит: x → X, w_i → W_I, читается как другие обозначения (находка ученика на уроке
   sgd-useful-noise: заголовок таблицы «x, МБ» превращался в «X, МБ» — урок весь построен на различении
   строчных символов). Это не только про th — любой uppercase-ярлык (.label/.eyebrow/.badge/.w-key/…)
   мог бы унаследовать ту же порчу, если формула когда-нибудь окажется внутри; правило — на самих узлах
   формулы, а не на th, чтобы защита не зависела от того, в каком контейнере формула оказалась. */
.math, .katex, .katex-display { text-transform: none; }
/* overflow-x:auto без видимого признака прокрутки — на macOS оверлейный скроллбар невидим, ученик
   видит просто обрезанную колонку и считает это поломкой (находка критика visual1): тонкий, но
   постоянно видимый скроллбар кросс-браузерно.
   display:block на самом .table-scroll (обёртке render.mjs, см. wrapTables), а не на <table> —
   display:block на table отменяет табличную раскладку (анонимная таблица внутри ужимается по
   контенту, width:100% на ней перестаёт работать) — таблица «худела» и висела у левого края
   колонки с пустотой справа (находка критика visual2). table остаётся display:table; width:100%. */
.table-scroll {
  display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.table-scroll::-webkit-scrollbar { height: 6px; }
.table-scroll::-webkit-scrollbar-track { background: transparent; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--radius-pill); }
sup, sub { line-height: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
/* Тон переключателей — везде из палитры, а не системный синий/серый ОС (находка критика visual1:
   радиокнопки вариантов ответа в тёмной теме и чекбоксы внутри виджетов рисовались нативным цветом). */
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--ink-sea) 30%, transparent); }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* --shell-pad растёт с шириной окна (24…64px): на фиксированных 24px поля страницы в диапазоне
   1125–1180px почти съедались (shell 1120 упирается в вьюпорт) — окно «распирало» контент, тогда
   как на 1440 поля были 168px (находка критика visual1). */
.shell { max-width: var(--shell); margin: 0 auto; padding: 0 var(--shell-pad); }

/* ярлыки, eyebrow, бейджи */
.label, .eyebrow { font-family: var(--font-label); font-weight: 500; font-size: var(--fs-label); letter-spacing: var(--ls-label); text-transform: none; color: var(--muted); }
.label { display: block; margin-bottom: .35rem; }
.eyebrow { margin: 0 0 .9rem; color: var(--accent); display: flex; flex-wrap: wrap; align-items: center; gap: .35em .6em; }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; }
.badge { display: inline-block; font-family: var(--font-label); font-weight: 700; font-size: .65rem; letter-spacing: 0; text-transform: none; padding: .15em .55em; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--muted); background: var(--card); vertical-align: middle; }
.badge-ready { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--lv1-soft); }
.badge-draft { color: var(--ink-sun-dark); border-color: color-mix(in srgb, var(--ink-sun) 50%, transparent); background: var(--band-butter); }
.badge-stub { color: var(--muted); }
.badge-core { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--surface); }
.badge-pro { color: var(--lv2); border-color: color-mix(in srgb, var(--lv2) 40%, transparent); background: var(--lv2-soft); }
.badge-capstone { color: var(--lv3); border-color: color-mix(in srgb, var(--lv3) 40%, transparent); background: var(--lv3-soft); }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 32px; padding: 5px 0; border-radius: 2px; border: 0; background: transparent; color: var(--fg); font-family: var(--font-label); font-weight: 400; font-size: .875rem; line-height: 1.4; text-decoration: none; text-underline-offset: .25em; text-decoration-thickness: 1px; cursor: pointer; }
.btn:hover:not(:disabled), .btn:focus-visible { text-decoration: underline; }
.btn:hover:not(:disabled) .action-label, .btn:focus-visible .action-label { text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { font-weight: 500; }
.btn-ghost { color: var(--fg); }
/* Разрушительное действие отличается цветом, сохраняя ту же компактную форму. */
.btn-danger { color: var(--err); }
.btn-sm { font-size: .8125rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; margin: 1rem 0 0; }

/* ---------- 3. Шапка сайта ---------- */
.site-header { position: sticky; top: 0; z-index: 30; height: var(--nav-h); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
/* padding — var(--shell-pad), а не фиксированные 24px: иначе левый край шапки (24px) и левый
   край .shell/.lesson-body (clamp 24…64px) расходятся на широких экранах — на 1440 шапка съезжала
   на 34px левее остального контента (находка критика visual2, «страница прыгает от страницы к
   странице»). */
.site-header-inner { max-width: var(--shell); margin: 0 auto; padding: 0 var(--shell-pad); height: 100%; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; color: var(--fg); text-decoration: none; }
.brand svg { display: block; width: 36px; height: 36px; }
.brand:focus-visible { outline: var(--focus); outline-offset: 3px; border-radius: 4px; }
.header-menu { display: contents; }
.site-settings { display: flex; align-items: center; gap: .75rem; margin-left: auto; }
.site-nav { display: flex; gap: 1.1rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-family: var(--font-label); font-weight: 600; font-size: .9rem; padding: .3em 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--fg); }
.site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--fg); }
.site-tools { margin-left: 0; display: flex; align-items: center; gap: .75rem; }
.level-switch { display: inline-flex; margin: 0; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); }
.level-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.level-switch label { position: relative; display: inline-flex; align-items: center; padding: .25em .7em; border-radius: var(--radius-pill); font-family: var(--font-label); font-weight: 700; font-size: .78rem; color: var(--muted); cursor: pointer; }
.level-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.level-switch label:has(input:checked) { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.level-switch label:has(input:focus-visible) { outline: var(--focus); outline-offset: 1px; }
.level-switch .lv-base:has(input:checked) { color: var(--lv1); }
.level-switch .lv-pro:has(input:checked) { color: var(--lv2); }
.level-switch .lv-epic:has(input:checked) { color: var(--lv3); }
html[data-level="base"] .level-switch .lv-base, html[data-level="pro"] .level-switch .lv-pro, html[data-level="epic"] .level-switch .lv-epic { background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
html[data-level="base"] .level-switch .lv-base { color: var(--lv1); }
html[data-level="pro"] .level-switch .lv-pro { color: var(--lv2); }
html[data-level="epic"] .level-switch .lv-epic { color: var(--lv3); }
.theme-toggle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; padding: 0; color: var(--fg); }
.theme-icon { grid-area: 1 / 1; display: block; }
.theme-icon-sun { display: none; color: var(--fg); }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; color: var(--fg); }
.auth-anon { font-family: var(--font-label); font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--fg); white-space: nowrap; }
.auth-user { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--fg); font-family: var(--font-label); font-weight: 600; font-size: .9rem; }
.avatar { display: inline-block; flex: 0 0 auto; }
.avatar svg { display: block; width: 100%; height: 100%; overflow: visible; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-lg { width: 104px; height: 112px; }
.avatar-ring { fill: none; stroke: var(--fg); stroke-width: 1.15; vector-effect: non-scaling-stroke; }
.avatar-inner-ring { fill: none; stroke: color-mix(in srgb, var(--card) 55%, transparent); stroke-width: .7; vector-effect: non-scaling-stroke; }
.avatar-formula { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; line-height: 1; white-space: nowrap; overflow: visible; color: #f7f3e8; }
.avatar-formula .katex { color: inherit; font-size: 1.12em; }

/* ---------- 5. Сетка урока: .row > .main + .margin ---------- */
.row { display: grid; grid-template-columns: minmax(0, var(--prose)) var(--margin-w); column-gap: var(--gap); align-items: start; }
.row > .main { min-width: 0; }
.row > .margin { min-width: 0; padding-top: .2rem; }
.row + .row { margin-top: 0; }
.main > :last-child { margin-bottom: 1.1em; }
.main > h3 { margin-top: 1.4em; }

/* Раскладка маргиналий на широком экране (site/client/layout.mjs, docs/WEEK-1-2.md): заметка не
   растягивает свой .row — .margin нулевой высоты, а каждая .note позиционируется абсолютно (top
   считает layout.mjs после шрифтов/KaTeX/раскрытия шага/resize/смены уровня; без наложений и без
   дыр). .lv-body — отдельная (стопкой внутри main-колонки), эта раскладка её не трогает. На ≤1024px
   (§22) и при печати (§print) — статичная построчная сетка без JS. */
@media screen and (min-width: 1025px) {
  .lesson-header > .row > .margin,
  .intro > .row > .margin,
  .step-body > .row > .margin {
    position: relative;
    height: 0;
    overflow: visible;
  }
  .lesson-header > .row > .margin > .note,
  .intro > .row > .margin > .note,
  .step-body > .row > .margin > .note {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}

/* маргиналии */
.note { margin: 0 0 1.1rem; padding-top: .55rem; border-top: 1px solid var(--line); font-size: var(--fs-note); line-height: 1.5; color: var(--fg); overflow-wrap: anywhere; }
.note summary { list-style: none; cursor: default; display: flex; gap: .5em; align-items: baseline; }
.note summary::-webkit-details-marker { display: none; }
.note summary .label { margin: 0; }
.note summary .note-lead { display: none; }
/* план «Учителю» свёрнут на любой ширине: summary кликабельна, показывает начало */
.note.kind-teacher summary { cursor: pointer; }
.note.kind-teacher:not([open]) summary .note-lead { display: inline; color: var(--muted); font-size: .85rem; }
.note.kind-teacher summary::before { content: "▸"; font-size: .7em; color: var(--muted); margin-right: .2em; }
.note.kind-teacher[open] summary::before { content: "▾"; }
.note .note-body { margin-top: .3rem; overflow-x: auto; }
.note .note-body > :last-child, .note p:last-child { margin-bottom: 0; }
.note p, .note ul, .note ol { margin-bottom: .6em; }
.note ul, .note ol { padding-left: 1.2em; }
.note img, .note svg { display: block; margin: .3rem 0; max-width: 100%; height: auto; }
/* Размер текста внутри SVG задаёт сам рисунок (viewBox 300 = ширина колонки, атрибут font-size = пиксели).
   CSS его не переопределяет: увеличение ломает подписи в нарисованных рамках. Минимум 11px проверяет валидатор. */
.note table { font-size: .85rem; }
.note td, .note th { padding: .3em .5em; }
.note code { font-size: .85em; }
/* Инлайн-формула в узкой (300px) колонке переносилась посреди выражения, выбивая заметку из
   базового ритма (находка критика visual1): не переносим формулу — короткие выражения в маргиналиях
   умещаются, а длинные автору стоит выносить в $$…$$ отдельной строкой (docs/CONTENT-GUIDE.md). */
.note .math, .note .katex { font-size: .95em; white-space: nowrap; }
.kind-example .label { color: var(--muted); }
.kind-link .label { color: var(--muted); }
.kind-quote .label { color: var(--muted); }
.kind-history .label { color: var(--muted); }
.kind-figure .label, .kind-notation .label { color: var(--muted); }
.kind-note .label { color: var(--muted); }
.kind-think .label { color: var(--muted); }
.kind-teacher .label { color: var(--muted); }
.kind-recap .label { color: var(--muted); }
.kind-quote .note-body { font-family: var(--font-display); font-style: italic; font-size: 1rem; }
.kind-quote .note-body p:last-child { font-style: normal; font-family: var(--font-body); font-size: .85rem; color: var(--muted); }
.kind-notation td:first-child, .kind-notation th:first-child { font-family: var(--font-body); font-style: italic; white-space: nowrap; }
/* KaTeX сам ставит font-family на свои узлы (.katex), эта специфичность его не перебивает — правило
   только для случая, когда символ набран обычным текстом, а не $…$ (docs/TYPOGRAPHY.md §«Итоговая система»). */
.kind-figure figcaption, .kind-figure em { font-style: normal; color: var(--muted); font-size: .85rem; }
.kind-link ul { list-style: none; padding: 0; }
.kind-link li { padding-left: 1em; text-indent: -1em; }
.kind-link li::before { content: "↗ "; color: var(--accent); }
.kind-teacher { background: var(--lv3-soft); border-top-color: var(--lv3); padding: .55rem .7rem .7rem; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.kind-recap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .9rem 1rem; box-shadow: var(--shadow); }
.kind-recap ul { list-style: none; padding: 0; margin: .5rem 0 0; }
.kind-recap li { font-size: .85rem; }
.kind-recap li::before { content: "← "; color: var(--muted); }

/* ---------- 6. Шапка урока ---------- */
.lesson-header { background: var(--band-cream); border-bottom: 1px solid var(--line); padding: 3.5rem 0 2rem; }
.lesson-header .row { max-width: var(--shell); margin: 0 auto; padding: 0 var(--shell-pad); }
/* templates.mjs (teacherToolsHtml) подшивает .teach-tools перед </header>, вне .row — без своего
   правила ссылки «PDF урока»/«Слайды» рисовались от x=0, под сеткой страницы (находка критика
   visual2). Та же мера, что у .row: центрируем по shell и добавляем нижний отступ шапки. */
.lesson-header .teach-tools { max-width: var(--shell); margin: 0 auto; padding: .5rem var(--shell-pad) 0; display: flex; gap: .5rem; }
.lesson-title { margin: .2em 0 .35em; }
.lesson-dek { font-family: var(--font-body); font-style: normal; font-size: 1.15rem; color: var(--muted); line-height: 1.45; margin-bottom: 1.2rem; }
.outcomes { list-style: none; padding: 0; margin: 0 0 1.2rem; display: grid; gap: .3rem; }
.outcomes li { position: relative; padding-left: 1.3em; font-size: .95rem; }
.outcomes li::before { content: "·"; position: absolute; left: .35em; top: -.1em; font-size: 1.4em; color: var(--lv1); }
.outcomes li.label { padding-left: 0; margin-bottom: .15rem; }
.outcomes li.label::before { content: none; }
.keyidea { border-left: 2px solid var(--line); padding: .25rem 0 .25rem 1rem; margin: 1.5rem 0; }
.keyidea .label { color: var(--ink-coral); margin-bottom: .2rem; }
.keyidea p { margin: 0; font-family: var(--font-display); font-size: 1.05rem; line-height: 1.45; }
.progress { height: 3px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--fg) 10%, transparent); overflow: hidden; max-width: var(--prose); }
.progress-fill { height: 100%; width: 0; background: var(--lv1); border-radius: inherit; transition: width .3s ease; }

/* ---------- 7. Тело урока и шаги ---------- */
.lesson-body { max-width: var(--shell); margin: 0 auto; padding: 2rem var(--shell-pad) 0; }
.intro { padding-bottom: .5rem; }
.intro .main > p:first-child { font-size: inherit; }
.step { padding: 1.75rem 0 2rem; border-bottom: 1px solid color-mix(in srgb, var(--fg) 8%, transparent); }
/* Несколько свёрнутых шагов подряд (хвост урока) при том же padding, что у раскрытого, дают
   ~330px почти пустых полос — заголовок и серая пометка на фоне 108px пустоты (находка критика
   visual2). Свёрнутый шаг — компактнее; раскрытый и пройденный не трогаем. */
.step[data-state="locked"] { padding: 1rem 0 1.05rem; }
.step-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: .3rem .8rem; margin: 0 0 1.25rem; font-size: 1.5rem; font-weight: 600; }
.step-toggle { all: unset; cursor: pointer; display: inline-flex; align-items: baseline; gap: .5em; font: inherit; color: inherit; border-radius: var(--radius-sm); }
.step-toggle:focus-visible { outline: var(--focus); outline-offset: 4px; }
.step-num { font-family: var(--font-label); font-size: .8em; font-weight: 600; color: var(--muted); min-width: 1.6em; }
.step-num::after { content: "."; }
.step-status { font-family: var(--font-label); font-size: .8125rem; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 700; }
.step[data-state="locked"] .step-toggle { color: var(--muted); }
.step[data-state="locked"] .step-toggle::after { content: "▸"; font-size: .6em; opacity: .6; }
.step[data-state="locked"][data-expanded="1"] .step-toggle::after { content: "▾"; }
.step[data-state="done"] .step-num { color: var(--ok); }
.step[data-state="done"] .step-num::before { content: "✓ "; }
.step[data-state="done"][data-assisted="1"] .step-num { color: var(--assisted); }
.step[data-state="done"][data-assisted="1"] .step-status { color: var(--assisted); }
.step-body { animation: fade-in .2s ease; }
.step[data-state="locked"]:not([data-expanded="1"]) .step-body { display: none; }
.step[data-state="locked"] .step-advance, .step[data-state="done"] .step-advance { display: none; }
.step-advance { margin-top: .5rem; }
.btn-next { font-size: .875rem; font-weight: 500; }
.step[data-has-check="1"][data-state="open"] .btn-next[disabled] { opacity: .5; }
.step-final .row-callout, .step-final .row-summary { margin-top: .5rem; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 8. Проверки ---------- */
.check { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem 1rem; margin: .5rem 0 1.4rem; }
.check::before { content: none; }
.check[data-gating="0"]::before { content: "Дополнительное задание"; display: block; color: var(--muted); font-size: .8125rem; margin-bottom: .75rem; }
.check-prompt { font-size: 1rem; margin-bottom: .8rem; }
.check-prompt p:last-child { margin-bottom: 0; }
.check-input { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .9rem; }
/* .check-var («Ответ») — визуально скрыт (render.mjs), остаётся именем поля для скринридера; видимый
   ярлык слева от пустого поля читался как второй «ОТВЕТ» рядом с единицей справа (критик visual1). */
.check-input input { font-family: var(--font-label); font-size: 1rem; padding: .45em .7em; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); color: var(--fg); width: min(100%, 14rem); }
.check-input input:focus-visible { outline: var(--focus); border-color: var(--ink-sea); }
/* Контраст --line (#27272a) на --card (#1d1e22) в тёмной теме ≈1,2:1 — рамка поля ввода практически
   не видна, проверка выглядит пятном без поля (та же беда, что уже чинили у .progress-dot ниже,
   находка критика visual2). */
html[data-theme="dark"] .check-input input, html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="password"], html[data-theme="dark"] select { border-color: color-mix(in srgb, var(--fg) 25%, transparent); }
.check-unit { color: var(--muted); font-family: var(--font-body); font-size: .95em; }
.choices { border: 0; padding: 0; margin: 0 0 .9rem; min-width: 0; }
.choices legend { padding: 0; margin-bottom: .8rem; float: left; width: 100%; }
.choice { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem .85rem; border: 1px solid transparent; border-radius: var(--radius-md); background: var(--surface); margin-bottom: .4rem; cursor: pointer; clear: both; }
.choice:hover { border-color: var(--fg); }
/* Радио своей отрисовки — нативный кружок в тёмной теме заливался светло-серым и читался как «уже
   выбран», даже без :checked (находка критика visual2). Двойное кольцо через inset box-shadow —
   тот же язык, что .w-seg-btn/.level-switch (акцентный цвет вместо системного). */
.choice input {
  appearance: none; -webkit-appearance: none; margin: .18em 0 0; width: 1.05em; height: 1.05em;
  border: 1.5px solid color-mix(in srgb, var(--fg) 40%, transparent); border-radius: 50%;
  background: transparent; flex: 0 0 auto; cursor: pointer;
}
/* radial-gradient, не inset box-shadow: «зазор» box-shadow нужно красить в цвет фона позади радио
   (--card/--band-sky/error-tint — разный в зависимости от состояния варианта), а градиент с
   прозрачным кольцом показывает этот фон сам, без подбора цвета под каждое состояние. */
.choice input:checked { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 42%, transparent 44%); }
/* Кольцо фокуса рисует .choice (весь вариант), само поле фокус не дублирует — иначе внутри уже
   обведённого варианта вставал ещё квадратный outline вокруг круглой радиокнопки (критик visual2). */
.choice input:focus-visible { outline: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--surface); }
.choice:has(input:focus-visible) { outline: var(--focus); outline-offset: 1px; }
.choice.is-correct { border-color: var(--ok); background: var(--lv1-soft); }
/* is-wrong задаёт background явно — иначе одноимённое свойство из .choice:has(input:checked) (band-sky)
   стоит выше по каскаду и выбранный неверный вариант остаётся синим, будто ошибка ни на чём не
   отмечена (находка критика visual1). */
.choice.is-wrong { border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, var(--card)); opacity: .8; }
/* То же — сразу после неверной попытки, ещё до раскрытия ответа: data-state="wrong" ставит клиент
   (docs/DOM-CONTRACT.md), а выбранный вариант без этого правила оставался синим «выбрано», будто
   ошибку ничем не отметили (находка критика visual2). */
.check[data-state="wrong"] .choice:has(input:checked) { border-color: var(--err); background: color-mix(in srgb, var(--err) 10%, var(--card)); }
.check-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
/* Пройденный шаг прячет кнопки (.check[data-state=ok/revealed] ниже), но .check-actions с одними
   точками попыток оставался пустой полосой ~35px (находка критика visual2) — гасим контейнер целиком. */
.check[data-state="ok"] .check-actions, .check[data-state="revealed"] .check-actions { display: none; }
.check-attempts { display: inline-flex; gap: 4px; }
.check-attempts::before, .check-attempts::after, .check-attempts > i { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--fg) 15%, transparent); }
.check-attempts > i { font-style: normal; }
.check-attempts[data-attempts="1"]::before, .check-attempts[data-attempts="2"]::before, .check-attempts[data-attempts="3"]::before,
.check-attempts[data-attempts="2"] > i, .check-attempts[data-attempts="3"] > i,
.check-attempts[data-attempts="3"]::after { background: var(--err); }
/* Цвет по умолчанию (idle/«пустой ответ») — предупреждающий, а не обычный var(--fg): без выбранного
   варианта форма остаётся в data-state="idle", и «Выберите вариант.» тонуло в обычном тексте кнопки
   рядом (находка критика visual2). ok/wrong/revealed ниже перебивают по специфичности (2 класса). */
.check-feedback { margin-top: .6rem; font-weight: 600; font-size: .95rem; min-height: 0; color: var(--warn); }
.check-feedback:empty { display: none; }
.check[data-state="ok"] .check-feedback { color: var(--ok); }
.check[data-state="wrong"] .check-feedback { color: var(--err); }
.check[data-state="revealed"] .check-feedback { color: var(--assisted); }
.check[data-state="ok"] { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.check[data-state="ok"] .check-input input, .check[data-state="ok"] .choice input, .check[data-state="revealed"] .check-input input { pointer-events: none; }
.check[data-state="ok"] button[type="submit"], .check[data-state="revealed"] button[type="submit"] { display: none; }
.check-hint { margin: .7rem 0 0; padding: .6rem .8rem; background: var(--band-butter); border-left: 3px solid var(--ink-sun); border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: .92rem; }
.check-hint::before { content: "Подсказка. "; font-weight: 600; }
.check-explain { margin: .7rem 0 0; padding: .6rem .8rem; background: var(--surface); border-left: 3px solid var(--ok); border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: .92rem; }
.check-explain p:last-child { margin-bottom: 0; }
.check-explain .check-answer { font-family: var(--font-label); font-weight: 600; }

/* ---------- 9. Блоки уровня ---------- */
/* --radius-lg (12px), не --radius-xl/--radius-md: в потоке урока подряд стоят .widget/.check/.lv/
   .callout — три разных скругления (16/12/8) читались как разнобой вёрстки (находка критика
   visual2). 12px — общая мера для всех карточек внутри шага; 16px остаётся только у страничных
   карточек (.auth-card, .lesson-complete, docs/DESIGN.md §«Радиус»). */
.lv { border: 1px solid var(--line); border-left: 3px solid var(--lv2); border-radius: var(--radius-lg); background: var(--card); margin: .5rem 0 1.4rem; box-shadow: var(--shadow); }
.lv-epic { border-left-color: var(--lv3); }
.lv-head { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .3rem .8rem; padding: .8rem 1rem; }
.lv-head .label { margin: 0; }
.lv-pro .lv-head .label { color: var(--lv2); }
.lv-epic .lv-head .label { color: var(--lv3); }
.lv-head h3 { margin: 0; font-size: 1.1rem; grid-column: 2; }
@media (max-width: 600px) {
  .lv-head { grid-template-columns: auto 1fr; }
  .lv-head h3 { grid-column: 1 / -1; }
}
.lv-body { padding: 0 1rem .2rem; border-top: 1px solid var(--line); }
.lv-body > .row:first-child { padding-top: 1rem; }
.lv-body .row { grid-template-columns: minmax(0, 1fr); }
.lv-body .row > .margin { grid-column: 1; margin-bottom: 0; }
.lv-body .note { border-top: 0; border-left: 2px solid var(--line); padding: .2rem 0 .2rem .8rem; }
/* На экране другой уровень отсутствует целиком, включая ряд и заметки.
   Полный авторский просмотр (?all=1) и печатные уровни управляются отдельно. */
@media screen {
  html:not([data-all])[data-level="base"] .lesson :is(.row-pro, .row-epic, [data-level-block]),
  html:not([data-all])[data-level="pro"] .lesson :is(.row-epic, [data-level-block="epic"]) { display: none; }
}
/* Раскрывашка «Решение» внутри .lv (эпик/профи-блоки): без стилизации браузер рисует дефолтный
   треугольный маркер и неоформленный summary — на фоне стилизованных .note details это выглядит как
   забытый кусок вёрстки (находка критика visual1). Тот же язык, что у .note (labelкапс + свой маркер). */
.lv details { margin: .8rem 0; }
.lv details > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4em;
  font-family: var(--font-label); font-weight: 600; font-size: .8rem; letter-spacing: 0; text-transform: none; color: var(--muted);
  padding: .3rem 0;
}
.lv details > summary::-webkit-details-marker { display: none; }
.lv details > summary::before { content: "▸"; font-size: .8em; }
.lv details[open] > summary::before { content: "▾"; }
.lv details > summary:hover { color: var(--fg); }

/* ---------- 10. Виджет ---------- */
/* --radius-lg, не --radius-xl — см. комментарий у .lv выше: единая мера скругления для карточек в
   потоке урока (находка критика visual2). */
.widget { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin: .5rem 0 1.4rem; overflow: hidden; }
.widget-head { display: flex; align-items: baseline; gap: .6rem; padding: .8rem 1.1rem .5rem; }
.widget-head .label { margin: 0; color: var(--ink-sea); }
.widget-head strong { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.widget-stage { padding: .4rem 1.1rem 1rem; min-height: 120px; }
/* Незамонтированный виджет со штриховкой без подписи читался как битая картинка/ошибка, особенно
   когда таких блоков на экране сразу несколько (?all=1, быстрая прокрутка) — находка критика visual1.
   Нейтральная подложка + подпись вместо штриховки. */
.widget-stage:empty { background: var(--surface); display: flex; align-items: center; justify-content: center; }
.widget-stage:empty::before {
  content: "Загружается эксперимент…"; font-family: var(--font-label); font-weight: 600; font-size: .75rem;
  letter-spacing: 0; text-transform: none; color: var(--muted);
}
.widget-caption { margin: 0; padding: .5rem 1.1rem .9rem; font-size: .85rem; font-style: normal; color: var(--muted); border-top: 1px solid var(--line); }
.widget-caption p { margin: 0; }
.widget-error { padding: .8rem 1.1rem; color: var(--err); font-size: .9rem; }
/* классы внутри сцены (site/widgets/_lib.mjs) */
.w-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .6rem; }
.w-stage { position: relative; }
.w-stage svg { display: block; width: 100%; height: auto; overflow: visible; }
.w-stage svg text { font-family: var(--font-label); }
.w-stage canvas { display: block; width: 100%; }
.w-grid line, .w-grid path { stroke: var(--line); stroke-width: 1; }
.w-axis line, .w-axis path { stroke: var(--muted); stroke-width: 1; }
.w-tick { fill: var(--muted); font-size: var(--fs-svg-tick); font-family: var(--font-label); }
.w-axis-label { fill: var(--fg); font-size: var(--fs-svg-label); font-family: var(--font-label); }
.w-readout { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); font-family: var(--font-label); font-size: .85rem; }
.w-row { display: inline-flex; gap: .5em; align-items: baseline; }
.w-key { color: var(--muted); font-family: var(--font-label); font-size: .72rem; letter-spacing: 0; text-transform: none; }
.w-val { font-weight: 600; min-width: 3ch; }
.w-range { display: inline-grid; grid-template-columns: auto minmax(90px, 1fr) auto; align-items: center; gap: .5rem; font-size: .85rem; min-width: 200px; }
.w-range-label { color: var(--muted); font-family: var(--font-label); font-size: .75rem; }
.w-range-value { font-family: var(--font-label); min-width: 3.5ch; text-align: right; }
.w-range input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.w-seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 2px; background: var(--surface); }
.w-seg-btn { border: 0; background: transparent; padding: .25em .7em; border-radius: var(--radius-pill); font-family: var(--font-label); font-weight: 600; font-size: .8rem; color: var(--muted); }
.w-seg-btn.is-active, .w-seg-btn[aria-checked="true"] { background: var(--card); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.w-btn { border: 0; background: transparent; color: var(--fg); min-height: 32px; padding: 5px 0; border-radius: 2px; font-family: var(--font-label); font-weight: 400; font-size: .82rem; text-underline-offset: .25em; }
.w-btn:hover:not(:disabled), .w-btn:focus-visible { text-decoration: underline; }
.w-btn-primary { font-weight: 500; }
.w-btn:disabled { opacity: .5; cursor: not-allowed; }
.w-stage .is-dragging { cursor: grabbing; }
.w-stage [data-drag], .w-stage .handle { cursor: grab; }
.w-stage select, .w-controls select { padding: .3em .5em; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); font-size: .85rem; }
.w-table { font-family: var(--font-label); font-size: .8rem; }
.w-table td, .w-table th { padding: .25em .5em; text-align: center; }
.w-handle { cursor: grab; touch-action: none; }
.w-handle:active { cursor: grabbing; }
.w-handle:focus-visible { outline: var(--focus); outline-offset: 2px; }
.w-note { font-size: .82rem; color: var(--muted); margin-top: .6rem; }
.w-matrix { font-family: var(--font-label); font-size: .78rem; border-collapse: collapse; margin: 0; }
.w-matrix td, .w-matrix th { padding: .25em .6em; text-align: center; border: 1px solid var(--line); font-weight: 400; }
.w-matrix td.is-ok { color: var(--ok); font-weight: 600; }
.w-matrix td.is-error { color: var(--err); font-weight: 600; }

/* ---------- 11. Python-лаборатория ---------- */
.pylab { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); margin: .5rem 0 1.4rem; overflow: hidden; box-shadow: var(--shadow); }
.pylab-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.pylab-head .label { margin: 0; color: var(--lv2); }
.pylab-head strong { font-family: var(--font-display); font-size: 1.05rem; flex: 1 1 auto; }
.pylab-head .btn { margin-left: auto; }
.pylab-goal { margin: 0; padding: .5rem 1rem; font-size: .9rem; background: var(--surface); }
.pylab-code { display: block; width: 100%; min-height: 220px; resize: vertical; border: 0; padding: .9rem 1rem; background: var(--surface); color: var(--fg); font-family: var(--font-mono); font-size: .85rem; line-height: 1.55; tab-size: 4; }
.pylab-code:focus-visible { outline: none; box-shadow: inset 3px 0 0 var(--accent); }
.pylab-out { margin: 0; min-height: 3rem; padding: .7rem 1rem; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--card); color: var(--muted); font-size: .82rem; white-space: pre-wrap; }
.pylab-out:empty::before { content: "Вывод появится здесь. Pyodide (≈10 МБ) загружается только по кнопке «Запустить»."; font-style: italic; }
.pylab-out[data-state="success"] { color: var(--ok); font-weight: 600; }
.pylab-out[data-state="error"] { color: var(--err); }
.pylab-out[data-state="loading"] { color: var(--muted); }
.pylab[data-state="ok"] .pylab-head::after { content: "✓ засчитано"; color: var(--ok); font-family: var(--font-label); font-size: .72rem; font-weight: 700; letter-spacing: 0; text-transform: none; }

/* ---------- 12. Рисунки, формулы ---------- */
.figure { margin: .5rem 0 1.4rem; }
.figure svg { display: block; width: 100%; height: auto; }
/* Подписи и числа в SVG используют системный шрифт; формулы в тексте — KaTeX.
   Размер задаётся рисунком. В публикуемых уроках он не ниже 12 CSS px после масштабирования. */
.figure svg, .note svg { font-family: var(--font-label); }
.note svg { width: 100%; min-width: 280px; max-width: none; }
.figure figcaption { margin-top: .5rem; font-size: var(--fs-small); font-style: normal; color: var(--muted); }
.figure table { font-size: .9rem; }
.equation, .math-display { margin: 1.6rem 0; overflow-x: auto; overflow-y: hidden; text-align: center; padding: .2rem 0; }
.math-display .katex-display { margin: 0; }
/* Формулы согласованы по видимому размеру с системным текстом. */
.katex { font-size: 1.13em; }
/* Выключная формула ($$…$$) тем же кеглем, что абзац, не читается как акцент («\boxed{…}» выглядит
   мелкой рамкой посреди широкой колонки — находка критика visual2). Крупнее только в основном
   потоке; .note .katex (выше) остаётся сильнее по специфичности (3 класса против 2), в маргиналии
   формула не раздувается. */
.equation .katex, .math-display .katex { font-size: 1.28em; }
.note .equation .katex, .note .math-display .katex { font-size: .95em; }
/* формула шире колонки (в т.ч. в узкой маргиналии) скроллится, а не переполняет страницу */
.katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.math[data-tex]:not(:has(.katex)) { font-family: var(--font-body); font-style: italic; font-size: .9em; }
.main img { display: block; border-radius: var(--radius-md); }

/* ---------- 13. Хвост урока ---------- */
.callout { background: var(--surface); border-radius: var(--radius-lg); padding: .9rem 1.1rem; margin: .5rem 0 1.4rem; font-size: .95rem; }
.callout .label { color: var(--accent); }
.callout p:last-child { margin-bottom: 0; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; margin: .5rem 0 1.4rem; }
.summary-item { background: var(--card); padding: .9rem 1rem; font-size: .9rem; }
.summary-item .label { color: var(--fg); }
.summary-item p { margin: 0; }
.summary-item:nth-child(1) .label { color: var(--ok); }
.summary-item:nth-child(2) .label { color: var(--ink-sea); }
.summary-item:nth-child(3) .label { color: var(--ink-sun-dark); }
.homework, .sources, .task, .criteria, .checklist { margin: .5rem 0 1.4rem; }
.homework h3, .sources h3, .task h3, .criteria h3, .checklist h3 { font-size: 1.25rem; margin-bottom: .6rem; }
.homework > ol, .checklist > ol { list-style: none; padding: 0; counter-reset: hw; }
.homework > ol > li, .checklist > ol > li { counter-increment: hw; position: relative; padding: .6rem 0 .6rem 2.4rem; border-top: 1px solid var(--line); margin: 0; }
.homework > ol > li::before, .checklist > ol > li::before { content: counter(hw); position: absolute; left: .2rem; top: .7rem; font-family: var(--font-label); color: var(--muted); font-size: .85rem; }
.hw-item { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.hw-item > span { min-width: 0; }
.hw-item input { margin: .35em 0 0; accent-color: var(--ok); flex: 0 0 auto; }
/* Зачёркивание на всю длину 2-3-строчного пункта ДЗ рвало инлайновые формулы KaTeX в нечитаемые
   глифы, а сплошная линия через абзац — тяжёлое пятно посреди спокойной вёрстки (критик visual1).
   Выполненное помечает только галочка (:checked) и приглушённый цвет. */
.hw-item:has(input:checked) span { color: var(--muted); opacity: .8; }
.hw-check .check { margin: 0; }
/* Маркер того же тона, что цветные точки/полосы курса, а не чёрный browser-default disc — на одной
   странице с точкой .outcomes и нумерацией эпик-блока стандартный disc читался как из другой вёрстки
   (находка критика visual2). */
.sources ul { padding-left: 1.2em; font-size: .92rem; }
.sources ul li::marker { color: var(--ink-sea); font-size: .8em; }
.sources li { margin-bottom: .35em; }
.task { background: var(--band-butter); border-radius: var(--radius-lg); padding: 1rem 1.2rem; }
.criteria ul, .criteria ol { font-size: .95rem; }
.lesson-complete { display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: center; background: var(--surface); border-radius: var(--radius-xl); padding: 1.5rem 1.75rem; margin: 2.5rem 0 1.5rem; max-width: var(--prose); }
.lesson-complete .label { color: var(--ok); }
.lesson-complete h2 { margin: .1em 0 .3em; font-size: 1.6rem; }
.lesson-complete p { margin: 0; font-family: var(--font-display); font-size: 1.05rem; }
.prev-next { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem 2rem; margin: 1.25rem 0 .75rem; max-width: var(--shell); }
.nav-card { display: inline-flex; align-items: center; gap: .5rem; max-width: 32ch; min-height: 32px; padding: 5px 0; color: var(--fg); font: 400 .875rem/1.4 var(--font-label); text-decoration: none; }
.nav-card:hover .action-label, .nav-card:focus-visible .action-label { text-decoration: underline; }
.nav-next { flex-direction: row-reverse; text-align: right; margin-left: auto; }
.nav-card-empty { display: none; }
.lesson-footer { margin: 0 0 2rem; }
.lesson-footer .btn { font-size: .85rem; color: var(--muted); }

/* ---------- 14. Индекс курса ---------- */
/* Оглавление: книжный заголовок и компактный гротеск. */
.index { width: 100%; max-width: 900px; min-width: 0; margin: 0 auto; padding: 48px var(--shell-pad) 56px; }
.index-hero { padding: 0 0 34px; }
.index-hero h1 { font-size: 2.5rem; font-weight: 400; margin: 0 0 20px; }
.lead { font-size: 1.05rem; line-height: 1.6; color: var(--muted); max-width: 46rem; }
.index-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .8125rem; line-height: 1.6; }
.index-meta p { margin: 0; }
.index-expand { appearance: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; padding: 0 0 0 16px; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.index-expand:hover { color: var(--fg); }
.index-expand:focus-visible, .section-head:focus-visible { outline: var(--focus); outline-offset: 4px; }
.section { margin: 0; padding: 0; border: 0; scroll-margin-top: 5rem; }
.section-head { list-style: none; display: grid; grid-template-columns: 36px minmax(0, 1fr) 28px; align-items: baseline; gap: 12px; margin: 0; padding: 6px 0; cursor: pointer; }
.section-head::-webkit-details-marker { display: none; }
.section-head h2 { margin: 0; font: 600 .9375rem/1.45 var(--font-label); letter-spacing: 0; text-wrap: pretty; }
.section-num { font-size: .875rem; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.section-toggle { display: flex; align-items: center; justify-content: center; width: 28px; height: 18px; align-self: center; justify-self: end; color: var(--muted); }
.section-head:hover .section-toggle { color: var(--fg); }
.section-toggle .action-icon, .lesson-material .action-icon { stroke-width: 2; }
.section[open] > .section-head .section-toggle-vertical { display: none; }
.section-body { padding: 0 0 28px; }
.section-facts { margin: 2px 0 10px 48px; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { margin: 0; }
.lesson-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 6px 0; font-size: .875rem; line-height: 1.5; color: var(--fg); text-decoration: none; border: 0; background: transparent; }
.lesson-open { display: grid; grid-template-columns: subgrid; grid-column: 1 / 3; align-items: baseline; color: inherit; text-decoration: none; }
.lesson-open:hover .lesson-text strong { text-decoration: underline; text-underline-offset: 4px; }
.lesson-open:focus-visible, .lesson-material:focus-visible { outline: var(--focus); outline-offset: 3px; border-radius: 3px; }
.lesson-material { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: 0 0 auto; color: var(--muted); text-decoration: none; }
.lesson-material:hover, .lesson-material:focus-visible { color: var(--fg); }
.lesson-card > .lesson-meta:has(.lesson-material) { align-self: start; margin-top: -4px; }
.lesson-num { font: 400 .8125rem/1.5 var(--font-label); color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-text { min-width: 0; }
.lesson-text strong { font: 400 .875rem/1.5 var(--font-label); }
.lesson-card.is-stub .lesson-text { color: var(--muted); }
.lesson-meta { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; color: var(--muted); }
.minutes { font: 400 .75rem/1.5 var(--font-label); font-variant-numeric: tabular-nums; }
.lesson-availability { font-size: .6875rem; }
.lesson-meta .progress-dot { width: 10px; height: 10px; }
.lesson-meta .progress-dot:not(.is-started):not(.is-done) { display: none; }
.levels { margin: 36px 0 0 48px; color: var(--muted); }
.levels > summary { cursor: pointer; width: fit-content; font-size: .8125rem; }
.level-cards { display: grid; gap: 18px; margin-top: 20px; }
.level-card { padding: 0; border: 0; background: none; }
.level-card .label { display: inline; margin-right: 10px; color: var(--fg); }
.level-card strong { font-size: .8125rem; font-weight: 400; }
.level-card p { font-size: .8125rem; line-height: 1.6; margin: 5px 0 0; }
@media (max-width: 900px) {
  .index { padding-top: 36px; }
}
@media (max-width: 560px) {
  .index { padding-inline: 20px; }
  .index-hero h1 { font-size: 2.25rem; }
  .index-meta { font-size: .75rem; }
  .section-head, .lesson-card { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; }
  .section-head { padding-block: 12px; }
  .section-facts, .levels { margin-left: 38px; }
  .lesson-card { padding-block: 9px; }
  .lesson-meta { gap: 2px; }
  .section-toggle { width: 36px; }
  .lesson-material { width: 36px; height: 36px; }
  .lesson-card > .lesson-meta:has(.lesson-material) { margin-top: -8px; }
  .lesson-availability { display: none; }
}
.progress-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line); background: conic-gradient(var(--lv1) calc(var(--done, 0) * 100%), transparent 0); flex: 0 0 auto; }
.progress-dot[data-done="1"] { border-color: var(--lv1); }
/* Траектории используют прежние стили оглавления; меняется только состав. */
html[data-level="base"] [data-trajectory]:not([data-trajectory="base"]),
html[data-level="pro"] [data-trajectory]:not([data-trajectory="pro"]),
html[data-level="epic"] [data-trajectory]:not([data-trajectory="epic"]) { display: none; }

/* В тёмной теме --line (#27272a) на --card (#1d1e22) даёт контраст ниже 1.3:1 — точка прогресса
   непройденного урока практически невидима (находка критика visual1). */
html[data-theme="dark"] .progress-dot { border-color: color-mix(in srgb, var(--fg) 25%, transparent); }

/* ---------- 15. Формы и страницы входа ---------- */
.auth { padding: 3rem 24px; }
.auth-card { max-width: 30rem; margin: 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 2rem; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 2rem; margin-bottom: .3em; }
.auth-card h2 { font-size: 1.3rem; margin: 1.5rem 0 .6rem; }
.auth-card .lead { font-size: 1rem; margin-bottom: 1.2rem; }
.auth-alt, .auth-note { font-size: .9rem; color: var(--muted); margin: 1.2rem 0 0; }
/* Единая страница входа: две вкладки, роль нужна только при регистрации. */
.page-login .auth-card { box-shadow: none; }
.page-login .auth-card h1 { font-size: 1.6rem; margin: 1.5rem 0; }
.auth-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); font-family: var(--font-label); }
.auth-tabs a { color: var(--muted); text-decoration: none; padding: 0 0 .7rem; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tabs a[aria-current] { color: var(--fg); border-bottom-color: var(--fg); }
.auth-roles { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; border: 0; padding: 0; margin: 0 0 1.5rem; font-family: var(--font-label); font-size: .9rem; }
.auth-roles legend { font-size: .8rem; color: var(--muted); margin-bottom: .6rem; }
.auth-roles label { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.auth-roles input { accent-color: var(--fg); }
.auth-contact, .auth-help { font-size: .9rem; }
.auth-contact a, .auth-help a { overflow-wrap: anywhere; }
.auth-contact p { margin-bottom: .6rem; }
.auth-help { margin-top: 1.2rem; color: var(--muted); }
.auth-help summary { cursor: pointer; }
.auth-help p { margin: .6rem 0 0; }
.page-login .form-actions .btn { width: 100%; }
.form { margin: 0; }
.field { display: grid; gap: .3rem; margin: 0 0 .9rem; }
.field label, .field-inline > span { font-family: var(--font-label); font-weight: 700; font-size: .75rem; letter-spacing: 0; text-transform: none; color: var(--muted); }
.field input, .field select, .field textarea, .field-inline input, .field-inline select { padding: .55em .8em; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); color: var(--fg); width: 100%; font-size: 1rem; }
.field input:focus-visible { outline: var(--focus); border-color: var(--ink-sea); }
/* Нативная OS-стрелка/градиент select'а выбивалась из системы токенов (серый градиент, системный
   радиус) — находка критика visual1 (/practice/, но одинаково касается всех select на сайте):
   своя тонкая стрелка на CSS-градиентах, без картинок. */
.field select, .field-inline select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 2.2rem;
}
.field input[name="code"] { font-family: var(--font-label); font-weight: 700; text-transform: none; letter-spacing: 0; }
.field-hint { color: var(--muted); font-size: .8rem; }
.field-inline { display: inline-flex; flex-direction: column; gap: .3rem; }
.field-inline input, .field-inline select { width: auto; font-size: .9rem; padding: .4em .7em; }
.form-inline { display: grid; gap: .3rem; margin-top: 1rem; }
.form-error { color: var(--err); font-size: .9rem; font-weight: 600; margin: .3rem 0 0; min-height: 1.2em; }
.form-error[data-kind="info"] { color: var(--muted); font-weight: 400; }
.form-error:empty { display: none; }
.form-ok { color: var(--ok); font-size: .9rem; font-weight: 600; }
.login-suggestions { font-size: .9rem; margin: -.3rem 0 .8rem; padding: .6rem .8rem; background: var(--band-butter); border-radius: var(--radius-md); }
.login-suggestions button { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-pill); padding: .15em .6em; font-family: var(--font-label); font-size: .85rem; margin: .2em .2em 0 0; }
.switch { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.switch input { accent-color: var(--ok); width: 1.1em; height: 1.1em; }
.page-head { padding: 2.5rem 0 1rem; }
.page-head .lead { margin-bottom: 0; }

/* ---------- 16. Кабинет учителя ---------- */
.teacher .cabinet-head { padding: 2.5rem 0 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.report-open { border: 0; background: none; color: inherit; font: inherit; text-align: inherit; cursor: pointer; padding: .4rem; width: 100%; }
.report-open:focus-visible { outline: var(--focus); outline-offset: 2px; }
.student-cell .report-open { font-weight: 600; text-align: left; }
.class-create { margin-top: 1rem; }
.class-create > summary { cursor: pointer; color: var(--muted); }
.class-create[open] > summary { margin-bottom: 1rem; }
.classes > summary, .class-live > summary { cursor: pointer; font-weight: 500; }
.classes[open] > summary, .class-live[open] > summary { margin-bottom: 1rem; }
.class-live { margin-top: 1rem; }
.classes, .class-live, .class-report, .profile-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 1.3rem 1.5rem; box-shadow: var(--shadow); }
.classes h2, .class-live h2, .class-report h2, .profile-section h2 { font-size: 1.25rem; margin-bottom: .8rem; }
.class-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.class-list li { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-md); margin: 0; }
.class-list li.is-active { border-color: var(--accent); background: var(--surface); }
.class-list li:has(.class-item) { padding: 0; overflow: hidden; }
/* Строка-кнопка «Открыть класс»: растягивается на весь li, текст (имя · счётчик) — по левому краю. */
.class-list .class-item { display: block; width: 100%; padding: .6rem .8rem; border: none; border-radius: inherit; background: none; font: inherit; font-weight: 600; text-align: left; color: var(--fg); cursor: pointer; }
.class-list .class-item:hover { background: var(--surface); color: var(--accent); }
.class-list .class-item:focus-visible { outline: var(--focus); outline-offset: -2px; }
.class-list .class-name { font-weight: 600; flex: 1 1 auto; }
.class-list .class-count, .class-list .class-code-sm { color: var(--muted); font-size: .85rem; font-family: var(--font-label); }
.class-list button:not(.class-item) { margin-left: auto; }
.live-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; font-size: .9rem; }
.live-list li { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; padding: .4rem 0; border-top: 1px solid var(--line); margin: 0; }
.live-list .live-name { font-weight: 600; }
.live-list .live-step { color: var(--muted); grid-column: 2; font-size: .85rem; }
.live-list .live-name::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: .4em; }
.class-report { margin-top: 1.5rem; }
.report-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem 2rem; margin-bottom: 1rem; }
.report-head h2 { margin: 0; font-size: 1.6rem; }
.class-code-box { display: flex; flex-direction: column; gap: .2rem; }
.class-code { font-family: var(--font-label); font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 700; letter-spacing: 0; background: var(--band-butter); border: 1px dashed var(--ink-sun-dark); border-radius: var(--radius-md); padding: .15em .5em; line-height: 1.2; }
.class-controls { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; margin-left: auto; }
.class-settings { margin-left: auto; max-width: 38rem; }
.class-settings > summary { cursor: pointer; }
.class-settings .class-controls { margin-top: .75rem; }
.class-settings .class-controls > .switch { flex-basis: 100%; }
.class-settings > p { margin: .75rem 0 0; font-size: .85rem; }
.report-tools { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; align-items: flex-end; }
.report-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.report { font-size: .85rem; min-width: 640px; }
.report th, .report td { padding: .5em .6em; white-space: nowrap; }
.report thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.report th:first-child, .report td:first-child { position: sticky; left: 0; background: var(--card); z-index: 2; width: 12rem; min-width: 12rem; max-width: 12rem; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .report th:first-child, .report td:first-child { width: 9rem; min-width: 9rem; max-width: 9rem; }
}
.report thead th:first-child { z-index: 3; background: var(--surface); }
.report td[data-student][data-lesson] { cursor: pointer; }
.report td[data-student][data-lesson]:hover { background: var(--surface); }
.report .student-name { font-weight: 600; }
.report .student-login { color: var(--muted); font-family: var(--font-label); font-size: .8rem; display: block; }
.report .last-seen { color: var(--muted); font-size: .8rem; }
.report th.is-sorted { color: var(--fg); }
.report th button { all: unset; cursor: pointer; font: inherit; color: inherit; }
/* мини-бар: --done и --assisted — доли 0…1 */
.bar { --done: 0; --assisted: 0; display: block; width: 72px; height: 8px; border-radius: var(--radius-pill); background: linear-gradient(to right, var(--lv1) 0 calc(var(--done) * 100%), var(--assisted-c, var(--assisted)) calc(var(--done) * 100%) calc((var(--done) + var(--assisted)) * 100%), color-mix(in srgb, var(--fg) 10%, transparent) 0); }
.bar-label { font-family: var(--font-label); font-size: .75rem; color: var(--muted); margin-left: .4em; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--fg) 15%, transparent); }
.dot.is-ok { background: var(--ok); }
.dot.is-tried { background: var(--err); }
.cell-pro { color: var(--lv2); font-family: var(--font-label); }
.cell-epic { color: var(--lv3); font-family: var(--font-label); }
.cell-hw { color: var(--ink-sun-dark); font-family: var(--font-label); }
.report-legend { font-size: .8rem; color: var(--muted); margin: .8rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
.legend-done, .legend-assisted, .legend-dot { display: inline-block; width: 14px; height: 8px; border-radius: var(--radius-pill); background: var(--lv1); }
.legend-assisted { background: var(--assisted); }
.legend-dot { width: 8px; border-radius: 50%; background: var(--ok); }
.student-detail { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--card); color: var(--fg); padding: 1.5rem; width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.student-detail::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: .7rem; right: .7rem; margin: 0; }
/* Диалог подтверждения (confirmDialog из site/client/dom.mjs) — те же токены, что у .student-detail,
   иначе на фоне карточек с мягкими тенями браузерный <dialog> без стилей выглядит как системный alert. */
.dialog { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--card); color: var(--fg); padding: 1.5rem; width: min(420px, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(3px); }
.dialog-form h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
.dialog-form p { color: var(--muted); margin: 0 0 1.2rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }
.student-detail h2 { font-size: 1.4rem; margin-right: 2.5rem; }
.student-detail h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
.detail-checks { list-style: none; padding: 0; display: grid; gap: .5rem; }
.detail-checks li { border: 1px solid var(--line); border-radius: var(--radius-md); padding: .6rem .8rem; font-size: .9rem; margin: 0; display: grid; gap: .2rem; }
.detail-checks .detail-id { font-family: var(--font-label); color: var(--muted); font-size: .75rem; }
.detail-checks .detail-answer { font-family: var(--font-label); }
.detail-checks li.is-ok { border-left: 3px solid var(--ok); }
.detail-checks li.is-stuck { border-left: 3px solid var(--err); }
.detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.detail-password { font-family: var(--font-label); font-weight: 700; letter-spacing: 0; font-size: 1.3rem; background: var(--band-butter); padding: .2em .5em; border-radius: var(--radius-md); }

/* ---------- 17. Профиль ---------- */
.profile-anon, .profile-user { padding: 2.5rem 0 1rem; }
.profile-card { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; padding: 1.5rem 0; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.profile-card h1 { font-size: 2rem; margin: 0 0 .2em; }
.avatar-blazon { font-family: var(--font-display); font-style: normal; color: var(--muted); margin: 0 0 .3rem; }
.profile-meta { color: var(--muted); font-size: .9rem; margin: 0; font-family: var(--font-label); }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 1.2rem; align-items: start; }
.profile-shortcuts { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.profile-shortcuts .btn-primary { padding: .65rem 1rem; border-radius: var(--radius-md); background: var(--cta); color: var(--cta-fg); }
.profile-shortcuts .btn-primary:hover { background: var(--cta-hover); }
.profile-shortcuts .btn-ghost { padding-inline: .5rem; }
.profile-section details > summary { cursor: pointer; }
.profile-section > summary { cursor: pointer; font-size: 1.1rem; font-weight: 600; }
.profile-section[open] > summary { margin-bottom: 1rem; }
.profile-session { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.profile-session p { margin: .25rem 0; font-size: .875rem; }
.profile-session .form-error:empty { display: none; }
.profile-card .avatar-lg { width: 64px; height: 76px; }
.merge-guest { background: var(--band-butter); border-left: 4px solid var(--ink-sun); border-radius: var(--radius-lg); padding: 1rem 1.2rem; margin-bottom: 1.5rem; }
.merge-guest .label { color: var(--ink-sun-dark); }
.must-change { color: var(--err); font-weight: 600; }
.level-options { border: 0; padding: 0; margin: 0 0 .5rem; display: grid; gap: .5rem; }
/* Раньше третья колонка (grid-template-columns: auto auto 1fr) начиналась после переменной ширины
   названия уровня («База»/«Профи»/«Эпик» — 40/50/43px), и у описания в каждой карточке была своя
   левая граница — рваный левый край, три узких столбика текста (находка критика visual2). Описание —
   на своей строке, под названием, во всю ширину варианта. */
.level-option { display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; align-items: start; padding: .6rem .8rem; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-md); cursor: pointer; }
.level-option.lv-base { border-left-color: var(--lv1); }
.level-option.lv-pro { border-left-color: var(--lv2); }
.level-option.lv-epic { border-left-color: var(--lv3); }
.level-option input { accent-color: var(--accent); margin-top: .25em; }
/* Рамка --fg по периметру выбранного варианта спорила с цветной левой полосой уровня (находка
   критика visual2) — оставляем подложку и утолщаем саму полосу, а не обводим карточку целиком. */
.level-option:has(input:checked) { background: var(--surface); }
.level-option.lv-base:has(input:checked) { border-left-color: var(--lv1); border-left-width: 6px; }
.level-option.lv-pro:has(input:checked) { border-left-color: var(--lv2); border-left-width: 6px; }
.level-option.lv-epic:has(input:checked) { border-left-color: var(--lv3); border-left-width: 6px; }
.level-name { grid-column: 2; font-family: var(--font-label); font-weight: 700; }
.level-desc { grid-column: 2; font-size: .85rem; color: var(--muted); text-align: left; margin-top: .1rem; }
.guest-summary { margin-top: 1.5rem; font-size: .95rem; }

/* ---------- 18. Карта мастерства ---------- */
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; font-size: .85rem; color: var(--muted); margin: 0 0 1.5rem; }
/* Свотч — уменьшенная копия плитки (.map-tile::after ниже), а не самостоятельная заливка слева
   направо: доля пройденного на самой плитке показана тонкой полосой снизу, легенда со сплошной
   левой заливкой искала не то, чего на плитках нет (находка критика visual2). */
.map-swatch { --done: 0; position: relative; display: inline-block; width: 22px; height: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
.map-swatch::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--done) * 100%); background: var(--lv1); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; align-items: stretch; }
/* app.js (initMap) вставляет счётчик «Пройдено уроков: N из M» первым узлом .map-grid — без этого
   правила он занимает первую ячейку грида как узкая карточка, а под ним пустует вся высота соседних
   разделов (находка критика visual1: «дыра больше экрана» под шапкой страницы). */
.map-grid > .map-summary { grid-column: 1 / -1; margin: 0 0 .3rem; }
/* display:flex + .map-tiles{flex:1} — разделы с разным числом плиток (8 в разделе 1, 6 в остальных)
   при align-items:start грида давали ряды разной высоты с рваным нижним краем и неровным зазором
   перед следующим рядом (находка критика visual2); align-items:stretch на .map-grid растягивает
   карточку раздела на всю высоту ряда, а flex внутри растягивает под неё сетку плиток. */
.map-section { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.1rem; background: var(--surface); }
.map-section h2 { font-size: 1.05rem; margin: 0 0 .6rem; display: flex; gap: .5rem; align-items: baseline; }
.map-section h2 .map-n { font-family: var(--font-label); color: var(--muted); font-size: .85rem; }
.map-tiles { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .4rem; align-content: start; }
/* Заливка доли пройденного — не прямоугольник поверх текста (обрезал слова посреди названия и
   игнорировал border-radius плитки, торча зелёным углом — критик visual1), а тонкая полоса снизу. */
.map-tile { --done: 0; display: flex; flex-direction: column; gap: .15rem; padding: .5rem .6rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--fg); text-decoration: none; font-size: .8rem; line-height: 1.25; min-height: 3.6rem; position: relative; overflow: hidden; }
.map-tile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; width: calc(var(--done) * 100%); background: var(--lv1); transition: width .2s ease; }
.map-tile:hover { border-color: var(--fg); }
.map-tile .map-id { font-family: var(--font-label); color: var(--muted); font-size: .7rem; }
.map-tile.is-stub { color: var(--muted); border-style: dashed; background: transparent; }
.map-tile.is-stub::after { content: none; }
.map-tile.is-capstone { border-color: color-mix(in srgb, var(--lv3) 50%, transparent); }
.map-tile[data-done="1"] { padding-right: 1.6rem; }
.map-tile[data-done="1"]::before { content: "✓"; position: absolute; right: .5rem; top: .4rem; color: var(--ok); font-weight: 700; }

/* ---------- 19. Тренажёр — бесконечная лента без самооценки (docs/TRAINER.md, LESSON-FORMAT §3.8) ---------- */
/* Вопрос начинается близко к шапке; длинные задания прокручиваются внутри экрана. */
.page-practice { height: 100dvh; overflow: hidden; }
.page-practice > main { flex: 1; min-height: 0; }
.page-practice .assistant-launcher { display: none; }
.practice-shell { display: flex; flex-direction: column; height: 100%; max-width: 640px; margin: 0 auto; padding: 0 24px; }
.practice-empty { padding: 3rem 0; text-align: center; }
/* Запас под внешнюю рамку фокуса; отрицательные поля сохраняют положение и ширину карточки. */
.feed-stage { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; margin-inline: -2px; padding: clamp(28px, 6vh, 60px) 4px 24px; }
.feed-card { display: flex; flex-direction: column; }
.feed-card:focus-visible { outline: none; }
.feed-card.is-entering { animation: feed-enter .2s ease-out; }
@keyframes feed-enter { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.feed-controls { position: relative; display: flex; align-items: center; justify-content: space-between; flex: none; padding: 10px 0 max(14px, env(safe-area-inset-bottom)); }
.feed-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 2px; border: 0; border-radius: 0; background: transparent; color: var(--fg); font: 400 .88rem/1.3 var(--font-label); cursor: pointer; text-decoration: none; }
.action-icon { flex: 0 0 18px; width: 18px; height: 18px; }
.action-label { min-width: 0; text-underline-offset: .25em; text-decoration-thickness: 1px; }
.feed-action:hover:not(:disabled) .action-label, .feed-action:focus-visible .action-label { text-decoration-line: underline; }
.feed-action:disabled { color: var(--muted); opacity: .55; cursor: default; }
.feed-action:focus-visible { outline: var(--focus); outline-offset: 2px; border-radius: 2px; }
.feed-controls { gap: 16px; }
.feed-controls .feed-action { color: var(--muted); font-size: .78rem; }
.feed-controls .feed-action:hover { color: var(--fg); }
.feed-hint { margin-left: auto; }
.feed-stats summary { list-style: none; }
.feed-stats summary::-webkit-details-marker { display: none; }
.feed-stats-panel { position: absolute; bottom: 100%; left: 0; z-index: 5; width: 240px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: 0 8px 30px #0001; font-size: .85rem; }
.feed-stats-panel dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; margin: 16px 0; }
.feed-stats-panel dd { margin: 0; font-variant-numeric: tabular-nums; }
.page-practice .assistant-hint { align-self: flex-start; border: 0; padding: 8px 0; margin-top: 18px; color: var(--muted); font-weight: 400; }

.feed-front { display: flex; flex-direction: column; }
.feed-topic { margin: 0 0 .75rem; color: var(--muted); font: 400 .78rem/1.4 var(--font-label); }
.feed-question { font-family: var(--font-display); font-size: clamp(1.35rem, 2.6vw, 1.75rem); font-weight: 500; line-height: 1.4; margin-bottom: 1.6rem; }
.feed-question > :last-child { margin-bottom: 0; }
.feed-answer { display: flex; flex-direction: column; gap: 1rem; }

/* Пропуск cloze (LESSON-FORMAT §3.8) — «…» в тексте вопроса на месте будущего печатного поля;
   сам символ прячем (расставляем точки letter-spacing на видимом псевдо-символе), поле для ответа
   не путается с обычной пунктуацией предложения. */
.cloze-gap { display: inline-block; min-width: 3.2em; margin: 0 .1em; padding: .05em .7em; border-bottom: 2px solid var(--accent); border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--surface); color: var(--accent); font-weight: 600; text-align: center; letter-spacing: .2em; }

/* choice/multi — варианты во всю ширину, тап отвечает (multi — отмечает и ждёт «Проверить»). */
.feed-choices { display: grid; gap: .5rem; }
.choice-btn, .match-item, .order-item { display: flex; align-items: baseline; gap: 10px; text-align: left; min-height: 44px; padding: 10px 0; border: 0; border-radius: 0; background: transparent; color: var(--fg); font: inherit; font-size: 1rem; line-height: 1.45; cursor: pointer; }
.choice-btn .action-icon, .match-item .action-icon, .order-item .action-icon { align-self: flex-start; margin-top: .16em; color: var(--muted); }
.choice-btn:hover:not(:disabled) .action-label, .match-item:hover:not(:disabled) .action-label, .order-item:hover:not(:disabled) .action-label { text-decoration-line: underline; }
.choice-btn:disabled { cursor: default; }
.option-tick { visibility: hidden; }
.choice-btn[aria-pressed="true"] .option-tick, .choice-btn[data-result="correct"] .option-tick { visibility: visible; }
.choice-btn[aria-pressed="true"] { color: var(--accent); }
.choice-btn[aria-pressed="true"] .action-icon { color: inherit; }
.choice-btn[data-result="correct"], .choice-btn[data-result="correct"] .action-icon { color: var(--ok); }
.choice-btn[data-result="wrong"] .action-label { color: var(--err); text-decoration: line-through; }
/* «Проверить» у multi — отдельный шаг после отметок, а не шестой вариант: без отступа кнопка
   прилипала к последнему варианту и на узком экране читалась как часть списка. */
.feed-multi-submit { margin: .9rem 0 0; }

/* numeric/short/cloze — печатное поле, Enter отправляет; is-wrong — короткая индикация неверной
   первой попытки (карточка остаётся на месте, вторая попытка тем же полем — LESSON-FORMAT §3.8). */
.feed-input-form, .feed-cloze-form { display: flex; flex-wrap: wrap; gap: .7rem; margin: 0; }
.feed-input-field { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; flex: 1; }
.feed-input-field input { width: 100%; min-width: 0; }
.feed-input-form { align-items: center; }

.feed-input-form input, .feed-cloze-form input { padding: .6em .85em; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); color: var(--fg); font: inherit; font-size: 1.05rem; min-width: 8rem; }
.feed-input-form input:focus-visible, .feed-cloze-form input:focus-visible { outline: var(--focus); outline-offset: 1px; }
.feed-input-form input.is-wrong, .feed-cloze-form input.is-wrong { border-color: var(--err); }
.feed-unit { font-family: var(--font-label); color: var(--muted); font-size: .85rem; }
/* Короткая подсказка «Неверно, ещё одна попытка» между первой и второй попыткой печатных типов —
   вставляет app.js текстовым узлом рядом с полем через тот же .feed-retry-hint, не отдельный блок. */
.feed-retry-hint { width: 100%; margin: -.3rem 0 0; font-family: var(--font-label); font-size: .82rem; color: var(--err); }

/* match — левая колонка фиксирована, правая перемешана; пара собирается двумя тапами подряд. */
.feed-match { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem 5rem; }
.feed-match-col { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.match-item { position: relative; align-items: center; font-size: .92rem; overflow-wrap: anywhere; }
.match-item[data-side="left"] { padding-right: 16px; }
.match-item[data-side="right"] { padding-left: 16px; }
.match-port { position: absolute; top: calc(50% - 3px); width: 6px; height: 6px; border: 1px solid var(--muted); border-radius: 50%; background: var(--bg); }
[data-side="left"] .match-port { right: -3px; }
[data-side="right"] .match-port { left: -3px; }
.match-item[data-matched] .match-port, .match-item[data-picked] .match-port { border-color: var(--accent); background: var(--accent); }
.match-item[data-result="correct"] .match-port { border-color: var(--ok); background: var(--ok); }
.match-item[data-result="wrong"] .match-port { border-color: var(--err); background: var(--err); }
.match-threads { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.match-threads path { fill: none; stroke: var(--accent); stroke-width: 1.25; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .65; }
.match-threads .is-pending { opacity: .9; }
.match-threads [data-result="correct"] { stroke: var(--ok); }
.match-threads [data-result="wrong"] { stroke: var(--err); }
.match-item:disabled { cursor: default; opacity: .55; } /* уже вошла в готовую пару */
.match-item[data-picked="true"] { color: var(--accent); }
.match-item[data-picked="true"] .action-label { text-decoration: underline; }
.match-item[data-result="correct"] { color: var(--ok); }
.match-item[data-result="wrong"] { color: var(--err); }
/* Итог пары важнее «уже занята»: без этого зелёная/красная рамка гасла под opacity .55 от :disabled,
   и после ответа обе колонки выглядели одинаково серыми — разбор карточки читался хуже вердикта. */
.match-item:disabled[data-result] { opacity: 1; }
.match-item[data-result="correct"]::after { content: " ✓"; color: var(--ok); }

/* order — шаги-«пул» тапаются по очереди (или стрелками+Enter с клавиатуры) в слоты сверху;
   пустой слот — пунктирная рамка с номером, занятый — как обычный вариант. */
.feed-order-slots { display: flex; flex-direction: column; gap: .4rem; margin: 0 0 .8rem; padding: 0; list-style: none; }
.feed-order-slots li { display: flex; align-items: center; gap: .6em; min-height: 2.4em; padding: .4em .7em; border: 1px dashed var(--line); border-radius: var(--radius-md); font-size: .92rem; color: var(--muted); }
.feed-order-slots li[data-filled="true"] { border-style: solid; color: var(--fg); background: var(--card); }
.feed-order-slots .order-slot-n { font-family: var(--font-label); font-weight: 700; color: var(--muted); flex-shrink: 0; }
.feed-order-pool { display: flex; flex-direction: column; gap: .25rem; }
.order-item { font-size: .92rem; }
.order-item:focus-visible { outline: var(--focus); outline-offset: 1px; }
.order-item[hidden] { display: none; } /* уже размещён в слоте */
.feed-order-slots.is-checked li[data-correct="true"] { border-color: var(--ok); }
.feed-order-slots.is-checked li[data-correct="false"] { border-color: var(--err); }

/* Оборот карточки: вердикт, объяснение, «Дальше» — появляется ПОД .feed-front после ответа (§1/§2),
   не заменяет его — у choice/multi/match/order сам верный ответ виден подсветкой прямо в вариантах
   выше (border-color/✓/зачёркивание), вердикт здесь только фиксирует словами; у numeric/short/cloze
   подсветки на поле недостаточно (само число/слово не показано), поэтому текст вердикта содержит
   «Правильный ответ: …» именно для них. Верхняя линия — единственный разделитель фронта и оборота. */
.feed-back { display: flex; flex-direction: column; margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.feed-verdict { margin: 0 0 .8rem; font-family: var(--font-label); font-weight: 700; font-size: 1.05rem; }
.feed-verdict.is-correct { color: var(--ok); }
.feed-verdict.is-wrong { color: var(--err); }
.feed-explain { margin: 0 0 1.6rem; padding: .8rem 1rem; background: var(--surface); border-left: 3px solid var(--ok); border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: .95rem; }
.feed-explain:empty { display: none; }
.feed-explain p:last-child { margin-bottom: 0; }
.feed-back .form-actions { margin: 0; }


@media (max-width: 640px) {
  .practice-shell { padding-left: 16px; padding-right: 16px; }
  .feed-match { gap: .5rem 3rem; }
  .match-item, .choice-btn { font-size: .92rem; }
  .feed-controls { gap: 10px; }
}

/* ---------- 20. Страница «Учителю» ---------- */
/* 800px при обычном теле (Inter 1rem) — это ~100 знаков в строке на «A4-странице» (находка критика
   visual1); --prose (680px) — та же читаемая мера, что и в уроке.
   Раньше .teach центрировался сам по себе (max-width:var(--prose), margin:auto) — на широком экране
   его левый край (~396px на 1440) не совпадает с .shell (~218px): страница «прыгает» при переходе
   курс → учителю (находка критика visual2). Общий левый край — через .shell, узкая колонка — max-width
   на прямых потомках .teach, без своей центровки. (.practice-shell в этот общий левый край больше не
   входит — тренажёр, в отличие от .teach, не текст для чтения, а Anki-подобная страница с одной
   карточкой по центру, см. §19 выше.) */
.teach { max-width: var(--shell); margin: 0 auto; padding: 2.5rem var(--shell-pad) 3rem; font-size: 1rem; }
.teach > * { max-width: var(--prose); }
/* 1px var(--line), не 2px почти-чёрным — единственная такая жирная линейка на сайте (везде 1px
   var(--line)), находка критика visual2. */
.teach-header { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.teach-header h1 { font-size: 2rem; }
.teach-meta { color: var(--muted); font-size: .9rem; font-family: var(--font-label); display: flex; flex-wrap: wrap; gap: .3rem .5rem; }
/* Каждый пункт — свой inline-блок с nowrap: раньше строка переносилась внутри пункта («ready»
   сиротой на второй строке — находка критика visual2), теперь перенос только между пунктами
   (разделитель « · » вставляет render.mjs между <span>). */
.teach-meta span { white-space: nowrap; }
.teach-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.teach-section { margin-bottom: 2rem; break-inside: avoid; }
.teach-section h2 { font-size: 1.35rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; margin-bottom: .8rem; }
.teach-section h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
.teach-plan li { margin-bottom: .3em; }
.teach-steps { padding-left: 0; list-style: none; }
.teach-steps li { padding: .3em 0; border-bottom: 1px dotted var(--line); }
.teach-answers { list-style: none; padding: 0; display: grid; gap: .7rem; }
.teach-check { border: 1px solid var(--line); border-radius: var(--radius-md); padding: .7rem .9rem; margin: 0; break-inside: avoid; }
.teach-check .label { margin-bottom: .2rem; }
.teach-prompt p:last-child { margin-bottom: .4rem; }
.teach-answer { margin: .2rem 0; font-size: .95rem; }
.teach-answer b { color: var(--ok); font-family: var(--font-label); }
.teach-choices { font-size: .9rem; margin: .3rem 0; }
.teach-choices .is-correct { font-weight: 600; color: var(--ok); }
/* ::marker наследует font-weight с <li> — жирный верный вариант делал и его цифру шире соседних,
   колонка «1. 2. 3.» рвалась на несколько px (находка критика visual2). Маркер — всегда обычный. */
.teach-choices li::marker { font-weight: 400; }
.teach-correct-mark { font-weight: 400; font-size: .85em; color: var(--muted); }
/* Подпись «шаг N» у формулы в «Ключевых формулах» — иначе три формулы стоят голым столбиком без
   указания, к какому шагу каждая относится (находка критика visual1). */
.teach-formula { margin-bottom: 1rem; }
.teach-formula-step { display: block; font-family: var(--font-label); font-weight: 700; font-size: .8125rem; letter-spacing: 0; text-transform: none; color: var(--muted); margin-bottom: .2rem; }
.teach-hint, .teach-explain, .teach-prompt-sample { font-size: .9rem; color: var(--muted); margin: .5rem 0 0; }
/* Ярлык вместо серого текста-префикса «Подсказка:»/«Объяснение:» — без него два блока подряд
   сливались в одну плашку без иерархии (находка критика visual2); цвет по смыслу, как везде на
   сайте (sun-dark — подсказка, accent — объяснение). */
.teach-hint .label, .teach-explain .label { display: block; margin-bottom: .15rem; }
.teach-hint .label { color: var(--ink-sun-dark); }
.teach-explain .label { color: var(--accent); }
.teach-notes li, .teach-margins li { margin-bottom: .6em; }
.teach-margins li .label { display: inline; margin-right: .5em; }
.teach-margins li > :not(.label) { display: inline; }

/* ---------- 21. 404 ---------- */
.notfound { padding: 4rem 24px; }
.notfound .auth-card { text-align: center; }
.notfound h1 { font-size: 2.2rem; }

/* ---------- 22. Адаптив ---------- */
@media screen and (max-width: 1024px) {
  :root { --gap: 0px; }
  .row { display: block; }
  /* Без сетки .main растягивается на всю ширину .lesson-body (~990px на планшете 1024) — вдвое шире
     заявленных --prose 680px/68ch, читать тяжело ровно на школьном ноутбуке (находка критика visual1).
     margin-inline:auto — иначе колонка 680px просто прижималась к левому краю .lesson-body (~942px на
     1024), оставляя ~300px мёртвой полосы справа и «съезжая» всю страницу влево (критик visual2);
     .note центрируется тем же приёмом, чтобы заметка под абзацем не уезжала мимо центрированной колонки. */
  .lesson-header > .row > .main, .intro > .row > .main, .step-body > .row > .main { max-width: var(--prose); margin-inline: auto; }
  .row > .margin { padding: 0; margin: -.4rem 0 1.2rem; }
  .row > .margin:empty { display: none; margin: 0; }
  .note { border-top: 0; border-left: 3px solid var(--line); padding: .3rem 0 .3rem .9rem; margin: 0 auto .8rem; max-width: var(--prose); background: var(--surface); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding-right: .8rem; }
  .note summary { cursor: pointer; padding: .3rem 0; }
  .note summary .note-lead { display: inline; color: var(--muted); font-size: .85rem; }
  .note[open] summary .note-lead { display: none; }
  /* Символ-треугольник ▸ почти не читался как аффорданс раскрытия — единственный способ добраться
     до половины боковой колонки на узком экране (находка критика visual1). Рисованный шеврон
     заметнее и разворачивается плавно. */
  .note summary::before {
    content: ""; display: inline-block; width: 6px; height: 6px; margin-right: .4em;
    border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .15s ease, border-color .15s ease;
  }
  .note[open] summary::before { transform: rotate(45deg); }
  .note summary:hover::before { border-color: var(--fg); }
  .kind-recap { border: 1px solid var(--line); background: var(--card); }
  .lesson-header .row > .margin { margin-top: .5rem; }
}
/* На телефоне сохраняем читаемый размер подписей; широкие графики прокручиваются
   внутри своего блока, не растягивая страницу. Статические SVG сохраняют размер viewBox. */
@media (max-width: 640px) {
  .w-stage { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--plot-line) transparent; }
  .w-stage svg { min-width: 400px; }
  .w-stage:has(> .w-threshold) { padding-left: 0; padding-right: 0; }
  .w-stage svg.w-threshold { min-width: 0; }
  .figure {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  }
  .figure::-webkit-scrollbar { height: 6px; }
  .figure::-webkit-scrollbar-track { background: transparent; }
  .figure::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--radius-pill); }
  .figure svg { width: var(--figure-width, 680px); max-width: none; min-width: var(--figure-width, 680px); height: auto; }
}
@media (max-width: 760px) {
  body { font-size: 1rem; }
  .site-header-inner { gap: .8rem; padding: 0 16px; }
  .site-nav { gap: .7rem; }
  .site-nav a { font-size: .85rem; }
  .level-switch label { padding: .25em .5em; font-size: .72rem; }
  .auth-anon { font-size: .85rem; }
  .auth-user [data-user-name] { display: none; }
  .shell, .lesson-body, .lesson-header .row { padding-left: 16px; padding-right: 16px; }
  .lesson-header { padding: 1.8rem 0 1.5rem; }
  .step-title { font-size: 1.45rem; }
  .prev-next { flex-wrap: wrap; }
  .nav-next { text-align: left; }
  .lesson-complete { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .summary { grid-template-columns: 1fr; }
  .auth-card { padding: 1.4rem; }
  .report-head { flex-direction: column; }
  .class-controls { margin-left: 0; }
  .class-settings { margin-left: 0; }
  .profile-card { grid-template-columns: 48px minmax(0, 1fr); gap: 1rem; justify-items: start; }
  .profile-card .avatar-lg { width: 48px; height: 58px; }
  .profile-card h1 { font-size: 1.5rem; }
  .w-range { min-width: 0; width: 100%; }
  .main table, .main th, .main td { font-size: .85rem; }
}
/* Кнопка-«Меню» (нав-тоггл): вставляется скриптом site/app.js (wireNav) только на страницах,
   где есть .site-nav/.site-tools — на широком экране скрыта, на ≤560px заменяет собой .site-nav
   рядом с гербом/переключателем уровня; раскрывает ту же .site-nav классом is-open (ниже). */
.nav-toggle { display: none; width: 2.2rem; height: 2.2rem; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; padding: 0; }
.nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { display: block; width: 1.1rem; height: 2px; background: var(--fg); border-radius: 1px; }
.nav-toggle-icon { position: relative; }
.nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
.nav-toggle-icon::before { top: -5px; }
.nav-toggle-icon::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { top: 0; transform: rotate(-45deg); }
@media (max-width: 760px) {
  .site-header-inner { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); gap: 12px; padding-inline: 20px; }
  .brand { grid-column: 2; grid-row: 1; justify-self: center; }
  .site-tools { grid-column: 3; grid-row: 1; justify-self: end; }
  .nav-toggle { display: inline-flex; grid-column: 1; grid-row: 1; justify-self: start; width: 44px; height: 44px; border: 0; background: none; }
  .nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { width: 24px; height: 1.5px; border-radius: 0; }
  .nav-toggle-icon::before { top: -7px; }
  .nav-toggle-icon::after { top: 7px; }
  .header-menu { display: none; position: absolute; top: 100%; left: 0; right: 0; padding: 10px 24px 20px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 40; }
  .header-menu.is-open { display: block; }
  .header-menu .site-nav { display: flex; flex-direction: column; gap: 0; }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .site-settings { margin: 16px 0 0; justify-content: space-between; }
  .site-settings .level-switch label { padding: 7px 14px; font-size: .8125rem; }
  .site-tools .auth-anon { border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 5px 14px; font-size: .8125rem; font-weight: 500; text-decoration: none; }
}

/* ---------- 23. html[data-all] и печать ---------- */
html[data-all] .step-body { display: block !important; }
html[data-all] .step-advance, html[data-all] .lesson-footer { display: none; }
html[data-all] .step[data-state="locked"] .step-toggle::after { content: none; }
html[data-all] .step[data-state="locked"] .step-status::before { content: none; }
/* .check-actions скрыта в ?all=1 (учитель/превью печати), но поле ввода оставалось активным пустым
   боксом с осиротевшими точками попыток под ним — мёртвый контрол: поле есть, отправить нечего
   (находка критика visual1). Гасим поле тем же приёмом, что уже есть в @media print (§23). */
html[data-all] .check-input input { pointer-events: none; border: 0; border-bottom: 1px solid var(--line); background: none; border-radius: 0; width: 10rem; }
html[data-all] .choice input { pointer-events: none; }
html[data-all] .check-attempts { display: none; }

.pylab-print { display: none; }

/* Печатный шаблон добавляется сборщиком из print.css и lib/print-theme.mjs. */

/* ---------- 24. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Наставник: отдельная панель, не перекрывающая чтение до открытия. */
.assistant-launcher { position: fixed; right: 24px; bottom: 20px; z-index: 40; width: 44px; height: 44px; border: 0; background: var(--bg); color: var(--muted); border-radius: 4px; padding: 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.assistant-launcher:hover { color: var(--fg); }
.assistant-launcher svg { width: 22px; height: 22px; }
.assistant-launcher.has-selection { width: auto; max-width: calc(100vw - 24px); gap: 8px; padding-inline: 12px; border: 1px solid var(--line); box-shadow: 0 2px 12px #0001; color: var(--fg); font: 500 .8125rem var(--font-body); }
.assistant-launcher.has-selection svg { flex-shrink: 0; }
.assistant-panel { width: min(480px, calc(100vw - 24px)); height: min(820px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); margin: auto 16px auto auto; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--fg); padding: 22px; overflow: auto; box-shadow: 0 8px 50px #0003; }
.assistant-panel[open] { display: flex; flex-direction: column; gap: 0; }
.assistant-panel.assistant-unavailable { height: fit-content; }
.assistant-panel:has(.assistant-log:empty) { height: fit-content; }
.assistant-log:empty { display: none; }
.assistant-unavailable .assistant-form, .assistant-unavailable .assistant-intro,
.assistant-unavailable .assistant-examples, .assistant-unavailable .assistant-task,
.assistant-unavailable .assistant-log:empty { display: none; }
.assistant-panel > * { flex-shrink: 0; }
.assistant-history { display: flex; align-items: center; gap: 8px; }
.assistant-history-panel > summary, .assistant-details > summary { color: var(--muted); font-size: .8rem; cursor: pointer; padding: 8px 0; }
.assistant-details { margin-top: .75rem; }
.assistant-details .assistant-help-link { margin: .75rem 0 0; }
.assistant-history select { min-width: 0; }
.assistant-history button { font-size: .75rem; padding: 8px 10px; white-space: nowrap; }
.assistant-panel::backdrop { background: #00000017; }
.assistant-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.assistant-header h2 { font-size: 1.35rem; margin: 0; }
.assistant-intro { font-size: .875rem; line-height: 1.5; color: var(--muted); margin: .75rem 0 1.25rem; }
.assistant-help-link { display:inline-block; margin-bottom:12px; font-size:.8125rem; }
.assistant-examples { display:flex; flex-wrap:wrap; gap:6px 14px; margin:12px 0; }
.assistant-examples button { appearance:none; border:0; background:none; color:var(--muted); font:inherit; font-size:.8125rem; text-align:left; text-decoration:underline; text-underline-offset:3px; padding:4px 0; cursor:pointer; }
.assistant-examples button:focus-visible { outline:var(--focus); outline-offset:3px; }
.help-page { max-width:820px; margin:50px auto 80px; padding:0 24px; }
.help-page h1 { font:400 clamp(36px,6vw,54px)/1.1 var(--font-display); }
.help-page h2 { font:400 32px/1.2 var(--font-display); }
.help-page p { font-size:1.1rem; line-height:1.7; }
.help-page>nav { margin:32px 0; }
.help-page>nav li { margin:8px 0; }
.help-page section { border-top:1px solid var(--line); padding:24px 0; scroll-margin-top:100px; }
.help-links { display:flex; flex-wrap:wrap; gap:12px 24px; }
.assistant-privacy { font-size: .75rem; line-height: 1.5; margin-top: 1rem; }
.assistant-privacy { color: var(--muted); margin-bottom: 0; }
.assistant-panel select { width: 100%; margin: 4px 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); color: var(--muted); font: 400 .8125rem var(--font-body); }
.assistant-log { flex: 1 1 auto; min-height: 40px; overflow-y: auto; overscroll-behavior: contain; margin: 10px 0; padding-right: 6px; }
.assistant-turn { padding: 20px 0; }
.assistant-turn-user { background: var(--surface); padding: 12px 16px; margin: 18px 0 0 24px; border-radius: 16px; }
.assistant-speaker { font-size: .8rem; font-weight: bold; margin: 0 0 6px; }
.assistant-turn-user .assistant-answer { color: var(--fg); }
.assistant-turn-user .assistant-speaker { display: none; }
.assistant-answer { overflow-wrap: anywhere; line-height: 1.6; font-size: .9375rem; }
.assistant-answer p { margin: 0 0 10px; }
.assistant-answer pre { max-width: 100%; overflow-x: auto; }
.assistant-sources { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .8rem; }
.assistant-form textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 70px; max-height: 160px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); padding: 14px; border-radius: 14px; font: 400 .9375rem/1.6 var(--font-body); }
.assistant-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; }
.assistant-status { font-size: .8125rem; margin: 0 0 8px; }
.assistant-status:empty { display: none; }
.assistant-task { font-size: .8125rem; color: var(--muted); margin: .5rem 0; }
.assistant-hint { font-size: .85rem; margin-top: 8px; }
/* «Спросить про это»: сосед формулы или опыта, виден при наведении и фокусе */
.assistant-anchor { display: block; margin: -1rem 0 1rem auto; border: 0; background: none; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
.math-display:hover + .assistant-anchor, figure.widget:hover + .assistant-anchor, .assistant-anchor:hover, .assistant-anchor:focus-visible { opacity: 1; }
@media (hover: none) { .assistant-anchor { opacity: .7; } }
.class-assistant-summary-box { margin: 12px 0; }
.class-assistant-summary ol { margin: 6px 0 0 18px; padding: 0; font-size: .9rem; }
.pylab > .assistant-hint { margin: .4rem 1rem .65rem; }
@media (pointer: coarse), (max-width: 560px) {
  .btn, .w-btn, .nav-card { min-height: 44px; }
}
.teacher-conversations summary { cursor: pointer; padding: 10px 0; }
@media(max-width: 560px) { .assistant-panel { margin: auto; padding: 16px; } .assistant-launcher { right: 12px; bottom: 12px; } }
@media print { .assistant-launcher, .assistant-panel, .assistant-hint { display:none !important; } }

/* Короткое введение: детали целей раскрываются по желанию. */
.lesson-meta-line { display: flex; gap: .6rem; align-items: center; margin: 0 0 1.25rem; color: var(--muted); font-size: .8125rem; }
.lesson-meta-line a { color: inherit; text-decoration: none; }
.lesson-meta-line a:hover { color: var(--fg); }
.lesson-goals { margin: 1.2rem 0; font: var(--reading-size)/var(--reading-leading) var(--font-display); color: var(--fg); }
.lesson-goals summary { cursor: pointer; width: fit-content; }
.lesson-goals summary::marker { font-size: .6em; color: var(--muted); }
.lesson-goals .outcomes { display: block; list-style: disc; padding-left: 1em; margin: .65em 0 0; }
.lesson-goals .outcomes li { padding-left: 0; font-size: inherit; margin-top: .45em; }
.lesson-goals .outcomes li::before { content: none; }
.lesson-goals .outcomes li::marker { font-size: .65em; }
.section-head .section-facts { margin-top: .5rem; font-size: .8125rem; font-weight: 400; }
.assistant-panel { font-family: var(--font-body); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

@media (max-width: 420px) {
  .site-header-inner { gap: .5rem; }
  .site-tools { gap: .25rem; }
  .theme-toggle { width: 32px; height: 32px; }
  .level-switch label { padding: .3em .4em; font-size: .6875rem; }
}

.teacher-guide { max-width: 760px; margin: 0 0 2rem; }
.teacher-guide > summary { cursor: pointer; font-weight: 500; }
.teacher-guide li { margin: .65rem 0; }

.teach-header > .eyebrow { display: none; }

/* Набор Algebrica: не только гарнитура, но и плотность строки (17/23),
   ровная полоса и номера в поле. Размер адаптирован к русскому учебнику.
   Учебный текст — одна гарнитура; Geist только для управления и графических подписей. */
.lesson { --reading-size: 1.3125rem; --reading-leading: 1.36; --aside-size: 1.0625rem; }
@media screen { .lesson { --prose: 760px; --margin-w: 280px; --gap: 48px; } }
.lesson-header { padding: 2.5rem 0 0; border-bottom: 0; }
.lesson-title { font-size: 2.5rem; letter-spacing: 0; }
.lesson-header .progress { height: 1px; }
.lesson-body { font-family: var(--font-display); font-size: var(--reading-size); line-height: var(--reading-leading); padding-top: 1.75rem; }
.lesson-body .main > p, .lesson-dek, .lesson-header .keyidea p {
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
}
.lesson-body .main > p { margin-bottom: 1em; }
.lesson-body .main > p .katex, .lesson-body .main > ul > li .katex,
.lesson-body .main > ol > li .katex { font-size: 1em; }
.lesson-body .main > .math-display .katex, .lesson-body .main > .equation .katex { font-size: 1.08em; }
.lesson-body .widget, .lesson-body .pylab,
.lesson-body .lv-head, .lesson-body .step-status, .lesson-body .prev-next { font-family: var(--font-label); }
.lesson-body .widget, .lesson-body .pylab { font-size: 1rem; line-height: 1.55; }
.lesson .note { font-family: var(--font-display); font-size: var(--aside-size); line-height: 1.4; }
.lesson .note .note-lead, .lesson .kind-quote .note-body,
.lesson .kind-quote .note-body p:last-child, .lesson .kind-recap li { font-family: inherit; font-size: inherit; }
.lesson .note .label { font-family: var(--font-display); font-size: 1em; font-weight: 400; }
.lesson .note table { font-size: 1em; }
.lesson .check { font-size: var(--reading-size); line-height: var(--reading-leading); }
.lesson .check-prompt, .lesson .check-hint, .lesson .check-explain { font-size: inherit; }
.lesson .check .katex { font-size: 1em; }
.lesson .check-explain .check-answer { font-family: inherit; }
.lesson .check-actions { font-family: var(--font-label); font-size: 1rem; }
.lesson .choice input { font-size: 1rem; }
.lesson .widget-caption, .lesson .pylab-goal, .lesson .figure figcaption,
.lesson .w-note { font: var(--aside-size)/1.4 var(--font-display); color: var(--fg); }
.lesson .callout, .lesson .summary-item, .lesson .criteria ul, .lesson .criteria ol { font-size: var(--reading-size); }
.lesson .sources ul { font-size: var(--aside-size); }
.lesson .main > .table-scroll > table { font-size: var(--aside-size); }
.step-title { position: relative; font-size: 1.875rem; font-weight: 400; letter-spacing: 0; margin-bottom: 1.25rem; }
.step-num { font-family: var(--font-display); font-size: .72em; font-weight: 400; }
.lesson-dek, .lesson-header .keyidea p { font-family: var(--font-display); font-size: var(--reading-size); line-height: var(--reading-leading); color: var(--fg); }
@media screen and (min-width: 1025px) {
  /* Номер остаётся участником baseline-выравнивания, а в поле его выносит
     отрицательный отступ. Абсолютное позиционирование теряло базовую линию. */
  .step-toggle { gap: 1rem; }
  .step-num { flex: 0 0 2ch; min-width: 2ch; margin-left: calc(-2ch - 1rem); text-align: right; white-space: nowrap; }
}
@media screen and (max-width: 1024px) {
  .lesson .step-title { max-width: var(--prose); margin-inline: auto; }
}
@media (max-width: 560px) {
  .lesson { --reading-size: 1.25rem; --reading-leading: 1.4; }
  .lesson-header { padding-top: 1.5rem; }
  .lesson-title { font-size: 2.125rem; }
  .lesson-body .main > p, .lesson-dek, .lesson-header .keyidea p { text-align: left; hyphens: manual; -webkit-hyphens: manual; }
  .step-title { font-size: 1.625rem; }
}

/* В интерактивах учебная речь остаётся книжной; оси и управление — Geist. */
.lesson .widget-head strong { font: 400 1.375rem/1.2 var(--font-display); }
.lesson .widget-stage p, .lesson .widget-stage .w-prose,
.lesson .widget-stage .w-readout li { font: var(--reading-size)/var(--reading-leading) var(--font-display); color: var(--fg); }
.lesson .widget-stage .w-note { font: var(--aside-size)/1.4 var(--font-display); }
.lesson .widget-stage .w-legend { font: .875rem/1.5 var(--font-label); }
.w-seg { gap: 1rem; border: 0; border-radius: 0; background: transparent; padding: 0; flex-wrap: wrap; }
.w-seg-btn, .w-seg-btn.is-active, .w-seg-btn[aria-checked="true"] { border-radius: 0; background: transparent; box-shadow: none; padding-inline: 0; }
.w-seg-btn.is-active, .w-seg-btn[aria-checked="true"] { color: var(--fg); text-decoration: underline; text-underline-offset: .3em; }
.w-btn { font-size: .875rem; }
.w-btn-primary { background: transparent; border: 0; color: var(--fg); }

/* Iris: график и смысловая боковая колонка, без декоративной карточки. */
.lesson:has([data-widget="iris-atlas"]) .lesson-header { padding-top: 1.3rem; }
.lesson:has([data-widget="iris-atlas"]) .lesson-body { padding-top: .5rem; }
.lesson:has([data-widget="iris-atlas"]) .lesson-header .keyidea { display: none; }
.intro > .row:has([data-widget="iris-atlas"]) > .main { grid-column: 1 / -1; max-width: none; width: 100%; }
.widget[data-widget="iris-atlas"] { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; margin-top: 0; }
.widget[data-widget="iris-atlas"] .widget-head { padding: 0; }
.widget[data-widget="iris-atlas"] .widget-head strong { font-size: 1.75rem; }
.widget[data-widget="iris-atlas"] .widget-stage { padding: 0; }
.widget[data-widget="iris-atlas"] .widget-caption { border: 0; padding: .8rem 0 0; max-width: 760px; }
.iris-atlas { container-type: inline-size; }
.atlas-tabs { display: flex; flex-wrap: wrap; gap: .75rem 2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.3rem; }
.atlas-tabs .w-btn { padding: .8rem 0; }
.iris-atlas .w-btn { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; min-height: 36px; border: 0; border-radius: 0; box-shadow: none; background: transparent; color: var(--fg); line-height: 1.3; }
.iris-atlas .w-btn[aria-pressed="true"] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .4em; }
.iris-atlas .w-btn:focus-visible, .iris-atlas select:focus-visible,
.iris-atlas input:focus-visible { outline: var(--focus); outline-offset: 4px; }
.atlas-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.atlas-chart-column { min-width: 0; }
.atlas-plot-controls { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.atlas-chart, .atlas-fit { display: block; width: 100%; height: auto; font-family: var(--font-label); overflow: visible; }
.atlas-point { cursor: crosshair; }
.atlas-point:hover { stroke: var(--fg); stroke-width: 1px; }
.atlas-legend { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; font: .8125rem/1.5 var(--font-label); min-height: 1.5rem; padding-top: .4rem; }
.lesson .widget-stage .atlas-chart-note { font: var(--aside-size)/1.4 var(--font-display); margin: .7rem 0 0; max-width: 42em; }
.atlas-question { font: 400 1.625rem/1.15 var(--font-display); margin: .3rem 0 .65rem; letter-spacing: 0; }
.lesson .widget-stage .atlas-copy, .lesson .widget-stage .atlas-feedback { font: var(--reading-size)/var(--reading-leading) var(--font-display); margin: 0 0 1rem; }
.lesson .widget-stage .atlas-feedback { margin: .9rem 0 0; }
.atlas-controls { display: grid; gap: .65rem; }
.atlas-select-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; font: .875rem/1.5 var(--font-label); margin: .65rem 0; }
.iris-atlas select { font: .875rem/1.4 var(--font-label); padding: .25rem 1.2rem .25rem .2rem; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--fg); max-width: 100%; }
.atlas-measurements { display: grid; grid-template-columns: 1fr auto; column-gap: .8rem; row-gap: .4rem; font: .8125rem/1.4 var(--font-label); margin: .8rem 0 0; }
.atlas-measurements dt { color: var(--muted); }
.atlas-measurements dd { margin: 0; font-variant-numeric: tabular-nums; }
.atlas-range { display: grid; grid-template-columns: 5.3rem 1fr 4ch; align-items: center; gap: .6rem; font: .8125rem/1.5 var(--font-label); margin: .8rem 0; }
.atlas-range input { width: 100%; min-width: 30px; accent-color: var(--ink-sea); }
.atlas-range output { font-variant-numeric: tabular-nums; text-align: right; }
.atlas-guesses { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .5rem 0; }
.atlas-prediction { margin-top: .8rem; }
.atlas-run { display: flex; gap: .25rem 1.2rem; flex-wrap: wrap; }
.atlas-loss-line { display: flex; flex-direction: column; gap: .3rem; margin-top: 1rem; font: .8125rem/1.4 var(--font-label); color: var(--muted); }
.atlas-loss { font: 400 1.6rem/1.15 var(--font-label); color: var(--fg); font-variant-numeric: tabular-nums; }
.atlas-dataset { margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: .65rem; }
.atlas-dataset summary { font: var(--aside-size)/1.4 var(--font-display); cursor: pointer; width: fit-content; }
.atlas-table-scroll { max-height: 330px; overflow: auto; margin-top: .8rem; }
.atlas-table-scroll table { width: 100%; font: .8125rem/1.4 var(--font-label); border-collapse: collapse; }
.atlas-table-scroll caption { text-align: left; padding-bottom: .8rem; font: var(--aside-size)/1.4 var(--font-display); }
.atlas-table-scroll th, .atlas-table-scroll td { padding: .4rem .65rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); font-weight: 400; }
.atlas-table-scroll thead { position: sticky; top: 0; background: var(--bg); }
.atlas-table-scroll tr[data-selected="true"] { background: var(--surface); }
.lesson .widget-stage .atlas-source { font: var(--aside-size)/1.4 var(--font-display); margin: .7rem 0 0; color: var(--muted); }
@container (max-width: 780px) {
  .atlas-grid { grid-template-columns: 1fr; gap: 1rem; }
  .atlas-aside { max-width: 640px; }
  .atlas-tabs { gap: .25rem 1.25rem; margin-bottom: .65rem; }
  .iris-atlas .w-btn { min-height: 44px; }
  .atlas-measurements { max-width: 420px; }
  .atlas-range { max-width: 480px; }
  .atlas-legend { gap: .25rem .8rem; }
}
@media (max-width: 560px) {
  .widget[data-widget="iris-atlas"] .widget-head strong { font-size: 1.5rem; }
  .atlas-tabs .w-btn { font-size: .875rem; }
}
@media print {
  .atlas-tabs, .atlas-controls, .atlas-plot-controls, .atlas-dataset { display: none; }
  .atlas-grid { grid-template-columns: 1fr; }
  .iris-atlas { break-inside: avoid; }
}

.w-seg-btn { font-size: .875rem; font-weight: 400; }
.w-seg-btn.is-active, .w-seg-btn[aria-checked="true"] { font-weight: 500; }
@container (max-width: 780px) {
  .iris-atlas[data-mode="learn"] .atlas-grid { display: flex; flex-direction: column; }
  .iris-atlas[data-mode="learn"] .atlas-aside { display: contents; }
  .iris-atlas[data-mode="learn"] .atlas-question { order: 0; }
  .iris-atlas[data-mode="learn"] .atlas-controls { order: 1; width: 100%; }
  .iris-atlas[data-mode="learn"] .atlas-chart-column { order: 2; width: 100%; }
  .iris-atlas[data-mode="learn"] .atlas-feedback { order: 3; }
  .iris-atlas[data-mode="learn"] .atlas-copy { order: 4; }
  .iris-atlas[data-mode="learn"] .atlas-loss-line { margin-top: .5rem; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 1rem; }
  .iris-atlas[data-mode="learn"] .atlas-run { gap: .1rem 1rem; }
  .iris-atlas[data-mode="learn"] .atlas-range { margin: .45rem 0; }
}
.atlas-learn-prompt { display: none; }
@container (max-width: 780px) {
  .atlas-learn-prompt { display: block; }
  .iris-atlas[data-mode="learn"] .atlas-aside > .atlas-copy { display: none; }
}

/* Карта задач: общая схема программы, затем выбранная ветвь. */
.intro > .row:has([data-widget="course-atlas"]) > .main { grid-column: 1 / -1; max-width: none; }
.intro > .row:has([data-widget="course-atlas"]) > .margin { display: none; }
.widget[data-widget="course-atlas"] { border: 0; background: none; overflow: visible; }
.widget[data-widget="course-atlas"] .widget-head { padding: 0 0 18px; }
.widget[data-widget="course-atlas"] .widget-stage { padding: 0; overflow: visible; }
.course-atlas { position: relative; --atlas-ink: var(--ink-sea); }
.course-atlas-root { display: flex; justify-content: center; position: relative; padding-bottom: 34px; }
.course-atlas-root span { border-bottom: 2px solid var(--atlas-ink); padding: 0 22px 9px; font: 500 29px/1.2 var(--font-display); }
.course-atlas-root::after { content: ''; position: absolute; height: 34px; bottom: 0; left: 50%; border-left: 1px solid var(--line); }
.course-atlas-branches { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px 24px; position: relative; padding-top: 20px; }
.course-atlas-branches::before { content: ''; position: absolute; top: 0; left: 0; right: calc(33.333% - 16px); border-top: 1px solid var(--line); }
.course-atlas-branches > .course-atlas-node { margin-left: 14px; }
.course-atlas-branches > .course-atlas-node::before { content: ''; position: absolute; top: -21px; bottom: -15px; left: -14px; border-left: 1px solid var(--line); }
.course-atlas-branches > .course-atlas-node::after { content: ''; position: absolute; top: 50%; width: 14px; left: -14px; border-top: 1px solid var(--line); }
.course-atlas-branches > .course-atlas-node:nth-last-child(-n+3)::before { bottom: 50%; }
.course-atlas-branches .course-atlas-node strong { min-height: 2.3em; }
.course-atlas-node { position: relative; min-width: 0; border-top: 1px solid var(--line); }
.course-atlas-node button { appearance: none; width: 100%; border: 0; border-radius: 0; background: transparent; color: var(--fg); text-align: left; cursor: pointer; padding: 12px 0 15px; display: grid; grid-template-columns: 1fr 70px; gap: 7px 5px; min-height: 160px; }
.course-atlas-node button:hover strong, .course-atlas-node button[aria-expanded="true"] strong { color: var(--atlas-ink); }
.course-atlas-node button[aria-expanded="true"] { box-shadow: inset 0 2px var(--atlas-ink); }
.course-atlas-node button:focus-visible, .course-atlas-panel button:focus-visible { outline: 2px solid var(--atlas-ink); outline-offset: 4px; }
.course-atlas-node strong { font: 500 25px/1.15 var(--font-display); align-self: center; grid-column: 1; grid-row: 1; }
.course-atlas-example { grid-column: 1/-1; font: 400 19px/1.3 var(--font-display); }
.course-atlas-status { grid-column: 1/-1; display: flex; justify-content: space-between; gap: 4px; font: 400 12px/1.35 var(--font-label); color: var(--muted); align-self: end; }
.course-atlas-glyph { grid-column: 2; grid-row: 1; width: 70px; height: 48px; overflow: visible; color: var(--atlas-ink); }
.course-atlas-glyph path, .course-atlas-glyph ellipse, .course-atlas-glyph rect { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.course-atlas-glyph circle { fill: currentColor; stroke: none; }
.course-atlas-glyph .atlas-mark-alt { fill: var(--ink-coral); }
.widget-stage .course-atlas-common { text-align: center; margin: 24px 0 10px; color: var(--muted); font: 400 14px/1.4 var(--font-label); }
.course-atlas-foundations { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.course-atlas-foundations .course-atlas-node button { min-height: 130px; grid-template-columns: 1fr 44px; }
.course-atlas-foundations .course-atlas-glyph { width: 44px; height: 38px; }
.course-atlas-foundations .course-atlas-node strong { font-size: 23px; }
.widget-stage .course-atlas-instruction { margin: 18px 0 8px; font: 400 14px/1.4 var(--font-label); color: var(--muted); }
.course-atlas-note { margin: 0; font: 400 19px/1.35 var(--font-display); }
.course-atlas-panel { border-top: 2px solid var(--atlas-ink); margin-top: 24px; padding-top: 18px; scroll-margin-top: 85px; }
.course-atlas-panel[hidden] { display: none !important; }
.course-atlas-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.course-atlas-panel h3 { margin: 0 0 12px; font: 500 30px/1.2 var(--font-display); }
.course-atlas-panel-head button { flex-shrink: 0; border: 0; background: none; color: var(--fg); padding: 4px 0; font: 400 13px/1.4 var(--font-label); cursor: pointer; }
.course-atlas-panel > p { max-width: 780px; font: 400 21px/1.4 var(--font-display); margin: 0 0 18px; }
.course-atlas-topics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 30px; padding: 0; margin: 0; list-style: none; }
.course-atlas-topics li { list-style: none; margin: 0; border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-direction: column; gap: 5px; font: 400 21px/1.2 var(--font-display); }
.course-atlas-topics a { color: var(--fg); text-decoration-color: var(--ink-sea); text-underline-offset: 4px; }
.course-atlas-topics small { color: var(--muted); font: 400 12px/1.4 var(--font-label); }
.course-atlas-print-links { display: none; }
@media (max-width: 600px) {
 .course-atlas-root span { font-size: 26px; }
 .course-atlas-branches { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 20px; }
 .course-atlas-branches::before { right: calc(50% - 10px); }
 .course-atlas-branches > .course-atlas-node:nth-child(4)::before { bottom: -15px; }
 .course-atlas-node button { grid-template-columns: 1fr; gap: 8px; min-height: 205px; }
 .course-atlas-node strong { font-size: 23px; grid-row: 2; }
 .course-atlas-glyph { grid-column: 1; grid-row: 1; width: 62px; height: 42px; }
 .course-atlas-example { font-size: 18px; }
 .course-atlas-foundations { grid-template-columns: 1fr; gap: 0; }
 .course-atlas-foundations .course-atlas-node button { min-height: auto; grid-template-columns: 1fr 50px; gap: 6px; padding: 15px 0; }
 .course-atlas-foundations .course-atlas-node strong { grid-row: 1; }
 .course-atlas-foundations .course-atlas-glyph { grid-column: 2; }
 .course-atlas-panel-head { display: block; }
 .course-atlas-panel-head button { margin-bottom: 14px; }
 .course-atlas-topics { grid-template-columns: 1fr; }
}
/* В презентации схема остаётся целиком, ветвь раскрывается поверх неё. */
.slide .course-atlas-root { padding-bottom: 19px; }
.slide .course-atlas-root::after { height: 19px; }
.slide .course-atlas-root span { font-size: 25px; padding-bottom: 6px; }
.slide .course-atlas-branches { padding-top: 14px; gap: 8px 24px; }
.slide .course-atlas-branches > .course-atlas-node::before { top: -15px; }
.slide .course-atlas-node button { min-height: 116px; padding: 8px 0; gap: 5px; }
.slide .course-atlas-node strong { font-size: 25px; }
.slide .course-atlas-example { font-size: 20px; }
.slide .course-atlas-glyph { width: 58px; height: 39px; }
.slide .course-atlas-status { font-size: 12px; }
.slide .widget-stage .course-atlas-common { margin: 12px 0 5px; font: 400 17px/1.4 var(--font-label); }
.slide .course-atlas-foundations .course-atlas-node button { min-height: 106px; }
.slide .course-atlas-foundations .course-atlas-node strong { font-size: 23px; }
.slide .widget-stage .course-atlas-instruction { margin: 7px 0 0; font: 400 17px/1.4 var(--font-label); }
.slide .course-atlas-note { display: none; }
.slide .course-atlas[data-open] .course-atlas-panels { position: absolute; inset: 0; overflow: auto; background: var(--bg); z-index: 2; border: 1px solid var(--line); padding: 0 22px 18px; }
.slide .course-atlas-panel { border: 0; margin: 0; padding-top: 14px; }
.slide .course-atlas-panel > p { font-size: 24px; }
.slide .course-atlas-panel h3 { font-size: 32px; }
.slide .course-atlas-panel-head button { font-size: 16px; }
.slide .course-atlas-topics li { font-size: 24px; }
.slide .course-atlas-topics small { font-size: 14px; }

/* Пошаговое продолжение фразы: текст и движение слова в книжной полосе. */
.widget[data-widget="word-growth"] { border: 0; border-radius: 0; background: none; overflow: visible; }
.widget[data-widget="word-growth"] .widget-head { padding: 0 0 12px; }
.widget[data-widget="word-growth"] .widget-stage { padding: 0; }
.widget[data-widget="word-growth"] .widget-caption { padding: 10px 0 0; border: 0; }
.word-growth-scene { display: grid; grid-template-columns: minmax(0, 1.8fr) 32px minmax(0, 1fr); gap: 16px; align-items: start; padding: 12px 0; min-height: 145px; }
.word-growth-label { display: block; margin-bottom: 14px; color: var(--muted); font: 400 13px/1.4 var(--font-label); }
.lesson .widget-stage .word-growth-text, .word-growth-next { margin: 0; font: 400 29px/1.4 var(--font-display); }
.lesson .widget-stage .word-growth-text, .word-growth-text { color: var(--ink-sea); }
.word-growth-added { display: inline-block; }
.word-growth-next { display: inline-block; color: var(--ink-coral); }
.word-growth-arrow { margin-top: 34px; color: var(--muted); font: 400 26px/1.4 var(--font-display); }
.word-growth-controls { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 8px 0; border: 0; background: none; }
.widget-stage .word-growth-status { margin: 8px 0 0; min-height: 2.8em; font: 400 20px/1.4 var(--font-display); }
.word-growth-states { display: none; }
@container (max-width: 440px) {
 .word-growth-scene { grid-template-columns: minmax(0, 1.5fr) 20px minmax(0, 1fr); gap: 10px; min-height: 155px; }
 .lesson .widget-stage .word-growth-text, .word-growth-next { font-size: 25px; }
 .word-growth-label { font-size: 12px; min-height: 2.8em; }
 .word-growth-arrow { margin-top: 45px; }
}
.slide .word-growth-scene { min-height: 215px; padding: 30px 0; }
.slide .widget-stage .word-growth-text, .slide .word-growth-next { font-size: 40px; }
.slide .word-growth-label { font-size: 17px; }
.slide .widget-stage .word-growth-status { font: 400 27px/1.4 var(--font-display); }
@media print {
 .word-growth-scene, .word-growth-controls, .word-growth-status { display: none !important; }
 .word-growth-states { display: block; padding-left: 1.3em; margin: 5pt 0; font: 400 14pt/1.5 var(--font-display); }
 .word-growth-states li { padding-left: .25em; margin: 3pt 0; color: var(--ink-sea); }
 .word-growth-states strong { font-weight: 500; color: var(--ink-coral); }
 .slide .word-growth-states { font-size: 34px; line-height: 1.6; }
}
.music-lab { color: var(--fg); font: 400 1.12rem/1.45 var(--font-display); }
.music-lab h3 { font-size: 1.65rem; margin: 0 0 .55rem; }
.music-lab p { margin: .65rem 0; }
.music-status, .music-hint, .music-source, .music-lab select, .music-lab input, .music-rank, .music-score, .music-evidence { font: 400 .8rem/1.5 var(--font-label); }
.music-status { color: var(--muted); padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.music-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1.6rem 2.8rem; align-items: start; }
.music-hint { color: var(--muted); }
.music-rating-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(120px, .85fr); align-items: center; gap: .6rem; min-height: 55px; border-bottom: 1px solid var(--line); }
.music-artist { font: 400 1.22rem/1.2 var(--font-display); overflow-wrap: anywhere; }
.music-lab select, .music-lab input { width: 100%; min-width: 0; min-height: 40px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 0; padding: .35rem .45rem; }
.music-search { margin-top: 1rem; }
.music-actions, .music-modes { display: flex; gap: 1rem; flex-wrap: wrap; }
.music-actions { margin-top: .55rem; }
.music-modes { border-bottom: 1px solid var(--line); }
.music-lab .w-btn { font: 400 .8rem/1.3 var(--font-label); cursor: pointer; }
.music-lab .w-btn[aria-pressed="true"] { text-decoration: underline; text-underline-offset: .45em; }
.music-recommendations { list-style: none; padding: 0; margin: 1rem 0; }
.music-recommendations li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.music-rec-heading { display: grid; grid-template-columns: 1.1rem minmax(0,1fr) auto; gap: .4rem; align-items: baseline; }
.music-rank { color: var(--muted); }
.music-score { font-variant-numeric: tabular-nums; white-space: nowrap; }
.music-bar { height: 3px; background: var(--line); margin: .6rem 0 .6rem 1.5rem; }
.music-bar span { display: block; height: 100%; background: var(--ink-sea); transition: width .15s; }
.music-evidence { margin-top: .5rem; }
.music-evidence summary { cursor: pointer; }
.music-evidence-body { overflow-x: auto; }
.music-fit { padding-block: .6rem; border-bottom: 1px solid var(--line); }
.music-vector { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 3px; }
.music-vector span { padding: .5rem 0; text-align: center; font: 400 .8rem/1.2 var(--font-label); font-variant-numeric: tabular-nums; }
.music-vector small { display: block; margin-bottom: .3rem; font-size: .65em; color: var(--muted); }
.music-training-details { font: 400 .85rem/1.4 var(--font-label); }
.music-training-details summary { cursor: pointer; }
.music-vector .music-positive { background: color-mix(in srgb, var(--ink-sea) 12%, transparent); }
.music-vector .music-negative { background: color-mix(in srgb, var(--ink-coral) 12%, transparent); }
.music-vectors .music-vector-label { margin: .8rem 0 .25rem; font: 400 .85rem/1.3 var(--font-label); }
.music-evidence-body table { font: 400 .78rem/1.5 var(--font-label); width: 100%; border-collapse: collapse; }
.music-evidence-body th, .music-evidence-body td { padding: .45rem; border-bottom: 1px solid var(--line); text-align: left; }
.music-choice { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.music-choice select { width: auto; max-width: 100%; }
.music-network { display: grid; grid-template-columns: minmax(0,1fr) 80px minmax(0,1fr); margin: 1.3rem 0; }
.music-network-sources { display: grid; gap: 1.2rem; }
.music-network-lines { width: 100%; height: 100%; min-height: 160px; }
.music-network-target { align-self: center; padding-left: .6rem; }
.music-source { grid-column: 1/-1; color: var(--muted); padding-top: .7rem; border-top: 1px solid var(--line); }
.music-source summary { cursor: pointer; }
.music-test-result { padding: 1.2rem 0; border-block: 1px solid var(--line); display: flex; align-items: center; gap: 2rem; }
.music-big-number { font: 400 2.7rem/1 var(--font-display); white-space: nowrap; }
.music-empty { padding: .4rem 0; }
.slide .music-lab { font: 400 24px/1.3 var(--font-display); }
.slide .music-lab p { margin: 8px 0; max-width: none; }
.slide .music-lab h3 { font-size: 30px; margin-bottom: 8px; }
.slide .music-lab .music-artist { font-size: 25px; }
.slide .music-lab .music-hint, .slide .music-lab .music-status { font: 400 17px/1.3 var(--font-label); }
.slide .music-lab .music-status { padding-bottom: 10px; margin: 0 0 16px; }
.slide .music-lab select, .slide .music-lab .w-btn, .slide .music-lab .music-score { font-size: 18px; }
.slide .music-lab .music-rating-row { min-height: 50px; }
.slide .music-lab .music-source { display: none; }
.slide .music-lab .music-recommendations { margin: 8px 0; }
.slide .music-lab .music-recommendations li { padding: 10px 0; }
.slide .music-rate .music-evidence { display: none; }
.slide .music-lab .music-recommendations { padding-left: 0; }
.slide .music-lab .music-recommendations li + li { margin-top: 0; }
.slide .music-lab .music-evidence { font-size: 17px; }
.slide .music-lab .music-evidence-body table { font-size: 18px; }
.slide .music-explain .music-content { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 32px; }
.slide .music-explain .music-choice, .slide .music-explain .music-content > .music-hint { grid-column: 1/-1; }
.slide .music-explain .music-network { grid-template-columns: minmax(0,1fr) 45px minmax(0,1fr); margin: 0; }
.slide .music-lab svg.music-network-lines { height: 100%; max-height: none; }
.slide .music-lab .music-big-number { font-size: 52px; }
.slide .music-vector span { font-size: 13px; padding: 12px 0; }
.slide .music-vectors .music-vector-label { font-size: 19px; }
.slide .music-fit { display: none; }
.slide .music-training-details { display: none; }
@media screen and (min-width:601px), screen and (orientation:landscape) {
  .slide .music-rating-panel { max-height: 440px; overflow-y: auto; overscroll-behavior: contain; padding-right: 10px; }
  .slide .music-rating-list { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; }
  .slide .music-search { margin: 10px 0; }
  .slide .music-search-results { max-height: 150px; overflow-y: auto; overscroll-behavior: contain; }
}
@media screen and (max-width:600px) and (orientation:portrait) {
  .slide .music-lab .music-grid, .slide .music-explain .music-content { display: block; }
  .slide .music-results { margin-top: 24px; }
  .slide .music-lab .music-artist { font-size: 23px; }
  .slide .music-lab .music-network { margin: 24px 0; }
}
@media(max-width:700px) {
  .music-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .music-rating-row { min-height: 60px; }
  .music-artist { font-size: 1.25rem; }
  .music-lab .w-btn { min-height: 44px; }
  .music-network { grid-template-columns: minmax(0,1fr) 35px minmax(0,1fr); }
  .music-test-result { gap: 1rem; flex-wrap: wrap; }
  .music-vector { grid-template-columns: repeat(6,minmax(0,1fr)); }
}
@media print {
  .music-lab { font-size: 11pt; }
  .music-lab h3 { font-size: 17pt; }
  .music-grid { grid-template-columns: 1fr 1fr; gap: 7mm; }
  .music-lab .music-hint, .music-lab .music-status, .music-lab select { font-size: 8pt; }
  .music-lab select { appearance: none; border: none; padding: 0; background: transparent; }
  .music-rating-row { min-height: 9mm; }
  .music-artist { font-size: 12pt; }
  .music-search, .music-actions, .music-modes, .music-source, .music-evidence { display: none; }
  .music-explain .music-evidence-body { display: block; }
}

/* Lesson adaptations of the foundations presentation, with readable mobile states. */
.course-scene { padding: clamp(12px, 3vw, 24px); color: var(--fg); line-height: 1.5; min-width: 0; }
.cs-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.cs-controls .w-btn, .cs-stage > .w-btn { font-size: 14px; min-height: 42px; white-space: normal; }
.cs-controls [aria-pressed="true"] { border-color: var(--ink-sea); background: var(--surface); }
.cs-stage { min-width: 0; overflow-wrap: anywhere; }
.cs-stage p { margin: 10px 0; }
.cs-stage > .w-btn { margin: 4px; }
.cs-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 15px; background: var(--card); min-width: 0; }
.cs-card small { color: var(--muted); font-size: 13px; }
.cs-card p { margin: 5px 0 0; }
.cs-flow { display: grid; gap: 12px; }
.cs-flow .cs-card:nth-child(1) { border-left: 4px solid #2563eb; }
.cs-flow .cs-card:nth-child(2) { border-left: 4px solid #7c3aed; }
.cs-flow .cs-card:nth-child(3) { border-left: 4px solid #059669; }
.cs-chip { display: inline-block; padding: 5px 8px; border: 0; border-radius: 4px; color: #172337; font: 16px/1.5 ui-monospace, monospace; }
button.cs-chip { cursor: pointer; }
.cs-chip:focus-visible { outline: 3px solid var(--ink-sea); outline-offset: 2px; }
.cs-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 15px 0; }
.cs-bar { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 15px 0; }
.cs-bar strong { font-variant-numeric: tabular-nums; }
.cs-track { grid-column: 1 / -1; height: 12px; border-radius: 5px; overflow: hidden; background: var(--line); }
.cs-track i { display: block; height: 100%; background: var(--ink-sea); transition: width .18s; }
.cs-status { color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.cs-training-row { border-top: 1px solid var(--line); padding: 12px 0; display: grid; gap: 8px; }
.cs-training-row > p { font-weight: 600; }
.cs-context-strip { display: flex; height: 25px; overflow: hidden; border-radius: 4px; margin: 15px 0; }
.cs-context-strip i { min-width: 2px; }
.cs-paper { display: block; max-height: 300px; max-width: 100%; margin: 15px auto; }
.cs-mascot { display: block; height: 140px; width: auto; max-width: 100%; object-fit: contain; margin: 0 auto 15px; }
.figure video { display: block; width: 100%; height: auto; border-radius: 8px; background: #101820; }
@media (prefers-reduced-motion: reduce) { .cs-track i { transition: none; } }
@media print { .cs-controls, .figure video { display: none; } .cs-stage { break-inside: avoid; } }
.cs-controls .w-btn { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; background: var(--card); }
.cs-controls .w-btn:disabled { opacity: .45; cursor: default; }
.cs-controls .w-btn:hover:not(:disabled) { border-color: var(--ink-sea); }
.cs-stage > .cs-card { margin: 12px 0; }
.cs-training-row .cs-card { margin: 0; }
@media (min-width: 700px) { .cs-training-row { grid-template-columns: 1.15fr 1fr 1.2fr; align-items: center; } }

.cs-live-frame { display:block; width:100%; height:780px; border:0; border-radius:8px; background:#fff; }
@media(max-width:700px){ .cs-live-frame { height:850px; } }
@media print { .cs-live-frame { display:none; } }
.cs-memory-result { font-size:1.5em; font-weight:600; }
.cs-memory-rail { height:18px; background:var(--line); border-radius:4px; overflow:hidden; }
.cs-memory-rail i { display:block; height:100%; background:var(--ink-coral); transition:width .2s; }
[data-widget="course-scenes"] .cs-memory-result { font-size:1.5rem; font-weight:600; }
.cs-memory .w-btn[aria-pressed="true"] { border-color:var(--fg); box-shadow:inset 0 -2px 0 var(--fg); }
/* Native versions of the author's Slidev scenes, in the book's reading column. */
.completion-preview { max-width:620px; margin:20px auto; overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--card); font:18px/1.5 var(--font-label,'PT Sans',sans-serif); }
.completion-query { display:flex; align-items:center; gap:14px; padding:18px 22px; background:color-mix(in srgb,var(--demo-purple,#7c3aed) 7%,var(--card)); border-bottom:1px solid var(--line); font-weight:700; }
.completion-query svg { flex:none; width:22px!important; height:22px!important; color:var(--demo-purple,#7c3aed); }
.lesson .completion-preview .completion-list { list-style:none; margin:0; padding:0; }
.completion-list li { margin:0; padding:14px 22px; border-bottom:1px solid var(--line); }
.completion-list li:last-child { border-bottom:0; }
.completion-stem { color:var(--muted); }
.completion-list strong { color:var(--demo-purple,#7c3aed); }
@media(max-width:520px) { .completion-preview { font-size:17px; } .completion-query { padding:16px; gap:11px; } .completion-list li { padding:13px 16px; } }
.native-scene { padding:clamp(14px,3vw,24px); border:1px solid var(--line); border-radius:12px; font-family:var(--font-ui,system-ui,sans-serif); font-size:16px; line-height:1.55; }
.native-scene p { font-family:inherit; font-size:inherit; margin:.65em 0; }
.native-card { min-width:0; padding:16px; border:1px solid var(--line); border-radius:9px; overflow-wrap:anywhere; }
.native-card > strong { display:block; margin-bottom:.55em; font-size:1.05em; }
.native-card + .native-card { margin-top:12px; }
.native-input { border-top:3px solid #5689d6; }
.native-model { border-top:3px solid #9c79ca; }
.native-output { border-top:3px solid #52977e; }
.native-flow { display:flex; align-items:center; gap:12px; }
.native-flow > .native-card { flex:1; margin:0; }
.native-arrow { flex:none; color:var(--muted); }
.native-columns,.native-documents { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.native-columns > .native-card,.native-documents > .native-card { margin:0; }
.native-documents { grid-template-columns:1fr; }
.native-document { display:block; max-height:210px; width:auto!important; max-width:100%; margin:12px auto; object-fit:contain; }
.native-hardware-photo { display:block; width:100%; height:155px; object-fit:contain; background:white; margin:12px 0; }
.native-reveal { margin-top:16px; padding:0; border-top:1px solid var(--line); }
.native-reveal > summary { padding:12px 0; cursor:pointer; font-weight:550; }
.native-reveal > summary:focus-visible { outline:2px solid var(--fg); outline-offset:3px; }
.native-reveal .native-reveal { margin-left:8px; }
.native-error { text-decoration:underline wavy #ba5555; }
.native-chips { display:flex; flex-wrap:wrap; gap:6px; margin:10px 0; }
.native-chips > span { padding:4px 8px; border:1px solid var(--line); border-radius:5px; background:color-mix(in srgb,#ab9bd3 12%,transparent); white-space:pre-wrap; overflow-wrap:anywhere; }
.native-chips .native-selected { border-bottom:3px solid #8060b2; }
.native-chips .native-space { background:transparent; color:var(--muted); }
.native-bar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px 14px; margin:18px 0; }
.native-rail { grid-column:1 / -1; height:8px; background:var(--line); border-radius:4px; overflow:hidden; }
.native-rail > span { display:block; height:100%; background:#7799cb; }
.cs-painting-panels { display:grid; grid-template-columns:1fr 1fr; gap:20px; text-align:center; }
.cs-painting-panel { min-width:0; }
.cs-painting-panel p { font-size:15px; margin:8px 0; }
.cs-painting-panel canvas { display:block; width:100%; max-width:280px; height:auto; margin:auto; border-radius:4px; }
.cs-painting-panel output { display:block; font-variant-numeric:tabular-nums; margin:8px 0; }
.cs-painting > label { display:block; margin:16px 0; }
.cs-painting input[type=range] { display:block; width:100%; margin:10px 0; }
@media(max-width:700px) { .native-flow { flex-direction:column; align-items:stretch; } .native-arrow { align-self:center; transform:rotate(90deg); } .native-columns { grid-template-columns:1fr; } .cs-painting-panels { gap:12px; } .cs-painting-panel p { min-height:3em; } }
@media print { .native-reveal::details-content { display:block!important; content-visibility:visible!important; } .native-reveal > summary { list-style:none; } }
.widget .cs-painting-panel p { font-family:var(--font-ui,system-ui,sans-serif); font-size:14px; line-height:1.4; overflow-wrap:anywhere; }

.lls-plots { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin:18px 0 8px; }
.lls-panel { min-width:0; }
.lls-panel[hidden] { display:none; }
.lls-panel > strong { display:block; font:600 15px system-ui,sans-serif; margin:0 0 4px; }
.lls-panel svg { display:block; width:100%; height:auto; overflow:visible; font-family:system-ui,sans-serif; }
.lls-single { grid-template-columns:minmax(0,1fr); max-width:540px; margin-inline:auto; }
.lls-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; padding:14px 0; margin:12px 0; border-block:1px solid var(--line); font-family:system-ui,sans-serif; }
.lls-stats span { display:block; font-size:13px; color:var(--muted); }
.lls-stats output { font-size:20px; font-variant-numeric:tabular-nums; }
.lls-legend { display:flex; flex-wrap:wrap; gap:8px 20px; font:13px/1.5 system-ui,sans-serif; }
.lls-data-key:before { content:'●'; color:#397ac2; margin-right:6px; }
.lls-line-key:before { content:'━'; color:#d45448; margin-right:6px; }
.lls-timeline,.lls-settings label { display:block; margin:18px 0; font:14px/1.5 system-ui,sans-serif; }
.cs-lls-native input[type=range] { display:block; width:100%; margin:10px 0; }
.lls-settings { border-top:1px solid var(--line); margin-top:20px; padding-top:12px; }
.lls-settings summary { cursor:pointer; font:14px/1.5 system-ui,sans-serif; }
.cs-lls-native .w-btn[aria-pressed=true] { border-color:var(--fg); box-shadow:inset 0 -2px 0 var(--fg); }
@media(max-width:700px) { .lls-plots { grid-template-columns:1fr; gap:22px; } .lls-stats { gap:6px; } .lls-stats output { font-size:18px; } }
@media print { .lls-timeline,.lls-settings { display:none; } }
.lls-path-key:before { content:'━'; color:#9154ae; margin-right:6px; }
.cs-lls-native[data-view=loss] .lls-data-key,.cs-lls-native[data-view=loss] .lls-line-key,.cs-lls-native[data-view=fit] .lls-path-key { display:none; }

/* Native lesson diagrams: selectable labels, vector connections, responsive composition. */
.native-neural { color:var(--fg); padding:12px 0; font-family:var(--font-display); border:0; border-radius:0; background:transparent; }
.native-neural.nd-single { max-width:600px; margin-inline:auto; }
.neural-diagram { display:block; width:100%; height:auto; overflow:visible; }
.neural-diagram text { fill:var(--fg); font-family:var(--font-display); user-select:text; }
.neural-diagram .nd-edge { fill:none; stroke:var(--fg); stroke-width:1.5; }
.neural-diagram .nd-arrowhead { fill:var(--fg); }
.neural-diagram .nd-weight { paint-order:stroke; stroke:var(--paper,var(--bg)); stroke-width:5px; stroke-linejoin:round; }
.neural-diagram .nd-axis { fill:none; stroke:var(--muted); stroke-width:1.5; }
.neural-diagram .nd-curve { fill:none; stroke:var(--ink-sea); stroke-width:4; }
.neural-diagram .nd-guide { fill:none; stroke:var(--muted); stroke-width:1; stroke-dasharray:4 5; }
.neural-diagram .nd-connection { fill:none; stroke:var(--muted); stroke-width:1; opacity:.55; }
.neural-diagram .nd-box { fill:none; stroke:none; }
.nd-pair { display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:20px; }
.nd-computation { text-align:center; font-size:18px; }
.nd-computation>div { padding:10px; }
.nd-computation strong { display:block; font-size:24px; font-weight:400; }
.nd-computation svg { max-width:175px; margin:auto; }
.nd-label { display:block; font-size:20px; color:var(--fg); line-height:1.4; }
.nd-flow-arrow { display:block; font-size:22px; color:var(--muted); line-height:1.5; }
.native-neural p { font-family:inherit; font-size:20px; line-height:1.5; margin:.5em 0; }
.nd-threshold p { text-align:center; }
.nd-input-photo { display:flex; gap:16px; align-items:center; margin-bottom:12px; }
.nd-input-photo img { width:90px; height:auto; flex-shrink:0; border-radius:8px; }
.nd-dialogue { display:grid; gap:14px; }
.nd-message { padding:14px 18px; border:1px solid var(--line); border-radius:10px; background:var(--card); }
.nd-system { border-left:3px solid var(--ink-coral); }
.nd-user { margin-left:10%; }
.nd-assistant { margin-right:10%; border-left:3px solid var(--ink-sea); }
@media(max-width:650px) { .nd-pair { grid-template-columns:1fr; } .nd-computation { display:grid; grid-template-columns:1fr; max-width:260px; width:100%; margin:auto; } .nd-threshold { padding-top:16px; } }
@media print { .native-neural { break-inside:avoid; } }
/* These diagrams have their own mobile composition; bypass legacy fixed-width figures. */
.figure .neural-diagram { width:100%; min-width:0; max-width:100%; height:auto; }
.figure .nd-computation .neural-diagram { max-width:175px; }

/* Labels share the lesson typography; math uses the existing KaTeX renderer. */
.nd-canvas { position:relative; min-width:0; container-type:inline-size; }
.nd-canvas .nd-text { position:absolute; display:block; width:max-content; max-width:100%; font-family:var(--font-display); font-size:clamp(16px,5cqw,21px); line-height:1; font-weight:400; white-space:nowrap; text-align:left; transform:translateY(-80%); }
.nd-canvas .nd-anchor-middle { transform:translate(-50%,-80%); }
.nd-canvas .nd-anchor-end { transform:translate(-100%,-80%); }
.native-neural .katex { font-size:1em; }

/* An in-text experiment: one selected input, its weight and contribution. */
.widget[data-widget="neuron-inputs"] { border:0; border-radius:0; background:transparent; overflow:visible; margin:1.4rem 0; }
.widget[data-widget="neuron-inputs"] .widget-head { display:none; }
.widget[data-widget="neuron-inputs"] .widget-stage { padding:0; }
.widget[data-widget="neuron-inputs"] .widget-caption { border:0; padding:.8rem 0 0; font-family:var(--font-display); font-size:18px; line-height:1.4; }
.neuron-inputs { font-family:var(--font-display); font-size:21px; max-width:680px; margin:auto; }
.neuron-inputs .katex { font-size:1em; }
.ni-headings { display:grid; grid-template-columns:30% 40% 30%; font-size:18px; color:var(--muted); text-align:center; }
.ni-headings span:first-child { text-align:left; padding-left:5px; }
.ni-headings span:nth-child(2) { text-align:left; padding-left:5%; }
.ni-headings span:last-child { text-align:right; padding-right:7%; }
.ni-scene { position:relative; height:260px; }
.ni-links { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.ni-link { fill:none; stroke:var(--plot-line); opacity:.5; stroke-width:1.4; vector-effect:non-scaling-stroke; transition:stroke .15s; }
.ni-link.is-selected { opacity:1; stroke:var(--accent); stroke-width:2; }
.ni-link.is-zero { stroke-dasharray:4 5; }
.neuron-inputs button { font:inherit; color:var(--muted); border:0; border-radius:0; box-shadow:none; background:transparent; cursor:pointer; padding:0; }
.neuron-inputs button:focus-visible { outline:var(--focus); outline-offset:4px; }
.neuron-inputs button[aria-pressed="true"] { color:var(--accent); }
.ni-input { position:absolute; left:0; transform:translateY(-50%); display:flex; align-items:center; gap:12px; height:48px; }
.ni-input img { width:30px; height:30px; opacity:.65; transition:opacity .15s; }
.ni-input[aria-pressed="true"] img { opacity:1; }
.ni-weight { position:absolute; left:34%; transform:translateY(-75%); min-height:44px; }
.ni-total { position:absolute; top:50%; right:0; width:22%; transform:translateY(-21px); display:flex; flex-direction:column; align-items:center; gap:4px; }
.ni-total img { width:42px; height:42px; }
.ni-total-label { font-size:17px; color:var(--muted); }
.ni-total>.math { font-size:30px; }
.ni-equation { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:12px; margin:8px 0 24px; }
.ni-equation .ni-term { min-width:28px; min-height:44px; border-bottom:1px solid transparent; }
.ni-equation .ni-term[aria-pressed="true"] { border-bottom-color:var(--accent); }
.ni-controls { display:grid; grid-template-columns:1fr 1fr; gap:30px; }
.ni-controls label { display:flex; align-items:center; gap:12px; }
.ni-controls input { min-width:0; width:100%; accent-color:var(--accent); cursor:ew-resize; height:32px; }
.ni-controls output { min-width:32px; text-align:right; font-variant-numeric:tabular-nums; }
.ni-detail { margin-top:18px; min-height:78px; }
.ni-detail>.math { color:var(--accent); }
.neuron-inputs .ni-explanation { font-family:inherit; font-size:19px; line-height:1.4; text-align:left; margin:6px 0 0; }
.neuron-inputs .ni-reset { font-size:17px; text-decoration:underline; text-underline-offset:4px; min-height:44px; }
@media(max-width:650px) { .neuron-inputs { font-size:18px; } .ni-scene { height:244px; } .ni-input { gap:5px; } .ni-input img { width:24px; height:24px; } .ni-total img { width:34px; height:34px; } .ni-total { transform:translateY(-17px); } .ni-weight { left:36%; } .ni-controls { grid-template-columns:1fr; gap:4px; } .ni-equation { gap:8px; margin-bottom:14px; } }
@media(prefers-reduced-motion:reduce) { .ni-link,.ni-input img { transition:none; } }

.widget[data-widget="prediction-loss"] { border:0; border-radius:0; background:transparent; overflow:visible; margin:1.4rem 0; }
.widget[data-widget="prediction-loss"] .widget-head { display:none; }
.widget[data-widget="prediction-loss"] .widget-stage { padding:0; }
.widget[data-widget="prediction-loss"] .widget-caption { border:0; padding:.7rem 0; font-family:var(--font-display); font-size:18px; line-height:1.4; }
.prediction-loss { max-width:680px; margin:auto; font-family:var(--font-display); font-size:21px; }
.prediction-loss .katex { font-size:1em; }
.pl-intro { color:var(--muted); font-size:19px; line-height:1.4; margin-bottom:20px; }
.pl-control { display:flex; gap:18px; align-items:center; }
.pl-control input { width:100%; min-width:0; height:32px; accent-color:var(--accent); cursor:ew-resize; }
.pl-control output { min-width:30px; text-align:right; font-variant-numeric:tabular-nums; }
.pl-plot { position:relative; height:180px; margin:14px 0 4px; }
.pl-geometry { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.pl-axis { fill:none; stroke:var(--plot-line); stroke-width:1; vector-effect:non-scaling-stroke; }
.pl-gap { fill:none; stroke:var(--accent); stroke-width:1.5; vector-effect:non-scaling-stroke; }
.pl-truth-line { fill:none; stroke:var(--fg); stroke-width:1; stroke-dasharray:3 4; vector-effect:non-scaling-stroke; }
.pl-fact-dot { position:absolute; top:94.5px; left:50%; width:7px; height:7px; transform:translateX(-50%); border-radius:50%; background:var(--fg); }
.pl-prediction-dot { position:absolute; top:91px; width:14px; height:14px; transform:translateX(-50%); border-radius:50%; background:var(--accent); border:2px solid var(--bg); }
.pl-tick,.pl-fact,.pl-forecast,.pl-gap-label { position:absolute; transform:translateX(-50%); width:max-content; font-size:18px; }
.pl-tick { top:111px; color:var(--muted); }
.pl-fact { top:9px; left:50%; }
.pl-forecast { top:145px; color:var(--accent); }
.pl-forecast.is-left { transform:none; }
.pl-forecast.is-right { transform:translateX(-100%); }
.pl-gap-label { top:40px; color:var(--accent); }
.pl-result { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:18px 0 12px; }
.pl-result>div { display:flex; flex-direction:column; gap:4px; }
.pl-result-label { font-size:18px; color:var(--muted); }
.pl-loss-value { font-size:36px; line-height:1.15; font-variant-numeric:tabular-nums; }
.prediction-loss .pl-status { font-family:inherit; font-size:19px; line-height:1.4; margin:8px 0; min-height:54px; text-align:left; }
.pl-compare { display:flex; align-items:center; gap:20px; font-size:18px; color:var(--muted); }
.pl-presets { display:flex; gap:16px; }
.pl-presets button { min-width:36px; min-height:44px; border:0; border-bottom:1px solid transparent; border-radius:0; padding:0; background:transparent; color:var(--fg); font:inherit; cursor:pointer; box-shadow:none; }
.pl-presets button[aria-pressed="true"] { color:var(--accent); border-bottom-color:var(--accent); }
.pl-presets button:focus-visible { outline:var(--focus); outline-offset:3px; }
.pl-days { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; font-size:18px; margin:0 0 24px; }
.pl-days>div,.pl-days>div>span:last-child { display:flex; flex-direction:column; }
.pl-days>div>span:first-child { color:var(--muted); margin-bottom:4px; }
.pl-days .pl-current-day { color:var(--accent); }
@media(max-width:650px) { .prediction-loss { font-size:20px; } .pl-result { align-items:flex-start; gap:12px; } .pl-result>.math { padding-top:12px; font-size:18px; } .pl-result-label { max-width:155px; line-height:1.25; } .pl-tick,.pl-fact,.pl-forecast,.pl-gap-label { font-size:17px; } .pl-compare { gap:10px; } .pl-presets { gap:8px; } }

/* Hardware chapter: original photographs, native diagrams and source data. */
.widget[data-widget="hardware-scenes"] { border:0; border-radius:0; background:transparent; overflow:visible; margin:1.8rem 0; }
.widget[data-widget="hardware-scenes"] .widget-head { padding:0 0 .8rem; }
.widget[data-widget="hardware-scenes"] .widget-stage { padding:0; }
.widget[data-widget="hardware-scenes"] .widget-caption { border:0; padding:.6rem 0; }
.widget .hardware-scene, .widget .hardware-scene :is(p,button,a,span,output,strong,summary,h3) { font-family:var(--font-display); }
.widget .hardware-scene { color:var(--fg); font-size:20px; line-height:1.35; }
.widget .hardware-scene p { margin:.3rem 0; font-size:20px; line-height:1.35; text-align:left; }
.widget .hardware-scene :is(.hw-small,.hw-note,.hw-dateline), .widget .hardware-scene details { font-size:17px; line-height:1.35; }
.widget .hardware-scene .hw-dateline { color:var(--muted); margin:0 0 1.1rem; }
.widget .hardware-scene .hw-note { margin:1rem 0 .2rem; }
.widget .hardware-scene h3 { font-size:23px; font-weight:500; margin:.7rem 0 .25rem; }
.hardware-scene a { color:inherit; text-decoration:underline; text-decoration-color:var(--line); text-underline-offset:.15em; overflow-wrap:anywhere; }
.widget .hardware-scene .hw-photo { display:block; width:100%; height:120px; min-width:0; margin:0; overflow:hidden; }
.hw-device-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:2.2rem 1.2rem; }
.hw-device { min-width:0; }
.widget .hardware-scene .hw-memory { color:var(--ink-sea); font-size:23px; }
.widget .hardware-scene .hw-speed { font-size:27px; margin:.7rem 0 .3rem; }
.hw-device details { margin:.5rem 0 0; }
.hw-device details p { font-size:17px!important; }
.hw-device summary { cursor:pointer; }
.hw-controls { display:flex; flex-wrap:wrap; gap:.5rem; margin:.6rem 0 1rem; }
.hardware-scene button { background:transparent; border:1px solid var(--line); color:var(--fg); cursor:pointer; padding:.35rem .7rem; border-radius:5px; font-size:18px; line-height:1.2; }
.hardware-scene button[aria-pressed="true"] { border-color:var(--ink-sea); color:var(--ink-sea); box-shadow:inset 0 -2px 0 var(--ink-sea); }
.hardware-scene button:focus-visible { outline:2px solid var(--ink-sea); outline-offset:3px; }
.hw-model-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1.1rem; padding:.6rem 0; }
.hw-model-grid a { display:block; min-height:2.7em; }
.hw-big { display:block; font-size:34px; color:var(--ink-sea); }
.hw-price-plot { position:relative; height:355px; margin:1.6rem 0 2.5rem; }
.hw-price-plot > svg { position:absolute; width:100%; height:100%; min-width:0; overflow:visible; }
.hw-grid-line { stroke:var(--line); stroke-width:1; vector-effect:non-scaling-stroke; fill:none; }
.hardware-scene .hw-price-point { position:absolute; padding:0; transform:translate(-50%,-50%); width:29px; height:29px; border:1px solid var(--ink-coral); border-radius:50%; background:var(--bg); color:var(--fg); font-size:17px; box-shadow:none; z-index:1; }
.hardware-scene .hw-price-point.is-computer { border-color:var(--ink-sea); }
.hardware-scene .hw-price-point[aria-pressed="true"] { background:var(--fg); color:var(--bg); border-color:var(--fg); box-shadow:none; z-index:2; }
.hw-price-tick { position:absolute; left:0; transform:translateY(-50%); font-size:14px; color:var(--muted); }
.hw-ram-tick { position:absolute; top:94%; transform:translateX(-50%); font-size:16px; color:var(--muted); }
.hw-axis-price { position:absolute; top:-1.3rem; left:0; font-size:17px; }
.hw-axis-ram { position:absolute; top:103%; right:0; font-size:17px; }
.hw-price-detail { display:grid; grid-template-columns:145px 1fr; align-items:center; gap:1.2rem; min-height:180px; margin:1rem 0; }
.hw-price-legend { display:grid; grid-template-columns:1fr 1fr; gap:.25rem .6rem; }
.hardware-scene .hw-price-legend button { text-align:left; border:0; padding:.4rem .1rem; }
.hardware-scene .hw-price-legend button[aria-pressed="true"] { box-shadow:none; text-decoration:underline; }
.hw-gpu-row { display:grid; grid-template-columns:66px minmax(0,1fr) 65px 130px; align-items:center; gap:.75rem; padding:.7rem 0; border-bottom:1px solid var(--line); }
.widget .hardware-scene .hw-gpu-row .hw-photo { height:42px; }
.hw-gpu-row > a { text-align:right; }
.hw-capacity-track { height:5px; margin:.45rem 0 0; background:var(--line); }
.hw-capacity-track i { display:block; height:100%; background:var(--ink-sea); }
.hw-hours { display:grid; grid-template-columns:auto 1fr 60px; gap:.8rem; align-items:center; margin:1rem 0; }
.hw-hours input { width:100%; min-width:0; accent-color:var(--ink-sea); }
.hw-rental-row { display:grid; grid-template-columns:95px 1fr 155px; gap:1rem; align-items:center; padding:1rem 0; border-bottom:1px solid var(--line); }
.widget .hardware-scene .hw-rental-row .hw-photo { height:70px; }
.hw-rental-result { text-align:right; }
.hw-rental-result output { font-size:27px; color:var(--ink-sea); }
.widget .hardware-scene .hw-rental-result p { text-align:right; }
.widget .hw-server > .hw-photo { height:220px; max-width:520px; margin:0 auto 1.2rem; }
.hw-server-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; }
.hw-server-stats strong { font-size:27px; font-weight:500; }
.hw-chips { display:grid; grid-template-columns:repeat(8,1fr); gap:8px; margin:1.4rem 0; }
.hw-chips > span { border:1px solid var(--ink-sea); text-align:center; padding:10px 2px; font-size:16px; color:var(--ink-sea); }
.hw-chips b { display:block; font-size:18px; font-weight:500; }
.hw-operating { display:flex; flex-wrap:wrap; gap:1rem 1.5rem; padding:1rem 0; }
.hw-operating span::before { content:'＋'; color:var(--ink-coral); margin-right:.35rem; }
.hw-placement-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1.2rem; }
.hw-api-symbol { height:120px; display:flex; align-items:center; justify-content:center; gap:.4rem; color:var(--ink-sea); font-size:21px; }
.hw-api-symbol > span { font-size:32px; }
.hw-memory-path { display:grid; grid-template-columns:repeat(3,1fr); gap:1.5rem; margin:1.5rem 0; }
.hw-memory-path strong { display:block; font-size:29px; font-weight:500; }
.hw-memory-path .hw-small { display:block; font:18px/1.3 var(--font-display); margin:.5rem 0; }
.hw-memory-path span { color:var(--ink-sea); }
.hw-budget { margin:1.7rem 0; }
.hw-budget-track { display:flex; height:25px; margin:.6rem 0; background:var(--line); }
.hw-budget-track > span:nth-child(1) { background:var(--ink-sea); }
.hw-budget-track > span:nth-child(2) { background:var(--ink-coral); }
.hw-budget-track > span:nth-child(3) { background:var(--muted); opacity:.4; }
.hw-budget-labels { display:flex; flex-wrap:wrap; gap:.4rem 1.3rem; font-size:18px; }
.hw-budget-labels span:nth-child(1) { color:var(--ink-sea); }
.hw-budget-labels span:nth-child(2) { color:var(--ink-coral); }
.hw-epoch-scroll { overflow-x:auto; padding:.8rem 0; }
.figure .hw-epoch { display:block; width:100%; min-width:660px; height:auto; }
.hw-epoch :is(text,tspan) { font-family:var(--font-display)!important; fill:var(--fg)!important; }
.hw-history-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.5rem; margin:1.5rem 0; }
.hw-history-scroll { height:380px; overflow:auto; overscroll-behavior:contain; margin:.6rem 0; }
.hw-history-scroll img { display:block; width:100%; height:auto; }
.hw-history-grid .hw-small { font:17px/1.35 var(--font-display); }
@media(max-width:600px) {
 .hw-device-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:1.6rem 1rem; }
 .widget .hardware-scene h3 { font-size:21px; }
 .widget .hardware-scene .hw-photo { height:100px; }
 .hw-model-grid { grid-template-columns:1fr; gap:1rem; }
 .hw-model-grid > div { display:grid; grid-template-columns:1fr auto; align-items:center; gap:0 .7rem; }
 .hw-model-grid a { min-height:0; }
 .hw-model-grid p { grid-column:1; }
 .hw-model-grid output { grid-column:2; grid-row:1 / 3; font-size:28px; }
 .hw-price-plot { height:310px; }
 .hw-price-detail { grid-template-columns:90px 1fr; gap:.7rem; min-height:235px; }
 .hw-price-legend { grid-template-columns:1fr; }
 .hw-price-tick { font-size:12px; }
 .hw-gpu-row { grid-template-columns:48px minmax(0,1fr) 58px; gap:.6rem; }
 .hw-gpu-row > a { grid-column:2 / 4; text-align:left; }
 .hw-rental-row { grid-template-columns:65px 1fr; gap:.6rem; }
 .hw-rental-result { grid-column:2; text-align:left; }
 .widget .hardware-scene .hw-rental-result p { text-align:left; }
 .hw-server-stats { grid-template-columns:1fr; gap:.8rem; }
 .hw-server-stats > div { display:flex; justify-content:space-between; gap:.7rem; align-items:baseline; }
 .hw-server-stats p { max-width:48%; }
 .hw-chips { grid-template-columns:repeat(4,1fr); }
 .hw-placement-grid { grid-template-columns:1fr; gap:1.5rem; }
 .hw-placement-grid > div { display:grid; grid-template-columns:105px 1fr; gap:0 1rem; }
 .hw-placement-grid :is(.hw-photo,.hw-api-symbol) { grid-row:1 / 3; width:105px; }
 .hw-api-symbol { flex-direction:column; gap:0; }
 .hw-memory-path { grid-template-columns:1fr; gap:1rem; }
 .hw-history-grid { grid-template-columns:1fr; }
 .hw-history-scroll { height:430px; }
}
.hw-epoch :is(text,tspan) { font-size:16px!important; }
.hw-epoch line { stroke:var(--line)!important; }
.hw-memory-path .hw-small { color:var(--fg); }
@media(max-width:600px) {
 .hw-price-plot { height:420px; }
 .hardware-scene .hw-price-point { width:20px; height:20px; font-size:13px; }
}
.hw-epoch :is(text,tspan) { stroke:none!important; }
.hw-epoch path { stroke:var(--fg)!important; }
.hw-epoch marker path { fill:var(--fg)!important; }
.widget[data-widget="tensorflow-playground"] { border:0; border-radius:0; background:transparent; }
.playground-print {display:none}
.widget[data-widget="tensorflow-playground"] .widget-stage { padding:0; }
.widget[data-widget="tensorflow-playground"] .widget-head { padding:0 0 .8rem; }
.widget[data-widget="tensorflow-playground"] .widget-caption { border:0; padding:.6rem 0; }
.slide .widget[data-widget="tensorflow-playground"] iframe {max-height:500px}

/* Real, on-demand browser models. Shared book type; no outer card. */
.widget[data-widget="model-showcase"]{border:0;background:transparent;box-shadow:none}
.model-lab{font-family:var(--font-display);color:var(--fg);min-width:0}
.model-lab .ml-lead{font-size:1.2em;margin:0 0 1em}
.model-lab .ml-menu{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 1.2rem;margin-bottom:1rem}
.model-lab .ml-choice{display:flex;align-items:center;gap:.65rem;text-align:left;padding:.8rem 0;border:0;border-bottom:2px solid var(--line,#ddd);border-radius:0;background:transparent;color:inherit;font-family:inherit;min-width:0;white-space:normal}
.model-lab .ml-choice[aria-pressed="true"]{border-color:var(--accent);color:var(--accent)}
.model-lab .ml-choice strong{display:block;font-weight:500;font-size:1rem;line-height:1.2}
.model-lab .ml-choice small{display:block;font: .66rem/1.5 var(--font-body);color:var(--muted,#777);margin-top:.35rem}
.model-lab .ml-glyph{font-size:1.8rem;min-width:1.7rem;text-align:center;color:var(--accent)}
.model-lab .ml-panel h3{font-family:inherit;font-size:1.6rem;font-weight:500;margin:1.4rem 0 .5rem}
.model-lab .ml-panel p{margin:.65rem 0}
.model-lab .ml-scene{display:grid;grid-template-columns:1fr 1fr;gap:1.4rem;align-items:start;margin:1.25rem 0;min-width:0}
.model-lab .ml-input,.model-lab .ml-output{min-width:0}
.model-lab .ml-picture{position:relative;line-height:0}
.model-lab img,.model-lab video{display:block;width:100%;height:auto;max-height:360px;object-fit:contain;border:0;border-radius:0}
.model-lab .ml-picture canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;pointer-events:none}
.model-lab [hidden]{display:none!important}
.model-lab .ml-placeholder{color:var(--muted,#777);font-style:italic;min-height:130px;display:flex;align-items:center;justify-content:center;text-align:center;padding:1rem}
.model-lab textarea{display:block;box-sizing:border-box;width:100%;font:inherit;font-size:1rem;line-height:1.45;min-height:140px;resize:vertical;background:transparent;color:inherit;border:1px solid var(--line,#ccc);border-radius:4px;padding:.65rem;margin-top:.4rem}
.model-lab label{display:block;font-size:.95rem}
.model-lab .ml-file{margin-top:.7rem}
.model-lab input[type=file]{display:block;width:100%;font-size:.7rem;margin:.4rem 0 1rem}
.model-lab .ml-actions,.model-lab .ml-examples{display:flex;flex-wrap:wrap;gap:.5rem;margin:.65rem 0}
.model-lab button{font-family:var(--font-body);font-size:.8rem;cursor:pointer;background:transparent;color:inherit;border:1px solid var(--line,#d7d3ce);border-radius:4px;padding:.6rem .8rem;line-height:1.3}.model-lab button:hover{border-color:var(--accent)}.model-lab button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.model-lab button.ml-choice{padding:.8rem 0;border:0;border-bottom:2px solid var(--line,#ddd);border-radius:0}.model-lab button.ml-choice[aria-pressed="true"]{border-bottom-color:var(--accent)}
.model-lab button:disabled{opacity:.45;cursor:default}
.model-lab .ml-primary{background:var(--cta);color:var(--cta-fg);border:1px solid var(--cta);padding:.65rem .9rem;border-radius:4px}
.model-lab .ml-small,.model-lab .ml-status,.model-lab .ml-details{font-size:.85rem;line-height:1.5}
.model-lab .ml-small{color:var(--muted,#777)}
.model-lab progress{width:100%;height:5px;accent-color:var(--accent)}
.model-lab .ml-answer{white-space:pre-wrap;overflow-wrap:anywhere}
.model-lab .ml-output a{font-size:.8rem}
.model-lab .ml-transparent{background:repeating-conic-gradient(#bbb3 0% 25%,transparent 0% 50%) 50%/18px 18px}
.model-lab .ml-details{margin-top:1rem}
.model-lab .ml-details pre{font-size:.7rem;white-space:pre-wrap;overflow-wrap:anywhere}
.model-lab audio{width:100%}
@media(max-width:650px){.model-lab .ml-menu{grid-template-columns:repeat(2,minmax(0,1fr));gap:0 .8rem}.model-lab .ml-scene{grid-template-columns:1fr}.model-lab .ml-choice strong{font-size:.92rem}.model-lab .ml-placeholder{min-height:60px}.model-lab .ml-glyph{display:none}}

/* Inline neural examples are part of the lesson, with no gallery navigation. */
.model-lab.ml-inline .ml-scene{margin-top:.7rem}
.model-lab .ml-model-label{font:500 .8rem/1.5 var(--font-body);color:var(--muted)}
.neural-painting{color:var(--fg);min-width:0}
.neural-painting .np-pictures{display:grid;grid-template-columns:1fr 1fr;gap:1.2rem}
.neural-painting canvas{display:block;width:100%;height:auto;aspect-ratio:1;border-radius:3px}
.neural-painting .np-label{font:500 .9rem/1.4 var(--font-display);margin:0 0 .6rem}
.neural-painting .np-controls{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin-top:1rem}
.neural-painting select{max-width:100%;padding:.5rem;font:inherit;font-size:.85rem;color:var(--fg);background:var(--bg);border:1px solid var(--line);border-radius:4px}
.neural-painting .np-counter{font: .8rem/1.5 var(--font-body);color:var(--muted);font-variant-numeric:tabular-nums}
.neural-painting .np-note,.neural-painting .np-status{font-size:.85rem;line-height:1.5}
.neural-painting .np-note{color:var(--muted)}
@media(max-width:450px){.neural-painting .np-pictures{gap:.6rem}.neural-painting .np-controls .btn{font-size:.8rem;padding:.6rem}}

.lesson[data-flow="continuous"] .step-body{display:block}
.widget[data-widget="neural-painting"]{border:0;background:transparent;box-shadow:none}

/* Activation comparison accompanies the progressively revealed Playground. */
.neuron-activation {display:grid;gap:1rem}
.neuron-activation svg {display:block;width:100%;max-width:520px;height:auto;margin:auto}
.neuron-activation input {width:100%;accent-color:var(--ink-sea)}
.neuron-activation select {padding:.4rem;background:var(--card);color:var(--fg);border:1px solid var(--line);border-radius:5px}
.slide .neuron-activation {grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px 40px;align-items:center;font-size:24px}
.slide .neuron-activation > :not(svg) {grid-column:2}
.slide .neuron-activation svg {grid-column:1;grid-row:1 / span 5;max-height:380px}
.nn-pipeline { display:flex; align-items:center; justify-content:space-between; gap:.5rem; font-size:.9rem; }
.nn-pipeline .nd-box { padding:.8rem .4rem; text-align:center; }
@media(max-width:650px) { .nn-pipeline { flex-direction:column; } .nn-pipeline .nd-arrow { transform:rotate(90deg); } }

/* Model examples: one quiet toolbar, stable video state, visible microphone input. */
.widget[data-widget="model-showcase"] > .widget-head{display:none}
.model-lab .ml-support{font: .8rem/1.5 var(--font-body);color:var(--muted);margin:0 0 .6rem}
.model-lab .ml-model-line{font:500 .78rem/1.5 var(--font-body);color:var(--muted);margin-bottom:.6rem}
.model-lab .ml-model-line select{max-width:100%;font:inherit;color:inherit;background:transparent;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:.4rem 1.5rem .4rem 0}
.model-lab .ml-media-actions{display:flex;flex-wrap:wrap;gap:.45rem;margin:.6rem 0}
.model-lab .ml-media-actions button,.model-lab .ml-examples button,.model-lab .ml-unload{border-color:transparent;padding:.4rem .5rem}
.model-lab .ml-media-actions button:hover,.model-lab .ml-examples button:hover{background:var(--wash);border-color:var(--line)}
.model-lab .ml-feedback{min-height:2rem}
.model-lab .ml-status{min-height:1.4em;margin:.2rem 0;font: .78rem/1.5 var(--font-body);color:var(--muted)}
.model-lab .ml-feedback progress{height:3px;margin:0;display:block}
.model-lab .ml-actions{min-height:2.5rem;align-items:center}
.model-lab .ml-actions .ml-primary{min-width:7rem}
.model-lab .ml-details{font: .75rem/1.5 var(--font-body);color:var(--muted)}
.model-lab .ml-details p{font:inherit}
.model-lab .ml-hint,.model-lab .ml-answer-question{font: .78rem/1.5 var(--font-body);color:var(--muted)}
.model-lab .ml-detections{white-space:pre-line;font: .9rem/1.8 var(--font-body);font-variant-numeric:tabular-nums;margin:0}
.model-lab .ml-output{min-height:6rem}
.model-lab[data-kind="track"] .ml-scene{grid-template-columns:minmax(0,3fr) minmax(8rem,1fr)}
.model-lab .ml-meter{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:.3rem .6rem;margin:1rem 0}
.model-lab .ml-record-dot{width:.55rem;height:.55rem;border-radius:50%;background:var(--accent)}
.model-lab .ml-meter-time{font: .85rem/1.5 var(--font-body);font-variant-numeric:tabular-nums}
.model-lab .ml-meter canvas{grid-column:1/-1;display:block;width:100%;height:44px}
@media(max-width:650px){.model-lab[data-kind="track"] .ml-scene{grid-template-columns:1fr}.model-lab[data-kind="track"] .ml-output{min-height:2rem}.model-lab[data-kind="track"] .ml-detections{white-space:normal}.model-lab .ml-scene{gap:.6rem}}
.model-lab[data-kind="speech"] .ml-scene{grid-template-columns:1fr;gap:.5rem}
.model-lab[data-kind="speech"] .ml-output{min-height:2rem}
.model-lab[data-kind="speech"] .ml-placeholder{min-height:0;justify-content:flex-start;padding:0;text-align:left}
.model-lab[data-kind="track"] .ml-output{height:7rem;overflow:auto}
.model-lab[data-kind="vision"] .ml-output{height:14rem;overflow:auto;overflow-anchor:none}
@media(max-width:650px){.model-lab[data-kind="track"] .ml-output{height:3rem}}

@media print {
  @page { size: A4; margin: 18mm 20mm 18mm;
    @bottom-center { content: counter(page); font: 10pt "EB Garamond"; color: #73706d; }
  }
  :root, html[data-theme="dark"] {
    --bg: #fff; --fg: #343230; --muted: #73706d; --line: #b8b3af; --surface: #fff; --card: #fff;
    --shadow: none; --band-cream: #fff; --band-mint: #fff; --band-sky: #fff; --band-butter: #fff;
    --print-font: "EB Garamond"; --print-size: 12.5pt; --print-aside: 10pt;
    --print-title: 19pt; --print-heading: 16pt; --print-leading: 1.4;
    --prose: 124mm; --margin-w: 38mm; --gap: 8mm;
  }
}
/* Книжная печать: непрерывная основная полоса и независимые заметки на полях.
   Шрифт, краски и внешние поля общие с Typst-листками (lib/print-theme.mjs). */
@media print {
  html, body { background: #fff; color: var(--fg); }
  body { display: block; min-height: 0; font: var(--print-size)/1.25 var(--print-font); }
  .lesson { --reading-size: var(--print-size); --reading-leading: 1.25; --aside-size: 9pt; }
  *, *::before, *::after { animation: none !important; transition: none !important; box-shadow: none !important; }
  .site-header, .btn, .step-advance, .lesson-footer, .theme-toggle, .level-switch, .progress,
  .lesson-complete, .prev-next, .check-actions, .teach-actions, .map-legend,
  .assistant-launcher, .assistant-panel, .assistant-hint, .lesson-meta-line, .teach-tools { display: none !important; }
  .lesson-header, .lesson-body, .lesson-header .row, .shell, .teach { padding: 0; max-width: none; }
  .lesson-title { font: 600 var(--print-title)/1.1 var(--print-font); margin: 0 0 6pt; text-wrap: pretty; }
  .lesson-header { border: 0; margin-bottom: 8pt; }
  .lesson-dek { font: italic var(--print-size)/1.25 var(--print-font); color: var(--fg); margin: 0 0 8pt; }
  .lesson-goals { font: inherit; margin: 0 0 6pt; }
  .lesson-goals summary { font: inherit; font-weight: 600; list-style: none; }
  .lesson-goals summary::-webkit-details-marker { display: none; }
  .lesson-goals::details-content { content-visibility: visible !important; block-size: auto !important; }
  .lesson-goals .outcomes { margin: 2pt 0 5pt; padding-left: 1.1em; font: inherit; }
  .lesson-header .keyidea { margin: 6pt 0 8pt; padding: 0; border: 0; background: none; font-style: italic; }
  .lesson-header .keyidea p { font: inherit; }
  p { orphans: 3; widows: 3; }
  p, ul, ol, table, blockquote, pre { margin: 0 0 5pt; }
  .lesson pre { break-inside: avoid; }
  li + li { margin-top: 2pt; }
  .lesson-body .main > p { text-align: justify; hyphens: auto; }
  h2, h3, h4, summary { break-after: avoid; }
  h3, h4 { font-weight: 600; text-wrap: pretty; }
  /* beforeprint ставит margin перед main. Float не растягивает абзац до высоты
     заметки; clear:right разводит соседние заметки, текст продолжает набираться. */
  .lesson .row { display: block; width: 100%; break-inside: auto; }
  .lesson .row > .main { width: var(--prose); max-width: none; margin: 0; }
  .lesson .main > :last-child { margin-bottom: 5pt; }
  .lesson .row > .margin { float: right; clear: right; position: static; height: auto; width: var(--margin-w); margin: 0 0 5pt var(--gap); padding: 0; }
  .lesson .row > .margin:empty { display: none; }
  .lesson .note { position: static; width: auto; margin: 0 0 7pt; padding: 0; border: 0; background: none; font: 9pt/1.22 var(--font-body); break-inside: avoid; }
  .note summary .note-lead, .note.kind-teacher { display: none; }
  .note:not(.kind-teacher) > .note-body { display: block !important; overflow: visible; margin-top: 2pt; }
  .note:not(.kind-teacher)::details-content { content-visibility: visible !important; block-size: auto !important; }
  .lesson .note .label { font: inherit; font-weight: 600; color: var(--fg); }
  .note p, .note ul, .note ol { margin-bottom: 4pt; }
  .note table { font: 8pt/1.2 var(--font-body); }
  .note th, .note td { padding: 2pt; }
  .step-body, .lv-body { display: block !important; }
  .lesson .step { padding: 8pt 0 0; border: 0; break-inside: auto; }
  .lesson .step-title { display: block; font: 600 15pt/1.15 var(--print-font); margin: 0 0 5pt; width: var(--prose); break-after: avoid; break-inside: avoid; }
  .step-toggle { display: inline; font: inherit; }
  .step-num { font: inherit; min-width: 0; color: inherit; margin-right: .25em; }
  .step[data-state="locked"] .step-toggle { color: var(--fg); }
  .step[data-state="locked"] .step-toggle::after, .step-num::before { content: none !important; }
  .step-status { display: none; }
  .lesson .row:has(> .main > .lv) > .main { width: 100%; }
  .lv { border: 0; border-radius: 0; background: none; margin: 7pt 0; break-inside: auto; }
  .lv-head { display: block; padding: 0; border: 0; width: var(--prose); break-after: avoid; }
  .lv-head .label { display: inline; font: italic 10pt var(--print-font); color: var(--fg); }
  .lv-head .label::after { content: ". "; }
  .lv-head h3 { display: inline; font: 600 13pt/1.2 var(--print-font); }
  .lv-body { padding: 4pt 0 0; border: 0; }
  html[data-print-level="base"] :is(.lv, [data-level-block]),
  html[data-print-level="pro"] :is(.lv-epic, [data-level-block="epic"]) { display: none !important; }
  html[data-print-level="base"] .row:has(> .main > .lv:only-child),
  html[data-print-level="pro"] .row:has(> .main > .lv-epic:only-child) { display: none !important; }
  .lv-body > .row:first-child { padding-top: 0; }
  .lv details { margin: 5pt 0; }
  .lv details > summary { display: block; font: italic var(--print-size)/1.25 var(--print-font); color: var(--fg); }
  .lv details > summary::before { content: none; }
  .main > details { break-inside: avoid; }
  .lv .main > details { break-inside: auto; }
  .main > details > summary { display: block; list-style: none; }
  .main > details > summary::-webkit-details-marker { display: none; }
  .row:has(> .main > details > summary:only-child),
  .main:has(> details > summary:only-child) { break-after: avoid; }
  .figure, .widget { break-inside: avoid; margin: 7pt 0; }
  .figure, .w-stage { overflow: visible; }
  .figure svg, .w-stage svg, .note svg { width: 100%; min-width: 0; max-width: 100%; }
  .figure, .widget, .pylab { background: none; border: 0; border-radius: 0; }
  .figure figcaption, .widget-caption { padding: 3pt 0; font: italic 10pt/1.2 var(--print-font); }
  .widget-head { padding: 0 0 4pt; border: 0; font: 600 11pt var(--print-font); break-after: avoid; }
  .lesson .widget-stage { display: block; min-height: 0; padding: 0; break-before: avoid; }
  .lesson .widget, .lesson .widget-caption { font-size: 10pt; line-height: 1.25; }
  .widget[data-widget="sms-features"] .w-stage > div:nth-child(2) { grid-template-columns: repeat(4, 1fr) !important; }
  .widget[data-widget="tensorflow-playground"] .widget-stage > :not(.playground-print) {display:none!important}
  .playground-print {display:block;break-inside:avoid;color:#343434}
  .playground-print-maps {display:flex;gap:5mm;align-items:center;justify-content:center}
  .playground-print-map {width:70mm;flex:0 1 70mm;min-width:0}
  .playground-print-map svg {display:block;width:100%;height:auto;max-height:70mm}
  .playground-print-choices {display:grid;grid-template-columns:repeat(2,24mm);gap:3mm}
  .playground-print-choices figure {margin:0;break-inside:avoid;text-align:center}
  .playground-print-choices img {display:block;width:24mm;height:24mm}
  .playground-print-choices figcaption {font-size:8pt;padding:1pt 0}
  .playground-print p {margin:3pt 0!important;font:10pt/1.2 var(--print-font)}
  .playground-print .school-inspector-math {font-size:9pt;margin:3pt 0}
  .playground-print .school-probabilities {font-size:9pt}
  .w-stage { padding: 0; }
  .w-stage svg { --w-fs-scale: 1.35 !important; }
  .w-controls, .w-handle { display: none !important; }
  .widget:not([data-widget-state="mounted"]) .widget-stage { display: none; }
  .widget::after { content: "Интерактивный эксперимент — в электронной версии урока."; display: block; padding: 2pt 0; font: italic 9pt/1.2 var(--print-font); color: var(--muted); }
  /* Значимые состояния опыта печатаются последовательно, а не одной высокой
     неразрывной карточкой. Каждый снимок использует тот же DOM и расчёты виджета. */
  .lesson .intro > .row:has([data-widget="iris-atlas"]) > .main { width: 100%; }
  .lesson .widget[data-widget="iris-atlas"] { break-inside: auto; width: 100%; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-print-panel { break-inside: avoid; margin: 0 0 9pt; padding-top: 6pt; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 6mm; align-items: start; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-aside { display: block; max-width: none; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-chart-column,
  .lesson .widget[data-widget="iris-atlas"] .atlas-aside { order: 0; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-aside > .atlas-copy { display: block; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-learn-prompt { display: none; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-question { font: 400 13pt/1.15 var(--print-font); margin: 0 0 4pt; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-copy,
  .lesson .widget[data-widget="iris-atlas"] .atlas-feedback { font: 400 11pt/1.25 var(--print-font); margin: 0 0 4pt; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-chart-note { font: 400 9pt/1.2 var(--print-font); margin: 4pt 0 0; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-chart { max-height: 62mm; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-fit { max-height: 28mm; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-legend { font: 8pt/1.2 var(--font-label); min-height: 0; gap: 2pt 6pt; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-loss-line { font: 9pt/1.2 var(--font-label); margin-top: 4pt; }
  .lesson .widget[data-widget="iris-atlas"] .atlas-loss { font: 400 14pt/1.2 var(--font-label); }
  .lesson .widget[data-widget="iris-atlas"] .atlas-source { font: 9pt/1.2 var(--print-font); margin: 4pt 0; }
  .lesson .row:has([data-widget="iris-neighbors"]) > .main { width: 100%; }
  .lesson .widget[data-widget="iris-neighbors"] { break-inside: auto; }
  .lesson .widget[data-widget="neighbor-confidence"] { break-inside: auto; }
  .lesson .widget[data-widget="regression-fit"] { break-inside: auto; }
  .regression-print-panel { break-inside: avoid; margin-bottom: 12pt; }
  .regression-print-panel h4 { font: 400 13pt/1.2 var(--print-font); margin: 0 0 4pt; }
  .neighbor-print-panel { break-inside: avoid; margin: 0 0 8pt; }
  .neighbor-print-stage { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 3mm 6mm; }
  .neighbor-print-title { margin: 0 0 4pt; font: 400 13pt/1.2 var(--print-font); }
  .neighbor-print-panel .w-controls { display: none !important; }
  .neighbor-print-panel .w-stage { min-width: 0; }
  .neighbor-print-panel .w-readout { display: block; margin: 0; padding: 0; border: 0; }
  .lesson .widget-stage .neighbor-print-panel .w-readout p,
  .lesson .widget-stage .neighbor-print-panel .w-readout li { font: 10pt/1.2 var(--print-font); margin-bottom: 3pt; }
  .neighbor-print-panel .w-readout ol { padding-left: 1.1em; }
  .lesson .widget-stage .neighbor-print-panel .w-legend { font: 8pt/1.2 var(--font-label); }
  .lesson .widget:has(.widget-print-panel) { break-inside: auto; }
  .widget-print-panel { break-inside: avoid; margin: 0 0 8pt; }
  .widget-print-title { margin: 0 0 5pt; font: 400 13pt/1.2 var(--print-font); }
  .widget-print-panel .w-controls { display: none !important; }
  .widget-print-panel .w-readout button { display: none !important; }
  .widget-stage > .widget-print-panel:first-child,
  .widget-stage > .atlas-print-panel:first-child,
  .widget-stage > .neighbor-print-panel:first-child { break-before: avoid; }
  .pylab { margin: 6pt 0; overflow: visible; break-inside: avoid; }
  .pylab-code, .pylab-out { display: none; }
  .pylab-print { display: block; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; font: 8pt/1.3 var(--font-mono); padding: 5pt 0; margin: 0; border: 0; border-top: .4pt solid var(--line); border-bottom: .4pt solid var(--line); border-radius: 0; background: none; orphans: 4; widows: 4; }
  .pylab-head, .pylab-goal { padding: 2pt 0; border: 0; break-inside: avoid; break-after: avoid; }
  .pylab-head { display: block; font: 600 11pt var(--print-font); }
  .pylab-goal { font: italic 10pt/1.2 var(--print-font); }
  .table-scroll { overflow: visible; break-inside: auto; margin: 6pt 0; }
  .lesson .main > .table-scroll > table { width: 100%; table-layout: auto; font: 10.5pt/1.2 var(--print-font); }
  .main th, .main td { padding: 3pt; overflow-wrap: normal; word-break: normal; }
  .main th { font-family: inherit; font-size: inherit; font-weight: 600; color: var(--fg); }
  tr { break-inside: avoid; }
  thead { break-after: avoid; }
  .lesson .check { padding: 5pt 0 5pt 8pt; margin: 5pt 0 7pt; background: none; border: 0; border-left: .5pt solid var(--line); border-radius: 0; break-inside: avoid; }
  .check .label, .check-label, .check[data-gating="0"]::before { display: none; }
  .check-q, .check-prompt, .choices legend { margin: 0 0 3pt; }
  .choices { display: contents; }
  .choices legend { display: block; float: none; width: auto; }
  .choice { padding: 0; border: 0; background: none; margin: 2pt 0; gap: 5pt; font: inherit; clear: none; }
  .choice input { width: 8pt; height: 8pt; }
  .check-input, .check-hint, .check-explain, .check-feedback { display: none; }
  .summary { display: block; overflow: visible; margin: 6pt 0; padding: 0; border: 0; background: none; break-inside: auto; }
  .summary-item { padding: 0 0 5pt; background: none; font: inherit; break-inside: avoid; }
  .summary-item .label { display: inline; color: var(--fg) !important; font: inherit; font-weight: 600; }
  .summary-item .label::after { content: " "; }
  .summary-item p { display: inline; }
  .homework, .sources, .callout { margin: 8pt 0; padding: 0; border: 0; background: none; }
  .homework h3, .sources h3 { font: 600 13pt/1.2 var(--print-font); margin: 0 0 5pt; }
  .homework > ol { list-style: decimal; padding-left: 1.2em; }
  .homework > ol > li { padding: 0 0 5pt; border: 0; break-inside: avoid; }
  .homework > ol > li::before, .homework input { display: none; }
  .homework .hw-text { font: inherit; }
  .callout .label { font: inherit; font-style: italic; color: var(--fg); }
  .callout p { font: inherit; }
  .sources ul { font: 9pt/1.25 var(--print-font); }
  .sources li { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .sources a::after { content: " (" attr(href) ")"; font-size: .9em; overflow-wrap: anywhere; }
}
@media print {
 .lesson .intro > .row:has([data-widget="course-atlas"]) > .main { width: 100%; }
 .widget[data-widget="course-atlas"] { break-inside: avoid; overflow: visible; }
 .course-atlas button { display: grid !important; color: var(--fg); }
 .course-atlas-root { padding-bottom: 12pt; }
 .course-atlas-root::after { height: 12pt; }
 .course-atlas-root span { font-size: 16pt; padding: 0 9pt 5pt; }
 .course-atlas-branches { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7pt 14pt; padding-top: 10pt; }
 .course-atlas-branches::before { left: 0; right: calc(33.333% - 9.333pt); }
 .course-atlas-branches > .course-atlas-node::before { top: -11pt; }
 .course-atlas-node button { grid-template-columns: 1fr 34pt; min-height: 80pt; padding: 6pt 0; gap: 4pt; }
 .course-atlas-node strong { font-size: 13pt; grid-row: 1; }
 .course-atlas-glyph { grid-column: 2; grid-row: 1; width: 34pt; height: 26pt; }
 .course-atlas-example { font-size: 10.5pt; }
 .course-atlas-status { font-size: 7pt; }
 .course-atlas-common { font-size: 8pt; margin: 10pt 0 5pt; }
 .course-atlas-foundations { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14pt; }
 .course-atlas-foundations .course-atlas-node button { min-height: 75pt; grid-template-columns: 1fr 25pt; }
 .course-atlas-foundations .course-atlas-node strong { font-size: 12pt; }
 .course-atlas-foundations .course-atlas-glyph { width: 25pt; height: 23pt; }
 .course-atlas-instruction, .course-atlas-panels { display: none !important; }
 .course-atlas-note { font-size: 10pt; margin-top: 8pt; }
 .course-atlas-print-links { display: block; font: 8pt/1.35 var(--font-label); margin-top: 10pt; }
 .course-atlas-print-links h4 { font: 500 11pt/1.2 var(--font-display); margin: 0 0 4pt; }
 .course-atlas-print-links a { color: var(--fg); }
 .slide .course-atlas-print-links { display: none; }
}
