/* ============================================================
   «Сам себе отдел» — стили читалки и печати
   Бумага, чернила, бирюзовый акцент интерфейса; маскот Бит оранжево-терракотовый.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f5efe2;
  --bg2: #ece3cf;
  --paper: #fffdf7;
  --ink: #1f2a33;
  --ink2: #56626c;
  --line: #d9cfb8;
  --line2: #e8dfcb;
  --acc: #12705f;
  --acc2: #0c4f44;
  --mint: #5fd0bd;
  --mint2: #bfeae1;
  --mint3: #e3f6f1;
  --bit: #e17c4b;
  --coral: #c8402f;
  --coral-l: #f0b4aa;
  --coral2: #fbe3de;
  --sun: #e0aa2c;
  --sun-l: #ecd48a;
  --sun2: #fbf0cd;
  --night: #18232c;
  --night-ink: #eef7f4;
  --code: #fffefa;
  --fig: #fffaf0;
  --shadow: 0 1px 0 rgba(31, 42, 51, .05), 0 14px 32px -16px rgba(31, 42, 51, .28);
  --f-head: 'Unbounded', 'Onest', 'Segoe UI', system-ui, sans-serif;
  --f-ui: 'Onest', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --f-body: 'Literata', Georgia, 'Times New Roman', serif;
  --f-mono: 'JetBrains Mono', Consolas, 'SF Mono', Menlo, monospace;
  --fs: 17px;
  --tap: 44px;
  
}

:root {
  --i-ink:#1f2a33;--i-ink2:#5d6872;--i-p:#fffdf7;--i-p2:#efe6d3;--i-gy:#c4ccd0;--i-ln:#c9c1b1;--i-bg:#f6f0e4;--i-ml:#c3eee5;--i-r:#e2614f;--i-r2:#b8473a;--i-y:#f2c14e;--i-y2:#d6a136;--i-g:#5bb57d;--i-b:#7f9fda;--i-b2:#5b7cc0;--i-pk:#f3b8b1;--i-kc:#1f8f7f;--i-glass:#d7f1ec;--i-fog:#d9d4c8;--i-bb:#e17c4b;--i-bb2:#cb6639;--i-bbd:#a94d28;--i-onr:#ffffff;--i-rt:#c4402f;--i-gt:#2f8a57;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12181e;
  --bg2: #1a232b;
  --paper: #1b252d;
  --ink: #e9e3d4;
  --ink2: #a4aeb4;
  --line: #34424d;
  --line2: #2a3640;
  --acc: #62d6c2;
  --acc2: #9be8d9;
  --mint2: #265049;
  --mint3: #1a3a37;
  --bit: #ee8b5b;
  --coral: #ee7a69;
  --coral-l: #6b3a33;
  --coral2: #35221f;
  --sun: #e9b949;
  --sun-l: #5e5224;
  --sun2: #302c1a;
  --night: #0c1217;
  --code: #151d24;
  --fig: #1b252d;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 32px -16px rgba(0, 0, 0, .6);
  --i-ink:#e8e1d2;--i-ink2:#a9b2b7;--i-p:#25303a;--i-p2:#2e3a44;--i-gy:#5a6871;--i-ln:#52606a;--i-bg:#151b21;--i-ml:#2a5a53;--i-r:#e8705e;--i-r2:#b9523f;--i-y:#e9b949;--i-y2:#b98a2a;--i-g:#5cc488;--i-b:#86a3de;--i-b2:#6a88c8;--i-pk:#d99a95;--i-kc:#62d6c2;--i-glass:#2c4a48;--i-fog:#39434b;--i-bb:#ee8b5b;--i-bb2:#d9733f;--i-bbd:#b9552c;--i-onr:#1f2a33;--i-rt:#ee7a69;--i-gt:#5cc488;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12181e;
    --bg2: #1a232b;
    --paper: #1b252d;
    --ink: #e9e3d4;
    --ink2: #a4aeb4;
    --line: #34424d;
    --line2: #2a3640;
    --acc: #62d6c2;
    --acc2: #9be8d9;
    --mint2: #265049;
    --mint3: #1a3a37;
    --bit: #ee8b5b;
    --coral: #ee7a69;
    --coral-l: #6b3a33;
    --coral2: #35221f;
    --sun: #e9b949;
    --sun-l: #5e5224;
    --sun2: #302c1a;
    --night: #0c1217;
    --code: #151d24;
    --fig: #1b252d;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 32px -16px rgba(0, 0, 0, .6);
    --i-ink:#e8e1d2;--i-ink2:#a9b2b7;--i-p:#25303a;--i-p2:#2e3a44;--i-gy:#5a6871;--i-ln:#52606a;--i-bg:#151b21;--i-ml:#2a5a53;--i-r:#e8705e;--i-r2:#b9523f;--i-y:#e9b949;--i-y2:#b98a2a;--i-g:#5cc488;--i-b:#86a3de;--i-b2:#6a88c8;--i-pk:#d99a95;--i-kc:#62d6c2;--i-glass:#2c4a48;--i-fog:#39434b;--i-bb:#ee8b5b;--i-bb2:#d9733f;--i-bbd:#b9552c;--i-onr:#1f2a33;--i-rt:#ee7a69;--i-gt:#5cc488;
  }
}

:root[data-fs="s"] { --fs: 15.5px; }
:root[data-fs="l"] { --fs: 19.5px; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: auto; }
html.no-scroll { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.7 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--acc); text-underline-offset: .18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--acc2); }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; border-radius: 6px; }
[id] { scroll-margin-top: 76px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--night); color: #fff; padding: 10px 14px; border-radius: 10px; }
.skip:focus { top: 8px; }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: 16px; }

/* ---------- каркас ---------- */
.shell { display: block; }
.stage { min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px;
  height: 56px; padding: 0 6px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.icon-btn {
  flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 14px; color: var(--ink);
}
.icon-btn:hover { background: var(--bg2); }
.icon-btn svg { width: 24px; height: 24px; }
.crumb {
  flex: 1; min-width: 0; padding: 0 6px; color: var(--ink); text-decoration: none;
  font: 700 .86rem/1.2 var(--f-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none; }
.progress i { display: block; height: 100%; width: 100%; background: var(--mint); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- шторка с оглавлением ---------- */
.drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(88vw, 360px);
  display: flex; flex-direction: column;
  background: var(--paper); border-right: 1.5px solid var(--line);
  transform: translateX(-104%); visibility: hidden;
  transition: transform .26s ease, visibility 0s linear .26s;
  box-shadow: none;
}
.drawer.open { transform: none; visibility: visible; transition: transform .26s ease; box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(12, 20, 26, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.dr-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.dr-title { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.02rem/1.2 var(--f-head); }
.dr-mark {
  width: 22px; height: 28px; border-radius: 11px; background: var(--bit); border: 2px solid var(--ink); position: relative; flex: none;
}
.dr-mark::after { content: ''; position: absolute; left: 3px; right: 3px; top: 7px; height: 8px; border-radius: 4px; background: var(--night); }
.dr-close { flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center; border: 0; background: transparent; border-radius: 14px; }
.dr-close svg { width: 22px; height: 22px; }
.dr-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line2); font: 600 .78rem var(--f-ui); color: var(--ink2); }
.fs { display: flex; gap: 6px; }
.fs button { width: var(--tap); height: 38px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); font: 700 14px var(--f-ui); }
.fs button:nth-child(1) { font-size: 12px; }
.fs button:nth-child(3) { font-size: 18px; }
.fs button[aria-pressed="true"] { border-color: var(--acc); background: var(--mint3); color: var(--acc2); }
.dr-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1; padding: 6px 0 40px; -webkit-overflow-scrolling: touch; }
.dr-parts, .dr-chs, .dr-sub { list-style: none; margin: 0; padding: 0; }
.dr-part { padding: 10px 8px 4px; }
.dr-part-t { margin: 0; padding: 6px 12px; font: 800 .7rem/1.2 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.dr-home { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; margin: 0 4px 0 0; border-radius: 999px; background: var(--bg2); color: var(--ink); text-decoration: none; font: 700 .82rem var(--f-ui); }
.dr-ch > a {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 6px 12px; border-radius: 14px;
  color: var(--ink); text-decoration: none; font: 600 .92rem/1.3 var(--f-ui);
}
.dr-ch > a b { flex: none; min-width: 2.1em; font: 700 .78rem var(--f-head); color: var(--acc); }
.dr-ch > a:hover { background: var(--bg2); }
.dr-ch.cur > a { background: var(--mint3); box-shadow: inset 3px 0 0 var(--mint); }
.dr-sub { display: none; margin: 2px 0 8px 46px; border-left: 2px solid var(--line); }
.dr-ch.cur .dr-sub { display: block; }
.dr-sub a { display: block; padding: 8px 12px; min-height: 40px; color: var(--ink2); text-decoration: none; font: 500 .84rem/1.35 var(--f-ui); }
.dr-sub a:hover { color: var(--acc); }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 320px minmax(0, 1fr); }
  .drawer {
    position: sticky; top: 0; height: 100vh; width: auto; transform: none; visibility: visible; z-index: 20;
    box-shadow: none; transition: none; background: var(--paper);
  }
  .drawer.open { box-shadow: none; }
  .scrim, #menuBtn, .dr-close { display: none; }
  .crumb { padding-left: 14px; }
  html.no-scroll { overflow: auto; }
}

