:root {
  --bg-top: #383931;
  --bg-mid: #2f312b;
  --bg-deep: #1e211d;
  --cream: #f4ebd4;
  --cream-soft: rgba(244, 235, 212, 0.72);
  --cream-muted: rgba(244, 235, 212, 0.45);
  --gold: #dfc38d;
  --panel-bg: rgba(34, 37, 33, 0.72);
  --panel-border: rgba(236, 222, 189, 0.22);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif CN", "SimSun", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 44%, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-deep) 100%);
  color: var(--cream);
  font-family: var(--sans);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body.mood-night {
  background: radial-gradient(ellipse at 50% 42%, #243043 0%, #192232 52%, #0e1420 100%);
}

body.mood-forest {
  background: radial-gradient(ellipse at 50% 44%, #313c32 0%, #242e26 50%, #161d18 100%);
}

#canvas-wrap {
  position: absolute;
  inset: 0;
}

/* 主舞台容器（默认全屏；适配微信内置浏览器动态视口 100dvh；开启小红书 3:4 时居中裁成 3:4 画幅） */
.stage-frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
}

body.ratio-xhs {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141513 !important;
}

body.ratio-xhs .stage-frame {
  height: min(94vh, 960px);
  width: calc(min(94vh, 960px) * 0.75);
  max-width: 96vw;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(236, 222, 189, 0.18);
  background: radial-gradient(ellipse at 50% 44%, var(--bg-top) 0%, var(--bg-mid) 50%, var(--bg-deep) 100%);
}

body.ratio-xhs.mood-luoyang .stage-frame {
  background: radial-gradient(ellipse at 50% 38%, #2c211d 0%, #1c1618 48%, #0f0d12 100%);
}

body.ratio-xhs.mood-arcade .stage-frame {
  background: radial-gradient(ellipse at 50% 38%, #26252c 0%, #1a1a22 50%, #101016 100%);
}

.pill-btn.active-mode {
  background: rgba(223, 195, 141, 0.26);
  border-color: rgba(244, 214, 150, 0.75);
  color: #fff4da;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene.dragging-orbit {
  cursor: grabbing;
}

#scene.hover-interactive {
  cursor: pointer;
}

#scene.hover-corner {
  cursor: ew-resize;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 52%, transparent 48%, rgba(12, 14, 11, 0.48) 100%);
}

/* 顶部导航 */
.top-bar {
  position: absolute;
  top: 22px;
  left: 28px;
  right: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  pointer-events: auto;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(155deg, #f3e6c8 0%, #decba3 100%);
  color: #362d22;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--cream);
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--cream-soft);
  margin-top: 2px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  pointer-events: auto;
}

.pill-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.pill-btn.icon-only {
  width: 34px;
  padding: 0;
}

.pill-btn:hover {
  background: rgba(54, 58, 50, 0.88);
  border-color: rgba(244, 235, 212, 0.45);
}

.pill-btn:active {
  transform: scale(0.95);
}

.pill-btn.muted {
  color: var(--cream-muted);
}

/* 左侧章节标题 */
.chapter-header {
  position: absolute;
  top: 86px;
  left: 32px;
  z-index: 15;
  pointer-events: none;
  max-width: 310px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.chapter-header.switching {
  opacity: 0;
  transform: translateY(6px);
}

.chapter-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 10px;
}

.eyebrow-line {
  width: 18px;
  height: 1px;
  background: var(--gold);
  opacity: 0.7;
}

.eyebrow-sep {
  opacity: 0.4;
}

#ch-latin {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: var(--cream-soft);
}

