/* 温州玩家 · 1024分钟 —— 流程 UI 样式（W3）
   调性：温州手账 / 国风暖纸（2026-10-23 换肤）：宣纸底、墨字、朱砂与灯笼金点缀，
   与游戏世界的黑瓦白墙红灯笼同一世界。借鉴：Dave the Diver 拟物质感 + 江南百景图国风。
   所有页面在 390×844 完整显示；桌面端居中 9:16 容器，两侧留黑。 */

:root {
  --bg: #f4ecdc;            /* 宣纸底 */
  --bg-noise: rgba(146, 122, 82, 0.05);
  --panel: #fbf6ea;         /* 纸卡 */
  --panel2: #f0e6d2;
  --line: #d8cbae;          /* 纸纹线 */
  --ink: #33302a;           /* 墨字 */
  --text: #3a362e;
  --muted: #8d8474;
  --cyan: #b3432b;          /* 旧霓虹青 → 朱砂红（变量名保留，免改 ui.js） */
  --violet: #b98a2f;        /* 旧紫 → 灯笼金 */
  --warm: #c0392b;
  --hot: #c0392b;
  --ok: #4a7c3f;            /* 墨绿 */
  --night: #000;
  --lamp: #f6d58a;
  --radius: 14px;
  --btn-h: 52px;
  --shadow-hard: 0 3px 0 rgba(58, 48, 34, 0.28);   /* Dave 式硬投影 */
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Courier New", monospace;
  --dur: 0.35s;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

/* ---------- 9:16 容器 ---------- */
#app {
  position: relative;
  margin: 0 auto;
  height: 100vh;
  width: min(100vw, calc(100vh * 9 / 16));
  background: var(--bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
@supports (height: 100dvh) {
  #app { height: 100dvh; width: min(100vw, calc(100dvh * 9 / 16)); }
}

#game {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  background: var(--bg);
}

/* 层级：canvas(0) < hud(10) < dock(20) < overlay(30) < toast(40) */
#hud, #dock, #toast { position: absolute; left: 0; right: 0; }
#hud { top: 0; z-index: 10; pointer-events: none; padding-top: env(safe-area-inset-top, 0); }
#hud button { pointer-events: auto; }
#hud[hidden] { display: none; }
#dock { bottom: 0; z-index: 20; pointer-events: none; padding-bottom: env(safe-area-inset-bottom, 0); }
#dock > * { pointer-events: auto; }
#overlay { position: absolute; inset: 0; z-index: 30; }
#overlay[hidden] { display: none; }
#toast {
  top: calc(env(safe-area-inset-top, 0) + 14px);
  z-index: 40; pointer-events: none;
  display: flex; justify-content: center;
}

/* ---------- 通用 ---------- */
.page {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0) + 18px) 18px calc(env(safe-area-inset-bottom, 0) + 18px);
  /* 宣纸质感：细噪点 + 微暖渐变 */
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, var(--bg-noise) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, var(--bg-noise) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #f7f0e1 0%, #f1e8d4 100%);
  color: var(--text);
  overflow: hidden;
  animation: page-in var(--dur) ease-out both;
}
.page.dim { background: rgba(5, 7, 14, 0.82); }
.page.no-anim { animation: none; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

.scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: 0.02em; }
h1 { font-size: 24px; line-height: 1.3; }
h2 { font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--btn-h); padding: 0 20px;
  border: 2px solid #4a4133; border-radius: var(--radius);
  font: inherit; font-size: 17px; font-weight: 700;
  color: var(--ink); background: var(--panel);
  box-shadow: var(--shadow-hard);
  cursor: pointer; text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(58, 48, 34, 0.28); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; box-shadow: var(--shadow-hard); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn-primary {
  border-color: #7c2317;
  background: linear-gradient(180deg, #d4553a, var(--warm));
  color: #fff7ea;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--line); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 12px; }
.btn-row .btn { flex: 1 1 0; min-width: 0; padding: 0 10px; }
.btn-sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.brand-title { font-size: 14px; letter-spacing: 0.3em; color: var(--cyan); }
.brand-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }

.field { display: block; margin-top: 12px; }
.field-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; height: 48px; padding: 0 14px;
  border: 2px solid var(--line); border-radius: 12px;
  background: #fffdf6; color: var(--ink);
  font: inherit; font-size: 17px;
  outline: none;
}
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(179, 67, 43, 0.12); }
.input::placeholder { color: #b3a88f; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 0 rgba(58, 48, 34, 0.12);
}

