/* 互动书阅读器样式。系统字体，无外部资源。 */
:root {
  --ink: #173f5b;
  --ink-soft: #3a6079;
  --bg-1: #d9f3ef;
  --bg-2: #9edcd7;
  --bg-3: #7cc8c3;
  --paper: #fffdf8;
  --primary: #3072c8;
  --primary-d: #155aab;
  --hot: #e68c0a;
  --hot-d: #b45f06;
  --chrome: rgb(255 255 255 / .84);
  --ring: #073d78;
  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --shadow-1: 0 4px 14px rgb(23 63 91 / .18);
  --shadow-2: 0 18px 50px rgb(23 63 91 / .32);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-turn: cubic-bezier(.45, .05, .25, 1);
  --unit: #9fb3c2;
  --vh: 100vh;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: "Arial Rounded MT Bold", "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; max-width: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
html, body { -webkit-tap-highlight-color: transparent; }

/* 不许框选、不许拖图片、不许长按出菜单（输入框除外） */
html, body, #app, #video-modal, .panel, .dialog {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
::selection { background: transparent; }
input::selection, textarea::selection { background: rgb(48 114 200 / .3); }
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.pg img, .thumb img, #landing-cover, .video-wrap img { pointer-events: none; }
svg.ic { width: 24px; height: 24px; fill: currentColor; flex: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px #fff;
}
:focus:not(:focus-visible) { outline: none; }
.bar .ibtn:focus-visible, .bar .btn:focus-visible { outline-offset: 1px; box-shadow: 0 0 0 5px rgb(255 255 255 / .95); }

#app { position: fixed; inset: 0; height: var(--vh); overflow: hidden; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; min-width: 44px; padding: 0 20px;
  border: 0; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 1rem; line-height: 1;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background-color 120ms;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(.96); transition-duration: 80ms; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgb(48 114 200 / .38); }
.btn-primary:hover { background: var(--primary-d); box-shadow: 0 12px 26px rgb(48 114 200 / .45); }
.btn-soft { background: #fff; color: var(--primary-d); box-shadow: var(--shadow-1); }
.btn-soft:hover { box-shadow: 0 8px 20px rgb(23 63 91 / .26); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: rgb(255 255 255 / .5); }
.btn-big { min-height: 56px; padding: 0 30px; font-size: 1.15rem; }
.btn-big .ic { width: 26px; height: 26px; }

.ibtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 14px;
  background: transparent; color: var(--ink); cursor: pointer; font-weight: 700;
  transition: transform 120ms var(--ease), background-color 120ms, box-shadow 120ms;
}
.ibtn:hover { background: rgb(48 114 200 / .12); transform: translateY(-1px); }
.ibtn:active { transform: scale(.96); transition-duration: 80ms; }
.ibtn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.ibtn .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--hot-d); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center;
}
.ibtn.brand { color: var(--primary-d); }
.translation-icon {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: rgb(111 63 163 / .12); color: #673a91; font-size: 15px; font-weight: 900;
}
#btn-translation[aria-pressed="true"] { background: #7146a3; color: #fff; }
#btn-translation[aria-pressed="true"] .translation-icon { background: #fff; color: #673a91; }