.chapter-title {
  font-family: var(--serif);
  font-size: clamp(36px, 4.4vw, 54px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.12;
  color: #f7eed9;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.34);
  margin-bottom: 10px;
}

.chapter-sub {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 0.1em;
  color: var(--cream-soft);
  margin-bottom: 12px;
}

.chapter-hint {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(34, 37, 33, 0.52);
  border: 1px solid rgba(236, 222, 189, 0.24);
  color: var(--cream);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.chapter-hint:hover {
  background: rgba(58, 62, 53, 0.8);
  border-color: rgba(236, 222, 189, 0.5);
  transform: translateY(-1px);
}

.chapter-hint:active {
  transform: scale(0.97);
}

.hint-dot {
  color: var(--gold);
  font-size: 13px;
}

.chapter-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chapter-hint.secondary {
  background: rgba(186, 86, 74, 0.24);
  border-color: rgba(242, 168, 152, 0.48);
  color: #ffeae4;
}

.chapter-hint.secondary:hover {
  background: rgba(196, 94, 82, 0.42);
  border-color: rgba(248, 192, 178, 0.78);
}

.chapter-hint[hidden] {
  display: none;
}

.chapter-score {
  margin-top: 10px;
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.05em;
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(30, 33, 29, 0.78);
  border: 1px solid rgba(223, 195, 141, 0.3);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.chapter-score:empty {
  display: none;
}

/* 左下旁白字幕 */
.caption-bar {
  position: absolute;
  left: 32px;
  bottom: 24px;
  z-index: 15;
  pointer-events: none;
  max-width: min(560px, 56vw);
}

.caption-bar p {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: #f3ead6;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  transition: opacity 0.28s ease;
}

/* 右下角翻页滑块 */
.pager-panel {
  position: absolute;
  right: 28px;
  bottom: 20px;
  z-index: 20;
  width: 248px;
  padding: 10px 14px 12px;
  border-radius: 12px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.pager-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--cream-soft);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}

.pager-count {
  font-variant-numeric: tabular-nums;
  color: var(--cream);
  font-weight: 600;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager-arrow {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(236, 222, 189, 0.25);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s ease, opacity 0.18s ease;
}

.pager-arrow:hover:not(:disabled) {
  background: rgba(236, 222, 189, 0.18);
}

.pager-arrow:disabled {
  opacity: 0.32;
  cursor: default;
}

.pager-track-wrap {
  position: relative;
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
}

#page-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 99px;
  background: rgba(244, 235, 212, 0.25);
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

#page-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #2b2d26;
  box-shadow: 0 0 0 2px rgba(223, 195, 141, 0.32);
  cursor: pointer;
  transition: transform 0.15s ease;
}

#page-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}

.pager-dots {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
}

.pager-dots .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(244, 235, 212, 0.35);
}

.pager-dots .dot.active {
  background: var(--gold);
}

/* 目录抽屉 */
.toc-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 86vw);
  background: rgba(27, 30, 26, 0.94);
  border-left: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  z-index: 40;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  transform: translateX(104%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45);
}

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

.toc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(236, 222, 189, 0.14);
}

.toc-kicker {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-bottom: 4px;
}

.toc-header h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--cream);
}

.toc-list {
  list-style: none;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

.toc-item {
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(236, 222, 189, 0.12);
  background: rgba(255, 250, 240, 0.03);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.toc-item:hover {
  background: rgba(236, 222, 189, 0.09);
  border-color: rgba(236, 222, 189, 0.34);
  transform: translateX(-2px);
}

.toc-item.active {
  background: rgba(223, 195, 141, 0.15);
  border-color: rgba(223, 195, 141, 0.55);
}

.toc-item-meta {
  font-size: 10.5px;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.toc-item-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--cream);
  margin-bottom: 4px;
}

.toc-item-desc {
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1.5;
  color: rgba(244, 235, 212, 0.72);
}

.toc-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(236, 222, 189, 0.12);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--cream-muted);
}

