/* ============================================================
   Учебник органической химии

   Страница учебника — это чтение, поэтому всё подчинено тексту:
   одна колонка шириной в 68–72 знака, серифный шрифт для абзацев,
   спокойный тёплый фон. Слева — параграфы главы, справа — разделы
   текущей страницы; на телефоне обе панели уходят, текст остаётся.

   Химия оформляется единообразно во всех главах: уравнения — блоком
   по центру со стрелкой и условиями над ней, формулы в строке — тем
   же шрифтом с индексами, врезки — пятью видами с разным цветом
   полосы. Разметку уравнений строит сборщик (tools/organic/chem.mjs).

   Префикс org- у всех классов, чтобы style.css сайта не вмешивался.
   ============================================================ */

.org-body {
    --ink: #161c28;
    --ink-2: #353f51;
    --muted: #697488;
    --faint: #98a1b1;
    --line: #e8e3da;
    --line-2: #f0ece5;
    --paper: #ffffff;
    --bg: #f7f5f0;
    --brand: #f5a623;
    --brand-d: #b86c07;
    --brand-t: #fff5e3;

    --c-def: #e0900f;
    --c-rule: #2f6fe0;
    --c-ege: #5b55d6;
    --c-trap: #d8413b;
    --c-fact: #0f9488;
    --c-lab: #0a8fcf;
    --c-key: #8a4fd8;

    --serif: 'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --r: 16px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    /* Переменные движка визуализаций (перенесён из курса 10 класса). */
    --c10-ink: var(--ink);
    --c10-ink-soft: var(--muted);
    --c10-line: var(--line);
    --c10-line-soft: var(--line-2);
    --c10-brand: var(--brand);
    --c10-brand-dark: var(--brand-d);
    --c10-brand-tint: var(--brand-t);
    --c10-ok: #10b981;
    --c10-sh-md: 0 10px 30px -18px rgba(22, 28, 40, .35);

    background: var(--bg);
    color: var(--ink);
}
body.org-body { background: var(--bg); overflow-x: hidden; overflow-x: clip; }

.org {
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 6px 24px 64px;
    box-sizing: border-box;
    font-family: var(--sans);
}
.org *, .org *::before, .org *::after { box-sizing: border-box; }

/* style.css ставит заголовкам оранжевую черту и выравнивает абзацы по
   ширине с переносами — в учебнике это мешает чтению. */
.org h1, .org h2, .org h3, .org h4 { font-family: var(--sans); color: var(--ink); }
.org h1::before, .org h1::after, .org h2::before, .org h2::after, .org h3::before, .org h3::after { content: none; display: none; }
.org p, .org li { text-align: left; }
.org a { color: inherit; }

/* ——— Полоса прочитанного ——— */
.org-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 9600; pointer-events: none; }
.org-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), #e8850a); transition: width .12s linear; }

/* ——— Шапка страницы ——— */
.org-hero { max-width: 1340px; margin: 0 auto; padding: 20px 0 30px; }
.org-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: .8rem; color: var(--muted); }
.org-crumbs a { padding: 0; color: var(--muted); text-decoration: none; }
.org-crumbs a:hover { color: var(--brand-d); }
.org-crumbs i { font-style: normal; color: var(--faint); }
.org-crumbs span { color: var(--ink-2); }
.org-hero__kicker {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    margin: 26px 0 12px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: uppercase;
}
.org-hero__kicker span {
    padding: 5px 10px; border-radius: 8px; background: var(--ink); color: #fff;
    font-size: .8rem; letter-spacing: .02em; text-transform: none; font-variant-numeric: tabular-nums;
}
.org-hero h1 {
    margin: 0; max-width: 20ch; font-size: clamp(2rem, 1.2rem + 2.6vw, 3.1rem); line-height: 1.05;
    font-weight: 850; letter-spacing: -.028em; border: 0; padding: 0;
}
.org-hero__lead {
    margin: 16px 0 0; max-width: 62ch; font-family: var(--serif); font-size: 1.18rem; line-height: 1.55; color: var(--ink-2);
}
.org-hero__meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 20px 0 0; padding: 0; list-style: none; font-size: .86rem; color: var(--muted); font-weight: 600; }
.org-hero__meta li { display: inline-flex; align-items: center; gap: 7px; }
.org-hero__meta svg, .org-pcard__m svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.org-hero__go {
    display: inline-flex; align-items: center; gap: 10px; margin-top: 26px; padding: 14px 22px; border-radius: 14px;
    background: var(--ink); color: #fff !important; text-decoration: none; font-weight: 750; font-size: .95rem;
    box-shadow: 0 14px 30px -18px rgba(22, 28, 40, .8); transition: transform .2s var(--ease), background .2s;
}
.org-hero__go:hover { transform: translateY(-1px); background: #242c3b; }
.org-hero__go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ——— Раскладка параграфа: главы · текст · разделы ——— */
.org-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 740px) 210px;
    justify-content: space-between;
    gap: 44px;
    align-items: start;
}
.org-mnav { display: none; }