/* ---------- 封面 / 开场屏 ---------- */
#landing {
  position: absolute; inset: 0; overflow: auto; z-index: 2;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  transition: opacity 240ms ease-out;
}
#landing.leaving { opacity: 0; pointer-events: none; }
.blobs i { position: absolute; border-radius: 50%; opacity: .5; animation: float 9s ease-in-out infinite; pointer-events: none; }
.blobs i:nth-child(1) { width: 220px; height: 220px; left: 3%; top: 8%; width: 180px; height: 180px; background: radial-gradient(circle at 35% 30%, #fff, rgb(255 255 255 / .25) 70%); }
.blobs i:nth-child(2) { width: 150px; height: 150px; left: 46%; top: 6%; background: radial-gradient(circle at 35% 30%, #fff3c6, rgb(251 181 52 / .35) 75%); opacity: .4; animation-delay: -3s; }
.blobs i:nth-child(3) { width: 260px; height: 260px; right: 3%; bottom: -70px; background: radial-gradient(circle at 35% 30%, rgb(255 255 255 / .85), rgb(48 114 200 / .3) 75%); opacity: .45; animation-delay: -6s; }
@keyframes float { 50% { transform: translate3d(0, -22px, 0) scale(1.05); } }

.landing-inner {
  position: relative; min-height: 100%; display: flex; align-items: center; justify-content: center;
  gap: clamp(28px, 6vw, 96px); padding: 32px clamp(20px, 5vw, 72px);
}
.cover-wrap {
  flex: none; height: min(70vh, 760px); height: min(70dvh, 760px); aspect-ratio: 1274 / 1800;
  padding: 0; border: 0; background: none; cursor: pointer; perspective: 1400px; border-radius: 10px;
}
.cover3d {
  position: relative; display: block; width: 100%; height: 100%;
  border-radius: 6px 12px 12px 6px; overflow: hidden; background: var(--paper);
  transform: rotateY(-10deg); transform-origin: left center;
  box-shadow: -10px 16px 0 -4px rgb(23 63 91 / .12), 18px 28px 56px rgb(23 63 91 / .4);
  transition: transform 320ms var(--ease), box-shadow 320ms var(--ease);
}
.cover3d::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 14px; z-index: 1;
  background: linear-gradient(90deg, rgb(0 0 0 / .34), rgb(255 255 255 / .18) 55%, transparent);
}
.cover3d img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; }
.cover-wrap:hover .cover3d, .cover-wrap:focus-visible .cover3d {
  transform: rotateY(0) translateY(-6px);
  box-shadow: -10px 22px 0 -4px rgb(23 63 91 / .1), 20px 38px 64px rgb(23 63 91 / .42);
}
.landing-copy { max-width: 540px; }
.eyebrow {
  display: inline-block; margin: 0 0 10px; padding: 4px 14px; border-radius: 999px;
  background: #fff; color: var(--primary-d); font-weight: 700; letter-spacing: .08em; box-shadow: var(--shadow-1);
}
.landing-copy h1 {
  margin: 0 0 18px; font-family: var(--font-title); font-size: clamp(2rem, 3.6vw, 3.1rem); line-height: 1.15; color: var(--ink);
}
.stats { margin: 0 0 24px; font-size: 1rem; color: var(--ink); min-height: 1.4em; }
.stats b { color: var(--primary-d); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 28px; }
.unit-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-pill {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer; font-weight: 700;
  background: var(--c); color: var(--ink); box-shadow: 0 3px 8px rgb(23 63 91 / .16);
  transition: transform 120ms var(--ease), box-shadow 120ms;
}
.unit-pill:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgb(23 63 91 / .24); }
.unit-pill:active { transform: scale(.96); }
@media (max-width: 820px) {
  .landing-inner { flex-direction: column; justify-content: flex-start; padding-top: 28px; padding-bottom: 36px; text-align: center; gap: 26px; }
  .cover-wrap { height: min(46vh, 420px); height: min(46dvh, 420px); }
  .actions, .unit-pills { justify-content: center; }
  .landing-copy { max-width: 520px; }
}

/* ---------- 阅读器外壳 ---------- */
#reader {
  position: absolute; inset: 0; z-index: 1;
  display: grid; grid-template-rows: 56px minmax(0, 1fr) 56px;
  background:
    radial-gradient(circle at 10% 90%, rgb(255 255 255 / .28) 0 120px, transparent 121px),
    radial-gradient(circle at 92% 12%, rgb(255 255 255 / .22) 0 90px, transparent 91px),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
}
#reader.entering { opacity: 0; }
#reader.entering-go { opacity: 1; transition: opacity 320ms ease-out; }

.bar {
  position: relative; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--chrome); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgb(23 63 91 / .08);
  transition: transform 260ms var(--ease), opacity 260ms;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .bar { background: rgb(255 255 255 / .96); } }
#topbar { padding-top: env(safe-area-inset-top); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); height: calc(56px + env(safe-area-inset-top)); }
#bottombar { padding-bottom: env(safe-area-inset-bottom); padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); height: calc(56px + env(safe-area-inset-bottom)); box-shadow: 0 -1px 0 rgb(23 63 91 / .08); }
#reader { grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow: hidden; }
#reader.idle #topbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
#reader.idle #bottombar { transform: translateY(100%); opacity: 0; pointer-events: none; }

.tb-left, .tb-right { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-center {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; overflow: hidden; white-space: nowrap;
}
.unit-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--unit); box-shadow: 0 0 0 3px rgb(255 255 255 / .9), 0 0 0 4px var(--unit); flex: none; margin-right: 4px; transition: background-color 240ms; }
.now-label { font-weight: 800; }
.now-title { overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); min-width: 0; }
.now-title:not(:empty)::before { content: "· "; }
.now-count { flex: none; font-size: .8rem; color: var(--ink-soft); padding: 2px 8px; border-radius: 999px; background: rgb(23 63 91 / .08); }

