:root {
  color-scheme: dark;
  --void-950: #060c12;
  --void-900: #0a121a;
  --void-850: #0e1922;
  --void-800: #13212a;
  --ink-100: #eef4f1;
  --ink-200: #d7e3df;
  --ink-300: #a8bab6;
  --ink-400: #748885;
  --ice-300: #9de0dc;
  --ice-400: #65b9ba;
  --ice-500: #3d868f;
  --heat-300: #ff9b78;
  --heat-400: #ea674f;
  --paper: #101b22;
  --paper-strong: #172731;
  --paper-ink: #dfeeea;
  --paper-muted: #91aaa5;
  --line: rgba(174, 220, 215, .15);
  --reader-size: 18px;
  --reader-leading: 2;
  --reader-width: 720px;
  --sidebar-width: 330px;
  --shadow: 0 28px 80px rgba(0, 0, 0, .34);
}

html[data-theme="ice"] {
  color-scheme: light;
  --void-950: #d9e7e5;
  --void-900: #e7f0ed;
  --void-850: #eef5f1;
  --void-800: #f6faf6;
  --ink-100: #102128;
  --ink-200: #263a40;
  --ink-300: #52696b;
  --ink-400: #687d7c;
  --paper: #e9efeb;
  --paper-strong: #f7faf6;
  --paper-ink: #18262b;
  --paper-muted: #536667;
  --line: rgba(32, 75, 77, .18);
  --shadow: 0 22px 60px rgba(35, 75, 78, .14);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--void-950);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 72% -8%, rgba(59, 132, 143, .22), transparent 30rem),
    radial-gradient(circle at 5% 68%, rgba(144, 40, 35, .1), transparent 25rem),
    var(--void-950);
  color: var(--ink-100);
  font-family: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: background-color .25s ease, color .25s ease;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: .17;
  background-image:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

button, input { font: inherit; }
button { color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--heat-300);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 14px;
  color: var(--void-950);
  background: var(--heat-300);
  transform: translateY(-150%);
  transition: transform .2s ease;
}
.skip-link:focus { transform: translateY(0); }

.top-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 110;
  height: 3px;
  background: rgba(255, 255, 255, .07);
}
.top-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--ice-400), var(--heat-400));
  transition: width .12s linear;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 0 max(28px, env(safe-area-inset-left)) 0 max(28px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--void-900) 90%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 212px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid var(--ice-400);
  border-radius: 50%;
  transform: rotate(22deg);
}
.brand-mark::before, .brand-mark::after {
  position: absolute;
  content: "";
  border: 1px solid var(--heat-400);
  border-radius: 50%;
}
.brand-mark::before { width: 9px; height: 9px; }
.brand-mark::after { width: 44px; height: 44px; border-color: rgba(101, 185, 186, .34); }
.brand-mark i { width: 1px; height: 48px; background: linear-gradient(transparent, var(--ice-400), transparent); }

.brand-copy { display: grid; gap: 2px; }
.brand-copy strong {
  font-family: "Noto Serif CJK SC", "Songti SC", STSong, serif;
  font-size: 17px;
  letter-spacing: .15em;
}
.brand-copy small, .eyebrow {
  color: var(--ink-400);
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: .12em;
}

.reading-status {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-300);
  font-size: 13px;
}
.status-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--heat-400);
  box-shadow: 0 0 0 5px rgba(234, 103, 79, .11), 0 0 16px rgba(234, 103, 79, .55);
}

.top-actions { display: flex; gap: 7px; margin-left: auto; }
.icon-button, .close-button {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--ink-300);
  background: transparent;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.icon-button:hover, .close-button:hover { border-color: var(--line); color: var(--ink-100); background: rgba(101, 185, 186, .07); }
.menu-button { display: none; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - 72px); }

.library-panel {
  position: sticky;
  top: 72px;
  align-self: start;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 30px 22px 42px 28px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--ice-500) transparent;
}

.library-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.library-head h2, .layout-dialog h2 { margin: 5px 0 0; font: 700 30px/1.2 "Noto Serif CJK SC", "Songti SC", serif; }
.eyebrow { margin: 0; color: var(--ice-300); text-transform: uppercase; }
.close-button { display: none; font-size: 26px; }

