/* Reading Companion — одна таблица стилей на весь сайт. Редизайн «Полки» (2026-11-19):
   Apple Books в стилистике ElevenLabs. Обложки главные, уровень — цвет по шкале A1→C2,
   Inter / Inter Tight для интерфейса и заголовков, Newsreader для текста статей.
   Шрифты лежат на сайте (static/fonts, лицензия OFL), без Google Fonts. */

/* ------------------------------------------------------------ шрифты */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-tight-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-tight-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/newsreader-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/newsreader-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url(/fonts/newsreader-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url(/fonts/newsreader-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ------------------------------------------------------------ токены */

:root {
  --bg: #ffffff;
  --panel: #f5f5f7;
  --card: #ffffff;
  --line: #e8e8ed;
  --ink: #1d1d1f;
  --ink-2: #3a3a3e;
  --text: #1f1f22;
  --mute: #6e6e73;
  --soft: #8e8e93;
  --link: #3355d1;
  --focus: #3355d1;
  --chip: #f2f2f5;
  --glass: rgba(255, 255, 255, 0.72);
  --shadow-book: 0 10px 22px -10px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lift: 0 26px 40px -16px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.08);
  --marker: #f6e14b;
  --marker-ink: #1d1d1f;

  /* Шкала уровней. Яркие — полосы, плитки, фильтры; тёмные (-ink) — плашки с белым текстом (контраст ≥ 4.5:1). */
  --lv-a1: #22c55e; --lv-a1-ink: #15803d;
  --lv-a2: #14b8a6; --lv-a2-ink: #0f766e;
  --lv-b1: #3b82f6; --lv-b1-ink: #2563eb;
  --lv-b2: #6366f1; --lv-b2-ink: #4f46e5;
  --lv-c1: #a855f7; --lv-c1-ink: #9333ea;
  --lv-c2: #ec4899; --lv-c2-ink: #db2777;

  --ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Inter Tight", "Inter", -apple-system, system-ui, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Charter, Georgia, serif;

  --wrap: 1160px;
  --col: 720px;
  --side: 240px;
  --gutter: 24px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.3, 0.4, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --panel: #18181b;
    --card: #1c1c1f;
    --line: #2c2c31;
    --ink: #f4f4f5;
    --ink-2: #d4d4d8;
    --text: #e4e4e7;
    --mute: #a1a1aa;
    --soft: #8b8b94;
    --link: #8fa8ff;
    --focus: #8fa8ff;
    --chip: #232327;
    --glass: rgba(14, 14, 16, 0.72);
    --shadow-book: 0 12px 24px -10px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-lift: 0 26px 44px -14px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.4);
    --marker: #d8c238;
    --marker-ink: #0e0e10;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------ основа */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01"; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 0.5rem 0.8rem; border-radius: 8px; font-weight: 500;
}
.skip:focus { top: 0.6rem; }

/* ------------------------------------------------------------ шапка */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 7%, transparent);
  view-transition-name: site-header;
}
.header-inner {
  max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter);
  min-height: 60px; display: flex; align-items: center; gap: 20px;
}
.wordmark { display: flex; align-items: center; gap: 10px; flex: none; color: var(--ink); text-decoration: none; }
.wordmark svg { flex: none; border-radius: 7px; }
.wm { display: flex; flex-direction: column; gap: 2px; }
.wm-name { font: 650 16.5px/1.1 var(--display); letter-spacing: -0.02em; }
.wm-tag { font: 500 11.5px/1.2 var(--ui); color: var(--mute); letter-spacing: -0.005em; }

.langs {
  display: flex; gap: 2px; margin: 0 auto; padding: 3px; border-radius: 11px; background: var(--chip);
  scrollbar-width: none;
}
.langs::-webkit-scrollbar { display: none; }
.langs a {
  display: flex; align-items: center; justify-content: center; height: 30px; padding: 0 13px; border-radius: 8px;
  font: 500 13.5px/1 var(--ui); color: var(--ink-2); text-decoration: none; white-space: nowrap;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.langs a:hover { color: var(--ink); background: color-mix(in srgb, var(--card) 60%, transparent); }
.langs a.on {
  background: var(--card); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}

.get {
  flex: none; display: inline-flex; align-items: center; height: 34px; padding: 0 15px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font: 500 13.5px/1 var(--ui); text-decoration: none; white-space: nowrap;
  transition: transform 0.2s var(--ease), opacity 0.2s;
}
.get:hover { opacity: 0.88; }
.get:active { transform: scale(0.96); }

.site-nav { font: 500 14px/1.3 var(--ui); }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav summary { cursor: pointer; list-style: none; user-select: none; -webkit-user-select: none; }
.site-nav summary::-webkit-details-marker { display: none; }

.nav-top { display: flex; align-items: center; gap: 2px; }
.nav-top > li > a, .nav-top summary {
  display: block; padding: 8px 11px; border-radius: 9px; color: var(--ink-2); transition: background 0.2s, color 0.2s;
}
.nav-top > li > a:hover, .nav-top summary:hover { background: var(--chip); color: var(--ink); }
.nav-top > li > a[aria-current="page"], .nav-top summary.here { color: var(--ink); background: var(--chip); }
.nav-top summary::after {
  content: ""; display: inline-block; width: 0.38em; height: 0.38em; margin: 0 0 0.22em 0.5em;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.nav-top details[open] summary::after { transform: rotate(-135deg); margin-bottom: -0.05em; }
.nav-top .drop { position: relative; }
.nav-top .menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.06);
  animation: drop-in 0.22s var(--ease);
}
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.nav-top .menu a { display: block; padding: 7px 10px; border-radius: 9px; line-height: 1.35; font-weight: 450; }
.nav-top .menu a:hover { background: var(--chip); }
.nav-top .menu a[aria-current="page"] { font-weight: 650; }
.nav-top .drop:nth-child(1) .menu { min-width: 15rem; }
.nav-top .drop:nth-child(2) .menu {
  width: min(48rem, calc(100vw - 2rem)); display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; padding: 14px;
}
.group-name {
  margin: 4px 10px 4px; font: 600 11px/1.3 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft);
}

.nav-mobile { display: none; }
.nav-mobile > summary {
  display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%;
}
.nav-mobile > summary:hover { background: var(--chip); }
.nav-mobile .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.burger, .burger::before, .burger::after {
  display: block; width: 18px; height: 1.6px; border-radius: 2px; background: currentColor; position: relative;
  transition: transform 0.25s var(--ease), background 0.2s;
}
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.nav-mobile[open] .burger { background: transparent; }
.nav-mobile[open] .burger::before { top: 0; transform: rotate(45deg); }
.nav-mobile[open] .burger::after { top: 0; transform: rotate(-45deg); }
.nav-mobile .sheet {
  position: absolute; left: 0; right: 0; top: 100%;
  max-height: calc(100vh - 7rem); max-height: calc(100dvh - 7rem); overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); border-bottom: 1px solid var(--line);
  box-shadow: 0 24px 40px -18px rgba(0, 0, 0, 0.3); padding: 8px var(--gutter) 24px;
  animation: drop-in 0.22s var(--ease);
}
.nav-mobile .group-name { margin: 18px 0 4px; }
.nav-mobile .sheet a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 450; }
.nav-mobile .sheet a[aria-current="page"] { font-weight: 650; }
.nav-mobile .last { margin-top: 14px; }