/* 提示吐司 */
.toast {
  position: absolute;
  left: 50%;
  top: 26px;
  transform: translateX(-50%) translateY(-16px);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(31, 34, 29, 0.88);
  border: 1px solid rgba(236, 222, 189, 0.3);
  color: var(--cream);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 应天门互拍机位切换胶囊条 */
.cam-mode-bar {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cam-mode-bar[hidden] {
  display: none;
}

.cam-pill {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(236, 222, 189, 0.28);
  background: rgba(24, 26, 24, 0.72);
  color: var(--cream-soft);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.18s ease;
}

.cam-pill:hover {
  border-color: rgba(244, 212, 146, 0.65);
  color: var(--cream);
}

.cam-pill.active {
  background: rgba(226, 174, 92, 0.28);
  border-color: rgba(246, 210, 134, 0.85);
  color: #fff4d8;
  box-shadow: 0 0 12px rgba(240, 182, 88, 0.25);
}

/* 复古相机取景框叠层（避开左侧章节标题与右侧拍立得展区） */
.viewfinder-overlay {
  position: absolute;
  top: 74px;
  bottom: 88px;
  left: max(315px, 25%);
  right: max(224px, 18%);
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.viewfinder-overlay.active {
  opacity: 1;
  transform: scale(1);
}

.vf-corner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-color: rgba(252, 232, 186, 0.78);
  border-style: solid;
  border-width: 0;
}

.vf-tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.vf-tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.vf-bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.vf-br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.vf-top-meta {
  position: absolute;
  top: 10px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(252, 235, 198, 0.86);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
}

.vf-rec {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.vf-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef6351;
  box-shadow: 0 0 8px #ef6351;
}

.vf-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(252, 232, 186, 0.45);
  border-radius: 50%;
}

/* 快门暖白闪光 */
.shutter-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 250, 235, 0.92) 0%, rgba(255, 240, 212, 0.72) 100%);
  opacity: 0;
  pointer-events: none;
  z-index: 45;
  transition: opacity 0.36s ease-out;
}

.shutter-flash.flash {
  opacity: 1;
  transition: none;
}

/* 拍立得即时成片展示区 */
.polaroid-tray {
  position: absolute;
  right: 28px;
  top: 78px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.polaroid-card {
  pointer-events: auto;
  width: 176px;
  padding: 8px 8px 10px;
  background: #faf3e4;
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(96, 74, 48, 0.18);
  color: #463526;
  transform: rotate(var(--rot, -2deg)) translateY(0);
  animation: polaroidPop 0.45s cubic-bezier(0.22, 1.28, 0.36, 1) both;
  cursor: pointer;
  position: relative;
}

.polaroid-card:hover {
  transform: rotate(0deg) scale(1.04);
  transition: transform 0.2s ease;
}

.polaroid-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  background: #1a1816;
}

.polaroid-cap {
  margin-top: 7px;
  font-family: var(--serif);
  font-size: 11.5px;
  text-align: center;
  color: #4e3b2b;
  letter-spacing: 0.04em;
}

.polaroid-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(34, 28, 22, 0.65);
  color: #fff6e6;
  font-size: 10px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}

@keyframes polaroidPop {
  from {
    opacity: 0;
    transform: rotate(4deg) translateY(-18px) scale(0.86);
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot, -2deg)) translateY(0) scale(1);
  }
}

/* 应天门盛唐夜色背景 */
body.mood-luoyang {
  background: radial-gradient(ellipse at 50% 38%, #2c211d 0%, #1c1618 48%, #0f0d12 100%);
}

/* 飞镖潮玩馆霓虹暗调背景 */
body.mood-arcade {
  background: radial-gradient(ellipse at 50% 38%, #26252c 0%, #1a1a22 50%, #101016 100%);
}

/* 双人飞镖积分表浮卡 */
.dart-scoreboard {
  position: absolute;
  right: 28px;
  top: 76px;
  z-index: 22;
  width: 248px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(24, 25, 32, 0.86);
  border: 1px solid rgba(255, 118, 82, 0.36);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--cream);
}

.dart-scoreboard[hidden] {
  display: none;
}

.ds-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ds-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #ffb27a;
}

.ds-reset {
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid rgba(244, 235, 212, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream-soft);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.ds-reset:hover {
  background: rgba(255, 110, 74, 0.25);
  color: var(--cream);
}

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 10px;
}

