/* ======================================================================
   OrbitLens Reader — dark void, royal violet accent
   Ideal design principles: D-01 purple, D-04 numbers as heroes,
   D-06 compass rose, D-11 notebook margin, D-29 reticle on focus,
   UX-06 scope always visible.
   ====================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Void background (Ideal D-02) */
  --bg-void: #0a0e17;
  --bg-deep: #060912;
  --paper: #141b2d;
  --paper-hi: #1a2238;
  --border: #1e2a45;
  --border-hi: #2a3a5e;
  --border-glow: #3c2d70;

  /* Text (Ideal gruvbox-warm) */
  --text: #ebdbb2;
  --text-strong: #f2e4c0;
  --body: #d5c6a0;
  --muted: #928374;
  --dim: #665c54;

  /* Royal violet — intellectual, deep but vivid */
  --purple: #7c5ce0;
  --purple-dim: #5e44b5;
  --purple-bright: #a188ed;
  --purple-soft: #8a76c9;
  --purple-deep: #3f2d85;
  --purple-glow: rgba(124, 92, 224, 0.22);

  /* Code tokens */
  --code-bg: #1c2540;
  --code-text: #a188ed;
  --pre-bg: #06080e;
  --pre-text: #e8dfc7;
  --quote-bg: #181f36;
  --quote-border: #7c5ce0;
  --selection: rgba(124, 92, 224, 0.28);
  --shadow: rgba(0, 0, 0, 0.55);

  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --sans: 'Inter', 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', Meiryo, -apple-system, BlinkMacSystemFont, sans-serif;
  --jp: 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', Meiryo, sans-serif;
  --display: 'Inter Tight', 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  --serif: var(--sans);

  --font-size: 17px;
  --line-height: 1.95;
  --content-max: 740px;
}

/* Optional light theme — "observation space": muddied whites, minimal contrast, code-block as the gravity core.
   Principles: read by density, not by brightness. Whites are dialed down, card/bg gap is small, only the code
   fence pushes hard. Purple shifts to a livelier indigo (#6D5EF5) with a lavender soft counterpart. */
body.theme-light {
  --bg-void: #eceef3;          /* bg-base — slightly cloudy, not SaaS white */
  --bg-deep: #e4e7ee;          /* bg-subtle */
  --paper: #f3f4f8;            /* surface-primary — a whisper above bg, not pure white */
  --paper-hi: #eff1f6;         /* surface-secondary */
  --border: #d8dbe3;           /* border melts into space */
  --border-hi: #b8bdc8;
  --border-glow: #8b7bbf;
  --text: #1c1f26;             /* text-primary — dark but not crushed */
  --text-strong: #0f1218;
  --body: #2d3340;
  --muted: #6b7280;            /* text-secondary */
  --dim: #9aa0ab;
  --purple: #6d5ef5;           /* accent-primary — structural, alive */
  --purple-dim: #6d5bc2;
  --purple-bright: #8b7cff;
  --purple-soft: #a78bfa;      /* accent-secondary — auxiliary */
  --purple-deep: #4b3fc7;
  --purple-glow: rgba(109, 94, 245, 0.12);
  --code-bg: #eff1f6;          /* inline code + table headers */
  --code-text: #6d5ef5;
  --pre-bg: #0f1115;           /* the gravity core — nearly black */
  --pre-text: #dce2ec;
  --quote-bg: #eaecf2;
  --quote-border: #6d5ef5;
  --selection: rgba(109, 94, 245, 0.14);
  --shadow: rgba(20, 22, 30, 0.06);   /* bleed, not float */
}

/* Light mode background — radial gravitational wells + vertical layer */
body.theme-light {
  background:
    radial-gradient(ellipse 80% 60% at 15% -10%, rgba(124, 92, 224, 0.08), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 110%, rgba(60, 80, 130, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg-void), var(--bg-deep));
  background-attachment: fixed;
}

body.font-serif { --sans: var(--serif); }

html { scroll-behavior: smooth; scroll-padding-top: 96px; }

body {
  font-family: var(--sans);
  background: var(--bg-void);
  color: var(--body);
  font-size: var(--font-size);
  line-height: var(--line-height);
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "palt" 1, "kern" 1, "tnum" 1;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  transition: background .18s, color .18s;
  padding-bottom: 56px;
}
:lang(ja), [lang="ja"] { font-family: var(--jp); }

::selection { background: var(--selection); color: var(--text-strong); }

a { color: var(--text-strong); text-decoration: none; transition: color .12s; }
a:hover { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }

/* Quiet starfield */
.starfield {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(235,219,178,0.45), transparent),
    radial-gradient(1px 1px at 28% 72%, rgba(235,219,178,0.28), transparent),
    radial-gradient(1.5px 1.5px at 52% 10%, rgba(161,136,237,0.55), transparent),
    radial-gradient(1px 1px at 68% 42%, rgba(235,219,178,0.22), transparent),
    radial-gradient(1px 1px at 91% 78%, rgba(235,219,178,0.38), transparent),
    radial-gradient(1px 1px at 42% 86%, rgba(235,219,178,0.28), transparent),
    radial-gradient(1px 1px at 82% 20%, rgba(161,136,237,0.4), transparent),
    radial-gradient(1px 1px at 18% 56%, rgba(235,219,178,0.32), transparent),
    radial-gradient(1.5px 1.5px at 95% 38%, rgba(235,219,178,0.36), transparent);
}
body.theme-light .starfield { display: none; }

/* ======================================================================
   Breadcrumb (UX-06 scope always visible)
   ====================================================================== */
.orbit-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--muted);
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex; align-items: center; gap: 14px;
  min-height: 52px;
}
body.theme-light .orbit-bar { background: rgba(26, 30, 42, 0.92); color: #d0d6e2; border-bottom-color: rgba(255,255,255,0.08); }
body.theme-light .orbit-bar .crumb-brand { color: #eef1f7; }
body.theme-light .orbit-bar .crumb-sep { color: #7a8190; }
body.theme-light .orbit-bar .crumb-book { color: #d0d6e2; }
body.theme-light .orbit-bar a { color: #d0d6e2; }
body.theme-light .orbit-bar a:hover { color: #eef1f7; }

.orbit-bar a { color: var(--muted); text-decoration: none; transition: color 150ms ease; }
.orbit-bar a:hover { color: var(--text-strong); text-decoration: none; }
.crumb-logo { display: inline-flex; align-items: center; gap: 10px; }
.crumb-logo img { width: 22px; height: 22px; display: block; opacity: 0.95; }
.crumb-brand { color: var(--text-strong); font-weight: 600; letter-spacing: 1.2px; }
.crumb-sep { color: var(--dim); margin: 0 4px; }
.crumb-scope { color: var(--purple-bright); }
.crumb-book {
  color: var(--text);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
@media (max-width: 640px) {
  .crumb-book { max-width: 180px; font-size: 11px; }
}

.private-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  padding: 3px 9px;
  color: var(--purple-bright);
  border: 1px solid rgba(124, 92, 224, 0.35);
  border-radius: 3px;
  background: rgba(124, 92, 224, 0.05);
  white-space: nowrap;
  flex-shrink: 0;
}
.private-chip svg { width: 10px; height: 10px; }

.orbit-spacer { flex: 1; }

.orbit-tools { display: flex; align-items: center; gap: 6px; }
.orbit-tool {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  transition: all .12s;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}
.orbit-tool:hover { border-color: var(--purple-dim); color: var(--purple-bright); text-decoration: none; }
.orbit-tool.active { background: rgba(124, 92, 224, 0.08); color: var(--purple-bright); border-color: var(--purple-dim); }

/* Default: icon only (desktop tool bar) */
.orbit-tool .tool-label { display: none; }
.orbit-tool .tool-icon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Mobile hamburger toggle — hidden on desktop */
.orbit-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
.orbit-menu-toggle:hover { border-color: var(--purple); color: var(--purple-bright); }

@media (max-width: 640px) {
  .orbit-menu-toggle { display: inline-flex; }
  .orbit-bar .private-chip { display: none; }
  /* Scoped to the reader.js toolbar (#orbit-tools), so standalone articles
     that reuse .orbit-tools without a hamburger keep rendering inline. */
  .orbit-bar #orbit-tools {
    position: absolute;
    top: 100%;
    right: 12px;
    margin-top: 8px;
    flex-direction: column;
    gap: 4px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    display: none;
    min-width: 160px;
    z-index: 60;
  }
  .orbit-bar #orbit-tools.open { display: flex; }
  .orbit-bar #orbit-tools .orbit-tool {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 14px;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--text);
    border-color: transparent;
  }
  .orbit-bar #orbit-tools .orbit-tool:hover {
    background: var(--paper-hi);
    border-color: var(--border);
  }
  .orbit-bar #orbit-tools .orbit-tool .tool-icon {
    min-width: 28px;
    font-size: 14px;
    color: var(--purple-bright);
    justify-content: center;
  }
  .orbit-bar #orbit-tools .orbit-tool .tool-label {
    display: inline;
    font-family: var(--sans);
    font-size: 13px;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--text);
    font-weight: 500;
  }
}