.btn-nav { background: var(--primary); color: #fff; padding: 0 14px 0 10px; box-shadow: 0 3px 8px rgb(48 114 200 / .35); flex: none; }
.btn-nav:last-of-type { padding: 0 10px 0 14px; }
.btn-nav:hover { background: var(--primary-d); }
.btn-nav[aria-disabled="true"] { background: #8da1b0; box-shadow: none; cursor: default; color: #fff; }
.btn-nav[aria-disabled="true"]:hover { transform: none; }

/* 进度条 */
.slider-wrap { position: relative; flex: 1; min-width: 80px; height: 44px; }
.cells {
  position: absolute; left: 11px; right: 11px; top: 50%; height: 10px; transform: translateY(-50%);
  display: grid; border-radius: 5px; overflow: visible;
}
.cells i { position: relative; display: block; background: var(--c, #9fb3c2); opacity: .5; }
.cells i.seen { opacity: 1; filter: saturate(1.1) brightness(.9); }
.cells i:first-child { border-radius: 5px 0 0 5px; }
.cells i:last-child { border-radius: 0 5px 5px 0; }
.cells i.has::after {
  content: ""; position: absolute; left: 50%; top: -6px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--primary-d);
}
#slider {
  position: absolute; inset: 0; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
#slider::-webkit-slider-runnable-track { height: 44px; background: transparent; }
#slider::-moz-range-track { height: 44px; background: transparent; }
#slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: 11px; border-radius: 50%;
  background: #fff; border: 4px solid var(--primary); box-shadow: 0 2px 8px rgb(23 63 91 / .4); transition: transform 120ms;
}
#slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 4px solid var(--primary); box-shadow: 0 2px 8px rgb(23 63 91 / .4); }
#slider:active::-webkit-slider-thumb { transform: scale(1.2); }
.bubble {
  position: absolute; bottom: 48px; left: 0; transform: translateX(-50%); pointer-events: none;
  padding: 6px 12px; border-radius: 12px; background: var(--ink); color: #fff; font-size: .85rem; font-weight: 700; white-space: nowrap;
  max-width: 60vw; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow-1);
}

.jump { display: flex; align-items: center; gap: 8px; position: relative; flex: none; margin-left: 4px; padding-left: 14px; font-size: .95rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.jump::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: rgb(23 63 91 / .16); }
.jump input {
  width: 64px; height: 44px; padding: 0 6px; text-align: center; color: var(--ink); border: 2px solid rgb(23 63 91 / .3); border-radius: 12px; background: #fff; font-weight: 700;
}
.jump input[aria-invalid="true"] { border-color: #c0392b; animation: shake 320ms; }
.jump-msg { position: absolute; right: 0; bottom: 50px; padding: 4px 10px; border-radius: 10px; background: #fff; color: #a1261a; font-size: .85rem; box-shadow: var(--shadow-1); white-space: nowrap; }
.jump-msg:empty { display: none; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---------- 舞台与书本 ---------- */
#stage { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 0; min-width: 0; }
#zoom { position: relative; transform-origin: 50% 50%; z-index: 2; }
#zoom.zoomed { cursor: grab; touch-action: none; }
#book {
  position: relative; width: calc(var(--page-w) * var(--across, 2)); height: var(--page-h);
  transition: transform 450ms var(--ease-turn);
  cursor: grab;
}
#book, #book * { touch-action: none; }
#book.is-dragging, #book.is-dragging * { cursor: grabbing !important; }
#book::before {
  content: ""; position: absolute; left: 3%; right: 3%; bottom: -16px; height: 28px; z-index: -1;
  border-radius: 50%; background: rgb(23 63 91 / .36); filter: blur(15px);
}
#book.closed::before { left: 50%; right: 3%; }
#book.closed.back-cover::before { left: 3%; right: 50%; }
#stage.single #book::before { left: 3%; right: 3%; }

/* 翻页引擎的容器：精确像素盒，由引擎在内部摆放页面 */
#book #flip-host { position: absolute; inset: 0; }
.stf__parent, .stf__wrapper, .stf__block { touch-action: none !important; }

#gutter {
  position: absolute; top: 0; bottom: 0; left: 50%; width: calc(var(--page-w) * .08); transform: translateX(-50%);
  pointer-events: none; z-index: 3; mix-blend-mode: multiply; opacity: 1; transition: opacity 320ms;
  background: linear-gradient(90deg, transparent, rgb(0 0 0 / .22) 48%, rgb(0 0 0 / .34) 50%, rgb(0 0 0 / .22) 52%, transparent);
}
#book.closed #gutter, #stage.single #gutter { opacity: 0; }
/* 卷页进行中：热点和书脊暗影先收起，避免浮在折页上方 */
#book.is-turning .hotspot-layer { visibility: hidden; }
#book.is-turning #gutter { display: none; }

/* 书页：位置、尺寸、变换都由翻页引擎用内联样式控制，这里只管外观 */
.pg { background: var(--paper); overflow: hidden; }
.pg > img {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; opacity: 0;
  user-select: none; -webkit-user-drag: none; transition: opacity 150ms ease-out;
}
.pg.loaded > img { opacity: 1; }
.skeleton {
  position: absolute; inset: 0; background: linear-gradient(110deg, #f3eee2 30%, #fbf8ef 50%, #f3eee2 70%);
  animation: shimmer 1.4s ease-in-out infinite;
}
.pg.loaded .skeleton, .pg.failed .skeleton { display: none; }
@keyframes shimmer { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
.page-card {
  position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; text-align: center;
  background: repeating-linear-gradient(135deg, #faf6ea, #faf6ea 12px, #f5efdf 12px, #f5efdf 24px); color: var(--ink);
}
.page-card b { font-size: 1.1rem; }
.page-card p { margin: 0; color: var(--ink-soft); }
.page-card .btn { min-height: 44px; }

/* 两侧翻页区 */
.edge {
  position: absolute; top: 0; bottom: 0; z-index: 3; width: var(--edge-w, 44px); padding: 0; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--ink);
}
.edge.prev { left: 0; }
.edge.next { right: 0; }
.edge-pill {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgb(255 255 255 / .75);
  box-shadow: var(--shadow-1); opacity: .55; transition: opacity 160ms, transform 160ms var(--ease), background-color 160ms;
}
.edge:hover .edge-pill, .edge:focus-visible .edge-pill { opacity: 1; background: #fff; transform: scale(1.08); }
.edge:active .edge-pill { transform: scale(.94); }
.edge[aria-disabled="true"] { cursor: default; }
.edge[aria-disabled="true"] .edge-pill { opacity: .18; transform: none; }
#stage.no-edges .edge { display: none; }
#stage.zoomed .edge { pointer-events: none; opacity: .3; }

/* 提示与字幕 */
#tip {
  position: absolute; top: 14px; left: 50%; z-index: 7; transform: translateX(-50%); max-width: 92%;
  padding: 10px 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: var(--shadow-1);
  animation: tip-in 260ms var(--ease);
}
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, -10px); } }
#toast {
  position: absolute; left: 50%; bottom: 14px; z-index: 7; max-width: min(92%, 720px); padding: 10px 20px; border-radius: 16px;
  background: rgb(4 35 56 / .86); color: #fff; font-size: 1.15rem; font-weight: 700; text-align: center; line-height: 1.35;
  box-shadow: var(--shadow-1); opacity: 0; transform: translate(-50%, 12px); pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast:empty { display: none; }