.ds-table th {
  text-align: left;
  font-weight: 500;
  font-size: 10.5px;
  color: var(--cream-muted);
  padding: 0 4px 6px;
  border-bottom: 1px solid rgba(244, 235, 212, 0.12);
}

.ds-table th:last-child,
.ds-table td:last-child {
  text-align: right;
}

.ds-table td {
  padding: 7px 4px;
  border-bottom: 1px solid rgba(244, 235, 212, 0.07);
}

.ds-table tr.active-turn {
  background: rgba(255, 108, 72, 0.14);
}

.ds-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.ds-tag.girl {
  background: rgba(244, 114, 128, 0.26);
  color: #ffc5cc;
  border: 1px solid rgba(244, 114, 128, 0.48);
}

.ds-tag.boy {
  background: rgba(94, 174, 235, 0.24);
  color: #bfe4ff;
  border: 1px solid rgba(94, 174, 235, 0.48);
}

.ds-hist {
  font-variant-numeric: tabular-nums;
  color: var(--cream-soft);
  font-size: 11.5px;
}

.ds-total {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 700;
  color: #ffd87a;
}

.ds-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.ds-turn-btn {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(244, 235, 212, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream-soft);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ds-turn-btn:hover {
  border-color: rgba(255, 158, 106, 0.55);
  color: var(--cream);
}

.ds-turn-btn.active {
  background: rgba(255, 106, 68, 0.28);
  border-color: rgba(255, 138, 96, 0.85);
  color: #fff4e4;
  box-shadow: 0 0 12px rgba(255, 98, 62, 0.25);
}

/* 3D 精装硬壳书合拢态与开合过渡 HUD 控制 */
body.book-closed {
  background: radial-gradient(ellipse at 50% 42%, #2f3a2f 0%, #202721 52%, #131814 100%);
}

body.ratio-xhs.book-closed .stage-frame {
  background: radial-gradient(ellipse at 50% 42%, #2f3a2f 0%, #202721 52%, #131814 100%);
}

.top-bar,
.chapter-header,
.caption-bar,
.pager-panel,
.dart-scoreboard,
.vinyl-card,
.polaroid-tray {
  transition: opacity 0.48s cubic-bezier(0.22, 1, 0.36, 1), transform 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

body.book-closed .top-bar,
body.book-closed .chapter-header,
body.book-closed .caption-bar,
body.book-closed .pager-panel,
body.book-closed .dart-scoreboard,
body.book-closed .vinyl-card,
body.book-closed .polaroid-tray,
body.book-transitioning .top-bar,
body.book-transitioning .chapter-header,
body.book-transitioning .caption-bar,
body.book-transitioning .pager-panel,
body.book-transitioning .dart-scoreboard,
body.book-transitioning .vinyl-card,
body.book-transitioning .polaroid-tray,
body.book-closing .top-bar,
body.book-closing .chapter-header,
body.book-closing .caption-bar,
body.book-closing .pager-panel,
body.book-closing .dart-scoreboard,
body.book-closing .vinyl-card,
body.book-closing .polaroid-tray {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(8px);
}

/* 3D 封面合拢态底部轻盈浮层（完全不遮挡 3D 实体精装书） */
.cover-hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(28px, calc(18px + env(safe-area-inset-bottom)));
  z-index: 36;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.52s cubic-bezier(0.22, 1, 0.36, 1), transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

body.book-closed .cover-hud {
  opacity: 1;
  transform: translateY(0);
}

.cover-open-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 28px;
  border-radius: 999px;
  border: 1px solid rgba(244, 216, 140, 0.78);
  background: linear-gradient(180deg, rgba(38, 60, 40, 0.88) 0%, rgba(22, 36, 24, 0.92) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #faecbf;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow:
    0 10px 28px rgba(8, 16, 10, 0.56),
    inset 0 1px 0 rgba(255, 240, 194, 0.25);
  transition: background 0.22s ease, transform 0.18s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

body:not(.book-closed) .cover-open-btn {
  pointer-events: none;
}

.cover-open-btn:hover {
  background: linear-gradient(180deg, rgba(50, 78, 52, 0.94) 0%, rgba(28, 46, 30, 0.96) 100%);
  border-color: #f9e4a6;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(8, 16, 10, 0.65), 0 0 20px rgba(244, 214, 134, 0.2);
}

.cover-open-btn:active {
  transform: scale(0.96);
}

.cover-open-spark {
  font-size: 13px;
  color: #f4d37e;
}

.cover-hud-tip {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: rgba(244, 235, 212, 0.66);
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

body.ratio-xhs .cover-hud {
  bottom: 22px;
  gap: 8px;
}

body.ratio-xhs .cover-open-btn {
  padding: 9px 22px;
  font-size: 13.5px;
}

body.ratio-xhs .cover-hud-tip {
  font-size: 11px;
}

body.ratio-xhs #btn-bgm { padding: 0 8px; }
body.ratio-xhs #bgm-label { font-size: 10.5px; }

/* 放大阅读复古情书信纸弹层 */
.letter-modal {
  position: absolute;
  inset: 0;
  z-index: 44;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 17, 14, 0.68);
  backdrop-filter: blur(7px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.36s ease;
}

.letter-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.letter-sheet {
  position: relative;
  width: min(460px, 90%);
  max-height: 84%;
  overflow-y: auto;
  padding: 36px 32px 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #fcf6e8 0%, #f5ead2 100%);
  color: #463425;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(188, 152, 108, 0.55);
  transform: translateY(22px) scale(0.92);
  transition: transform 0.42s cubic-bezier(0.22, 1.15, 0.36, 1);
}

.letter-sheet::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid rgba(192, 152, 104, 0.46);
  border-radius: 5px;
  pointer-events: none;
}

.letter-modal.open .letter-sheet {
  transform: translateY(0) scale(1);
}

.letter-wax-badge {
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #dc5b50 0%, #b43931 100%);
  color: #fcebd4;
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(154, 48, 38, 0.34);
}

.letter-date {
  text-align: center;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: #a68259;
  margin-bottom: 18px;
}

.letter-salutation {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: #513724;
  margin-bottom: 14px;
}

.letter-body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 2.05;
  color: #4b392a;
  letter-spacing: 0.04em;
}

.letter-body p {
  min-height: 14px;
  border-bottom: 1px dashed rgba(186, 154, 118, 0.3);
  padding: 2px 0;
}

.letter-body p.spacer {
  border-bottom: none;
  min-height: 12px;
}

.letter-sign {
  margin-top: 20px;
  text-align: right;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  color: #b44b40;
  letter-spacing: 0.06em;
}

.letter-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.letter-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(180, 128, 86, 0.45);
  background: rgba(212, 168, 114, 0.14);
  color: #65452b;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease;
}

.letter-close-btn.primary {
  background: linear-gradient(180deg, #d85d52 0%, #b84239 100%);
  border-color: rgba(164, 48, 40, 0.7);
  color: #fff5e8;
  box-shadow: 0 6px 14px rgba(154, 48, 38, 0.25);
}

.letter-close-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

body.ratio-xhs .letter-sheet {
  padding: 28px 24px 22px;
}

body.ratio-xhs .letter-body {
  font-size: 14.5px;
  line-height: 1.95;
}

body.ratio-xhs .toc-drawer { padding: 18px 16px; }
body.ratio-xhs .toc-header { padding-bottom: 10px; }
body.ratio-xhs .toc-header h2 { font-size: 20px; }
body.ratio-xhs .toc-list { margin-top: 10px; gap: 6px; scrollbar-width: none; }
body.ratio-xhs .toc-list::-webkit-scrollbar { display: none; }
body.ratio-xhs .toc-item { padding: 8px 11px; }
body.ratio-xhs .toc-item-title { font-size: 14.5px; margin-bottom: 2px; }
body.ratio-xhs .toc-item-desc { font-size: 11px; line-height: 1.4; }
body.ratio-xhs .toc-footer { padding-top: 10px; font-size: 10.5px; }

/* 共同歌单黑胶播放器浮卡 */
.vinyl-card {
  position: absolute;
  right: 28px;
  top: 76px;
  z-index: 22;
  width: 274px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(34, 28, 25, 0.86);
  border: 1px solid rgba(232, 198, 134, 0.34);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.44);
  color: var(--cream);
}

.vinyl-card[hidden] {
  display: none;
}

.vc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(244, 235, 212, 0.12);
}

.vc-disc-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background:
    radial-gradient(circle, #f3d092 0 14%, #b8434a 15% 38%, #1f1f24 39% 100%);
  box-shadow: 0 0 0 1px rgba(255, 240, 212, 0.25);
}

.vc-disc-icon.spinning {
  animation: vinylSpin 2.6s linear infinite;
}

@keyframes vinylSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vc-meta {
  flex: 1;
  min-width: 0;
}

.vc-kicker {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--gold);
}

.vc-now {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vc-play-btn {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(242, 206, 138, 0.55);
  background: rgba(226, 178, 98, 0.2);
  color: #fff4da;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease;
}

.vc-play-btn:hover {
  background: rgba(226, 178, 98, 0.36);
}

.vc-play-btn.playing {
  background: rgba(204, 84, 76, 0.36);
  border-color: rgba(246, 152, 140, 0.72);
}

.vc-tracks {
  list-style: none;
  margin: 9px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.vc-track-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 250, 240, 0.04);
  font-family: var(--serif);
  font-size: 13px;
  color: var(--cream-soft);
  cursor: pointer;
  transition: all 0.16s ease;
}

.vc-track-item:hover {
  background: rgba(244, 235, 212, 0.1);
  color: var(--cream);
}

.vc-track-item.active {
  background: rgba(226, 184, 114, 0.18);
  border-color: rgba(236, 198, 130, 0.45);
  color: #fff5de;
}

.vc-track-num {
  font-family: var(--sans);
  font-size: 10.5px;
  color: var(--gold);
  margin-right: 7px;
}

.vc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(244, 235, 212, 0.1);
  font-size: 10.5px;
  color: var(--cream-muted);
}