/* 头像：圆形 tag 配色 + 图标 */
.ava {
  --c: var(--cyan);
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.35), transparent 50%), var(--c);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35), 0 0 12px color-mix(in srgb, var(--c) 55%, transparent);
  flex: 0 0 auto;
}
.hearts { color: var(--hot); letter-spacing: 1px; font-size: 14px; }
.hearts .off { color: #c9bfa8; }

/* ---------- S0 开局 ---------- */
.q { margin: 6px 0 14px; }
.tag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tag {
  --c: var(--cyan);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: 72px; padding: 8px 2px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 0 rgba(58, 48, 34, 0.14);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.08s;
}
.tag .ico { font-size: 24px; line-height: 1; }
.tag:active { transform: scale(0.96); }
.tag:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.tag[aria-pressed="true"] {
  border-color: var(--c);
  background: #fff4e4;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 55%, transparent);
}
.intro-foot { margin-top: auto; padding-top: 14px; }
/* 留白处的竖排诗句水印（谢灵运《登江中孤屿》）+ 小印 —— 江南百景图式留白
   （.page 本身是 absolute，已是伪元素的包含块，不能再改 position 以免破坏全屏布局） */
.page-intro::before {
  content: "云日相辉映，空水共澄鲜";
  position: absolute; right: 22px; top: 56%;
  writing-mode: vertical-rl; letter-spacing: 0.4em;
  color: rgba(58, 48, 34, 0.16); font-size: 15px; font-weight: 600;
  pointer-events: none;
}
.page-intro::after {
  content: "谢";
  position: absolute; right: 18px; top: calc(56% + 236px);
  width: 24px; height: 24px; line-height: 24px; text-align: center;
  font-size: 13px; font-weight: 800;
  color: rgba(179, 67, 43, 0.55); border: 2px solid rgba(179, 67, 43, 0.5);
  border-radius: 4px; transform: rotate(6deg);
  pointer-events: none;
}

/* ---------- S1 接团 ---------- */
.team-list { display: flex; flex-direction: column; gap: 10px; }
.guest-card {
  display: flex; align-items: center; gap: 12px;
  animation: slide-in 0.45s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes slide-in { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: none; } }
.guest-card .ava { width: 52px; height: 52px; font-size: 26px; }
.guest-body { flex: 1 1 auto; min-width: 0; }
.guest-name { font-weight: 700; font-size: 16px; }
.guest-line { color: var(--text); opacity: 0.85; margin-top: 2px; font-size: 15px; }
.team-foot { margin-top: auto; padding-top: 12px; }

/* ---------- S2 排路线 ---------- */
.hint { margin: 4px 0 10px; color: var(--muted); font-size: 13px; }
.preview-bar {
  display: flex; gap: 6px; justify-content: space-between;
  padding: 10px 8px; margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
}
.pv { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; }
.pv .ava { width: 36px; height: 36px; font-size: 18px; }
.pv-mood {
  position: absolute; top: -6px; right: calc(50% - 24px);
  font-size: 14px; line-height: 1;
  background: var(--bg); border-radius: 50%; padding: 1px;
  transition: transform 0.2s;
}
.pv-text {
  width: 100%; font-size: 10px; color: var(--muted); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pv[data-mood="happy"] .pv-text { color: var(--ok); }
.pv[data-mood="worry"] .pv-text { color: var(--warm); }
.place-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }
.place {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 62px; padding: 10px 12px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 2px 0 rgba(58, 48, 34, 0.14);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.place:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.place[aria-pressed="true"] { border-color: var(--cyan); background: #fff4e4; box-shadow: 0 2px 0 rgba(179, 67, 43, 0.4); }
.place-ico { font-size: 26px; width: 34px; text-align: center; flex: 0 0 auto; }
.place-body { flex: 1 1 auto; min-width: 0; }
.place-name { display: block; font-weight: 700; font-size: 16px; }
.place-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.place-no {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 700; font-size: 14px;
  background: var(--cyan); color: #fff7ea;
  visibility: hidden;
}
.place[aria-pressed="true"] .place-no { visibility: visible; }
.plan-foot { margin-top: 10px; display: flex; align-items: center; gap: 12px; }
.plan-count { font-family: var(--mono); color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- HUD ---------- */
.hud-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.mem {
  --heat: #ffd166;
  position: relative; flex: 1 1 auto; height: 14px;
  background: rgba(40, 32, 22, 0.85); border: 1px solid rgba(216, 203, 174, 0.45); border-radius: 4px;
  overflow: hidden;
}
.mem-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, #f6d58a, var(--heat));
  box-shadow: 0 0 10px var(--heat);
  transition: width 0.3s linear, background 0.6s, box-shadow 0.6s;
}
.mem-ticks {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg,
    transparent 0, transparent calc(3.125% - 1px),
    rgba(0,0,0,0.55) calc(3.125% - 1px), rgba(0,0,0,0.55) 3.125%);
}
.mem[data-heat="cool"] { --heat: #ffd166; }
.mem[data-heat="warm"] { --heat: #ff9d4d; }
.mem[data-heat="hot"]  { --heat: #ff5a4d; }
.mem-read {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  color: #fff7ea; letter-spacing: 0.08em; white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.mem-read span { color: #d8cbae; font-weight: 400; font-size: 11px; }
.mem-read[data-heat="warm"] { color: var(--warm); }
.mem-read[data-heat="hot"]  { color: var(--hot); }
.hud-pause {
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid rgba(58, 48, 34, 0.5); background: rgba(51, 46, 38, 0.85);
  color: #f4ecdc; font-size: 16px; cursor: pointer;
}
.hud-pause:focus-visible { outline: 2px solid var(--lamp); }
.hud-guests { display: flex; gap: 6px; padding: 2px 10px 6px; overflow: hidden; }
.hg {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 4px 2px 3px;
  background: rgba(51, 46, 38, 0.78); border: 1px solid rgba(216, 203, 174, 0.45); border-radius: 10px;
  backdrop-filter: blur(4px); color: #f4ecdc;
}
.hg .ava { width: 30px; height: 30px; font-size: 15px; }
.hg .hearts { font-size: 11px; line-height: 1.2; }
.hg-status { font-size: 10px; line-height: 1.2; min-height: 12px; color: var(--lamp); }
.hg[data-status="lost"] .hg-status { color: #b3a88f; }
.hg[data-status="lost"] .ava, .hg[data-status="home"] .ava { filter: grayscale(1) brightness(0.6); }
.hg[data-status="runaway"] .ava { animation: shake 0.6s infinite; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.hg-calm { display: flex; gap: 3px; height: 5px; }
.hg-calm i { width: 5px; height: 5px; border-radius: 50%; background: var(--lamp); }
.hg-calm i.used { background: rgba(244, 236, 220, 0.25); }

/* ---------- 停站卡 / 中断条（底部 dock） ---------- */
/* 停站卡 = 门票票根（Dave the Diver 式拟物）：纸底、撕边打孔、右侧斜盖朱砂印 */
.stay-card {
  position: relative;
  margin: 0 12px 12px;
  background: linear-gradient(180deg, #fdf8ec, #f6eeda);
  border: 2px solid #4a4133; border-radius: 14px;
  padding: 12px 66px 12px 14px;
  box-shadow: var(--shadow-hard), 0 8px 20px rgba(40, 30, 15, 0.18);
  animation: dock-in 0.3s ease-out both;
  cursor: pointer;
  overflow: hidden;
}
.stay-card::before { /* 打孔撕边：两排半圆凹槽 */
  content: ""; position: absolute; right: 52px; top: 0; bottom: 0; width: 2px;
  background: repeating-linear-gradient(180deg, transparent 0 6px, rgba(74, 65, 51, 0.5) 6px 8px);
  border-left: 1px dashed rgba(74, 65, 51, 0.55);
}
.stay-card::after { /* 朱砂印：斜盖「温州」 */
  content: "温州\A一日游";
  white-space: pre; text-align: center;
  position: absolute; right: 8px; top: 50%;
  width: 40px; padding: 6px 0;
  transform: translateY(-50%) rotate(8deg);
  font-size: 11px; font-weight: 800; line-height: 1.35; letter-spacing: 0.15em;
  color: #c0392b; border: 2px solid #c0392b; border-radius: 6px;
  background: rgba(192, 57, 43, 0.06);
  opacity: 0.85;
}
.stay-card.out { animation: dock-out 0.25s ease-in both; }
@keyframes dock-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes dock-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(24px); } }
.stay-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--cyan); }
.stay-head b { color: var(--ink); font-size: 15px; }
.stay-text { margin-top: 6px; font-size: 15px; color: var(--ink); }
.stay-src { margin-top: 4px; font-size: 11px; color: var(--muted); }

.interrupt {
  margin: 0 12px 12px;
  background: linear-gradient(180deg, #fdf8ec, #f6eeda);
  border: 2px solid #4a4133; border-radius: 14px;
  padding: 12px 12px 12px;
  box-shadow: var(--shadow-hard), 0 8px 20px rgba(40, 30, 15, 0.18);
  animation: dock-in 0.3s ease-out both;
}
.interrupt-title { font-size: 15px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.interrupt-title::before { content: "!"; width: 20px; height: 20px; border-radius: 6px; background: var(--warm); color: #fff7ea; font-family: var(--mono); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ring {
  --p: 0;
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--cyan) calc(var(--p) * 1%), rgba(255,255,255,0.12) 0);
  -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px);
  mask: radial-gradient(circle, transparent 7px, #000 8px);
}

/* ---------- 名人卡 ---------- */
.celeb-scene { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; perspective: 1000px; }
.celeb-card {
  position: relative; width: min(300px, 86%); aspect-ratio: 3 / 4.2;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  animation: flip-in 0.8s cubic-bezier(.2,.7,.2,1) both;
  cursor: pointer;
}
.celeb-card.done { animation: none; transform: rotateY(0deg); }
@keyframes flip-in {
  from { transform: rotateY(180deg) scale(0.7); opacity: 0; }
  40% { opacity: 1; }
  to { transform: rotateY(0deg) scale(1); opacity: 1; }
}
.face {
  position: absolute; inset: 0; border-radius: 20px; padding: 20px 18px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column;
}
.face.front {
  background: linear-gradient(165deg, #fdf6e6 0%, #f3e7cb 60%, #eeddb8 100%);
  border: 2px solid #4a4133;
  box-shadow: inset 0 0 0 4px rgba(185, 138, 47, 0.35), 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(255, 209, 102, 0.18);
  color: var(--ink);
}
.face.back {
  transform: rotateY(180deg);
  background: repeating-linear-gradient(45deg, #f3e7cb 0 8px, #ecdfc0 8px 16px);
  border: 2px solid #4a4133;
  align-items: center; justify-content: center; text-align: center; color: #6f6353; font-size: 13px;
}
.celeb-name { font-size: 30px; font-weight: 900; letter-spacing: 0.12em; color: var(--ink); }
.celeb-title { font-size: 13px; color: var(--cyan); margin-top: 4px; }
.celeb-text { flex: 1 1 auto; margin-top: 18px; font-size: 17px; line-height: 1.7; white-space: pre-line; overflow: auto; color: var(--ink); }
.celeb-src { font-size: 11px; color: var(--muted); text-align: right; }
.celeb-foot { padding-top: 14px; opacity: 0; transition: opacity 0.25s; }
.celeb-foot.ready { opacity: 1; }

/* ---------- 结算（旅行手账风） ---------- */
.res-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.res-cell { padding: 10px 6px; text-align: center; }
.res-cell .v { font-family: var(--mono); font-size: 20px; font-weight: 800; color: var(--cyan); }
.res-cell .k { font-size: 11px; color: var(--muted); margin-top: 2px; }
.res-cell.over .v { color: var(--hot); }
.res-title { text-align: center; margin: 12px 0 8px; }
.res-title .t {
  display: inline-block; padding: 6px 18px;
  font-size: 26px; font-weight: 900; letter-spacing: 0.2em; color: #fff7ea;
  background: linear-gradient(180deg, #d4553a, var(--warm));
  border: 2px solid #7c2317; border-radius: 10px;
  box-shadow: var(--shadow-hard);
  transform: rotate(-2deg);
}
.res-title .k { font-size: 12px; color: var(--muted); margin-top: 6px; }
.res-sec { font-size: 12px; color: var(--muted); margin: 12px 0 6px; letter-spacing: 0.1em; display: flex; align-items: center; gap: 8px; }
.res-sec::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.res-lines { display: flex; flex-direction: column; gap: 6px; }
.res-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.res-line .ava { width: 28px; height: 28px; font-size: 14px; }
.res-line .who { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.res-line .say { flex: 1 1 auto; min-width: 0; }
.res-know { display: flex; flex-direction: column; gap: 6px; }
.res-know li { list-style: none; font-size: 14px; padding: 9px 12px; background: var(--panel); border-radius: 10px; border: 1px solid var(--line); border-left: 4px solid var(--violet); color: var(--ink); }
.res-know .src { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.res-know ul, ul.res-know { margin: 0; padding: 0; }
.res-foot { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- 升华屏 ---------- */
.epi { background: #000; justify-content: center; align-items: center; text-align: center; padding: 40px 28px; animation: none; }
.epi-line { font-size: 19px; line-height: 1.9; color: #fff; white-space: pre-line; opacity: 0; transition: opacity 1s ease; margin: 10px 0; }
.epi-line.on { opacity: 1; }

/* ---------- 难度 ---------- */
.diff-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.diff {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 86px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.diff:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.diff:not(:disabled):hover { border-color: var(--cyan); }
.diff:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(1); }
.diff-ico { font-size: 30px; width: 40px; text-align: center; }
.diff-name { font-size: 18px; font-weight: 800; }
.diff-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.diff-lock { font-size: 12px; color: var(--muted); margin-left: auto; text-align: right; white-space: nowrap; }

/* ---------- 榜单 ---------- */
.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tab {
  flex: 1 1 0; min-height: 40px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab[aria-selected="true"] { color: #fff7ea; background: var(--cyan); border-color: #7c2317; }
.tab:focus-visible { outline: 2px solid var(--violet); }
.board { display: flex; flex-direction: column; gap: 6px; }
.board-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border-radius: 12px; font-size: 15px; }
.board-row .rank { font-family: var(--mono); color: var(--muted); width: 24px; }
.board-row .seat { font-family: var(--mono); color: var(--cyan); letter-spacing: 0.1em; }
.board-row .name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .val { font-family: var(--mono); font-weight: 700; }
.board-empty { color: var(--muted); text-align: center; padding: 30px 0; }
.board-foot { margin-top: auto; padding-top: 12px; }

/* ---------- 暂停 ---------- */
.pause { justify-content: center; align-items: center; gap: 14px; }
.pause h2 { font-size: 26px; letter-spacing: 0.3em; }

/* ---------- toast ---------- */
.toast-msg {
  padding: 10px 18px; border-radius: 999px;
  background: rgba(51, 46, 38, 0.95); border: 1px solid #6b5f4c;
  color: #f4ecdc; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  animation: toast-in 0.25s ease-out both;
}
.toast-msg.out { animation: toast-out 0.25s ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-10px); } }

/* ---------- 结尾（ending.js） ---------- */
.ending {
  background: var(--night); padding: 0; animation: none;
  justify-content: center; align-items: center;
  transition: background 0.8s ease;
}
.ending.lit { background: radial-gradient(ellipse at 50% 40%, #fff2c6 0%, #f3cf7f 45%, #c99a4a 100%); }
.ending-text {
  position: absolute; left: 24px; right: 24px; top: 44%;
  text-align: center; color: #fff; font-size: 22px; letter-spacing: 0.15em;
  transition: opacity 0.6s;
  white-space: pre;
}
.ending-text .caret { display: inline-block; width: 0.5em; border-bottom: 2px solid #fff; animation: caret 0.8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.yard { position: absolute; inset: 0; opacity: 0; transition: opacity 0.8s; }
.ending.lit .yard { opacity: 1; }
.alley {
  position: absolute; left: 0; top: 34%; width: 52px; height: 34%;
  background: linear-gradient(90deg, #2a1e12 0%, rgba(42,30,18,0.0) 100%);
}
.alley::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: #1a1209; }
.fig {
  position: absolute; width: 16px; height: 30px;
  transform: translate(-50%, -100%);
  transition: left 1s ease-in-out, top 1s ease-in-out, opacity 0.5s;
}
.fig::before {
  content: ""; position: absolute; left: 50%; top: 0; width: 12px; height: 12px;
  transform: translateX(-50%); border-radius: 50%; background: var(--fc, #5a3f2a);
}
.fig::after {
  content: ""; position: absolute; left: 50%; top: 12px; width: 16px; height: 18px;
  transform: translateX(-50%); border-radius: 5px 5px 3px 3px; background: var(--fb, #7a5a3a);
}
.fig.me { --fc: #2d3a5e; --fb: #35e0e0; }
.fig.shadow { --fc: #6e6e6e; --fb: #8a8a8a; opacity: 0; }
.fig.shadow.on { opacity: 1; }
.fig.step { transition: left 1s ease-in-out; }
.ending-btns {
  position: absolute; left: 18px; right: 18px; bottom: calc(env(safe-area-inset-bottom, 0) + 26px);
  display: flex; gap: 12px; opacity: 0; transition: opacity 0.4s;
}
.ending-btns.on { opacity: 1; }
.ending-btns .btn { flex: 1 1 0; min-width: 0; background: rgba(20,26,42,0.92); border-color: rgba(0,0,0,0.3); }
.ending-btns .cost { font-size: 12px; font-weight: 500; color: #8a9099; margin-left: 4px; }
.ending-black { position: absolute; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; letter-spacing: 0.15em; }

/* ---------- 降级：减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .celeb-card { animation: none; transform: none; }
  .guest-card { animation: none; }
  .epi-line { transition: none; }
  .ending { transition: none; }
}

/* ---------- 小屏兜底（<360 宽） ---------- */
@media (max-width: 359px) {
  .tag { min-height: 64px; font-size: 12px; }
  .tag .ico { font-size: 20px; }
  .btn { font-size: 15px; }
}

/* ---------- PRD-v2 增量 ---------- */
/* F3 横幅层 */
#banner {
  position: absolute; left: 0; right: 0;
  top: calc(env(safe-area-inset-top, 0) + 44px);
  z-index: 15; pointer-events: none;
  display: flex; justify-content: center; padding: 0 12px;
}
.banner {
  display: flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 8px 14px; border-radius: 14px;
  background: rgba(20,26,42,0.95); border: 1px solid rgba(166,108,255,0.5);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0; transform: translateY(-12px);
  transition: opacity 0.3s, transform 0.3s;
}
.banner.on { opacity: 1; transform: none; }
.banner.out { opacity: 0; transform: translateY(-12px); }
.banner .ava { width: 30px; height: 30px; font-size: 15px; }
.banner-body { display: flex; flex-direction: column; min-width: 0; }
.banner-body b { font-size: 13px; color: var(--warm); }
.banner-body span { font-size: 12px; color: var(--text); opacity: 0.85; }

/* F1 停站前台页 */
.stay-front { max-height: 62vh; overflow-y: auto; }
.stay-voices { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.sv-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sv-row .ava { width: 24px; height: 24px; font-size: 12px; }
.sv-text { flex: 1 1 auto; min-width: 0; color: var(--text); opacity: 0.9; }
.sv-star { flex: 0 0 auto; }
.stay-knowledge { margin-top: 10px; font-size: 15px; line-height: 1.6; color: #fff; border-left: 3px solid var(--violet); padding-left: 10px; }
.stay-foot { margin-top: 10px; }

/* F2 名人卡立绘 / 原作句 / 描字小游戏 */
.celeb-portrait {
  width: 72px; height: 72px; image-rendering: pixelated;
  border-radius: 10px; border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.3); margin-bottom: 8px;
}
.celeb-quote {
  margin-top: 12px; padding: 8px 10px;
  border-left: 3px solid var(--warm); background: rgba(179, 67, 43, 0.07);
}
.celeb-quote-text { font-size: 14px; color: var(--ink); font-weight: 600; }
.celeb-quote-src { font-size: 10px; color: var(--muted); margin-top: 2px; }
.celeb-text { flex: 0 1 auto; margin-top: 12px; }
.mg { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; }
.mg-canvas {
  width: min(240px, 60vw); height: min(240px, 60vw);
  background: rgba(0,0,0,0.35); border-radius: 12px;
  border: 1px solid var(--line); align-self: center; touch-action: none;
}
.mg-hint { font-size: 12px; color: var(--muted); text-align: center; }
.mg-foot { flex-direction: column; gap: 8px; }

/* F8 结算 */
.res-met { display: flex; gap: 8px; flex-wrap: wrap; }
.res-met .celeb-portrait { width: 48px; height: 48px; margin: 0; }
.res-met-name { font-size: 12px; color: var(--muted); }
.res-celebrity {
  margin-top: 10px; padding: 10px 12px;
  background: var(--panel); border-radius: 10px; font-size: 14px;
}
.res-celebrity b { color: var(--cyan); margin-right: 6px; }

/* F7 那句话的旅程 */
.mine-card { margin-top: 10px; text-align: center; padding: 18px 14px; }
.mine-label { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }
.mine-text { font-size: 20px; margin-top: 8px; }
.mine-note { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* ---------- PRD-v3：名人典故问答 ---------- */
.quiz { display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.quiz-hint { font-size: 14px; line-height: 1.6; color: var(--text); }
.quiz-sil { display: flex; gap: 10px; justify-content: center; padding: 6px 0; }
.quiz-head {
  width: 18px; height: 26px; border-radius: 9px 9px 4px 4px;
  background: #2c3448; border: 1px solid rgba(255,255,255,0.14);
}
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { min-height: 44px; font-size: 15px; }
.quiz-opt.right { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset, 0 0 14px rgba(94,230,168,0.35); }
.quiz-opt.wrong { opacity: 0.35; text-decoration: line-through; }
.quiz-win { font-size: 13px; color: var(--ok); text-align: center; }

/* ---------- PRD-v3：名人卡限高（foot 曾被挤出屏，实锤修复） ---------- */
.celeb-card { max-height: 54vh; aspect-ratio: auto; }
.celeb-scene { align-items: flex-start; padding-top: 6px; }
.celeb-card .face { overflow-y: auto; }
.celeb-text { font-size: 15px; }

/* ========== 网页版布局（桌面全屏） ==========
   手机版契约不变：390×844 竖屏完整可玩。
   宽屏（≥900px 且横比接近横屏）切网页版：画布全屏铺开，流程页变成
   居中悬浮纸卡（地图在卡外继续活着），HUD/底卡限宽居中，键鼠可玩。
   纯 CSS 媒体查询实现，不动的 JS。 */
@media (min-width: 900px) and (min-aspect-ratio: 4/5) {
  /* 画布全屏 */
  #app { width: 100vw; height: 100vh; }
  @supports (height: 100dvh) { #app { height: 100dvh; } }
  #game { cursor: crosshair; }

  /* 悬浮纸卡：absolute 居中（inset:0 + margin:auto） */
  #overlay:not([hidden]) { background: rgba(28, 22, 12, 0.42); }
  .page {
    inset: 0; margin: auto;
    width: min(480px, 92vw);
    height: min(900px, 94vh);
    border-radius: 22px;
    border: 2px solid #4a4133;
    box-shadow: 0 30px 90px rgba(15, 10, 4, 0.5), var(--shadow-hard);
  }
  /* 全屏气氛页不收卡：名人（dim）/升华/结尾/暂停保持铺满 */
  .page.dim, .epi, .ending { width: auto; height: auto; max-width: none; max-height: none; border: 0; border-radius: 0; box-shadow: none; margin: 0; }

  /* HUD 与底卡限宽居中 */
  .hud-bar, .hud-guests { max-width: 680px; margin-left: auto; margin-right: auto; }
  #dock .stay-card, #dock .interrupt { max-width: 640px; margin-left: auto; margin-right: auto; }
  #toast { max-width: 680px; margin: 0 auto; }

  /* 桌面操作提示（右下角小铭牌） */
  #app::after {
    content: "网页版 · WASD 移动 / 点击地面行走 · 点游客哄";
    position: absolute; right: 14px; bottom: 10px; z-index: 5;
    font-size: 12px; letter-spacing: 0.06em;
    color: rgba(244, 236, 220, 0.75);
    background: rgba(51, 46, 38, 0.55);
    padding: 4px 10px; border-radius: 999px;
    pointer-events: none;
  }

  /* 竖排诗句在桌面隐藏（伪元素出不了纸卡的 overflow，地图本身就是装饰） */
  .page-intro::before, .page-intro::after { display: none; }
}

/* v1.0 真实数据行 */
.place-real{display:block;color:#8a5a2b;font-size:11px;line-height:1.35;margin-top:2px}
.stay-real{margin:4px 0 6px;font-size:12px}
.res-reviews{display:flex;flex-direction:column;gap:8px;margin-bottom:10px}
.rev-card{padding:10px 12px;text-align:left}
.rev-head{display:flex;align-items:center;gap:8px}
.rev-head .avatar,.rev-head img,.rev-head canvas{width:28px;height:28px}
.rev-stars{margin-left:auto;color:#d08a1e;font-weight:700;letter-spacing:1px}
.rev-comment{margin:6px 0 4px;font-size:14px}
.rev-pro{color:#2e7d32;font-size:12px}.rev-con{color:#c0392b;font-size:12px}.rev-q{color:#1f6f8b;font-size:12px;margin-top:2px}