.resume-card {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
  padding: 17px;
  border: 1px solid rgba(101, 185, 186, .24);
  background: linear-gradient(135deg, rgba(101, 185, 186, .1), rgba(234, 103, 79, .04));
}
.resume-card span { color: var(--ice-300); font: 11px/1.4 "IBM Plex Mono", Consolas, monospace; letter-spacing: .1em; }
.resume-card strong { font: 700 16px/1.5 "Noto Serif CJK SC", "Songti SC", serif; }
.resume-card small { color: var(--ink-300); font-size: 12px; }
.resume-card button, .primary-button {
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--heat-400);
  background: var(--heat-400);
  color: #fff;
  cursor: pointer;
}

.search-wrap { margin-bottom: 20px; }
.search-wrap > label { display: block; margin-bottom: 8px; color: var(--ink-300); font-size: 12px; }
.search-control {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 32px;
  align-items: center;
  min-height: 44px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
}
.search-control input { width: 100%; border: 0; outline: 0; color: var(--ink-100); background: transparent; font-size: 13px; }
.search-control input::placeholder { color: var(--ink-400); }
.search-control button { width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; }
.search-state { min-height: 17px; margin: 7px 0 0; color: var(--ink-400); font-size: 11px; }

.volume-list { display: grid; gap: 7px; }
.volume-group { border-bottom: 1px solid var(--line); }
.volume-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 2px;
  color: var(--ink-200);
  cursor: pointer;
  list-style: none;
}
.volume-group summary::-webkit-details-marker { display: none; }
.volume-group summary span { font: 600 14px/1.5 "Noto Serif CJK SC", "Songti SC", serif; }
.volume-group summary small { color: var(--ink-400); font: 11px/1.5 "IBM Plex Mono", Consolas, monospace; }
.chapter-list { display: grid; gap: 2px; padding: 0 0 12px; }
.chapter-link {
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--ink-300);
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.chapter-link:hover { color: var(--ink-100); background: rgba(101, 185, 186, .06); }
.chapter-link.is-active { border-left-color: var(--heat-400); color: var(--ink-100); background: rgba(234, 103, 79, .07); }
.chapter-link.is-read .chapter-read-dot { background: var(--ice-400); box-shadow: 0 0 9px rgba(101, 185, 186, .55); }
.chapter-index { color: var(--ink-400); font: 11px/1.4 "IBM Plex Mono", Consolas, monospace; }
.chapter-name { overflow: hidden; font: 13px/1.45 "Noto Serif CJK SC", "Songti SC", serif; text-overflow: ellipsis; white-space: nowrap; }
.chapter-read-dot { justify-self: center; width: 6px; height: 6px; border-radius: 50%; background: rgba(116, 136, 133, .38); }
.library-note { margin: 24px 0 0; color: var(--ink-400); font-size: 12px; line-height: 1.7; }

.search-results { display: grid; gap: 8px; margin-bottom: 22px; }
.search-result {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  color: var(--ink-200);
  background: rgba(255, 255, 255, .025);
  text-align: left;
  cursor: pointer;
}
.search-result:hover { border-color: var(--ice-500); }
.search-result strong { font: 600 14px/1.4 "Noto Serif CJK SC", "Songti SC", serif; }
.search-result span { color: var(--ink-400); font-size: 11px; }
.search-result p { margin: 0; color: var(--ink-300); font-size: 12px; line-height: 1.6; }
.search-result mark { padding: 0 2px; color: var(--void-950); background: var(--ice-300); }

