:root {
  --bg: #0b0d10;
  --bg2: #12161c;
  --bar: rgba(15, 19, 24, 0.92);
  --card: #161b22;
  --ink: #eef1f4;
  --ink2: #cfd4da;
  --mut: #9aa3ad;
  --red: #E1121D;
  --red2: #b3121b;
  --line: rgba(255, 255, 255, 0.10);
  --stage-grid: rgba(255, 255, 255, 0.025);
  --h: 'Barlow Semi Condensed', system-ui, sans-serif;
  --b: 'Barlow', system-ui, sans-serif;
}

html[data-theme="light"] {
  --bg: #e4e7ec;
  --bg2: #f4f5f7;
  --bar: rgba(255, 255, 255, 0.94);
  --card: #ffffff;
  --ink: #171b20;
  --ink2: #343b44;
  --mut: #5b636e;
  --line: rgba(12, 18, 26, 0.12);
  --stage-grid: rgba(12, 18, 26, 0.035);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  position: fixed;
  inset: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--b);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

body {
  display: flex;
  flex-direction: column;
}

html:fullscreen, html:-webkit-full-screen,
body:fullscreen, body:-webkit-full-screen {
  position: fixed;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  background: var(--bg);
}

/* TOPBAR */
.topbar {
  height: calc(56px + env(safe-area-inset-top));
  flex: 0 0 auto;
  background: var(--bar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 40;
}

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

.tb-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  margin-right: 4px;
}
.tb-icon { width: 26px; height: 26px; display: block; }
.ic-light { display: none; }
html[data-theme="light"] .ic-light { display: block; }
html[data-theme="light"] .ic-dark { display: none; }
.tb-word { font-family: var(--h); font-weight: 800; font-size: 19px; letter-spacing: -0.4px; }
.tb-word b { color: var(--red); }

.tb-pill {
  font-family: var(--h);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.6px;
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 6px;
}

.tb-center {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.page-readout {
  font-family: var(--h);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.6px;
  color: var(--ink);
  background: rgba(225, 18, 29, 0.14);
  border: 1px solid rgba(225, 18, 29, 0.36);
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.chapter-readout {
  font-size: 13px;
  font-weight: 500;
  color: var(--mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink2);
  font-family: var(--h);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
html[data-theme="light"] .tbtn { background: rgba(12, 18, 26, 0.04); }
.tbtn.icon-only { width: 36px; padding: 0; justify-content: center; }
.tbtn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.tbtn .ic-sun { display: none; }
html[data-theme="light"] .tbtn .ic-sun { display: block; }
html[data-theme="light"] .tbtn .ic-moon { display: none; }

.btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-family: var(--h);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  transition: background .2s, transform .15s;
}
.btn-pdf svg { width: 15px; height: 15px; }
.pdf-short { display: none; }

/* EMBED & STANDALONE LANGUAGE SWITCHER */
.kat-lang {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  gap: 2px;
}
html[data-theme="light"] .kat-lang { background: rgba(12, 18, 26, 0.04); }
.kat-lang button {
  height: 30px;
  padding: 0 7px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--mut);
  font-family: var(--h);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.kat-lang button.on { background: var(--red); color: #fff; }

.dr-lang {
  display: none;
  padding: 6px 16px 4px;
  gap: 6px;
}
.dr-lang button {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink2);
  font-family: var(--h);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}
html[data-theme="light"] .dr-lang button { background: rgba(12, 18, 26, 0.04); }
.dr-lang button.on { background: var(--red); border-color: var(--red); color: #fff; }

html.is-embed .tb-brand,
html.is-embed .tb-pill,
html.is-embed .kat-lang,
html.is-embed .dr-lang { display: none !important; }
html.is-embed #btnFull { display: inline-flex !important; }

/* MOBILE CHAPTER STRIP */
.mob-chapter {
  display: none;
  width: 100%;
  height: 34px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: none;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink2);
  font-family: var(--b);
  font-size: 12.5px;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  z-index: 35;
}
.mc-code {
  font-family: var(--h);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: #fff;
  background: var(--red);
  padding: 2px 7px;
  border-radius: 5px;
  flex: 0 0 auto;
}
.mc-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mc-caret {
  color: var(--mut);
  font-size: 12px;
  flex: 0 0 auto;
}

/* STAGE */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background:
    radial-gradient(65% 65% at 50% 45%, rgba(255, 255, 255, 0.04) 0%, transparent 72%),
    repeating-linear-gradient(0deg, transparent 0 31px, var(--stage-grid) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, var(--stage-grid) 31px 32px),
    var(--bg);
  overflow: hidden;
}

.book-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  filter: drop-shadow(0 26px 46px rgba(0, 0, 0, 0.56));
  transition: transform .34s cubic-bezier(.22, 1, .36, 1);
}
html[data-theme="light"] .book-shell {
  filter: drop-shadow(0 22px 38px rgba(12, 18, 26, 0.22));
}
.book-shell.is-portrait {
  filter: none;
}
.book-shell.is-portrait .stf__parent,
.book-shell.is-portrait .mcurl-root {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.50);
}
html[data-theme="light"] .book-shell.is-portrait .stf__parent,
html[data-theme="light"] .book-shell.is-portrait .mcurl-root {
  box-shadow: 0 14px 32px rgba(12, 18, 26, 0.22);
}

