/* Copyright © TroBee ONE LLC. All Rights Reserved. */

:root {
  --bg-color: #f8f6f0;
  --text-color: #2b2b2b;
  --text-muted: #6e6d6a;
  --card-bg: rgba(0, 0, 0, 0.04);
  --border-color: rgba(0, 0, 0, 0.09);
  --accent-color: #a4421b;
  --accent-glow: rgba(164, 66, 27, 0.15);
  --code-bg: #eae6db;
  --code-text: #1f2328;
  --panel-bg: rgba(248, 246, 240, 0.95);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  --font-base: "Merriweather", Georgia, "Times New Roman", serif;
  --font-size: 18px;
  --line-height: 1.75;
  --max-width: 680px;
  --header-height: 56px;
  --footer-height: 54px;
}

/* Themes */
body.theme-light {
  --bg-color: #faf9f6;
  --text-color: #262626;
  --text-muted: #737373;
  --card-bg: rgba(0, 0, 0, 0.03);
  --border-color: rgba(0, 0, 0, 0.08);
  --accent-color: #923a13;
  --code-bg: #eceae5;
  --code-text: #1a1a1a;
  --panel-bg: rgba(250, 249, 246, 0.96);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

body.theme-sepia {
  --bg-color: #f3ecda;
  --text-color: #3b2e2a;
  --text-muted: #7c685b;
  --card-bg: rgba(59, 46, 42, 0.04);
  --border-color: rgba(59, 46, 42, 0.12);
  --accent-color: #8c3b1e;
  --code-bg: #e5dcc7;
  --code-text: #2f221e;
  --panel-bg: rgba(243, 236, 218, 0.96);
  --shadow: 0 8px 30px rgba(59, 46, 42, 0.1);
}

body.theme-slate {
  --bg-color: #1e2227;
  --text-color: #abb2bf;
  --text-muted: #5c6370;
  --card-bg: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-color: #e5c07b;
  --code-bg: #16191d;
  --code-text: #98c379;
  --panel-bg: rgba(30, 34, 39, 0.96);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

body.theme-midnight {
  --bg-color: #0b0c0e;
  --text-color: #d1d5db;
  --text-muted: #6b7280;
  --card-bg: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.07);
  --accent-color: #60a5fa;
  --code-bg: #030405;
  --code-text: #34d399;
  --panel-bg: rgba(11, 12, 14, 0.96);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

/* Font Families */
body.font-serif {
  --font-base: "Merriweather", Georgia, "Times New Roman", serif;
}
body.font-sans {
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body.font-mono {
  --font-base: "SF Mono", "Fira Code", Menlo, Monaco, Consolas, monospace;
}

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

html, body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-base);
  font-size: var(--font-size);
  line-height: var(--line-height);
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Header Bar */
.reader-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  transition: transform 0.25s ease;
}

.reader-header.header-hidden {
  transform: translateY(-100%);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-color);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--card-bg);
  border-color: var(--border-color);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Main Reader Viewport */
.reader-viewport {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--header-height) + 32px) 24px calc(var(--footer-height) + 64px);
  min-height: 100vh;
}

/* Chapter Typography */
.chapter-container {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chapter-heading {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
  text-align: center;
  color: var(--text-color);
}

p.reader-p {
  margin-bottom: 1.5em;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  word-break: break-word;
}

/* Scene Divider */
.scene-divider {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 2.5rem auto;
  width: 35%;
  position: relative;
}

.scene-divider::after {
  content: "♦ ♦ ♦";
  display: block;
  text-align: center;
  position: relative;
  top: -0.65em;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.5em;
  background: var(--bg-color);
  width: max-content;
  margin: 0 auto;
  padding: 0 8px;
}

/* AI Cognition Ledger / Terminal Console View */
.ledger-console {
  background: #0c1015;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-left: 3px solid #38bdf8;
  border-radius: 8px;
  margin: 1.8rem 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), inset 0 0 20px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  position: relative;
}

/* Subtle CRT scanline effect */
.ledger-console::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.22) 50%);
  background-size: 100% 4px;
  z-index: 2;
  pointer-events: none;
  opacity: 0.35;
}

.ledger-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(20, 26, 33, 0.96);
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #8b949e;
  user-select: none;
}

