/**
 * 《末班车的归潮》海港归潮信俗典藏版样式系统 v6
 * 设计语言：「海蚀黑曜石玻璃 × 香槟暖金细线 × 归潮海灯微光」
 * v5 重点升级：
 * 1. 柚子社（Yuzusoft）级树状分支流程图（主干轨 → 总分岔枢纽 → 三列并行个人线 → 终章汇流 + 直达选项徽章）
 * 2. 对白回看行内「↶ 跳回此句」时光倒流微按钮
 * 3. 三人同屏立绘自适应间距与缩放（.cast-layer.trio）、矮屏/移动端宽银幕黑边与底部工具栏防拥挤修复
 */
:root {
  --bg-void: #060f17;
  --obsidian: rgba(8, 20, 30, 0.84);
  --obsidian-strong: rgba(7, 17, 26, 0.92);
  --glass-border: rgba(232, 202, 146, 0.28);
  --glass-border-b: rgba(114, 218, 255, 0.42);
  --gold: #ecd098;
  --gold-bright: #ffe5b3;
  --rift-cyan: #7ce2ff;
  --text-main: #f6efe2;
  --text-sub: #a9c1cc;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font: 16px/1.6 var(--sans);
  background: var(--bg-void);
  color: var(--text-main);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button[disabled] { cursor: default; opacity: 0.38; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}
button[hidden], [hidden] { display: none !important; }

.screen { position: relative; isolation: isolate; min-height: 100vh; min-height: 100svh; }

/* ==================== 标题界面（电影海报级排版） ==================== */
.home {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text-main);
  overflow: hidden;
}
.home-image, .home-veil, .fx-canvas, .grain, .viewport,
.scenery, .mood-layer, .cast-layer, .cg-layer, .edge, .fx-layer, .end-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.home-image {
  z-index: -4;
  background: #081520 url(./art/title.webp?v=7) 64% 44% / cover no-repeat;
  animation: home-pan 28s ease-in-out infinite alternate;
}
.home-veil {
  z-index: -3;
  background:
    linear-gradient(95deg, rgba(4, 11, 20, 0.94) 0%, rgba(6, 17, 29, 0.78) 34%, rgba(8, 20, 34, 0.24) 60%, transparent 82%),
    linear-gradient(0deg, rgba(4, 10, 18, 0.88) 0%, transparent 25%, transparent 78%, rgba(4, 11, 20, 0.72) 100%);
}
.fx-canvas { z-index: -2; width: 100%; height: 100%; }
.grain {
  z-index: -1;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255, 255, 255, 0.025) 3px);
}

.homebar, .homefoot {
  padding: clamp(18px, 3.6vh, 34px) max(4.8vw, 22px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  z-index: 3;
}
.homebar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.back-portal { text-decoration: none; display: inline-flex; align-items: center; }
.brand-lockup { display: flex; align-items: center; gap: 13px; color: var(--gold); }
.tape-reel { width: 42px; height: 26px; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(124, 226, 255, 0.28)); }
.mini-reel { width: 28px; height: 16px; color: var(--gold); opacity: 0.85; flex-shrink: 0; }
.reel-spin { transform-box: fill-box; transform-origin: center; }
body.audio-on .reel-spin { animation: reel-rotate 6s linear infinite; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font: 600 0.76rem var(--sans); letter-spacing: 0.24em; color: var(--gold-bright); }
.brand-text span { font: 400 0.78rem var(--serif); letter-spacing: 0.1em; color: var(--text-sub); margin-top: 2px; }

.homecopy {
  width: min(630px, 58%);
  margin-left: max(6.5vw, 24px);
  padding: 12px 0 20px;
  z-index: 3;
}
.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--rift-cyan);
}
.eyebrow:before {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), var(--rift-cyan));
}
.eyebrow i {
  font-style: normal;
  color: var(--gold);
  letter-spacing: 0.14em;
  padding-left: 10px;
  border-left: 1px solid rgba(236, 208, 152, 0.35);
}

.home h1 {
  margin: 0;
  font: 600 clamp(3.3rem, 6.2vw, 6.4rem)/1.02 var(--serif);
  letter-spacing: -0.02em;
  color: #fff5df;
  text-shadow: 0 8px 40px rgba(4, 14, 26, 0.9), 0 0 28px rgba(124, 226, 255, 0.16);
}
.title-main { display: block; }
.title-accent { display: inline-flex; align-items: baseline; gap: 0.06em; }
.title-tide {
  font: 700 1.12em/1.02 var(--serif);
  font-style: normal;
  background: linear-gradient(135deg, #fff4d2 0%, #f4cb7e 44%, #86e6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(124, 226, 255, 0.36));
}
.title-m { font-size: 0.94em; }

.blurb {
  margin: 22px 0 26px;
  font: 400 clamp(0.95rem, 1.1vw, 1.1rem)/1.92 var(--serif);
  color: rgba(244, 238, 226, 0.92);
  text-shadow: 0 2px 16px rgba(3, 10, 18, 0.95);
}

/* 奢华艺术按钮体系 */
.entry, .home-links, .end-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.cta-gold, .cta-rift, .cta-ghost, .glass-pill, .choice, .forward {
  transition: transform 0.18s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}
.cta-gold {
  position: relative;
  overflow: hidden;
  padding: 12px 32px;
  border-radius: 4px;
  border: 1px solid rgba(255, 238, 198, 0.85);
  background: linear-gradient(135deg, #f7e1b2 0%, #dfc082 100%);
  color: #102029;
  font: 700 0.98rem var(--serif);
  letter-spacing: 0.1em;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.cta-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(236, 208, 152, 0.35); background: linear-gradient(135deg, #ffefd0, #ebcb8d); }
.cta-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sheen 4.8s ease-in-out infinite;
}

.cta-rift {
  padding: 12px 26px;
  border-radius: 4px;
  border: 1px solid rgba(134, 230, 255, 0.8);
  background: linear-gradient(135deg, rgba(20, 74, 108, 0.92), rgba(154, 96, 44, 0.92));
  color: #fff9eb;
  font: 700 0.96rem var(--serif);
  letter-spacing: 0.08em;
  box-shadow: 0 0 28px rgba(124, 226, 255, 0.38);
}
.cta-rift:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(124, 226, 255, 0.6); }

.cta-ghost, .glass-pill {
  padding: 8px 15px;
  border-radius: 4px;
  border: 1px solid var(--glass-border);
  background: rgba(8, 22, 34, 0.68);
  backdrop-filter: blur(12px);
  color: var(--text-main);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
}
.cta-ghost:hover, .glass-pill:hover {
  background: rgba(18, 46, 66, 0.82);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.home-links { margin-top: 18px; gap: 22px; }
.home-links button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: rgba(240, 232, 215, 0.88);
  font: 500 0.94rem var(--serif);
  letter-spacing: 0.08em;
  position: relative;
}
.home-links button:after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--gold), var(--rift-cyan));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.home-links button:hover { color: var(--gold-bright); }
.home-links button:hover:after { transform: scaleX(1); }