.mcurl-root {
  position: relative;
  overflow: hidden;
  background: #ffffff;
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transform: translateZ(0);
}
.mcurl-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
.mcurl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  will-change: opacity;
  pointer-events: none;
  touch-action: none;
}

.book-host {
  position: relative;
}
.book-host, .stf__parent, .stf__wrapper, .stf__block {
  touch-action: none !important;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.flip-page {
  background: #ffffff;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-touch-callout: none;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 10px rgba(0, 0, 0, 0.22);
}
.flip-page img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  touch-action: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Authentic matte paper backside for St.PageFlip portrait forward curl flap */
.stf__wrapper.--portrait .flip-page.--paper-back {
  background: linear-gradient(118deg, #f8f9fb 0%, #eef1f5 55%, #e1e5eb 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.stf__wrapper.--portrait .flip-page.--paper-back img {
  opacity: 0.13;
  transform: scaleX(-1) translateZ(0);
  filter: grayscale(0.45) contrast(0.85);
}

/* StPageFlip core structural rules */
.stf__parent {
  position: relative;
  display: block;
  box-sizing: border-box;
  transform: translateZ(0);
  touch-action: none;
}
.stf__wrapper {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
.stf__wrapper.--portrait,
.stf__wrapper.--portrait .stf__block {
  overflow: hidden;
  perspective: none;
}
.stf__parent canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}
.stf__block {
  position: absolute;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  perspective: 2200px;
}
.stf__item {
  display: none;
  position: absolute;
  transform-style: preserve-3d;
}
.stf__item.--simple {
  transform: translate3d(0, 0, 0);
}
.stf__wrapper.--portrait .stf__item {
  transform-style: flat;
}
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow {
  position: absolute;
  left: 0;
  top: 0;
}

.spine-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 34px;
  transform: translate3d(-50%, 0, 0);
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.16) 44%, rgba(0,0,0,0.34) 50%, rgba(0,0,0,0.16) 56%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s;
  z-index: 4;
}
.spine-shadow.on { opacity: 1; }
.spine-shadow.is-hard { opacity: 0; }

.nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bar);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: border-color .2s, background-color .2s, transform .2s, opacity .2s;
}
.nav-arrow:disabled { opacity: 0.25; cursor: default; }
.nav-arrow.prev { left: 16px; }
.nav-arrow.next { right: 16px; }
.nav-arrow svg { width: 20px; height: 20px; }

.hint-toast {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 19, 24, 0.88);
  color: #cfd4da;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 99px;
  pointer-events: none;
  opacity: 1;
  transition: opacity .5s ease;
  z-index: 32;
  white-space: nowrap;
}
.hint-toast.gone { opacity: 0; }

/* BOTTOMBAR */
.bottombar {
  height: calc(54px + env(safe-area-inset-bottom));
  flex: 0 0 auto;
  background: var(--bar);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 0 18px env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 40;
}

.bnav {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color .2s, background-color .2s, transform .15s;
}
html[data-theme="light"] .bnav { background: rgba(12, 18, 26, 0.04); }
.bnav:disabled { opacity: 0.3; cursor: default; }
.bnav svg { width: 17px; height: 17px; }
.b-zoom-mob { display: none; }

.b-pg {
  font-family: var(--h);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink2);
  min-width: 58px;
  text-align: center;
  white-space: nowrap;
}

