/* =========================================================
   Flipbook viewer — dependency-free
   ========================================================= */

:root {
  --bg: #eceae4;
  --panel: #ffffff;
  --ink: #17172a;
  --muted: #726f68;
  --line: rgba(23, 23, 42, 0.10);
  --accent: #e2761b;
  --navy: #24245c;

  --topbar: 64px;
  --bottombar: 54px;

  --pw: 420px;
  --ph: 594px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(120% 80% at 50% -10%, #f8f7f3 0%, #eceae4 45%, #dfdcd4 100%);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

.app {
  display: flex;
  flex-direction: column;
  height: var(--app-h, 100dvh);
}

/* ---------------- top bar ---------------- */

.topbar {
  height: var(--topbar);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 30;
}

.btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}
.btn:hover { background: rgba(23, 23, 42, 0.06); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.icon { padding: 8px; }
.btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#menuBtn span { font-size: 14px; letter-spacing: 0.02em; }
#menuBtn svg { width: 22px; height: 22px; }

.meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 8px;
}
.meta-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meta-sub {
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tools { display: flex; gap: 2px; }

.draft-chip {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.draft-chip[hidden] { display: none; }

/* ---------------- stage ---------------- */

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 70px;
}

.book-area {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 2600px;
  perspective-origin: 50% 50%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(23, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.82);
  color: var(--navy);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(20, 20, 45, 0.10);
  transition: transform 0.18s var(--ease), background 0.18s ease, opacity 0.2s ease;
}
.nav svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
.nav:active { transform: translateY(-50%) scale(0.96); }
.nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.nav:disabled { opacity: 0.28; cursor: default; pointer-events: none; }
.nav-prev { left: 12px; }
.nav-next { right: 12px; }

/* ---------------- the book ---------------- */

.book {
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  transform-style: preserve-3d;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.book.is-ready { opacity: 1; }

/* soft cast shadow under the spread */
.book::after {
  content: "";
  position: absolute;
  inset: 8px -10px -10px -10px;
  border-radius: 4px;
  background: transparent;
  box-shadow: 0 34px 60px rgba(22, 22, 50, 0.22), 0 6px 14px rgba(22, 22, 50, 0.12);
  transform: translateZ(-3px);
  pointer-events: none;
}

.book-base {
  position: absolute;
  inset: 0;
  background: #f7f5f0;
  border-radius: 2px;
  box-shadow: inset 0 0 50px rgba(23, 23, 42, 0.05);
  z-index: 0;
}
.book-base::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 60px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, rgba(23, 23, 42, 0) 0%, rgba(23, 23, 42, 0.14) 50%, rgba(23, 23, 42, 0) 100%);
  opacity: 0.7;
}

/* subtle printed mark on the inside back cover (last spread of an even book) */
.end-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  display: none;
  place-items: center;
}
.book.is-end .end-mark { display: grid; }
.end-mark span {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(23, 23, 42, 0.14);
}
.end-mark span::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: rgba(23, 23, 42, 0.10);
}

.sheet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
  z-index: 10;
}

.face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fbfaf6;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 1px;
}
.face.back { transform: rotateY(180deg); }

.page-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* contain, not cover: a PDF with mixed page sizes must never be cropped */
  object-fit: contain;
  display: block;
  background: #f4f1ea;
  -webkit-user-drag: none;
}

/* permanent gutter shading */
.gutter {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.85;
}
.face.front .gutter {
  background: linear-gradient(90deg, rgba(23, 23, 42, 0.16) 0%, rgba(23, 23, 42, 0.05) 3.5%, rgba(23, 23, 42, 0) 12%);
}
.face.back .gutter {
  background: linear-gradient(270deg, rgba(23, 23, 42, 0.16) 0%, rgba(23, 23, 42, 0.05) 3.5%, rgba(23, 23, 42, 0) 12%);
}