.badge-strip {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(6, 17, 27, 0.72);
  border: 1px solid rgba(236, 208, 152, 0.22);
  backdrop-filter: blur(12px);
}
.badge-label { font: 600 0.76rem var(--serif); letter-spacing: 0.14em; color: var(--gold); margin-right: 4px; }
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(169, 193, 204, 0.65);
  background: rgba(5, 13, 21, 0.6);
}
.badge-pill i { font-style: normal; }
.badge-pill.lit {
  color: #fff8e6;
  border-color: rgba(124, 226, 255, 0.75);
  background: linear-gradient(135deg, rgba(22, 69, 94, 0.85), rgba(84, 62, 34, 0.85));
  box-shadow: 0 0 14px rgba(124, 226, 255, 0.35);
}
.badge-pill.lit i { color: var(--gold-bright); }

.resume-note { margin: 12px 0 0; color: #ffdfb2; font-size: 0.84rem; }
.homefoot { font-size: 0.76rem; letter-spacing: 0.12em; color: rgba(188, 208, 218, 0.75); }

/* ==================== 舞台界面与立绘呼吸融合 ==================== */
.stage, .ending { height: 100vh; height: 100dvh; min-height: 360px; overflow: hidden; }
.viewport { overflow: hidden; background: #061018; }
.scenery { z-index: 1; }
.scenery img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  opacity: 0; transform: scale(1.02); transition: opacity 0.6s ease;
}
.scenery img.on { opacity: 1; animation: scene-in 4.2s ease-out both; }

/* 气氛与归潮境滤镜层 */
.mood-layer { z-index: 2; opacity: 0; transition: background 0.7s ease, opacity 0.7s ease, backdrop-filter 0.7s ease; }
.mood-layer[data-mood="dusk"] {
  opacity: 1;
  background: linear-gradient(180deg, rgba(255, 145, 77, 0.15) 0%, rgba(56, 36, 78, 0.22) 58%, rgba(8, 17, 30, 0.42) 100%);
}
.mood-layer[data-mood="night"] {
  opacity: 1;
  background: linear-gradient(180deg, rgba(5, 15, 32, 0.56) 0%, rgba(10, 28, 48, 0.42) 65%, rgba(4, 11, 20, 0.65) 100%);
}
.mood-layer[data-mood="rain"] {
  opacity: 1;
  background: linear-gradient(180deg, rgba(16, 34, 48, 0.36) 0%, rgba(10, 24, 36, 0.44) 100%);
}
.mood-layer[data-mood="memory"] {
  opacity: 1;
  background: radial-gradient(circle at center, transparent 36%, rgba(20, 12, 5, 0.68) 100%), linear-gradient(180deg, rgba(212, 160, 96, 0.24), rgba(112, 72, 34, 0.28));
  backdrop-filter: sepia(0.42) contrast(1.05);
}
.mood-layer[data-mood="tense"] {
  opacity: 1;
  background: radial-gradient(circle at center, transparent 32%, rgba(3, 12, 20, 0.72) 100%);
}
.mood-layer[data-mood="warm"] {
  opacity: 1;
  background: radial-gradient(circle at 50% 35%, rgba(255, 214, 145, 0.22) 0%, rgba(78, 43, 20, 0.16) 72%, rgba(12, 18, 26, 0.35) 100%);
}
.mood-layer[data-mood="bside"] {
  opacity: 1;
  background:
    radial-gradient(ellipse at 55% 15%, rgba(86, 224, 255, 0.26) 0%, transparent 56%),
    linear-gradient(180deg, rgba(6, 22, 44, 0.64) 0%, rgba(9, 28, 48, 0.46) 55%, rgba(4, 14, 28, 0.72) 100%);
  backdrop-filter: hue-rotate(-8deg) saturate(1.18) contrast(1.08);
}

#stageCanvas { z-index: 3; }

/* 多人立绘舞台：伪 Live2D 柔和呼吸 + 三人同屏疏朗构图优化 */
.cast-layer { z-index: 4; overflow: hidden; }
.actor-slot {
  position: absolute;
  bottom: max(-4vh, -38px);
  height: 92%;
  width: 48vw;
  max-width: 620px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.32s ease, filter 0.38s ease, left 0.38s ease, height 0.38s ease;
}
.actor-slot[data-pos="center"] { left: 50%; transform: translateX(-50%); }
.actor-slot[data-pos="left"] { left: 26%; transform: translateX(-50%); }
.actor-slot[data-pos="right"] { left: 74%; transform: translateX(-50%); }

/* 三角色同屏构图：拉宽左右间距并适度收束高度，避免肩袖交叠 */
.cast-layer.trio .actor-slot {
  height: 86%;
  width: 34vw;
  max-width: 460px;
  bottom: max(-2vh, -20px);
}
.cast-layer.trio .actor-slot[data-pos="left"] { left: 20%; }
.cast-layer.trio .actor-slot[data-pos="center"] { left: 50%; z-index: 1; }
.cast-layer.trio .actor-slot[data-pos="right"] { left: 80%; }

.actor-slot.on { opacity: 1; }
.actor-slot.on img { animation: live-breath 5.2s ease-in-out infinite; }
.actor-slot.dim { filter: brightness(0.68) saturate(0.84); transform: translateX(-50%) scale(0.97); }
.actor-slot.speaking {
  z-index: 3;
  filter: brightness(1.04) drop-shadow(0 12px 28px rgba(5, 16, 26, 0.65));
  transform: translateX(-50%) translateY(-4px) scale(1.02);
}
.stage[data-phase="B"] .actor-slot.on {
  filter: brightness(0.95) drop-shadow(0 0 22px rgba(114, 222, 255, 0.42));
}
.stage[data-phase="B"] .actor-slot.dim {
  filter: brightness(0.64) drop-shadow(0 0 12px rgba(114, 222, 255, 0.2));
}
.actor-slot img {
  max-height: 100%; max-width: 100%;
  object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 8px 24px rgba(5, 14, 22, 0.52));
  transform-origin: center bottom;
}
.actor-slot.anim-enter { animation: actor-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
.actor-slot.anim-shake { animation: actor-shake 0.38s ease; }
.actor-slot.anim-hop { animation: actor-hop 0.44s ease; }
.actor-slot.anim-lean { transform: translateX(-50%) translateY(-10px) scale(1.08) !important; }

/* 全屏事件 CG 层 */
.cg-layer { z-index: 5; opacity: 0; transition: opacity 0.6s ease; background: #050d14; }
.cg-layer.on { opacity: 1; }
.cg-layer img { width: 100%; height: 100%; object-fit: cover; object-position: center; transform: scale(1.015); }
.cg-layer.on img { animation: cg-in 2.6s ease-out both; }

.edge {
  z-index: 6;
  background: linear-gradient(180deg, rgba(4, 12, 20, 0.56) 0%, transparent 18%, transparent 56%, rgba(4, 11, 18, 0.82) 100%);
}
.fx-layer { z-index: 7; opacity: 0; }
.viewport.fx-shake { animation: cam-shake 0.38s ease; }
.viewport.fx-shake-hard { animation: cam-shake-hard 0.54s ease; }
.fx-layer.fx-flash { animation: fx-flash 0.58s ease-out; background: #fff9ec; }
.fx-layer.fx-blackout { animation: fx-blackout 0.92s ease-out; background: #02060a; }
.fx-layer.fx-glitch {
  opacity: 1;
  animation: fx-glitch 0.72s steps(2, end);
  background:
    repeating-linear-gradient(0deg, rgba(84, 236, 255, 0.24) 0 2px, transparent 2px 5px, rgba(255, 76, 116, 0.18) 5px 7px),
    linear-gradient(90deg, rgba(86, 232, 255, 0.18), transparent 42%, rgba(255, 76, 116, 0.22));
  mix-blend-mode: screen;
}

/* 电影宽银幕黑边遮幅（自适应高度防遮挡） */
.cinema-bar {
  position: absolute; left: 0; right: 0; height: 0; z-index: 8;
  background: #03080d;
  transition: height 0.65s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.cinema-bar.top { top: 0; }
.cinema-bar.bottom { bottom: 0; }
.stage.cinema-bars .cinema-bar { height: clamp(16px, 3.6vh, 38px); }

/* 电影章节标题卡 */
.chapter-card {
  position: absolute; inset: 0; z-index: 25;
  display: grid; place-items: center;
  background: radial-gradient(circle at center, rgba(8, 22, 34, 0.92) 0%, rgba(3, 9, 16, 0.97) 100%);
  color: var(--text-main);
  cursor: pointer;
  animation: card-fade 2.15s ease forwards;
}
.card-inner {
  text-align: center;
  padding: 32px 44px;
  border-top: 1px solid rgba(236, 208, 152, 0.45);
  border-bottom: 1px solid rgba(124, 226, 255, 0.38);
}
.card-phase { display: block; font-size: 0.76rem; letter-spacing: 0.26em; color: var(--rift-cyan); margin-bottom: 8px; }
.card-act { display: block; font-size: 0.86rem; letter-spacing: 0.22em; color: var(--gold); margin-bottom: 10px; }
.card-title { margin: 0; font: 600 clamp(1.8rem, 3.6vw, 2.85rem)/1.3 var(--serif); letter-spacing: 0.1em; color: #fff6e2; }
.card-meta { display: block; margin-top: 12px; font-size: 0.82rem; letter-spacing: 0.16em; color: var(--text-sub); }

/* 舞台顶部 HUD */
.stagehead {
  position: absolute; inset: 0 0 auto; z-index: 12;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: max(18px, env(safe-area-inset-top)) max(3.6vw, 18px);
  transition: opacity 0.25s, transform 0.45s;
}
.stage.cinema-bars .stagehead { transform: translateY(14px); }
.location {
  display: flex; flex-direction: column; align-items: flex-start;
  border-left: 2px solid var(--gold);
  padding: 6px 16px;
  background: linear-gradient(90deg, rgba(6, 17, 28, 0.86), rgba(6, 17, 28, 0.56) 80%, transparent);
  backdrop-filter: blur(10px);
  border-radius: 0 6px 6px 0;
  max-width: 65%;
}
.stage[data-phase="B"] .location { border-left-color: var(--rift-cyan); }
.loc-top { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; font-size: 0.76rem; letter-spacing: 0.08em; color: var(--text-sub); }
.phase-badge {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  padding: 1px 8px; border-radius: 3px;
  background: rgba(236, 208, 152, 0.18);
  border: 1px solid rgba(236, 208, 152, 0.5);
  color: var(--gold-bright);
}
.stage[data-phase="B"] .phase-badge {
  background: rgba(124, 226, 255, 0.18);
  border-color: rgba(124, 226, 255, 0.75);
  color: #a4efff;
  box-shadow: 0 0 12px rgba(124, 226, 255, 0.35);
}
.loc-top time { color: var(--gold); font-variant-numeric: tabular-nums; padding-left: 8px; border-left: 1px solid rgba(236, 208, 152, 0.32); }
.location b { font: 600 1.08rem var(--serif); letter-spacing: 0.04em; color: #fff6e4; margin-top: 2px; }
.stage-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.pill-num {
  display: inline-block; min-width: 1.4em; padding: 0 5px; margin-left: 4px;
  border-radius: 99px; background: var(--gold); color: #0c1b24;
  font-size: 0.74rem; font-weight: 700; text-align: center;
}

.clue-toast {
  position: absolute; top: max(84px, calc(env(safe-area-inset-top) + 68px)); right: max(3.6vw, 18px); z-index: 16;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 18px; border-radius: 6px;
  border: 1px solid rgba(124, 226, 255, 0.65);
  background: linear-gradient(130deg, rgba(9, 25, 40, 0.94), rgba(16, 40, 54, 0.94));
  backdrop-filter: blur(12px);
  color: #fff6e4;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55), 0 0 18px rgba(124, 226, 255, 0.22);
  animation: toast-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast-kicker { font-size: 0.72rem; letter-spacing: 0.16em; color: var(--rift-cyan); }
.clue-toast strong { font: 600 0.96rem var(--serif); }

.unhide-ui {
  position: absolute; bottom: 20px; right: 22px; z-index: 18;
  padding: 6px 14px; border-radius: 99px;
  border: 1px solid rgba(236, 208, 152, 0.45);
  background: rgba(6, 17, 27, 0.75);
  color: var(--text-main); font-size: 0.82rem;
}
.stage.ui-hidden .stagehead, .stage.ui-hidden .textArea, .stage.ui-hidden .clue-toast { opacity: 0; pointer-events: none; }

/* 非对称切角黑曜石磨砂对话框 */
.textArea {
  position: absolute;
  bottom: max(2.4vh, 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(1040px, 92%);
  z-index: 12;
  transition: opacity 0.25s, bottom 0.45s;
}
.stage.cinema-bars .textArea { bottom: max(4.4vh, 26px); }

.decision { display: grid; gap: 10px; max-width: min(100%, 700px); margin: 0 auto 14px; max-height: 46vh; overflow: auto; padding: 2px; }
.choice {
  background: linear-gradient(110deg, rgba(10, 26, 40, 0.92), rgba(16, 36, 52, 0.9));
  backdrop-filter: blur(14px);
  border: 1px solid rgba(236, 208, 152, 0.38);
  border-left: 4px solid var(--gold);
  border-radius: 4px;
  color: #fff6e4;
  padding: 12px 20px;
  text-align: left;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.choice:hover {
  background: linear-gradient(110deg, rgba(22, 52, 74, 0.96), rgba(34, 62, 78, 0.95));
  border-color: var(--gold-bright);
  border-left-color: var(--rift-cyan);
  transform: translateY(-2px);
}
.choice.true-choice {
  background: linear-gradient(110deg, rgba(20, 50, 74, 0.95), rgba(82, 50, 22, 0.95));
  border-color: var(--rift-cyan);
  border-left-color: var(--gold-bright);
  box-shadow: 0 0 24px rgba(124, 226, 255, 0.32);
}
.choice b { display: block; font: 700 1rem var(--serif); letter-spacing: 0.03em; }
.choice small { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--text-sub); }

.dialogue {
  position: relative;
  border: 1px solid var(--glass-border);
  border-top: 2px solid var(--gold);
  background: linear-gradient(120deg, rgba(7, 19, 30, 0.90) 0%, rgba(11, 27, 40, 0.86) 100%);
  backdrop-filter: blur(16px);
  border-radius: 2px 14px 4px 14px;
  padding: clamp(14px, 1.5vw, 22px) clamp(20px, 2.5vw, 36px) 10px;
  color: var(--text-main);
  box-shadow: 0 16px 52px rgba(2, 8, 15, 0.72), inset 0 1px 0 rgba(255, 240, 210, 0.1);
}
.stage[data-phase="B"] .dialogue {
  border-color: var(--glass-border-b);
  border-top-color: var(--rift-cyan);
  box-shadow: 0 16px 52px rgba(2, 10, 22, 0.78), 0 0 26px rgba(124, 226, 255, 0.14);
}
.dialogue[data-tone="thought"] p { color: #b9d4df; font-style: italic; }
.dialogue[data-tone="signal"] { border-top-color: #6df2e2; }
.dialogue[data-tone="signal"] p { color: #befbf2; letter-spacing: 0.05em; }

.talktop, .tools, .tool-group, .speaker-wrap, .talk-meta { display: flex; align-items: center; }
.talktop, .tools { justify-content: space-between; gap: 10px; }
.speaker-wrap { gap: 10px; min-width: 0; }
.speaker-bar { width: 4px; height: 18px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 10px currentColor; flex-shrink: 0; }
.talktop strong { font: 700 1.2rem var(--serif); letter-spacing: 0.06em; color: var(--gold-bright); white-space: nowrap; }
.speaker-sub { font: 400 0.76rem var(--serif); letter-spacing: 0.12em; color: var(--text-sub); opacity: 0.88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid rgba(236, 208, 152, 0.36);
  background: rgba(16, 38, 56, 0.72);
  color: var(--gold-bright);
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.voice-btn:hover { background: rgba(236, 208, 152, 0.18); border-color: var(--gold-bright); }
.voice-btn.playing {
  border-color: rgba(124, 226, 255, 0.78);
  background: rgba(18, 58, 82, 0.86);
  color: #b4f0ff;
  box-shadow: 0 0 12px rgba(124, 226, 255, 0.28);
}
.voice-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}
.voice-bars i {
  display: block;
  width: 2px;
  height: 5px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.72;
}
.voice-bars i:nth-child(2) { height: 9px; }
.voice-bars i:nth-child(3) { height: 6px; }
.voice-btn.playing .voice-bars i {
  opacity: 1;
  animation: voice-eq 0.78s ease-in-out infinite alternate;
}
.voice-btn.playing .voice-bars i:nth-child(2) { animation-delay: 0.18s; }
.voice-btn.playing .voice-bars i:nth-child(3) { animation-delay: 0.36s; }
@keyframes voice-eq {
  0% { transform: scaleY(0.35); }
  100% { transform: scaleY(1.18); }
}
.cast-voice-btn {
  margin-left: 8px;
  vertical-align: middle;
}
.talk-meta { gap: 9px; font-size: 0.76rem; color: var(--text-sub); letter-spacing: 0.08em; flex-shrink: 0; }

.dialogue p {
  font: 400 var(--size, 1.2rem)/1.85 var(--serif);
  letter-spacing: 0.03em;
  min-height: 3.7em;
  margin: 8px 0 9px;
  max-height: 32vh;
  overflow-y: auto;
  white-space: pre-line;
  user-select: text;
}
.tools { border-top: 1px solid rgba(236, 208, 152, 0.16); padding-top: 7px; }
.tool-group { gap: 4px; flex-wrap: wrap; }
.tool-group button, .forward {
  border: 0; background: none; color: rgba(226, 232, 230, 0.8);
  padding: 5px 9px; font-size: 0.84rem; border-radius: 4px;
  white-space: nowrap;
}
.tool-group button:hover, .tool-group button[aria-pressed="true"], .forward:hover {
  background: rgba(236, 208, 152, 0.14);
  color: var(--gold-bright);
}
.forward { color: var(--gold-bright); font-weight: 700; white-space: nowrap; letter-spacing: 0.08em; flex-shrink: 0; }
.forward .caret { display: inline-block; animation: pulse-caret 1.3s ease-in-out infinite; }

/* ==================== 结局结算界面 ==================== */
.ending { display: grid; place-items: center; }
.end-bg { z-index: -1; background: linear-gradient(100deg, rgba(5, 14, 24, 0.82), rgba(10, 22, 34, 0.78)), url(./art/bg-dusk.webp?v=5) center / cover no-repeat; }
.end-paper {
  width: min(670px, calc(100% - 32px));
  max-height: 92dvh;
  overflow-y: auto;
  background: linear-gradient(145deg, rgba(8, 21, 33, 0.94), rgba(12, 29, 44, 0.92));
  backdrop-filter: blur(18px);
  border: 1px solid rgba(236, 208, 152, 0.42);
  border-top: 2px solid var(--gold);
  padding: clamp(24px, 3.8vw, 44px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
  border-radius: 4px 16px 4px 16px;
}
.end-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.end-brand { font-size: 0.74rem; letter-spacing: 0.24em; color: var(--text-sub); }
.end-type-tag {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em;
  padding: 2px 10px; border-radius: 3px;
  border: 1px solid var(--rift-cyan); color: var(--rift-cyan);
}
.end-route { margin: 22px 0 8px; font-size: 0.84rem; letter-spacing: 0.18em; color: var(--gold); }
.end-paper h2 { font: 600 clamp(1.85rem, 3.2vw, 2.55rem)/1.28 var(--serif); text-wrap: balance; margin: 0 0 16px; color: #fff6e4; }
.end-summary {
  font: 400 1.03rem/1.88 var(--serif);
  color: rgba(236, 240, 242, 0.9);
  margin: 0 0 16px;
  padding-left: 16px;
  border-left: 2px solid var(--gold);
}
.end-badge-tip {
  background: rgba(124, 226, 255, 0.12);
  border: 1px solid rgba(124, 226, 255, 0.35);
  color: #bdeeff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  margin: 0 0 14px;
}
.end-count { color: var(--text-sub); font-size: 0.88rem; margin: 0 0 20px; }

/* ==================== 黑曜石玻璃拟态弹窗体系 ==================== */
dialog {
  width: min(980px, calc(100% - 26px));
  max-height: 89dvh;
  border: 1px solid rgba(236, 208, 152, 0.36);
  border-top: 2px solid var(--gold);
  border-radius: 4px 14px 4px 14px;
  background: linear-gradient(150deg, rgba(8, 20, 31, 0.96), rgba(11, 26, 40, 0.95));
  backdrop-filter: blur(18px);
  color: var(--text-main);
  padding: 0;
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.82);
}
dialog::backdrop { background: rgba(3, 9, 16, 0.78); backdrop-filter: blur(6px); }
.panel-inner { padding: clamp(18px, 2.6vw, 30px); }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid rgba(236, 208, 152, 0.22);
}
.panel-head h2 { margin: 0; font: 700 1.44rem var(--serif); letter-spacing: 0.06em; color: var(--gold-bright); }
#panelBody p { color: var(--text-sub); }

.menu-grid, .slot-list, .logs { display: grid; gap: 9px; }
.menu-grid { grid-template-columns: repeat(2, 1fr); }
.menu-grid button, .slot {
  border: 1px solid rgba(236, 208, 152, 0.24);
  background: rgba(15, 34, 50, 0.65);
  border-radius: 6px;
  padding: 12px 15px;
  text-align: left;
  color: var(--text-main);
}
.menu-grid button:hover, .slot:not(:disabled):hover {
  background: rgba(24, 54, 76, 0.82);
  border-color: var(--gold);
  color: var(--gold-bright);
}
.slot b, .slot span { display: block; }
.slot span, .help { font-size: 0.85rem; color: var(--text-sub); margin-top: 3px; }

.tabs { display: flex; gap: 7px; margin: 0 0 16px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid rgba(236, 208, 152, 0.28);
  color: var(--text-sub);
  background: rgba(10, 24, 38, 0.6);
  border-radius: 99px;
  padding: 5px 15px;
  font-size: 0.88rem;
}
.tabs button[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(236, 208, 152, 0.24), rgba(124, 226, 255, 0.2));
  color: var(--gold-bright);
  border-color: var(--gold);
}

/* 人物档案 */
.profile { display: grid; grid-template-columns: minmax(160px, 0.8fr) 1.25fr; gap: 22px; align-items: start; }
.portrait {
  height: 290px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(46, 88, 114, 0.5), rgba(7, 17, 27, 0.9));
  border: 1px solid rgba(236, 208, 152, 0.25);
  border-radius: 8px;
}
.portrait img { width: 100%; height: 118%; object-fit: contain; object-position: center top; }
.profile h3, .gallery-title { font: 700 1.35rem var(--serif); margin: 4px 0 6px; color: var(--gold-bright); }
.profile .bio-tag {
  display: inline-block; font-size: 0.78rem; padding: 3px 10px; border-radius: 4px;
  background: rgba(124, 226, 255, 0.14); border: 1px solid rgba(124, 226, 255, 0.35);
  color: #a6ecff; margin-bottom: 10px;
}
.secret-box {
  margin-top: 12px; padding: 11px 14px; border-radius: 6px;
  background: rgba(236, 208, 152, 0.08);
  border-left: 3px solid var(--gold);
  font-size: 0.88rem; color: #e8e0cf;
}

/* 手账纪事卡片 */
.clue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; max-height: 56vh; overflow-y: auto; padding-right: 4px; }
.clue-card {
  background: rgba(14, 32, 48, 0.72);
  border: 1px solid rgba(236, 208, 152, 0.22);
  border-left: 3px solid var(--rift-cyan);
  border-radius: 6px;
  padding: 12px 14px;
}
.clue-card.locked { opacity: 0.5; border-left-color: #4f6470; background: rgba(9, 20, 30, 0.5); }
.clue-meta { display: flex; justify-content: space-between; font-size: 0.73rem; color: var(--rift-cyan); margin-bottom: 5px; letter-spacing: 0.08em; }
.clue-card h4 { margin: 0 0 6px; font: 700 0.98rem var(--serif); color: var(--gold-bright); }
.clue-card p { margin: 0; font-size: 0.84rem; line-height: 1.65; color: #c7d7df !important; }

/* CG 鉴赏与频谱可视化音乐盒 */
.cg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; max-height: 56vh; overflow-y: auto; }
.cg-tile {
  border: 1px solid rgba(236, 208, 152, 0.28); border-radius: 7px; overflow: hidden;
  background: #0a1824; padding: 0; text-align: left; color: var(--text-main);
}
.cg-tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; transition: transform 0.35s ease; }
.cg-tile:not(:disabled):hover img { transform: scale(1.05); }
.cg-tile span { display: block; padding: 8px 11px; font: 500 0.86rem var(--serif); }
.cg-tile.locked { background: rgba(12, 25, 36, 0.65); color: rgba(169, 193, 204, 0.5); }
.cg-tile .cg-placeholder { aspect-ratio: 16 / 9; display: grid; place-items: center; font-size: 0.8rem; letter-spacing: 0.22em; }

.spec-wrap {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 7px;
  background: rgba(5, 13, 22, 0.82);
  border: 1px solid rgba(124, 226, 255, 0.28);
}
.spec-wrap canvas { width: 100%; height: 62px; display: block; }
.sound-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 9px; max-height: 44vh; overflow-y: auto; }
.sound-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 6px;
  border: 1px solid rgba(236, 208, 152, 0.24);
  background: rgba(14, 31, 46, 0.72);
  color: var(--text-main);
}
.sound-row.active {
  background: linear-gradient(135deg, rgba(24, 72, 98, 0.9), rgba(92, 68, 34, 0.85));
  color: var(--gold-bright);
  border-color: var(--rift-cyan);
}

/* ==================== 柚子社（Yuzusoft）级树状分支流程图 ==================== */
.flow-quickbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 7px;
  background: linear-gradient(120deg, rgba(16, 36, 54, 0.82), rgba(14, 28, 42, 0.76));
  border: 1px solid rgba(236, 208, 152, 0.28);
}
.flow-quick-meta {
  font-size: 0.84rem;
  color: var(--text-sub);
}
.flow-quick-meta b { color: var(--gold-bright); font-family: var(--serif); }
.flow-quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.flow-quick-btn {
  padding: 6px 13px;
  border-radius: 5px;
  border: 1px solid rgba(255, 232, 184, 0.65);
  background: linear-gradient(135deg, rgba(236, 208, 152, 0.24), rgba(124, 226, 255, 0.16));
  color: #fff6df;
  font: 600 0.82rem var(--serif);
  letter-spacing: 0.04em;
}
.flow-quick-btn:hover { background: linear-gradient(135deg, #f3d79e, #d9b46e); color: #0e1e28; }
.flow-quick-btn.rift {
  border-color: rgba(124, 226, 255, 0.78);
  background: linear-gradient(135deg, rgba(20, 74, 108, 0.88), rgba(128, 82, 36, 0.86));
}

.flow-tree {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 58vh;
  overflow-y: auto;
  padding: 2px 4px 8px 0;
}

/* 共同篇主干 */
.flow-trunk, .flow-finale, .flow-columns, .flow-rail { flex-shrink: 0; }
.flow-trunk, .flow-finale {
  position: relative;
  background: rgba(11, 27, 41, 0.78);
  border: 1px solid rgba(236, 208, 152, 0.26);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 13px 15px;
}
.flow-finale {
  border-color: rgba(124, 226, 255, 0.48);
  border-left-color: var(--rift-cyan);
  background: linear-gradient(135deg, rgba(14, 35, 52, 0.9), rgba(20, 32, 46, 0.88));
}
.flow-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.flow-section-head h3 {
  margin: 0;
  font: 700 0.98rem var(--serif);
  color: var(--gold-bright);
  letter-spacing: 0.04em;
}
.flow-section-badge {
  font-size: 0.75rem;
  color: var(--rift-cyan);
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid rgba(124, 226, 255, 0.35);
  background: rgba(124, 226, 255, 0.08);
}

.flow-horizontal {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
}
.flow-connector-arrow {
  align-self: center;
  color: rgba(236, 208, 152, 0.45);
  font-size: 0.78rem;
}

/* 三向分叉 / 汇流铁轨连线 */
.flow-rail {
  position: relative;
  height: 28px;
  margin: 0 14%;
}
.flow-rail::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  height: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--gold), var(--rift-cyan));
}
.flow-rail::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 50%;
  border-top: 2px solid rgba(236, 208, 152, 0.42);
  border-left: 2px solid rgba(114, 184, 240, 0.55);
  border-right: 2px solid rgba(240, 170, 101, 0.55);
  border-radius: 6px 6px 0 0;
}
.flow-rail.merge::before {
  top: 50%;
  height: 50%;
  background: linear-gradient(180deg, rgba(134, 200, 138, 0.6), var(--rift-cyan));
}
.flow-rail.merge::after {
  top: 0;
  height: 50%;
  border-top: 0;
  border-bottom: 2px solid rgba(124, 226, 255, 0.45);
  border-radius: 0 0 6px 6px;
}
.flow-rail-mid {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(134, 200, 138, 0.55);
}
.flow-rail.merge .flow-rail-mid {
  top: 0;
  height: 50%;
}

/* 三列并行个人线 */
.flow-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.flow-branch {
  background: rgba(10, 24, 37, 0.78);
  border: 1px solid rgba(236, 208, 152, 0.2);
  border-top: 3px solid var(--branch-accent, var(--gold));
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.flow-branch-title {
  margin: 0 0 4px;
  font: 700 0.94rem var(--serif);
  color: var(--branch-accent, var(--gold-bright));
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flow-branch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  padding-left: 12px;
}
.flow-branch-list::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--branch-accent, var(--gold)), rgba(255, 255, 255, 0.1));
  opacity: 0.48;
}

/* 单个节点卡片（本体跳幕首 + 可选「⚑ 直达选项」快捷按钮） */
.flow-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 5px;
}
.flow-branch-list .flow-card::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  width: 9px;
  height: 2px;
  background: var(--branch-accent, var(--gold));
  opacity: 0.45;
}
.flow-node {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid rgba(236, 208, 152, 0.28);
  background: rgba(17, 39, 57, 0.84);
  color: var(--text-main);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.82rem;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.flow-node:not(:disabled):hover {
  background: rgba(31, 68, 95, 0.94);
  border-color: var(--rift-cyan);
}
.flow-node.is-fork-hub {
  border-color: rgba(255, 224, 150, 0.72);
  background: linear-gradient(135deg, rgba(46, 54, 42, 0.92), rgba(22, 54, 76, 0.92));
  box-shadow: 0 0 14px rgba(236, 208, 152, 0.22);
}
.flow-node.current {
  background: var(--gold);
  color: #0c1c26;
  border-color: var(--gold-bright);
  font-weight: 700;
}
.flow-node.locked {
  background: rgba(9, 20, 30, 0.55);
  color: rgba(169, 193, 204, 0.45);
  border-style: dashed;
}
.flow-node.is-end-he:not(.locked) { border-color: rgba(247, 214, 138, 0.7); }
.flow-node.is-end-true:not(.locked) { border-color: rgba(124, 226, 255, 0.85); }
.flow-end-pip {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(236, 208, 152, 0.18);
  color: var(--gold-bright);
  flex-shrink: 0;
}
.flow-node.current .flow-end-pip { background: rgba(12, 28, 38, 0.2); color: #0c1c26; }

.flow-choice-btn {
  flex-shrink: 0;
  border: 1px solid rgba(124, 226, 255, 0.58);
  background: rgba(18, 56, 78, 0.88);
  color: #b4f0ff;
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.flow-choice-btn:hover {
  background: var(--rift-cyan);
  color: #061824;
  border-color: #d6f7ff;
}

.end-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.end-list li { background: rgba(13, 28, 42, 0.7); padding: 9px 12px; border-left: 3px solid #4e6672; border-radius: 4px; font-size: 0.85rem; color: var(--text-sub); }
.end-list li.got { background: rgba(20, 52, 68, 0.82); border-left-color: var(--gold); color: #fff6e4; }

/* 对白回看 + 行内「跳回此句」微按钮 */
.logs { max-height: 56vh; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.log-line { border-bottom: 1px solid rgba(236, 208, 152, 0.14); padding: 8px 2px 10px; }
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.log-line b { color: var(--gold); font-family: var(--serif); }
.log-line p { margin: 4px 0 0; color: var(--text-main) !important; font-size: 0.94rem; }
.log-jump {
  border: 1px solid rgba(236, 208, 152, 0.34);
  background: rgba(16, 38, 54, 0.72);
  color: var(--gold-bright);
  border-radius: 4px;
  padding: 2px 9px;
  font-size: 0.75rem;
  white-space: nowrap;
}
.log-jump:hover { background: var(--gold); color: #0e1f2a; border-color: var(--gold-bright); }
.log-current-tag { font-size: 0.73rem; color: var(--rift-cyan); letter-spacing: 0.08em; }

.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 10px 0; padding-bottom: 10px; border-bottom: 1px solid rgba(236, 208, 152, 0.15);
}
.setting select { background: #0c1f2e; color: var(--text-main); border: 1px solid rgba(236, 208, 152, 0.35); border-radius: 5px; padding: 5px 9px; }
.volume-control { display: flex; align-items: center; gap: 10px; }
.volume-control input { width: clamp(90px, 20vw, 180px); accent-color: var(--gold); }
.volume-control output { width: 3.1em; font-variant-numeric: tabular-nums; text-align: right; color: var(--gold); }
.music-credit { margin: 0 0 14px; font: 600 0.98rem var(--serif); color: var(--rift-cyan); }

.cg-lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(3, 8, 14, 0.95);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
.cg-lightbox img { max-width: 96vw; max-height: 82vh; border-radius: 6px; box-shadow: 0 20px 70px rgba(0, 0, 0, 0.85); }
.lightbox-bar { margin-top: 14px; display: flex; align-items: center; gap: 16px; color: var(--gold-bright); font-family: var(--serif); }

.mini-toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 70;
  padding: 7px 18px; border-radius: 99px;
  background: rgba(9, 24, 38, 0.94); border: 1px solid rgba(236, 208, 152, 0.55);
  color: var(--gold-bright); font-size: 0.86rem; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}
.sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.noscript { z-index: 4; position: fixed; bottom: 0; background: white; color: black; padding: 8px; }

/* ==================== 动画关键帧 ==================== */
@keyframes home-pan { from { transform: scale(1.01); } to { transform: scale(1.06) translateX(-1%); } }
@keyframes scene-in { from { transform: scale(1.045); } to { transform: scale(1.015); } }
@keyframes cg-in { from { transform: scale(1.045); opacity: 0.72; } to { transform: scale(1.015); opacity: 1; } }
@keyframes reel-rotate { to { transform: rotate(360deg); } }
@keyframes sheen { 0%, 72% { transform: translateX(-130%); } 100% { transform: translateX(130%); } }
@keyframes live-breath { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-3px) scaleY(1.006); } }
@keyframes actor-enter { from { opacity: 0; transform: translateX(calc(-50% + 18px)); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes actor-shake {
  0%, 100% { transform: translateX(-50%); }
  22% { transform: translateX(calc(-50% - 10px)); }
  45% { transform: translateX(calc(-50% + 10px)); }
  70% { transform: translateX(calc(-50% - 5px)); }
}
@keyframes actor-hop { 0%, 100% { transform: translateX(-50%) translateY(0); } 40% { transform: translateX(-50%) translateY(-16px); } }
@keyframes cam-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 4px); }
  40% { transform: translate(7px, -4px); }
  65% { transform: translate(-4px, 3px); }
}
@keyframes cam-shake-hard {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-15px, 8px); }
  30% { transform: translate(15px, -9px); }
  48% { transform: translate(-11px, -6px); }
  68% { transform: translate(8px, 6px); }
}
@keyframes fx-flash { 0% { opacity: 0.92; } 100% { opacity: 0; } }
@keyframes fx-blackout { 0% { opacity: 1; } 55% { opacity: 0.96; } 100% { opacity: 0; } }
@keyframes fx-glitch {
  0% { opacity: 0.95; transform: translateX(-6px) skewX(-2deg); }
  25% { opacity: 0.78; transform: translateX(8px) skewX(3deg); }
  50% { opacity: 0.92; transform: translateX(-5px); }
  75% { opacity: 0.5; transform: translateX(4px) skewX(-1deg); }
  100% { opacity: 0; transform: none; }
}
@keyframes card-fade { 0% { opacity: 0; } 14% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes pulse-caret { 0%, 100% { opacity: 1; transform: translateX(0); } 50% { opacity: 0.42; transform: translateX(3px); } }

/* ==================== 矮屏与平板专项适配 ==================== */
@media (max-height: 760px) {
  .stage.cinema-bars .cinema-bar { height: clamp(10px, 2.2vh, 20px); }
  .stage.cinema-bars .stagehead { transform: translateY(6px); }
  .stage.cinema-bars .textArea { bottom: max(2.4vh, 14px); }
}

@media (max-width: 820px) {
  .flow-columns { grid-template-columns: 1fr; }
  .flow-rail { display: none; }
  .flow-tree { gap: 11px; }
  .flow-horizontal { flex-direction: column; gap: 6px; }
  .flow-connector-arrow { display: none; }
}

/* ==================== 移动端响应式专项优化 ==================== */
@media (max-width: 740px) {
  .home-image { background-position: 66% center; }
  .home-veil { background: linear-gradient(0deg, rgba(4, 11, 20, 0.96) 5%, rgba(6, 16, 28, 0.84) 40%, rgba(7, 19, 32, 0.28) 70%, rgba(5, 13, 24, 0.72) 100%); }
  .homebar { padding: 14px 16px; flex-wrap: nowrap; }
  .brand-text strong { font-size: 0.66rem; letter-spacing: 0.14em; }
  .brand-text span { font-size: 0.72rem; }
  .glass-pill { font-size: 0.76rem; padding: 6px 9px; white-space: nowrap; }
  .homecopy { width: calc(100% - 36px); margin: clamp(110px, 22svh, 240px) 18px 0; padding: 0 0 12px; }
  .home h1 { font-size: clamp(2.8rem, 11vw, 4.4rem); }
  .title-main { display: inline; }
  .blurb { font-size: 0.94rem; margin: 14px 0 18px; }
  .blurb br { display: none; }
  .badge-strip { width: 100%; border-radius: 10px; }
  .homefoot { padding: 14px 18px; flex-wrap: wrap; font-size: 0.72rem; }
  .stagehead { padding: max(10px, env(safe-area-inset-top)) 12px; }
  .stage.cinema-bars .cinema-bar { height: 12px; }
  .stage.cinema-bars .stagehead { transform: translateY(6px); }
  .stage.cinema-bars .textArea { bottom: max(14px, env(safe-area-inset-bottom)); }
  .location { max-width: 55%; padding: 5px 10px; }
  .location b { font-size: 0.92rem; }
  .stage-actions { gap: 5px; }
  .clue-toast { top: max(112px, calc(env(safe-area-inset-top) + 102px)); right: 12px; padding: 8px 13px; }
  .textArea { width: calc(100% - 14px); bottom: max(10px, env(safe-area-inset-bottom)); }
  .dialogue { padding: 11px 13px 8px; }
  .talk-meta { display: none; }
  .dialogue p { font-size: calc(var(--size, 1.18rem) * 0.9); min-height: 4.1em; line-height: 1.66; max-height: 27dvh; }
  /* 移动端工具栏单行可横滑，防止折成多行挤占立绘空间 */
  .tools { gap: 6px; padding-top: 6px; }
  .tool-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
  }
  .tool-group::-webkit-scrollbar { display: none; }
  .tool-group button, .forward { padding: 4px 7px; font-size: 0.78rem; }
  .actor-slot { height: 76%; bottom: 13%; width: 74vw; }
  .actor-slot[data-pos="left"] { left: 24%; }
  .actor-slot[data-pos="right"] { left: 76%; }
  .cast-layer.trio .actor-slot { height: 68%; width: 54vw; bottom: 16%; }
  .cast-layer.trio .actor-slot[data-pos="left"] { left: 18%; }
  .cast-layer.trio .actor-slot[data-pos="right"] { left: 82%; }
  .profile { grid-template-columns: 1fr; }
  .portrait { height: 220px; }
  .end-list, .menu-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; }