/* Light-mode overrides for orbit-bar controls (bar itself is dark in light mode) */
body.theme-light .orbit-tool { color: #d0d6e2; border-color: rgba(255,255,255,0.12); }
body.theme-light .orbit-tool:hover { color: #eef1f7; border-color: var(--purple-bright); }
body.theme-light .orbit-menu-toggle { color: #d0d6e2; border-color: rgba(255,255,255,0.14); }
body.theme-light .orbit-menu-toggle:hover { color: #eef1f7; border-color: var(--purple-bright); }
@media (max-width: 640px) {
  body.theme-light .orbit-bar #orbit-tools {
    background: #1a1e2a;
    border-color: rgba(255,255,255,0.1);
  }
  body.theme-light .orbit-bar #orbit-tools .orbit-tool {
    color: #d0d6e2;
    border-color: transparent;
  }
  body.theme-light .orbit-bar #orbit-tools .orbit-tool:hover {
    background: rgba(255,255,255,0.05);
    color: #eef1f7;
  }
  body.theme-light .orbit-bar #orbit-tools .orbit-tool .tool-icon {
    color: var(--purple-bright);
  }
  body.theme-light .orbit-bar #orbit-tools .orbit-tool .tool-label {
    color: #d0d6e2;
  }
}

/* Progress track — draggable scrubber with section markers */
.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 8px;  /* widened clickable/tap area */
  cursor: pointer;
  user-select: none;
  touch-action: none;
}
.progress-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(124, 92, 224, 0.12);
  pointer-events: none;
}
.progress-bar {
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple-deep), var(--purple), var(--purple-bright));
  width: 0;
  transition: width .12s linear;
  box-shadow: 0 0 10px var(--purple-glow);
  pointer-events: none;
}
.progress-track.dragging .progress-bar { transition: none; }
.progress-markers {
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 8px;
  pointer-events: none;
}
.progress-marker {
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 6px;
  background: var(--purple-dim);
  transform: translateX(-50%);
  opacity: 0.5;
}
.progress-thumb {
  position: absolute;
  bottom: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple);
  border: 2px solid var(--bg-void);
  transform: translateX(-50%);
  left: 0;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity .2s;
}
.progress-track:hover .progress-thumb,
.progress-track.dragging .progress-thumb { opacity: 1; }
body.theme-light .progress-thumb { border-color: #1a1e2a; }

/* ======================================================================
   Layout
   ====================================================================== */
.reader-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: 28px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 84px 24px 80px;
  position: relative;
  z-index: 1;
}
@media (max-width: 1180px) {
  .reader-layout { grid-template-columns: 240px minmax(0, 1fr) 200px; gap: 22px; }
}
@media (max-width: 1040px) {
  .reader-layout { grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; }
  .book-toc-sidebar { display: none; }
}
@media (max-width: 820px) {
  .reader-layout { grid-template-columns: 1fr; padding: 72px 20px 64px; }
  .inline-toc { display: none; }
}

/* Left sidebar — chapter navigation */
.book-toc-sidebar {
  position: sticky; top: 80px; align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-right: 4px;
}
.book-toc-sidebar::-webkit-scrollbar { width: 5px; }
.book-toc-sidebar::-webkit-scrollbar-track { background: transparent; }
.book-toc-sidebar::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 3px; }

.sidebar-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.8px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-left: 4px;
}

.sidebar-home {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  padding: 8px 12px;
  margin-bottom: 16px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid transparent;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.sidebar-home:hover {
  color: var(--purple-bright);
  background: var(--paper);
  border-color: var(--border);
  text-decoration: none;
}

.sidebar-chapters { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1px; }
.sidebar-chapters li a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: all .12s;
}
.sidebar-chapters li a:hover { background: var(--paper); color: var(--text); text-decoration: none; }
.sidebar-chapters li a.current {
  background: var(--paper);
  color: var(--purple-bright);
  border-left-color: var(--purple);
  font-weight: 600;
}
.sidebar-chapters .ch-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 1.2px;
  flex-shrink: 0;
  min-width: 40px;
}
.sidebar-chapters li a.current .ch-num { color: var(--purple); }
.sidebar-chapters .ch-title { flex: 1; }