.org-side, .org-toc { position: sticky; top: calc(var(--hp-bar-h, 62px) + var(--hp-bar-gap, 12px) * 2 + 12px); max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: thin; }
.org-side__book {
    display: flex; align-items: center; gap: 8px; margin-bottom: 18px; font-size: .8rem; font-weight: 700; color: var(--muted); text-decoration: none;
}
.org-side__book svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.org-side__book:hover { color: var(--brand-d); }
.org-side__ch { display: block; margin-bottom: 12px; font-size: 1rem; font-weight: 800; line-height: 1.25; text-decoration: none; color: var(--ink); }
.org-side__ch small { display: block; margin-bottom: 3px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.org-side__list { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--line); }
.org-side__list a {
    position: relative; display: grid; grid-template-columns: 30px 1fr 16px; gap: 6px; align-items: baseline;
    margin-left: -2px; padding: 8px 6px 8px 14px; border-left: 2px solid transparent;
    font-size: .88rem; line-height: 1.35; color: var(--ink-2); text-decoration: none; transition: color .15s, border-color .15s, background .15s;
}
.org-side__list a:hover { color: var(--ink); background: rgba(245, 166, 35, .06); }
.org-side__list a[aria-current="page"] { border-left-color: var(--brand); color: var(--ink); font-weight: 700; background: rgba(245, 166, 35, .08); }
.org-side__n { font-size: .78rem; font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.org-side__ok { display: none; color: #10a36f; }
.org-side__ok svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.org-side__list a.is-read .org-side__ok { display: block; }

.org-toc__h { margin-bottom: 10px; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.org-toc ol { margin: 0; padding: 0; list-style: none; }
.org-toc a {
    display: block; padding: 6px 0 6px 12px; border-left: 2px solid var(--line);
    font-size: .82rem; line-height: 1.35; color: var(--muted); text-decoration: none; transition: color .15s, border-color .15s;
}
.org-toc a:hover { color: var(--ink); }
.org-toc a.is-on { color: var(--ink); border-left-color: var(--brand); font-weight: 650; }

/* ——— Текст параграфа ——— */
.org-article {
    min-width: 0;
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.72;
    color: var(--ink);
    font-optical-sizing: auto;
}
.org-article > :first-child { margin-top: 0; }
.org-article p { margin: 0 0 1.05em; hyphens: auto; -webkit-hyphens: auto; }
.org-article strong, .org-article b { font-weight: 650; color: var(--ink); }
.org-article em { font-style: italic; }
.org-article a:not([class]) { color: var(--brand-d); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.org-article h2 {
    position: relative; margin: 2.2em 0 .7em; padding: 0; border: 0;
    font-size: 1.62rem; line-height: 1.18; font-weight: 820; letter-spacing: -.018em;
    scroll-margin-top: 100px;
}
.org-article h2 sub, .org-article h2 sup { font-size: .6em; }
.org-article h3 { margin: 1.7em 0 .5em; font-size: 1.2rem; line-height: 1.3; font-weight: 760; letter-spacing: -.01em; }
.h-anchor { position: absolute; left: -1.1em; top: 0; width: 1em; color: var(--faint); text-decoration: none; opacity: 0; font-weight: 500; transition: opacity .15s; }
.org-article h2:hover .h-anchor { opacity: 1; }
.org-article ul, .org-article ol:not([class]) { margin: 0 0 1.1em; padding-left: 1.35em; }
.org-article li { margin: .3em 0; }
.org-article ul li::marker { color: var(--brand); }
.org-article ol:not([class]) li::marker { color: var(--brand-d); font-family: var(--sans); font-weight: 700; font-size: .9em; }

/* Формула в строке: без засечек, чуть плотнее, чтобы индексы читались. */
.f { font-family: var(--sans); font-size: .94em; font-weight: 550; white-space: nowrap; letter-spacing: -.005em; }
.f sub, .rx sub, .tbl sub { font-size: .72em; line-height: 0; vertical-align: -.28em; }
.f sup, .rx sup, .tbl sup { font-size: .72em; line-height: 0; vertical-align: .55em; }
.f .b, .rx .b { padding: 0 .06em; }

/* ——— Уравнения реакций ——— */
.rx {
    margin: 1.4em 0 1.5em; padding: 18px 20px 16px; border-radius: 14px;
    background: var(--paper); border: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 10px 24px -22px rgba(22, 28, 40, .5);
    overflow-x: auto; scrollbar-width: thin;
    font-family: var(--sans);
}
.rx__eq {
    /* Уравнение не шире блока: длинное (окисление перманганатом) переносится
       между веществами, а не уезжает за край, где его никто не заметит. */
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 2px;
    min-width: 0; margin: 0 auto; padding: 4px 0;
    font-size: 1.12rem; font-weight: 560; line-height: 1.2; color: var(--ink); letter-spacing: -.005em;
}
.rx__eq + .rx__eq { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 12px; }
.rx__sp { display: inline-flex; flex-direction: column; align-items: center; white-space: nowrap; }
.rx__sp--lab { padding-top: 0; }
.rx__row { display: inline-flex; align-items: baseline; white-space: nowrap; }
.rx__lab { margin-top: 5px; font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.rx__k { margin-right: .08em; color: var(--brand-d); font-weight: 750; }
.rx__plus { margin: 0 .55em; color: var(--muted); font-weight: 400; align-self: center; }
.rx__txt { font-size: .88rem; color: var(--muted); font-weight: 600; }
.rx__arr {
    display: inline-grid; grid-template-rows: auto 12px auto; align-items: center; justify-items: center;
    min-width: 64px; margin: 0 .7em; align-self: center;
}
.rx__c { min-height: 1em; padding: 0 4px; font-size: .74rem; font-weight: 650; line-height: 1.2; color: var(--ink-2); white-space: nowrap; }
.rx__c--b { color: var(--muted); }
.rx__line { position: relative; width: 100%; height: 2px; background: var(--ink); border-radius: 2px; }
.rx__line::after {
    content: ""; position: absolute; right: -1px; top: 50%; width: 9px; height: 9px;
    border-top: 2px solid var(--ink); border-right: 2px solid var(--ink); transform: translateY(-50%) rotate(45deg); border-radius: 1px;
}
/* Обратимая реакция: две полустрелки, верхняя вправо, нижняя влево. */
.rx__line--eq { height: 8px; background: none; }
.rx__line--eq::after { content: none; }
.rx__line--eq i { position: absolute; left: 0; right: 0; height: 2px; background: var(--ink); border-radius: 2px; }
.rx__line--eq i:first-child { top: 0; }
.rx__line--eq i:last-child { bottom: 0; }
.rx__line--eq i:first-child::after, .rx__line--eq i:last-child::before {
    content: ""; position: absolute; width: 9px; height: 2px; background: var(--ink); border-radius: 2px;
}
.rx__line--eq i:first-child::after { right: 0; top: 0; transform: rotate(-35deg); transform-origin: right center; }
.rx__line--eq i:last-child::before { left: 0; top: 0; transform: rotate(-35deg); transform-origin: left center; }
.rx__note { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: .86rem; line-height: 1.5; color: var(--muted); text-align: center; font-weight: 500; }

/* ——— Врезки ——— */
.bx {
    --c: var(--c-def);
    position: relative; margin: 1.6em 0; padding: 18px 22px 18px 24px; border-radius: 14px;
    background: color-mix(in srgb, var(--c) 6%, #fff);
    border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
    font-size: 1.04rem; line-height: 1.65;
}
.bx::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.bx--rule { --c: var(--c-rule); }
.bx--ege { --c: var(--c-ege); }
.bx--trap { --c: var(--c-trap); }
.bx--fact { --c: var(--c-fact); }
.bx--lab { --c: var(--c-lab); }
.bx--key { --c: var(--c-key); }
.bx__h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; font-family: var(--sans); }
.bx__tag { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c); }
.bx__h b { font-size: 1rem; font-weight: 750; color: var(--ink); }
.bx__b > :last-child { margin-bottom: 0; }
.bx__b p { margin-bottom: .6em; }
.bx .rx { margin: .9em 0; background: #fff; }

/* ——— Таблицы ——— */
.tbl-wrap { margin: 1.4em 0 1.6em; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); scrollbar-width: thin; }
.tbl { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: .9rem; line-height: 1.45; }
.tbl caption { caption-side: top; padding: 14px 16px 4px; text-align: left; font-weight: 750; font-size: .92rem; color: var(--ink); }
.tbl th { padding: 11px 14px; text-align: left; font-size: .74rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: #faf8f4; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:hover td { background: #fcfbf8; }
.tbl td[rowspan] { vertical-align: middle; border-left: 1px solid var(--line-2); color: var(--muted); font-weight: 600; }

/* ——— Рисунки и интерактивные модели (движок viz.js) ——— */
.org-article .c10-viz { margin: 1.8em 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); box-shadow: 0 16px 36px -28px rgba(22, 28, 40, .55); overflow: hidden; font-family: var(--sans); font-size: .95rem; line-height: 1.5; }
.c10-viz__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: #fbfaf7; }
.c10-viz__badge { flex: none; padding: 4px 9px; border-radius: 7px; font-size: .64rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--ink); }
.c10-viz__title { font-size: .94rem; font-weight: 700; color: var(--ink); }
.c10-viz__stage { position: relative; min-height: 260px; display: flex; align-items: center; justify-content: center; padding: 1rem; background: radial-gradient(circle at 50% 0%, #25324a 0%, #151d2b 72%); }
.c10-viz__stage canvas, .c10-viz__stage svg { max-width: 100%; display: block; }
.c10-viz__stage--light { background: linear-gradient(180deg, #fdfcfa, #f6f4ef); }
.c10-viz__controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; padding: 12px 16px; border-top: 1px solid var(--line-2); background: #fbfaf7; }
.c10-viz__caption { padding: 12px 16px; font-size: .88rem; line-height: 1.6; color: var(--muted); border-top: 1px solid var(--line-2); background: #fff; }
.c10-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: .84rem; font-weight: 650; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.c10-btn:hover { border-color: var(--brand); color: var(--brand-d); }
.c10-btn.is-on { background: var(--brand-t); border-color: var(--brand); color: var(--brand-d); }
.c10-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.c10-seg button { padding: .45rem .85rem; border: 0; border-right: 1px solid var(--line); background: #fff; font: inherit; font-size: .82rem; font-weight: 650; color: var(--muted); cursor: pointer; }
.c10-seg button:last-child { border-right: 0; }
.c10-seg button.is-on { background: var(--ink); color: #fff; }
.c10-range { display: inline-flex; align-items: center; gap: .55rem; font-size: .82rem; color: var(--muted); font-weight: 650; }
.c10-range input[type=range] { width: 150px; accent-color: var(--brand); }
.c10-legend { display: flex; flex-wrap: wrap; gap: .5rem .95rem; font-size: .78rem; color: var(--muted); }
.c10-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.c10-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
/* Движок задаёт формулам шрифт с засечками прямо в атрибуте style —
   в учебнике все формулы набраны одним шрифтом, поэтому перебиваем. */
.org-article .c10-viz [style*="Cambria"], .org-article .c10-viz [style*="Georgia"] { font-family: var(--sans) !important; }
@keyframes c10-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ——— Главное в параграфе ——— */
.org-sum {
    margin: 2.4em 0 1.6em; padding: 22px 24px; border-radius: 16px;
    background: var(--ink); color: #e8edf5; font-family: var(--sans); font-size: .98rem; line-height: 1.6;
}
.org-sum h2, .org-article .org-sum h2 { margin: 0 0 12px; font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
.org-sum h2 .h-anchor { display: none; }
.org-sum ul { margin: 0; padding-left: 1.2em; }
.org-sum li { margin: .45em 0; }
.org-sum li::marker { color: var(--brand); }
.org-sum strong, .org-sum b { color: #fff; }

/* ——— Проверь себя ——— */
.qz {
    margin: 2.4em 0 1.8em; border: 1px solid var(--line); border-radius: 18px; background: var(--paper);
    box-shadow: 0 20px 40px -32px rgba(22, 28, 40, .6); font-family: var(--sans); font-size: 1rem; line-height: 1.55; overflow: hidden;
}
.qz__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); background: #fbfaf7; }
.qz__tag { font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-d); }
.org-article .qz__title { flex: 1 1 100%; order: 2; margin: 0; font-size: 1.22rem; }
.qz__title .h-anchor { display: none; }
.qz__score { margin-left: auto; font-size: .82rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.qz__list { margin: 0; padding: 0; list-style: none; counter-reset: q; }
.qz__q { padding: 20px 22px; border-top: 1px solid var(--line-2); counter-increment: q; }
.qz__q:first-child { border-top: 0; }
.qz__text { display: grid; grid-template-columns: 30px 1fr; gap: 8px; margin: 0 0 12px; font-weight: 600; color: var(--ink); }
.qz__text::before { content: counter(q); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--line-2); font-size: .8rem; font-weight: 800; color: var(--ink-2); }
.qz__hint { display: block; margin-top: 2px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.qz__opts { display: grid; gap: 7px; margin: 0 0 0 38px; padding: 0; list-style: none; }
.qz__opts--grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.qz__opts li { margin: 0; }
.qz__opt {
    display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 11px;
    background: #fff; text-align: left; font: inherit; font-size: .95rem; color: var(--ink); cursor: pointer; overflow-wrap: anywhere; transition: border-color .15s, background .15s;
}
.qz__opt:hover { border-color: #d6cfc2; background: #fcfbf8; }
.qz__opt i {
    flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border: 1.5px solid #cfc7b9; border-radius: 6px;
    font-style: normal; font-size: .72rem; font-weight: 800; color: var(--muted);
}
.qz__q[data-type="one"] .qz__opt i { border-radius: 50%; }
.qz__opt[aria-pressed="true"] { border-color: var(--ink); background: #f7f6f2; }
.qz__opt[aria-pressed="true"] i { background: var(--ink); border-color: var(--ink); color: #fff; }
.qz__opt.is-right { border-color: #13a06f; background: #ecfaf3; }
.qz__opt.is-right i { background: #13a06f; border-color: #13a06f; color: #fff; }
.qz__opt.is-wrong { border-color: #e0524b; background: #fdf0ef; }
.qz__opt.is-wrong i { background: #e0524b; border-color: #e0524b; color: #fff; }
.qz__opt:disabled { cursor: default; }
.qz__input { display: flex; gap: 8px; margin-left: 38px; }
.qz__input input {
    flex: 1 1 auto; min-width: 0; max-width: 260px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px;
    font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
}
.qz__input input:focus { outline: 0; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 28, 40, .08); }
.qz__input input.is-right { border-color: #13a06f; background: #ecfaf3; }
.qz__input input.is-wrong { border-color: #e0524b; background: #fdf0ef; }
.qz__act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 0 38px; }
.qz__btn {
    height: 40px; padding: 0 18px; border: 0; border-radius: 11px; background: var(--ink); color: #fff;
    font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; transition: opacity .15s, background .15s;
}
.qz__btn:hover { background: #262f40; }
.qz__btn:disabled { opacity: .35; cursor: default; }
.qz__btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.qz__btn--ghost:hover { background: #f7f5f0; color: var(--ink); }
.qz__verdict { font-size: .9rem; font-weight: 750; }
.qz__verdict.is-right { color: #0e8a5e; }
.qz__verdict.is-wrong { color: #c43d36; }
.qz__why { margin: 12px 0 0 38px; padding: 12px 14px; border-radius: 11px; background: #f7f5f0; font-size: .93rem; line-height: 1.6; color: var(--ink-2); }
.qz__why b { color: var(--ink); }
.qz__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 16px 22px; border-top: 1px solid var(--line-2); background: #fbfaf7; font-size: .9rem; color: var(--muted); }
.qz__foot b { color: var(--ink); }

/* ——— После параграфа: задания ——— */
.org-next {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px;
    margin: 2.4em 0 1.4em; padding: 22px 24px; border-radius: 18px;
    background: linear-gradient(135deg, #fff7e8, #fff 70%); border: 1px solid #f3dcb3; font-family: var(--sans);
}
.org-next__t { flex: 1 1 320px; min-width: 0; }
.org-next__t span { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-d); }
.org-next__t b { display: block; margin-top: 4px; font-size: 1.12rem; font-weight: 800; color: var(--ink); }
.org-next__t p { margin: 5px 0 0; font-size: .92rem; line-height: 1.5; color: var(--ink-2); }
.org-next__btn {
    flex: none; display: inline-flex; align-items: center; gap: 9px; padding: 13px 20px; border-radius: 13px;
    background: linear-gradient(135deg, #f7b84b, #e8850a); color: #16191f !important; text-decoration: none; font-weight: 800; font-size: .95rem;
    box-shadow: 0 12px 24px -14px rgba(232, 133, 10, .9); transition: transform .2s var(--ease), filter .2s;
}
.org-next__btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.org-next__btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }

/* ——— Соседние параграфы ——— */
.org-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1.6em 0 0; font-family: var(--sans); }
.org-pager__a {
    display: flex; align-items: center; gap: 12px; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
    background: var(--paper); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .2s var(--ease), box-shadow .2s;
}
.org-pager__a:hover { border-color: #d8d0c2; transform: translateY(-1px); box-shadow: 0 12px 26px -22px rgba(22, 28, 40, .6); }
.org-pager__a span { min-width: 0; font-size: .95rem; font-weight: 700; line-height: 1.3; }
.org-pager__a small { display: block; margin-bottom: 3px; font-size: .74rem; font-weight: 700; color: var(--faint); }
.org-pager__a svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.org-pager__a--next { justify-content: flex-end; text-align: right; grid-column: 2; }

/* ——— Страница главы ——— */
.org-chapter { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 760px); justify-content: space-between; gap: 48px; align-items: start; }
.org-pcards { position: sticky; top: calc(var(--hp-bar-h, 62px) + var(--hp-bar-gap, 12px) * 2 + 12px); display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.org-pcard {
    position: relative; display: grid; gap: 4px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
    text-decoration: none; color: var(--ink); transition: border-color .15s, transform .2s var(--ease), box-shadow .2s;
}
.org-pcard:hover { border-color: #d8d0c2; transform: translateY(-1px); box-shadow: 0 14px 30px -24px rgba(22, 28, 40, .6); }
.org-pcard__n { font-size: .74rem; font-weight: 800; color: var(--brand-d); font-variant-numeric: tabular-nums; }
.org-pcard__t { font-size: 1.05rem; font-weight: 800; line-height: 1.25; }
.org-pcard__d { font-size: .86rem; line-height: 1.45; color: var(--muted); }
.org-pcard__m { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .78rem; font-weight: 650; color: var(--faint); }
.org-pcard__ok { display: none; margin-left: auto; align-items: center; gap: 4px; font-style: normal; color: #10a36f; }
.org-pcard__ok svg { stroke-width: 3; }
.org-pcard.is-read .org-pcard__ok { display: inline-flex; }
.org-article--wide { max-width: 760px; }

/* ——— Оглавление учебника ——— */
.org-book { display: grid; gap: 36px; max-width: 1100px; }
.org-part__h { margin: 0 0 14px; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); border: 0; padding: 0; }
.org-chlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.org-ch {
    position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 2px 12px; height: 100%; padding: 18px 20px 20px;
    border: 1px solid var(--line); border-radius: 16px; background: var(--paper); text-decoration: none; color: var(--ink); overflow: hidden;
    transition: border-color .15s, transform .2s var(--ease), box-shadow .2s;
}
a.org-ch:hover { border-color: #d8d0c2; transform: translateY(-2px); box-shadow: 0 18px 34px -26px rgba(22, 28, 40, .6); }
.org-ch__n { grid-row: span 2; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--ink); color: #fff; font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.org-ch__t { align-self: center; font-size: 1.04rem; font-weight: 800; line-height: 1.25; }
.org-ch__d { font-size: .82rem; line-height: 1.45; color: var(--muted); }
.org-ch__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line-2); }
.org-ch__bar i { display: block; height: 100%; width: 0; background: #13a06f; }
.org-ch--soon { background: transparent; border-style: dashed; color: var(--faint); }
.org-ch--soon .org-ch__n { background: var(--line); color: var(--muted); }
.org-ch--soon .org-ch__t { color: var(--muted); }

/* ——— Адаптив ——— */
@media (max-width: 1240px) {
    .org-layout { grid-template-columns: 230px minmax(0, 740px); justify-content: start; }
    .org-toc { display: none; }
}
@media (max-width: 960px) {
    .org { padding: 0 16px 56px; }
    .org-layout { display: block; }
    .org-layout > .org-side { display: none; }
    .org-mnav {
        display: block; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden;
    }
    .org-mnav summary {
        display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; list-style: none;
        font-size: .9rem; font-weight: 700; color: var(--ink);
    }
    .org-mnav summary::-webkit-details-marker { display: none; }
    .org-mnav summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
    .org-mnav[open] summary::after { transform: rotate(-135deg); }
    .org-mnav summary svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
    .org-mnav .org-side { position: static; max-height: none; padding: 4px 16px 16px; border-top: 1px solid var(--line-2); }
    .org-mnav .org-side__book { display: none; }
    .org-chapter { display: block; }
    .org-pcards { position: static; margin-bottom: 36px; }
}
@media (max-width: 640px) {
    .org-hero { padding: 12px 0 22px; }
    .org-hero__kicker { margin-top: 18px; }
    .org-hero__lead { font-size: 1.06rem; }
    .org-article { font-size: 1.06rem; line-height: 1.68; }
    .org-article h2 { font-size: 1.36rem; }
    .h-anchor { display: none; }
    .rx { margin-left: -4px; margin-right: -4px; padding: 14px 12px 12px; }
    /* На телефоне уравнение переносится, а не уезжает за край: вещества
       и стрелка — неразрывные блоки, строка ломается между ними. */
    .rx__eq { font-size: 1rem; }
    .rx__arr { min-width: 54px; margin: 0 .45em; }
    .bx { padding: 16px 16px 16px 18px; font-size: 1rem; }
    .qz__head, .qz__q, .qz__foot { padding-left: 16px; padding-right: 16px; }
    .qz__opts, .qz__input, .qz__act, .qz__why { margin-left: 0; }
    .org-pager { grid-template-columns: 1fr; }
    .org-pager__a--next { grid-column: auto; }
    .org-next { padding: 18px; }
    .org-next__btn { width: 100%; justify-content: center; }
    .org-chlist { grid-template-columns: 1fr; }
}
/* ——— Учебник в PDF (оглавление /organic/) ——— */
.org-pdf {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; max-width: 740px; margin-top: 22px;
    padding: 14px 16px; border-radius: 16px; background: #FDF2F8; border: 1px solid #FBCFE8;
}
.org-pdf__cover { width: 44px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #fff; transform: rotate(-5deg); box-shadow: 0 8px 16px -9px rgba(157, 23, 77, .6); }
.org-pdf__cover svg { width: 30px; height: 30px; }
.org-pdf__txt { flex: 1 1 200px; min-width: 0; font-family: var(--sans); }
.org-pdf__txt b { display: block; font-size: 1rem; font-weight: 800; color: var(--ink); }
.org-pdf__txt small { display: block; margin-top: 2px; font-size: .8rem; font-weight: 600; color: #7A6371; }
.org-pdf__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.org .org-pdf__btn {
    display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 11px; text-decoration: none;
    font-family: var(--sans); font-size: .86rem; font-weight: 800; line-height: 1;
    background: #fff; color: #9D174D; box-shadow: inset 0 0 0 1px #F9A8D4; transition: background .15s, filter .15s;
}
.org .org-pdf__btn:hover { background: #FCE7F3; }
.org .org-pdf__btn--read { background: #DB2777; color: #fff; box-shadow: none; }
.org .org-pdf__btn--read:hover { background: #BE185D; }
@media (max-width: 560px) {
    .org-pdf__acts { width: 100%; }
    .org .org-pdf__btn { flex: 1; justify-content: center; }
}

.qz__key, .c10-steps__print { display: none; }

/* ——— Печать и PDF-книга (tools/build_textbook_pdf.js) ———
   Кнопки сборщик прячет все (button { display: none }), поэтому
   варианты ответов возвращаем селектором посильнее: вопрос без
   вариантов на бумаге не решить. */
@media print {
    .org-side, .org-toc, .org-mnav, .org-pager, .org-next, .org-progress, .org-crumbs,
    .qz__act, .qz__why, .qz__foot, .qz__input, [data-quiz-score] { display: none !important; }
    .pdf-off, .org-hero__go, .org-pcards, .org-pdf { display: none !important; }
    .org-chapter { display: block; }
    .org-layout { display: block; }
    .org-article { font-size: 11pt; max-width: none; }
    .org-hero { padding-top: 0; }
    .org-article .qz__opt { display: flex !important; cursor: default; }
    .org-article .qz__q[data-type="num"] .qz__text::after { content: "Ответ: ____________"; display: block; margin-top: 8px; font-weight: 500; color: #6A7A90; }
    .org-article .qz__key { display: block; margin: 0; padding: 12px 18px; border-top: 1px dashed #D6CFC2; font-size: .86rem; color: #44536B; }
    .qz__q, .bx, .rx, .org-sum { break-inside: avoid; }
    .c10-steps__track, .c10-steps__pane { display: none !important; }
    .c10-steps__print { display: block; padding: 1rem 1.3rem 1.2rem; }
    .c10-steps__item { margin: 0 0 1rem; font-size: .92rem; line-height: 1.6; break-inside: avoid; }
    .c10-steps__item > b { display: block; margin-bottom: .3rem; }
    .c10-steps__f { margin: .4rem 0 .6rem; padding: .7rem; text-align: center; font-family: 'Cambria Math', Georgia, serif; font-size: 1.1rem; background: #fff; border: 1px solid #E4E1DA; border-radius: 10px; }
}
.org-article .org-center { text-align: center; font-family: var(--sans); font-size: 1.1rem; margin: 1.2em 0; }