.scrubber-wrap {
  position: relative;
  width: min(440px, 52vw);
  display: flex;
  align-items: center;
}
.scrub-tip {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(15, 19, 24, 0.94);
  color: #eef1f4;
  border: 1px solid rgba(225, 18, 29, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-family: var(--h);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  padding: 5px 11px;
  border-radius: 99px;
  white-space: nowrap;
  max-width: 82vw;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 50;
}
.scrub-tip.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#pageSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--red) var(--pct, 0%), var(--line) var(--pct, 0%));
  outline: none;
  cursor: pointer;
}
#pageSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
#pageSlider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
@media (pointer: coarse) {
  #pageSlider::-webkit-slider-thumb { width: 20px; height: 20px; }
  #pageSlider::-moz-range-thumb { width: 20px; height: 20px; }
}

/* DRAWERS */
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.62);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 60;
}
.drawer-scrim.on { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; bottom: 0;
  width: min(90vw, 390px);
  background: var(--bg2);
  border-color: var(--line);
  z-index: 70;
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}
.drawer.left { left: 0; border-right: 1px solid var(--line); transform: translateX(-100%); }
.drawer.right { right: 0; border-left: 1px solid var(--line); transform: translateX(100%); }
.drawer.open { transform: none; }

.dr-head {
  padding: calc(16px + env(safe-area-inset-top)) 18px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dr-kicker { display: block; font-family: var(--h); font-weight: 700; font-size: 11px; letter-spacing: 2.5px; color: var(--red); }
.dr-head h2 { font-family: var(--h); font-weight: 800; font-size: 22px; color: var(--ink); }
.dr-close {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: none;
  color: var(--mut);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s, transform .15s;
}

.dr-search { padding: 12px 16px 6px; }
.dr-search input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--b);
  font-size: 14px;
  outline: none;
}
.dr-search input:focus { border-color: var(--red); }

.toc-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 14px 16px;
}
.toc-grp {
  font-family: var(--h);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--mut);
  padding: 12px 6px 6px;
  text-transform: uppercase;
}
.toc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--ink2);
  font-family: var(--b);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.toc-btn.on { background: rgba(225, 18, 29, 0.14); border-color: rgba(225, 18, 29, 0.35); color: var(--ink); }
.toc-code { font-family: var(--h); font-weight: 800; font-size: 12.5px; color: var(--red); min-width: 34px; }
.toc-name { flex: 1; font-weight: 600; }
.toc-pg { font-family: var(--h); font-weight: 700; font-size: 12.5px; color: var(--mut); }

.dr-foot {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.dr-cta, .dr-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 99px;
  font-family: var(--h);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}
.dr-cta { background: var(--red); color: #fff; }
.dr-dl { border: 1px solid var(--line); color: var(--ink); }

.thumb-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.th-card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  transition: border-color .18s, transform .18s;
}
.th-card.on { border-color: var(--red); }
.th-card img { width: 100%; aspect-ratio: 210 / 297; object-fit: cover; display: block; background: #fff; }
.th-meta { padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--ink2); width: 100%; }
.th-meta b { font-family: var(--h); color: var(--red); }

/* ZOOM LIGHTBOX */
.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 10, 14, 0.96);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s, visibility .22s;
}
.zoom-modal.open { opacity: 1; visibility: visible; }

.zm-bar {
  height: 54px;
  flex: 0 0 auto;
  padding: 0 14px;
  background: #12161c;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.zm-title { display: flex; align-items: center; gap: 10px; min-width: 0; color: #eef1f4; }
.zm-badge { font-family: var(--h); font-weight: 800; font-size: 13px; background: var(--red); color: #fff; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.zm-title strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.zm-controls { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.zbtn {
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #eef1f4;
  font-family: var(--h);
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, transform .15s;
}
.zbtn svg { width: 17px; height: 17px; }
.zbtn.zclose { font-size: 22px; background: rgba(225, 18, 29, 0.22); border-color: rgba(225, 18, 29, 0.45); }
.zm-pct {
  font-family: var(--h);
  font-weight: 700;
  font-size: 13px;
  color: #cfd4da;
  min-width: 52px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}

.zm-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}
.zm-viewport.dragging { cursor: grabbing; }
.zm-img {
  max-width: 96%;
  max-height: 96%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
  transform-origin: center center;
  will-change: transform;
  background: #fff;
}
.zm-hint {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 19, 24, 0.85);
  color: #aeb4bc;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  white-space: nowrap;
}