/* animated shading during a turn */
.shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.face.front .shade {
  background: linear-gradient(90deg, rgba(10, 10, 25, 0.55) 0%, rgba(10, 10, 25, 0.12) 45%, rgba(10, 10, 25, 0.05) 100%);
}
.face.back .shade {
  background: linear-gradient(270deg, rgba(10, 10, 25, 0.55) 0%, rgba(10, 10, 25, 0.12) 45%, rgba(10, 10, 25, 0.05) 100%);
}

/* single-page mode */
.book.single { width: var(--pw); }
.single-page {
  position: absolute;
  inset: 0;
  opacity: 0;
  display: none;
  border-radius: 2px;
  overflow: hidden;
  background: #fbfaf6;
  will-change: transform, opacity;
  transform: translateZ(0);
}
.single-page.is-on { opacity: 1; display: block; }

/* ---------------- bottom bar ---------------- */

.bottombar {
  flex: 0 0 auto;
  height: var(--bottombar);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 30;
}
.track {
  position: relative;
  flex: 1 1 auto;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 3px;
  background: rgba(23, 23, 42, 0.10);
}
.track:focus-visible::before {
  box-shadow: 0 0 0 2px rgba(226, 118, 27, 0.55);
}
.fill {
  position: relative;
  z-index: 1;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--accent));
  border-radius: 3px;
  transition: width 0.4s var(--ease);
  pointer-events: none;
}
.track-thumb {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0%;
  width: 11px;
  height: 17px;
  margin: -8.5px 0 0 -5.5px;
  border-radius: 3px;
  background: var(--navy);
  box-shadow: 0 1px 4px rgba(10, 10, 30, 0.35);
  transition: left 0.4s var(--ease), background 0.15s ease;
  pointer-events: none;
}
.track.is-scrubbing .track-thumb { background: var(--accent); }