/* Right sidebar — on-page TOC */
.inline-toc {
  position: sticky; top: 80px; align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.inline-toc-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.inline-toc ol { list-style: none; padding: 0; margin: 0; }
.inline-toc li { padding: 2px 0; }
.inline-toc a {
  display: block;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  padding: 4px 10px;
  border-left: 2px solid transparent;
  margin-left: -14px;
  transition: color .12s, border-color .12s;
  text-decoration: none;
}
.inline-toc a:hover { color: var(--text); text-decoration: none; }
.inline-toc a.active { color: var(--purple-bright); border-left-color: var(--purple); font-weight: 500; }
.inline-toc a.level-3 { padding-left: 22px; font-size: 11.5px; opacity: 0.85; }

/* ======================================================================
   Main column
   ====================================================================== */
.reader-main { min-width: 0; }

/* Compass rose divider (D-06) */
.compass-divider {
  display: flex; align-items: center; gap: 18px;
  margin-bottom: 24px;
  color: var(--purple-dim);
  opacity: 0.75;
}
.compass-divider .line {
  flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, rgba(94, 68, 181, 0.5), transparent);
}
.compass-divider svg { width: 22px; height: 22px; flex-shrink: 0; }

/* Book cover (TOC landing page) */
.book-cover-section {
  background: var(--paper);
  /* D-11 notebook paper */
  background-image: linear-gradient(to bottom, rgba(255,255,255,0.012) 0px, transparent 1px, transparent 29px);
  background-size: 100% 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 44px 42px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 20px var(--shadow);
}
.book-cover-section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--purple-deep), var(--purple), var(--purple-bright));
}
/* D-11 notebook margin line on right */
.book-cover-section::after {
  content: '';
  position: absolute;
  top: 18px; bottom: 18px; right: 20px;
  width: 1px;
  background: var(--purple-dim);
  opacity: 0.35;
  pointer-events: none;
}
@media (max-width: 600px) { .book-cover-section { padding: 30px 22px; } }

.book-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--purple-dim);
  text-transform: uppercase;
  margin-bottom: 16px;
}
/* D-04 numbers as heroes */
.book-code-hero {
  font-family: var(--mono);
  font-weight: 300;
  font-size: 42px;
  letter-spacing: 2px;
  color: var(--text-strong);
  line-height: 1;
  margin-bottom: 10px;
}
.book-title-main {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.2vw, 2.15rem);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.book-subtitle-main {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 24px;
  font-weight: 400;
}
.book-summary-main {
  font-size: 14.5px;
  color: var(--body);
  line-height: 1.85;
  max-width: 620px;
}

.book-meta {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.book-meta-item { display: inline-flex; align-items: center; gap: 8px; }
.book-meta-item strong { color: var(--text-strong); font-weight: 600; }
.book-meta-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--purple); display: inline-block; }
a.book-meta-link { color: var(--muted); text-decoration: none; transition: color .14s; }
a.book-meta-link:hover { color: var(--text-strong); text-decoration: none; }

/* TOC listing */
.toc-grid {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 34px;
  box-shadow: 0 2px 20px var(--shadow);
}
@media (max-width: 600px) { .toc-grid { padding: 22px 18px; } }

.toc-heading {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  margin-bottom: 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 3px;
  text-transform: uppercase;
}
.toc-heading .toc-total {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.2px;
  font-weight: 400;
  text-transform: uppercase;
}

.toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.toc-list li a {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 12px;
  border-radius: 6px;
  color: var(--text-strong);
  text-decoration: none;
  transition: background .12s, transform .12s;
  border: 1px solid transparent;
  position: relative;
}
.toc-list li a:hover {
  background: var(--paper-hi);
  border-color: var(--border);
  text-decoration: none;
  transform: translateX(3px);
}
/* Reticle circle on hover (D-29) */
.toc-list li a::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.4);
  width: 30px; height: 30px;
  border: 1px solid var(--purple-dim);
  border-radius: 50%;
  opacity: 0;
  transition: all .2s;
  pointer-events: none;
}
.toc-list li a:hover::before { opacity: 0.25; transform: translate(-50%, -50%) scale(1); }

.toc-list .toc-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--purple);
  letter-spacing: 1px;
  font-weight: 500;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.toc-list .toc-title-text {
  font-family: var(--display);
  font-size: 14.5px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}
