/* 痴迷 · 平安夜的最后一桌 — 暖桌灯 / 冷蓝九点窗外 / 深阴影 */
:root {
  --ink: #eee3d2;
  --ink-dim: #c8b9a6;
  --ink-faint: #8f8172;
  --bg: #0b0806;
  --bg-2: #120d0a;
  --amber: #e5b077;
  --amber-strong: #ffd9a3;
  --amber-dim: #a97c4f;
  --line: #3a2e24;
  --rose: #dd9898;
  --cold: #8ba6c4;
  --panel: #1b1410;
  --panel-edge: #6d4c31;
  --risk: #d08268;
  --ok: #a9d3b4;
  --bad: #e2a08b;
  --serif: 'Songti SC', 'Noto Serif SC', 'STSong', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(120, 74, 38, 0.16), transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.7 var(--sans);
  min-height: 100svh;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
kbd {
  font: 11px/1 var(--sans); color: var(--ink-faint);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  padding: 2px 5px; letter-spacing: .04em;
}
:focus-visible { outline: 2px solid var(--amber-strong); outline-offset: 3px; border-radius: 3px; }

/* ── 顶栏 ─────────────────────────────── */
.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 10px clamp(14px, 4vw, 44px);
  background: linear-gradient(rgba(11, 8, 6, .94), rgba(11, 8, 6, .78));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(90, 68, 45, .35);
}
.brand { display: flex; align-items: center; gap: 11px; }
.seal {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--amber-dim); border-radius: 5px;
  color: var(--amber-strong); font: 20px/1 var(--serif);
  background: rgba(120, 70, 30, .18);
  box-shadow: inset 0 0 12px rgba(230, 170, 100, .12);
}
.names { display: flex; align-items: baseline; gap: 10px; }
.names b { font: 22px/1 var(--serif); color: var(--amber-strong); letter-spacing: .08em; }
.names span { font-size: 12.5px; color: var(--ink-faint); letter-spacing: .18em; }
.where { margin-left: auto; font-size: 12px; color: var(--ink-faint); letter-spacing: .22em; white-space: nowrap; }
.switches {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto; flex-shrink: 0;
}
.where + .switches { margin-left: 18px; }
.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--ink-dim);
  transition: border-color .2s, color .2s, background .2s;
}
.ghost:hover { border-color: var(--amber-dim); color: var(--amber-strong); background: rgba(120, 70, 30, .12); }
.ghost:disabled { opacity: .35; cursor: default; }
.ghost:disabled:hover { border-color: var(--line); color: var(--ink-dim); background: transparent; }
#musicBtn[data-on="1"] { border-color: var(--amber-dim); color: var(--amber-strong); }

/* ── 舞台 ─────────────────────────────── */
main { max-width: 1480px; margin: 0 auto; }
.stage {
  position: relative; overflow: hidden;
  height: clamp(300px, 56vh, 660px);
  background: #060404;
  cursor: pointer;
}
.stage img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: center 44%;
  animation: settle .8s ease both;
}
@keyframes settle { from { opacity: 0; } to { opacity: 1; } }
.stage .shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 3, 2, .28), transparent 28%),
    linear-gradient(0deg, var(--bg) 1%, transparent 26%);
}
.stage[data-frame="1"] img { object-fit: contain; }
.stage[data-frame="1"] .shade { background: none; }
.plaque {
  position: absolute; top: 14px; left: clamp(14px, 4vw, 44px); right: clamp(14px, 4vw, 44px);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  pointer-events: none;
}
#chapterTag {
  font-size: 12px; letter-spacing: .24em; color: rgba(238, 227, 210, .82);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
  padding: 4px 10px; border-radius: 3px;
  background: rgba(10, 7, 5, .38);
}
.framemark {
  position: absolute; right: clamp(14px, 4vw, 44px); bottom: 56px;
  font-size: 11.5px; letter-spacing: .3em; color: var(--ink-dim);
  border-left: 1px solid var(--amber-dim); padding: 2px 0 2px 10px;
  pointer-events: none;
}
.titlecard {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 10px;
  text-align: center; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 3, 2, .1), rgba(5, 3, 2, .55));
}
.titlecard small { font-size: 12px; letter-spacing: .5em; color: var(--amber); text-indent: .5em; }
.titlecard h1 {
  margin: 0; font: 400 clamp(34px, 6vw, 66px)/1.15 var(--serif);
  color: #f7ead4; letter-spacing: .06em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .85), 0 0 60px rgba(190, 120, 50, .25);
}