.vc-import-btn {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(244, 235, 212, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream-soft);
  cursor: pointer;
  white-space: nowrap;
}

.vc-import-btn:hover {
  background: rgba(232, 198, 134, 0.2);
  color: var(--cream);
}

body.ratio-xhs .vinyl-card {
  right: 14px;
  top: 58px;
  width: 214px;
  padding: 9px 10px;
}
body.ratio-xhs .vc-track-item { font-size: 12px; padding: 5px 7px; }
body.ratio-xhs .vc-tip { display: none; }

/* 3:4 小红书竖屏录屏模式下的精致紧凑排版（绝不换行、绝不遮挡书页主体） */
body.ratio-xhs .top-bar { top: 14px; left: 14px; right: 14px; gap: 8px; }
body.ratio-xhs .brand { gap: 8px; min-width: 0; }
body.ratio-xhs .brand-icon { width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0; }
body.ratio-xhs .brand-title { font-size: 16px; white-space: nowrap; }
body.ratio-xhs .brand-sub { font-size: 9.5px; letter-spacing: 0.1em; white-space: nowrap; }
body.ratio-xhs .top-actions { gap: 5px; flex-shrink: 0; }
body.ratio-xhs .pill-btn { height: 28px; padding: 0 9px; font-size: 11px; white-space: nowrap; }
body.ratio-xhs .pill-btn.icon-only { width: 28px; padding: 0; }
body.ratio-xhs #btn-reset span { display: none; }
body.ratio-xhs #btn-reset { width: 28px; padding: 0; }
body.ratio-xhs #btn-close-book span { display: none; }
body.ratio-xhs #btn-close-book { width: 28px; padding: 0; }
body.ratio-xhs .toast { top: 54px; font-size: 11.5px; padding: 6px 13px; white-space: nowrap; }
body.ratio-xhs .chapter-header { top: 58px; left: 18px; right: 18px; max-width: none; }
body.ratio-xhs .chapter-eyebrow { margin-bottom: 4px; font-size: 11px; }
body.ratio-xhs .chapter-title { font-size: 30px; margin-bottom: 4px; }
body.ratio-xhs .chapter-sub { font-size: 13.5px; margin-bottom: 8px; }
body.ratio-xhs .chapter-hint { padding: 5px 11px; font-size: 11.5px; }
body.ratio-xhs .chapter-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.chapter-hint.secondary {
  background: rgba(186, 86, 74, 0.24);
  border-color: rgba(242, 168, 152, 0.48);
  color: #ffeae4;
}