.toc-list .toc-en-badge {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  padding: 4px 9px;
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  transition: all .12s;
  text-decoration: none;
  text-transform: uppercase;
}
.toc-list .toc-en-badge:hover {
  background: var(--purple);
  color: var(--bg-void) !important;
  border-color: var(--purple);
  text-decoration: none;
}

/* ======================================================================
   Book switcher (cover page only) — cross-links to sibling books
   ====================================================================== */
.book-switch {
  margin-top: 40px;
}
.book-switch-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2.8px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-left: 4px;
}
.book-switch-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 600px) {
  .book-switch-list { grid-template-columns: 1fr; }
}
.book-switch-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .14s, background .14s, transform .14s, box-shadow .14s;
}
.book-switch-item:hover {
  border-color: var(--purple);
  background: var(--paper-hi);
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 6px 18px var(--purple-glow);
}
.book-switch-item.current {
  pointer-events: none;
  cursor: default;
  background: var(--purple-glow);
  border-color: var(--purple);
  transform: none;
}
.book-switch-item .bs-code {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--purple-bright);
  text-transform: uppercase;
}
.book-switch-item .bs-layer {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--dim);
  text-transform: uppercase;
}
.book-switch-item .bs-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-strong);
  letter-spacing: -0.005em;
}

/* ======================================================================
   Chapter content
   ====================================================================== */
.chapter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 28px;
  font-size: 13px;
  font-family: var(--mono);
  gap: 16px;
  flex-wrap: wrap;
  letter-spacing: 0.8px;
}
.chapter-bar .ch-info { color: var(--muted); display: flex; gap: 18px; align-items: center; text-transform: uppercase; font-size: 11px; letter-spacing: 1.5px; }
.chapter-bar .ch-info strong { color: var(--purple-bright); font-weight: 600; }
.chapter-bar .ch-reading-time { display: inline-flex; align-items: center; gap: 6px; }
.chapter-bar .en-link {
  color: var(--purple-bright);
  font-weight: 500;
  padding: 6px 12px;
  border: 1px solid var(--purple-dim);
  border-radius: 3px;
  font-size: 10px;
  text-decoration: none;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all .12s;
  background: rgba(124, 92, 224, 0.05);
}
.chapter-bar .en-link:hover { background: var(--purple); color: var(--bg-void); border-color: var(--purple); text-decoration: none; }

/* Chapter title — displayed prominently above the section TOC accordion.
   Replaces the markdown H1 (which is stripped from body). Multi-chapter book reader style. */
.chapter-title-display {
  font-family: var(--display);
  font-size: clamp(1.85rem, 4vw, 2.4rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 20px 0 24px;
  padding: 0;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}
@media (max-width: 820px) {
  .chapter-title-display {
    font-size: clamp(1.6rem, 5.5vw, 1.95rem);
    margin: 16px 0 18px;
  }
}

article.chapter-content {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 60px 56px 64px;
  max-width: var(--content-max);
  margin: 0 auto;
  box-shadow: 0 2px 20px var(--shadow);
  position: relative;
}
article.chapter-content::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--purple-dim), transparent);
  opacity: 0.5;
}
@media (max-width: 720px) { article.chapter-content { padding: 30px 20px 40px; } }

/* Typography */
.chapter-content h1 {
  font-family: var(--display);
  font-size: clamp(1.85rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.4;
  margin: 0 0 1em;
  letter-spacing: -0.02em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--border-hi);
}
.chapter-content h2 {
  font-family: var(--display);
  font-size: 1.32rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 2.4em 0 0.9em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 88px;
  position: relative;
  letter-spacing: -0.01em;
}
.chapter-content h3 {
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 1.9em 0 0.7em;
  scroll-margin-top: 88px;
  position: relative;
  letter-spacing: -0.01em;
}
.chapter-content h4 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--purple-bright);
  margin: 1.5em 0 0.5em;
  letter-spacing: 0.3px;
}

/* Heading anchors */
.heading-anchor {
  position: absolute;
  left: -26px;
  top: 0;
  color: var(--dim);
  font-weight: 400;
  font-size: 0.8em;
  text-decoration: none;
  opacity: 0;
  transition: opacity .12s, color .12s;
  padding: 0 6px;
}
.chapter-content h2:hover .heading-anchor,
.chapter-content h3:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--text-strong); text-decoration: none; }

.chapter-content p { margin: 1.15em 0; color: var(--body); }
.chapter-content p:first-child { margin-top: 0; }
.chapter-content ul, .chapter-content ol { margin: 1em 0; padding-left: 1.8em; color: var(--body); }
.chapter-content li { margin: 0.4em 0; }
.chapter-content li::marker { color: var(--dim); }
.chapter-content strong { font-weight: 700; color: var(--text-strong); }
.chapter-content em { color: var(--text); font-style: italic; }

