/* ═══════════════════════════════════════════════════════
   ЛИЛА — Книга 1 · Экранная версия  
   Премиум-дизайн: минимализм, читаемость, ритм
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a0e;
  --bg-2: #111116;
  --paper: #f5f0e8;
  --paper-translucent: rgba(245, 240, 232, 0.03);
  --paper-edge: #e8e0d0;
  --ink: #1a1a1e;
  --ink-soft: #555;
  --ink-muted: #888;
  --accent: #a8884a;
  --accent-soft: #c4a86a;
  --accent-dim: rgba(168, 136, 74, 0.2);
  --accent-line: rgba(168, 136, 74, 0.12);
  --gold: #a8884a;
  --gold-soft: #c4a86a;
  --gold-dim: rgba(168, 136, 74, 0.2);
  --line: rgba(255, 255, 255, 0.06);
  --shadow: rgba(0, 0, 0, 0.4);
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
  --book-ratio: 105 / 148;
  --body-size: 9.5pt;
  --body-lh: 1.52;
  --indent: 1.5em;
  --topbar-h: 52px;
  --bottombar-h: 100px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: -webkit-fill-available;
}

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  background: var(--bg);
  color: #ddd;
  font-family: var(--sans);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  padding:
    var(--safe-top)
    var(--safe-right)
    var(--safe-bottom)
    var(--safe-left);
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  max-height: 100dvh;
  max-height: -webkit-fill-available;
  overflow: hidden;
}

/* ── Subtle background depth ── */
.stars { display: none; }

.topbar, .bottombar, .stage, .toc-panel { position: relative; z-index: 2; }

/* ── Top bar ── */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: var(--topbar-h);
  padding: 6px 12px 4px;
  background: rgba(10, 10, 14, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--accent-line);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  flex: 1;
}
.brand-mark {
  font-family: var(--display);
  letter-spacing: 0.32em;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.brand-sub {
  font-size: 9px;
  color: #777;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

/* ── Control buttons ── */
.icon-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent-soft);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  font-size: 18px;
}
.icon-btn:hover { background: rgba(168, 136, 74, 0.1); color: #d4b86a; }
.icon-btn:active { background: rgba(168, 136, 74, 0.18); }

/* ── Book switcher ── */
.book-switcher {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.switcher-btn {
  appearance: none;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #777;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 6px 10px;
  line-height: 1;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.switcher-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent-soft);
}

.switcher-btn.is-active {
  color: #f5f0e8;
  background: var(--accent);
  border-color: var(--accent);
}

.top-link-print {
  text-decoration: none;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-soft);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 5px 7px;
  line-height: 1;
}
.top-link-print:hover { background: rgba(168, 136, 74, 0.1); }

/* ── Stage / Reader area ── */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: stretch;
  gap: 2px;
  padding: 0 8px;
}

