/* 《下一站，见你》 视觉语言：暖纸色、海盐蓝、珊瑚、奶油黄，手写感字体 */
:root {
  --paper: #fbf4e6;
  --paper-2: #f4e8d2;
  --paper-3: #eadbc0;
  --ink: #4a3a2f;
  --ink-soft: #7a6656;
  --ink-faint: #a8937f;
  --coral: #e98a6f;
  --coral-deep: #d06a52;
  --sea: #4aa9b8;
  --sea-deep: #2f7f8f;
  --sky: #a9dbea;
  --sun: #f6cf6b;
  --leaf: #86b87a;
  --rose: #e7a3a6;
  --shadow: 0 10px 30px rgba(74, 58, 47, .18), 0 2px 6px rgba(74, 58, 47, .12);
  --radius: 18px;
  --font-hand: "LXGW WenKai Screen", "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --stage-bg: #2b2420;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
.hand { font-family: var(--font-hand); }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ── 通用按钮 ── */
.btn {
  appearance: none; border: 0; cursor: pointer;
  padding: 13px 26px; border-radius: 999px;
  background: var(--coral); color: #fff;
  font-family: var(--font-hand); font-size: 19px; letter-spacing: .06em;
  box-shadow: 0 4px 0 var(--coral-deep), 0 8px 18px rgba(208, 106, 82, .3);
  transition: transform .12s, box-shadow .12s, filter .2s;
  min-height: 48px;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-deep), 0 4px 10px rgba(208, 106, 82, .25); }
.btn.sea { background: var(--sea); box-shadow: 0 4px 0 var(--sea-deep), 0 8px 18px rgba(47, 127, 143, .3); }
.btn.ghost { background: rgba(255,255,255,.7); color: var(--ink); box-shadow: 0 3px 0 var(--paper-3), 0 6px 14px rgba(74,58,47,.12); }
.btn.small { padding: 8px 16px; font-size: 16px; min-height: 38px; }
.btn[disabled] { filter: grayscale(.6) opacity(.6); cursor: default; }
.icon-btn {
  appearance: none; border: 0; cursor: pointer; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(251, 244, 230, .92); color: var(--ink);
  display: inline-grid; place-items: center; box-shadow: var(--shadow);
  position: relative; transition: transform .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn .badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--coral); color: #fff; font-size: 11px; display: grid; place-items: center; padding: 0 4px;
}

input.field, textarea.field {
  width: 100%; border: 2px solid var(--paper-3); background: #fffdf8; border-radius: 14px;
  padding: 12px 14px; font-size: 17px; color: var(--ink); outline: none; font-family: var(--font-ui);
}
input.field:focus, textarea.field:focus { border-color: var(--sea); }