/* Hover/drag preview above the scrubber */
.scrub-preview {
  position: fixed;
  z-index: 2147483647;
  display: flex;
  gap: 8px;
  margin: 0;
  right: auto;
  border: 0;
  overflow: visible;
  padding: 9px 9px 7px;
  border-radius: 10px;
  background: #24245c;
  color: #fff;
  box-shadow: 0 18px 46px rgba(8, 8, 24, 0.45);
  transform: translateX(-50%) translateZ(0);
  will-change: transform;
  pointer-events: none;
}
.scrub-preview[hidden] { display: none; }
.scrub-pages { display: flex; gap: 8px; }
.scrub-page {
  margin: 0;
  width: clamp(84px, 26vw, 132px);
}
.scrub-page img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / var(--scrub-aspect, 1.4145);
  object-fit: cover;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
}
.scrub-page figcaption {
  margin-top: 5px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.scrub-tail {
  position: absolute;
  left: var(--tail-x, 50%);
  bottom: -6px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: #24245c;
  transform: rotate(45deg);
  border-radius: 2px;
}
.counter {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.counter #pageNow { color: var(--ink); font-weight: 600; }
.counter .sep { margin: 0 6px; opacity: 0.5; }

/* ---------------- thumbnails drawer ---------------- */

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 340px;
  max-width: 88vw;
  background: #fbfaf7;
  z-index: 60;
  transform: translateX(-101%);
  transition: transform 0.32s var(--ease), visibility 0s linear 0.32s;
  display: flex;
  flex-direction: column;
  box-shadow: 20px 0 60px rgba(20, 20, 45, 0.18);
  visibility: hidden;
}
.drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.32s var(--ease), visibility 0s;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.thumbs {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.thumb {
  appearance: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: inherit;
  color: var(--muted);
}
.thumb img {
  width: 100%;
  aspect-ratio: 1 / 1.414;
  object-fit: cover;
  border-radius: 2px;
  background: #eeece6;
  box-shadow: 0 4px 12px rgba(20, 20, 45, 0.14);
  transition: transform 0.18s var(--ease), box-shadow 0.18s ease;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.thumb:hover img { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20, 20, 45, 0.2); }
.thumb.is-active img { outline-color: var(--accent); }
.thumb.is-active { color: var(--ink); }
.thumb span { font-size: 11px; letter-spacing: 0.06em; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 15, 30, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.scrim.is-open { opacity: 1; }

/* ---------------- zoom lightbox ---------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #0d0d1a;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.2s ease;
}
/* `display:flex` would otherwise defeat the hidden attribute and leave an
   invisible full-screen layer swallowing every click. */
.lightbox[hidden],
.scrim[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lb-bar {
  flex: 0 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 20px;
  color: #e8e8f2;
  font-size: 13px;
  letter-spacing: 0.08em;
}
.lb-bar .btn { color: #e8e8f2; }
.lb-bar .btn:hover { background: rgba(255, 255, 255, 0.12); }
.lb-actions { display: flex; align-items: center; gap: 2px; }
.lb-zoom {
  font-size: 11.5px;
  color: #b9b9cc;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.lb-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 0 20px 24px;
  overscroll-behavior: contain;
}
.lb-pages {
  display: flex;
  gap: 4px;
  --z: 1;
  --lbw: 400px;
  margin: auto;
}
.lb-page { position: relative; flex: 0 0 auto; }
.lb-pages .lb-page > img {
  height: calc((100dvh - 150px) * var(--z));
  width: auto;
  display: block;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lb-images {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.lb-image-item { position: absolute; display: block; }
.lb-image-item img { display: block; width: 100%; height: 100%; }
.lb-texts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.lb-text-item {
  position: absolute;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-size: calc(var(--lbw) * var(--size, 0.03));
}

/* ---------------- loading + hint ---------------- */

.boot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 24px;
  z-index: 5;
  transition: opacity 0.3s ease;
}
.boot.is-hidden { opacity: 0; pointer-events: none; }
.boot p { margin: 0; max-width: 420px; line-height: 1.6; }
.boot code {
  font-family: Consolas, monospace;
  background: rgba(23, 23, 42, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.spin {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(23, 23, 42, 0.15);
  border-top-color: var(--navy);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottombar) + 18px);
  transform: translate(-50%, 8px);
  background: rgba(23, 23, 42, 0.88);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
  z-index: 40;
}
.hint.is-on { opacity: 1; transform: translate(-50%, 0); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottombar) + 18px);
  transform: translate(-50%, 8px);
  background: #17172a;
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(10, 10, 25, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 93;
  max-width: 90vw;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- image overlays ---------------- */

.images {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.image-item {
  position: absolute;
  display: block;
}
.image-item img {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------- text overlays ---------------- */

.texts {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.text-item {
  position: absolute;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------------- hotspots ---------------- */

.hotspots {
  position: absolute;
  inset: 0;
  z-index: 3;
}
.hotspot {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}
.hotspot:hover,
.hotspot:focus-visible {
  background: rgba(226, 118, 27, 0.10);
  box-shadow: inset 0 0 0 2px rgba(226, 118, 27, 0.9);
  outline: none;
}
.hotspot:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 3px rgba(226, 118, 27, 0.35);
}

.hotspot .badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(10, 10, 30, 0.35);
  transition: transform 0.18s var(--ease), background 0.18s ease;
  pointer-events: none;
}
.hotspot.hs-audio .badge { width: 42px; height: 42px; }
.hotspot:hover .badge { transform: translate(-50%, -50%) scale(1.08); background: #fff; }
.hotspot .badge svg { width: 22px; height: 22px; fill: currentColor; }
.hotspot.hs-audio .badge svg { width: 18px; height: 18px; }

.hotspot[data-label]::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  background: rgba(23, 23, 42, 0.94);
  color: #fff;
  font: 500 12px/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
  padding: 7px 11px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 5;
}
.hotspot[data-label]:hover::after,
.hotspot[data-label]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* media labels are always visible (touch devices have no hover) */
.hotspot.hs-video[data-label]::after,
.hotspot.hs-audio[data-label]::after {
  top: 50%;
  bottom: auto;
  margin-top: 34px;
  max-width: 240px;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  opacity: 1;
  transform: translateX(-50%);
}
.hotspot.hs-audio[data-label]::after { margin-top: 26px; }

.search-hit {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  border-radius: 3px;
  background: rgba(255, 205, 0, 0.38);
  box-shadow: 0 0 0 2px rgba(226, 118, 27, 0.9);
  animation: hitPulse 2.6s ease forwards;
}
@keyframes hitPulse {
  0% { opacity: 0; }
  8% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------------- search ---------------- */

.search,
.media {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  background: rgba(15, 15, 30, 0.5);
  backdrop-filter: blur(3px);
}
.search[hidden],
.media[hidden] { display: none; }

.search-panel {
  width: min(640px, 100%);
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  background: #fbfaf7;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(10, 10, 30, 0.45);
}
.search-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.search-head > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.search-head input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  padding: 8px 0;
}
.search-head input::-webkit-search-cancel-button { display: none; }
.search-meta {
  padding: 10px 18px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.search-results {
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
}
.result {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.result:hover,
.result.is-active { background: rgba(23, 23, 42, 0.06); }
.result b {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}
.result span { font-size: 14px; line-height: 1.55; color: #3b3b4a; }
.result mark {
  background: rgba(255, 205, 0, 0.55);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}
.search-empty {
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------------- media ---------------- */

.media {
  align-items: center;
  background: rgba(8, 8, 18, 0.94);
}
.media-inner { width: min(1100px, 100%); }
.media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 10px;
  color: #e8e8f2;
  font-size: 13px;
  letter-spacing: 0.06em;
}
.media-head .btn { color: #e8e8f2; }
.media-head .btn:hover { background: rgba(255, 255, 255, 0.12); }
.media-body {
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.media-body video,
.media-body iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  background: #000;
  border: 0;
}
.media-body audio { display: block; width: 100%; padding: 14px; background: #fbfaf7; }

/* ---------------- audio bar ---------------- */

.audiobar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottombar) + 16px);
  transform: translateX(-50%);
  z-index: 85;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, 94vw);
  padding: 10px 12px 10px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(20, 20, 45, 0.28);
}
.audiobar[hidden] { display: none; }
.audio-title {
  font-size: 13px;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.audiobar audio { height: 36px; max-width: 300px; }

/* ---------------- drawer tabs ---------------- */

.drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: visible;
  scrollbar-width: none;
}
.drawer-tabs::-webkit-scrollbar { display: none; }
.drawer-tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.drawer-tabs button:hover { color: var(--ink); }
.drawer-tabs button.is-on {
  background: rgba(23, 23, 42, 0.07);
  color: var(--ink);
  font-weight: 600;
}

.drawer-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.drawer-panel[hidden] { display: none; }

.toc-list { padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.toc-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.toc-item:hover { background: rgba(23, 23, 42, 0.06); }
.toc-item strong { font-weight: 500; }
.toc-item span { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.toc-empty { padding: 18px 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* ---------------- bookmarks ---------------- */

.bookmark-list { padding: 12px; display: flex; flex-direction: column; gap: 3px; }
.bookmark-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  border-radius: 8px;
}
.bookmark-item:hover { background: rgba(23, 23, 42, 0.06); }
.bookmark-jump {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.bookmark-jump strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-jump span { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.bookmark-remove {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
}
.bookmark-remove:hover { color: var(--danger, #b3261e); background: rgba(179, 38, 30, 0.08); }
#bookmarkBtn.is-on svg { fill: currentColor; }
#playBtn.is-on { color: var(--accent); }

/* ---------------- text panel ---------------- */

.text-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf7;
}
.text-nav {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.text-nav:disabled { opacity: 0.35; cursor: default; }
.text-page { flex: 1 1 auto; text-align: center; font-size: 12px; color: var(--muted); }
.text-read {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  white-space: nowrap;
}
.text-read:hover { background: #f3f1ec; }
.text-body { padding: 16px 18px 28px; font-size: 15px; line-height: 1.65; color: var(--ink); }
.text-body p { margin: 0 0 14px; }
.text-body p:last-child { margin-bottom: 0; }

.page-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.page-feedback button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.page-feedback button:hover { background: #f3f1ec; }
.page-feedback button.is-on { border-color: var(--accent); background: rgba(226, 118, 27, 0.1); }
.page-feedback .thanks { color: var(--accent); font-size: 12px; }

/* ---------------- comments ---------------- */

#drawerComments {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#drawerComments[hidden] { display: none; }
.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.comments-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(23, 23, 42, 0.08);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 10.5px;
}
.comment-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}
.comment-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.comment-item.is-reply { margin-left: 18px; background: #faf8f3; }
.comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}
.comment-meta strong { color: var(--ink); font-size: 12px; }
.comment-text {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.comment-empty {
  margin: 0;
  padding: 16px 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.comment-form {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line);
  background: #fbfaf7;
}
.comment-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.comment-label input,
.comment-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 9px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: normal;
  resize: vertical;
}
.comment-label input:focus,
.comment-label textarea:focus {
  outline: 2px solid rgba(226, 118, 27, 0.35);
  outline-offset: 1px;
}
.comment-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.comment-submit {
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 9px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.comment-submit:hover { background: #ef8326; }
.comment-submit:disabled { opacity: 0.55; cursor: default; }
.comment-status {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}
.comment-status.is-ok { color: #2f7a53; }
.comment-status.is-error { color: var(--danger); }

/* ---------------- quiz / poll ---------------- */

.quiz {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 15, 30, 0.58);
  backdrop-filter: blur(4px);
}
.quiz[hidden] { display: none; }
.quiz-panel {
  width: min(540px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 16px;
  background: #fbfaf7;
  box-shadow: 0 30px 80px rgba(10, 10, 30, 0.5);
}
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.quiz-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.quiz-head .btn { color: var(--muted); }
.quiz-panel h2 {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.35;
}
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.quiz-option {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}
.quiz-option:hover { border-color: rgba(226, 118, 27, 0.6); background: #fdf6ee; }
.quiz-option:disabled { cursor: default; }
.quiz-option.is-correct {
  border-color: #2f7a53;
  background: rgba(47, 122, 83, 0.1);
  color: #1f5c3d;
  font-weight: 600;
}
.quiz-option.is-wrong {
  border-color: var(--danger);
  background: rgba(179, 38, 30, 0.08);
  color: #8a1f19;
}
.quiz-option.is-selected {
  border-color: var(--accent);
  background: rgba(226, 118, 27, 0.09);
  color: var(--ink);
}
.quiz-result {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 600;
}
.quiz-result.is-correct { color: #2f7a53; }
.quiz-result.is-wrong { color: var(--danger); }
.quiz-explain {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.quiz-empty { color: var(--muted); font-size: 13px; }
.quiz-done {
  appearance: none;
  margin-top: 16px;
  width: 100%;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.quiz-done:hover { background: #ef8326; }
.badge-quiz {
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ---------------- accessibility ---------------- */

.skip-link {
  position: fixed;
  left: 10px;
  top: -52px;
  z-index: 200;
  background: #17172a;
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 10px; }

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

.text-size {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}
.text-size button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 3px 8px;
  font: inherit;
  cursor: pointer;
}
.text-size button:hover { background: #f3f1ec; }

/* ---------------- share & export ---------------- */

.share {
  position: fixed;
  inset: 0;
  z-index: 92;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  background: rgba(15, 15, 30, 0.5);
  backdrop-filter: blur(3px);
}
.share[hidden] { display: none; }
.share-panel {
  width: min(430px, 100%);
  background: #fbfaf7;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(10, 10, 30, 0.45);
}
.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; }
.share-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.share-item:hover { background: #f3f1ec; }
.share-item[hidden] { display: none; }
.share-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.share-note { margin: 0; padding: 0 18px 16px; font-size: 12px; color: var(--muted); }
.share-note[hidden] { display: none; }

/* ---------------- keyboard shortcuts ---------------- */

.shortcuts {
  position: fixed;
  inset: 0;
  z-index: 94;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  background: rgba(15, 15, 30, 0.5);
  backdrop-filter: blur(3px);
}
.shortcuts[hidden] { display: none; }
.shortcuts-panel {
  width: min(440px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  background: #fbfaf7;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(10, 10, 30, 0.45);
}
.shortcuts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
}
.shortcuts-list {
  margin: 0;
  padding: 8px 18px 16px;
  display: flex;
  flex-direction: column;
}
.shortcuts-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(23, 23, 42, 0.06);
}
.shortcuts-list > div:last-child { border-bottom: 0; }
.shortcuts-list dt {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--ink);
  background: rgba(23, 23, 42, 0.06);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.shortcuts-list dd { margin: 0; font-size: 13px; color: var(--muted); text-align: right; }

/* ---------------- password gate ---------------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 13, 26, 0.96);
}
.gate[hidden] { display: none; }
.gate-panel {
  width: min(380px, 100%);
  padding: 30px 26px;
  border-radius: 16px;
  background: #1d1d33;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  color: #f2f2f8;
  text-align: center;
}
.gate-panel > svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: #f0d9c4;
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.gate-panel h1 {
  margin: 10px 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 600;
}
.gate-panel > p { margin: 0 0 18px; color: #a9a9c4; font-size: 13px; }
.gate-panel form { text-align: left; }
.gate-panel input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font: inherit;
  font-size: 16px;
}
.gate-panel input:focus {
  outline: 2px solid rgba(226, 118, 27, 0.6);
  outline-offset: 1px;
  border-color: var(--accent);
}
.gate-panel button {
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.gate-panel button:disabled { opacity: 0.6; cursor: default; }
.gate-error { margin: 10px 0 0; color: #ff9b8f; font-size: 12.5px; }
.gate-error[hidden] { display: none; }
.gate-panel a {
  display: inline-block;
  margin-top: 20px;
  color: #a9a9c4;
  font-size: 12px;
  text-decoration: none;
}
.gate-panel a:hover { color: #fff; }

.print-area { display: none; }

@media print {
  html, body { height: auto; overflow: visible; background: #fff; }
  .app, .drawer, .scrim, .lightbox, .search, .media, .share, .hint, .boot { display: none !important; }
  .print-area { display: block; }
  .print-area img {
    display: block;
    width: 100%;
    max-width: 100%;
    page-break-after: always;
    break-after: page;
  }
  .print-area img:last-child { page-break-after: auto; break-after: auto; }
}

/* ---------------- responsive ---------------- */

@media (max-height: 720px) {
  :root { --topbar: 52px; --bottombar: 44px; }
  .stage { padding: 8px 60px; }
  .meta-sub { display: none; }
  .bottombar { height: var(--bottombar); }
}

@media (max-width: 900px) {
  .stage { padding: 8px 8px; }
  .nav { width: 40px; height: 40px; }
  .nav-prev { left: 2px; }
  .nav-next { right: 2px; }
  .meta-sub { display: none; }
  #menuBtn span { display: none; }
  .hint { bottom: calc(var(--bottombar) + 10px); }
}

@media (max-width: 560px) {
  :root { --topbar: 56px; --bottombar: 48px; }
  .topbar { padding: 0 8px; gap: 6px; }
  .btn.icon { padding: 6px; }
  #helpBtn { display: none; }
  .meta-title { font-size: 15px; }
  .draft-chip { display: none; }
  /* 44 px keeps the overlay at the minimum comfortable touch target. */
  .nav { width: 44px; height: 44px; background: rgba(255, 255, 255, 0.7); }
  .nav svg { width: 18px; height: 18px; }
  .bottombar { padding: 0 14px; gap: 12px; }
  .search, .media { padding: 4vh 10px 16px; }
  .search-panel { max-height: 84vh; }
  .hotspot .badge { width: 42px; height: 42px; }
  .audiobar { bottom: calc(var(--bottombar) + 10px); gap: 8px; padding: 8px 8px 8px 12px; }
  .audio-title { max-width: 96px; }
  .audiobar audio { max-width: 210px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}

/* ---------------- embed ---------------- */

body.embed .topbar,
body.embed .bottombar,
body.embed .hint,
body.embed .draft-chip { display: none; }
body.embed .stage { padding: 0; }
body.embed .book-area { padding: 0; }

/* ---------------- reading themes ---------------- */

html[data-theme="dark"] {
  --bg: #14141d;
  --panel: #1e1e2b;
  --ink: #f2f2f8;
  --muted: #a9a9c4;
  --line: rgba(255, 255, 255, 0.13);
  --navy: #9a9ae8;
  --accent: #f08a32;
}
html[data-theme="dark"] body {
  background: radial-gradient(120% 80% at 50% -10%, #20202e 0%, #14141d 55%, #0d0d14 100%);
}
html[data-theme="dark"] .topbar { background: rgba(20, 20, 31, 0.86); }
html[data-theme="dark"] .bottombar { background: rgba(20, 20, 31, 0.82); }
html[data-theme="dark"] .nav { background: rgba(30, 30, 43, 0.9); border-color: var(--line); }
html[data-theme="dark"] .nav:hover { background: #2a2a3d; }
html[data-theme="dark"] .btn:hover { background: rgba(255, 255, 255, 0.08); }
html[data-theme="dark"] .track::before { background: rgba(255, 255, 255, 0.14); }
html[data-theme="dark"] .drawer { background: #1b1b28; }
html[data-theme="dark"] .drawer-tabs button.is-on { background: rgba(255, 255, 255, 0.1); }
html[data-theme="dark"] .toc-item:hover,
html[data-theme="dark"] .bookmark-item:hover { background: rgba(255, 255, 255, 0.07); }
html[data-theme="dark"] .text-tools { background: #1b1b28; }
html[data-theme="dark"] .text-nav,
html[data-theme="dark"] .text-read { background: #26263a; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .text-read:hover { background: #303048; }
html[data-theme="dark"] .search-panel,
html[data-theme="dark"] .share-panel,
html[data-theme="dark"] .shortcuts-panel { background: #1b1b28; }
html[data-theme="dark"] .search-head input { background: #26263a; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .share-item { background: #26263a; border-color: var(--line); color: var(--ink); }
html[data-theme="dark"] .share-item:hover { background: #303048; }
html[data-theme="dark"] .shortcuts-list dt { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
html[data-theme="dark"] .media-body audio { background: #1b1b28; }
html[data-theme="dark"] .boot { background: #14141d; color: var(--ink); }
html[data-theme="dark"] .hotspot .badge { background: rgba(30, 30, 43, 0.94); color: var(--ink); }

html[data-theme="sepia"] {
  --bg: #efe6d4;
  --panel: #fbf3e2;
  --ink: #3b3020;
  --muted: #7d6e57;
  --line: rgba(59, 48, 32, 0.16);
  --navy: #6b5634;
  --accent: #b5651d;
}
html[data-theme="sepia"] body {
  background: radial-gradient(120% 80% at 50% -10%, #faf3e3 0%, #efe6d4 50%, #e3d7c0 100%);
}
html[data-theme="sepia"] .topbar { background: rgba(250, 243, 227, 0.74); }
html[data-theme="sepia"] .bottombar { background: rgba(250, 243, 227, 0.64); }
html[data-theme="sepia"] .drawer,
html[data-theme="sepia"] .search-panel,
html[data-theme="sepia"] .share-panel,
html[data-theme="sepia"] .shortcuts-panel,
html[data-theme="sepia"] .text-tools { background: #fbf3e2; }
html[data-theme="sepia"] .text-nav,
html[data-theme="sepia"] .text-read,
html[data-theme="sepia"] .share-item,
html[data-theme="sepia"] .search-head input { background: #fff8ea; border-color: var(--line); }
html[data-theme="sepia"] .nav { background: rgba(255, 248, 234, 0.86); border-color: var(--line); }
html[data-theme="sepia"] .btn:hover { background: rgba(59, 48, 32, 0.06); }