/* ── 文本区 ───────────────────────────── */
.sheet {
  position: relative; z-index: 2;
  width: min(1020px, 92%); margin: -56px auto 0;
  padding-bottom: 30px;
}
.objective {
  width: fit-content; max-width: 100%;
  background: rgba(19, 13, 9, .92);
  border: 1px solid rgba(120, 84, 52, .5); border-left: 3px solid var(--amber-dim);
  border-radius: 3px; padding: 7px 14px;
  font-size: 13.5px; letter-spacing: .06em; color: #ecd3ad;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
.objective[data-big="1"] {
  margin-top: 16px; font-size: clamp(15px, 1.8vw, 18px);
  padding: 12px 18px; color: #ffe4b8;
}
.scene-line { display: flex; align-items: center; gap: 14px; margin: 16px 0 4px; }
.scene-title { font-size: 12px; letter-spacing: .24em; color: var(--ink-faint); }
.ticks { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ticks i {
  width: 14px; height: 2px; background: #33281f; border-radius: 1px;
  transition: background .3s;
}
.ticks i.past { background: #7c624a; }
.ticks i.now { background: var(--amber); box-shadow: 0 0 8px rgba(229, 176, 119, .55); }

.narr {
  margin: 10px 0 6px; max-width: 44em;
  font-size: 16.5px; color: var(--ink-dim); line-height: 1.9;
  white-space: pre-line;
  animation: rise .45s ease both;
}
.narr:empty { display: none; }
.narr[data-memory="1"] { color: #b3a08c; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.dialogue { margin: 14px 0 4px; animation: rise .45s ease both; }
.who {
  display: inline-block; font-size: 13px; letter-spacing: .28em; margin-bottom: 6px;
}
.who[data-who="贝尔"] { color: var(--amber); }
.who[data-who="贝尔"]::after { content: " · 你"; letter-spacing: .1em; color: var(--ink-faint); }
.who[data-who="妮基"] { color: var(--rose); }
.who[data-who="服务员"] { color: var(--cold); }
.dialogue blockquote {
  margin: 0; padding: 0 0 0 16px;
  border-left: 2px solid rgba(150, 106, 66, .55);
  font: 400 clamp(21px, 2.4vw, 31px)/1.55 var(--serif);
  color: #f4e8d5; letter-spacing: .02em;
  text-shadow: 0 1px 14px rgba(0, 0, 0, .4);
}

.advance-row { min-height: 44px; display: flex; align-items: center; }
.advance {
  background: transparent; border: 0; padding: 8px 2px;
  color: var(--amber-strong); font-size: 14.5px; letter-spacing: .18em;
  display: inline-flex; align-items: center; gap: 10px;
}
.advance::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 10px rgba(229, 176, 119, .8);
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .25; } }
.advance kbd { opacity: .8; }
.advance:hover { color: #ffe9c9; }

/* ── 选项 ─────────────────────────────── */
.choice { margin-top: 6px; animation: rise .45s ease both; }
.choice-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.choice-kind {
  font-size: 12px; letter-spacing: .26em; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 3px; padding: 2px 9px;
}
.choice h2 {
  margin: 4px 0; font: 500 clamp(18px, 2vw, 23px)/1.4 var(--serif); color: #f2e3cc;
}
.choice-hint { margin: 2px 0 12px; font-size: 13px; color: var(--ink-faint); }
.options { display: grid; gap: 10px; }

/* 普通回应 */
.choice[data-kind="reply"] .choice-kind { color: var(--cold); border-color: rgba(139, 166, 196, .35); }
.choice[data-kind="reply"] .options { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.choice[data-kind="reply"] .options button {
  background: transparent; border: 0; border-bottom: 1px solid #57483a; border-radius: 0;
  padding: 10px 4px; text-align: left; font-size: 16.5px; color: var(--ink-dim);
  transition: color .18s, border-color .18s;
}
.choice[data-kind="reply"] .options button:hover {
  color: #ffe4bf; border-color: var(--amber);
}

/* 剧情分歧 */
.choice[data-kind="branch"],
.choice[data-kind="timed"] {
  background: linear-gradient(170deg, #201711, #17100c);
  border: 1px solid var(--panel-edge); border-left: 4px solid var(--amber);
  border-radius: 5px; padding: 14px clamp(14px, 3vw, 24px) 18px;
  box-shadow: 0 10px 38px rgba(0, 0, 0, .5);
}
.choice[data-kind="branch"] .choice-kind,
.choice[data-kind="timed"] .choice-kind {
  color: var(--amber-strong); border-color: var(--amber-dim);
  font-weight: 600;
}
.choice[data-kind="branch"] .choice-kind::before { content: "⑂ "; }
.choice[data-kind="branch"] .options { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.choice[data-kind="branch"] .options button {
  background: #2c2018; border: 1px solid #7d5836; border-radius: 4px;
  padding: 13px 16px; text-align: left; font-size: 16px; line-height: 1.5;
  transition: background .18s, border-color .18s, transform .18s;
}
.choice[data-kind="branch"] .options button:hover {
  background: #432f20; border-color: var(--amber); transform: translateY(-1px);
}
.choice[data-risk="1"] { border-left-color: var(--risk); }
.choice[data-risk="1"] .choice-kind { color: var(--risk); border-color: rgba(208, 130, 104, .45); }

/* 限时分歧 */
.choice[data-kind="timed"] { border-left-color: #d1694f; }
.choice[data-kind="timed"] .choice-kind { color: #ffb196; border-color: rgba(209, 105, 79, .5); }
.choice[data-kind="timed"] .choice-kind::before { content: "⏱ "; }
.choice[data-kind="timed"] .options { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.choice[data-kind="timed"] .options button {
  background: #33201a; border: 1px solid #8d4f3c; border-radius: 4px;
  padding: 13px 16px; text-align: left; font-size: 16px;
  transition: background .18s, border-color .18s;
}
.choice[data-kind="timed"] .options button:hover { background: #4a2c22; border-color: #e58a6b; }
.timer { display: flex; align-items: baseline; gap: 6px; margin: 2px 0 12px; }
.timer b {
  font: 700 30px/1 var(--serif); color: #ffb499; min-width: 1.4em;
  font-variant-numeric: tabular-nums;
}
.timer .unit { font-size: 12px; color: var(--ink-faint); letter-spacing: .2em; }
.timerbar { flex: 1; height: 3px; background: #38251d; border-radius: 2px; overflow: hidden; margin-left: 10px; align-self: center; }
.timerbar i { width: 100%; height: 100%; background: linear-gradient(90deg, #d1694f, #e5b077); transform-origin: left; display: block; }
.timer[data-urgent="1"] b { animation: urgent .5s ease-in-out infinite; }
@keyframes urgent { 50% { opacity: .45; } }

/* ── 结局卡 ───────────────────────────── */
.endcard { margin-top: 18px; border-top: 1px solid #453629; padding-top: 18px; animation: rise .5s ease both; }
.verdict {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .22em;
  padding: 4px 13px; border: 1px solid currentColor; border-radius: 3px;
}
.verdict[data-ok="1"] { color: var(--ok); background: rgba(45, 80, 60, .18); }
.verdict[data-ok="0"] { color: var(--bad); background: rgba(90, 44, 38, .2); }
.endcard h2 { margin: 14px 0 6px; font: 400 clamp(28px, 3.4vw, 42px)/1.2 var(--serif); color: #f6e9d3; }
.end-reason { color: var(--ink-dim); max-width: 42em; margin: 4px 0 16px; }
.recap h3 { font-size: 13px; letter-spacing: .22em; color: var(--ink-faint); font-weight: 500; margin: 16px 0 6px; }
.recap ol { margin: 0; padding-left: 1.4em; color: var(--ink-dim); }
.recap li { margin: 7px 0; }
.recap li button {
  margin-left: 8px; background: transparent; border: 0; padding: 2px 4px;
  color: var(--amber-strong); font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(229, 176, 119, .5);
}
.recap li button:hover { text-decoration-color: var(--amber-strong); }
.end-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.end-actions button { border-radius: 4px; padding: 10px 20px; font-size: 14.5px; }
#retryLast { background: #33241a; border: 1px solid var(--amber-dim); color: var(--amber-strong); }
#retryLast:hover { background: #463222; border-color: var(--amber); }

/* ── 底栏 ─────────────────────────────── */
.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  max-width: 1480px; margin: 0 auto;
  padding: 14px clamp(14px, 4vw, 44px) calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(90, 68, 45, .3);
  color: var(--ink-faint); font-size: 12px; letter-spacing: .1em;
}
.keys kbd { margin: 0 2px; }
.foot-actions { display: flex; gap: 10px; }

/* ── 移动端 ───────────────────────────── */
@media (max-width: 760px) {
  .where { display: none; }
  .names span { display: none; }
  .bar { gap: 10px; }
  .switches { margin-left: auto; }
  .stage { height: 36svh; min-height: 210px; }
  .sheet { width: 94%; margin-top: -26px; padding-bottom: 20px; }
  .narr { font-size: 15.5px; line-height: 1.85; }
  .dialogue blockquote { font-size: 21px; }
  .choice[data-kind="branch"] .options,
  .choice[data-kind="timed"] .options { grid-template-columns: 1fr; }
  .foot { flex-direction: column; align-items: flex-start; gap: 8px; }
  .foot-actions { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* 满幅播放。画面延伸到视口边缘，控制层叠在画面之上。 */
:root {
  --top-control: 66px;
  --gutter: clamp(16px, 4vw, 64px);
  --control-bottom: max(16px, env(safe-area-inset-bottom));
}
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body { background: var(--bg); }
main { max-width: none; margin: 0; }
.bar {
  position: fixed;
  inset: 0 0 auto;
  align-content: center;
  min-height: var(--top-control);
  padding: max(9px, env(safe-area-inset-top)) var(--gutter) 9px;
  background: linear-gradient(180deg, rgb(8 6 5 / .87), rgb(8 6 5 / .46) 66%, transparent);
  backdrop-filter: none;
  border-bottom: 0;
  flex-wrap: nowrap;
  pointer-events: none;
}
.bar .switches { pointer-events: auto; margin-left: auto; gap: 6px; }
.bar .ghost { background: rgb(14 10 8 / .76); min-height: 40px; white-space: nowrap; }
.bar .ghost:hover { background: rgb(37 25 17 / .94); }
.bar .names span, .bar .where { color: var(--ink-dim); }
.bar .where { margin-left: auto; }
.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  isolation: isolate;
}
.stage img { object-fit: cover; object-position: 50% 48%; }
.stage .shade {
  background: linear-gradient(180deg, rgb(5 3 2 / .4), transparent 24%, transparent 70%, rgb(5 3 2 / .62));
}
.stage[data-frame="1"]::before {
  content: "";
  position: absolute;
  inset: -24px;
  z-index: -1;
  background: var(--frame-image) center / cover no-repeat;
  filter: blur(24px) brightness(.46);
}
.stage[data-frame="1"] img { object-position: center 43%; }
.stage[data-frame="1"] .shade { background: linear-gradient(0deg, rgb(5 3 2 / .55), transparent 20%); }
.plaque {
  top: calc(var(--top-control) + max(5px, env(safe-area-inset-top)));
  left: var(--gutter);
  right: var(--gutter);
}
.titlecard {
  top: var(--top-control);
  bottom: 35%;
  background: none;
  padding: 0 var(--gutter);
}
.titlecard h1 { font-size: clamp(36px, 6vw, 84px); }
.framemark {
  bottom: auto;
  right: var(--gutter);
  top: calc(var(--top-control) + 10px);
  background: rgb(14 10 8 / .75);
  padding: 5px 10px;
}
.sheet {
  position: fixed;
  inset: auto 0 var(--control-bottom);
  width: min(940px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  max-height: calc(100% - var(--top-control) - var(--control-bottom) - 10px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(13px, 2.15vw, 23px);
  border: 1px solid rgb(184 138 92 / .38);
  border-radius: 12px;
  background: linear-gradient(150deg, rgb(28 20 15 / .92), rgb(12 9 8 / .96));
  box-shadow: 0 16px 48px rgb(0 0 0 / .42);
}
.scene-line { display: none; }
.objective[data-big="0"] { display: none; }
.objective[data-big="1"] { margin: 0 0 9px; }
.narr { color: var(--ink); margin: 0 0 4px; max-width: 100%; }
.narr[data-memory="1"] { color: var(--ink-dim); }
.dialogue { margin: 0 0 5px; }
.who { margin-bottom: 2px; }
.advance-row { min-height: 0; justify-content: flex-end; }
.advance {
  min-height: 42px; padding: 6px 13px;
  background: #35251a;
  border: 1px solid var(--amber-dim);
  border-radius: 6px;
}
.advance:hover { background: #493120; }
.choice { margin-top: 0; }
.choice[data-kind="branch"], .choice[data-kind="timed"] {
  padding: 10px 0 0; border: 0; border-top: 1px solid var(--line);
  background: none; box-shadow: none;
}
.choice-hint { color: var(--ink-dim); }
.choice-hint:empty { display: none; }
.choice .options button { min-height: 44px; }
.endcard { margin: 0; border: 0; padding: 0; }

@media (max-width: 760px) {
  :root { --top-control: 54px; --gutter: 12px; --control-bottom: max(10px, env(safe-area-inset-bottom)); }
  .bar { gap: 6px; }
  .bar .ghost { min-height: 36px; padding: 4px 8px; font-size: 12px; }
  .bar .switches { gap: 4px; }
  .stage img { object-position: 55% center; }
  .stage[data-frame="1"] img { object-position: center 35%; }
  .sheet { padding: 12px 14px; }
  .narr { line-height: 1.6; }
  .dialogue blockquote { font-size: 21px; line-height: 1.43; }
  .choice-head { column-gap: 8px; row-gap: 2px; }
  .choice h2 { margin: 2px 0; }
  .choice-hint { margin: 3px 0 8px; font-size: 12px; line-height: 1.45; }
  .choice .options { gap: 6px; }
  .choice[data-kind="branch"] .options button,
  .choice[data-kind="timed"] .options button { padding: 8px 10px; }
  .timer { margin-bottom: 7px; }
}
@media (max-width: 360px) {
  .bar .ghost { padding: 3px 6px; font-size: 11px; }
  .names b { font-size: 18px; }
  .objective[data-big="1"] { font-size: 13px; padding: 7px 10px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  :root { --top-control: 48px; --control-bottom: 8px; }
  .sheet { padding: 10px 14px; }
  .titlecard { bottom: 44%; }
  .titlecard h1 { font-size: clamp(29px, 5.5vw, 52px); }
  .dialogue blockquote { font-size: 19px; }
  .choice[data-kind="timed"] .options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 竖屏按已用镜头定位视线，横屏继续沿用原构图。 */
@media (max-aspect-ratio: 4/5) {
  .stage[data-shot="shadow"] img { object-position: 78% center; }
  .stage[data-shot="night/01"] img { object-position: 41% center; }
  .stage[data-shot="night/02D"] img { object-position: 82% center; }
  .stage[data-shot="night/07"] img { object-position: 69% center; }
  .stage[data-shot="night/08"] img { object-position: 71% center; }
  .stage[data-shot="night/15"] img { object-position: 62% center; }
  .stage[data-shot="buji/tears"] img { object-position: 72% center; }
  .stage[data-shot="buji/knock"] img { object-position: 70% center; }
  .stage[data-shot="buji/shop"] img { object-position: 46% center; }
  .stage:is([data-shot="segments/05"], [data-shot="segments/09"], [data-shot="segments/11"]) img {
    object-position: 54% center;
  }
  .stage[data-shot="segments/18"] img { object-position: 74% center; }
  .stage:is([data-shot="autumn/freeze-across"], [data-shot="autumn/autumn-table"]) img {
    object-position: 53% center;
  }
  .stage:is([data-shot="segments/13"], [data-shot="segments/17"], [data-shot="segments/20"]) img {
    object-position: center;
  }
  .stage:is(
    [data-shot="buji/warm"], [data-shot="buji/menu"], [data-shot="buji/anger"], [data-shot="night/06"],
    [data-shot="segments/01"], [data-shot="segments/02"], [data-shot="segments/03"], [data-shot="segments/04"],
    [data-shot="segments/06"], [data-shot="segments/07"], [data-shot="segments/08"], [data-shot="segments/10"],
    [data-shot="segments/12"], [data-shot="segments/14"], [data-shot="segments/15"], [data-shot="segments/16"],
    [data-shot="segments/19"], [data-shot="autumn/autumn-street"], [data-shot="autumn/autumn-shop"],
    [data-shot="autumn/autumn-intact"], [data-shot="autumn/autumn-broken"], [data-shot="autumn/autumn-door"]
  ) {
    & img { object-fit: contain; object-position: center 32%; }
    &::before {
      content: "";
      position: absolute;
      inset: -24px;
      z-index: -1;
      background: var(--frame-image) center / cover no-repeat;
      filter: blur(24px) brightness(.46);
    }
  }
}

/* 正片字幕、接话与剧情选择 */
.sheet:is([data-view="reading"], [data-view="choice"]) {
  width: min(1000px, calc(100% - 2 * var(--gutter)));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.sheet .dialogue {
  margin: 0 auto;
  max-width: min(34em, 100%);
  text-align: center;
  animation: none;
}
.dialogue .who {
  display: inline;
  margin: 0;
  color: #e1d7ca;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: normal;
  white-space: nowrap;
}
.caption-clue {
  color: #ffd18a;
  font-size: 1.18em;
  font-weight: 700;
}
.dialogue blockquote {
  padding: 0;
  border: 0;
  font: 500 clamp(17px, 1.65vw, 24px)/1.45 var(--sans);
  color: #fffaf0;
  text-wrap: pretty;
  text-shadow: 0 1px 2px #000, 0 2px 4px #000, 0 0 12px #000, 0 0 24px #000;
}
.sheet[data-view="description"] {
  width: min(530px, calc(100% - 2 * var(--gutter)));
  padding: 8px clamp(13px, 2.5vw, 25px) 5px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border-color: rgb(149 57 62 / .43);
  border-radius: 8px;
  background:
    radial-gradient(ellipse 42px 4px at 31% 0, rgb(160 37 50 / .56), transparent 100%),
    radial-gradient(ellipse 23px 9px at 34% -1px, rgb(120 21 35 / .48), transparent 100%),
    radial-gradient(ellipse 66px 12px at 32% -3px, rgb(105 19 28 / .35), transparent 100%),
    linear-gradient(165deg, rgb(47 13 19 / .68), rgb(20 8 12 / .73) 72%);
  box-shadow: 0 7px 18px rgb(0 0 0 / .3);
}
.sheet[data-view="description"] .narr {
  grid-row: 1;
  margin: 0;
  overflow: auto;
  text-align: center;
  color: #faf0eb;
  font-size: clamp(14px, 1.15vw, 16px);
  line-height: 1.6;
  text-shadow: 0 1px 3px rgb(0 0 0 / .8);
}
.sheet[data-view="description"] .advance-row {
  grid-row: 2;
  margin-top: 3px;
  justify-content: center;
}
.sheet[data-view="description"] .advance {
  min-height: 36px;
  padding-block: 3px;
  border-color: rgb(168 70 81 / .58);
  background: rgb(99 28 41 / .56);
  color: #ffddd8;
  font-size: 13px;
  letter-spacing: .08em;
}
.sheet[data-view="description"] .advance:hover {
  border-color: #bb6670;
  background: rgb(127 38 53 / .7);
}
.sheet[data-view="description"] .advance::before { display: none; }

.sheet[data-view="reading"] .advance {
  min-height: 36px;
  padding: 2px 8px;
  border-color: transparent;
  background: rgb(13 10 9 / .76);
  font-size: 12px;
  letter-spacing: .07em;
}
.sheet[data-view="reading"] .advance::before { display: none; }
.sheet[data-view="reading"] .advance:hover { border-color: var(--amber-dim); }
.sheet[data-view="reading"] .advance-row { margin-top: 2px; }

.sheet .choice {
  width: min(700px, 100%);
  margin: 7px auto 0;
  padding: 8px 10px 10px;
  border: 1px solid rgb(158 178 201 / .33);
  border-radius: 7px;
  background: rgb(15 15 18 / .91);
  animation-duration: .18s;
}
.sheet .choice[data-kind="branch"], .sheet .choice[data-kind="timed"] {
  border-color: #906542;
  border-top: 2px solid #d4a06d;
  background: rgb(28 19 15 / .96);
}
.sheet .choice[data-kind="timed"] {
  border-color: #98523f;
  border-top-color: #ef9174;
}
.sheet .choice-head { gap: 6px 10px; margin-bottom: 5px; align-items: center; }
.sheet .choice-kind { letter-spacing: .09em; padding: 1px 6px; }
.sheet .choice h2 { margin: 0; font-size: clamp(14px, 1.4vw, 17px); }
.sheet .choice h2:empty { display: none; }
.sheet .choice .options { gap: 5px; }
.sheet .choice .options button { font-size: clamp(14px, 1.45vw, 16px); padding: 5px 10px; }
.sheet .choice[data-kind="reply"] .options button {
  color: #e8f0fa;
  border-bottom-color: #526777;
}
.sheet .choice[data-kind="reply"] .options button:hover {
  background: rgb(139 166 196 / .14);
  border-bottom-color: var(--cold);
}
.sheet .timer { margin: 0 0 5px; }
.sheet .timer b { min-width: 0; font-size: 19px; }

@media (min-width: 761px) {
  .sheet[data-view="reading"] { padding-inline: 90px; }
  .sheet[data-view="reading"] .advance-row { position: absolute; bottom: 0; right: 2px; }
  .sheet[data-view="reading"] { min-height: 36px; display: grid; align-content: end; }
}
@media (max-width: 540px) {
  .sheet .choice .options { grid-template-columns: 1fr; }
  .sheet[data-view="reading"] .advance kbd { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) and (min-width: 600px) {
  .sheet .choice .options { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
}

/* The restaurant stays visible beneath successive memory exposures. */
.memory-cut { position: fixed; inset: 0; z-index: 20; overflow: hidden; pointer-events: auto; }
.memory-cut .memory-exposure { position: absolute; border: 0; pointer-events: none; }
.memory-coil { position: absolute; top: max(72px,10%); left: 5%; width: clamp(35px,4vw,55px); fill: none; stroke: #e0cfaf; stroke-width: 1.4; stroke-dasharray: 1; opacity: .8; }
.hold-rewind {
  position: absolute; left: 50%; bottom: max(7%, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; gap: .35rem; justify-items: center; width: min(260px,86vw); padding: .8rem 1.2rem;
  color: #f7ead2; background: rgba(27,16,14,.9); border: 1px solid #ad947a; border-radius: 5px;
  touch-action: none; user-select: none; -webkit-touch-callout: none; cursor: pointer;
}
.hold-rewind small { color: #d6c3b2; }
.hold-rewind progress { width: 100%; height: 4px; accent-color: #c18a75; }

/* 阅读层的字距以汉字为单位，交互始终落在画面下沿。 */
body:not(:has(.sheet[data-view="start"])) .bar .where { display: none; }
.sheet[data-view="start"] {
  width: min(680px, calc(100% - 2 * var(--gutter)));
  padding: clamp(14px, 2vw, 23px);
  background: linear-gradient(145deg, #211911ed, #130f0ded);
}
.sheet[data-view="start"] .objective {
  width: 100%; border: 0; border-left: 2px solid var(--amber);
  padding: 0 0 0 .8em; background: transparent; box-shadow: none;
  font: 600 clamp(16px,1.4vw,20px)/1.6 var(--serif); letter-spacing: .025em;
}
.sheet[data-view="start"] .narr { font-size: clamp(14px,1.15vw,17px); color: #d5c7b8; }
.sheet .dialogue { width: fit-content; max-width: min(100%, 33em); }
.sheet .dialogue blockquote {
  line-break: strict; text-wrap: balance; line-height: 1.55;
  letter-spacing: .025em; font-size: clamp(18px,1.65vw,26px);
}
.sheet .dialogue .who { color: #e8d5c1; font-size: inherit; }
.sheet[data-view="description"] {
  width: min(37rem, calc(100% - 2 * var(--gutter)));
  border-radius: 5px; padding: 8px clamp(12px,2.2vw,24px) 4px;
}
.sheet[data-view="description"] .narr {
  text-wrap: balance; line-break: strict; font: 500 clamp(15px,1.15vw,18px)/1.65 var(--serif);
}
.sheet[data-view="description"] .advance { background: transparent; border-color: transparent; min-width: 90px; justify-content: center; }
.sheet .choice:focus { outline: none; }
.sheet .choice { border-radius: 5px; padding: 10px 12px; }
.sheet .choice-head { margin-bottom: 7px; }
.sheet .choice-kind { border: none; padding: 0; font-size: 13px; letter-spacing: .09em; }
.sheet .choice .options button {
  display: flex; align-items: center; gap: .65em; line-height: 1.45; min-height: 44px;
}
.sheet .choice .options button:focus-visible { outline-offset: -3px; }
@media (hover:hover) and (pointer:fine) {
  .sheet .choice .options button::before {
    content: attr(data-index); display: inline-grid; place-items: center; flex: 0 0 1.45em;
    height: 1.45em; border: 1px solid currentColor; border-radius: 3px;
    font: 500 11px/1 var(--sans); opacity: .75;
  }
}
.sheet[data-view="ending"] { width: min(720px,calc(100% - 2 * var(--gutter))); }
.end-reason, .recap ol { line-break: strict; line-height: 1.65; }
.hold-rewind { gap: .35rem; background: linear-gradient(180deg,#201916ec,#120e0deb); }
.hold-rewind span { font: 600 17px/1.5 var(--serif); }
.hold-rewind progress { appearance: none; border: 0; border-radius: 2px; background: #594c42; }
.hold-rewind progress::-webkit-progress-bar { background: #594c42; }
.hold-rewind progress::-webkit-progress-value { background: #e5b894; }
@media (pointer:coarse) {
  .advance kbd { display:none; }
  .sheet[data-view="description"] .advance { min-height:44px; }
}
#storyTree { color:var(--ink); background:#18130ff7; border:1px solid #796148; border-radius:9px; padding:0; width:min(760px,94vw); max-height:87dvh; }
#storyTree::backdrop { background:#0c0809bd; }
#storyTree header { position:sticky; top:0; z-index:1; display:flex; gap:12px; justify-content:space-between; align-items:center; padding:14px 20px; background:#201912; border-bottom:1px solid #55402c; }
#storyTree h2 { font:500 25px/1.3 var(--serif); margin:0; }
#storyTree p { margin:4px 0; }
#treeProgress,.tree-key { color:#c0af99; font-size:13px; }
#storyTree section { padding:12px clamp(12px,3vw,26px) 26px; }
#treeRoutes,.tree-lines { list-style:none; padding:0; margin:8px 0; }
.tree-lines { margin-left:9px; padding-left:13px; border-left:1px solid #514339; }
.tree-link:only-child > .tree-lines { border:0; padding:0; margin-left:0; }
.tree-node { padding:4px 0 4px 8px; border-left:2px solid #514339; scroll-margin-top:100px; }
.tree-node.on-route { border-color:#bf9667; }
.tree-name { font:500 16px/1.45 var(--serif); }
.tree-node .now,.tree-node .result,.tree-retry { margin-left:8px; font-size:12px; }
.tree-node .now { color:#ffd49f; }
.tree-retry { border:1px solid #735c44; background:#251d17; color:#edc798; border-radius:4px; padding:4px 7px; }
.unknown,.merge,.tree-edge { font-size:13px; color:#bbad9d; }
.tree-edge { color:#d6ba96; }
.route-length { font-size:11px; font-weight:400; color:#dac3ae; margin-left:auto; white-space:nowrap; }
@media(max-width:540px){.bar .ghost{padding-inline:6px}.tree-lines{margin-left:3px;padding-left:5px}.tree-node{padding-left:4px}.sheet .choice .options button{gap:.4em}}
#storyTree[open] { display:flex; flex-direction:column; width:min(96vw,1600px); max-width:none; height:90dvh; max-height:none; overflow:hidden; border-color:#685747; background:#181513; }
#storyTree .map-tools { padding:6px 20px; display:flex; align-items:center; justify-content:space-between; gap:8px; color:#e1d3be; font-size:14px; }
#treeViewport { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; cursor:grab; scrollbar-color:#776453 #211c18; background:radial-gradient(ellipse at 50% 45%,#332c25,transparent 75%),#161414; }
#treeViewport:active { cursor:grabbing; }
#treeCanvas { position:relative; margin:auto; top:max(0px,calc((100% - var(--graph-height,100%)) / 2)); }
#treeLinks,#treeRoutes { position:absolute; inset:0; width:100%; height:100%; margin:0; }
#treeLinks { fill:none; stroke-width:2; }
#treeLinks .active { stroke:#e0aa71; }
#treeLinks .visited { stroke:#a39380; }
#treeLinks .locked { stroke:#776c61; stroke-dasharray:4 5; }
#treeRoutes { pointer-events:none; }
#treeRoutes .map-card { box-sizing:border-box; position:absolute; width:176px; height:132px; margin:0; padding:10px 12px; display:flex; flex-direction:column; justify-content:flex-end; gap:3px; border:1px solid #817364; background:#2c2824; color:#f5eada; border-radius:4px; isolation:isolate; overflow:hidden; pointer-events:auto; user-select:none; }
.map-card img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:-2; }
.map-card:has(img)::after { content:''; position:absolute; inset:0; z-index:-1; background:linear-gradient(transparent,#140e0aeb 78%); }
#treeRoutes .map-card.on-route { border-color:#c39665; }
#treeRoutes .map-card[aria-current] { border:2px solid #f3be7c; }
.map-card[aria-current]::before { content:'当前位置'; position:absolute; left:6px; top:5px; background:#38291cf2; color:#ffe3b9; font:12px/1.5 var(--sans); padding:1px 6px; }
#treeRoutes .map-card.unknown { background:#211e1b; border:1px dashed #726557; justify-content:center; color:#c3b9ab; }
.map-card .tree-name { font-size:16px; }
.map-detail { font-size:12px; line-height:1.4; }
.map-card .tree-retry { margin:0; align-self:flex-start; padding:2px 7px; background:#251d17eb; }
.map-key { padding:7px 18px; font-size:12px; color:#c2b5a3; }
.zoom-tools { display:flex; align-items:center; gap:4px; margin-left:auto; }
.zoom-tools button { min-width:34px; padding:3px 8px; font-size:18px; }
#treeScale { min-width:4ch; text-align:center; font-variant-numeric:tabular-nums; }
#treeLinks path[data-recent] {stroke:#ffe09e;stroke-width:5;filter:drop-shadow(0 0 3px #b98240);}
#treeRoutes .retry-origin {border:2px solid #ffdb98;}
.retry-origin .tree-retry {color:#24190c;background:#ffdaa1;border:0;font-weight:bold;}
.tree-intro #treeLinks path[data-reveal] {stroke:#ffe1a9;stroke-width:3;animation:fork-cue 1.6s ease-out both;}
@keyframes fork-cue {from{stroke-dasharray:1 240;opacity:.25}to{stroke-dasharray:240 0;opacity:1}}
@media(max-width:600px){#storyTree .map-tools{flex-wrap:wrap;padding:5px 10px}#treeLocation{flex:1 0 100%}.zoom-tools{margin-left:0}#locateTree{margin-left:auto}}