/* ── 首页 ── */
#home { background: #f7e3c9; overflow: hidden; }
.home-art { position: absolute; inset: 0; }
.home-art svg { width: 100%; height: 100%; display: block; }
.home-ui {
  position: relative; z-index: 2; margin: auto; text-align: center; padding: 24px 16px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 720px; width: 100%;
}
.title-cn {
  font-family: var(--font-hand); font-size: clamp(40px, 8.4vw, 80px); margin: 0; color: #fff; white-space: nowrap;
  letter-spacing: .12em; text-shadow: 0 3px 0 rgba(208, 106, 82, .55), 0 8px 26px rgba(74, 58, 47, .35);
  line-height: 1.1;
}
.title-en { font-family: Georgia, "Times New Roman", serif; letter-spacing: .5em; color: #fff; font-size: clamp(13px, 2.4vw, 17px); margin: -2px 0 6px; text-shadow: 0 2px 8px rgba(74,58,47,.4); padding-left: .5em; }
.tagline { font-family: var(--font-hand); color: #fff; font-size: clamp(16px, 3.4vw, 20px); text-shadow: 0 2px 10px rgba(74,58,47,.45); margin-bottom: 14px; }
.home-actions { display: flex; flex-direction: column; gap: 14px; width: min(320px, 100%); }
.home-foot { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; z-index: 2; font-size: 12px; color: rgba(255,255,255,.85); text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.home-foot a { color: inherit; }
.home-top { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; gap: 10px; }

/* ── 纸卡面板 ── */
.card {
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); padding: 22px;
  position: relative;
}
.card::before {
  content: ""; position: absolute; inset: 8px; border: 1.5px dashed rgba(122, 102, 86, .25); border-radius: 16px; pointer-events: none;
}
.card h2 { font-family: var(--font-hand); margin: 0 0 10px; font-size: 26px; font-weight: normal; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

/* ── 选角 / 大厅 ── */
.panel-screen { background: radial-gradient(120% 90% at 50% 0%, #fff6e6 0%, #f3dfc2 60%, #e9cfae 100%); overflow-y: auto; }
.panel-wrap { margin: auto; width: min(760px, 100%); padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.role-card {
  cursor: pointer; border: 3px solid transparent; transition: transform .2s, border-color .2s; text-align: left;
  display: flex; flex-direction: column; gap: 8px; min-height: 230px; appearance: none; font: inherit;
}
.role-card:hover { transform: translateY(-3px); }
.role-card.sel { border-color: var(--coral); }
.role-card[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.role-card .role-name { font-family: var(--font-hand); font-size: 28px; }
.role-card .role-art { height: 110px; border-radius: 14px; overflow: hidden; }
.role-card .role-art svg { width: 100%; height: 100%; }
.code-box {
  font-family: Georgia, serif; font-size: 40px; letter-spacing: .3em; text-align: center; padding: 10px 0 6px 0.3em;
  background: #fffdf8; border-radius: 14px; border: 2px dashed var(--paper-3); user-select: all;
}
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.seat { text-align: center; padding: 16px 10px; }
.seat .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c9b8a5; margin-right: 6px; vertical-align: middle; }
.seat .dot.on { background: #5cc27a; box-shadow: 0 0 0 4px rgba(92, 194, 122, .2); }
.seat .who { font-family: var(--font-hand); font-size: 24px; margin: 6px 0; }
.seat .state { font-size: 14px; color: var(--ink-soft); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.back-link { background: none; border: 0; color: var(--ink-soft); cursor: pointer; font-size: 15px; padding: 6px 0; align-self: flex-start; }

/* ── 游戏舞台 ── */
#game { background: var(--stage-bg); }
.stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.world > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; /* 只显示这个场景自己的范围：宽屏时两边不再露出光效层盖不到的、对方那一半的画面 */ }
/* 活动层单独合成，人物更新时复用带泛光的房间底图。 */
.world > svg.live-layer { transform: translateZ(0); }
.world [data-hot] { cursor: pointer; }
.world [data-hot].off { pointer-events: none; }
.world .hot-glow { animation: hotglow 1.6s ease-out 1; }
@keyframes hotglow {
  0% { filter: drop-shadow(0 0 0 rgba(255, 236, 170, 0)); }
  30% { filter: drop-shadow(0 0 14px rgba(255, 236, 170, 1)) drop-shadow(0 0 4px #fff); }
  100% { filter: drop-shadow(0 0 0 rgba(255, 236, 170, 0)); }
}
.world [data-hot]:hover { filter: brightness(1.06) drop-shadow(0 0 6px rgba(255, 240, 200, .9)); }
@media (hover: none) { .world [data-hot]:hover { filter: none; } }
.grain {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .32;
  background-size: 220px 220px;
}
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(40, 25, 15, .35) 100%); }
.pan-hint {
  position: absolute; bottom: 92px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px;
  background: rgba(40, 30, 25, .55); padding: 6px 12px; border-radius: 999px; pointer-events: none; transition: opacity .6s;
}

/* HUD */
.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; z-index: 20; }
.hud-top > * { pointer-events: auto; }
.chip {
  background: rgba(251, 244, 230, .93); border-radius: 999px; padding: 7px 14px 7px 10px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px; font-family: var(--font-hand); font-size: 17px; max-width: 58vw;
}
.chip .stop-no { background: var(--coral); color: #fff; border-radius: 999px; padding: 2px 9px; font-size: 14px; white-space: nowrap; }
.chip .stop-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partner { font-family: var(--font-ui); font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; margin-top: 6px; margin-left: 6px; background: rgba(251,244,230,.85); border-radius: 999px; padding: 3px 9px; width: fit-content; }
.partner .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9b8a5; }
.partner .dot.on { background: #5cc27a; }
.hud-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 50vw; }

.inv-bar {
  position: absolute; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  display: flex; gap: 8px; padding: 8px 12px; border-radius: 22px; background: rgba(251, 244, 230, .9); box-shadow: var(--shadow);
  max-width: calc(100vw - 20px); overflow-x: auto; scrollbar-width: none; min-height: 64px; align-items: center;
}
.inv-bar::-webkit-scrollbar { display: none; }
.inv-bar .empty { color: var(--ink-faint); font-size: 13px; padding: 0 10px; font-family: var(--font-hand); white-space: nowrap; }
.inv-item {
  width: 50px; height: 50px; flex: 0 0 auto; border-radius: 14px; background: #fffaf0; border: 2px solid var(--paper-3);
  display: grid; place-items: center; cursor: pointer; position: relative; transition: transform .15s, border-color .15s; padding: 0; touch-action: none;
}
.inv-item svg { width: 38px; height: 38px; pointer-events: none; }
.inv-item.sel { border-color: var(--coral); transform: translateY(-6px); box-shadow: 0 8px 16px rgba(233, 138, 111, .35); }
.inv-item.new::after { content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); }
.drag-ghost { position: fixed; z-index: 200; width: 56px; height: 56px; pointer-events: none; transform: translate(-50%, -60%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.3)); }
.drag-ghost svg { width: 100%; height: 100%; }

/* 浮动文字 / 提示条 */
.caption {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30;
  background: rgba(46, 36, 30, .86); color: #fff8ec; padding: 12px 18px; border-radius: 16px;
  font-family: var(--font-hand); font-size: 18px; line-height: 1.55; max-width: min(620px, calc(100vw - 32px));
  text-align: center; pointer-events: none; opacity: 0; transition: opacity .3s, transform .3s;
}
.caption.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
/* 终章闪回：白那边「那一刻的问题」是一条页面上的框（章节条下面、深色字）；这一段的字幕挪到上面，不盖底下的回忆记录（验收 C11-13） */
.flash-ask { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); z-index: 25; width: min(760px, calc(100% - 320px)); background: #fffaf0; border: 3px solid #8a6a4a; border-radius: 16px; padding: 8px 18px 10px; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); pointer-events: none; }
.flash-ask .t { font-family: var(--font-hand); font-size: 17px; color: #8a5a32; }
.flash-ask .q { font-family: var(--font-hand); font-size: 24px; line-height: 1.4; color: #24160c; font-weight: 700; }
.caption.cap-top { bottom: auto; top: 200px; }
.toasts { position: fixed; bottom: 92px; right: max(12px, env(safe-area-inset-right)); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; width: max-content; max-width: min(360px, calc(100vw - 24px)); }
/* 特写开着时，提示条挪到屏幕最上面，不压住特写里的按钮（验收 R-01） */
body:has(.modal-back) .toasts { bottom: auto; top: max(8px, env(safe-area-inset-top)); right: 50%; transform: translateX(50%); align-items: center; }
.toast { background: var(--paper); color: var(--ink); border-radius: 14px; padding: 10px 16px; box-shadow: var(--shadow); font-size: 15px; animation: toastin .3s ease-out; display: flex; gap: 10px; align-items: center; }
.toast.chat { border-left: 4px solid var(--sea); font-family: var(--font-hand); font-size: 17px; }
.toast.good { border-left: 4px solid var(--leaf); }
.toast svg { width: 28px; height: 28px; flex: none; }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px); } }
.hover-label { position: fixed; z-index: 150; pointer-events: none; background: rgba(46, 36, 30, .85); color: #fff; font-size: 13px; padding: 4px 10px; border-radius: 8px; transform: translate(14px, 14px); white-space: nowrap; }

/* ── 模态框 / 特写 ── */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(30, 22, 18, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 12px; animation: fadein .25s;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  background: var(--paper); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  width: min(var(--mw, 820px), 100%); max-height: calc(100dvh - 24px); overflow: auto; position: relative;
  animation: popin .3s cubic-bezier(.2, 1.3, .4, 1);
  display: flex; flex-direction: column;
}
@keyframes popin { from { transform: scale(.92); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; gap: 8px; position: sticky; top: 0; background: var(--paper); z-index: 2; }
.modal-head h3 { margin: 0; font-family: var(--font-hand); font-weight: normal; font-size: 22px; }
.modal-body { padding: 8px 18px 20px; }
.closeup-stage { position: relative; width: 100%; aspect-ratio: var(--ar, 4 / 3); max-height: max(140px, calc(100dvh - 270px)); margin-inline: auto; /* 小屏上给下面的说明和按钮留出地方（画面按比例缩在框里） */ border-radius: 14px; overflow: hidden; background: #3a2e27; touch-action: none; user-select: none; -webkit-user-select: none; }
.closeup-stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* 特写里只有一块画面（操作都做在画面里，没有说明和按钮，Ryan 2026-11-21）：画面可以占满弹窗 */
.modal-body > .closeup-stage:only-child { max-height: max(160px, calc(100dvh - 240px)); }
.closeup-say { position: absolute; z-index: 5; pointer-events: none; transition: opacity .6s; padding: 10px 14px; border-radius: 12px; background: #3a2e27; color: #fff6e6; font-family: var(--font-hand); font-size: 17px; line-height: 1.6; box-shadow: 0 -6px 16px rgba(58, 46, 39, .18); }
.closeup-say.flash { animation: sayIn .35s ease-out; }
.closeup-say.gone { opacity: 0; }
.closeup-say.inside { opacity: .93; font-size: 15px; padding: 7px 12px; }
.closeup-say.inside.gone { opacity: 0; }
@keyframes sayIn { from { opacity: 0; transform: translateY(6px); } }
.closeup-note { white-space: pre-line; /* 说明里写的换行要显示出来（验收 C3-16） */ font-family: var(--font-hand); font-size: 17px; line-height: 1.7; margin-top: 12px; color: var(--ink); }
.closeup-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.x-btn { appearance: none; border: 0; background: var(--paper-2); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 20px; line-height: 1; flex: none; }

/* 文档（信、便签） */
.doc {
  background: #fffdf6; border-radius: 6px; padding: 26px 26px 30px; position: relative;
  background-image: repeating-linear-gradient(transparent 0 33px, rgba(169, 219, 234, .55) 33px 34px);
  font-family: var(--font-hand); font-size: 19px; line-height: 34px; color: #3d3029;
  box-shadow: inset 0 0 0 1px rgba(122, 102, 86, .12);
  white-space: pre-wrap;
}
.doc.plain { background-image: none; line-height: 1.8; }
.doc .sign { text-align: right; margin-top: 8px; color: var(--ink-soft); }
.doc table { border-collapse: collapse; width: 100%; font-size: 16px; line-height: 1.6; }
.doc td, .doc th { border-bottom: 1px dashed rgba(122,102,86,.3); padding: 4px 6px; text-align: left; vertical-align: top; }
.doc .stamp { position: absolute; right: 18px; top: 14px; transform: rotate(8deg); color: var(--coral); border: 2px solid var(--coral); border-radius: 6px; padding: 0 8px; font-size: 15px; line-height: 26px; opacity: .8; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }

/* 手账 */
.tabs { display: flex; gap: 6px; padding: 0 18px; flex-wrap: wrap; }
.tab { appearance: none; border: 0; background: var(--paper-2); padding: 8px 16px; border-radius: 12px 12px 0 0; cursor: pointer; font-family: var(--font-hand); font-size: 17px; }
.tab.on { background: var(--paper-3); }
.grid-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.j-item { background: #fffaf0; border: 2px solid var(--paper-3); border-radius: 14px; padding: 10px; cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; appearance: none; font: inherit; }
.j-item.sel { border-color: var(--coral); }
.j-item svg { width: 56px; height: 56px; }
.j-item .nm { font-family: var(--font-hand); font-size: 16px; }
.j-item .lv { font-size: 11px; color: var(--ink-faint); }

/* 提示 */
.hint-list { display: flex; flex-direction: column; gap: 10px; }
.hint { background: #fffaf0; border-radius: 14px; padding: 12px 14px; border-left: 4px solid var(--sun); font-family: var(--font-hand); font-size: 18px; line-height: 1.6; }
.hint .lvl { font-family: var(--font-ui); font-size: 12px; color: var(--ink-faint); display: block; margin-bottom: 2px; }

/* 对讲机 */
.chat-panel {
  position: absolute; right: max(10px, env(safe-area-inset-right)); top: 70px; z-index: 40; width: min(340px, calc(100vw - 20px));
  background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: min(460px, calc(100dvh - 170px));
  animation: popin .25s;
}
.chat-head { padding: 10px 14px; font-family: var(--font-hand); font-size: 18px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--paper-3); }
.chat-log { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 120px; }
.msg { max-width: 82%; padding: 7px 11px; border-radius: 14px; font-family: var(--font-hand); font-size: 17px; line-height: 1.45; word-break: break-word; }
.msg.me { align-self: flex-end; background: #ffe2d6; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #dff1f4; border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px dashed var(--paper-3); }
.chat-form input { flex: 1; min-width: 0; }

/* ── 剧情 ── */
.story {
  position: fixed; inset: 0; z-index: 120; background: #1f1915; display: flex; flex-direction: column; cursor: pointer;
  animation: fadein .6s;
}
.story-art { position: absolute; inset: 0; overflow: hidden; }
.story-art > svg, .story-art > .world-wrap { position: absolute; inset: 0; width: 100%; height: 100%; }
.story-art svg { transition: opacity 1s, transform 8s ease-out; }
.story-art .kb { animation: kenburns 14s ease-out forwards; transform-origin: 50% 50%; }
@keyframes kenburns { from { transform: scale(1.0); } to { transform: scale(1.07) translateY(-1%); } }
.story-bars::before, .story-bars::after { content: ""; position: absolute; left: 0; right: 0; height: 7vh; background: #120e0b; z-index: 2; }
.story-bars::before { top: 0; } .story-bars::after { bottom: 0; }
.story-text {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(7vh + 18px); z-index: 3;
  width: min(760px, calc(100vw - 28px)); background: rgba(251, 244, 230, .95); border-radius: 18px; padding: 18px 22px 22px; box-shadow: 0 10px 40px rgba(0,0,0,.4);
  font-family: var(--font-hand); font-size: clamp(17px, 2.4vw, 21px); line-height: 1.75; color: var(--ink); min-height: 96px;
}
.story-text .who { position: absolute; top: -16px; left: 18px; background: var(--coral); color: #fff; padding: 3px 14px; border-radius: 999px; font-size: 16px; }
.story-text .who.she { background: var(--sea); }
.story-text .who.none { display: none; }
.story-text .more { position: absolute; right: 16px; bottom: 8px; font-size: 13px; color: var(--ink-faint); animation: bob 1.2s ease-in-out infinite; font-family: var(--font-ui); }
@keyframes bob { 50% { transform: translateY(3px); } }
.story-title { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; color: #fff; pointer-events: none; }
.story-title .t1 { font-family: var(--font-hand); font-size: clamp(18px, 3vw, 24px); letter-spacing: .3em; opacity: .9; }
.story-title .t2 { font-family: var(--font-hand); font-size: clamp(38px, 7vw, 68px); letter-spacing: .15em; text-shadow: 0 4px 24px rgba(0,0,0,.5); }
.story-title .t3 { font-family: Georgia, serif; letter-spacing: .4em; font-size: 14px; opacity: .8; margin-top: 6px; }
.story-title > div { animation: titlein 2.4s ease-out both; }
@keyframes titlein { from { opacity: 0; transform: translateY(12px); letter-spacing: .4em; } }
.story-skip { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 5; background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; }
.story-letter { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 8vh 16px; }
.story-letter .doc { width: min(560px, 100%); max-height: 70vh; overflow: auto; transform: rotate(-1deg); box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: popin .6s; }

/* 等待遮罩 */
.wait {
  position: fixed; inset: 0; z-index: 110; background: rgba(30, 22, 18, .72); display: grid; place-items: center; color: #fff;
  font-family: var(--font-hand); font-size: 22px; text-align: center; padding: 20px;
}
.wait .sub { font-size: 15px; opacity: .8; margin-top: 8px; font-family: var(--font-ui); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 结局：一起按住 */
.finale { position: fixed; inset: 0; z-index: 115; display: grid; place-items: center; text-align: center; color: #fff; }
.finale .holder { display: flex; gap: clamp(20px, 8vw, 80px); justify-content: center; margin: 26px 0; }
.hand-pad {
  width: clamp(110px, 26vw, 150px); height: clamp(110px, 26vw, 150px); border-radius: 50%; border: 3px dashed rgba(255,255,255,.6);
  display: grid; place-items: center; transition: all .3s; position: relative; touch-action: none; user-select: none; -webkit-user-select: none;
  background: rgba(255,255,255,.08);
}
.hand-pad svg { width: 60%; height: 60%; opacity: .7; transition: opacity .3s; }
.hand-pad.mine { cursor: pointer; }
.hand-pad.on { border-style: solid; border-color: #ffe2a8; background: rgba(255, 214, 140, .25); box-shadow: 0 0 40px rgba(255, 214, 140, .7), inset 0 0 30px rgba(255, 214, 140, .4); }
.hand-pad.on svg { opacity: 1; }
.hand-pad .lbl { position: absolute; bottom: -30px; left: 0; right: 0; font-size: 15px; font-family: var(--font-hand); }

.credits { position: fixed; inset: 0; z-index: 125; overflow-y: auto; background: linear-gradient(#2a1f2e, #f2a77a 140%); color: #fff; text-align: center; }
.credits-inner { width: min(640px, 100%); margin: 0 auto; padding: 60px 20px 80px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.ticket {
  background: #fff8ea; color: var(--ink); border-radius: 14px; padding: 18px 22px; width: min(420px, 100%); position: relative; font-family: var(--font-hand);
  box-shadow: 0 16px 40px rgba(0,0,0,.35); text-align: left;
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 12px, #000 13px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 12px, #000 13px) right / 51% 100% no-repeat;
          mask: radial-gradient(circle at 0 50%, transparent 12px, #000 13px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 12px, #000 13px) right / 51% 100% no-repeat;
}
.ticket .tk-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ticket .from-to { font-size: 30px; }
.ticket .meta { font-size: 14px; color: var(--ink-soft); font-family: var(--font-ui); }

/* 设置 */
.set-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--paper-3); }
.set-row label { flex: 0 0 82px; font-family: var(--font-hand); font-size: 18px; }
.set-row input[type=range] { flex: 1; accent-color: var(--coral); }

/* 小屏适配 */
@media (max-width: 560px) {
  .icon-btn { width: 42px; height: 42px; }
  .icon-btn svg { width: 21px; height: 21px; }
  .chip { font-size: 15px; padding: 6px 12px 6px 8px; }
  .modal-body { padding: 6px 12px 16px; }
  .doc { padding: 18px 16px 22px; font-size: 17px; line-height: 30px; background-image: repeating-linear-gradient(transparent 0 29px, rgba(169, 219, 234, .55) 29px 30px); }
  .caption { bottom: 88px; font-size: 16px; }
  .inv-item { width: 46px; height: 46px; }
}
@media (max-height: 460px) {
  .inv-bar { min-height: 56px; padding: 5px 10px; }
  .inv-item { width: 44px; height: 44px; }
  .caption { bottom: 74px; }
  .story-text { bottom: calc(7vh + 6px); padding: 12px 18px 16px; min-height: 70px; }
  .chat-panel { top: 60px; max-height: calc(100dvh - 130px); }
}
.rotate-tip { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 25; background: rgba(251,244,230,.92); border-radius: 999px; padding: 6px 14px; font-size: 13px; box-shadow: var(--shadow); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
@media (orientation: landscape) { .rotate-tip { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 场景里转动的齿轮 */
.world .spin { transform-box: fill-box; transform-origin: center; }
.world .spin.run { animation: gearspin 9s linear infinite; }
.world .spin.run.rev { animation-direction: reverse; animation-duration: 5s; }
@keyframes gearspin { to { transform: rotate(360deg); } }

/* 嵌在双视角试玩页里 */
.embedded .rotate-tip { display: none; }

/* 动画：道具飞进物品栏、解谜闪光 */
.fly-icon { position: fixed; left: 0; top: 0; width: 64px; height: 64px; z-index: 400; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }
.fly-icon svg { width: 100%; height: 100%; }
.spark { position: fixed; left: -8px; top: -12px; z-index: 400; pointer-events: none; font-size: 22px; text-shadow: 0 0 10px rgba(255, 230, 160, .9); }
.glow-flash { position: fixed; inset: 0; z-index: 390; pointer-events: none; background: radial-gradient(circle at 50% 50%, rgba(255, 236, 180, .9), rgba(255, 236, 180, 0) 60%); }

/* 横屏的手机（高度很小）：场景左右两边本来就有空白，把按钮和物品栏放到两侧，不挡画面 */
@media (orientation: landscape) and (max-height: 520px) {
  .hud-top { top: 6px; bottom: 6px; left: max(6px, env(safe-area-inset-left)); right: max(6px, env(safe-area-inset-right)); }
  .hud-top > div:first-child { position: absolute; left: 0; top: 0; width: 66px; }
  .chip { flex-direction: column; gap: 2px; padding: 6px 4px; border-radius: 14px; max-width: 66px; text-align: center; }
  .chip .stop-name { display: none; }
  .chip .stop-no { font-size: 12px; padding: 2px 6px; }
  .partner { font-size: 10px; padding: 2px 5px; max-width: 66px; margin-left: 0; }
  .hud-btns { position: absolute; right: 0; top: 0; flex-direction: column; max-width: none; gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn svg { width: 20px; height: 20px; }
  .inv-bar { left: max(6px, env(safe-area-inset-left)); top: 92px; bottom: 6px; transform: none; flex-direction: column; width: 66px; max-width: none; overflow-y: auto; overflow-x: hidden; padding: 6px; min-height: 0; justify-content: flex-start; border-radius: 16px; }
  .inv-bar .empty { display: none; }
  /* 矮屏（横屏手机）：特写改成左右两栏——左边画面占满弹窗高度，右边说明和操作（验收 G-01b） */
  /* 左边那一栏：引擎在特写建好后给「第一块画面」（或包着它的那一层）加 cu-main（验收 C10-11：拼图、拨钟这类自己建画面的特写也要两栏） */
  .modal:has(.modal-body > .cu-main) { width: min(96vw, 900px); }
  .modal-body:has(> .cu-main) { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 14px; align-items: start; }
  .modal-body > .cu-main { grid-column: 1; grid-row: 1 / span 30; }
  .modal-body > .cu-main.closeup-stage { max-height: calc(100dvh - 86px); }
  .modal-body > .cu-main .closeup-stage { max-height: calc(100dvh - 150px); } /* 画面和按钮包在一起时，给按钮留地方 */
  .modal-body:has(> .cu-main) > :not(.cu-main) { grid-column: 2; }
  .modal-body > .closeup-stage.lock-deco { display: none; }
  /* 物品栏浮在特写上面时（左边一竖条），特写往右让开，不被盖住（直接动手：道具拖进特写） */
  body:has(.inv-bar.floating) .modal-back { padding-left: 84px; padding-bottom: 12px; }
  body:has(.inv-bar.floating) .modal { max-height: calc(100dvh - 24px); width: min(calc(100vw - 100px), 900px) !important; }
  body:has(.inv-bar.floating) .modal-body > .cu-main.closeup-stage { max-height: calc(100dvh - 104px); }
  .modal-body > .closeup-stage:only-child { max-height: calc(100dvh - 118px); }
  .modal:has(.modal-body > .closeup-stage:only-child) { width: auto !important; max-width: min(calc(100vw - 100px), 900px); }
  .modal:has(.modal-body > .closeup-stage:only-child) .closeup-stage { width: auto; height: calc(100dvh - 118px); }
  /* 拨号锁在矮屏上收紧：转轮小一点，「试开」放在转轮旁边，一屏看全（验收 C2-16b） */
  .dial-lock { flex-direction: row !important; flex-wrap: wrap; justify-content: center; gap: 10px !important; }
  .dial-lock .dial-face { font-size: 26px !important; width: 44px !important; height: 42px !important; }
  /* 矮屏上特写的说明字小一点、行距紧一点，按钮留在首屏（验收 C11-07b、第五章点歌卡） */
  .modal-body .closeup-note { font-size: 15px; line-height: 1.5; margin-top: 6px; }
  .modal-body .closeup-note.tip-line { display: none; }
  .lid-wheels > div > .hand { width: 50px !important; height: 50px !important; line-height: 50px !important; font-size: 30px !important; }
  .dial-lock .dial-btn { width: 48px !important; min-height: 30px !important; position: relative; }
  .dial-lock .dial-go { width: 48px !important; height: 48px !important; }
  .dial-lock .dial-btn::after { content: ''; position: absolute; inset: -7px -3px; } /* 看着小、点得大：点击范围上下各多出 7px（验收 C6-21：手指不好点） */
  .dial-lock > div:first-child { padding: 8px 10px !important; gap: 6px !important; }
  .flash-ask { top: 6px; width: calc(100% - 300px); padding: 4px 10px 6px; }
  .flash-ask .t { display: none; }
  .flash-ask .q { font-size: 16px; line-height: 1.35; }
  .caption.cap-top { top: 70px; }
  /* 大厅：左边房间码，右边两个人和「准备好了」，一屏看全（验收 S-12） */
  .panel-wrap:has(> .seats) { width: min(96vw, 900px); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px 14px; align-items: start; }
  .panel-wrap:has(> .seats) > .card:first-child { grid-row: 1 / span 3; }
  .panel-wrap:has(> .seats) > :not(:first-child) { grid-column: 2; }
  .panel-wrap:has(> .seats) .card { padding: 12px 14px; }
  .code-box { font-size: 28px; }
  .seat { padding: 8px 6px; } .seat .who { font-size: 20px; margin: 2px 0; }
  /* 「准备好了」放在小贴士上面，不用往下滚就能按 */
  .panel-wrap:has(> .seats) > .card:last-child { display: flex; flex-direction: column; }
  .panel-wrap:has(> .seats) > .card:last-child > .row { order: -1; margin: 0 0 8px !important; }
  .panel-wrap:has(> .seats) > .card:last-child > .hand { font-size: 15px !important; line-height: 1.55 !important; }
  .modal:has(.modal-body > .closeup-stage.lock-deco) { width: min(92vw, 640px); }
  .modal-body:has(> .closeup-stage.lock-deco) { display: block; } /* 竖条太窄，空着时的提示字挤成一团，干脆不显示 */
  .pan-arrow.left { left: 84px; } .pan-arrow.right { right: 58px; } /* 箭头放到物品栏和按钮列里面 */
  .inv-item { width: 50px; height: 50px; }
  .inv-item.sel { transform: translateX(6px); }
  /* 东西多了竖条装不下（验收 aa483e5 二：第 6 件在竖条外面、看不见点不到、手指一滚就变成拖东西）：6 件时缩小一点，7 件起排成两列 */
  .inv-bar:has(> .inv-item:nth-child(6)) { gap: 5px; padding: 5px; }
  .inv-bar:has(> .inv-item:nth-child(6)) .inv-item { width: 42px; height: 42px; }
  .inv-bar:has(> .inv-item:nth-child(6)) .inv-item svg { width: 32px; height: 32px; }
  .inv-bar:has(> .inv-item:nth-child(7)) { display: grid; grid-auto-flow: column; grid-template-rows: repeat(6, 42px); width: auto; bottom: auto; }
  body:has(.inv-bar.floating > .inv-item:nth-child(7)) .modal-back { padding-left: 116px; }
  .chat-panel { top: 8px; right: 56px; max-height: calc(100dvh - 16px); }
  .caption { bottom: 12px; max-width: calc(100vw - 170px); }
  .rotate-tip { display: none; }
}

/* ───────── 2.0：剧情动画 ───────── */
.cut { position: fixed; inset: 0; z-index: 900; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; }
.cut-stage, .cut-shot, .cut-fx, .fx-layer { position: absolute; inset: 0; }
.cut-shot svg, .fx-layer svg { width: 100%; height: 100%; display: block; }
.cut-fx, .fx-layer, .cut-noise { pointer-events: none; }
/* 光效层（混合模式）各自单独成层：底下的画面在动时，不用每一帧把整幅光效（渐变、颗粒滤镜）也重画一遍（iPad 卡顿，2026-11-23）。
   是光效层自己成层、外面那个 .cut-fx / .scene-fx 不成层，所以照样和底下的画面混合 */
.fx-layer, .cut-noise { will-change: transform; }
.cut-frame { position: absolute; left: 50%; top: 50%; width: var(--cut-width); aspect-ratio: 16 / 9; transform: translate(-50%, -50%); overflow: hidden; }
.cut-frame > .cam { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.cut-frame > .cam > svg { position: absolute; left: 0; top: 0; overflow: visible; transform: translateZ(0); }
.cut-noise { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: .9; mix-blend-mode: screen; image-rendering: pixelated; }
.cut::after { content: ''; position: absolute; inset: 0; background: var(--thru, #000); opacity: 0; transition: opacity .45s; pointer-events: none; }
.cut.thru::after { opacity: 1; }
/* 上下黑边：静止不动，不闪 */
.cut-bars .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height .8s ease; z-index: 3; pointer-events: none; }
.cut-bars .bar.top { top: 0; } .cut-bars .bar.bot { bottom: 0; }
.cut-bars.on .bar { height: 11.5%; }
.cut-sub { position: absolute; left: 50%; bottom: 13.5%; transform: translateX(-50%); z-index: 5; max-width: min(88vw, 900px); text-align: center; color: #fff8ec; font-family: "LXGW WenKai Screen", "Kaiti SC", KaiTi, serif; font-size: clamp(17px, 2.6vw, 27px); line-height: 1.55; text-shadow: 0 2px 6px rgba(0,0,0,.8), 0 0 18px rgba(0,0,0,.5); opacity: 0; transition: opacity .35s; pointer-events: none; padding: 0 16px; }
.cut-sub.on { opacity: 1; }
.cut-sub .txt { text-wrap: balance; }
.cut-sub .who { display: inline-block; margin-right: .6em; font-size: .78em; padding: 1px 10px; border-radius: 999px; background: rgba(255,255,255,.16); vertical-align: 2px; }
.cut-sub .who.zai { background: rgba(233,110,140,.42); } .cut-sub .who.bai { background: rgba(80,110,160,.5); }
.cut-sub .who.nai { background: rgba(140,150,120,.5); } .cut-sub .who.qin { background: rgba(170,120,70,.5); }
.cut-title { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; text-align: center; color: #fff4e2; font-family: "LXGW WenKai Screen", "Kaiti SC", KaiTi, serif; background: radial-gradient(circle at 50% 50%, rgba(40,28,30,.4), #000 75%); transition: opacity .8s; pointer-events: none; }
.cut-title.hidden { opacity: 0; }
.cut-title .t1 { font-size: clamp(14px, 2vw, 18px); letter-spacing: .4em; opacity: .75; }
.cut-title .t2 { font-size: clamp(30px, 6vw, 60px); letter-spacing: .12em; margin-top: 10px; }
.cut-title .t3 { font-size: clamp(14px, 2vw, 18px); opacity: .7; margin-top: 12px; }
.cut-ctrl { position: absolute; right: max(16px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); z-index: 8; display: flex; gap: 8px; opacity: .55; transition: opacity .3s; }
.cut.show-ctrl .cut-ctrl, .cut-ctrl:hover { opacity: 1; }
.cut-btn { font: inherit; font-size: 14px; color: #fff8ec; background: rgba(20,14,16,.55); border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 36px; }
.cut.paused .cut-sub::before { content: '已暂停 · 点「继续」'; display: block; font-size: .7em; opacity: .7; }
/* 场景里的画风光效层（跟着画面一起平移缩放） */
.world .fx-layer { pointer-events: none; }
.world .fx-layer svg { width: 100%; height: 100%; }
.stage .bars-h { display: none; }
.lead-chip { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(233,138,111,.9); color: #241c22; margin-left: 6px; }
.scene-veil { position: fixed; inset: 0; z-index: 800; background: #120c10; opacity: 0; transition: opacity .85s ease; pointer-events: none; }
.scene-veil.white { background: #fff6e8; }
.scene-veil.on { opacity: 1; pointer-events: auto; }
.scene-arrive { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 810; color: #fff8ec; font-family: "LXGW WenKai Screen", "Kaiti SC", KaiTi, serif; font-size: clamp(20px, 3.4vw, 34px); letter-spacing: .14em; text-shadow: 0 2px 12px rgba(0,0,0,.7); opacity: 0; transition: opacity .8s; pointer-events: none; text-align: center; padding: 0 16px; }
.scene-arrive.on { opacity: 1; }
.doc-page { background: #fbf6ea; color: #3b2a22; border-radius: 10px; padding: 18px 20px; box-shadow: inset 0 0 0 1px rgba(90,60,40,.15); }
.doc-page.paper { background: linear-gradient(#fbf6ea, #f4ead4); }
.doc-page .hand { white-space: pre-wrap; }
.doc-table { border-collapse: collapse; margin: 12px auto 0; font-size: 18px; }
.doc-table th, .doc-table td { border: 1px solid #c9b8a0; padding: 6px 12px; text-align: center; }
.doc-table th { background: #efe2c4; }
.embedded-cut { position: absolute; z-index: 5; }
.pan-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 6; width: 44px; height: 72px; border: 0; border-radius: 12px; background: rgba(36,28,34,.45); color: #fff8ec; font-size: 34px; line-height: 1; cursor: pointer; }
.pan-arrow.left { left: max(8px, env(safe-area-inset-left)); } .pan-arrow.right { right: max(8px, env(safe-area-inset-right)); }
.pan-arrow[hidden] { display: none; }
.scene-veil.quick { transition-duration: .35s; }
/* 场景里不能点的画（整屋夜色罩、烛光圈、光晕、前景装饰……）一律不挡点击，点击只落到能点的东西上（验收 C10-01：第十章夜色罩盖住了红烛和小座钟） */
.world > svg:not(.live-layer) *:not([data-hot]):not([data-hot] *) { pointer-events: none; }
.world > svg:not(.live-layer) [data-hot] { pointer-events: visiblePainted; }
.world > svg.live-layer { pointer-events: none; }
.stage-fill { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.stage-fill > canvas { object-fit: cover; position: absolute; inset: -6%; width: 112%; height: 112%; filter: blur(22px) brightness(.82) saturate(.9); }
.world > svg.live-layer [data-hot] { pointer-events: visiblePainted; cursor: pointer; }

/* ───── 点按手感（feel.js）：被点的东西做一个小动作 ───── */
.world [class*="feel-"] { transform-box: fill-box; } /* 只给正在做动作的元素用（它们一定没有自己的 transform 属性） */
.world .feel-swing { transform-origin: 50% 0%; animation: feelSwing 1.3s ease-out; }
.world .feel-rock { transform-origin: 50% 100%; animation: feelRock 1.1s ease-out; }
.world .feel-sway { transform-origin: 50% 100%; animation: feelSway 1.2s ease-in-out; }
.world .feel-shake { transform-origin: 50% 100%; animation: feelShake 0.9s ease-in-out; }
.world .feel-roll { animation: feelRoll 1.5s cubic-bezier(.2,.7,.3,1); }
.world .feel-flyoff { animation: feelFly 1.6s ease-in; }
.world .feel-nudge { transform-origin: 50% 100%; animation: feelNudge 0.35s ease-out; }
.world .feel-lift { transform-origin: 50% 100%; animation: feelLift 0.5s ease-out; }
.world .feel-squash { transform-origin: 50% 100%; animation: feelSquash 0.4s ease-out; }
.world .feel-blink { animation: feelBlink 0.45s steps(2); }
@keyframes feelSwing { 0% { transform: rotate(0); } 15% { transform: rotate(3.5deg); } 35% { transform: rotate(-2.6deg); } 55% { transform: rotate(1.6deg); } 75% { transform: rotate(-0.8deg); } 100% { transform: rotate(0); } }
@keyframes feelRock { 0% { transform: rotate(0); } 12% { transform: rotate(-4deg); } 30% { transform: rotate(3deg); } 50% { transform: rotate(-2deg); } 70% { transform: rotate(1deg); } 100% { transform: rotate(0); } }
@keyframes feelSway { 0%, 100% { transform: skewX(0); } 25% { transform: skewX(-4deg); } 55% { transform: skewX(3deg); } 80% { transform: skewX(-1.5deg); } }
@keyframes feelShake { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-2deg); } 30% { transform: rotate(2deg); } 45% { transform: rotate(-1.6deg); } 60% { transform: rotate(1.2deg); } 80% { transform: rotate(-0.5deg); } }
@keyframes feelRoll { 0% { transform: translateX(0) rotate(0); } 55% { transform: translateX(46px) rotate(220deg); } 80% { transform: translateX(38px) rotate(180deg); } 100% { transform: translateX(0) rotate(0); } }
@keyframes feelFly { 0% { transform: translate(0, 0); opacity: 1; } 45% { transform: translate(60px, -160px); opacity: 0; } 70% { transform: translate(-40px, -120px); opacity: 0; } 100% { transform: translate(0, 0); opacity: 1; } }
@keyframes feelNudge { 0% { transform: translateY(0); } 40% { transform: translateY(-3px) scale(1.01); } 100% { transform: translateY(0); } }
@keyframes feelLift { 0% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-8px) rotate(-2deg); } 100% { transform: translateY(0) rotate(0); } }
@keyframes feelSquash { 0% { transform: scale(1, 1); } 40% { transform: scale(1.05, 0.92); } 100% { transform: scale(1, 1); } }
@keyframes feelBlink { 0% { opacity: 1; } 50% { opacity: .6; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .world [class*="feel-"] { animation: none !important; } }

/* ───── 家具开合（house-extra.js 的 furnitureStage） ───── */
.furniture .f-front, .furniture .f-doorL, .furniture .f-doorR, .furniture .f-lid { transform-box: fill-box; transition: transform .6s cubic-bezier(.3,.7,.3,1); }
.furniture .f-inside { opacity: .15; transition: opacity .5s .15s; }
.furniture.f-open .f-inside { opacity: 1; }
.furniture.f-drawer .f-front { transform-origin: 50% 100%; }
.furniture.f-drawer.f-open .f-front { transform: translateY(58px) scale(1.06, .55); }
.furniture .f-doorL { transform-origin: 0% 50%; }
.furniture .f-doorR { transform-origin: 100% 50%; }
.furniture.f-open .f-doorL { transform: scaleX(.12) skewY(-6deg); }
.furniture.f-open .f-doorR { transform: scaleX(.12) skewY(6deg); }
.furniture.f-fridge .f-doorL { transform-origin: 100% 50%; }
.furniture.f-fridge.f-open .f-doorL { transform: scaleX(.1) skewY(5deg); }
.furniture .f-lid { transform-origin: 50% 0%; }
.furniture.f-open .f-lid { transform: translateY(-34px) scaleY(.35); }
/* 掉下来的树叶、羽毛；滚出去的球（feel.js 的 spawn） */
.world .fall-leaf { animation: fallLeaf 2.4s ease-in forwards; opacity: 0; }
@keyframes fallLeaf { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 50% { transform: translate(18px, 110px) rotate(140deg); } 100% { opacity: 0; transform: translate(-10px, 240px) rotate(300deg); } }
.world .roll-out { animation: rollOut 2.6s cubic-bezier(.2,.7,.3,1) forwards; transform-box: fill-box; transform-origin: center; }
@keyframes rollOut { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 70% { transform: translate(-140px, 40px) rotate(-560deg); opacity: 1; } 100% { transform: translate(-150px, 40px) rotate(-600deg); opacity: 0; } }
.world .feel-flip { transform-origin: 100% 100%; animation: feelFlip 1.4s ease-in-out; }
@keyframes feelFlip { 0%, 100% { transform: scale(1); } 40%, 60% { transform: scale(1.8, 2.2); } }
.world .feel-stretch { transform-origin: 50% 100%; animation: feelStretch 1.2s ease-in-out; }
@keyframes feelStretch { 0%, 100% { transform: scale(1, 1); } 45% { transform: scale(1.12, .9); } }

/* 场景比屏幕窄时（21:9 宽屏上一屏宽的场景），两边淡出到背景色，不硬切 */
.world.boxed { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 70px, #000 calc(100% - 70px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 70px, #000 calc(100% - 70px), transparent 100%); }

/* ───── 特写里能直接动手的零件（engine.js parts）───── */
.has-parts [data-part] { cursor: pointer; outline: none; }
.has-parts [data-part]:hover, .has-parts [data-part]:focus-visible { filter: brightness(1.15) drop-shadow(0 0 4px rgba(255, 214, 130, .95)); }
.has-parts [data-part].part-press { animation: partPress .25s ease-out; }
@keyframes partPress { 45% { filter: brightness(.78); } }
.has-parts [data-part].part-hint { animation: partHint 1.4s ease-in-out 1; }
@keyframes partHint { 0%, 100% { filter: none; } 35%, 60% { filter: brightness(1.25) drop-shadow(0 0 7px #ffd27a); } }
/* 拖着道具的时候，收道具的零件亮着 */
body.dragging-item .has-parts [data-part][data-accepts] { filter: drop-shadow(0 0 7px #ffd27a) brightness(1.1); }
/* 特写开着时物品栏浮在遮罩上面，可以直接把道具拖进特写 */
.inv-bar.floating { position: fixed; z-index: 120; }
.inv-bar.floating .empty { display: none; }
/* 物品栏浮在下面时，特写往上让出它的高度，最下面的按钮不被盖住 */
/* 横屏手机（矮屏）物品栏在左边一竖条，那边另有规则；这里只管物品栏在下面的情形（原来这两条写在后面，把矮屏的规则盖掉了，特写底下被裁掉一截） */
@media not all and (orientation: landscape) and (max-height: 520px) {
  body:has(.inv-bar.floating) .modal-back { padding-bottom: 96px; }
  body:has(.inv-bar.floating) .modal { max-height: calc(100dvh - 120px); }
}

/* 画面角上的小圆钮「重来」（只画 ↺，不写字；Ryan 2026-11-21：操作做在画面里，不另设文字按钮） */
.stage-reset { position: absolute; top: 8px; right: 8px; z-index: 2; width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(61, 48, 41, .55); background: rgba(255, 250, 240, .85); color: #5b4636; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.stage-reset:active { transform: translateY(2px); }

/* 拖着东西时顶上的「递给对方」：一只手 + 对方的名字（验收 aa483e5：怎么递东西没地方看得出来；特写开着时也在最上层） */
.give-zone { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 140; display: flex; align-items: center; gap: 8px; min-width: 120px; min-height: 52px; justify-content: center; padding: 6px 18px; border-radius: 999px; background: rgba(58, 46, 39, .88); color: #fff6e6; font-family: var(--font-hand); font-size: 20px; border: 3px dashed rgba(255, 246, 230, .6); animation: sayIn .25s ease-out; }
.give-zone.over { background: #e98a6f; border-color: #fff6e6; }
.give-zone * { pointer-events: none; }

/* 线索页翻页：纸左右两边只画箭头的小圆钮（验收 aa483e5） */
.doc-paged { position: relative; padding: 0 30px; }
.doc-flip { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(61, 48, 41, .45); background: rgba(255, 250, 240, .92); color: #5b4636; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); z-index: 2; }
.doc-flip.l { left: -8px; } .doc-flip.r { right: -8px; }
.doc-flip:active { transform: translateY(calc(-50% + 2px)); }
.doc-pageno { text-align: center; font-size: 13px; color: #a8937f; margin-top: 4px; }
/* 物品栏空着时浮在特写上面只剩一条白色小条（验收 aa483e5）：空着就不浮出来 */
.inv-bar.floating:not(:has(.inv-item)) { display: none; }

/* ───── 首页开场（沙漏 → KLOCC → 秒表准备界面 → 出发；js/opening.js） ───── */
@font-face { font-family: 'KloccPAR'; src: url('/fonts/parisienne-vr.woff2') format('woff2'); font-display: block; } /* V&R（只截了这三个字） */
@font-face { font-family: 'KloccZMX'; src: url('/fonts/zhimangxing-sub.woff2') format('woff2'); font-display: block; } /* 副标题（只截了用到的字） */
.opening { position: fixed; inset: 0; z-index: 95; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.opening canvas, .opening .op-main { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.opening .op-main { transform-origin: 50% 50%; }
.opening .op-fx { pointer-events: none; }
.opening .op-btn { position: absolute; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.opening .op-btn:focus-visible { outline: 2px solid rgba(255, 246, 230, .7); outline-offset: 2px; }
.opening .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.opening .sheen { animation: opSheen 1.8s ease-in-out infinite; transform-box: fill-box; }
.opening .sheen.r { animation-delay: .9s; }
@keyframes opSheen { 0% { transform: translateX(-60px) skewX(-20deg); opacity: 0; } 15% { opacity: .85; } 60% { transform: translateX(70px) skewX(-20deg); opacity: .85; } 61%, 100% { opacity: 0; transform: translateX(70px) skewX(-20deg); } }
.opening .pressGlow { animation: opPg 1.4s ease-in-out infinite; }
@keyframes opPg { 50% { opacity: .2; } }
body.opening-cover #app { visibility: hidden; } /* 开场盖满屏幕时底下的游戏不画（排版照旧，量字、量外框不受影响） */
body.opening-on .wait { display: none; } /* 开场 / 准备界面开着时不盖「正在连接」 */