.chapter-content blockquote {
  border-left: 3px solid var(--quote-border);
  background: var(--quote-bg);
  padding: 1em 1.4em;
  margin: 1.8em 0;
  color: var(--body);
  border-radius: 0 6px 6px 0;
  font-size: 0.97em;
  position: relative;
}
.chapter-content a.xref {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted var(--purple-soft);
  padding-bottom: 1px;
  transition: color .12s, border-color .12s;
}
.chapter-content a.xref:hover { color: var(--text-strong); border-bottom-color: var(--purple); text-decoration: none; }

.chapter-content blockquote p { margin: 0.4em 0; }
.chapter-content blockquote p:first-child { margin-top: 0; }
.chapter-content blockquote p:last-child { margin-bottom: 0; }

.chapter-content hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--purple-dim), transparent);
  margin: 2.4em auto;
  width: 60%;
  opacity: 0.55;
}

.chapter-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border-radius: 6px;
  background: var(--paper-hi);
  box-shadow: 0 4px 20px var(--shadow);
}

/* Inline code */
.chapter-content code:not(pre code) {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.5em;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.88em;
  letter-spacing: 0;
  font-feature-settings: "liga" 0;
  border: 1px solid var(--border);
}

/* Code blocks */
.chapter-content pre {
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 1.3em 1.5em;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.86em;
  line-height: 1.65;
  position: relative;
  border: 1px solid var(--border-hi);
}
.chapter-content pre code {
  font-family: var(--mono);
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border: none;
}
.copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(124, 92, 224, 0.08);
  border: 1px solid rgba(124, 92, 224, 0.2);
  color: var(--purple-bright);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
  text-transform: uppercase;
}
.chapter-content pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: rgba(124, 92, 224, 0.2); border-color: var(--purple); }
.copy-btn.copied { color: var(--text-strong); border-color: var(--purple); }

.chapter-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.9em;
  background: var(--paper-hi);
  border-radius: 6px;
  overflow: hidden;
}
.chapter-content th, .chapter-content td {
  padding: 0.8em 1em;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.chapter-content th { background: var(--code-bg); font-weight: 600; color: var(--text-strong); letter-spacing: 0.3px; font-size: 0.92em; }
.chapter-content tr:last-child td { border-bottom: none; }

/* ======================================================================
   Chapter navigation
   ====================================================================== */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  margin: 44px auto 0;
  padding-top: 28px;
  max-width: var(--content-max);
}
.chapter-nav a {
  display: block;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text);
  text-decoration: none;
  transition: all .14s;
  line-height: 1.45;
  font-size: 0.88rem;
}
.chapter-nav a:hover {
  border-color: var(--purple);
  color: var(--purple-bright);
  background: var(--paper-hi);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--purple-glow);
}
.chapter-nav .nav-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--purple-dim);
  margin-bottom: 6px;
  display: block;
}
.chapter-nav .prev { text-align: left; }
.chapter-nav .next { text-align: right; }
.chapter-nav .home {
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
.chapter-nav .home:hover { color: var(--text-strong); }

@media (max-width: 720px) {
  .chapter-nav { grid-template-columns: 1fr; }
}

.chapter-loading { text-align: center; padding: 5em 0; color: var(--muted); font-family: var(--mono); letter-spacing: 2px; text-transform: uppercase; font-size: 12px; }

.book-footer {
  text-align: center;
  margin: 44px auto 0;
  padding-top: 24px;
  max-width: var(--content-max);
  border-top: 1px dashed var(--border);
}
.book-footer .quote {
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  font-size: 0.92rem;
  font-weight: 400;
}
.book-footer .foot-links {
  display: flex;
  gap: 22px;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.book-footer a { color: var(--muted); }
.book-footer a:hover { color: var(--text-strong); }

/* ======================================================================
   Mobile drawer
   ====================================================================== */
.mobile-toc-toggle {
  display: none;
  position: fixed;
  bottom: 80px; right: 20px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--purple);
  color: var(--bg-void);
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 24px var(--purple-glow);
  z-index: 60;
  font-size: 1.2rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}
.mobile-toc-toggle:hover { background: var(--purple-bright); }
@media (max-width: 940px) { .mobile-toc-toggle { display: flex; } }

/* Mobile section TOC — article-style "On this page" inline accordion */
.mobile-section-list {
  display: none;   /* desktop hides this; right-rail inline-toc + left sidebar cover it */
  margin: 8px 0 24px;
}
@media (max-width: 820px) {
  .mobile-section-list { display: block; }
}

.mobile-section-list > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1.2px;
  color: var(--muted);
  text-transform: uppercase;
  transition: border-color .15s, background .15s;
}
.mobile-section-list > summary:hover {
  border-color: var(--purple);
  background: var(--paper-hi);
}
.mobile-section-list > summary::-webkit-details-marker { display: none; }
.msl-label { color: var(--text-strong); flex-shrink: 0; }
.msl-current {
  color: var(--purple-bright);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--sans);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60vw;
  min-width: 0;
  flex: 1;
}
.msl-chevron {
  margin-left: auto;
  transition: transform .2s ease;
  color: var(--dim);
  flex-shrink: 0;
}
.mobile-section-list[open] .msl-chevron { transform: rotate(180deg); }