.main-stage { min-width: 0; outline: 0; }
.home-view {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(320px, 570px);
  align-items: center;
  justify-content: center;
  gap: clamp(46px, 7vw, 110px);
  min-height: calc(100vh - 72px);
  padding: 70px clamp(34px, 7vw, 110px) 90px;
}
.cover-visual { position: relative; align-self: center; aspect-ratio: 4 / 5; max-height: 680px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.cover-visual::after { position: absolute; inset: 20px; border: 1px solid rgba(255, 255, 255, .22); content: ""; pointer-events: none; }
.cover-visual img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.78) contrast(1.05); }
.cover-orbit { position: absolute; right: -36px; bottom: 14%; width: 88px; height: 88px; border: 1px solid var(--ice-400); border-radius: 50%; }
.cover-orbit::before, .cover-orbit::after { position: absolute; inset: 19px; border: 1px solid var(--heat-400); border-radius: 50%; content: ""; }
.cover-orbit::after { inset: 42px -24px; border-radius: 0; border-width: 1px 0 0; transform: rotate(-18deg); }
.home-copy h1 { margin: 13px 0 22px; font: 700 clamp(64px, 8vw, 118px)/.94 "Noto Serif CJK SC", "Songti SC", STSong, serif; letter-spacing: .08em; }
.home-lead { max-width: 30em; margin: 0; color: var(--ink-300); font: 18px/1.9 "Noto Serif CJK SC", "Songti SC", serif; }
.book-facts { display: flex; flex-wrap: wrap; gap: 16px 28px; margin: 38px 0; }
.book-facts span { display: flex; align-items: baseline; gap: 6px; color: var(--ink-400); font-size: 12px; }
.book-facts strong { color: var(--ice-300); font: 600 28px/1 "IBM Plex Mono", Consolas, monospace; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.primary-button, .secondary-button { min-width: 150px; min-height: 48px; padding: 0 20px; cursor: pointer; }
.secondary-button { border: 1px solid var(--line); color: var(--ink-200); background: transparent; }
.primary-button:hover { background: var(--heat-300); }
.secondary-button:hover { border-color: var(--ice-400); }
.offline-note { margin: 22px 0 0; color: var(--ink-400); font-size: 12px; line-height: 1.7; }

.reader-view { min-height: calc(100vh - 72px); }
.chapter-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 48px;
  align-items: end;
  max-width: 1160px;
  margin: 0 auto;
  padding: 74px 62px 44px;
  border-bottom: 1px solid var(--line);
}
.chapter-volume { margin: 0 0 15px; color: var(--ice-300); font: 12px/1.5 "IBM Plex Mono", Consolas, monospace; letter-spacing: .12em; }
.chapter-number-row { display: flex; gap: 14px; color: var(--ink-400); font: 11px/1.5 "IBM Plex Mono", Consolas, monospace; }
.chapter-number-row span:first-child { color: var(--heat-300); }
.chapter-heading h1 { max-width: 780px; margin: 10px 0 19px; font: 700 clamp(38px, 5vw, 68px)/1.16 "Noto Serif CJK SC", "Songti SC", STSong, serif; letter-spacing: .04em; }
.chapter-meta { display: flex; flex-wrap: wrap; gap: 9px 22px; color: var(--ink-400); font-size: 12px; }
.chapter-meta span + span::before { margin-right: 22px; color: var(--heat-400); content: "·"; }
.volume-signal { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; color: var(--ink-400); font: 11px/1.4 "IBM Plex Mono", Consolas, monospace; }
.volume-signal i { position: relative; height: 2px; background: var(--line); }
.volume-signal b { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--ice-400), var(--heat-400)); }

.reader-grid { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: 36px; max-width: calc(var(--reader-width) + 150px); margin: 0 auto; padding: 48px 38px 110px; }
.reading-surface { min-width: 0; }
.reading-tools { display: flex; align-items: center; justify-content: flex-end; gap: 5px; margin-bottom: 24px; color: var(--ink-400); }
.reading-tools span { margin-right: 8px; font: 11px/1.4 "IBM Plex Mono", Consolas, monospace; }
.reading-tools button { min-width: 40px; min-height: 40px; border: 1px solid transparent; color: var(--ink-300); background: transparent; cursor: pointer; }
.reading-tools button:hover { border-color: var(--line); color: var(--ink-100); }
.chapter-loading { padding: 60px 0; color: var(--ink-400); text-align: center; }
.prose { max-width: var(--reader-width); color: var(--paper-ink); font: var(--reader-size)/var(--reader-leading) "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", STSong, serif; }
.prose p { margin: 0 0 1.55em; text-align: justify; text-justify: inter-ideograph; overflow-wrap: anywhere; }
.prose p.signal-line-text { color: var(--ice-300); font-weight: 600; letter-spacing: .025em; }
.prose strong { color: var(--ice-300); font-weight: 700; }