.ledger-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ledger-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #f87171; box-shadow: 0 0 4px rgba(248, 113, 113, 0.5); }
.dot-yellow { background: #fbbf24; box-shadow: 0 0 4px rgba(251, 191, 36, 0.5); }
.dot-green { background: #34d399; box-shadow: 0 0 4px rgba(52, 211, 153, 0.5); }

.ledger-console-title {
  color: #38bdf8;
  font-weight: 600;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ledger-console-icon {
  font-size: 0.8rem;
  opacity: 0.85;
}

.ledger-console-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #34d399;
  font-size: 0.68rem;
}

.ledger-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
  animation: pulse-live 2s infinite ease-in-out;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.ledger-console-screen {
  background: transparent;
  position: relative;
  z-index: 1;
}

.ledger-console-body {
  margin: 0;
  padding: 16px 18px;
  background: transparent;
  color: #cbd5e1;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.82em;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}

.ledger-console-body code {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
  border: none;
}

/* Tokens and tags inside ledger */
.ledger-header-text {
  display: inline-block;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
  margin-bottom: 0.4rem;
}

.ledger-tag {
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 0.95em;
}

.tag-oplog {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.14);
}

.tag-assess {
  color: #34d399;
  background: rgba(52, 211, 153, 0.14);
}

.tag-warn {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
}

.tag-info {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.14);
}

.tag-note {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.14);
}

.tag-revision {
  color: #f87171;
  background: rgba(248, 113, 113, 0.14);
}

.ledger-epoch {
  color: #fbbf24;
  font-weight: 600;
}

.ledger-divider-line {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.35), rgba(56, 189, 248, 0.05));
  margin: 10px 0;
}

/* Legacy fallback block */
.ledger-block {
  background-color: #0c1015;
  color: #cbd5e1;
  padding: 16px 18px;
  border-radius: 8px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82em;
  line-height: 1.6;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 1.8rem 0;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-left: 3px solid #38bdf8;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Illustrations */
.reader-illustration {
  margin: 2.2rem -12px;
  text-align: center;
}

.reader-illustration img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reader-illustration img:hover {
  transform: scale(1.008);
}

.reader-illustration figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 10px;
  padding: 0 16px;
  line-height: 1.4;
}

/* Frontispiece Specifics */
.frontispiece-view {
  text-align: center;
  padding: 2rem 0;
}

.frontispiece-title {
  font-size: 2.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-weight: 800;
  color: var(--text-color);
}

.frontispiece-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

.frontispiece-art {
  max-width: 100%;
  margin: 1.5rem auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.epigraph-card {
  margin: 2.5rem auto;
  padding: 1.5rem 2rem;
  background: var(--card-bg);
  border-left: 3px solid var(--accent-color);
  border-radius: 4px;
  font-style: italic;
  font-size: 1.15em;
  line-height: 1.6;
  max-width: 540px;
  text-align: center;
}

.frontispiece-copyright {
  margin-top: 3rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Kindle-Style Bottom Reader Bar */
.reader-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background-color: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.25s ease;
}

.reader-footer.footer-hidden {
  transform: translateY(100%);
}

.footer-nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-color);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.footer-nav-btn:hover:not(:disabled) {
  background: var(--card-bg);
  border-color: var(--border-color);
}

.footer-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.footer-progress-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
}

.footer-chapter-name {
  font-weight: 600;
  color: var(--text-color);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-progress-bar-container {
  width: 140px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.footer-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-color);
  transition: width 0.15s ease;
}

/* Modals & Drawers */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Table of Contents Drawer */
.toc-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--panel-bg);
  border-right: 1px solid var(--border-color);
  z-index: 210;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
}

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

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.toc-list {
  overflow-y: auto;
  padding: 12px 8px;
  list-style: none;
  flex: 1;
}

.toc-item {
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
  color: var(--text-color);
}

.toc-item:hover {
  background: var(--card-bg);
}

.toc-item.active {
  background: var(--accent-glow);
  color: var(--accent-color);
  font-weight: 600;
}

/* Settings Modal */
.settings-modal {
  position: fixed;
  top: calc(var(--header-height) + 8px);
  right: 16px;
  width: 320px;
  max-width: 90vw;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  z-index: 220;
  display: none;
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.settings-modal.open {
  display: block;
}

.settings-row {
  margin-bottom: 16px;
}

.settings-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.theme-pill-group, .font-pill-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.font-pill-group {
  grid-template-columns: repeat(3, 1fr);
}

.pill-btn {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 8px 6px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--accent-color);
}

.pill-btn.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
  font-weight: 600;
}

.size-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px;
}