.chapter-hint.secondary:hover {
  background: rgba(196, 94, 82, 0.42);
  border-color: rgba(248, 192, 178, 0.78);
}

.chapter-hint[hidden] {
  display: none;
}

.chapter-score { margin-top: 6px; font-size: 11px; padding: 3px 10px; }
body.ratio-xhs .caption-bar { left: 18px; right: 18px; bottom: 82px; max-width: none; }
body.ratio-xhs .caption-bar p { font-size: 13.5px; }
body.ratio-xhs .pager-panel { right: 16px; bottom: 14px; width: 214px; }
body.ratio-xhs .dart-scoreboard { right: 14px; top: 58px; width: 196px; padding: 9px 10px; }
body.ratio-xhs .polaroid-tray { right: 14px; top: 58px; }
body.ratio-xhs .polaroid-card { width: 122px; }
body.ratio-xhs .viewfinder-overlay { top: 60px; bottom: 92px; left: 18px; right: 18px; }

@media (max-width: 720px) {
  .top-bar {
    top: max(12px, env(safe-area-inset-top));
    left: 14px;
    right: 14px;
    gap: 8px;
  }
  .brand { gap: 7px; min-width: 0; }
  .brand-icon { width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; }
  .brand-title { font-size: 15px; white-space: nowrap; }
  .brand-sub { display: none; }
  .top-actions { gap: 5px; flex-shrink: 0; }
  .pill-btn { height: 29px; padding: 0 8px; font-size: 11px; white-space: nowrap; }
  .pill-btn.icon-only { width: 29px; padding: 0; }
  #btn-ratio { display: none; }
  #btn-reset span { display: none; }
  #btn-reset { width: 29px; padding: 0; }
  #btn-shot { display: none; }
  #btn-close-book { padding: 0 8px; }
  #btn-close-book span { font-size: 11px; }
  #btn-bgm { padding: 0 7px; }
  #bgm-label { font-size: 10.5px; }

  .chapter-header {
    top: max(56px, calc(46px + env(safe-area-inset-top)));
    left: 16px;
    right: 16px;
    max-width: none;
  }
  .chapter-eyebrow { margin-bottom: 4px; font-size: 11px; }
  .chapter-title { font-size: 28px; margin-bottom: 4px; }
  .chapter-sub { font-size: 13px; margin-bottom: 8px; }
  .chapter-hint { padding: 6px 12px; font-size: 11.5px; }
  .caption-bar {
    left: 16px;
    right: 16px;
    bottom: max(84px, calc(74px + env(safe-area-inset-bottom)));
    max-width: none;
  }
  .caption-bar p { font-size: 13px; line-height: 1.55; }
  .pager-panel {
    right: 14px;
    left: 14px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
  }
  .polaroid-tray { right: 12px; top: 58px; }
  .polaroid-card { width: 120px; }
  .dart-scoreboard { right: 12px; top: 56px; width: 192px; padding: 9px 10px; }
  .vinyl-card { right: 12px; top: 56px; width: 212px; padding: 9px 10px; }
  .vc-tip { display: none; }
  .cover-open-btn { padding: 11px 24px; font-size: 14px; }
  .cover-hud-tip { font-size: 11px; }
}