.nav-arrow {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  align-self: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.nav-arrow:hover { opacity: 0.8; }
.nav-arrow:disabled { opacity: 0.08; cursor: default; }

/* ── Book page ── */
.book {
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  perspective: 1800px;
}

.page-sheet {
  width: min(680px, 100%);
  height: 100%;
  max-height: 100%;
  aspect-ratio: var(--book-ratio);
  max-width: calc((100dvh - var(--topbar-h) - var(--bottombar-h) - 20px) * var(--book-ratio));
  background: var(--paper);
  border-radius: 12px;
  box-shadow:
    0 20px 60px var(--shadow),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 10px 0 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: center center;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s ease;
}

.page-sheet.turning-next { animation: turnNext 0.4s ease; }
.page-sheet.turning-prev { animation: turnPrev 0.4s ease; }

@keyframes turnNext {
  0% { transform: rotateY(0) scale(1); opacity: 1; }
  40% { transform: rotateY(-6deg) scale(0.99); opacity: 0.9; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}
@keyframes turnPrev {
  0% { transform: rotateY(0) scale(1); opacity: 1; }
  40% { transform: rotateY(6deg) scale(0.99); opacity: 0.9; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

/* ── Page content ── */
.page-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 28px 32px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
  font-size: var(--body-size);
  line-height: var(--body-lh);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  font-variant-ligatures: common-ligatures;
  font-kerning: normal;
  hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
  hyphenate-limit-zone: 4%;
}

/* ── Page footer ── */
.page-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--ink-muted);
  font-size: 8px;
  font-family: var(--sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
#page-num { flex-shrink: 0; text-align: right; }
#page-num .print-num { color: var(--accent); font-weight: 600; }

/* ── Loading state ── */
.loading {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  font-family: var(--serif);
  font-size: 20px;
}

/* ═══════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════ */

/* ── Headings ── */
.page-content h1,
.page-content h2,
.page-content h3 {
  font-family: var(--display);
  font-weight: 500;
  color: #111;
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.page-content h1 {
  font-size: clamp(24px, 6vw, 42px);
  text-align: center;
  line-height: 1.15;
}
.page-content h2 {
  font-size: clamp(18px, 4vw, 24px);
  line-height: 1.2;
}
.page-content h2.chapter-open {
  margin: 0 0 0.55em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.page-content h3 {
  font-size: clamp(15px, 3.2vw, 17px);
  font-weight: 600;
  color: #222;
  margin: 0.7em 0 0.35em;
}
.page-content h3.cont { display: none; }

.page-content h4 {
  font-family: var(--sans);
  color: #555;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 11px;
  text-transform: uppercase;
  margin: 1em 0 0.35em;
}

.page-content h5,
.page-content h5.cell-sub {
  font-family: var(--display);
  color: #222;
  font-weight: 600;
  font-style: italic;
  font-size: 11pt;
  letter-spacing: 0.02em;
  margin: 0.6em 0 0.2em;
}

/* ── Paragraphs ── */
.page-content p {
  font-family: var(--serif);
  font-size: 1em;
  line-height: var(--body-lh);
  color: var(--ink);
  margin: 0;
  text-align: justify;
  hyphens: auto;
  hyphenate-limit-chars: 6 3 3;
  overflow-wrap: break-word;
  word-break: normal;
  text-indent: var(--indent);
}

.page-content p + p {
  margin-top: 0;
}

/* Remove indent after block elements */
.page-content h2 + p,
.page-content h2 + .lead,
.page-content h3 + p,
.page-content h4 + p,
.page-content .lead,
.page-content .lead + p,
.page-content .part-lead,
.page-content p.lead-in,
.page-content p.lead-in + p,
.page-content p.bullet,
.page-content p.q,
.page-content blockquote,
.page-content blockquote + p,
.page-content ul + p,
.page-content ol + p,
.page-content .cell-q-list + p,
.page-content li > p.num-body {
  text-indent: 0;
}

/* ── Lead ── */
.page-content .lead {
  color: #444;
  font-size: clamp(15px, 3.8vw, 19px);
  font-style: italic;
  line-height: 1.4;
}
.page-content .part-lead {
  color: #555;
  font-size: clamp(14px, 3.6vw, 17px);
  font-style: italic;
  margin-bottom: 0.4em;
}

/* ── Lead-in (small uppercase header before list) ── */
.page-content p.lead-in {
  font-family: var(--sans);
  color: #555;
  font-weight: 600;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.65em;
  margin-bottom: 0.15em;
  text-indent: 0;
}

/* ── Highlight / Utility ── */
.page-content .gold { color: var(--accent); }
.page-content .eyebrow { display: none; }
.page-content .chapter-label { display: none; }

/* ── Bullet paragraphs ── */
.page-content p.bullet {
  padding-left: 0.6em;
  border-left: 0.5px solid var(--accent-dim);
  color: #444;
  margin: 0.15em 0;
  text-indent: 0;
}

/* ── Questions (italic, indented) ── */
.page-content p.q {
  color: #444;
  font-style: italic;
  padding-left: 0.5em;
  border-left: 1.5px solid var(--accent-dim);
  margin: 0.15em 0;
  text-indent: 0;
}

/* ── Blockquote ── */
.page-content blockquote {
  margin: 0.6em 0 0.6em 0;
  padding: 0.2em 0 0.2em 0.7em;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: clamp(16px, 4vw, 22px);
  line-height: 1.35;
  font-style: italic;
  color: #222;
  text-indent: 0;
}

.page-content blockquote.cell-message {
  margin: 0.7em 0.2em;
  padding: 0.4em 0 0.4em 0.7em;
  border-left: 2.5px solid var(--accent);
  font-style: italic;
  font-size: 11pt;
  color: #333;
}

/* ── Sign ── */
.page-content .sign {
  text-align: right;
  color: var(--accent);
  font-family: var(--display);
  letter-spacing: 0.04em;
  font-style: italic;
}

/* ── Stats ── */
.page-content .stats {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #777;
}

/* ── Footer line ── */
.page-content .footer-line {
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--accent);
  margin-top: 16px;
}

/* ── Cell block ── */
.page-content .cell-block {
  margin-top: 0.8em;
}

.page-content .cell-questions-extended {
  margin-top: 1em;
  padding-top: 0.35em;
  border-top: 0.5px solid var(--accent-line);
}

/* ── Question topic ── */
.page-content .q-topic h5,
.page-content h5.cell-sub {
  color: #444;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   LISTS
   ═══════════════════════════════════════════════════════ */

.page-content ul.cell-q-list,
.page-content ul.cell-list,
.page-content ul.bare-list,
.page-content ul.query-list,
.page-content ul.x-list,
.page-content ol.num-list {
  margin: 0.15em 0 0.35em 1.15em;
  padding: 0;
}

.page-content ol.num-list {
  list-style: decimal;
  padding-left: 1.3em;
}

.page-content .num-title {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.05em;
}

.page-content .num-body {
  margin: 0 0 0.2em;
  text-indent: 0;
  color: var(--ink);
}

.page-content ul.cell-q-list li,
.page-content ul.cell-list li,
.page-content ul.bare-list li,
.page-content ul.query-list li,
.page-content ul.x-list li,
.page-content ol.num-list li {
  margin-bottom: 0.2em;
}

.page-content ul.x-list li {
  color: #555;
}

/* ═══════════════════════════════════════════════════════
   COVER / IMAGE PAGES
   ═══════════════════════════════════════════════════════ */

.page-cover, .page-image {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-cover img, .page-image img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(65vh, 580px);
  object-fit: contain;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.page-cover .cover-caption,
.page-image .img-caption {
  margin-top: 8px;
  text-align: center;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #777;
}

/* Photo cell — full illustration */
.page-image.cell-photo {
  justify-content: flex-start;
  padding-top: 4px;
}
.page-image.cell-photo img {
  max-height: min(68vh, 520px);
  object-fit: cover;
  width: 100%;
  border-radius: 4px;
}
.page-image.cell-photo .img-caption {
  font-family: var(--serif);
  font-size: 11pt;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
  line-height: 1.4;
  padding: 0 4px;
}

/* ── Title block ── */
.page-title-block {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 12px 4px;
}

/* ═══════════════════════════════════════════════════════
   TABLE OF CONTENTS
   ═══════════════════════════════════════════════════════ */

.toc {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}

.toc li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 0;
  padding: 7px 0;
  border-bottom: 0.5px solid var(--accent-line);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.toc-leader {
  display: block;
  min-width: 12px;
  margin: 0 8px;
  border-bottom: 0.5px dotted var(--accent-dim);
  transform: translateY(-0.3em);
  align-self: end;
}

.toc-page {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
  min-width: 2.5ch;
  text-align: right;
  flex-shrink: 0;
}

.toc li:hover { color: var(--accent); }

.toc li.sub {
  padding-left: 12px;
  font-size: 13px;
  color: #555;
}

.toc li span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.page-content.page-toc {
  padding: 18px 24px 14px;
}
.page-content.page-toc h2 {
  font-family: var(--display);
  color: #111;
  text-align: center;
  margin: 0 0 14px;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.toc-cells-title,
.toc-note {
  font-family: var(--sans);
  color: #777;
}
.toc-cells-title {
  margin: 20px 0 6px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #666;
}
.toc-note {
  margin-top: 16px;
  font-size: 11px;
  text-align: center;
}
.toc-cells li { font-size: 13px; }

.toc-manuscript .toc-part {
  list-style: none;
  margin-top: 10px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #666;
  border-bottom: none;
  cursor: default;
  display: list-item;
}
.toc-manuscript .toc-part-title {
  list-style: none;
  font-family: var(--display);
  font-size: 18px;
  color: #111;
  margin: 3px 0 8px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  cursor: default;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.toc-manuscript .toc-dash,
.toc-manuscript .toc-section {
  font-style: italic;
  color: #666;
}
.toc-manuscript .toc-item,
.toc-manuscript .toc-dash,
.toc-manuscript .toc-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   SIDE TOC PANEL
   ═══════════════════════════════════════════════════════ */

.toc-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: min(340px, 100vw);
  height: 100dvh;
  height: 100vh;
  background: rgba(10, 10, 14, 0.98);
  border-right: 1px solid var(--accent-line);
  transform: translateX(-105%);
  transition: transform 0.3s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.toc-panel.open { transform: translateX(0); }

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--accent-line);
}

.toc-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--accent-soft);
  font-weight: 500;
}

.toc-nav {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 8px 20px;
}

.toc-nav button {
  width: 100%;
  text-align: left;
  appearance: none;
  border: none;
  background: transparent;
  color: #ccc;
  font-family: var(--serif);
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: baseline;
}

.toc-btn-page {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
  min-width: 2.5ch;
  text-align: right;
}

.toc-nav button .toc-btn-page:empty::after {
  content: "—";
  opacity: 0.4;
}

.toc-section-label {
  padding: 14px 12px 4px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #666;
}

.toc-nav button:hover,
.toc-nav button.active {
  background: rgba(168, 136, 74, 0.08);
  color: var(--accent-soft);
}

.toc-nav button.sub { padding-left: 20px; font-size: 13px; color: #888; }

.toc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 15;
}
.toc-backdrop.show { opacity: 1; pointer-events: auto; }

/* ═══════════════════════════════════════════════════════
   BOTTOM BAR
   ═══════════════════════════════════════════════════════ */

.bottombar {
  flex: 0 0 auto;
  padding: 4px 12px 8px;
  flex-shrink: 0;
  z-index: 40;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
  background: rgba(10, 10, 14, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.mobile-nav { display: none; }

#scrubber {
  width: 100%;
  accent-color: var(--accent);
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.bottom-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 10px;
  color: #777;
  font-family: var(--sans);
  letter-spacing: 0.03em;
}

#page-title-bottom {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint { opacity: 0.6; white-space: nowrap; }

/* Desktop layout */
@media (min-width: 721px) {
  .bottombar {
    padding: 4px 18px 12px;
  }
  .mobile-nav { display: block; }
  .mobile-nav-btn { display: none; }
  .mobile-nav-center { width: 100%; }
  #progress-label {
    display: inline-block;
    margin-bottom: 2px;
    color: #777;
  }
  #page-title-bottom { display: none; }
  .bottom-meta .hint { display: inline; }
}

/* ═══════════════════════════════════════════════════════
   MOBILE (≤720px)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 720px) {
  :root {
    --topbar-h: 80px;
    --bottombar-h: 118px;
    --body-size: 10.5pt;
  }

  .brand-mark {
    letter-spacing: 0.16em;
    font-size: 12px;
  }

  #btn-fs { display: none; }

  .stage {
    grid-template-columns: 1fr;
    padding: 0 8px 4px;
    gap: 0;
  }

  .nav-arrow { display: none; }

  .page-sheet {
    width: 100%;
    border-radius: 10px;
    max-width: 100%;
    aspect-ratio: auto;
    height: 100%;
  }

  .page-content {
    padding: 14px 16px 8px;
  }

  .page-foot {
    padding: 4px 10px 6px;
    font-size: 7.5px;
  }

  .bottombar {
    padding: 4px 8px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(10, 10, 14, 0.95);
  }

  .mobile-nav {
    display: grid;
    grid-template-columns: 46px 1fr 46px;
    align-items: center;
    gap: 6px;
  }

  .mobile-nav-btn {
    appearance: none;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent-soft);
    width: 46px;
    height: 46px;
    border-radius: 10px;
    font-size: 26px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
  }
  .mobile-nav-btn:active { background: rgba(168, 136, 74, 0.15); }
  .mobile-nav-btn:disabled { opacity: 0.2; cursor: default; }

  .mobile-nav-center {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
  }

  #progress-label {
    text-align: center;
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.06em;
  }

  .bottom-meta { margin-top: 4px; font-size: 9px; }
  .hint { display: none; }

  .page-cover img, .page-image img {
    max-height: min(55dvh, 55vh, 480px);
  }

  .toc-panel {
    width: 100vw;
    max-width: 100%;
  }

  .page-sheet.turning-next,
  .page-sheet.turning-prev {
    animation: none;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 4px 8px 2px;
  }

  .book-switcher {
    order: -1;
    width: 100%;
    justify-content: center;
    margin-bottom: 1px;
  }

  .switcher-btn {
    flex: 1;
    text-align: center;
    padding: 8px 8px;
    font-size: 9px;
  }

  .mobile-nav {
    display: grid !important;
  }
  .mobile-nav-btn {
    display: grid !important;
  }
}

/* Extra small */
@media (max-width: 380px) {
  .brand-sub { display: none; }
  .page-content { padding: 12px 10px 8px; }
  .mobile-nav-btn { width: 40px; height: 40px; font-size: 22px; }
  .mobile-nav { grid-template-columns: 40px 1fr 40px; }
}

/* ═══════════════════════════════════════════════════════
   PRINT (browser)
   ═══════════════════════════════════════════════════════ */

@media print {
  @page {
    size: 105mm 148mm;
    margin: 0;
  }
  body {
    background: #fff;
    color: #111;
    padding: 0;
  }
  .stars, .topbar, .bottombar, .nav-arrow, .mobile-nav,
  .toc-panel, .toc-backdrop, .book-switcher, .top-link-print {
    display: none !important;
  }
  .stage {
    display: block;
    height: auto;
    padding: 0;
  }
  .page-sheet {
    width: 105mm;
    min-height: 148mm;
    max-height: none;
    aspect-ratio: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
    background: #fff;
  }
  .page-content {
    color: #111;
    padding: 14mm 10mm 12mm 15mm;
    overflow: visible;
    font-size: 9.5pt;
    line-height: 1.52;
    text-align: justify;
    hyphens: auto;
  }
  .page-foot {
    color: #888;
    border-color: #ccc;
  }
}