.size-btn {
  background: transparent;
  border: 0;
  color: var(--text-color);
  width: 40px;
  height: 34px;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.size-btn:hover {
  background: var(--border-color);
}

.size-indicator {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Lightbox */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

.lightbox-modal.open {
  display: flex;
}

.lightbox-modal img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

/* Responsive adjustments for phones */
@media (max-width: 600px) {
  :root {
    --font-size: 17px;
    --line-height: 1.68;
    --header-height: 50px;
    --footer-height: 50px;
  }
  
  .reader-viewport {
    padding: calc(var(--header-height) + 16px) 16px calc(var(--footer-height) + 48px);
  }
  
  .chapter-heading {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
  }
  
  .frontispiece-title {
    font-size: 1.9rem;
  }
  
  p.reader-p {
    text-align: left;
  }
  
  .reader-illustration {
    margin: 1.8rem -8px;
  }
  
  .settings-modal {
    right: 8px;
    left: 8px;
    width: auto;
  }
  
  .footer-chapter-name {
    max-width: 140px;
  }
  
  .footer-progress-bar-container {
    width: 90px;
  }
}

/* Audio Controls & Chips */
.audio-btn {
  position: relative;
}

.audio-btn.playing {
  color: var(--accent-color);
  animation: audioPulse 2s infinite ease-in-out;
}

@keyframes audioPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

.frontispiece-audio-chip, .author-note-audio-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 1.2rem auto 0;
  padding: 8px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.frontispiece-audio-chip:hover, .author-note-audio-chip:hover {
  border-color: var(--accent-color);
  color: var(--text-color);
}

.frontispiece-audio-chip.playing, .author-note-audio-chip.playing {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: var(--accent-glow);
  font-weight: 600;
}

.mode-pill-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.audio-pill-group {
  display: grid;
  grid-template-columns: 1fr;
}

/* Author's Note & Finale Page */
.author-note-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 3rem 1rem;
}

.author-note-card {
  max-width: 620px;
  width: 100%;
  text-align: center;
  padding: 3.5rem 2rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.4s ease-out;
}

.author-note-sparkle {
  color: var(--accent-color);
  font-size: 0.85rem;
  letter-spacing: 0.5em;
  margin-bottom: 2rem;
}

.author-note-headline {
  font-size: 1.8rem;
  line-height: 1.45;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 2rem;
  font-style: italic;
  letter-spacing: -0.01em;
}

.author-note-signature {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-color);
  margin-bottom: 2.5rem;
  text-transform: uppercase;
}

.author-note-copyright {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Mobile Screen-by-Screen Swipe Mode */
body.mode-swipe {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
  user-select: none;
  -webkit-user-select: none;
}

body.mode-swipe .reader-viewport {
  max-width: 100% !important;
  width: 100vw !important;
  height: calc(100dvh - var(--header-height) - var(--footer-height)) !important;
  margin-top: var(--header-height) !important;
  padding: 0 !important;
  overflow: hidden !important;
  position: relative !important;
  min-height: auto !important;
  background-color: var(--bg-color) !important;
  transition: margin-top 0.25s ease, height 0.25s ease;
}

body.mode-swipe.bars-hidden .reader-viewport {
  margin-top: 0 !important;
  height: 100dvh !important;
  padding-top: env(safe-area-inset-top, 14px) !important;
  padding-bottom: env(safe-area-inset-bottom, 14px) !important;
}

body.mode-swipe #chapterContent {
  height: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  position: relative !important;
}

body.mode-swipe .chapter-container,
body.mode-swipe .frontispiece-view,
body.mode-swipe .author-note-view {
  height: 100% !important;
  width: 100% !important;
  column-width: calc(100vw - 36px) !important;
  column-gap: 36px !important;
  column-fill: auto !important;
  padding: 16px 18px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  max-width: none !important;
  transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

body.mode-swipe .chapter-heading {
  margin-bottom: 1.2rem;
}

body.mode-swipe p.reader-p {
  margin-bottom: 1.2em;
  break-inside: avoid;
  page-break-inside: avoid;
}

body.mode-swipe .scene-divider,
body.mode-swipe .ledger-block,
body.mode-swipe .ledger-console,
body.mode-swipe .epigraph-card,
body.mode-swipe .author-note-card {
  break-inside: avoid;
  page-break-inside: avoid;
  max-height: 58vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mode-swipe .reader-illustration {
  break-inside: avoid;
  page-break-inside: avoid;
  max-height: 48vh;
  margin: 10px auto;
  overflow: hidden;
}

body.mode-swipe .reader-illustration img {
  max-height: 38vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  margin: 0 auto;
}

body.mode-swipe .frontispiece-art {
  max-height: 40vh;
  width: auto;
  object-fit: contain;
  margin: 0.5rem auto;
}