.copy-toast {
  position: fixed;
  top: calc(68px + env(safe-area-inset-top));
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 100;
  background: rgba(15, 19, 24, 0.94);
  color: #eef1f4;
  border: 1px solid rgba(225, 18, 29, 0.55);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  font-family: var(--h);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.4px;
  padding: 8px 16px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.copy-toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* RESPONSIVE */
@media (max-width: 1180px) {
  .chapter-readout { display: none; }
}
@media (max-width: 900px) {
  .tb-pill, .chapter-readout, .page-readout, .tbtn-lbl, .nav-arrow, .hide-mob, .pdf-full, .kat-lang { display: none; }
  .dr-lang { display: flex; }
  .pdf-short { display: inline; }
  .mob-chapter { display: flex; }
  .topbar { padding: env(safe-area-inset-top) 10px 0; height: calc(52px + env(safe-area-inset-top)); gap: 6px; }
  .tb-left, .tb-right { gap: 6px; }
  .tb-word { font-size: 16.5px; }
  .btn-pdf { height: 34px; padding: 0 11px; font-size: 12.5px; }
  .tbtn { height: 34px; }
  .tbtn.icon-only { width: 34px; }
  .hide-touch { display: none; }
  .stage { padding: 8px 6px; }
  .bottombar { gap: 8px; padding: 0 10px env(safe-area-inset-bottom); }
  .scrubber-wrap { flex: 1; width: auto; }
  .b-zoom-mob { display: flex; }
  .hint-toast { font-size: 11px; padding: 5px 10px; bottom: 8px; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
  .zm-title strong { display: none; }
}
@media (max-width: 600px) {
  .zm-desk { display: none; }
  .zm-bar { padding: env(safe-area-inset-top) 10px 0; height: calc(54px + env(safe-area-inset-top)); }
  .zbtn { height: 38px; min-width: 38px; }
  .zm-pct { height: 38px; min-width: 54px; }
  .zm-hint { font-size: 11px; padding: 5px 10px; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 340px) {
  .tb-word { display: none; }
}
@media (max-width: 900px), (pointer: coarse) {
  .book-shell { filter: none; }
  .book-host { box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42); }
  html[data-theme="light"] .book-host { box-shadow: 0 14px 30px rgba(12, 18, 26, 0.2); }
}

.tbtn:active, .btn-pdf:active, .bnav:active:not(:disabled), .zbtn:active, .dr-close:active, .th-card:active {
  transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  .tbtn:hover { border-color: rgba(255, 255, 255, 0.34); background: rgba(255, 255, 255, 0.10); color: var(--ink); transform: translateY(-1px); }
  html[data-theme="light"] .tbtn:hover { border-color: rgba(12, 18, 26, 0.30); background: rgba(12, 18, 26, 0.08); }
  .btn-pdf:hover { background: var(--red2); transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.55); }
  .kat-lang button:hover:not(.on) { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
  html[data-theme="light"] .kat-lang button:hover:not(.on) { background: rgba(12, 18, 26, 0.06); }
  .nav-arrow:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.36); transform: translateY(-50%) scale(1.06); }
  html[data-theme="light"] .nav-arrow:hover:not(:disabled) { border-color: rgba(12, 18, 26, 0.32); }
  .bnav:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.34); background: rgba(255, 255, 255, 0.10); transform: translateY(-1px); }
  html[data-theme="light"] .bnav:hover:not(:disabled) { border-color: rgba(12, 18, 26, 0.30); background: rgba(12, 18, 26, 0.08); }
  .dr-close:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.34); transform: translateY(-1px); }
  html[data-theme="light"] .dr-close:hover { border-color: rgba(12, 18, 26, 0.30); }
  .toc-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
  html[data-theme="light"] .toc-btn:hover { background: rgba(12, 18, 26, 0.06); }
  .th-card:hover { border-color: var(--mut); transform: translateY(-2px); }
  .zbtn:hover { border-color: rgba(255, 255, 255, 0.38); background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
  .zbtn.zclose:hover { background: var(--red); border-color: var(--red); }
  .zm-pct:hover { border-color: rgba(255, 255, 255, 0.38); color: #fff; background: rgba(255, 255, 255, 0.12); }
}