.mobile-section-items {
  list-style: none;
  padding: 10px 0;
  margin: 6px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  max-height: 60vh;
  overflow-y: auto;
}
.mobile-section-items li a {
  display: block;
  padding: 9px 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.5;
  border-left: 2px solid transparent;
  font-family: var(--sans);
}
.mobile-section-items li a.level-3 {
  padding-left: 34px;
  font-size: 12.5px;
  opacity: 0.85;
}
.mobile-section-items li a:hover {
  background: var(--paper-hi);
  color: var(--text);
  text-decoration: none;
}

.mobile-toc-drawer {
  position: fixed; inset: 0;
  background: rgba(5, 4, 10, 0.68);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
  backdrop-filter: blur(8px);
}
.mobile-toc-drawer.open { opacity: 1; pointer-events: auto; }
.mobile-toc-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--paper);
  max-height: 82vh;
  overflow-y: auto;
  border-radius: 14px 14px 0 0;
  padding: 24px 22px 36px;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1px solid var(--border);
}
.mobile-toc-drawer.open .mobile-toc-panel { transform: translateY(0); }
.mobile-toc-handle {
  width: 40px; height: 4px;
  background: var(--border-hi);
  border-radius: 2px;
  margin: 0 auto 20px;
}
.mobile-toc-panel .sidebar-label { margin-bottom: 16px; }

/* ======================================================================
   Shortcut overlay
   ====================================================================== */