@media (max-width: 1099px) {
  .header-inner { flex-wrap: wrap; row-gap: 8px; padding-top: 10px; padding-bottom: 10px; min-height: 0; }
  .wordmark { margin-right: auto; }
  .get { order: 1; }
  .site-nav { order: 2; }
  .langs { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .langs a { flex: 1 0 auto; }
  .nav-top { display: none; }
  .nav-mobile { display: block; }
}
@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .header-inner { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .wm-tag { display: none; }
  .wm-name { font-size: 15.5px; }
  .wordmark { gap: 8px; }
  .wordmark svg { width: 26px; height: 26px; }
  .get { height: 32px; padding: 0 12px; font-size: 13px; }
  .langs a { padding: 0 10px; font-size: 13px; }
}
@media (max-width: 350px) {
  .get { display: none; }
}

/* ------------------------------------------------------------ подвал */

.site-footer {
  margin-top: 96px; border-top: 1px solid var(--line); background: var(--panel);
  font: 400 13.5px/1.55 var(--ui); color: var(--mute);
}
.footer-inner { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 40px var(--gutter) 56px; }
.col-name { margin: 0 0 10px; font: 600 11px/1.3 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); }
.scale { margin-bottom: 36px; }
.level-scale { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.level-scale .lv {
  display: block; padding: 10px 12px 9px; border-radius: 12px; color: #fff; text-decoration: none;
  font: 500 12.5px/1.2 var(--ui); position: relative; overflow: hidden; transition: transform 0.3s var(--ease);
}
.level-scale .lv b { display: block; font: 700 20px/1 var(--display); letter-spacing: -0.02em; margin-bottom: 4px; }
.level-scale a.lv:hover { transform: translateY(-2px); }
.lv-a1 { background: linear-gradient(140deg, #86efac, var(--lv-a1-ink)); }
.lv-a2 { background: linear-gradient(140deg, #5eead4, var(--lv-a2-ink)); }
.lv-b1 { background: linear-gradient(140deg, #7dd3fc, var(--lv-b1-ink)); }
.lv-b2 { background: linear-gradient(140deg, #a5b4fc, var(--lv-b2-ink)); }
.lv-c1 { background: linear-gradient(140deg, #e879f9, var(--lv-c1-ink)); }
.lv-c2 { background: linear-gradient(140deg, #fb7185, var(--lv-c2-ink)); }
.footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 28px 32px; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: 0 0 6px; }
.footer-cols a { color: var(--mute); text-decoration: none; }
.footer-cols a:hover { color: var(--ink); }
.footer-about { margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.footer-about p { max-width: 46rem; margin: 0 0 8px; }
.footer-about strong { color: var(--ink); }
.footer-about a { color: var(--ink-2); }
@media (max-width: 640px) {
  .level-scale { grid-template-columns: repeat(3, 1fr); }
  .site-footer { margin-top: 64px; }
}

/* ------------------------------------------------------------ колонка текста */

main { padding: 0 var(--gutter); container-type: inline-size; }

.prose { max-width: var(--col); margin: 36px auto 0; }
@media (min-width: 1100px) {
  /* Текст слева, оглавление справа и едет вместе со страницей (каркас mockups/article.tpl.html). */
  .prose.has-toc {
    display: grid; grid-template-columns: minmax(0, var(--col)) var(--side); column-gap: 64px;
    max-width: calc(var(--col) + 64px + var(--side)); align-items: start;
  }
  .prose.has-toc > * { grid-column: 1; }
  .prose.has-toc > .toc { grid-column: 2; grid-row: span 999; position: sticky; top: 96px; }
  .prose.has-toc > .bleed, .prose.has-toc > .book-hero { grid-column: 1 / -1; }
  .prose.has-toc > .bleed { width: auto; margin-left: 0; }
  .prose.has-toc > h2 { margin-top: 44px; }
}

.crumbs { font: 400 13px/1.4 var(--ui); color: var(--soft); margin: 0 0 14px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 0; }
.crumbs li { margin: 0; }
.crumbs li:not(:last-child)::after { content: "›"; margin: 0 8px; opacity: 0.7; }
.prose .crumbs li { font: inherit; color: inherit; margin: 0; }
.prose .crumbs a { color: inherit; text-decoration: none; }
.prose .crumbs a:hover { color: var(--ink); }

.prose h1 {
  font: 300 46px/1.06 var(--ui); letter-spacing: -0.035em; color: var(--ink);
  margin: 0 0 18px; text-wrap: balance;
}
.prose h2 {
  font: 500 27px/1.2 var(--ui); letter-spacing: -0.02em; color: var(--ink);
  margin: 54px 0 14px; text-wrap: balance; scroll-margin-top: 90px;
}
.prose h3 { font: 600 19px/1.3 var(--ui); letter-spacing: -0.01em; margin: 34px 0 10px; }
.prose p, .prose li { font-family: var(--serif); font-size: 19px; line-height: 1.62; color: var(--text); font-optical-sizing: auto; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin: 0 0 8px; }
.prose li > ul, .prose li > ol { margin-top: 8px; }
.prose a { color: var(--link); text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--link); }
.prose strong { font-weight: 650; }
.prose .lead { font: 400 20px/1.5 var(--ui); color: var(--ink-2); letter-spacing: -0.005em; margin: 0 0 16px; }
.prose .meta { font: 400 13px/1.5 var(--ui); color: var(--soft); margin: 0 0 26px; }
.meta a { color: var(--mute); }

@media (max-width: 640px) {
  .prose { margin-top: 22px; }
  .prose h1 { font-size: 34px; line-height: 1.08; }
  .prose .lead { font-size: 18px; }
  .prose p, .prose li { font-size: 17.5px; }
  .prose h2 { font-size: 23px; margin-top: 44px; }
  .key-points { padding: 18px 18px 8px; }
  .key-points li { font-size: 16.5px; }
  .k-home .prose h1 { font-size: 32px; }
}

/* Шаги — настоящая последовательность, поэтому с номерами. */
ol.steps { list-style: none; counter-reset: step; padding: 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 46px; margin-bottom: 20px; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 2px;
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg);
  font: 600 14px/30px var(--ui); text-align: center;
}
ol.steps > li > strong:first-child { display: block; font-family: var(--ui); font-size: 17px; font-weight: 600; margin-bottom: 2px; }

.prose blockquote {
  margin: 22px 0; padding: 18px 22px; border-radius: 18px; background: var(--panel); border: 0;
}
.prose blockquote p { font-style: italic; font-size: 19px; margin: 0; }

/* Главное (Key points): спокойная панель. */
.key-points { margin: 6px 0 30px; padding: 22px 26px 12px; border-radius: 22px; background: var(--panel); }
.prose .key-points h2 {
  font: 600 12px/1.3 var(--ui); letter-spacing: 0.09em; text-transform: uppercase; color: var(--mute); margin: 0 0 12px;
}
.key-points ul { list-style: none; padding: 0; margin: 0 0 6px; }
.key-points li { position: relative; padding-left: 20px; font-size: 17px; }
.key-points li::before {
  content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--lv-a2), var(--lv-b2));
}

/* Источник под абзацем. */
.note {
  display: block; margin: -6px 0 18px; padding-left: 12px; border-left: 2px solid var(--line);
  font: 400 13px/1.5 var(--ui); color: var(--mute);
}
.note a { color: inherit; }
.with-note > .note { margin-top: -8px; }

/* Оглавление: справа на широком экране, панелью на остальных. */
.toc { margin: 0 0 30px; padding: 16px 18px; border-radius: 18px; background: var(--panel); font-family: var(--ui); }
.toc summary {
  cursor: pointer; list-style: none; font: 600 12px/1.3 var(--ui); letter-spacing: 0.09em; text-transform: uppercase; color: var(--mute);
}
.toc summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 10px 0 0; padding: 0; columns: 2 16rem; column-gap: 24px; }
.prose .toc li { font: 400 14px/1.4 var(--ui); margin: 0; break-inside: avoid; }
.prose .toc a { display: block; padding: 5px 0; color: var(--ink-2); text-decoration: none; }
.prose .toc a:hover { color: var(--ink); }
@media (min-width: 1100px) {
  .prose.has-toc > .toc { margin: 0; padding: 0; background: none; border-radius: 0; }
  .prose.has-toc > .toc ol { columns: auto; border-left: 1px solid var(--line); margin-top: 12px; }
  .prose.has-toc > .toc li { font-size: 13.5px; }
  .prose.has-toc > .toc a {
    padding: 7px 0 7px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--mute);
    transition: color 0.2s, border-color 0.2s;
  }
  .prose.has-toc > .toc a:hover, .prose.has-toc > .toc a.on { color: var(--ink); border-left-color: var(--ink); }
}

/* ------------------------------------------------------------ таблицы */

.table-wrap {
  overflow-x: auto; margin: 22px 0 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--card);
}
.wide { margin: 0; }
@media (min-width: 760px) {
  /* Без оглавления справа широкие таблицы выходят из колонки текста. */
  .prose:not(.has-toc) .wide {
    width: min(960px, 100cqw); margin-left: calc(50% - min(960px, 100cqw) / 2);
  }
}
table {
  border-collapse: collapse; width: 100%; font: 400 14px/1.45 var(--ui); color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
}
caption {
  caption-side: top; text-align: left; padding: 14px 18px; font-size: 13px; line-height: 1.45; color: var(--mute);
  border-bottom: 1px solid var(--line);
}
th, td { padding: 11px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; }
thead th { border-top: 0; background: var(--panel); font-weight: 500; font-size: 12.5px; color: var(--ink-2); vertical-align: bottom; }
caption + thead th { border-top: 0; }
tbody th { font-weight: 500; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: color-mix(in srgb, var(--panel) 60%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; }
thead th.num { white-space: normal; }
tfoot th, tfoot td { border-top: 1px solid var(--line); background: var(--panel); font-weight: 600; }
.prose table a { text-decoration: none; }
.prose table a:hover { text-decoration: underline; }

table.matrix td { text-align: right; }
table.matrix th[scope="col"]:not(:first-child) { text-align: right; }
table.matrix td.nil { color: var(--soft); }
table.matrix td.total { font-weight: 600; }

.level {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.4em; height: 20px; padding: 0 7px;
  border-radius: 6px; font: 700 11px/1 var(--ui); letter-spacing: 0.02em; color: #fff; text-decoration: none;
}
.level-a1 { background: var(--lv-a1-ink); }
.level-a2 { background: var(--lv-a2-ink); }
.level-b1 { background: var(--lv-b1-ink); }
.level-b2 { background: var(--lv-b2-ink); }
.level-c1 { background: var(--lv-c1-ink); }
.level-c2 { background: var(--lv-c2-ink); }

table.books th.book a { font-weight: 600; color: var(--ink); }
table.books .by { display: block; color: var(--mute); font-size: 13px; font-weight: 400; }
table.books td.form { color: var(--mute); }
table.books tr { scroll-margin-top: 90px; }
table.books th.book .bk { display: flex; gap: 12px; align-items: flex-start; }
table.books th.book .thumb { flex: none; line-height: 0; }
table.books th.book .thumb img {
  width: 40px; height: auto; border-radius: 2px 4px 4px 2px; box-shadow: var(--shadow-book); background: var(--panel);
  transition: transform 0.3s var(--ease);
}
table.books tr:hover .thumb img { transform: translateY(-2px) rotate(-2deg); }
section.lang h2 .count, .collection h2 .count {
  font: 400 15px/1 var(--ui); color: var(--mute); letter-spacing: 0; margin-left: 6px;
}

table.tools .by, table.free .by { display: block; color: var(--mute); font-size: 13px; font-weight: 400; }
table.tools th[scope="row"] a, table.free th[scope="row"] a { font-weight: 600; }

/* На телефоне строка таблицы книг — карточка вместо семи колонок. */
@media (max-width: 640px) {
  table.books, table.books tbody, table.books tr, table.books th, table.books td { display: block; }
  table.books thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.books caption { display: block; }
  table.books tr {
    display: grid; grid-template-columns: auto auto auto; justify-content: start; gap: 6px 22px;
    padding: 14px 16px; border-top: 1px solid var(--line);
  }
  table.books th, table.books td { border: 0; padding: 0 !important; text-align: left; }
  table.books th.book, table.books td.form { grid-column: 1 / -1; }
  table.books td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--soft); }
  table.books td.form { margin-top: -4px; font-style: italic; }
  table.books td.num { white-space: normal; }

  table.tools, table.tools tbody, table.tools tr, table.tools th, table.tools td,
  table.free, table.free tbody, table.free tr, table.free th, table.free td { display: block; }
  table.tools thead, table.free thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.tools caption, table.free caption { display: block; }
  table.tools tr, table.free tr { padding: 14px 16px; border-top: 1px solid var(--line); }
  table.tools th, table.tools td, table.free th, table.free td { border: 0; padding: 2px 0 !important; }
  table.tools td::before, table.free td::before { display: block; font-size: 11.5px; color: var(--soft); }
  table.tools td:nth-of-type(1)::before { content: "Runs on"; }
  table.tools td:nth-of-type(2)::before { content: "What you read"; }
  table.tools td:nth-of-type(3)::before { content: "Looking up a word"; }
  table.tools td:nth-of-type(4)::before { content: "Saved words"; }
  table.tools td:nth-of-type(5)::before { content: "Price"; }
  table.free td:nth-of-type(1)::before { content: "What you get"; }
  table.free td:nth-of-type(2)::before { content: "Levels"; }
  table.free td:nth-of-type(3)::before { content: "Format"; }
  table.free td:nth-of-type(4)::before { content: "Cost"; }

  /* stack_tables() в build.py подписывает ячейки из шапки; на телефоне строка — карточка. */
  table.stack, table.stack tbody, table.stack tfoot, table.stack tr, table.stack th, table.stack td { display: block; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stack caption { display: block; }
  table.stack tr { padding: 12px 16px; border-top: 1px solid var(--line); }
  table.stack th, table.stack td { border: 0; padding: 2px 0 !important; text-align: left; white-space: normal; background: none; }
  table.stack th[scope="row"], table.stack tbody th { font-weight: 600; margin-bottom: 2px; }
  table.stack td[data-label]::before {
    content: attr(data-label); display: block; font-size: 11.5px; line-height: 1.3; color: var(--soft);
  }
  table.stack tr:has(> th ~ th) > th[data-label]::before {
    content: attr(data-label); display: block; font-size: 11.5px; font-weight: 400; color: var(--soft);
  }
  table.stack tr:has(> th ~ th) > th ~ th { margin-top: 8px; }
  table.stack.stack-grid tr {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 4px 14px; align-items: start;
  }
  table.stack.stack-grid th { grid-column: 1 / -1; }
}
/* Широкие таблицы книг (8 колонок, рассказы): карточки и на планшете. */
@media (min-width: 640.02px) and (max-width: 900px) {
  table.books.many, table.books.many tbody, table.books.many tr, table.books.many th, table.books.many td { display: block; }
  table.books.many thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.books.many caption { display: block; }
  table.books.many tr {
    display: grid; grid-template-columns: repeat(6, auto); justify-content: start; gap: 6px 24px;
    padding: 14px 18px; border-top: 1px solid var(--line);
  }
  table.books.many th, table.books.many td { border: 0; padding: 0 !important; text-align: left; white-space: normal; }
  table.books.many th.book, table.books.many td.form { grid-column: 1 / -1; }
  table.books.many td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--soft); }
  table.books.many td.form { margin-top: -4px; font-style: italic; }
}

/* ------------------------------------------------------------ демонстрация 98/95/90 % на главной */

.demo { margin: 30px 0 34px; }
.demo input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.demo-controls { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; font-family: var(--ui); }
.demo-controls .ask { flex-basis: 100%; font-size: 14px; color: var(--mute); margin: 0 0 4px; font-family: var(--ui); }
.demo-controls label {
  cursor: pointer; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500;
  background: var(--chip); color: var(--ink); transition: background 0.25s, color 0.25s;
}
.demo-controls label .sub { color: var(--mute); font-weight: 400; }
#k98:checked ~ .demo-controls label[for="k98"],
#k95:checked ~ .demo-controls label[for="k95"],
#k90:checked ~ .demo-controls label[for="k90"] { background: var(--ink); color: var(--bg); }
#k98:checked ~ .demo-controls label[for="k98"] .sub,
#k95:checked ~ .demo-controls label[for="k95"] .sub,
#k90:checked ~ .demo-controls label[for="k90"] .sub { color: inherit; opacity: 0.75; }
#k98:focus-visible ~ .demo-controls label[for="k98"],
#k95:focus-visible ~ .demo-controls label[for="k95"],
#k90:focus-visible ~ .demo-controls label[for="k90"] { outline: 3px solid var(--focus); outline-offset: 2px; }
.demo-page {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px 14px 14px 6px; padding: 26px 30px 18px;
  box-shadow: 0 1px 0 var(--line), 0 4px 0 -1px var(--card), 0 5px 0 -1px var(--line), 0 30px 50px -30px rgba(0, 0, 0, 0.25);
}
.prose .demo-page p { margin: 0; font-size: 19px; line-height: 1.75; hyphens: auto; }
.prose .demo-page .folio { margin-top: 12px; text-align: center; font: 400 12px/1 var(--ui); color: var(--soft); }
#k98:checked ~ .demo-page .t98 .rw,
#k95:checked ~ .demo-page :is(.t98, .t95) .rw,
#k90:checked ~ .demo-page .nw .rw { display: none; }
#k98:checked ~ .demo-page .t98::after,
#k95:checked ~ .demo-page :is(.t98, .t95)::after,
#k90:checked ~ .demo-page .nw::after {
  content: attr(data-nw);
  background: linear-gradient(to bottom, transparent 18%, var(--marker) 18%, var(--marker) 88%, transparent 88%);
  color: var(--marker-ink); padding: 0 0.1em; margin: 0 -0.1em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.demo-caption { font: 400 14px/1.5 var(--ui); color: var(--mute); margin-top: 14px; }
.demo-caption span { display: none; }
#k98:checked ~ .demo-caption .c98,
#k95:checked ~ .demo-caption .c95,
#k90:checked ~ .demo-caption .c90 { display: inline; }
mark.unknown {
  background: linear-gradient(to bottom, transparent 18%, var(--marker) 18%, var(--marker) 88%, transparent 88%);
  color: var(--marker-ink); padding: 0 0.1em;
}

/* ------------------------------------------------------------ калькулятор времени чтения */

.calc { font-family: var(--ui); border-radius: 22px; background: var(--panel); padding: 22px 24px; margin: 24px 0 30px; }
.prose .calc h2 { margin-top: 0; }
.calc .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 14px 18px; }
.calc label { display: block; font-size: 13px; color: var(--mute); margin-bottom: 6px; }
.calc input {
  width: 100%; font: 500 17px/1 var(--ui); padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font-variant-numeric: tabular-nums;
}
.calc input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.calc output { display: block; margin-top: 16px; font: 500 18px/1.4 var(--ui); color: var(--ink); min-height: 1.6em; }
.prose .calc .hint { font: 400 13px/1.5 var(--ui); color: var(--mute); margin: 10px 0 0; }

/* ------------------------------------------------------------ разное в тексте */

.prose .disclosure { font: 400 13.5px/1.5 var(--ui); color: var(--mute); }
.sources { margin-top: 56px; padding-top: 6px; border-top: 1px solid var(--line); }
.prose .sources h2 { margin-top: 18px; font-size: 19px; font-weight: 600; }
.sources ol { padding-left: 20px; }
.prose .sources li { font: 400 13.5px/1.55 var(--ui); color: var(--mute); margin-bottom: 8px; scroll-margin-top: 90px; }
.sources li:target { background: var(--panel); border-radius: 6px; }
.prose .sources a { color: var(--ink-2); }
.prose .see-also {
  margin-top: 36px; padding: 18px 22px; border-radius: 18px; border: 1px solid var(--line); background: var(--card);
  font: 500 15px/1.45 var(--ui);
}
.prose .small { font: 400 13.5px/1.5 var(--ui); color: var(--mute); }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

/* Ссылки кокона — карточками. */
.cluster { margin-top: 44px; }
.prose .cluster h2 { font-size: 19px; font-weight: 600; margin: 0 0 4px; }
.prose .cluster ul { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.prose .cluster li { margin: 0; font: 500 14px/1.4 var(--ui); }
.prose .cluster a {
  display: block; height: 100%; padding: 14px 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.3s;
}
.prose .cluster a:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.25); border-color: transparent; }
@media (max-width: 640px) { .prose .cluster ul { grid-template-columns: 1fr; } }

/* Карточка приложения под подписью: спокойная, кадр слева. */
.app-top {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: center; margin: 0 0 30px;
  padding: 12px; border-radius: 20px; background: var(--card); border: 1px solid var(--line);
}
.app-top .shot { display: block; width: 100%; height: auto; border-radius: 12px; }
.app-top .body { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.prose .app-top .body p { font: 400 14px/1.5 var(--ui); margin: 0; color: var(--ink-2); }
.prose .app-top .body p a { color: var(--ink); font-weight: 600; text-decoration: none; }
.app-top .fine { display: block; margin-top: 4px; font-size: 12px; color: var(--soft); }
.app-top .badge { display: inline-block; line-height: 0; }
.app-top .badge img { height: 40px; width: auto; }
@media (max-width: 640px) { .app-top { grid-template-columns: 1fr; } }

/* Карточка приложения на странице книги. */
.book-cta {
  display: grid; grid-template-columns: 1fr 18rem; gap: 24px; align-items: center;
  margin: 0 0 30px; padding: 24px; border-radius: 24px; background: var(--panel);
}
.prose .book-cta .kicker { font: 600 11px/1.3 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); margin: 0 0 6px; }
.prose .book-cta .title { font: 650 22px/1.2 var(--display); letter-spacing: -0.02em; color: var(--ink); margin: 0 0 10px; }
.book-cta .title span { color: var(--lv-a2-ink); }
.prose .book-cta p { font: 400 15px/1.5 var(--ui); margin: 0 0 14px; color: var(--ink-2); }
.book-cta .badge { display: inline-block; line-height: 0; }
.book-cta .badge img { height: 42px; width: auto; }
.prose .book-cta .fine { font: 400 12px/1.4 var(--ui); color: var(--soft); margin: 10px 0 0; }
.book-cta .shot { display: block; line-height: 0; }
.book-cta .shot img { width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow-book); }
@media (max-width: 640px) {
  .book-cta { grid-template-columns: 1fr; padding: 18px; }
  .book-cta .shot { order: -1; }
}

/* Факты о книге — сеткой, как «Information» в Apple Books. */
.book-head { margin: 0 0 30px; }
dl.facts {
  display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 0; margin: 0;
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden; font: 400 14px/1.45 var(--ui); background: var(--card);
}
dl.facts dt, dl.facts dd { padding: 10px 16px; border-top: 1px solid var(--line); margin: 0; }
dl.facts dt { color: var(--mute); padding-right: 6px; }
dl.facts dd { color: var(--ink); }
dl.facts > :nth-child(-n+4) { border-top: 0; }
@media (max-width: 760px) {
  dl.facts { grid-template-columns: max-content 1fr; }
  dl.facts > :nth-child(-n+4) { border-top: 1px solid var(--line); }
  dl.facts > :nth-child(-n+2) { border-top: 0; }
}
ul.keywords { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.prose ul.keywords li { margin: 0; padding: 6px 12px; background: var(--panel); border-radius: 999px; font: 500 15px/1.2 var(--ui); }
ul.keywords .n { font: 400 12px/1 var(--ui); color: var(--soft); margin-left: 2px; }

/* ------------------------------------------------------------ кнопки */

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: 999px;
  font: 600 14.5px/1 var(--ui); text-decoration: none; white-space: nowrap; cursor: pointer; border: 0;
  transition: transform 0.2s var(--ease), background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn svg { flex: none; }
.btn.btn-light { background: #fff; color: #1d1d1f; }
.btn.btn-light:hover { background: #f1f1f3; }
.btn.btn-glass {
  background: rgba(255, 255, 255, 0.18); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.btn.btn-glass:hover { background: rgba(255, 255, 255, 0.26); }
.btn.btn-dark { background: var(--ink); color: var(--bg); }

/* ------------------------------------------------------------ добавочные блоки: полки */

.bleed { width: min(var(--wrap), 100cqw); margin-left: calc(50% - min(var(--wrap), 100cqw) / 2); }

.shelf { margin-top: 48px; }
.prose > .shelf.bleed:first-of-type { margin-top: 30px; }
.shelf-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.shelf .shelf-title, .prose .shelf .shelf-title {
  font: 700 26px/1.1 var(--display); letter-spacing: -0.025em; margin: 0; color: var(--ink);
}
.shelf .shelf-title a { color: inherit; text-decoration: none; }
.shelf-title a::after { content: " ›"; color: var(--soft); font-weight: 500; }
.shelf-title a:hover::after { color: var(--ink); }
.shelf .shelf-sub, .prose .shelf .shelf-sub { margin: 0; font: 400 14px/1.4 var(--ui); color: var(--mute); }
.shelf-nav { margin-left: auto; display: flex; gap: 8px; align-self: center; }
.shelf-nav[hidden] { display: none; }
.shelf-nav button {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--chip); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.2s, opacity 0.2s, transform 0.2s;
}
.shelf-nav button:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 12%, var(--chip)); }
.shelf-nav button:active:not(:disabled) { transform: scale(0.92); }
.shelf-nav button:disabled { opacity: 0.35; cursor: default; }
@media (hover: none) { .shelf-nav { display: none !important; } }
@media (hover: hover) and (min-width: 900px) {
  .shelf-nav { opacity: 0; transition: opacity 0.3s; }
  .shelf:hover .shelf-nav, .shelf:focus-within .shelf-nav { opacity: 1; }
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.chips[hidden] { display: none; }
.chips-label { align-self: center; min-width: 4.6rem; font: 600 11px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
.shelf-head + .chips:not(:has(+ .chips)) .chips-label { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 0;
  background: var(--chip); color: var(--ink); font: 500 13.5px/1 var(--ui); cursor: pointer;
  transition: background 0.25s, color 0.25s, transform 0.2s var(--ease);
}
.chip .n { font-weight: 400; color: var(--mute); font-size: 12.5px; transition: color 0.25s; }
.chip:hover { background: color-mix(in srgb, var(--ink) 9%, var(--chip)); }
.chip:active { transform: scale(0.95); }
.chip:disabled { opacity: 0.38; cursor: default; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.7; }
.chip[class*="chip-"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--soft)); }
.chip-a1 { --c: var(--lv-a1); } .chip-a2 { --c: var(--lv-a2); } .chip-b1 { --c: var(--lv-b1); }
.chip-b2 { --c: var(--lv-b2); } .chip-c1 { --c: var(--lv-c1); } .chip-c2 { --c: var(--lv-c2); }
.chip-a1[aria-pressed="true"] { background: var(--lv-a1-ink); } .chip-a2[aria-pressed="true"] { background: var(--lv-a2-ink); }
.chip-b1[aria-pressed="true"] { background: var(--lv-b1-ink); } .chip-b2[aria-pressed="true"] { background: var(--lv-b2-ink); }
.chip-c1[aria-pressed="true"] { background: var(--lv-c1-ink); } .chip-c2[aria-pressed="true"] { background: var(--lv-c2-ink); }
.chip[class*="chip-"][aria-pressed="true"] { color: #fff; }
.chip[class*="chip-"][aria-pressed="true"]::before { background: #fff; }
.chip.chip-en::before, .chip.chip-es::before, .chip.chip-fr::before, .chip.chip-de::before, .chip.chip-it::before { display: none; }

.shelf .shelf-row {
  list-style: none; margin: 0; padding: 6px 2px 14px;
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 5 * 22px) / 6); gap: 22px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.shelf .shelf-row::-webkit-scrollbar { display: none; }
.prose.has-toc .shelf .shelf-row, .after .shelf-row { grid-auto-columns: calc((100% - 5 * 20px) / 6); gap: 20px; }
.shelf .card, .prose .shelf .card {
  position: relative; scroll-snap-align: start; min-width: 0; margin: 0; padding: 0;
  font: 400 15px/1.5 var(--ui); color: var(--ink);
}
.prose .shelf .tiles li { margin: 0; font: 400 15px/1.5 var(--ui); }
.card[hidden] { display: none; }
.shelf .card-link { display: block; color: inherit; text-decoration: none; }
.card-cover {
  display: block; position: relative; aspect-ratio: 2 / 3; border-radius: 3px 7px 7px 3px; background: var(--panel);
  box-shadow: var(--shadow-book); transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}
.card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
/* Корешок и блик, чтобы обложка читалась как книга. */
.card-cover::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.22) 0, rgba(255, 255, 255, 0.22) 2.5%, rgba(0, 0, 0, 0.04) 5%,
    transparent 9%, transparent 96%, rgba(0, 0, 0, 0.06));
}
.card-link:hover .card-cover, .card-link:focus-visible .card-cover { transform: translateY(-8px) scale(1.02); box-shadow: var(--shadow-lift); }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible .card-cover { outline: 3px solid var(--focus); outline-offset: 3px; }
.card-text { display: flex; gap: 10px; margin-top: 12px; }
.rank { font: 700 26px/1 var(--display); color: var(--ink); min-width: 18px; letter-spacing: -0.03em; }
.card-body { min-width: 0; display: block; }
.card-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font: 500 14px/1.25 var(--ui); color: var(--ink);
}
.card-author { display: block; margin-top: 2px; font-size: 13px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; margin-top: 5px; font-size: 12px; color: var(--mute); }
.card-meta .level { height: 18px; font-size: 10.5px; padding: 0 5px; min-width: 0; border-radius: 5px; }
.card-lang::before { content: "· "; }
.shelf .card-dl {
  position: absolute; right: 8px; top: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #111; background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); opacity: 0; transform: scale(0.8);
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.shelf .card:hover .card-dl, .shelf .card-dl:focus-visible { opacity: 1; transform: none; }
.shelf .card:hover .card-dl { transform: translateY(-8px); }
@media (hover: none) {
  .shelf .card-dl { opacity: 1; transform: none; width: 30px; height: 30px; right: 6px; top: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .shelf .shelf-row.shuffle .card:not([hidden]) { animation: card-in 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }

@media (max-width: 1099px) {
  .shelf .shelf-row, .prose.has-toc .shelf .shelf-row, .after .shelf-row { grid-auto-columns: calc((100% - 3 * 18px) / 4.4); gap: 18px; }
}
@media (max-width: 640px) {
  .shelf { margin-top: 38px; }
  .shelf .shelf-title, .prose .shelf .shelf-title { font-size: 22px; }
  .shelf .shelf-row, .prose.has-toc .shelf .shelf-row, .after .shelf-row {
    grid-auto-columns: 40%; gap: 14px; margin: 0 calc(-1 * var(--gutter)); padding: 6px var(--gutter) 14px;
    scroll-padding: 0 var(--gutter);
  }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)) 12px; padding: 0 var(--gutter); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}

/* Полка после текста статьи и страницы книги. */
.after.shelf {
  max-width: calc(var(--col) + 64px + var(--side)); width: calc(100% - 2 * var(--gutter)); margin: 64px auto 0;
  padding: 26px 28px 18px; border-radius: 26px; background: var(--panel);
}
@media (max-width: 640px) {
  .after.shelf { width: auto; margin: 48px 0 0; border-radius: 0; padding: 22px var(--gutter) 10px; }
}

/* ------------------------------------------------------------ плитки уровней */

.shelf .tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.shelf .tile {
  position: relative; display: flex; flex-direction: column; height: 200px; padding: 18px; border-radius: 22px;
  overflow: hidden; color: #fff; text-decoration: none; isolation: isolate;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.tile:hover { transform: scale(1.025); box-shadow: 0 24px 40px -22px rgba(0, 0, 0, 0.5); }
.tile-a1 { background: linear-gradient(140deg, #86efac, var(--lv-a1) 55%, #fde68a); }
.tile-a2 { background: linear-gradient(140deg, #5eead4, #0ea5a4 55%, #a3d977); }
.tile-b1 { background: linear-gradient(140deg, #7dd3fc, #2563eb 60%, #a5b4fc); }
.tile-b2 { background: linear-gradient(140deg, #a5b4fc, #4f46e5 60%, #e9a8f5); }
.tile-c1 { background: linear-gradient(140deg, #e879f9, #7c3aed 60%, #f9a8d4); }
.tile-c2 { background: linear-gradient(140deg, #fb7185, #db2777 60%, #fdba74); }
.tile-lv { font: 700 32px/1 var(--display); letter-spacing: -0.02em; }
.tile-name { font: 500 14px/1.25 var(--ui); margin-top: 6px; max-width: 60%; }
.tile-n { margin-top: auto; font: 500 12.5px/1.3 var(--ui); opacity: 0.92; max-width: 55%; }
.fan { position: absolute; right: -10px; bottom: -30px; width: 140px; height: 140px; z-index: -1; }
.fan img {
  position: absolute; bottom: 0; width: 64px; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px 6px 6px 3px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35); transform-origin: bottom center; transition: transform 0.5s var(--ease);
}
.fan img:nth-child(1) { right: 66px; transform: rotate(-14deg); }
.fan img:nth-child(2) { right: 36px; transform: rotate(-2deg); z-index: 2; }
.fan img:nth-child(3) { right: 6px; transform: rotate(12deg); }
.tile:hover .fan img:nth-child(1) { transform: rotate(-22deg) translateX(-8px); }
.tile:hover .fan img:nth-child(2) { transform: translateY(-10px); }
.tile:hover .fan img:nth-child(3) { transform: rotate(20deg) translateX(8px); }
@media (max-width: 1099px) { .shelf .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .shelf .tiles {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 6px; gap: 12px;
  }
  .shelf .tiles::-webkit-scrollbar { display: none; }
  .shelf .tiles li { flex: 0 0 62%; scroll-snap-align: start; }
  .tile { height: 170px; }
}

/* ------------------------------------------------------------ баннер на главной */

.banner {
  position: relative; height: 480px; margin: 28px auto 0; max-width: var(--wrap); border-radius: 30px;
  overflow: hidden; color: #fff; background: #26262a; isolation: isolate;
}
.slide {
  position: absolute; inset: 0; display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity 1s ease, visibility 0s linear 1s;
}
.slide.is-on { opacity: 1; visibility: visible; transition: opacity 1s ease, visibility 0s; }
.slide-bg {
  position: absolute; inset: -80px; z-index: -2; background: var(--cover) center / cover no-repeat;
  filter: blur(60px) saturate(1.5) brightness(0.75); transform: scale(1.2); transition: transform 6s ease-out;
}
.slide.is-on .slide-bg { transform: scale(1.05); }
.slide::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.05) 70%);
}
.slide-text { padding: 0 0 18px 64px; max-width: 580px; }
.eyebrow { margin: 0; font: 600 12px/1.2 var(--ui); letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.85; }
.slide-title { margin: 14px 0 0; font: 700 54px/1.02 var(--display); letter-spacing: -0.035em; text-wrap: balance; }
.slide-title a { color: inherit; text-decoration: none; }
.slide-author { margin: 10px 0 0; font-size: 17px; opacity: 0.88; }
.slide-desc {
  margin: 14px 0 0; font-size: 15px; line-height: 1.5; opacity: 0.85; max-width: 470px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.strip { display: flex; margin: 22px 0 0; }
.strip div { padding: 0 18px; border-left: 1px solid rgba(255, 255, 255, 0.25); }
.strip div:first-child { padding-left: 0; border: 0; }
.strip dt { font: 500 10.5px/1.2 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.68; }
.strip dd { margin: 3px 0 0; font: 600 17px/1.2 var(--display); white-space: nowrap; }
.slide-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.slide-cover { display: flex; justify-content: center; perspective: 1200px; line-height: 0; }
.slide-cover img {
  width: 250px; aspect-ratio: 2 / 3; height: auto; object-fit: cover; border-radius: 4px 10px 10px 4px;
  box-shadow: 0 40px 70px -20px rgba(0, 0, 0, 0.6), 0 10px 20px rgba(0, 0, 0, 0.25);
  transform: rotateY(calc(-14deg + var(--ry, 0deg))) rotateX(calc(4deg + var(--rx, 0deg))) translateX(40px); opacity: 0;
  transition: transform 1.1s var(--ease), opacity 1s;
}
.slide.is-on .slide-cover img { transform: rotateY(calc(-8deg + var(--ry, 0deg))) rotateX(calc(2deg + var(--rx, 0deg))); opacity: 1; }
.slide-cover:hover img { transition: transform 0.25s ease-out, opacity 1s; }
.dots { position: absolute; bottom: 22px; left: 64px; z-index: 5; display: flex; gap: 7px; }
.dots[hidden] { display: none; }
.dots button {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.42);
  cursor: pointer; transition: width 0.4s var(--ease), background 0.4s;
}
.dots button.on { width: 26px; background: #fff; }
@media (max-width: 900px) {
  .slide-text { padding-left: 40px; }
  .slide-title { font-size: 42px; }
  .dots { left: 40px; }
}
@media (max-width: 640px) {
  .banner { height: 600px; border-radius: 24px; margin-top: 14px; }
  .slide { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-items: start; }
  .slide-cover { order: -1; padding-top: 28px; }
  .slide-cover img { width: 140px; }
  .slide-text { padding: 18px 22px 0; }
  .slide-title { font-size: 32px; margin-top: 10px; }
  .slide-author { font-size: 15px; margin-top: 6px; }
  .slide-desc { -webkit-line-clamp: 2; font-size: 14px; }
  .strip div { padding: 0 11px; }
  .strip dd { font-size: 14.5px; }
  .slide-actions { margin-top: 20px; }
  .slide-actions .btn { height: 40px; padding: 0 16px; font-size: 14px; }
  .dots { left: 22px; bottom: 18px; }
}
@media (max-width: 360px) {
  .banner { height: 630px; }
  .strip div:last-child { display: none; }
}

/* Заголовок главной под баннером. */
.k-home .prose { margin-top: 48px; }
.k-home .prose h1 { font: 700 40px/1.05 var(--display); letter-spacing: -0.03em; }

/* ------------------------------------------------------------ страница книги: шапка в стиле Apple Books */

.book-hero {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "cover text" "strip strip";
  column-gap: 44px; align-items: end; margin: 0 0 30px; padding: 40px 40px 0; border-radius: 30px;
  overflow: hidden; color: #fff; background: #26262a; isolation: isolate;
}
.book-hero .hero-bg {
  position: absolute; inset: -90px; z-index: -2; background: var(--cover) center / cover no-repeat;
  filter: blur(60px) saturate(1.5) brightness(0.7); transform: scale(1.15);
}
.book-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.08) 75%), linear-gradient(0deg, rgba(0, 0, 0, 0.35), transparent 40%);
}
.hero-cover { grid-area: cover; perspective: 1000px; line-height: 0; align-self: start; }
.hero-cover img {
  width: 230px; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px 10px 10px 4px;
  box-shadow: 0 30px 50px -18px rgba(0, 0, 0, 0.65), 0 6px 14px rgba(0, 0, 0, 0.25);
  transform: rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg)); transition: transform 0.25s ease-out;
  view-transition-name: book-cover;
}
.hero-text { grid-area: text; min-width: 0; padding-bottom: 8px; }
.book-hero .crumbs { color: rgba(255, 255, 255, 0.7); }
.prose .book-hero .crumbs a:hover { color: #fff; }
.prose .book-hero h1 { font: 700 42px/1.06 var(--display); letter-spacing: -0.03em; color: #fff; margin: 0 0 14px; }
.prose .book-hero h1 i { font-style: normal; }
.prose .book-hero .lead { font: 400 16.5px/1.55 var(--ui); color: rgba(255, 255, 255, 0.9); margin: 0 0 12px; max-width: 640px; }
.prose .book-hero .lead i { font-style: normal; font-weight: 600; }
.prose .book-hero .meta { color: rgba(255, 255, 255, 0.62); margin: 0; }
.book-hero .meta a { color: rgba(255, 255, 255, 0.8); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: flex-start; }

.book-strip {
  grid-area: strip; display: grid; grid-template-columns: repeat(5, 1fr); margin: 34px -40px 0; padding: 16px 12px;
  background: rgba(0, 0, 0, 0.22); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.book-strip div { text-align: center; padding: 2px 8px; border-left: 1px solid rgba(255, 255, 255, 0.16); }
.book-strip div:first-child { border: 0; }
.book-strip dt { font: 600 10.5px/1.2 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.book-strip dd { margin: 5px 0 0; font: 700 21px/1.15 var(--display); letter-spacing: -0.01em; color: #fff; }
.book-strip dd.sub { margin: 2px 0 0; font: 400 11.5px/1.3 var(--ui); color: rgba(255, 255, 255, 0.66); }

/* Kindle: две подсказки, без JS тоже открывается. */
details.kindle { position: relative; }
details.kindle > summary { list-style: none; }
details.kindle > summary::-webkit-details-marker { display: none; }
details.kindle[open] > summary { background: rgba(255, 255, 255, 0.3); }
.kindle-panel {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 10; width: min(340px, calc(100vw - 48px));
  padding: 14px 16px; border-radius: 16px; background: var(--card); color: var(--ink);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.5); animation: drop-in 0.22s var(--ease);
}
.prose .kindle-panel p, .prose .kindle-panel li { font: 400 13.5px/1.5 var(--ui); color: var(--ink-2); }
.prose .kindle-panel p { margin: 0 0 6px; font-weight: 600; color: var(--ink); }
.prose .kindle-panel ol { margin: 0; padding-left: 18px; }
.prose .kindle-panel li { margin: 0 0 6px; }

@media (max-width: 760px) {
  .book-hero { grid-template-columns: 1fr; grid-template-areas: "cover" "text" "strip"; padding: 26px 22px 0; border-radius: 24px; }
  .hero-cover { justify-self: center; margin-bottom: 22px; }
  .hero-cover img { width: 150px; }
  .prose .book-hero h1 { font-size: 30px; }
  .prose .book-hero .lead { font-size: 15.5px; }
  .book-strip { grid-template-columns: repeat(3, 1fr); row-gap: 14px; margin: 26px -22px 0; }
  .book-strip div:nth-child(4) { border: 0; }
  .hero-actions .btn { height: 40px; padding: 0 16px; font-size: 14px; }
}
@media (max-width: 640px) {
  .k-book main { padding: 0 10px; }
  .k-book .prose { margin-top: 12px; }
  .k-book .prose > :not(.book-hero) { margin-left: 6px; margin-right: 6px; }
}

/* ------------------------------------------------------------ плашка загрузки */

.dl-toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 1000; width: 330px; max-width: calc(100vw - 32px);
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 18px;
  background: rgba(20, 20, 22, 0.94); color: #fff; font: 400 13px/1.35 var(--ui);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transform: translateY(20px) scale(0.96); opacity: 0; pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.25, 1.2), opacity 0.3s;
}
.dl-toast.on { transform: none; opacity: 1; }
.dl-toast img { width: 34px; height: 51px; object-fit: cover; border-radius: 2px 4px 4px 2px; flex: none; }
.dl-toast .t { flex: 1; min-width: 0; }
.dl-toast b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-toast small { display: block; color: #a1a1aa; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-toast .bar { display: block; height: 4px; border-radius: 9px; background: rgba(255, 255, 255, 0.15); margin-top: 8px; overflow: hidden; }
.dl-toast .bar i { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, #5eead4, #7dd3fc, #a5b4fc); transition: width 1.3s cubic-bezier(0.4, 0.1, 0.2, 1); }
.dl-toast .ok {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.1); color: #5eead4; transform: scale(0); transition: transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.dl-toast.done .ok { transform: none; }
@media (max-width: 560px) { .dl-toast { right: 16px; bottom: 16px; } }

/* ------------------------------------------------------------ переходы между страницами */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  html { scroll-behavior: smooth; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.22s; }
::view-transition-group(book-cover) { animation-duration: 0.5s; animation-timing-function: cubic-bezier(0.2, 0.9, 0.25, 1); }
::view-transition-group(site-header) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------ тёмная тема: детали */

@media (prefers-color-scheme: dark) {
  .langs a.on { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
  .btn.btn-light { background: #fff; color: #111; }
  .shelf .card-dl { background: rgba(28, 28, 31, 0.92); color: #fff; }
  .wordmark svg rect { fill: #2a2f37; }
}

/* ------------------------------------------------------------ печать */

@media print {
  .site-header, .site-footer .footer-cols, .scale, .toc, .app-top, .demo-controls, .calc, .shelf, .banner,
  .hero-actions, .book-strip, .after, .dl-toast { display: none !important; }
  .book-hero { color: #000; background: none; padding: 0; }
  .book-hero .hero-bg, .book-hero::after { display: none; }
  .prose .book-hero h1, .prose .book-hero .lead, .prose .book-hero .meta { color: #000; }
}

/* ------------------------------------------------------------ коконы: таблицы карточками (2026-11-19) */
/* Строки таблиц с книгами и сериями — карточки с обложкой слева. Текст ячеек и порядок те же (card_tables()
   в build.py добавляет только обложку в первую ячейку и классы cards / cards-2 / series). */

.table-wrap:has(> table.cards) { border: 0; border-radius: 0; background: none; overflow: visible; }
table.cards.cards { display: block; }
table.cards.cards caption { display: block; padding: 0 2px 14px; border: 0; }
table.cards.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
table.cards.cards tbody, table.cards.cards tfoot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
table.cards.cards tr {
  position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px 18px;
  align-content: start; min-height: 142px; padding: 16px 18px 16px 112px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}
table.cards.cards:not(.cards-2) tr { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
table.cards.cards.cards-2 tr { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px 16px; }
table.cards.cards tr:hover { background: var(--card); transform: translateY(-2px); border-color: transparent; box-shadow: 0 18px 36px -22px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--line); }
table.cards.cards th, table.cards.cards td {
  display: block; padding: 0 !important; border: 0; text-align: left; white-space: normal; background: none; min-width: 0;
}
table.cards.cards tr > :first-child { grid-column: 1 / -1; font-size: 15.5px; font-weight: 600; line-height: 1.3; }
table.cards.cards tr > :first-child a { color: var(--ink); }
table.cards.cards .by { display: block; margin-top: 2px; color: var(--mute); font-size: 13px; font-weight: 400; }
table.cards.cards td { font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
table.cards.cards td[data-label]::before {
  content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 500; letter-spacing: 0.02em;
  color: var(--soft);
}
table.cards.cards td.form { grid-column: 1 / -1; margin-top: -4px; font-style: italic; color: var(--mute); }
table.cards.cards tfoot tr { min-height: 0; padding-left: 18px; background: var(--panel); }
table.books.cards th.book .bk { display: block; }
table.cards .row-cover, table.cards th.book .thumb {
  position: absolute; left: 18px; top: 16px; width: 74px; aspect-ratio: 2 / 3; line-height: 0;
  border-radius: 3px 6px 6px 3px; overflow: hidden; box-shadow: var(--shadow-book);
  transition: transform 0.35s var(--ease);
}
table.cards .row-cover img, table.cards th.book .thumb img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 0; box-shadow: none; transform: none;
}
table.cards tr:hover .row-cover, table.cards tr:hover th.book .thumb { transform: translateY(-3px) rotate(-1.5deg); }
@media (min-width: 900px) {
  table.cards.cards.cards-2 tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  table.cards.cards tr { padding: 14px 14px 14px 96px; min-height: 124px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 14px; }
  table.cards.cards:not(.cards-2) tr { grid-template-columns: minmax(0, 1fr); }
  table.cards .row-cover, table.cards th.book .thumb { left: 14px; top: 14px; width: 66px; }
}

/* Нарисованная «обложка» серии или книги вне каталога: чужие обложки не берём. Подписи — из атрибутов. */
.drawn {
  display: block; position: relative; overflow: hidden; container-type: inline-size; aspect-ratio: 2 / 3;
  border-radius: 3px 6px 6px 3px; color: #fff;
  background:
    radial-gradient(120% 70% at 85% 0%, rgba(255, 255, 255, 0.28), transparent 60%),
    linear-gradient(160deg, var(--c1, #a1a1aa), var(--c2, #3f3f46));
  box-shadow: inset 5px 0 0 rgba(0, 0, 0, 0.14), inset 6px 0 0 rgba(255, 255, 255, 0.12);
}
.drawn::before {
  content: attr(data-name); position: absolute; left: 12%; right: 9%; top: 13%;
  font: 600 12.5cqw/1.12 var(--serif); letter-spacing: -0.01em; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.drawn::after {
  content: attr(data-by) "\A" attr(data-lv); white-space: pre-line; position: absolute; left: 12%; right: 9%; bottom: 8%;
  font: 600 8.5cqw/1.3 var(--ui); letter-spacing: 0.03em; text-transform: uppercase; opacity: 0.92;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-cover .drawn { width: 100%; height: 100%; border-radius: inherit; }

/* Полка «книги с этой страницы» вверху статьи. */
.shelf.cocoon { margin-top: 26px; margin-bottom: 30px; padding: 22px 0 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Карточка книги при наведении на ссылку в тексте (site.js). */
.book-pop {
  position: absolute; z-index: 70; width: 310px; display: flex; gap: 14px; padding: 14px; border-radius: 18px;
  background: var(--card); color: var(--ink); text-decoration: none; font: 400 13px/1.4 var(--ui);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--line);
  opacity: 0; transform: translateY(6px) scale(0.98); pointer-events: none;
  transition: opacity 0.2s, transform 0.25s var(--ease);
}
.book-pop.on { opacity: 1; transform: none; pointer-events: auto; }
.book-pop img { flex: none; width: 64px; height: 96px; object-fit: cover; border-radius: 3px 6px 6px 3px; box-shadow: var(--shadow-book); }
.book-pop b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.book-pop .a { display: block; margin-top: 2px; color: var(--mute); }
.book-pop .m { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; color: var(--mute); font-size: 12.5px; }
.book-pop .go { display: block; margin-top: 8px; font-weight: 500; color: var(--link); }

/* Карточка приложения в общем стиле: мягкий градиент, кадр как экран. */
.app-top {
  border: 0; border-radius: 24px; padding: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--lv-a2) 9%, var(--card)), color-mix(in srgb, var(--lv-b2) 9%, var(--card)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent);
}
.app-top .shot { border-radius: 14px; box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.45); transition: transform 0.4s var(--ease); }
.app-top:hover .shot { transform: translateY(-2px) rotate(-0.6deg); }

/* Ссылка в шапке книги (английский оригинал перевода) — белая, как текст шапки. */
.prose .book-hero .lead a { color: #fff; text-decoration-color: rgba(255, 255, 255, 0.5); }
.prose .book-hero .lead a:hover { text-decoration-color: #fff; }