#toast .who { color: #ffd9a0; margin-right: 6px; }

/* 翻译气泡：始终只有一个，固定定位并由 JS 夹在可视区域内。 */
#translation-bubble {
  position: fixed; z-index: 52; width: max-content; max-width: min(360px, calc(100vw - 24px)); padding: 12px 16px 12px 46px;
  border: 3px solid #7146a3; border-radius: 16px; background: #fff5c9; color: #30204a;
  font-size: 1.05rem; font-weight: 800; line-height: 1.45; box-shadow: 0 12px 30px rgb(48 32 74 / .35);
  pointer-events: none; animation: translation-in 180ms var(--ease);
}
.translation-bubble-mark {
  position: absolute; left: 11px; top: 50%; display: grid; place-items: center; width: 26px; height: 26px;
  transform: translateY(-50%); border-radius: 9px; background: #7146a3; color: #fff; font-size: 14px;
}
@keyframes translation-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }

/* ---------- 热点 ---------- */
.hotspot-layer { position: absolute; inset: 0; z-index: 2; }
.hotspot {
  --hc: 230 140 10;
  position: absolute; display: block; margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms ease-out, background-color 160ms ease-out, box-shadow 160ms ease-out;
}
.hotspot.kind-video { --hc: 48 114 200; }
.hotspot::after {
  content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none; border: 2px solid transparent;
}
.hotspot-layer.hint .hotspot::after { animation: hint 2.4s ease-out var(--d, .4s) 3; }
@keyframes hint { 0% { box-shadow: 0 0 0 0 rgb(var(--hc) / .6); } 70%, 100% { box-shadow: 0 0 0 12px rgb(var(--hc) / 0); } }
@media (hover: hover) {
  .hotspot:hover { background: rgb(var(--hc) / .2); box-shadow: 0 0 0 3px rgb(var(--hc) / .95), 0 6px 16px rgb(23 63 91 / .3); transform: scale(1.03); }
}
.hotspot:active, .hotspot.is-pressed { transform: scale(.97); background: rgb(var(--hc) / .34); transition-duration: 80ms; }
.hotspot:focus-visible { background: rgb(var(--hc) / .2); outline-offset: 3px; box-shadow: 0 0 0 8px #fff; }
.hotspot.is-popping { animation: pop 260ms ease-out; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1.03); } }
.hotspot .badge {
  position: absolute; top: -9px; right: -9px; display: grid; place-items: center; pointer-events: none;
  width: clamp(16px, calc(var(--page-w) * .036), 28px); height: clamp(16px, calc(var(--page-w) * .036), 28px);
  border-radius: 50%; background: var(--primary); color: #fff; font-size: clamp(8px, calc(var(--page-w) * .018), 14px); line-height: 1;
  box-shadow: 0 2px 6px rgb(0 0 0 / .3); opacity: .94; transition: transform 160ms var(--ease);
}
.hotspot.kind-audio .badge { background: var(--hot-d); }
.hotspot .trans-mark {
  position: absolute; top: -8px; left: -8px; display: none; place-items: center; width: clamp(18px, calc(var(--page-w) * .04), 30px);
  height: clamp(18px, calc(var(--page-w) * .04), 30px); border: 2px solid #fff; border-radius: 9px;
  background: #7146a3; color: #fff; font-size: clamp(9px, calc(var(--page-w) * .019), 14px); font-weight: 900;
  box-shadow: 0 2px 7px rgb(48 32 74 / .45); pointer-events: none;
}
#stage.translation-on .hotspot .trans-mark { display: grid; }
#stage.translation-on .hotspot { --hc: 113 70 163; }
#stage.translation-on .hotspot .badge, #stage.translation-on .hotspot .wave { display: none; }
.hotspot.is-tight .badge { display: none; }
.hotspot.is-tight { box-shadow: inset 0 -3px 0 rgb(var(--hc) / .55); }
.hotspot.is-tight:hover { box-shadow: 0 0 0 3px rgb(var(--hc) / .95), 0 6px 16px rgb(23 63 91 / .3); }
.hotspot.is-tight::after { inset: -1px; }
/* 显示可点击区域 */
#stage.show-hot .hotspot { background: rgb(var(--hc) / .14); box-shadow: 0 0 0 2px rgb(var(--hc) / .95), 0 0 0 3.5px rgb(255 255 255 / .9); }
#stage.show-hot .hotspot .badge { transform: scale(1.25); }
#stage.show-hot .hotspot.is-tight { box-shadow: 0 0 0 2px rgb(var(--hc) / .95), 0 0 0 3.5px rgb(255 255 255 / .9), inset 0 -3px 0 rgb(var(--hc) / .8); }
/* 说话动画 */
.hotspot.is-speaking { background: rgb(var(--hc) / .28); box-shadow: 0 0 0 3px rgb(var(--hc) / 1), 0 0 18px rgb(var(--hc) / .7); animation: speak-glow 900ms ease-in-out infinite; }
@keyframes speak-glow { 50% { box-shadow: 0 0 0 5px rgb(var(--hc) / .9), 0 0 28px rgb(var(--hc) / .9); } }
.wave { position: absolute; left: 50%; bottom: -14px; display: none; gap: 3px; height: 16px; align-items: flex-end; transform: translateX(-50%); pointer-events: none; }
.wave i { width: 4px; height: 100%; border-radius: 2px; background: var(--hot); transform-origin: bottom; animation: bar 600ms ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: 120ms; }
.wave i:nth-child(3) { animation-delay: 240ms; }
.wave i:nth-child(4) { animation-delay: 360ms; }
@keyframes bar { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
.hotspot.is-speaking .wave { display: flex; }
/* 目录页：整行可点 */
.hotspot.toc-line { border-radius: 6px; }
/* 目录页：角标放到行左侧的色条上，不再压到右侧印刷页码 */
.hotspot.toc-line .badge, .hotspot.toc-line.is-tight .badge { display: grid; top: 50%; left: 1%; right: auto; transform: translateY(-50%); }
#stage.show-hot .hotspot.toc-line .badge { transform: translateY(-50%) scale(1.25); }
@media (hover: hover) { .hotspot.toc-line:hover { transform: none; } }
.hotspot.is-broken { background: rgb(120 120 120 / .14); box-shadow: 0 0 0 2px #777 inset; outline: 2px dashed #777; outline-offset: -2px; cursor: default; }
.hotspot.is-broken::after { display: none; }

/* ---------- 抽屉 ---------- */
#scrim {
  position: fixed; inset: 0; z-index: 39; background: rgb(4 35 56 / .5); opacity: 0; visibility: hidden;
  transition: opacity 200ms, visibility 0s 200ms;
}
#scrim.show { opacity: 1; visibility: visible; transition-delay: 0s; }
.panel {
  position: fixed; top: 0; bottom: 0; z-index: 40; width: min(400px, 92vw); height: var(--vh); display: flex; flex-direction: column;
  background: #f7fdfc; box-shadow: var(--shadow-2); visibility: hidden;
  transition: transform 260ms var(--ease), visibility 0s 260ms;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.panel.left { left: 0; transform: translateX(-100%); border-radius: 0 var(--radius-l) var(--radius-l) 0; }
.panel.right { right: 0; transform: translateX(100%); border-radius: var(--radius-l) 0 0 var(--radius-l); }
.panel.open { transform: none; visibility: visible; transition-delay: 0s; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 20px; }
.panel-head h2 { margin: 0; font-size: 1.25rem; font-family: var(--font-title); }

.toc-tools { display: flex; gap: 8px; padding: 8px 16px 12px; align-items: center; }
.search { flex: 1; display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: 999px; background: #fff; border: 2px solid rgb(23 63 91 / .18); min-width: 0; }
.search:focus-within { border-color: var(--primary); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; height: 40px; }
.search input:focus-visible { box-shadow: none; outline: none; }
.toc-tools .btn { font-size: .9rem; padding: 0 14px; white-space: nowrap; }
.toc-scroll, .list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 24px; }
.toc-empty { text-align: center; color: var(--ink-soft); padding: 32px 0; }

.group { margin: 0 0 8px; border-radius: var(--radius-m); background: #fff; box-shadow: 0 1px 4px rgb(23 63 91 / .12); overflow: hidden; }
.group-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px; min-height: 56px; align-items: center; }
.group-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; z-index: 1; width: 6px; background: var(--c); pointer-events: none; }
.group.has-spk .group-row { grid-template-columns: 56px minmax(0, 1fr) 44px; }
.spk {
  position: absolute; left: 14px; top: 50%; z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: var(--hot-d); color: #fff; cursor: pointer; transform: translateY(-50%);
  box-shadow: 0 2px 6px rgb(23 63 91 / .3); transition: transform 120ms var(--ease), background-color 120ms;
}
.spk:hover { background: #8f4a04; transform: translateY(-50%) scale(1.06); }
.spk:active { transform: translateY(-50%) scale(.94); transition-duration: 80ms; }
.spk .ic { width: 22px; height: 22px; }
.spk-wave { display: none; gap: 3px; height: 16px; align-items: flex-end; }
.spk-wave i { width: 4px; height: 100%; border-radius: 2px; background: #fff; transform-origin: bottom; animation: bar 600ms ease-in-out infinite; }
.spk-wave i:nth-child(2) { animation-delay: 150ms; }
.spk-wave i:nth-child(3) { animation-delay: 300ms; }
.spk.is-speaking { animation: spk-ring 900ms ease-in-out infinite; }
.spk.is-speaking .ic { display: none; }
.spk.is-speaking .spk-wave { display: flex; }
@keyframes spk-ring { 0%, 100% { box-shadow: 0 0 0 0 rgb(180 95 6 / .55); } 50% { box-shadow: 0 0 0 7px rgb(180 95 6 / 0); } }
/* 页标题读音：喇叭放在卡片底部单独一行（不盖缩略图和文字），视觉 36px，触控区 44px */
.toc-grid li.has-spk { position: relative; padding-bottom: 40px; }
.toc-grid li.has-spk .spk { left: auto; right: 6px; top: auto; bottom: 2px; width: 36px; height: 36px; transform: none; }
.toc-grid li.has-spk .spk::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
.toc-grid li.has-spk .spk .ic { width: 20px; height: 20px; }
.toc-grid li.has-spk .spk:hover { transform: scale(1.06); }
.toc-grid li.has-spk .spk:active { transform: scale(.94); }
.group-row > .spk { position: static; grid-column: 1; justify-self: center; transform: none; }
.group-row > .spk:hover { transform: scale(1.06); }
.group-row > .spk:active { transform: scale(.94); }
.group-head {
  grid-column: 1; width: 100%; min-height: 56px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px;
  padding: 8px 12px 8px 20px; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.group.has-spk .group-head { grid-column: 2; padding-left: 4px; }
.group-head:hover { background: rgb(48 114 200 / .06); }
.group-head .en { font-weight: 800; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; }
.group-head .zh { grid-column: 1; font-size: .85rem; color: var(--ink-soft); }
.group-head .meta { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--ink-soft); }
.group-head .badge-n { padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; }
.group-toggle {
  grid-column: 2; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink); cursor: pointer; transition: transform 120ms var(--ease), background-color 120ms;
}
.group.has-spk .group-toggle { grid-column: 3; }
.group-toggle:hover { background: rgb(48 114 200 / .12); transform: translateY(-1px); }
.group-toggle:active { transform: scale(.94); transition-duration: 80ms; }
.group-toggle .chev { width: 20px; height: 20px; transition: transform 200ms; }
.group.open .group-toggle .chev { transform: rotate(90deg); }
.group-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 200ms ease-out, visibility 0s 200ms; visibility: hidden; }
.group.open .group-body { grid-template-rows: 1fr; visibility: visible; transition-delay: 0s; }
.group-inner { min-height: 0; overflow: hidden; }
.toc-grid { list-style: none; margin: 0; padding: 8px 10px 12px 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.toc-item {
  position: relative; display: flex; flex-direction: column; width: 100%; padding: 4px; border: 0; border-radius: 12px; background: transparent;
  cursor: pointer; text-align: left; min-height: 44px; transition: transform 120ms var(--ease), background-color 120ms;
}
.toc-item:hover { background: rgb(48 114 200 / .08); transform: translateY(-2px); }
.toc-item .thumb { position: relative; display: block; aspect-ratio: 1274 / 1800; border-radius: 6px; overflow: hidden; background: #efe9da; box-shadow: 0 1px 4px rgb(23 63 91 / .25); }
.toc-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 200ms; }
.toc-item .thumb img.on { opacity: 1; }
.toc-item .cap { margin-top: 4px; font-size: .72rem; line-height: 1.25; color: var(--ink); }
.toc-item .cap b { display: block; font-size: .75rem; }
.toc-item .cap span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-soft); }
.toc-item .tags { position: absolute; left: 4px; bottom: 4px; display: flex; gap: 3px; flex-wrap: wrap; }
.tag { padding: 1px 6px; border-radius: 999px; color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.3; box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.tag.v { background: var(--primary); }
.tag.a { background: var(--hot-d); }
.toc-item .tick { position: absolute; top: 4px; right: 4px; display: none; width: 18px; height: 18px; padding: 2px; border-radius: 50%; background: #2e9d6b; fill: #fff; }
.toc-item.seen .tick { display: block; }
.toc-item.current { background: rgb(48 114 200 / .12); outline: 3px solid var(--primary); outline-offset: -1px; }
.toc-item:focus-visible { outline-offset: 0; }

.list-scroll { padding: 8px 14px 24px; }
.list-page { margin: 12px 4px 6px; font-size: .85rem; font-weight: 800; color: var(--ink-soft); }
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; margin-bottom: 8px; padding: 8px 14px; border: 0; border-radius: var(--radius-m);
  background: #fff; cursor: pointer; text-align: left; box-shadow: 0 1px 4px rgb(23 63 91 / .14); transition: transform 120ms var(--ease), box-shadow 120ms;
}
.list-item:hover { transform: translateX(-2px); box-shadow: 0 4px 12px rgb(23 63 91 / .22); }
.list-item .ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; }
.list-item.v .ico { background: var(--primary); }
.list-item.a .ico { background: var(--hot-d); }
.list-item .ico .ic { width: 20px; height: 20px; }
.list-item .txt { min-width: 0; }
.list-item .who { display: block; font-size: .78rem; color: var(--ink-soft); font-weight: 700; }
.list-item .ln { font-weight: 700; overflow-wrap: anywhere; }
.list-item.is-speaking { outline: 3px solid var(--hot); outline-offset: -2px; }
.list-empty { padding: 36px 12px; text-align: center; color: var(--ink-soft); }