.shortcut-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 4, 10, 0.86);
  backdrop-filter: blur(12px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
}
.shortcut-overlay.open { display: flex; }
.shortcut-panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 34px 38px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
}
.shortcut-panel h3 {
  font-family: var(--mono);
  font-size: 12px;
  margin-bottom: 22px;
  color: var(--text-strong);
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.shortcut-panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 22px;
  font-size: 13.5px;
  align-items: center;
}
.shortcut-panel dt {
  font-family: var(--mono);
  background: var(--code-bg);
  padding: 3px 9px;
  border-radius: 3px;
  color: var(--purple-bright);
  font-size: 11px;
  white-space: nowrap;
  justify-self: start;
  border: 1px solid var(--border);
}
.shortcut-panel dd { color: var(--body); font-size: 13px; }
.shortcut-panel .close-hint {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-family: var(--mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--paper);
  border: 1px solid var(--purple);
  color: var(--purple-bright);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 1.8px;
  text-transform: uppercase;
  opacity: 0;
  transition: all .2s;
  z-index: 400;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ======================================================================
   Evaluation firewall footer (T-30 + UX-12)
   ====================================================================== */
.firewall {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(10, 14, 23, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 11px 24px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
body.theme-light .firewall { background: rgba(26, 30, 42, 0.92); color: #bcc3d0; }
.firewall-icon { width: 12px; height: 12px; color: var(--purple-bright); flex-shrink: 0; }
.firewall-msg { display: inline-flex; align-items: center; gap: 8px; }
.firewall-msg strong { color: var(--text-strong); font-weight: 600; }
.firewall-tag {
  text-transform: uppercase;
  color: var(--purple-bright);
  font-size: 10px;
  letter-spacing: 2px;
}

@media (max-width: 720px) {
  .firewall { font-size: 10px; padding: 9px 14px; }
  .firewall-msg span:not(.firewall-tag):not(strong) { display: none; }
}

/* ======================================================================
   Light-mode overrides — observation space
   - Read by density, not by brightness
   - Whites are muddied; card/bg difference is a whisper
   - Code block is the gravity core — pushed hard, everything else recedes
   - Purple split: primary for structure (H2 bar, quote), soft for auxiliary
   ====================================================================== */

/* Background — quiet vertical stratum, no radial drama */
body.theme-light {
  background: linear-gradient(180deg, var(--bg-void), var(--bg-deep));
  background-attachment: fixed;
}

/* Reading surface — barely a lift from the field, a bleeding shadow */
body.theme-light article.chapter-content {
  box-shadow: 0 2px 10px var(--shadow);
  padding: 56px 56px 64px;
  border-radius: 12px;
}
body.theme-light article.chapter-content::before {
  background: linear-gradient(90deg, transparent, var(--purple-soft), transparent);
  opacity: 0.45;
  height: 1px;
}

/* H1 — structural, not dramatic. Weight 600, barely-there rule below */
body.theme-light .chapter-content h1 {
  font-family: var(--display);
  font-size: clamp(1.85rem, 4vw, 2.4rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 0 0 1em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid rgba(28, 31, 38, 0.06);
}

/* Chapter title (rendered outside .chapter-content) — same light-mode color.
   Font-weight / size already defined in the base rule; no override needed here. */
body.theme-light .chapter-title-display {
  color: var(--text-strong);
}

/* H2 — vertical purple pillar as the structural marker */
body.theme-light .chapter-content h2 {
  position: relative;
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  padding-top: 0;
  padding-left: 16px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text-primary, var(--text-strong));
}
body.theme-light .chapter-content h2::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25em;
  bottom: 0.25em;
  width: 4px;
  height: auto;
  background: var(--purple);
  border-radius: 2px;
}

/* Cover hero — one abnormal element on the Cover page. Slight upscale +
   a deep violet drop-shadow so the number looks like it's pressing on the field.
   This is the single "異様" feature — everything else stays quiet. */
body.theme-light .book-code-hero {
  font-weight: 300;
  color: var(--text-strong);
  transform: scale(1.05);
  transform-origin: left center;
  filter: drop-shadow(0 24px 48px rgba(74, 58, 190, 0.25));
  transition: filter .4s ease;
}

/* Cover subtitle — the "decisive line" promoted out of the summary block */
body.theme-light .book-subtitle-main {
  font-size: clamp(17px, 1.7vw, 20px);
  font-weight: 600;
  color: var(--purple-bright);
  letter-spacing: 0.01em;
  line-height: 1.55;
}

/* Emphasis (em) — stop competing with purple structural marks.
   Italicise with a soft body color; purple is reserved for structure now. */
body.theme-light .chapter-content em {
  color: var(--text);
  font-style: italic;
}

/* Sidebars recede — present but distant; brighten on focus */
body.theme-light .book-toc-sidebar {
  opacity: 0.55;
  transition: opacity .3s ease;
}
body.theme-light .book-toc-sidebar:hover,
body.theme-light .book-toc-sidebar:focus-within {
  opacity: 1;
}
body.theme-light .inline-toc {
  opacity: 0.55;
  transition: opacity .3s ease;
}
body.theme-light .inline-toc:hover,
body.theme-light .inline-toc:focus-within {
  opacity: 1;
}

/* Cover panels — soft bleed, not a float */
body.theme-light .toc-grid,
body.theme-light .book-switch-item,
body.theme-light .book-meta {
  box-shadow: 0 2px 10px var(--shadow);
}

/* The gravity core — code fence pushes hard, only element with real shadow */
body.theme-light .chapter-content pre {
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 17, 21, 0.22);
}

/* Blockquote — subtle purple rail */
body.theme-light .chapter-content blockquote {
  border-left-width: 3px;
  box-shadow: none;
}

/* Print */
@media print {
  .orbit-bar, .book-toc-sidebar, .inline-toc, .chapter-nav, .chapter-bar,
  .book-footer, .mobile-toc-toggle, .mobile-toc-drawer, .shortcut-overlay,
  .starfield, .toast, .firewall { display: none !important; }
  body { background: white; color: black; font-size: 11pt; padding-bottom: 0; }
  .reader-layout { grid-template-columns: 1fr; padding: 0; max-width: none; }
  article.chapter-content { border: none; box-shadow: none; padding: 0; max-width: none; background: white; color: black; }
  .chapter-content h1, .chapter-content h2, .chapter-content h3, .chapter-content strong { color: black; }
  .chapter-content h2 { break-before: page; }
  .chapter-content img { max-width: 400px; break-inside: avoid; }
}