/* ---------- виды (экран) ---------- */
@media screen {
  .js .view { display: none; }
  .js .view.is-active { display: block; }
}
.view { min-width: 0; }

/* ---------- обложка ---------- */
.cover { position: relative; overflow: hidden; padding: 28px 0 40px; background: var(--bg); }
.cover::before, .cover::after { content: ''; position: absolute; border-radius: 999px; background: var(--mint3); z-index: 0; }
.cover::before { width: 360px; height: 560px; right: -150px; top: -160px; transform: rotate(24deg); }
.cover::after { width: 240px; height: 380px; left: -150px; bottom: -150px; transform: rotate(24deg); background: var(--bg2); }
.cover-in { position: relative; z-index: 1; display: grid; gap: 18px; }
.cover-art { order: -1; width: min(72vw, 300px); margin: 0 auto; }
.cover-art svg { display: block; width: 100%; height: auto; overflow: visible; }
.kicker { margin: 0 0 14px; display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--night); color: var(--night-ink); font: 700 .72rem/1 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; }
.cover-t { margin: 0; font: 700 clamp(2.35rem, 11.5vw, 4.9rem)/1.02 var(--f-head); letter-spacing: -.02em; color: var(--ink); overflow-wrap: normal; hyphens: manual; }
.cover-st { margin: 14px 0 0; font: 700 clamp(1.15rem, 4.8vw, 1.75rem)/1.25 var(--f-ui); color: var(--acc); }
.cover-p { margin: 14px 0 0; max-width: 34rem; font-size: 1.02rem; line-height: 1.6; color: var(--ink2); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 24px; border-radius: 999px;
  font: 700 1rem var(--f-ui); text-decoration: none; border: 2px solid var(--ink);
}
.btn-main { background: var(--mint); color: #12202a; box-shadow: 0 4px 0 var(--ink); }
.btn-main:hover { color: #12202a; transform: translateY(1px); box-shadow: 0 3px 0 var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--bg2); color: var(--ink); }
.facts { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.facts li { display: flex; align-items: baseline; gap: 8px; font: 500 .88rem var(--f-ui); color: var(--ink2); }
.facts b { font: 700 1.5rem var(--f-head); color: var(--ink); }
.cover-note { margin: 22px 0 0; max-width: 34rem; font: 400 .8rem/1.55 var(--f-ui); color: var(--ink2); }

@media (min-width: 820px) {
  .cover { padding: 56px 0 72px; }
  .cover-in { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; gap: 40px; }
  .cover-art { order: 2; width: 100%; max-width: 460px; margin: 0; }
}

/* ---------- оглавление на главной ---------- */
.toc-home { padding: 36px 0 24px; }
.sec-t { margin: 0 0 18px; font: 700 clamp(1.5rem, 5vw, 2.1rem)/1.15 var(--f-head); letter-spacing: -.01em; }
.toc-grid { display: grid; gap: 16px; }
.tp { background: var(--paper); border: 1.5px solid var(--line); border-radius: 24px; padding: 16px 12px 10px; }
.tp-h { display: flex; gap: 14px; align-items: center; padding: 0 6px 10px; }
.tp-no {
  flex: none; width: 52px; height: 66px; border-radius: 26px; background: var(--mint); border: 2px solid var(--ink);
  display: grid; place-items: center; font: 700 1.3rem var(--f-head); color: #12202a; position: relative;
}
.tp-no::before { content: ''; position: absolute; top: -9px; left: 50%; width: 2px; height: 8px; background: var(--ink); transform: translateX(-50%); }
.tp-no.dot { background: var(--bit); }
.tp-no.dot::after { content: ''; width: 16px; height: 10px; border-radius: 5px; background: var(--night); }
.eyebrow { margin: 0; font: 700 .7rem/1.2 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--acc); }
.tp-name { margin: 2px 0 0; font: 700 1.2rem/1.2 var(--f-ui); }
.tp-sub { margin: 3px 0 0; font: 400 .82rem/1.4 var(--f-ui); color: var(--ink2); }
.tp-list { list-style: none; margin: 0; padding: 0; }
.tp-list a {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px; border-top: 1px solid var(--line2);
  color: var(--ink); text-decoration: none; font: 600 .95rem/1.3 var(--f-ui);
}
.tp-list li:first-child a { border-top: 0; }
.tp-list a:hover { background: var(--mint3); border-radius: 12px; }
.tp-list .n { flex: none; min-width: 2em; font: 700 .85rem var(--f-head); color: var(--acc); }
.tp-list .t { flex: 1; min-width: 0; }
.tp-list .m { flex: none; font: 500 .74rem var(--f-ui); color: var(--ink2); white-space: nowrap; }
@media (min-width: 760px) { .toc-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

.poses { padding: 28px 0 56px; }
.poses-p { margin: -6px 0 22px; max-width: 38rem; color: var(--ink2); }
.pose-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pose { margin: 0; background: var(--fig); border: 1.5px solid var(--line); border-radius: 22px; padding: 8px 8px 12px; text-align: center; }
.pose svg { display: block; width: 100%; height: auto; }
.pose figcaption { font: 600 .82rem/1.3 var(--f-ui); color: var(--ink2); padding: 0 4px; }
@media (min-width: 680px) { .pose-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }

/* ---------- глава ---------- */
.chapter { max-width: 46rem; margin: 0 auto; padding: 0 16px 56px; }
.part-open {
  display: flex; align-items: center; gap: 14px; margin: 22px 0 0; padding: 10px 14px 10px 6px;
  background: var(--night); color: var(--night-ink); border-radius: 22px;
}
.po-art { flex: none; width: 112px; }
.po-art svg { display: block; width: 100%; height: auto; }
.po-txt { display: flex; flex-direction: column; min-width: 0; }
.po-label { font: 700 .68rem/1.2 var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--mint); }
.po-name { margin-top: 3px; font: 700 1.1rem/1.2 var(--f-head); }
.po-sub { margin-top: 4px; font: 400 .8rem/1.4 var(--f-ui); opacity: .82; }
.ch-head { display: flex; gap: 16px; align-items: flex-start; padding: 26px 0 8px; }
.ch-num {
  flex: none; width: 60px; height: 78px; margin-top: 12px; border-radius: 30px; background: var(--mint);
  border: 2.5px solid var(--ink); display: grid; place-items: center; position: relative;
}
.ch-num::before { content: ''; position: absolute; top: -13px; left: 50%; width: 2.5px; height: 10px; background: var(--ink); transform: translateX(-50%); }
.ch-num::after { content: ''; position: absolute; top: -20px; left: 50%; width: 11px; height: 11px; border-radius: 50%; background: #f1fffa; border: 2.5px solid var(--ink); transform: translateX(-50%); }
.ch-num span { font: 700 1.25rem/1 var(--f-head); color: #12202a; margin-top: 8px; }
.ch-tx { min-width: 0; }
.ch-tx h1 { margin: 6px 0 0; font: 700 clamp(1.5rem, 6.4vw, 2.5rem)/1.12 var(--f-head); letter-spacing: -.015em; hyphens: auto; -webkit-hyphens: auto; }
.ch-meta { display: inline-block; margin-top: 12px; padding: 4px 10px; border-radius: 999px; background: var(--bg2); font: 600 .74rem var(--f-ui); color: var(--ink2); }
.appendix .ch-num { background: var(--sun); }

.prose { font-size: 1rem; }
.prose > p, .prose p { margin: 0 0 1em; hyphens: auto; -webkit-hyphens: auto; }
.prose .lead { font-size: 1.14rem; line-height: 1.65; margin: 18px 0 1.2em; color: var(--ink); }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose code {
  font: 500 .86em var(--f-mono); padding: .08em .38em; border-radius: 6px; background: var(--bg2); color: var(--ink);
  overflow-wrap: anywhere; word-break: normal;
}
.sec h2, .blk-h h2, .letter-sec h2:not(.letter), .prose > h2 {
  margin: 0; font: 700 clamp(1.3rem, 5.2vw, 1.75rem)/1.2 var(--f-ui); letter-spacing: -.01em;
}
.sec { margin: 2.4em 0 0; }
.sec > h2 { display: flex; gap: 12px; align-items: flex-start; margin-bottom: .7em; }
.sec > h2 .ht { min-width: 0; flex: 1; }
.sec > h2::before {
  content: ''; flex: none; width: 30px; height: 17px; margin-top: .42em; border-radius: 9px;
  /* визор Бита: глаза тёплые, как у самого Бита (#fff1dc), а не бирюзовые */
  background:
    radial-gradient(circle at 10px 50%, #fff1dc 0 2.6px, transparent 3.2px),
    radial-gradient(circle at 20px 50%, #fff1dc 0 2.6px, transparent 3.2px),
    var(--night);
  box-shadow: 0 0 0 1.5px var(--line);
}
.prose h3 { margin: 1.8em 0 .5em; font: 700 1.14rem/1.3 var(--f-ui); color: var(--ink); }
.prose h4 { margin: 1.4em 0 .4em; font: 700 1rem/1.3 var(--f-ui); }
.fname { display: inline-block; margin-left: 10px; padding: 2px 9px; border-radius: 999px; background: var(--bg2); font: 500 .72rem/1.6 var(--f-mono); color: var(--ink2); vertical-align: middle; }
.sep { border: 0; border-top: 1.5px dashed var(--line); margin: 2em 0; }

.prose ul, .prose ol { margin: 0 0 1.1em; padding: 0; list-style: none; }
.prose li { position: relative; margin: 0 0 .5em; padding-left: 1.5em; }
.prose li p { margin: 0 0 .5em; }
.prose ul > li::before {
  content: ''; position: absolute; left: .15em; top: .7em; width: .5em; height: .5em; border-radius: .22em; background: var(--mint); border: 1.5px solid var(--ink);
  transform: translateY(-50%);
}
.prose ol { counter-reset: n; }
.prose ol > li { counter-increment: n; padding-left: 2.1em; }
.prose ol > li::before {
  content: counter(n); position: absolute; left: 0; top: .12em; width: 1.5em; height: 1.5em; border-radius: 50%;
  background: var(--mint3); border: 1.5px solid var(--acc); color: var(--acc2); font: 700 .72em/1.45em var(--f-ui); text-align: center;
}
.prose li > ul, .prose li > ol { margin: .5em 0 .2em; }
.prose a.gl { color: inherit; text-decoration: underline dotted var(--acc); text-decoration-thickness: 2px; text-underline-offset: .22em; }
.prose a.gl:hover { color: var(--acc); }
.prose a.xref { font-weight: 600; }
.prose a.ext { overflow-wrap: anywhere; word-break: break-word; }

/* выноски */
.co { margin: 1.5em 0; padding: 14px 16px 6px; border-radius: 20px; border: 1.5px solid var(--co-line); background: var(--co-bg); }
.co-tip { --co-bg: var(--mint3); --co-line: var(--mint2); --co-ink: var(--acc2); }
.co-warn { --co-bg: var(--coral2); --co-line: var(--coral-l); --co-ink: var(--coral); }
.co-ex { --co-bg: var(--sun2); --co-line: var(--sun-l); --co-ink: #7b5a0d; }
:root[data-theme="dark"] .co-ex { --co-ink: #f0cd73; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .co-ex { --co-ink: #f0cd73; } }
.co-lab { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; font: 800 .72rem/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--co-ink); }
.co-lab svg { width: 22px; height: 22px; flex: none; }
.co-body > :last-child { margin-bottom: .8em; }
.co-body p { font-size: .97rem; line-height: 1.65; }
.bq { margin: 1.4em 0; padding: 12px 16px 4px; border-left: 4px solid var(--mint); background: var(--paper); border-radius: 4px 18px 18px 4px; border-top: 1px solid var(--line2); border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); }
.bq p { font-size: .97rem; }

/* словарик главы */
.blk { margin: 2.2em 0 0; }
.blk-h { display: flex; align-items: center; gap: 12px; margin: 0 0 .9em; }
.blk-h .ico { flex: none; width: 34px; height: 34px; }
.blk-h .ico svg { width: 100%; height: 100%; display: block; }
.blk-h h2 { flex: 1; min-width: 0; }
.gloss { padding: 16px 14px 14px; border-radius: 26px; background: var(--mint3); border: 1.5px dashed var(--acc); }
.gloss .blk-h { margin-bottom: .6em; }
.gloss-t { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--acc); background: transparent; color: var(--acc2); font: 700 .76rem var(--f-ui); }
.g-list { margin: 0; display: grid; gap: 8px; }
.g-item { background: var(--paper); border: 1px solid var(--line2); border-radius: 16px; padding: 10px 14px 11px; }
.g-item { scroll-margin-top: 84px; }
.g-item dt { margin: 0; font: 700 .98rem/1.3 var(--f-ui); color: var(--acc2); }
.g-item dt .gl-star { margin-left: .06em; color: var(--acc); font-weight: 700; text-decoration: none; }
.g-item dt a.gl-star { position: relative; display: inline; text-decoration: none; }
.g-item dt a.gl-star::after { content: ''; position: absolute; inset: -12px -10px; }
.g-item dd { margin: 4px 0 0; font-size: .9rem; line-height: 1.58; }
.g-item dd .gl-s { color: var(--acc); font-weight: 700; margin-right: .12em; }
.etym { color: var(--ink2); font-style: italic; }
/* первое упоминание термина в тексте: надстрочная звёздочка-ссылка на карточку словарика */
sup.gl-ref { line-height: 0; font-size: .78em; margin-left: .04em; vertical-align: super; font-family: var(--f-ui); font-weight: 700; }
sup.gl-ref a { position: relative; display: inline; color: var(--acc); text-decoration: none; }
sup.gl-ref a::after { content: ''; position: absolute; inset: -14px -10px; }
sup.gl-ref a:hover, sup.gl-ref a:focus-visible { color: var(--acc2); text-decoration: underline; }
.gloss.collapsed .g-wrap { display: none; }
@media (min-width: 900px) { .g-list { grid-template-columns: 1fr 1fr; } }

/* сделайте сейчас */
.blk-do { padding: 16px 14px 8px; border-radius: 26px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--mint); }
.blk-do ol.steps > li { margin: 0 0 .8em; padding: 12px 14px 12px 56px; border-radius: 16px; background: var(--bg); border: 1.5px solid var(--line); }
.blk-do ol.steps > li::before { left: 12px; top: 11px; width: 32px; height: 32px; font: 700 .95rem/29px var(--f-ui); background: var(--mint); border: 2px solid var(--ink); color: #12202a; }
.blk-do > p:first-of-type { display: inline-block; margin: 0 0 1em; padding: 4px 12px; border-radius: 999px; background: var(--sun2); border: 1.5px solid var(--sun-l); font: 600 .8rem/1.5 var(--f-ui); }

/* шаблон */
.blk-tpl .code { margin: 1em 0; }
.code { border-radius: 18px; border: 1.5px solid var(--line); background: var(--code); overflow: hidden; margin: 1.2em 0; }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 16px; background: var(--bg2); border-bottom: 1.5px solid var(--line); }
.code-lab { font: 800 .7rem/1 var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.copy { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border-radius: 999px; border: 2px solid var(--ink); background: var(--mint); color: #12202a; font: 700 .86rem var(--f-ui); }
.copy svg { width: 18px; height: 18px; }
.copy:hover { filter: brightness(.96); }
.copy.done { background: var(--ink); color: var(--paper); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 400 .82rem/1.62 var(--f-mono); white-space: pre; color: var(--ink); tab-size: 4; -webkit-overflow-scrolling: touch; }
.code.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.code:not(.wrap) pre {
  background:
    linear-gradient(to right, var(--code) 30%, transparent) 0 0 / 24px 100% no-repeat local,
    linear-gradient(to left, var(--code) 30%, transparent) 100% 0 / 24px 100% no-repeat local,
    linear-gradient(to right, rgba(31, 42, 51, .2), transparent) 0 0 / 10px 100% no-repeat scroll,
    linear-gradient(to left, rgba(31, 42, 51, .2), transparent) 100% 0 / 10px 100% no-repeat scroll;
}
.code pre code { padding: 0; background: none; font: inherit; border-radius: 0; }

/* частые ошибки */
.blk-err ul.errs { margin-top: .4em; }
.blk-err ul.errs > li { margin: 0 0 .7em; padding: 12px 14px 12px 50px; border-radius: 16px; background: var(--coral2); border: 1.5px solid var(--coral-l); }
.blk-err ul.errs > li::before {
  left: 13px; top: 15px; width: 24px; height: 24px; border-radius: 50%; border: 0; transform: none;
  background: var(--coral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8 8 8 8M16 8l-8 8' stroke='%23fff' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center/100% no-repeat;
}

/* коротко */
.blk-short { padding: 18px 16px 8px; border-radius: 26px; background: var(--night); color: var(--night-ink); }
.blk-short h2 { color: var(--night-ink); }
.blk-short ul.shorts > li, .blk-short ol.shorts > li { margin: 0 0 .9em; padding-left: 40px; font-size: 1.02rem; line-height: 1.6; }
.blk-short ul.shorts > li::before, .blk-short ol.shorts > li::before {
  left: 0; top: 2px; width: 26px; height: 26px; border-radius: 50%; transform: none; border: 0;
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6.5 12.5 3.6 3.6 7.4-8' fill='none' stroke='%2312202a' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
  content: ''; color: transparent;
}
.blk-short code { background: rgba(255, 255, 255, .12); color: var(--night-ink); }
.blk-short a { color: var(--mint); }

/* иллюстрации */
.fig { margin: 1.8em 0; padding: 6px; border: 1.5px solid var(--line); border-radius: 24px; background: var(--fig); }
.fig { position: relative; }
.fig svg.ill { display: block; width: 100%; height: auto; margin-bottom: 8px; }
.fig-foot { display: flex; align-items: center; justify-content: center; gap: 8px; }
.fig-foot figcaption { flex: 1; min-width: 0; }
.zoom {
  flex: none; display: none; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); margin: 0 2px 2px 0;
  border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); color: var(--acc2);
}
.zoom svg { width: 22px; height: 22px; }
.zoom:hover { border-color: var(--acc); }
@media (max-width: 759px) {
  .zoom { display: inline-flex; }
  .fig { cursor: zoom-in; }
  .fig-foot figcaption { text-align: left; padding-left: 8px; }
}
.zoomer { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: var(--bg); }
.zoomer[hidden] { display: none; }
.zoomer-bar { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.zoomer-cap { flex: 1; min-width: 0; margin: 0; font: 700 .86rem/1.3 var(--f-ui); color: var(--ink); }
.zoomer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 16px; touch-action: pan-x pan-y pinch-zoom; display: flex; }
.zoomer-body svg.ill { flex: none; max-width: none; width: max(172vw, 680px); height: auto; margin: auto; }
.zoomer-hint { margin: 0; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); text-align: center; font: 500 .76rem var(--f-ui); color: var(--ink2); border-top: 1px solid var(--line); background: var(--paper); }
.fig figcaption { padding: 2px 10px 8px; text-align: center; font: 600 .82rem/1.4 var(--f-ui); color: var(--ink2); }

.ill{display:block;width:100%;height:auto;overflow:visible}
.ill .k{stroke:var(--i-ink);stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round}
.ill .k2{stroke:var(--i-ink);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.ill .n{fill:none}
.ill .p{fill:var(--i-p)}.ill .p2{fill:var(--i-p2)}.ill .gy{fill:var(--i-gy)}.ill .i{fill:var(--i-ink)}
.ill .bgc{fill:var(--i-bg)}.ill .fog{fill:var(--i-fog)}
.ill .m{fill:#5fd0bd}.ill .m2{fill:#4cc0ac}.ill .md{fill:#2a9d8c}.ill .ml{fill:var(--i-ml)}
.ill .bb{fill:var(--i-bb)}.ill .bb2{fill:var(--i-bb2)}.ill .bbd{fill:var(--i-bbd)}
.ill .v{fill:#18232c}.ill .r{fill:var(--i-r)}.ill .r2{fill:var(--i-r2)}.ill .y{fill:var(--i-y)}
.ill .y2{fill:var(--i-y2)}.ill .ml2{fill:#8fd9ca}.ill .gy2{fill:var(--i-gy);fill-opacity:.7}.ill .p22{fill:var(--i-gy)}
.ill .g{fill:var(--i-g)}.ill .g2{fill:#3f9a63}.ill .b{fill:var(--i-b)}
.ill .b2{fill:var(--i-b2)}.ill .pk{fill:var(--i-pk)}.ill .w{fill:#ffffff}
.ill .glass{fill:var(--i-glass);fill-opacity:.7}
.ill .lens{fill:var(--i-ml);fill-opacity:.72}
.ill .lit{fill:#fff1dc}.ill .halo{fill:#ffb775;fill-opacity:.5}
.ill .eye{fill:#fff1dc}.ill .eyeglow{fill:#ffb775;fill-opacity:.34}
.ill .eyel{stroke:#fff1dc;stroke-width:3.4;stroke-linecap:round}
.ill .hl{fill:#ffffff;fill-opacity:.4}
.ill .seam{stroke:var(--i-bbd);stroke-width:2;stroke-opacity:.7}
.ill .shadow{fill:var(--i-ink);fill-opacity:.12}
.ill .hov{stroke:var(--i-bb2);stroke-width:2.6;stroke-linecap:round}
.ill .bit .k{stroke-width:var(--sw)}
.ill .bit .k2{stroke-width:calc(var(--sw) * .72)}
.ill .arm-o{fill:none;stroke:var(--i-ink);stroke-width:calc(6.6px + var(--sw) * 2px);stroke-linecap:round}
.ill .arm-i{fill:none;stroke:var(--i-bb);stroke-width:6.6;stroke-linecap:round}
.ill .handle-o{stroke:var(--i-ink);stroke-width:calc(3.6px + var(--sw) * 2px);stroke-linecap:round}
.ill .handle-i{stroke:var(--i-bbd);stroke-width:3.6;stroke-linecap:round}
.ill .kc{stroke:var(--i-kc);stroke-linecap:round;stroke-linejoin:round}
.ill .kr{stroke:var(--i-r);stroke-linecap:round;stroke-linejoin:round}
.ill .kw{stroke:#ffffff;stroke-linecap:round;stroke-linejoin:round}
.ill .km{stroke:var(--i-bb2);stroke-linecap:round}
.ill .kmo{stroke:var(--i-ink2);stroke-width:2.4;stroke-linecap:round}
.ill .ln{stroke:var(--i-ln);stroke-width:3.4;stroke-linecap:round}
.ill .lnr{stroke:var(--i-r);stroke-width:3.4;stroke-linecap:round}
.ill .acc{stroke:#2a9d8c;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round}
.ill .dash{stroke-dasharray:6 6}
.ill text{font-family:Onest,"Segoe UI",system-ui,sans-serif;font-weight:500;fill:var(--i-ink)}
.ill text.w4{font-weight:400}
.ill .t2{fill:var(--i-ink2)}.ill .tw{fill:#ffffff}.ill .tonr{fill:var(--i-onr)}.ill .tdark{fill:#1f2a33}.ill .tq{fill:#8a5a00}
.ill .tr{fill:var(--i-rt)}.ill .tm{font-family:"JetBrains Mono",Consolas,monospace;font-weight:500}
.ill .kq{stroke:#8a5a00;stroke-width:2.4;stroke-linecap:round}.ill .fq{fill:#8a5a00}
.ill .tmint{fill:#7ff0da}.ill .tacc{fill:var(--i-kc)}.ill .tg{fill:var(--i-gt)}
.ill .road-o{fill:none;stroke:var(--i-ink);stroke-width:42;stroke-linecap:round;stroke-linejoin:round}
.ill .road-i{fill:none;stroke:var(--i-p2);stroke-width:36;stroke-linecap:round;stroke-linejoin:round}
.ill .road-c{fill:none;stroke:var(--i-ln);stroke-width:2.6;stroke-dasharray:11 11}
.ill .faint{fill:var(--i-ink2);fill-opacity:.55}
.ill .ul{text-decoration:underline;text-decoration-thickness:2px}
.ill .wave{stroke:#2a9d8c;stroke-width:4;stroke-linecap:round}
.ill .wire{fill:none;stroke:var(--i-ink);stroke-width:2.5;stroke-linecap:round}
.ill .acc2{stroke:var(--i-kc);stroke-width:5;stroke-linecap:round;stroke-linejoin:round;fill:none}
.ill .glow-r{fill:var(--i-r);fill-opacity:.22}.ill .glow-g{fill:var(--i-g);fill-opacity:.25}
.ill .halo2{fill:#ffb775;fill-opacity:.5}
.ill .stampg{fill:none;stroke:var(--i-g);stroke-width:3}.ill .stampr{fill:none;stroke:var(--i-r);stroke-width:3}


/* таблицы */
.tw { margin: 1.3em 0; overflow-x: auto; border: 1.5px solid var(--line); border-radius: 18px; background:
  linear-gradient(to right, var(--paper) 30%, transparent) 0 0 / 28px 100% no-repeat local,
  linear-gradient(to left, var(--paper) 30%, transparent) 100% 0 / 28px 100% no-repeat local,
  linear-gradient(to right, rgba(31, 42, 51, .16), transparent) 0 0 / 12px 100% no-repeat scroll,
  linear-gradient(to left, rgba(31, 42, 51, .16), transparent) 100% 0 / 12px 100% no-repeat scroll,
  var(--paper); -webkit-overflow-scrolling: touch; }
.tw table { border-collapse: collapse; width: 100%; min-width: 30rem; font-family: var(--f-ui); font-size: .88rem; line-height: 1.5; }
.tw th { text-align: left; padding: 10px 14px; background: color-mix(in srgb, var(--bg2) 85%, transparent); font: 800 .72rem/1.3 var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tw td { padding: 10px 14px; vertical-align: top; border-top: 1px solid var(--line2); }
.tw table[data-cols="2"] { min-width: 0; }
.tw table[data-cols="2"] th { white-space: normal; }
.tw table[data-cols="3"] { min-width: 22rem; }
.tw tbody tr:first-child td { border-top: 0; }

/* пагинация */
.pager { display: grid; gap: 10px; margin-top: 3em; padding-top: 1.4em; border-top: 1.5px dashed var(--line); }
.pn { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 14px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; min-width: 0; }
.pn:hover { border-color: var(--acc); background: var(--mint3); color: var(--ink); }
.pn svg { flex: none; width: 22px; height: 22px; color: var(--acc); }
.pn span { display: flex; flex-direction: column; min-width: 0; }
.pn small { font: 700 .66rem/1.2 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.pn b { font: 700 .95rem/1.3 var(--f-ui); }
.pn-next { justify-content: space-between; }
.pn-next span { text-align: left; }
.pn.off { display: none; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } .pn-next { grid-column: 2; } .pn-prev:not(.off) + .pn-next { grid-column: 2; } }

/* словарь (приложение Б) */
.dtools { margin: 1.2em 0 1.6em; }
.dsearch input {
  width: 100%; height: 52px; padding: 0 20px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font: 500 1rem var(--f-ui);
}
.dsearch input:focus { outline: 3px solid var(--mint); outline-offset: 2px; }
.dcount { min-height: 1.4em; margin: 8px 6px 0; font: 600 .82rem var(--f-ui); color: var(--ink2); }
.alpha { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.alpha a { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; font: 700 .9rem var(--f-ui); }
.alpha a:hover { background: var(--mint3); border-color: var(--acc); }
.letter { margin: 1.8em 0 .5em; }
h2.letter { display: flex; align-items: center; gap: 14px; font: 700 1.9rem/1 var(--f-head); }
h2.letter span { display: grid; place-items: center; min-width: 54px; height: 54px; padding: 0 12px; border-radius: 27px; background: var(--mint); border: 2.5px solid var(--ink); color: #12202a; }
h2.letter.wide span { font-size: 1.1rem; height: 46px; }
h2.letter::after { content: ''; flex: 1; height: 0; border-top: 1.5px dashed var(--line); }
.dict { margin: 0; }
.entry { margin: 0 0 12px; padding: 12px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line2); }
.entry[hidden], .letter-sec[hidden] { display: none; }
.entry:target { border-color: var(--acc); box-shadow: 0 0 0 3px var(--mint2); }
.entry .term { margin: 0; font: 700 1rem/1.3 var(--f-ui); color: var(--acc2); }
.entry .def { margin: 4px 0 0; font-size: .93rem; line-height: 1.6; }
.entry.redir { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 9px 14px; background: transparent; border-style: dashed; }
.entry.redir .def { margin: 0; color: var(--ink2); }

/* подвал */
.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--ink2); font: 400 .8rem/1.5 var(--f-ui); }
.foot p { margin: 0 0 4px; }

/* ===================== ПЕЧАТЬ: A5 ===================== */
@page {
  size: A5; margin: 17mm 14mm 19mm 14mm; background: #f5efe2;
  @bottom-center { content: counter(page); font: 600 7.6pt 'Onest', sans-serif; color: #6a747c; }
}
@page cover { size: A5; margin: 0; background: #f5efe2; @bottom-center { content: none; } }
@page part { size: A5; margin: 0; background: #18232c; @bottom-center { content: none; } }

.tp-list a.pg { display: none; }

@media print {
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #f5efe2; --bg2: #ece3cf; --paper: #fffdf7; --ink: #1f2a33; --ink2: #56626c; --line: #d9cfb8; --line2: #e8dfcb;
    --acc: #12705f; --acc2: #0c4f44; --mint2: #bfeae1; --mint3: #e3f6f1; --coral: #c8402f; --coral-l: #f0b4aa;
    --coral2: #fbe3de; --sun: #e0aa2c; --sun-l: #ecd48a; --sun2: #fbf0cd; --night: #18232c; --code: #fffefa; --fig: #fffaf0;
    --shadow: none;
    --i-ink:#1f2a33;--i-ink2:#5d6872;--i-p:#fffdf7;--i-p2:#efe6d3;--i-gy:#c4ccd0;--i-ln:#c9c1b1;--i-bg:#f6f0e4;--i-ml:#c3eee5;--i-r:#e2614f;--i-r2:#b8473a;--i-y:#f2c14e;--i-y2:#d6a136;--i-g:#5bb57d;--i-b:#7f9fda;--i-b2:#5b7cc0;--i-pk:#f3b8b1;--i-kc:#1f8f7f;--i-glass:#d7f1ec;--i-fog:#d9d4c8;--i-bb:#e17c4b;--i-bb2:#cb6639;--i-bbd:#a94d28;--i-onr:#ffffff;--i-rt:#c4402f;--i-gt:#2f8a57;
  }
  html { font-size: 9.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; background: transparent; }
  body { background: transparent; line-height: 1.5; }
  .topbar, .drawer, .scrim, .skip, .copy, .gloss-t, .dtools, .pager, .foot, .cta, .progress, .zoom, .zoomer { display: none !important; }
  .shell { display: block; }
  .view { display: block !important; }
  .wrap { max-width: none; padding-inline: 0; }
  [id] { scroll-margin-top: 0; }
  a, a.gl, a.xref { color: inherit; text-decoration: none; }
  sup.gl-ref a, .g-item dt a.gl-star { color: var(--acc2); }
  .g-item { scroll-margin-top: 0; }
  a.ext { color: var(--acc2); text-decoration: none; }

  /* обложка: отдельная страница без полей */
  .cover { page: cover; height: 210mm; padding: 0; break-after: page; overflow: hidden; background: var(--bg); }
  .cover-in { display: block; height: 210mm; padding: 17mm 14mm; position: relative; }
  .cover::before { width: 130mm; height: 200mm; right: -52mm; top: -56mm; }
  .cover::after { width: 96mm; height: 140mm; left: -54mm; bottom: -52mm; }
  .cover-tx { position: static; }
  .kicker { font-size: 6.8pt; padding: 1.6mm 3mm; }
  .cover-t { font-size: 46pt; margin-top: 7mm; line-height: 1; max-width: 110mm; }
  .cover-st { font-size: 14.5pt; margin-top: 5mm; max-width: 96mm; }
  .cover-p { font-size: 9pt; max-width: 84mm; margin-top: 4mm; line-height: 1.55; }
  .facts { display: none; }
  .cover-art { order: 0; position: absolute; left: 50%; transform: translateX(-50%); bottom: 25mm; width: 94mm; margin: 0; }
  .cover-note { position: absolute; left: 14mm; right: 14mm; bottom: 11mm; width: auto; max-width: none; margin: 0; font-size: 6.8pt; line-height: 1.5; }

  /* оглавление: две страницы, номера страниц вместо минут */
  .toc-home { break-before: page; padding: 0; }
  .toc-home .sec-t { font-size: 18pt; margin-bottom: 4mm; }
  .toc-grid { display: block; columns: 1; }
  .tp { break-inside: avoid; margin-bottom: 2.6mm; padding: 2.4mm 3mm 0.8mm; border-radius: 4.5mm; border-width: .6pt; }
  .tp-no { width: 8mm; height: 10.4mm; font-size: 8.4pt; border-radius: 4mm; border-width: 1pt; }
  .tp-no::before { top: -1.6mm; height: 1.4mm; width: .5pt; }
  .tp-h { padding: 0 0 1.2mm; gap: 3mm; }
  .tp-name { font-size: 10.4pt; }
  .tp-sub { font-size: 6.8pt; margin: 0; }
  .eyebrow { font-size: 6pt; }
  .tp-list a { min-height: 0; padding: .8mm 1.5mm; font-size: 8.4pt; border-top-width: .4pt; }
  .tp-list li { display: flex; align-items: center; border-top: .4pt solid var(--line2); }
  .tp-list li:first-child { border-top: 0; }
  .tp-list li > a:first-child { flex: 1; min-width: 0; border-top: 0; }
  .tp-list .m { display: none; }
  .tp-list a.pg { display: block; flex: none; min-width: 8mm; padding: 0 1.5mm 0 0; text-align: right; font: 700 8pt var(--f-ui); color: var(--ink2); font-variant-numeric: tabular-nums; border: 0; min-height: 0; }
  .poses { break-before: page; padding: 0; }
  .poses .sec-t { font-size: 18pt; }
  .poses-p { font-size: 9pt; }
  .pose-grid { grid-template-columns: repeat(3, 1fr); gap: 3mm; }
  .pose { break-inside: avoid; border-radius: 4mm; padding: 2mm; border-width: .6pt; }
  .pose figcaption { font-size: 6.8pt; }

  /* главы */
  .chapter { max-width: none; padding: 0; break-before: page; }
  .part-open {
    page: part; break-before: page; break-after: page; height: 210mm; margin: 0; padding: 0 14mm; border-radius: 0;
    flex-direction: column; justify-content: center; align-items: flex-start; gap: 8mm;
  }
  .po-art { width: 84mm; }
  .po-label { font-size: 9pt; }
  .po-name { font-size: 26pt; margin-top: 3mm; }
  .po-sub { font-size: 10pt; margin-top: 3mm; }
  .ch-head { padding: 8mm 0 2mm; gap: 5mm; }
  .ch-num { width: 17mm; height: 22mm; margin-top: 2mm; border-radius: 8.5mm; border-width: 1.2pt; }
  .ch-num::before { top: -3.4mm; height: 2.8mm; width: 1.2pt; }
  .ch-num::after { top: -5.8mm; width: 3mm; height: 3mm; border-width: 1.2pt; }
  .ch-num span { font-size: 13pt; }
  .ch-tx h1 { font-size: 19pt; line-height: 1.28; margin-top: 2mm; hyphens: manual; }  /* 1.12 давало наложение строк Unbounded: pdftotext склеивал строки заголовка */
  .ch-meta { font-size: 6.8pt; margin-top: 3mm; }
  .prose .lead { font-size: 10.6pt; margin-top: 5mm; }
  .sec { margin-top: 1.5em; }
  .sec h2, .blk-h h2 { font-size: 12.6pt; }
  .sec > h2::before { width: 8mm; height: 4.4mm; margin-top: .2em; }
  .prose h3 { font-size: 10.6pt; break-after: avoid; }
  .sec > h2, .blk-h { break-after: avoid; }
  .co, .fig, .bq, .g-item, .blk-do ol.steps > li, .blk-err ul.errs > li, .entry, .tw, .code-bar, .blk-short, .pn { break-inside: avoid; }
  .gloss, .blk-do, .blk-tpl, .tw.tw-long { break-inside: auto; }
  .tw-long tr { break-inside: avoid; }
  .tw-long thead { display: table-header-group; }
  .gloss { padding: 3.5mm 3mm 3mm; border-radius: 5mm; border-width: .6pt; }
  .gloss.collapsed .g-wrap { display: block; }
  .g-list { grid-template-columns: 1fr; gap: 2mm; }
  .g-item { padding: 2mm 3mm; border-radius: 3.5mm; border-width: .4pt; }
  .g-item dt { font-size: 8.6pt; }
  .g-item dd { font-size: 8.2pt; line-height: 1.48; }
  .blk-do { box-shadow: 1.4mm 1.4mm 0 var(--mint); padding: 3.5mm 3mm 1.5mm; border-radius: 5mm; border-width: 1.2pt; }
  .blk-do ol.steps > li { padding: 2.4mm 3mm 2.4mm 11mm; margin-bottom: 2mm; border-radius: 3.5mm; border-width: .5pt; }
  .blk-do ol.steps > li::before { left: 2.4mm; top: 2.2mm; width: 6.2mm; height: 6.2mm; font-size: 8pt; line-height: 5.4mm; border-width: 1pt; }
  .blk-err ul.errs > li { padding: 2.6mm 3mm 2.6mm 11mm; margin-bottom: 2mm; border-radius: 3.5mm; border-width: .5pt; }
  .blk-err ul.errs > li::before { left: 2.6mm; top: 3mm; width: 5mm; height: 5mm; }
  .blk-short { border-radius: 5mm; padding: 4mm 4mm 1.5mm; }
  .blk-short ul.shorts > li, .blk-short ol.shorts > li { padding-left: 9mm; }
  .blk-short ul.shorts > li::before, .blk-short ol.shorts > li::before { width: 5.6mm; height: 5.6mm; }
  .co { border-radius: 4.5mm; padding: 3mm 3.5mm 1mm; border-width: .6pt; }
  .fig { border-radius: 5mm; padding: 1.6mm; margin: 5mm 0; border-width: .6pt; }
  .fig figcaption { font-size: 7.2pt; }
  .code pre { font-size: 7.5pt; padding: 3mm 3.5mm; white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }
  .code { border-radius: 4mm; border-width: .6pt; }
  .tw { overflow: visible; border-radius: 3.5mm; background: var(--paper); border-width: .6pt; }
  .tw table { min-width: 0; font-size: 7.6pt; }
  .tw th, .tw td { padding: 1.8mm 2.2mm; }
  .tw th { white-space: normal; font-size: 6.4pt; }
  .prose ul > li::before { border-width: 1pt; }
  .prose p { hyphens: auto; orphans: 3; widows: 3; }

  /* словарь: две колонки, без карточек */
  h2.letter { font-size: 15pt; break-after: avoid; margin-top: 5mm; }
  h2.letter span { min-width: 11mm; height: 11mm; border-radius: 5.5mm; border-width: 1.2pt; }
  h2.letter::after { border-top-width: .5pt; }
  .letter-sec { break-inside: auto; }
  .dict { columns: 2; column-gap: 7mm; column-fill: balance; }
  .entry, .entry.redir { display: block; break-inside: avoid; background: transparent; border: 0; border-bottom: .4pt solid var(--line); border-radius: 0; padding: 1.3mm 0 1.5mm; margin: 0; }
  .entry .term { font-size: 8.4pt; }
  .entry .def { font-size: 7.8pt; line-height: 1.42; margin-top: .6mm; }
  .entry.redir { padding: .9mm 0; }
  .entry.redir .term { display: inline; margin-right: 1.5mm; }
  .entry.redir .def { display: inline; }
}

/* ---------- узкие экраны ---------- */
@media (max-width: 380px) {
  .chapter { padding-inline: 14px; }
  .wrap { padding-inline: 14px; }
  .ch-num { width: 52px; height: 68px; }
  .ch-head { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============ надстройка сайта продаж: бесплатные главы ============ */
:root { --sun-ink: #6f5008; }
:root[data-theme="dark"] { --sun-ink: #f0cd73; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sun-ink: #f0cd73; } }
.bit { display: block; width: 100%; height: auto; }
.bit.pic-dark { display: none; }
:root[data-theme="dark"] .bit.pic-light { display: none; }
:root[data-theme="dark"] .bit.pic-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bit.pic-light { display: none; }
  :root:not([data-theme="light"]) .bit.pic-dark { display: block; }
}
.btn-ic { width: 1.25em; height: 1.25em; margin-left: 8px; flex: none; }
.btn { gap: 0; text-align: center; line-height: 1.2; }

.crumb { align-self: stretch; display: block; line-height: 56px; }          /* одна строка по центру панели, длинное название кончается многоточием */
.eyebrow { font-size: .76rem; }
.po-label, .code-lab, .pn small, .copy-t { font-size: .76rem; }
.buy-mini {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; margin: 0 2px;
  border-radius: 999px; background: var(--mint); border: 2px solid var(--ink); color: #12202a;
  font: 800 .8rem/1 var(--f-ui); text-decoration: none; box-shadow: 0 3px 0 var(--ink); white-space: nowrap;
}
.buy-mini:hover { color: #12202a; transform: translateY(1px); box-shadow: 0 2px 0 var(--ink); }
@media (max-width: 380px) { .buy-mini { padding: 0 12px; } }

.free-cover { padding-top: 18px; }
.free-cover .cta .btn { flex: 1 1 15rem; }
@media (min-width: 820px) { .free-cover .cta .btn { flex: 0 0 auto; } }
.free-cover .cover-art.free-art { width: min(44vw, 190px); }
.free-cover .cover-t { font-size: clamp(2.2rem, 10.5vw, 4.4rem); }
@media (min-width: 820px) { .free-cover .cover-art.free-art { width: 100%; max-width: 340px; margin-left: auto; } }

.fc-sec { padding: 8px 0 22px; }
.fc-list { display: grid; gap: 18px; }
.fc {
  display: flex; flex-direction: column; gap: 8px; padding: 22px 20px 20px; border-radius: 26px; background: var(--paper);
  border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--mint); color: var(--ink); text-decoration: none;
}
.fc:hover { color: var(--ink); transform: translate(1px, 1px); box-shadow: 4px 4px 0 var(--mint); }
.fc-top { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.fc-top > span:last-child { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 600 .8rem var(--f-ui); color: var(--ink2); }
.fc-t { margin: 6px 0 0; font: 700 clamp(1.3rem, 5.6vw, 1.6rem)/1.2 var(--f-head); letter-spacing: -.01em; }
.fc p { margin: 0; font: 400 1rem/1.6 var(--f-ui); color: var(--ink2); }
.fc .go { display: inline-flex; align-items: center; margin-top: 8px; font: 700 1rem var(--f-ui); color: var(--acc); }
.tag { display: inline-flex; padding: 3px 10px; border-radius: 999px; background: var(--mint); border: 1.5px solid var(--ink); color: #12202a; font: 800 .72rem/1.4 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; }
.ch-free { background: var(--mint); color: #12202a; border: 1.5px solid var(--ink); margin-left: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
@media (min-width: 760px) { .fc-list { grid-template-columns: 1fr 1fr; gap: 24px; } }

.buy {
  display: grid; gap: 14px; margin: 3em 0 0; padding: 22px 18px 20px; border-radius: 26px; background: var(--paper);
  border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--mint);
}
.wrap-buy .buy { margin-top: 0; max-width: 46rem; margin-inline: auto; }
.buy-head { display: flex; align-items: center; gap: 14px; }
.buy-art { flex: none; width: 88px; }
.buy h2 { margin: 4px 0 0; font: 700 clamp(1.15rem, 5.2vw, 1.5rem)/1.2 var(--f-head); letter-spacing: -.01em; }
.buy p { margin: 0; }
.buy-text { font: 400 1rem/1.6 var(--f-ui); color: var(--ink2); }
.buy-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.buy-list li {
  position: relative; padding-left: 28px; font: 500 .95rem/1.45 var(--f-ui);
}
.buy-list li::before {
  content: ''; position: absolute; left: 0; top: .12em; width: 19px; height: 19px; border-radius: 50%;
  background: var(--mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6.5 12.5 3.6 3.6 7.4-8' fill='none' stroke='%2312202a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
}
.buy .cta { margin-top: 4px; }
.buy .cta .btn { flex: 1 1 14rem; }
.buy-note { font: 500 .84rem/1.5 var(--f-ui); color: var(--ink2); }
.buy-note [data-min-price]:not(:empty) { font-weight: 800; color: var(--ink); }
.buy-note [data-min-price]:not(:empty)::after { content: '. '; }

.dr-buy { margin: 14px 8px 0; padding: 16px 14px 18px; border-radius: 22px; background: var(--mint3); border: 1.5px solid var(--mint2); }
.dr-buy .dr-part-t { padding-left: 0; padding-top: 0; }
.dr-buy-p { margin: 4px 0 12px; font: 500 .9rem/1.45 var(--f-ui); }
.dr-buy .btn { width: 100%; min-height: 48px; }
.dr-link { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 4px; color: var(--acc); font: 700 .9rem var(--f-ui); }

.foot-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 0 0 12px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink); font: 600 .86rem var(--f-ui); }
.seller-ph { background: var(--sun2); color: var(--sun-ink, #6f5008) !important; border-radius: 4px; padding: 0 .2em; text-decoration: none; }
@media print { .buy, .buy-mini { display: none !important; } }