/* 帮助 */
.dialog {
  position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: rgb(4 35 56 / .5);
  opacity: 0; visibility: hidden; transition: opacity 200ms, visibility 0s 200ms;
}
.dialog.open { opacity: 1; visibility: visible; transition-delay: 0s; }
.dialog-card { width: min(460px, 100%); max-height: 100%; overflow: auto; padding: 8px 20px 20px; border-radius: var(--radius-l); background: #fff; box-shadow: var(--shadow-2); }
.dialog .panel-head { padding-left: 0; }
.keys { margin: 0; display: grid; gap: 4px; }
.keys > div { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgb(23 63 91 / .1); }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--ink-soft); text-align: right; }
kbd { display: inline-block; min-width: 28px; padding: 2px 8px; border-radius: 8px; border: 1px solid rgb(23 63 91 / .3); border-bottom-width: 3px; background: #f3fbfa; font: 700 .85rem var(--font); text-align: center; }
.help-note { margin: 12px 0 0; color: var(--ink-soft); font-size: .9rem; }

/* ---------- 视频弹窗 ---------- */
.modal { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: clamp(12px, 3vw, 40px); }
.modal-backdrop { position: absolute; inset: 0; background: rgb(4 35 56 / .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; z-index: 1; width: min(100%, 620px); max-height: 100%; overflow: auto;
  padding: clamp(18px, 3.5vw, 30px); border: 4px solid #fff; border-radius: var(--radius-l); background: #e9fbfa;
  box-shadow: 0 22px 65px rgb(0 0 0 / .38); transform-origin: center;
}
.modal-card:focus-visible { outline: 4px solid var(--ring); }
.modal-close {
  position: absolute; top: 10px; right: 12px; display: grid; width: 44px; height: 44px; place-items: center; z-index: 2;
  border: 0; border-radius: 50%; background: var(--primary); color: #fff; cursor: pointer;
  transition: transform 120ms var(--ease), background-color 120ms;
}
.modal-close:hover { background: var(--primary-d); transform: scale(1.06); }
.modal h2 { margin: 0 3.4rem .2rem 0; color: var(--primary-d); font-family: var(--font-title); font-size: clamp(1.4rem, 4vw, 2rem); }
.spoken-line { margin: 0 0 .8rem; font-size: clamp(1rem, 2.4vw, 1.2rem); font-weight: 700; }
.video-wrap {
  position: relative; width: min(100%, calc(56vh * var(--ratio, .75))); margin-inline: auto; overflow: hidden;
  border-radius: var(--radius-m); background: #74c8c4; aspect-ratio: var(--ratio, .75);
}
@supports (height: 100dvh) { .video-wrap { width: min(100%, calc(56dvh * var(--ratio, .75))); } }
.video-wrap video, .video-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; background: #74c8c4; }
/* 视频没有任何原生控件：不接收点击，并把各浏览器的控件层全部隐藏 */
.video-wrap video { pointer-events: none; }
.video-wrap video::-webkit-media-controls,
.video-wrap video::-webkit-media-controls-enclosure,
.video-wrap video::-webkit-media-controls-panel,
.video-wrap video::-webkit-media-controls-start-playback-button,
.video-wrap video::-webkit-media-controls-overlay-play-button,
.video-wrap video::-webkit-media-controls-overlay-enclosure,
.video-wrap video::-webkit-media-controls-play-button {
  display: none !important; -webkit-appearance: none; appearance: none; opacity: 0; pointer-events: none;
}
.video-caption {
  position: absolute; right: .75rem; bottom: 4.2rem; left: .75rem; margin: 0; padding: .4rem .7rem; border-radius: .6rem;
  background: rgb(4 35 56 / .72); color: #fff; font-size: clamp(1.125rem, 2.8vw, 1.25rem); font-weight: 700; line-height: 1.3; text-align: center; pointer-events: none;
}
.video-caption #vm-cap-who { color: #ffd9a0; margin-right: .4em; }
.video-status {
  position: absolute; right: .65rem; bottom: .65rem; left: .65rem; margin: 0; padding: .45rem .65rem; border-radius: .5rem;
  background: rgb(255 255 255 / .92); color: var(--ink); font-size: .95rem; font-weight: 700; text-align: center;
}

/* ---------- 错误卡 ---------- */
#fatal { position: absolute; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--bg-1), var(--bg-2)); }
.fatal-card { max-width: 480px; padding: 28px; border-radius: var(--radius-l); background: #fff; box-shadow: var(--shadow-2); text-align: center; }
.fatal-card h2 { margin: 0 0 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
  .tb-center .now-title { display: none; }
  .has-label .lbl { display: none; }
  .jump label { display: none; }
}
@media (max-width: 760px) {
  .btn-nav .lbl { display: none; }
  .btn-nav { padding: 0 10px; }
  .now-count { display: none; }
  .jump { font-size: .8rem; }
  .jump input { width: 46px; }
  .jump > span:not(.jump-msg) { display: none; }
  .jump { margin-left: 0; padding-left: 0; }
  .jump::before { display: none; }
  .bar { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .panel.right { left: 0; right: 0; top: auto; width: 100%; height: auto; max-height: 72vh; max-height: 72dvh; transform: translateY(100%); border-radius: var(--radius-l) var(--radius-l) 0 0; }
  .panel.right.open { transform: none; }
  .toc-grid { grid-template-columns: repeat(2, 1fr); }
  .btn-big { padding: 0 22px; }
  #toast { font-size: 1.05rem; bottom: 8px; }
}
@media (max-width: 520px) {
  #btn-fs, #btn-help { display: none; }
  .tb-left, .tb-right { gap: 0; }
}
@media (max-height: 480px) {
  #reader { grid-template-columns: auto 1fr auto; grid-template-rows: 44px minmax(0, 1fr); }
  #topbar { display: contents; }
  .tb-left { grid-area: 1 / 1; background: var(--chrome); }
  .tb-right { grid-area: 1 / 3; background: var(--chrome); }
  .tb-center { display: none; }
  #bottombar { grid-area: 1 / 2; height: 44px; padding-top: 0; padding-bottom: 0; }
  #stage { grid-area: 2 / 1 / 3 / 4; }
  .tb-left, .tb-right { height: 44px; padding: 0 6px; }
  .has-label .lbl { display: none; }
  #reader.idle .tb-left, #reader.idle .tb-right { opacity: 0; pointer-events: none; }
  .jump { display: none; }
  .bubble { bottom: auto; top: 46px; }
}

/* ---------- 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  .blobs i, .skeleton, .wave i, .spk-wave i, .spk.is-speaking, .hotspot.is-speaking, .hotspot.is-popping, #tip { animation: none !important; }
  .cover3d, .btn, .ibtn, .unit-pill, .toc-item, .list-item, .edge-pill, .panel, #scrim, .group-body, #book, .spk { transition-duration: 1ms !important; transition-delay: 0s !important; }
  .cover3d { transform: none; }
  .hotspot, .hotspot:hover, .hotspot:active { transform: none !important; transition-duration: 1ms; }
  .hotspot-layer.hint .hotspot::after { animation: none; border: 2px dashed rgb(var(--hc)); }
  .hotspot.is-speaking { outline: 4px solid rgb(var(--hc)); }
  .wave i { transform: scaleY(.7); }
}

@media (forced-colors: active) {
  .btn, .ibtn, .hotspot, .unit-pill, .toc-item, .list-item, .edge-pill { border: 1px solid ButtonText; }
  .hotspot { border: 2px solid Highlight; }
}

/* 回到书架（链接按钮） */
a.ibtn, a.btn { text-decoration: none; display: inline-flex; align-items: center; }