.chapter-art { margin: 64px 0 18px; }
.illustration-card { margin: 0; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.illustration-button { display: block; width: 100%; padding: 0; border: 0; background: #03070a; cursor: zoom-in; }
.illustration-button img { display: block; width: 100%; height: auto; aspect-ratio: var(--image-ratio, 3 / 2); object-fit: contain; }
.illustration-caption { display: grid; gap: 5px; padding: 18px 20px 20px; }
.illustration-caption strong { color: var(--ice-300); font: 12px/1.5 "IBM Plex Mono", Consolas, monospace; }
.illustration-caption p { margin: 0; color: var(--ink-200); font-size: 13px; line-height: 1.7; }
.illustration-caption small { color: var(--ink-400); font-size: 11px; }

.chapter-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 54px; }
.chapter-pager button { display: grid; gap: 8px; min-height: 98px; padding: 18px; border: 1px solid var(--line); color: var(--ink-200); background: rgba(255, 255, 255, .02); text-align: left; cursor: pointer; }
.chapter-pager button:last-child { text-align: right; }
.chapter-pager button:hover:not(:disabled) { border-color: var(--ice-500); background: rgba(101, 185, 186, .05); }
.chapter-pager button:disabled { cursor: default; opacity: .48; }
.chapter-pager span { color: var(--ink-400); font: 11px/1.4 "IBM Plex Mono", Consolas, monospace; }
.chapter-pager strong { overflow: hidden; font: 600 14px/1.5 "Noto Serif CJK SC", "Songti SC", serif; text-overflow: ellipsis; white-space: nowrap; }

.reading-rail { position: sticky; top: 102px; align-self: start; display: grid; justify-items: center; gap: 12px; height: 360px; color: var(--ink-400); font: 10px/1.4 "IBM Plex Mono", Consolas, monospace; }
.rail-track { position: relative; width: 2px; height: 230px; overflow: hidden; background: var(--line); }
.rail-track i { position: absolute; inset: 0 0 auto; height: 0; background: linear-gradient(var(--ice-400), var(--heat-400)); }
.reading-rail button { width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; cursor: pointer; }

.mobile-toolbar { display: none; }
.panel-backdrop { display: none; }

.layout-dialog, .image-dialog { color: var(--ink-100); border: 1px solid var(--line); background: var(--void-850); box-shadow: var(--shadow); }
.layout-dialog::backdrop, .image-dialog::backdrop { background: rgba(2, 7, 10, .82); backdrop-filter: blur(8px); }
.layout-dialog { width: min(460px, calc(100vw - 30px)); padding: 0; }
.layout-dialog form { display: grid; gap: 23px; padding: 24px; }
.layout-dialog header { display: flex; align-items: flex-start; justify-content: space-between; }
.layout-dialog header button { width: 40px; height: 40px; border: 0; color: var(--ink-300); background: transparent; font-size: 26px; cursor: pointer; }
.layout-dialog label { display: grid; grid-template-columns: 1fr auto; gap: 10px; color: var(--ink-300); font-size: 13px; }
.layout-dialog input { grid-column: 1 / -1; width: 100%; accent-color: var(--heat-400); }
.layout-dialog output { color: var(--ice-300); font-family: "IBM Plex Mono", Consolas, monospace; }
.reset-layout { width: 100%; }

.image-dialog { width: min(94vw, 1200px); max-height: 94vh; padding: 12px; overflow: auto; }
.image-dialog > button { position: sticky; top: 0; z-index: 2; float: right; width: 44px; height: 44px; border: 1px solid rgba(255, 255, 255, .25); color: #fff; background: rgba(0, 0, 0, .72); font-size: 25px; cursor: pointer; }
.image-dialog img { display: block; max-width: 100%; max-height: 82vh; margin: auto; object-fit: contain; }
.image-dialog p { margin: 10px 6px 2px; color: var(--ink-300); font-size: 12px; text-align: center; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 190; max-width: min(360px, calc(100vw - 40px)); padding: 12px 15px; border: 1px solid var(--line); color: var(--ink-100); background: var(--void-850); box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: none; }
.focus-exit { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 185; display: none; align-items: center; gap: 8px; min-height: 46px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-100); background: color-mix(in srgb, var(--void-850) 92%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(16px); cursor: pointer; }
.focus-exit span { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; color: var(--ice-300); font-size: 18px; line-height: 1; }
.focus-exit strong { font-size: 12px; font-weight: 650; letter-spacing: .06em; }

body.focus-mode .topbar, body.focus-mode .library-panel, body.focus-mode .reading-rail { display: none; }
body.focus-mode .app-shell { display: block; }
body.focus-mode .reader-grid { grid-template-columns: minmax(0, 1fr); }
body.focus-mode .chapter-hero { padding-top: 34px; }
body.focus-mode .mobile-toolbar { transform: translateY(calc(100% + env(safe-area-inset-bottom))); }
body.focus-mode .focus-exit { display: flex; }

@media (max-width: 1080px) {
  .reading-status { display: none; }
  .app-shell { grid-template-columns: 292px minmax(0, 1fr); }
  .library-panel { padding-left: 22px; }
  .chapter-hero { padding-inline: 44px; }
}

@media (max-width: 840px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .topbar { min-height: 62px; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
  .brand { min-width: 0; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-mark::after { width: 38px; height: 38px; }
  .brand-copy small { display: none; }
  .top-actions .icon-button:not(.menu-button) { display: none; }
  .menu-button { display: grid; }
  .app-shell { display: block; min-height: calc(100vh - 62px); }
  .library-panel {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 160;
    width: min(92vw, 390px);
    height: 100dvh;
    padding: max(26px, env(safe-area-inset-top)) 20px calc(92px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    border-right: 1px solid var(--line);
    background: var(--void-900);
    transform: translateX(-105%);
    transition: transform .24s ease;
  }
  .library-panel.is-open { transform: none; }
  .close-button { display: grid; }
  .panel-backdrop { position: fixed; inset: 0; z-index: 150; display: block; background: rgba(1, 6, 9, .68); backdrop-filter: blur(4px); }
  body.panel-open { overflow: hidden; }
  .home-view { grid-template-columns: 1fr; gap: 38px; min-height: auto; padding: 42px 22px 76px; }
  .cover-visual { width: min(78vw, 390px); max-height: none; margin: 0 auto; }
  .cover-orbit { right: -20px; width: 68px; height: 68px; }
  .cover-orbit::before { inset: 15px; }
  .cover-orbit::after { inset: 33px -16px; }
  .home-copy { text-align: center; }
  .home-copy h1 { font-size: clamp(58px, 19vw, 92px); }
  .home-lead { margin-inline: auto; font-size: 16px; }
  .book-facts, .home-actions { justify-content: center; }
  .chapter-hero { grid-template-columns: 1fr; gap: 25px; padding: 34px 22px 26px; }
  .chapter-heading h1 { font-size: clamp(36px, 10vw, 54px); }
  .reader-grid { grid-template-columns: minmax(0, 1fr); padding: 22px 20px 78px; }
  .reading-rail { display: none; }
  .reading-tools { justify-content: center; margin-bottom: 18px; }
  .prose { font-size: var(--reader-size); line-height: var(--reader-leading); }
  .mobile-toolbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 130;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--void-900) 94%, transparent);
    backdrop-filter: blur(18px);
    transition: transform .2s ease;
  }
  .mobile-toolbar button { display: grid; place-items: center; gap: 2px; min-height: 48px; border: 0; color: var(--ink-300); background: transparent; cursor: pointer; }
  .mobile-toolbar span { font-size: 18px; }
  .mobile-toolbar small { font-size: 11px; }
  .toast { right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); }
  .focus-exit { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); min-height: 48px; }
  body.focus-mode .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 520px) {
  .brand-copy strong { font-size: 15px; }
  .home-actions { display: grid; }
  .primary-button, .secondary-button { width: 100%; }
  .book-facts { gap: 13px 20px; }
  .book-facts strong { font-size: 24px; }
  .chapter-meta { gap: 6px 14px; }
  .chapter-meta span + span::before { margin-right: 14px; }
  .reading-tools #font-value { display: none; }
  .chapter-pager { grid-template-columns: 1fr; }
  .chapter-pager button:last-child { text-align: left; }
  .illustration-caption { padding: 14px; }
}

@media print {
  .topbar, .library-panel, .mobile-toolbar, .reading-tools, .reading-rail, .chapter-pager, .top-progress { display: none !important; }
  body { padding: 0; color: #111; background: #fff; }
  .app-shell, .reader-grid { display: block; }
  .chapter-hero, .reader-grid { max-width: none; padding: 0; border: 0; }
  .prose { max-width: none; color: #111; font-size: 12pt; line-height: 1.8; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
