/* 视觉小说交互层 · 明亮古风（与 CG 立绘 / 宫殿内景同一套语言）
 * 语言：米白纸本 + 描金双线 + 朱红点睛 + 细金边
 * 结构：金框 → 顶部（头像+信息框）→ 舞台 → 立绘 → 角色行 → 对白 → 行动条 → 面板 → 弹窗
 */

:root {
  --ink: #3b2a1d;
  --ink-soft: #6b5540;
  --ink-faint: #8f7a5e;
  --ivory: #fbf5e8;
  --paper: #f3e7d0;
  --panel: rgba(251, 245, 232, .94);
  --panel-solid: #fbf5e8;
  --gold: #c8a05a;
  --gold-deep: #a87d3a;
  --line: rgba(168, 125, 58, .38);
  --line-soft: rgba(168, 125, 58, .22);
  --vermilion: #a33b28;
  --vermilion-deep: #8a2f1f;
  --seal: #9a3d2b;
  --shadow: 0 18px 44px rgba(58, 38, 18, .30);
  --display: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  --frame: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body, figure, h1, h2, p, dl, dd, ul { margin: 0; }
ul { padding: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  background: #1a120c;
  font: 15px/1.8 "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

.vn-shell { position: fixed; inset: 0; overflow: hidden; }

/* ── 舞台 ─────────────────────────────────────────────── */
.stage { position: absolute; inset: 0; }
.stage-art {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  transition: opacity .5s ease;
}
.stage-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(26, 18, 12, .34) 0%, rgba(26, 18, 12, 0) 22%,
                    rgba(26, 18, 12, 0) 52%, rgba(26, 18, 12, .42) 78%, rgba(26, 18, 12, .68) 100%);
}

/* ── 描金外框：双线 + 四角回纹 ─────────────────────────── */
.vn-frame {
  position: absolute;
  inset: var(--frame);
  pointer-events: none;
  z-index: 30;
  border: 1px solid rgba(214, 176, 110, .75);
  box-shadow: inset 0 0 0 4px rgba(26, 18, 12, .18), inset 0 0 0 5px rgba(214, 176, 110, .35);
  border-radius: 3px;
}
.vn-frame::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(214, 176, 110, .30);
  border-radius: 2px;
}

/* ── 顶部：头像 + 信息框 ──────────────────────────────── */
.hud {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font: 700 21px/1 var(--display);
  color: var(--gold-deep);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, .55);
  flex: 0 0 auto;
}
.info-box {
  min-width: 236px;
  padding: 8px 18px 9px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, .45);
  backdrop-filter: blur(6px);
}
.info-box .date {
  font: 700 18px/1.4 var(--display);
  letter-spacing: .12em;
  color: var(--ink);
}
.info-box .meta {
  display: flex;
  gap: 18px;
  margin-top: 3px;
  font-size: 12.5px;
  letter-spacing: .05em;
  color: var(--ink-soft);
}
.info-box .meta b { color: var(--vermilion); font-weight: 700; }

/* 晋升进度 */
.progress-line {
  position: absolute;
  top: 96px;
  left: 86px;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  max-width: min(600px, calc(100% - 220px));
  font-size: 11.5px;
  color: #f6ecd8;
  text-shadow: 0 1px 6px rgba(26, 18, 12, .95);
}
.progress-line .p-title {
  padding: 1px 9px;
  color: #3b2a1d;
  background: rgba(251, 245, 232, .92);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.progress-line .done { color: #cfe6c4; }
.progress-line .miss { color: #f0c0a8; }

/* ── 立绘 ─────────────────────────────────────────────── */
.cast {
  position: absolute;
  left: 50%;
  bottom: 108px;
  transform: translateX(-50%);
  width: auto;
  height: min(88vh, 780px);
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 26px 46px rgba(40, 24, 10, .55));
  animation: cast-in .6s ease both;
}
.cast img { height: 100%; width: auto; display: block; }
.cast.photo img {
  -webkit-mask-image:
    linear-gradient(to bottom, #000 78%, transparent 99%),
    linear-gradient(to right, transparent 0%, #000 13%, #000 87%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, #000 78%, transparent 99%),
    linear-gradient(to right, transparent 0%, #000 13%, #000 87%, transparent 100%);
  mask-composite: intersect;
}
@keyframes cast-in {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ── 底部：角色行 / 对白 / 行动条 ─────────────────────── */
.bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 0 20px 16px;
  background: linear-gradient(180deg, rgba(26, 18, 12, 0) 0%, rgba(26, 18, 12, .30) 26%, rgba(26, 18, 12, .60) 100%);
}
.panel-sheet {
  padding: 10px 16px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, .45);
  backdrop-filter: blur(6px);
}
.nameplate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 7px;
  border-bottom: 1px solid var(--line-soft);
}
.nameplate .who { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.nameplate .who .n {
  font: 700 17px/1.2 var(--display);
  letter-spacing: .14em;
  color: var(--ink);
}
.nameplate .who .r {
  padding: 1px 8px;
  font-size: 12px;
  letter-spacing: .08em;
  color: #fff6e6;
  background: var(--vermilion);
  border-radius: 2px;
}
.nameplate .who .s { color: var(--ink-faint); font-size: 12px; letter-spacing: .05em; }
.leave {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}
.leave:hover { color: var(--vermilion); border-color: var(--vermilion); }

.dialogue {
  max-height: 26vh;
  overflow-y: auto;
  padding: 9px 2px 2px;
  cursor: pointer;
}
.dialogue .speaker {
  font: 700 14px/1.3 var(--display);
  letter-spacing: .14em;
  color: var(--vermilion);
  margin-bottom: 2px;
}
.dialogue .line {
  font-size: 16.5px;
  line-height: 1.95;
  color: var(--ink);
  white-space: pre-wrap;
}
.dialogue .line .caret {
  display: inline-block;
  width: .5em; height: .95em;
  margin-left: 2px;
  vertical-align: -.1em;
  background: var(--gold-deep);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.choices { display: grid; gap: 7px; margin-top: 9px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 13px;
  text-align: start;
  color: var(--ink);
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.choice:hover { background: #f7ecd6; border-color: var(--gold-deep); transform: translateX(3px); }
.choice .index {
  flex: 0 0 auto;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  font-size: 11px;
  color: #fff6e6;
  background: var(--vermilion);
  border-radius: 50%;
}

.scene-input { display: flex; gap: 8px; margin-top: 9px; }
.scene-input input {
  flex: 1;
  min-height: 42px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.form-error { color: var(--vermilion-deep); font-size: 12.5px; margin-top: 6px; }
.form-error:empty { display: none; }

/* 行动条 */
.actionbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-top: 10px;
}
.act {
  min-height: 46px;
  padding: 8px 4px;
  font-size: 14.5px;
  letter-spacing: .14em;
  color: var(--ink);
  background: #fdf8ec;
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 3px 0 rgba(168, 125, 58, .22);
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.act:hover { background: #f7ecd6; border-color: var(--gold-deep); }
.act:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(168, 125, 58, .22); }
.act.primary {
  color: #fff6e6;
  background: var(--vermilion);
  border-color: var(--vermilion-deep);
  box-shadow: 0 3px 0 rgba(120, 40, 24, .45);
}
.act.primary:hover { background: #b64530; }
.act.ghost { color: var(--ink-soft); }

/* ── 提示条 ───────────────────────────────────────────── */
.toast {
  position: absolute;
  left: 50%;
  bottom: 250px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(560px, calc(100% - 40px));
  padding: 10px 20px;
  font-size: 13.5px;
  text-align: center;
  color: #fff3e0;
  background: rgba(140, 48, 30, .96);
  border: 1px solid rgba(214, 176, 110, .55);
  border-radius: 3px;
  box-shadow: 0 12px 30px rgba(26, 18, 12, .55);
  animation: toast-in .18s ease both;
}
@keyframes toast-in { from { transform: translate(-50%, 10px); } to { transform: translate(-50%, 0); } }

/* ── 面板（舆图 / 事迹 / 档案 / 更多）────────────────── */
.panel-layer {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: rgba(20, 14, 9, .74);
  backdrop-filter: blur(3px);
}
.panel-card {
  position: relative;
  width: min(760px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 26px 28px;
  color: var(--ink);
  background-color: var(--panel-solid);
  background-image: var(--ui-texture, none);
  background-size: 460px;
  background-blend-mode: multiply;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 26px 60px rgba(26, 18, 12, .55), inset 0 0 0 3px rgba(255, 255, 255, .55);
  animation: card-in .18s ease both;
}
.panel-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  pointer-events: none;
}
@keyframes card-in { from { transform: translateY(10px); } to { transform: translateY(0); } }
.panel-card h2 {
  font: 700 21px/1.3 var(--display);
  letter-spacing: .16em;
  color: var(--ink);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  z-index: 2;
}
.panel-close:hover { color: var(--vermilion); border-color: var(--vermilion); }

.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.more-grid .act { min-height: 56px; }

.journal-list { display: grid; gap: 6px; }
.journal-entry {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--line-soft);
}
.journal-entry time { color: var(--ink-faint); font-size: 12px; }
.journal-entry.bad { color: var(--vermilion-deep); }
.journal-entry.event { color: #8a5a22; }

.attr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; font-size: 13px; }
.attr-row { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dotted var(--line-soft); }
.attr-name { color: var(--ink-faint); }
.attr-val { color: var(--vermilion-deep); font-weight: 700; text-align: end; }
.sheet-note { color: var(--ink-soft); font-size: 12.5px; margin-top: 10px; line-height: 1.8; }

/* 舆图：等距轻 3D */
.map-wrap {
  display: grid;
  place-items: center;
  padding: 10px 0 24px;
  background-image: var(--ui-map, none);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.map-board {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  grid-auto-rows: 120px;
  gap: 6px;
  transform: rotateX(52deg) rotateZ(45deg);
  transform-style: preserve-3d;
}
.map-tile {
  position: relative;
  display: grid;
  place-items: center;
  padding: 4px;
  text-align: center;
  font: 700 15px/1.2 var(--display);
  letter-spacing: .06em;
  color: #3a2f22;
  background: linear-gradient(160deg, #f6ecd6, #e2cfa8);
  border: 1px solid var(--gold-deep);
  border-radius: 3px;
  box-shadow: 0 10px 0 #b99a63, 0 14px 22px rgba(60, 40, 18, .45);
  transform: translateZ(0);
  transform-style: preserve-3d;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.map-tile:hover { transform: translateZ(14px); background: linear-gradient(160deg, #fdf6e4, #ecd9b4); }
.map-tile[aria-pressed="true"] {
  background: linear-gradient(160deg, #f8dcc0, #e0a97f);
  box-shadow: 0 10px 0 var(--vermilion-deep), 0 18px 28px rgba(60, 40, 18, .5);
  color: #6d2417;
}
.map-tile .tile-face {
  display: block;
  transform: rotateZ(-45deg) rotateX(-52deg);
  transform-origin: center;
  pointer-events: none;
}
.map-tile small { display: block; font: 400 10px/1.4 sans-serif; color: #7a6544; letter-spacing: .03em; }
.map-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.map-caption { color: var(--ink-soft); font-size: 13px; }

/* ── 弹窗（档册 / 确认）──────────────────────────────── */
dialog.vn-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(620px, calc(100% - 32px));
  max-height: min(86dvh, 900px);
  padding: 26px 28px;
  color: var(--ink);
  background-color: var(--panel-solid);
  background-image: var(--ui-texture, none);
  background-size: 460px;
  background-blend-mode: multiply;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 26px 60px rgba(26, 18, 12, .6), inset 0 0 0 3px rgba(255, 255, 255, .55);
  overflow: auto;
}
dialog.vn-modal::backdrop { background: rgba(26, 18, 12, .62); }
.modal-title {
  font: 700 21px/1.35 var(--display);
  letter-spacing: .14em;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-text { white-space: pre-line; margin-bottom: 14px; color: var(--ink-soft); }
.modal-btn {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  color: var(--ink);
  background: #fdf8ec;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.modal-btn:hover { background: #f7ecd6; border-color: var(--gold-deep); }
.slot-list { display: grid; gap: 8px; margin: 10px 0 12px; }
.slot-row { padding: 10px 12px; background: #fffdf6; border: 1px solid var(--line-soft); border-radius: 2px; }
.slot-head { font-weight: 700; color: var(--ink); }
.slot-sub { font-size: 12px; color: var(--ink-faint); }
.slot-actions { display: flex; gap: 8px; margin-top: 6px; }
.slot-btn {
  min-height: 34px;
  padding: 4px 14px;
  color: var(--ink);
  background: #fdf8ec;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.slot-btn:hover { background: #f7ecd6; border-color: var(--gold-deep); }

/* ── 幕（封面 / 领牌 / 结局）────────────────────────── */
.curtain {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 38%, rgba(26, 18, 12, .10), rgba(26, 18, 12, .55));
}
.curtain-card {
  position: relative;
  width: min(720px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 36px 34px;
  background-color: var(--panel-solid);
  background-image: var(--ui-texture, none);
  background-size: 460px;
  background-blend-mode: multiply;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 30px 70px rgba(26, 18, 12, .6), inset 0 0 0 4px rgba(255, 255, 255, .6);
}
.curtain-card::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  pointer-events: none;
}
.curtain .game-title {
  font: 700 36px/1.25 var(--display);
  letter-spacing: .18em;
  color: var(--ink);
}
.curtain .game-subtitle { color: var(--ink-faint); margin: 8px 0 18px; letter-spacing: .1em; }
.origin-story, .ending-text {
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 2.05;
  text-align: start;
  white-space: pre-line;
  margin-bottom: 20px;
}
.ending-role { color: var(--ink-faint); margin-bottom: 16px; }
.ending-cond { text-align: start; padding: 12px 0; border-top: 1px solid var(--line-soft); color: var(--ink-soft); }
.ending-cond h2 { font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.ending-cond ul { padding-inline-start: 20px; }
.ending-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.curtain .start-btn {
  min-height: 46px;
  padding: 9px 34px;
  color: #fff6e6;
  background: var(--vermilion);
  border: 1px solid var(--vermilion-deep);
  border-radius: 2px;
  letter-spacing: .2em;
  box-shadow: 0 3px 0 rgba(120, 40, 24, .4);
}
.curtain .start-btn:hover { background: #b64530; }

/* ── 响应式 ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .cast { height: min(66vh, 520px); bottom: 196px; }
  .dialogue { max-height: 30vh; }
}

@media (max-width: 710px) {
  :root { --frame: 6px; }
  .hud { top: 12px; left: 12px; gap: 8px; }
  .avatar { width: 44px; height: 44px; font-size: 16px; }
  .info-box { min-width: 0; padding: 6px 11px 7px; }
  .info-box .date { font-size: 14px; letter-spacing: .06em; }
  .info-box .meta { gap: 12px; font-size: 11px; }
  .progress-line { top: 78px; left: 12px; max-width: calc(100% - 24px); font-size: 10px; }
  .cast { height: 58vh; width: 100%; bottom: 214px; }
  .cast img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; }
  .bottom { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .panel-sheet { padding: 8px 11px 10px; }
  .nameplate { font-size: 11.5px; padding-bottom: 6px; }
  .nameplate .who .n { font-size: 15px; }
  .dialogue { max-height: 28vh; padding: 7px 0 2px; }
  .dialogue .line { font-size: 14.5px; line-height: 1.85; }
  .actionbar { gap: 6px; margin-top: 8px; }
  .act { min-height: 42px; font-size: 12.5px; letter-spacing: .06em; }
  .more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast { bottom: 270px; font-size: 12.5px; padding: 8px 14px; }
  .map-board {
    grid-template-columns: repeat(3, 74px);
    grid-auto-rows: 74px;
    gap: 5px;
    transform: rotateX(52deg) rotateZ(45deg) scale(.74);
  }
  .panel-card { padding: 20px 16px; }
  .curtain-card { padding: 24px 18px; }
  .curtain .game-title { font-size: 27px; }
}

/* ══════════════════════════════════════════════════════════
   第四版增补：状态条 / 进度条 / 卷轴面板 / 图标按钮 / 等距建筑
   ══════════════════════════════════════════════════════════ */

/* ── 顶部状态条：疲劳 / 心情 / 健康 ────────────────────── */
.status-strip {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 8;
  display: grid;
  gap: 6px;
  width: 190px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, .45);
  backdrop-filter: blur(6px);
}
.status-row { display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 6px; }
.status-row .k { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .08em; }
.status-row .v { font-size: 11.5px; color: var(--ink); text-align: end; font-variant-numeric: tabular-nums; }
.status-track { display: block; height: 7px; background: #d8c39d; border-radius: 4px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(90, 62, 30, .25); }
.status-fill { display: block; height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.status-fill.fatigue { background: linear-gradient(90deg, #c98a3c, #a45f18); }
.status-fill.mood { background: linear-gradient(90deg, #86b46e, #527f42); }
.status-fill.health { background: linear-gradient(90deg, #d0755f, #a1432f); }

/* ── 晋升进度条 ───────────────────────────────────────── */
.progress-line {
  position: absolute;
  top: 96px;
  left: 86px;
  z-index: 8;
  display: grid;
  gap: 5px;
  width: min(430px, calc(100% - 300px));
  padding: 9px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow), inset 0 0 0 3px rgba(255, 255, 255, .45);
  backdrop-filter: blur(6px);
}
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: .08em;
}
.progress-head b { color: var(--vermilion); font-size: 12.5px; }
.prog-row { display: grid; grid-template-columns: 32px 1fr 46px; align-items: center; gap: 7px; }
.prog-row .k { font-size: 11px; color: var(--ink-faint); }
.prog-row .v { font-size: 11px; color: var(--ink-soft); text-align: end; font-variant-numeric: tabular-nums; }
.prog-track { display: block;
  position: relative;
  height: 9px;
  background: #dcc7a0;
  border: 1px solid rgba(168, 125, 58, .45);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(90, 62, 30, .2);
}
.prog-fill { display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d9a94f, #a87319);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .35);
  transition: width .7s cubic-bezier(.2, .8, .2, 1);
}
.prog-row.done .prog-fill { background: linear-gradient(90deg, #9cc47e, #4f7a3d); }
.prog-row.done .v { color: #4f7a3d; }
.prog-row .tick { color: #6f9a5c; }

/* ── 卷轴面板（事迹 / 卡片通用）───────────────────────── */
.scroll-card {
  position: relative;
  padding: 18px 20px 20px;
  background:
    linear-gradient(180deg, #fdf7ea, #f4e8d2);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .5), 0 10px 26px rgba(60, 40, 18, .22);
}
.scroll-card::before,
.scroll-card::after {
  content: "";
  position: absolute;
  top: -1px; bottom: -1px;
  width: 10px;
  background: linear-gradient(90deg, #d9b970, #b98f42, #d9b970);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45);
}
.scroll-card::before { left: -10px; }
.scroll-card::after { right: -10px; }
.scroll-tab {
  position: absolute;
  left: -32px;
  top: 22px;
  padding: 10px 6px;
  writing-mode: vertical-rl;
  font: 700 15px/1.2 var(--display);
  letter-spacing: .3em;
  color: #fff4dd;
  background: linear-gradient(180deg, #b4503a, #8a2f1f);
  border: 1px solid #7a2a1c;
  border-radius: 2px;
  box-shadow: 0 4px 10px rgba(90, 40, 20, .35);
}
.scroll-tassel {
  position: absolute;
  left: -26px;
  top: 92px;
  width: 2px; height: 26px;
  background: #b4503a;
}
.scroll-tassel::after {
  content: "";
  position: absolute;
  left: -4px; top: 24px;
  width: 10px; height: 14px;
  background: #b4503a;
  border-radius: 40% 40% 50% 50%;
}

/* 四角花枝装饰 */
.ornate { position: relative; }
.ornate::before, .ornate::after {
  content: "";
  position: absolute;
  width: 54px; height: 54px;
  background:
    radial-gradient(circle at 18px 18px, rgba(232, 180, 188, .95) 0 5px, transparent 6px),
    radial-gradient(circle at 30px 12px, rgba(242, 213, 216, .9) 0 4px, transparent 5px),
    radial-gradient(circle at 12px 30px, rgba(242, 213, 216, .8) 0 3px, transparent 4px),
    radial-gradient(circle at 26px 26px, rgba(111, 154, 92, .85) 0 3px, transparent 4px);
  opacity: .9;
  pointer-events: none;
}
.ornate::before { top: -6px; left: -6px; }
.ornate::after { bottom: -6px; right: -6px; transform: rotate(180deg); }

/* ── 图标按钮 ─────────────────────────────────────────── */
.act { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.act .ico { width: 18px; height: 18px; flex: 0 0 auto; }
.act .ico path, .act .ico circle, .act .ico rect, .act .ico polygon { stroke: currentColor; fill: none; stroke-width: 1.6; }
.act.primary .ico path, .act.primary .ico circle, .act.primary .ico rect { stroke: #fff1da; }

/* 底部主菜单：五格 */
.actionbar .act { flex-direction: column; gap: 3px; min-height: 58px; font-size: 12.5px; letter-spacing: .1em; }
.actionbar .act .ico { width: 22px; height: 22px; }

/* ── 生涯面板 ─────────────────────────────────────────── */
.career-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .career-grid { grid-template-columns: minmax(0, 1fr); } }

.rank-path { display: grid; gap: 7px; }
.rank-step {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  background: #fffdf6;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}
.rank-step.done { opacity: .72; }
.rank-step.current {
  background: linear-gradient(90deg, #fdf1dd, #f8e6c8);
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 1px rgba(168, 125, 58, .35) inset;
}
.rank-step.locked { opacity: .55; }
.rank-step .idx {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  font-size: 11px;
  color: #fff6e6;
  background: var(--gold-deep);
  border-radius: 50%;
}
.rank-step.current .idx { background: var(--vermilion); }
.rank-step .nm { font: 700 14px/1.3 var(--display); letter-spacing: .1em; color: var(--ink); }
.rank-step .duty { font-size: 11.5px; color: var(--ink-faint); }
.rank-step .lock { font-size: 12px; color: var(--ink-faint); }

.skill-row { display: grid; grid-template-columns: 54px 1fr 56px; align-items: center; gap: 8px; margin-bottom: 8px; }
.skill-row .nm { font-size: 12.5px; color: var(--ink-soft); }
.skill-row .lv { font-size: 11.5px; color: var(--inksoft, var(--ink-soft)); text-align: end; }
.skill-track { display: block; height: 8px; background: #dcc7a0; border-radius: 999px; overflow: hidden; border: 1px solid rgba(168,125,58,.3); }
.skill-fill { display: block; height: 100%; background: linear-gradient(90deg, #b5cf92, #5f8a46); transition: width .6s ease; }

.cond-list { display: grid; gap: 5px; margin-top: 6px; }
.cond-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.cond-item .box {
  width: 15px; height: 15px;
  border: 1px solid var(--line);
  border-radius: 2px;
  display: grid; place-items: center;
  font-size: 10px;
  color: #fff;
  background: #fffdf6;
}
.cond-item.ok .box { background: #6f9a5c; border-color: #5a7f49; }
.cond-item.ok { color: #4f7a3d; }

.remark {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  background: #fdf6e6;
  border-left: 3px solid var(--gold-deep);
}

/* ── 人物面板 ─────────────────────────────────────────── */
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 860px) { .people-grid { grid-template-columns: minmax(0, 1fr); } }
.npc-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: #fffdf6;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}
.npc-card .face {
  width: 52px; height: 68px;
  object-fit: cover;
  object-position: 50% 12%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #eadfc8;
}
.npc-card .nm { font: 700 14px/1.3 var(--display); letter-spacing: .08em; color: var(--ink); }
.npc-card .role { font-size: 11.5px; color: var(--ink-faint); }
.npc-card .state { font-size: 11.5px; color: var(--vermilion); }
.npc-bars { display: grid; gap: 4px; margin-top: 6px; }
.npc-bar { display: grid; grid-template-columns: 28px 1fr 24px; align-items: center; gap: 6px; }
.npc-bar .k { font-size: 10.5px; color: var(--ink-faint); }
.npc-bar .v { font-size: 10.5px; text-align: end; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.npc-track { display: block; height: 6px; background: #e8d9bd; border-radius: 999px; overflow: hidden; }
.npc-fill { display: block; height: 100%; transition: width .5s ease; }
.npc-fill.favor { background: linear-gradient(90deg, #e0b48a, #b4513c); }
.npc-fill.love { background: linear-gradient(90deg, #e8b4bc, #c2748a); }

/* ── 等距地图：建筑 ───────────────────────────────────── */
.map-scene {
  position: relative;
  height: min(46vh, 380px);
  background: radial-gradient(ellipse at 50% 60%, rgba(255, 246, 226, .9), rgba(233, 216, 184, .6) 60%, rgba(214, 194, 160, .5));
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
}
.map-ground {
  position: absolute;
  left: 50%; top: 52%;
  width: 560px; height: 560px;
  transform: translate(-50%, -50%) rotateX(58deg) rotateZ(45deg);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  transform-style: preserve-3d;
}
.map-plot { position: relative; transform-style: preserve-3d; }
.map-plot .ground {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #efe0c0, #dcc9a1);
  border: 1px solid rgba(150, 118, 66, .45);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .4) inset;
}
.map-plot button { position: absolute; inset: 0; background: transparent; border: 0; }
.map-building {
  position: absolute;
  left: 50%; bottom: 14%;
  width: 84%; height: auto;
  transform: translateX(-50%) rotateZ(-45deg) rotateX(-58deg);
  transform-origin: 50% 100%;
  transition: transform .2s ease, filter .2s ease;
  filter: drop-shadow(0 10px 8px rgba(80, 50, 20, .35));
  pointer-events: none;
}
.map-plot:hover .map-building { transform: translateX(-50%) translateY(-6px) rotateZ(-45deg) rotateX(-58deg); }
.map-plot.current .ground { background: linear-gradient(160deg, #f7e2c4, #e2b992); box-shadow: 0 0 0 2px var(--vermilion) inset; }
.map-plot.current .map-building { filter: drop-shadow(0 12px 10px rgba(80, 50, 20, .45)) saturate(1.1); }
.map-label {
  position: absolute;
  left: 50%; top: -4px;
  width: 96px; margin-left: -48px;
  text-align: center;
  transform: rotateZ(-45deg) rotateX(-58deg);
  transform-origin: 50% 100%;
  font: 700 12px/1.2 var(--display);
  letter-spacing: .08em;
  color: #4a3a22;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
  pointer-events: none;
}
.map-legend { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

@media (max-width: 710px) {
  .status-strip { top: auto; bottom: 128px; right: 8px; width: 132px; padding: 7px 9px; gap: 4px; }
  .status-row { grid-template-columns: 26px 1fr 24px; }
  .status-row .k, .status-row .v { font-size: 10px; }
  .progress-line { top: 74px; left: 8px; width: calc(100% - 16px); padding: 7px 9px; }
  .prog-row { grid-template-columns: 26px 1fr 40px; }
  .scroll-card::before, .scroll-card::after { display: none; }
  .scroll-tab { position: static; writing-mode: horizontal-tb; display: inline-block; margin-bottom: 8px; padding: 4px 10px; }
  .scroll-tassel { display: none; }
  .map-scene { height: 40vh; }
  .map-ground { width: 400px; height: 400px; }
}

/* 风云四线 */
.route-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.route-item:last-of-type { border-bottom: 0; }
.route-item .rn {
  flex: 0 0 auto;
  padding: 1px 8px;
  font: 700 12px/1.4 var(--display);
  letter-spacing: .1em;
  color: var(--ink-soft);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}
.route-item.on .rn { color: #fff6e6; background: var(--vermilion); border-color: var(--vermilion-deep); }
.route-item.on { color: var(--ink); }

/* 剧情弹窗 */
.scene-layer { z-index: 26; }
.scene-card {
  width: min(560px, calc(100% - 32px));
  max-height: min(80dvh, 720px);
  overflow: auto;
  padding: 26px 26px 20px;
}
.scene-card h2 { border-bottom: 1px solid var(--line-soft); }
.scene-text {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 2;
  white-space: pre-line;
  margin: 4px 0 16px;
}
.scene-actions { display: grid; gap: 8px; margin-top: 4px; }
.scene-actions .choice { padding: 11px 14px; font-size: 14.5px; }
.scene-actions .act { min-height: 44px; }


/* ══════════════════════════════════════════════════════════
   V5：用 gpt-image-2 生成的 UI 素材替换纯 CSS 部件
   ══════════════════════════════════════════════════════════ */

/* 主按钮：朱红描金匾额 */
.actionbar .act.primary,
.scene-actions .act.primary,
.curtain .start-btn {
  position: relative;
  background: none;
  border: 0;
  box-shadow: none;
  color: #fff3dc;
  text-shadow: 0 1px 2px rgba(90, 20, 10, .7);
  padding: 12px 22px;
  isolation: isolate;
}
.actionbar .act.primary::before,
.scene-actions .act.primary::before,
.curtain .start-btn::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: url("../assets/ui/ui_btn_red-a.png") center / 100% 100% no-repeat;
}
.actionbar .act.primary { min-height: 58px; }
.actionbar .act.primary .ico path,
.actionbar .act.primary .ico circle { stroke: #ffe9c6; }

/* 标题牌匾 */
.panel-card h2,
.scene-card h2 {
  position: relative;
  background: none;
  border-bottom: 0;
  padding: 12px 26px;
  margin: -6px 0 14px;
  color: #5a3a1c;
  text-align: center;
  isolation: isolate;
}
.panel-card h2::before,
.scene-card h2::before {
  content: "";
  position: absolute;
  inset: -12px -20px -10px;
  z-index: -1;
  background: url("../assets/ui/ui_plaque_gold-a.png") center / 100% 100% no-repeat;
}

/* 进度条：金属卷草框 + 内部填充 */
.status-track,
.prog-track,
.skill-track {
  background-image: url("../assets/ui/ui_progress_frame-a.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-color: #efe3c8;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: 14px;
  padding: 4px 14px;
  display: flex;
  align-items: center;
}
.status-track { height: 13px; padding: 3px 12px; }
.skill-track { height: 14px; padding: 4px 12px; }
.status-fill, .prog-fill, .skill-fill { border-radius: 999px; height: 6px; }
.act .prog-fill, .status-track .status-fill { box-shadow: none; }

/* 卷轴面板：上下加木轴 */
.scroll-card {
  padding: 26px 22px 30px;
}
.scroll-card::before, .scroll-card::after {
  content: "";
  position: absolute;
  left: -6px; right: -6px;
  height: 22px;
  background-image: url("../assets/ui/ui_scroll_rod-a.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 3px 4px rgba(80, 50, 20, .22));
  pointer-events: none;
}
.scroll-card::before { top: -16px; }
.scroll-card::after { bottom: -16px; }
.scroll-tab { top: 26px; }

/* 四角花枝：用生成的花枝贴图 */
.ornate::before, .ornate::after {
  width: 150px; height: 150px;
  background: url("../assets/ui/ui_corner_floral-a.png") center / contain no-repeat;
  opacity: .95;
}
.ornate::before { top: -26px; left: -26px; }
.ornate::after { bottom: -26px; right: -26px; transform: rotate(180deg); }

/* 等距建筑：改用生成的立绘，白底用 multiply 抠掉 */
.map-building {
  width: 92%;
  filter: drop-shadow(0 8px 6px rgba(80, 50, 20, .28));
}
.map-plot.current .map-building { filter: drop-shadow(0 10px 8px rgba(80, 50, 20, .38)) saturate(1.08); }


/* 次级按钮也用描金牌匾（与参考图一致的统一边框）*/
.actionbar .act:not(.primary),
.more-grid .act,
.scene-actions .choice,
.panel-card .act {
  position: relative;
  background: none;
  border: 0;
  box-shadow: none;
  isolation: isolate;
}
.actionbar .act:not(.primary)::before,
.more-grid .act::before,
.scene-actions .choice::before,
.panel-card .act::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: url("../assets/ui/ui_plaque_gold-a.png") center / 100% 100% no-repeat;
  opacity: .92;
}
.actionbar .act:not(.primary):hover::before,
.more-grid .act:hover::before,
.scene-actions .choice:hover::before { opacity: 1; }


/* 舆图 v5：贴图自带等距透视，容器不再做 3D 变换 */
.map-scene { height: min(56vh, 460px); }
.map-ground {
  position: absolute;
  left: 50%; top: 50%;
  width: min(94%, 760px); height: min(94%, 450px);
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  transform-style: flat;
}
.map-plot { position: relative; display: grid; place-items: center; transform-style: flat; }
.map-plot .ground {
  position: absolute;
  inset: 6%;
  transform: none;
  background: radial-gradient(ellipse at 50% 55%, rgba(255, 250, 236, .95), rgba(233, 216, 184, .55) 70%, transparent 78%);
  border: 0;
  box-shadow: none;
  border-radius: 50%;
  clip-path: none;
}
.map-plot.current .ground {
  background: radial-gradient(ellipse at 50% 55%, rgba(253, 236, 214, .98), rgba(226, 185, 146, .6) 72%, transparent 80%);
  box-shadow: none;
}
.map-building {
  position: relative;
  left: auto; bottom: auto;
  width: 66%;
  margin-top: 10px;
  transform: none;
  filter: drop-shadow(0 6px 5px rgba(80, 50, 20, .22));
  transition: transform .18s ease, filter .18s ease;
}
.map-plot:hover .map-building { transform: translateY(-5px) scale(1.03); }
.map-label {
  position: absolute;
  left: 0; right: 0; top: 0;
  width: auto; margin: 0;
  transform: none;
  text-align: center;
  font: 700 12px/1.2 var(--display);
  color: #4a3a22;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9), 0 0 6px rgba(255, 250, 235, .8);
}


/* 舆图 v6：自适应高度，三行完整可见 */
.map-scene { height: auto; padding: 6px 8px 4px; }
.map-ground {
  position: static;
  transform: none;
  width: 100%;
  height: auto;
  grid-template-rows: repeat(3, auto);
  gap: 0 2px;
}
.map-plot { aspect-ratio: 1 / 0.82; }
.map-building { width: 62%; margin-top: 14px; }
.map-label { top: 2px; font-size: 12.5px; }


/* ══ V7：第二批组件接入（面板九宫格 / 头像框 / 关闭钮 / 分隔纹 / 印章）══ */

/* 面板与弹窗：整张生成的纸本面板做底 */
.panel-card {
  background-color: transparent;
  background-image: url("../assets/ui/ui_panel_rect-a.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-blend-mode: normal;
  border: 0;
  box-shadow: 0 26px 60px rgba(26, 18, 12, .55);
  padding: 34px 36px;
}
.panel-card::after { display: none; }
.scene-card { background-image: url("../assets/ui/ui_panel_rect-a.png"); padding: 30px 32px; }

/* 弹窗与面板的关闭钮：生成的圆形描金按钮 */
.panel-close {
  width: 34px; height: 34px;
  background: url("../assets/ui/ui_close_ornate-a.png") center / contain no-repeat;
  border: 0;
  color: transparent;
  font-size: 0;
  top: 16px; right: 18px;
}
.panel-close:hover { filter: brightness(.92) saturate(1.1); }

/* 头像：生成的圆形花枝金框 */
.avatar {
  width: 58px; height: 58px;
  background: url("../assets/ui/ui_avatar_frame-a.png") center / 118% 118% no-repeat;
  border: 0;
  box-shadow: 0 6px 14px rgba(60, 36, 14, .35);
  color: #7a3a22;
  font-size: 20px;
}

/* 标题下加金色分隔纹 */
.panel-card h2::after,
.scene-card h2::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -6px;
  width: 62%; height: 12px;
  transform: translateX(-50%);
  background: url("../assets/ui/ui_divider_gold-a.png") center / contain no-repeat;
  opacity: .85;
}

/* 信息框 / 状态条 / 晋升卡：换成窄卡片底 */
.info-box, .status-strip, .progress-line, .scroll-card {
  background-image: url("../assets/ui/ui_card_rect-a.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-color: transparent;
  border: 0;
  box-shadow: 0 8px 20px rgba(60, 36, 14, .22);
}
.info-box { padding: 12px 20px 10px; }
.status-strip { padding: 12px 14px; }
.progress-line { padding: 12px 14px; }
.scroll-card { padding: 26px 26px 28px; }

/* 底部对白区：换成横向对白底板 */
.panel-sheet {
  background: url("../assets/ui/ui_dialogue_bar-a.png") center / 100% 100% no-repeat;
  border: 0;
  box-shadow: 0 10px 26px rgba(40, 24, 10, .35);
  padding: 16px 26px 14px;
}

/* 朱红织带标签：用在位份标签上 */
.nameplate .who .r {
  background: url("../assets/ui/ui_tag_ribbon-a.png") center / 100% 100% no-repeat;
  background-color: transparent;
  color: #fff3dc;
  padding: 3px 16px;
  border-radius: 0;
  text-shadow: 0 1px 2px rgba(90, 20, 10, .7);
}


/* V7 修正：内层卡片不用大角花，只保留纸底与细金线 */
.info-box, .status-strip, .progress-line, .scroll-card {
  background-image: none;
  background-color: rgba(251, 245, 232, .96);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(60, 36, 14, .16), inset 0 0 0 2px rgba(255, 255, 255, .5);
}
.scroll-card { border-radius: 2px; }
.panel-card { padding: 44px 40px 40px; }
.panel-card h2, .scene-card h2 { margin-top: 6px; }
.scene-card { padding: 34px 34px 28px; }
/* 内层卡片标题保持简洁 */
.scroll-card > div:first-child { letter-spacing: .12em; }


/* V7 修正二：对白底板留出花枝安全区；织带标签加宽 */
.panel-sheet { padding: 18px 54px 16px; }
.nameplate { padding: 0 4px 8px; }
.dialogue { padding: 8px 0 4px; }
.nameplate .who .r {
  padding: 4px 22px;
  min-width: 74px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: .12em;
}


/* ══ V8：进度条瘦身（约原尺寸 30%）+ 去掉底图 ══ */
.progress-line {
  width: min(150px, 30vw);
  padding: 7px 9px;
  gap: 4px;
  background: rgba(251, 245, 232, .82);
  border: 1px solid var(--line-soft);
  box-shadow: 0 4px 12px rgba(60, 36, 14, .16);
  backdrop-filter: blur(4px);
}
.progress-line .progress-head { font-size: 9.5px; letter-spacing: .04em; }
.progress-line .progress-head b { font-size: 10px; }
.prog-row { grid-template-columns: 18px 1fr 30px; gap: 4px; }
.prog-row .k { font-size: 9px; }
.prog-row .v { font-size: 9px; }
.prog-track {
  height: 4px;
  padding: 0;
  background: rgba(230, 215, 186, .9);
  background-image: none;
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 1px 1px rgba(90, 62, 30, .18);
  display: block;
}
.prog-fill { height: 4px; border-radius: 999px; box-shadow: none; }

/* 状态条同步瘦身（保留可读数值） */
.status-strip { width: 152px; padding: 8px 10px; gap: 5px; }
.status-row { grid-template-columns: 26px 1fr 24px; gap: 5px; }
.status-row .k, .status-row .v { font-size: 10px; }
.status-track {
  height: 4px;
  padding: 0;
  background: rgba(230, 215, 186, .9);
  background-image: none;
  border: 0;
  border-radius: 999px;
  display: block;
}
.status-fill { height: 4px; border-radius: 999px; }

/* ══ V8：按钮手机自适应 ══ */
.act {
  background-size: 100% 100%;
  min-width: 0;
  font-size: clamp(11px, 2.6vw, 14.5px);
  letter-spacing: clamp(.02em, .5vw, .14em);
}
.actionbar .act { min-height: clamp(46px, 9vw, 58px); }
.actionbar .act .ico { width: clamp(16px, 4vw, 22px); height: clamp(16px, 4vw, 22px); }

@media (max-width: 710px) {
  .progress-line { top: 70px; width: 132px; padding: 6px 8px; }
  .status-strip { width: 128px; padding: 7px 8px; bottom: 132px; }
  .actionbar { gap: 4px; }
  .actionbar .act { min-height: 48px; padding: 6px 2px; }
  .actionbar .act span { font-size: 11px; letter-spacing: .02em; }
  .panel-card { padding: 30px 20px 26px; }
  .scene-card { padding: 26px 20px 20px; }
  .panel-sheet { padding: 16px 34px 14px; }
  .nameplate .who .r { padding: 3px 16px; min-width: 62px; font-size: 11.5px; }
}


/* ══ V8 修正：手机端重排（状态条移到右上、底部不再被裁）══ */
@media (max-width: 710px) {
  .status-strip {
    top: 10px; right: 8px; bottom: auto; left: auto;
    width: 116px; padding: 6px 8px; gap: 4px;
  }
  .status-row { grid-template-columns: 24px 1fr 22px; }
  .status-row .k, .status-row .v { font-size: 9.5px; }
  .progress-line { top: 74px; left: 8px; width: 132px; }
  .info-box { max-width: calc(100% - 150px); }
  .cast { height: 52vh; bottom: 200px; }
  .bottom { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .panel-sheet { padding: 14px 30px 12px; }
  .dialogue { max-height: 19vh; }
  .dialogue .line { font-size: 14px; line-height: 1.8; }
  .actionbar { margin-top: 6px; }
  .actionbar .act { min-height: 44px; }
  .actionbar .act .ico { width: 18px; height: 18px; }
  .actionbar .act span { font-size: 10.5px; }
}


/* V8 修正二：手机端细节 */
@media (max-width: 710px) {
  .hud { top: 10px; left: 8px; gap: 6px; align-items: flex-start; }
  .avatar { width: 44px; height: 44px; font-size: 15px; }
  .info-box { padding: 6px 10px 7px; max-width: 150px; }
  .info-box .date { font-size: 12px; letter-spacing: .02em; white-space: nowrap; }
  .info-box .meta { font-size: 9.5px; gap: 8px; margin-top: 1px; flex-wrap: wrap; }
  .progress-line { top: 66px; left: 8px; width: 128px; }
  .bottom { padding: 0 6px calc(6px + env(safe-area-inset-bottom)); }
  .panel-sheet { padding: 12px 22px 10px; }
  .nameplate { gap: 6px; padding-bottom: 6px; }
  .nameplate .who { gap: 4px 8px; }
  .nameplate .who .n { font-size: 14px; }
  .nameplate .who .s { font-size: 10.5px; }
  .leave { padding: 3px 10px; font-size: 11px; }
  .dialogue { padding: 6px 0 2px; overflow-x: hidden; }
  .dialogue .line { font-size: 13.5px; line-height: 1.75; word-break: break-word; }
  .dialogue .speaker { font-size: 12.5px; }
  .actionbar { gap: 4px; }
  .actionbar .act { min-height: 46px; padding: 5px 1px; }
}


/* V8：才艺条同样去底图、减重 */
.skill-track {
  height: 6px;
  padding: 0;
  background: rgba(230, 215, 186, .95);
  background-image: none;
  border: 0;
  border-radius: 999px;
  display: block;
  box-shadow: inset 0 1px 1px rgba(90, 62, 30, .16);
}
.skill-fill { height: 6px; border-radius: 999px; }
.skill-row { grid-template-columns: 46px 1fr 54px; }


/* V9：封面卡也用生成面板；人物头像裁切对准面部 */
.curtain-card {
  background-color: transparent;
  background-image: url("../assets/ui/ui_panel_rect-a.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: 0;
  box-shadow: 0 30px 70px rgba(26, 18, 12, .6);
  padding: 44px 46px 40px;
}
.curtain-card::after { display: none; }
.npc-card .face {
  width: 56px; height: 74px;
  object-position: 50% 20%;
  border-radius: 2px;
}


/* V9：封面/结局卡靠下，露出上半幅画 */
.curtain { align-items: end; padding-bottom: clamp(20px, 5vh, 56px); }
.curtain-card { max-height: 74vh; }

/* 行囊 */
.pouch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.pouch-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: #fffdf6;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}
.pouch-item img {
  width: 46px; height: 46px;
  object-fit: contain;
}
.pouch-item .nm { font: 700 13.5px/1.3 var(--display); letter-spacing: .08em; color: var(--ink); }
.pouch-item .sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

/* 弹窗右上角的道具贴图 */
.scene-prop {
  position: absolute;
  top: 14px; right: 58px;
  width: 56px; height: 56px;
  object-fit: contain;
  opacity: .95;
  pointer-events: none;
}
.more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* 道具内联到正文左侧 */
.scene-prop {
  position: static;
  float: left;
  width: 52px; height: 52px;
  object-fit: contain;
  margin: 2px 12px 0 0;
  opacity: .95;
}

/* 选项行：不再套牌匾（宽高比不符会挤压花纹），改回纸底 + 金线 */
.scene-actions .choice {
  background: #fdf8ec;
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 rgba(168, 125, 58, .18);
}
.scene-actions .choice::before { content: none; }
.scene-actions .choice:hover { background: #f7ecd6; border-color: var(--gold-deep); }


/* 关闭钮：保留生成的圆形底，但把 × 显示出来，点得到 */
.panel-close {
  width: 38px; height: 38px;
  color: #7a5a34;
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .8);
  cursor: pointer;
}
.panel-close:hover { color: var(--vermilion); }
/* 面板遮罩：整个区域都可点关闭，卡片内除外 */
.panel-layer { cursor: default; }


/* ══ V10：封面/结局卡与弹窗一律居中 ══ */
.curtain {
  align-items: center;
  justify-items: center;
  padding: 24px 20px;
}
.curtain-card {
  max-height: 86vh;
  margin: 0 auto;
}

/* 原生 dialog：用 transform 居中，避免不同浏览器 margin:auto 失效 */
dialog.vn-modal {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-height: 86dvh;
  z-index: 60;
}
dialog.vn-modal::backdrop {
  background: rgba(20, 14, 9, .62);
  backdrop-filter: blur(2px);
}

/* 兜底：任何 dialog 都居中 */
body > dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

/* 面板层已是 grid 居中，这里确保小屏也不偏 */
.panel-layer { place-items: center; }

/* 弹窗本体：与面板同一套描金纸底 */
dialog.vn-modal {
  background-color: transparent;
  background-image: url("../assets/ui/ui_panel_rect-a.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: 0;
  box-shadow: 0 26px 60px rgba(20, 14, 9, .55);
  padding: 40px 38px 34px;
  width: min(600px, calc(100% - 32px));
}
dialog.vn-modal .modal-title {
  position: relative;
  text-align: center;
  padding: 12px 26px;
  margin: -6px 0 16px;
  border-bottom: 0;
  font: 700 20px/1.35 var(--display);
  letter-spacing: .16em;
  color: #5a3a1c;
  isolation: isolate;
}
dialog.vn-modal .modal-title::before {
  content: "";
  position: absolute;
  inset: -12px -18px -8px;
  z-index: -1;
  background: url("../assets/ui/ui_plaque_gold-a.png") center / 100% 100% no-repeat;
}
dialog.vn-modal .modal-text { color: var(--ink-soft); font-size: 14.5px; line-height: 1.95; }
dialog.vn-modal .modal-btn {
  background: #fdf8ec;
  border: 1px solid var(--line);
  border-radius: 2px;
  min-height: 42px;
  color: var(--ink);
}
dialog.vn-modal .modal-btn:first-of-type {
  color: #fff3dc;
  border: 0;
  background: var(--vermilion) url("../assets/ui/ui_btn_red-a.png") center / 100% 100% no-repeat;
  text-shadow: 0 1px 2px rgba(90, 20, 10, .65);
}

/* 弹窗：给足高度，避免生成的纸本面板被压扁 */
dialog.vn-modal {
  width: min(540px, calc(100% - 32px));
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
dialog.vn-modal .modal-title { flex: 0 0 auto; }
dialog.vn-modal .slot-list { max-height: 52vh; overflow: auto; }


/* 地图建筑：去掉 blend，透明图直接呈现 */
.map-building { filter: drop-shadow(0 6px 5px rgba(80, 50, 20, .22)); }
.map-legend { padding: 0 10px; }
.map-caption { color: var(--ink-soft); }

/* 舆图底部说明避开角花 */
.map-legend { padding: 0 26px 4px; }

/* 面板内的事迹卷轴：去掉外挂轴杆，题签改内嵌，避免与卡片角花打架 */
.panel-card .scroll-card::before,
.panel-card .scroll-card::after { display: none; }
.panel-card .scroll-card { padding: 16px 18px 18px 18px; }
.scroll-card .scroll-tab {
  position: absolute;
  left: 0;
  top: 14px;
  padding: 8px 5px;
  font-size: 13px;
  letter-spacing: .28em;
  border-radius: 0 3px 3px 0;
}
.scroll-card .scroll-tassel { display: none; }
.panel-card .scroll-card { padding-left: 44px; }
.journal-list { min-height: 120px; }
.journal-entry time { font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════════════════════
   V11：右侧竖列 / 7 键底栏 / 镂空进度条 / 字体加粗
   ══════════════════════════════════════════════════════════ */

/* 右侧快捷竖列 */
.rail {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  display: grid;
  gap: 6px;
  padding: 10px 7px;
  background: url("../assets/ui/ui_rail_panel-a.png") center / 100% 100% no-repeat;
  min-width: 62px;
}
.rail-btn {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 7px 4px;
  width: 48px;
  color: #4a3521;
  background: transparent;
  border: 0;
  border-radius: 3px;
  font: 700 10.5px/1.2 var(--display);
  letter-spacing: .04em;
  transition: background .15s ease, color .15s ease;
}
.rail-btn .ico { width: 19px; height: 19px; }
.rail-btn .ico path, .rail-btn .ico circle, .rail-btn .ico rect, .rail-btn .ico polygon { stroke: currentColor; fill: none; stroke-width: 1.7; }
.rail-btn:hover { background: rgba(214, 176, 110, .28); color: #8a2f1f; }

/* 底部 7 键：更矮更紧凑 */
.actionbar { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.actionbar .act {
  min-height: 48px;
  padding: 5px 2px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #3a2816;
}
.actionbar .act .ico { width: 19px; height: 19px; }
.actionbar .act span { font-weight: 700; }

/* 按钮字体统一加粗加深 */
.act, .choice, .modal-btn, .slot-btn, .start-btn, .rail-btn {
  font-weight: 700;
  color: #3a2816;
}
.scene-actions .choice { font-size: 15px; color: #33240f; }
.panel-card .act, .more-grid .act { font-size: 14px; color: #33240f; }

/* 晋升 / 状态：去掉背景框与填充，改镂空细线 */
.progress-line, .status-strip {
  background: none;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  padding: 2px 0;
}
.progress-line { width: min(190px, 34vw); }
.progress-head, .prog-row .k, .prog-row .v,
.status-row .k, .status-row .v {
  color: #2f2113;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(255, 250, 240, .95), 0 0 6px rgba(255, 248, 232, .9);
}
.progress-head b { color: #8a2f1f; }
.prog-track, .status-track, .skill-track {
  background: none;
  background-image: none;
  border: 0;
  border-top: 1px solid rgba(90, 60, 30, .55);
  border-bottom: 1px solid rgba(90, 60, 30, .35);
  border-radius: 0;
  box-shadow: none;
  height: 6px;
  padding: 0;
  display: block;
  position: relative;
}
.prog-fill, .status-fill, .skill-fill {
  height: 2px;
  margin-top: 1px;
  border-radius: 0;
  box-shadow: none;
  background: linear-gradient(90deg, #b8863f, #8a5a1c);
}
.status-fill.fatigue { background: linear-gradient(90deg, #b8863f, #8a5a1c); }
.status-fill.mood { background: linear-gradient(90deg, #6f9a5c, #436b32); }
.status-fill.health { background: linear-gradient(90deg, #b4513c, #7d2f1e); }

/* 事迹内容：限制在窗口内，不溢出 */
.panel-card[data-panel-card] .scroll-card { max-height: 54vh; overflow: auto; }
.journal-list { padding-right: 4px; }
.journal-entry { grid-template-columns: 96px 1fr; align-items: start; }

/* 剧情插画与背景过渡：边缘柔化 + 上暗下亮 */
.stage-art {
  transition: opacity .6s ease, filter .6s ease;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.88) 0%, #000 18%, #000 78%, rgba(0,0,0,.9) 100%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.88) 0%, #000 18%, #000 78%, rgba(0,0,0,.9) 100%);
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%, rgba(20, 14, 9, 0) 46%, rgba(20, 14, 9, .30) 100%);
}

@media (max-width: 1100px) {
  .rail { right: 10px; padding: 8px 5px; min-width: 54px; }
  .rail-btn { width: 42px; font-size: 9.5px; }
}
@media (max-width: 710px) {
  .rail { position: static; transform: none; display: flex; gap: 4px; justify-content: center;
          margin: 0 0 6px; padding: 6px 4px; background-size: 100% 100%; }
  .rail-btn { width: auto; padding: 5px 8px; grid-auto-flow: column; gap: 4px; font-size: 10px; }
  .actionbar { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .actionbar .act { min-height: 44px; font-size: 11.5px; }
  .actionbar .act .ico { width: 16px; height: 16px; }
  .progress-line { width: 150px; }
}

/* V11 修正：镂空后保证可读——字号加大、加深、加白边光晕 */
.progress-line { width: min(216px, 36vw); gap: 5px; }
.progress-head { font-size: 12px; letter-spacing: .06em; }
.progress-head b { font-size: 13px; }
.prog-row { grid-template-columns: 30px 1fr 54px; gap: 6px; }
.prog-row .k { font-size: 11.5px; }
.prog-row .v { font-size: 11.5px; }
.prog-track, .status-track, .skill-track { height: 7px; }
.prog-fill, .status-fill, .skill-fill { height: 3px; margin-top: 1px; }
.status-strip { width: 178px; gap: 6px; }
.status-row { grid-template-columns: 32px 1fr 28px; }
.status-row .k, .status-row .v { font-size: 11.5px; }
.progress-head, .prog-row .k, .prog-row .v,
.status-row .k, .status-row .v {
  text-shadow: 0 1px 3px rgba(255, 252, 244, .98), 0 0 8px rgba(255, 248, 232, .95), 0 1px 1px rgba(255,255,255,.9);
}

/* V11 修正二：镂空但可读——文字用紧致白描边，背景只留极淡渐隐 */
.progress-line, .status-strip {
  background: linear-gradient(90deg, rgba(255, 250, 240, .92) 0%, rgba(255, 250, 240, .72) 62%, rgba(255, 250, 240, 0) 100%);
  border: 0;
  box-shadow: none;
  border-radius: 2px;
  padding: 4px 8px;
}
.status-strip {
  background: linear-gradient(270deg, rgba(255, 250, 240, .92) 0%, rgba(255, 250, 240, .72) 62%, rgba(255, 250, 240, 0) 100%);
}
.progress-head, .prog-row .k, .prog-row .v,
.status-row .k, .status-row .v {
  color: #241a0e;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .95);
}
.prog-row .v, .status-row .v { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* 事迹滚动区：底部渐隐 + 内边距，避免内容被硬切 */
.panel-card[data-panel-card] .scroll-card {
  max-height: 54vh;
  overflow: auto;
  padding-bottom: 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 88%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 88%, transparent 100%);
}

/* 弹窗顶部事件插画：圆角裁切 + 底部渐隐过渡到纸面 */
.scene-cg {
  margin: -18px -20px 10px;
  height: 150px;
  overflow: hidden;
  border-radius: 2px;
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
.scene-cg img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; display: block; }
.scene-card { overflow: hidden auto; }

/* V12：镂空改「极淡白纱」——轨道内铺一层很淡的白，仍能透出背景 */
.prog-track, .status-track, .skill-track {
  background: rgba(255, 253, 247, .34);
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 1px 2px rgba(60, 40, 18, .06);
  height: 8px;
  padding: 2px 3px;
  display: flex;
  align-items: center;
}
.prog-fill, .status-fill, .skill-fill {
  height: 3px;
  margin-top: 0;
  border-radius: 999px;
}
.progress-line, .status-strip {
  background: linear-gradient(90deg, rgba(255, 252, 245, .72) 0%, rgba(255, 252, 245, .38) 66%, rgba(255, 252, 245, 0) 100%);
  border-radius: 3px;
  padding: 5px 9px;
}
.status-strip {
  background: linear-gradient(270deg, rgba(255, 252, 245, .72) 0%, rgba(255, 252, 245, .38) 66%, rgba(255, 252, 245, 0) 100%);
}

/* V12 手机端：状态区错开、底栏两行不溢出 */
@media (max-width: 710px) {
  .hud { top: 8px; left: 8px; }
  .info-box { max-width: 148px; padding: 5px 9px 6px; }
  .info-box .date { font-size: 11.5px; }
  .info-box .meta { font-size: 9px; gap: 6px; }
  .status-strip {
    top: 8px; right: 6px; width: 108px;
    padding: 4px 6px; gap: 3px;
    background: linear-gradient(270deg, rgba(255,252,245,.78) 0%, rgba(255,252,245,.42) 70%, rgba(255,252,245,0) 100%);
  }
  .status-row { grid-template-columns: 22px 1fr 20px; gap: 4px; }
  .status-row .k, .status-row .v { font-size: 9px; }
  .status-track { height: 7px; padding: 1px 2px; }
  .progress-line {
    top: 76px; left: 8px; width: 176px;
    padding: 4px 7px; gap: 3px;
    background: linear-gradient(90deg, rgba(255,252,245,.80) 0%, rgba(255,252,245,.45) 70%, rgba(255,252,245,0) 100%);
  }
  .progress-head { font-size: 9.5px; }
  .progress-head b { font-size: 10px; }
  .prog-row { grid-template-columns: 24px 1fr 42px; gap: 4px; }
  .prog-row .k, .prog-row .v { font-size: 9.5px; }
  .prog-track, .skill-track { height: 7px; padding: 1px 2px; }

  .cast { height: 42vh; bottom: 232px; }
  .panel-sheet { padding: 11px 24px 9px; }
  .dialogue { max-height: 15vh; }
  .dialogue .line { font-size: 13px; line-height: 1.7; }
  .actionbar { gap: 5px; margin-top: 5px; }
  .actionbar .act { min-height: 40px; }
  .actionbar .act span { font-size: 10px; }
  .actionbar .act .ico { width: 15px; height: 15px; }
  .bottom { padding: 0 5px calc(4px + env(safe-area-inset-bottom)); }
}

/* V12 手机端二次收紧 */
@media (max-width: 710px) {
  .progress-line { top: 74px; width: 168px; gap: 2px; padding: 4px 7px; }
  .prog-row { grid-template-columns: 22px 1fr 40px; gap: 3px; align-items: center; }
  .prog-row .k, .prog-row .v { font-size: 9px; line-height: 1.25; }
  .prog-track { height: 6px; }
  .cast { height: 36vh; bottom: 214px; }
  .dialogue { max-height: 12vh; }
  .nameplate { padding-bottom: 4px; }
  .actionbar { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .actionbar .act { min-height: 38px; padding: 3px 1px; }
  .actionbar .act span { font-size: 9.5px; letter-spacing: 0; }
  .actionbar .act .ico { width: 14px; height: 14px; }
  .panel-sheet { padding: 9px 20px 7px; }
}

/* V12 修正：去掉过重的白色发光，改用单层紧致描边，避免小字被糊白 */
.progress-head, .prog-row .k, .prog-row .v,
.status-row .k, .status-row .v {
  text-shadow: 0 1px 0 rgba(255, 255, 255, .85);
}
.progress-head b {
  font-size: 11.5px;
  color: #7d2a1a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
}

/* 位份名再清晰一点 */
.progress-head b { font-size: 12px; letter-spacing: .04em; }

/* ══ V13：晋升块 / 状态块恢复背景框与填充，整体 60% 不透明 ══ */
.progress-line, .status-strip {
  background: rgba(251, 245, 232, .60);
  border: 1px solid rgba(168, 125, 58, .42);
  border-radius: 3px;
  box-shadow: 0 8px 20px rgba(60, 36, 14, .20), inset 0 0 0 2px rgba(255, 255, 255, .35);
  backdrop-filter: blur(5px);
  padding: 8px 10px;
}
.progress-line { width: min(228px, 38vw); gap: 5px; }
.status-strip { width: 184px; gap: 6px; }

/* 轨道恢复浅色底，填充恢复正常实色 */
.prog-track, .status-track {
  background: rgba(214, 196, 158, .55);
  border: 0;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(90, 62, 30, .20);
  height: 8px;
  padding: 2px;
  display: flex;
  align-items: center;
}
.prog-fill, .status-fill {
  height: 4px;
  border-radius: 999px;
  box-shadow: none;
}
.prog-fill { background: linear-gradient(90deg, #d9a94f, #a87319); }
.status-fill.fatigue { background: linear-gradient(90deg, #c98a3c, #a45f18); }
.status-fill.mood { background: linear-gradient(90deg, #86b46e, #527f42); }
.status-fill.health { background: linear-gradient(90deg, #d0755f, #a1432f); }
.prog-row.done .prog-fill { background: linear-gradient(90deg, #9cc47e, #4f7a3d); }

/* 文字回到正常对比（框已恢复，不再需要描边救场） */
.progress-head, .prog-row .k, .prog-row .v,
.status-row .k, .status-row .v {
  color: #3a2a1a;
  text-shadow: none;
}
.progress-head b { color: #8a2f1f; }

/* 手机端：两块并排不打架 */
@media (max-width: 710px) {
  .progress-line { width: 158px; padding: 6px 8px; }
  .status-strip { width: 150px; padding: 6px 8px; }
  .progress-head b { font-size: 11px; }
  .prog-row { grid-template-columns: 22px 1fr 38px; gap: 3px; }
  .prog-row .k, .prog-row .v, .status-row .k, .status-row .v { font-size: 9.5px; }
  .prog-track, .status-track { height: 7px; padding: 1px; }
  .prog-fill, .status-fill { height: 3px; }
}

/* ══ V14：晋升块 / 状态块——去边框、填充 40%、宽度缩 30% ══ */
.progress-line, .status-strip {
  border: 0;
  box-shadow: none;
  background: rgba(251, 245, 232, .40);
  backdrop-filter: blur(6px);
}
.progress-line { width: min(160px, 28vw); padding: 7px 9px; gap: 4px; }
.status-strip { width: min(129px, 23vw); padding: 7px 9px; gap: 5px; }
.progress-head { font-size: 10.5px; }
.progress-head b { font-size: 10.5px; }
.prog-row { grid-template-columns: 24px 1fr 40px; gap: 4px; }
.prog-row .k, .prog-row .v { font-size: 10px; }
.status-row { grid-template-columns: 26px 1fr 22px; gap: 4px; }
.status-row .k, .status-row .v { font-size: 10px; }
.prog-track, .status-track { height: 7px; padding: 1px; }
.prog-fill, .status-fill { height: 3px; }

@media (max-width: 710px) {
  .progress-line { width: 118px; padding: 5px 7px; }
  .status-strip { width: 100px; padding: 5px 7px; }
  .progress-head { font-size: 9.5px; }
  .progress-head b { font-size: 9.5px; }
  .prog-row { grid-template-columns: 20px 1fr 34px; gap: 3px; }
  .prog-row .k, .prog-row .v, .status-row .k, .status-row .v { font-size: 9px; }
}

/* 数值列放宽并禁止换行，避免“✓ 43/40”被折成两行 */
.prog-row { grid-template-columns: 24px 1fr 48px; }
.prog-row .v { white-space: nowrap; }
.status-row .v { white-space: nowrap; }
.prog-row .v .tick { font-size: 9px; }

/* ══ V15：状态块改为顶部横向并列；两块字体加深一倍、不描边 ══ */
.status-strip {
  top: 18px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 7px 14px;
  border: 0;
  border-radius: 3px;
  background: rgba(251, 245, 232, .40);
  box-shadow: none;
  backdrop-filter: blur(6px);
}
.status-row {
  display: grid;
  grid-template-columns: auto 84px auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.status-row .k { white-space: nowrap; }
.status-track { width: 84px; }

/* 字体加深一倍：由 #3a2a1a 收到近黑 */
.progress-head, .prog-row .k, .prog-row .v,
.status-row .k, .status-row .v {
  color: #140d06;
  font-weight: 800;
  text-shadow: none;
}
.progress-head b { color: #5e1c10; }

@media (max-width: 710px) {
  .status-strip {
    top: 66px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    gap: 8px;
    padding: 5px 9px;
  }
  .status-row { grid-template-columns: auto 46px auto; gap: 4px; }
  .status-track { width: 46px; }
  .status-row .k, .status-row .v { font-size: 9px; }
}

/* 手机端：状态条与晋升块上下错开 */
@media (max-width: 710px) {
  .status-strip { top: 62px; }
  .progress-line { top: 104px; }
}

/* 达标绿再压深，保持“整体加深”的一致观感 */
.prog-row.done .v { color: #2f5222; font-weight: 800; }
.prog-row .v .tick { color: #2f5222; }
.status-strip { gap: 18px; }

/* ══ V16：状态块再缩 20%、靠右、贴顶对齐 ══ */
.status-strip {
  left: auto;
  right: 100px;
  top: 16px;
  transform: none;
  gap: 13px;
  padding: 6px 12px;
}
.status-row { grid-template-columns: auto 66px auto; gap: 5px; }
.status-track { width: 66px; }
.status-row .k, .status-row .v { font-size: 9.5px; }

@media (max-width: 710px) {
  .status-strip {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    top: 62px;
    gap: 8px;
    padding: 5px 9px;
  }
  .status-row { grid-template-columns: auto 46px auto; }
  .status-track { width: 46px; }
}

/* 手机端同样靠右贴顶 */
@media (max-width: 710px) {
  .status-strip {
    left: auto;
    right: 8px;
    transform: none;
    top: 60px;
  }
}

/* ══ V17：状态块再缩 20% ══ */
.status-strip { gap: 10px; padding: 5px 10px; }
.status-row { grid-template-columns: auto 53px auto; gap: 4px; }
.status-track { width: 53px; }
.status-row .k, .status-row .v { font-size: 9px; }

@media (max-width: 710px) {
  .status-strip { gap: 7px; padding: 4px 8px; }
  .status-row { grid-template-columns: auto 38px auto; }
  .status-track { width: 38px; }
  .status-row .k, .status-row .v { font-size: 8.5px; }
}

/* ══ V18：状态块再缩 15% ══ */
.status-strip { gap: 8px; padding: 5px 9px; }
.status-row { grid-template-columns: auto 45px auto; gap: 3px; }
.status-track { width: 45px; }
.status-row .k, .status-row .v { font-size: 8.5px; }

@media (max-width: 710px) {
  .status-strip { gap: 6px; padding: 4px 7px; }
  .status-row { grid-template-columns: auto 32px auto; }
  .status-track { width: 32px; }
  .status-row .k, .status-row .v { font-size: 8px; }
}

/* ══ V19：状态块贴信息框右侧；晋升块上移 30%；位份名去白描边 ══ */
.status-strip {
  left: 334px;
  right: auto;
  top: 20px;
  transform: none;
}
.progress-line {
  top: 68px;           /* 96 → 68，上移约 30% */
}
.progress-head b,
.progress-head b * {
  text-shadow: none !important;
  -webkit-text-shadow: none !important;
}

@media (max-width: 1100px) {
  .status-strip { left: 300px; }
}
@media (max-width: 710px) {
  .status-strip { left: auto; right: 8px; top: 8px; transform: none; }
  .progress-line { top: 68px; }
}

/* ══ V20：压缩信息框高度，让晋升块上移到 68px 不重叠；状态块紧贴其右 ══ */
.info-box {
  padding: 5px 14px 5px;
  min-width: 214px;
}
.info-box .date { font-size: 16px; line-height: 1.25; }
.info-box .meta { margin-top: 0; font-size: 11.5px; gap: 14px; }
.status-strip { left: 336px; top: 20px; }
.progress-line { top: 68px; }

/* 信息框再压 7px，晋升块 68px 正好贴住 */
.info-box { padding: 4px 12px; }
.info-box .date { font-size: 15px; }
.info-box .meta { font-size: 11px; gap: 12px; }
.status-strip { left: 314px; }

.progress-line { top: 71px; }

/* 手机端最终覆盖：状态块贴信息框右侧放不下，改为下一行右对齐 */
@media (max-width: 710px) {
  .status-strip {
    left: auto;
    right: 8px;
    top: 62px;
    transform: none;
  }
  .progress-line { top: 100px; }
}

/* ══ V21：撤回上一批改动，回到「状态块右上、晋升块 96px、信息框原尺寸」══ */
.info-box {
  padding: 8px 18px 9px;
  min-width: 236px;
}
.info-box .date { font-size: 18px; line-height: 1.4; }
.info-box .meta { margin-top: 3px; font-size: 12.5px; gap: 18px; }

.progress-line { top: 96px; }

.status-strip {
  left: auto;
  right: 100px;
  top: 16px;
  transform: none;
}
.status-row { grid-template-columns: auto 45px auto; gap: 3px; }
.status-track { width: 45px; }
.status-row .k, .status-row .v { font-size: 8.5px; }

/* 位份名恢复原来的单层白色描边 */
.progress-head b {
  text-shadow: 0 1px 0 rgba(255, 255, 255, .85) !important;
}

@media (max-width: 710px) {
  .status-strip { left: auto; right: 8px; top: 60px; transform: none; }
  .progress-line { top: 104px; }
  .info-box { padding: 5px 9px 6px; min-width: 0; max-width: 148px; }
  .info-box .date { font-size: 11.5px; }
  .info-box .meta { font-size: 9px; gap: 6px; }
}

/* ══ V22：状态块再缩 10% 并置顶；位份名去白描边；晋升块上移 30% ══ */
.status-strip { right: 100px; top: 16px; gap: 7px; padding: 4px 8px; }
.status-row { grid-template-columns: auto 40px auto; gap: 3px; }
.status-track { width: 40px; }
.status-row .k, .status-row .v { font-size: 8px; }

.progress-head b { text-shadow: none !important; }

/* 信息框压到 62px 以内，让晋升块能上到 67px */
.info-box { padding: 5px 14px 6px; min-width: 228px; }
.info-box .date { font-size: 16px; line-height: 1.3; }
.info-box .meta { margin-top: 1px; font-size: 11.5px; gap: 14px; }
.progress-line { top: 67px; }

@media (max-width: 710px) {
  .status-strip { right: 8px; top: 8px; }
  .progress-line { top: 96px; }
}

/* 信息框再收 6px，顶到 67px 不留缝 */
.info-box { padding: 4px 12px; }
.info-box .date { font-size: 15px; }
.info-box .meta { font-size: 10.5px; gap: 12px; margin-top: 0; }

.progress-line { top: 68px; }

/* ══ V23：状态块再缩 20%；信息框宽度缩 30%（左对齐不变）══ */
.status-strip { gap: 5px; padding: 3px 6px; right: 100px; }
.status-row { grid-template-columns: auto 32px auto; gap: 2px; }
.status-track { width: 32px; }
.status-row .k, .status-row .v { font-size: 8px; }

.info-box {
  width: 160px;
  min-width: 160px;
  padding: 4px 10px;
}
.info-box .date { font-size: 14px; letter-spacing: .06em; }
.info-box .meta { font-size: 10px; gap: 8px; flex-wrap: wrap; }

@media (max-width: 710px) {
  .status-row { grid-template-columns: auto 28px auto; }
  .status-track { width: 28px; }
  .info-box { width: 138px; min-width: 138px; max-width: 138px; }
}

/* 手机端：信息框再收窄，状态块下移一行，避免与日期挤在一起 */
@media (max-width: 710px) {
  .info-box { width: 150px; min-width: 150px; max-width: 150px; padding: 4px 8px; }
  .info-box .date { font-size: 12px; letter-spacing: .02em; white-space: nowrap; }
  .info-box .meta { font-size: 9px; gap: 6px; }
  .status-strip { top: 58px; right: 8px; }
  .progress-line { top: 92px; }
  .status-row { grid-template-columns: auto 26px auto; }
  .status-track { width: 26px; }
  .status-row .k, .status-row .v { font-size: 7.5px; }
}

/* ══ V24：状态块与信息框顶部对齐（同高起点）══ */
.status-strip { top: 20px; right: 100px; }

@media (max-width: 710px) {
  .status-strip { top: 8px; right: 8px; }
  .status-row { grid-template-columns: auto 22px auto; }
  .status-track { width: 22px; }
  .status-row .k, .status-row .v { font-size: 7px; }
  .status-strip { gap: 4px; padding: 3px 5px; }
}

/* 状态块高度与信息框一致（顶部对齐 + 同高） */
.status-strip { min-height: 46px; align-items: center; }
@media (max-width: 710px) {
  .status-strip { min-height: 40px; }
}

/* ══════════════════════════════════════════════════════════
   V25：顶部区域自适应（流式布局 + clamp 尺寸）
   ══════════════════════════════════════════════════════════ */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: clamp(8px, 1.4vw, 18px);
  padding: clamp(8px, 1.8vh, 20px) clamp(8px, 1.4vw, 20px);
  flex-wrap: wrap;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar-left {
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.7vh, 7px);
  min-width: 0;
}
.hud {
  position: static;
  display: flex;
  align-items: flex-start;
  gap: clamp(6px, 0.8vw, 10px);
  top: auto; left: auto;
}
.avatar {
  width: clamp(36px, 3.4vw, 58px);
  height: clamp(36px, 3.4vw, 58px);
  font-size: clamp(13px, 1.25vw, 20px);
}
.info-box {
  width: clamp(140px, 15vw, 236px);
  min-width: 0;
  padding: clamp(3px, 0.5vh, 6px) clamp(8px, 0.9vw, 14px);
}
.info-box .date { font-size: clamp(12px, 1.05vw, 17px); line-height: 1.35; letter-spacing: .04em; }
.info-box .meta { font-size: clamp(9px, 0.8vw, 11.5px); gap: clamp(6px, 0.7vw, 14px); flex-wrap: wrap; margin-top: 1px; }

.progress-line {
  position: static;
  width: clamp(140px, 15vw, 236px);
  padding: clamp(4px, 0.6vh, 7px) clamp(7px, 0.8vw, 10px);
  gap: clamp(2px, 0.4vh, 5px);
}
.progress-head { font-size: clamp(9px, 0.78vw, 11px); }
.progress-head b { font-size: clamp(9px, 0.78vw, 11px); }
.prog-row { grid-template-columns: clamp(20px, 2vw, 30px) 1fr clamp(38px, 3.6vw, 54px); gap: clamp(3px, 0.4vw, 6px); }
.prog-row .k, .prog-row .v { font-size: clamp(9px, 0.75vw, 11px); }
.prog-track { height: clamp(6px, 0.8vh, 8px); }

.status-strip {
  position: static;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(5px, 0.8vw, 13px);
  padding: clamp(4px, 0.7vh, 7px) clamp(7px, 0.9vw, 12px);
  min-height: 0;
  max-width: 100%;
}
.status-row { grid-template-columns: auto clamp(22px, 3vw, 44px) auto; gap: clamp(3px, 0.4vw, 5px); }
.status-track { width: clamp(22px, 3vw, 44px); height: clamp(6px, 0.8vh, 8px); }
.status-row .k, .status-row .v { font-size: clamp(8px, 0.72vw, 10px); }

/* 中等宽度：状态块换到下一行，占满整宽 */
@media (max-width: 980px) {
  .topbar { align-items: stretch; }
  .status-strip { order: 2; width: 100%; justify-content: flex-start; }
  .topbar-left { order: 1; }
}

/* 手机：整行铺开，字号用 vw 兜底 */
@media (max-width: 710px) {
  .topbar { padding: 8px 8px 4px; gap: 6px; }
  .info-box { width: clamp(132px, 40vw, 170px); }
  .progress-line { width: clamp(132px, 40vw, 170px); }
  .status-strip { gap: 6px; padding: 4px 7px; }
  .status-row { grid-template-columns: auto clamp(20px, 6vw, 30px) auto; }
  .status-track { width: clamp(20px, 6vw, 30px); }
  .prog-row { grid-template-columns: 20px 1fr 38px; }
}

/* 晋升块与信息框左对齐（让出头像宽度），并保证条有空间 */
.progress-line {
  margin-left: calc(clamp(36px, 3.4vw, 58px) + clamp(6px, 0.8vw, 10px));
  width: clamp(150px, 15vw, 236px);
  align-self: flex-start;
}
.prog-row { grid-template-columns: clamp(22px, 2vw, 30px) minmax(24px, 1fr) clamp(38px, 3.6vw, 54px); }
@media (max-width: 710px) {
  .progress-line {
    margin-left: calc(clamp(36px, 3.4vw, 58px) + 6px);
    width: clamp(150px, 42vw, 190px);
  }
}

/* 修：旧规则的 max-width 表达式被解析成 55px，把晋升块夹死了 */
.progress-line { max-width: none; }

/* 换行后不要拉满整宽：收缩到内容宽度并靠右 */
@media (max-width: 980px) {
  .status-strip { width: auto; margin-left: auto; }
}

/* 中等宽度：三项保持一行，缩小条宽而不是换行 */
@media (max-width: 980px) {
  .status-strip { flex-wrap: nowrap; }
  .status-row { grid-template-columns: auto clamp(16px, 3.4vw, 32px) auto; }
  .status-track { width: clamp(16px, 3.4vw, 32px); }
}

/* 中等宽度不要把状态块拉伸到整行高度 */
@media (max-width: 980px) {
  .status-strip { align-self: flex-start; }
}

/* ══════════════════════════════════════════════════════════
   V26：位置布局固定（左上信息框 → 其下晋升块；右上状态块），
        尺寸/字号随窗口等比缩放，不换行、不重排
   ══════════════════════════════════════════════════════════ */
:root { --hud-w: clamp(140px, 15vw, 240px); }

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 0;
  padding: 0;
  display: block;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.topbar-left {
  position: absolute;
  top: clamp(10px, 1.6vh, 20px);
  left: clamp(8px, 1.4vw, 20px);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.8vh, 8px);
  width: var(--hud-w);
}
.hud {
  position: static;
  display: flex;
  align-items: flex-start;
  gap: clamp(6px, 0.7vw, 10px);
  width: 100%;
}
.avatar {
  width: clamp(34px, 3.4vw, 58px);
  height: clamp(34px, 3.4vw, 58px);
  font-size: clamp(12px, 1.2vw, 20px);
}
.info-box {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: clamp(3px, 0.5vh, 6px) clamp(7px, 0.8vw, 14px);
}
.info-box .date { font-size: clamp(12px, 1.05vw, 17px); }
.info-box .meta { font-size: clamp(9px, 0.8vw, 11.5px); gap: clamp(6px, 0.7vw, 14px); }

.progress-line {
  position: static;
  width: var(--hud-w);
  max-width: none;
  margin-left: calc(clamp(34px, 3.4vw, 58px) + clamp(6px, 0.7vw, 10px));
  padding: clamp(4px, 0.6vh, 7px) clamp(7px, 0.8vw, 10px);
  gap: clamp(2px, 0.4vh, 5px);
}
.progress-head { font-size: clamp(9px, 0.78vw, 11px); }
.progress-head b { font-size: clamp(9px, 0.78vw, 11px); }
.prog-row { grid-template-columns: clamp(20px, 1.9vw, 30px) minmax(20px, 1fr) clamp(36px, 3.4vw, 54px); gap: clamp(3px, 0.4vw, 6px); }
.prog-row .k, .prog-row .v { font-size: clamp(8.5px, 0.74vw, 11px); }
.prog-track { height: clamp(6px, 0.75vh, 8px); }

.status-strip {
  position: absolute;
  top: clamp(10px, 1.6vh, 20px);
  right: clamp(12px, 6.9vw, 100px);
  left: auto;
  transform: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(6px, 0.9vw, 14px);
  padding: clamp(4px, 0.7vh, 7px) clamp(7px, 0.9vw, 12px);
  width: auto;
  min-height: 0;
  max-width: none;
}
.status-row { grid-template-columns: auto clamp(20px, 2.9vw, 46px) auto; gap: clamp(3px, 0.4vw, 5px); }
.status-track { width: clamp(20px, 2.9vw, 46px); height: clamp(6px, 0.75vh, 8px); }
.status-row .k, .status-row .v { font-size: clamp(7.5px, 0.7vw, 10px); }

/* 信息框与晋升块同宽（都占 --hud-w），文字随 vw 等比缩放不换行 */
.hud { width: max-content; }
.info-box {
  flex: 0 0 auto;
  width: var(--hud-w);
}
.info-box .date { white-space: nowrap; }
.info-box .meta { white-space: nowrap; }
.progress-line { width: var(--hud-w); }

@media (max-width: 710px) {
  .status-row { grid-template-columns: auto clamp(14px, 4vw, 26px) auto; }
  .status-track { width: clamp(14px, 4vw, 26px); }
  .status-strip { right: 8px; }
}

/* 事件插画作为背景时的融合处理：淡入 + 轻压 + 边缘柔化 */
.stage-art.cg {
  filter: saturate(1.02) contrast(1.02) brightness(.99);
  -webkit-mask-image: radial-gradient(120% 100% at 50% 42%, #000 55%, rgba(0,0,0,.92) 78%, rgba(0,0,0,.82) 100%);
  mask-image: radial-gradient(120% 100% at 50% 42%, #000 55%, rgba(0,0,0,.92) 78%, rgba(0,0,0,.82) 100%);
}
@media (prefers-reduced-motion: no-preference) {
  .stage-art.cg-enter { animation: cg-in .55s ease both; }
}
@keyframes cg-in {
  from { opacity: .35; transform: scale(1.015); }
  to { opacity: 1; transform: none; }
}
.vn-shell:has(.stage-art.cg) .stage-vignette {
  background:
    linear-gradient(180deg, rgba(20,14,9,.42) 0%, rgba(20,14,9,.06) 24%,
                    rgba(20,14,9,.10) 48%, rgba(20,14,9,.55) 82%, rgba(20,14,9,.78) 100%);
}

/* 有事件插画时：弹窗遮罩减淡，让画面透出来 */
.vn-shell.has-cg .scene-layer {
  background: rgba(20, 14, 9, .26);
  backdrop-filter: blur(1px);
}
.vn-shell.has-cg .scene-card {
  box-shadow: 0 30px 70px rgba(20, 14, 9, .55), inset 0 0 0 3px rgba(255, 255, 255, .5);
}
.vn-shell.has-cg .stage-vignette {
  background:
    linear-gradient(180deg, rgba(20,14,9,.34) 0%, rgba(20,14,9,.04) 22%,
                    rgba(20,14,9,.06) 46%, rgba(20,14,9,.42) 80%, rgba(20,14,9,.68) 100%);
}

/* 专属结局图的主角位于右侧，窄屏把裁切区域推向人物。 */
@media (max-width: 710px) {
  .stage-art.ending-art { background-position: 84% center; }
  .vn-shell:has(.stage-art.ending-art) .curtain { align-items: end; }
  .vn-shell:has(.stage-art.ending-art) .curtain-card { max-height: 60dvh; }
}

/* Event cards share the stage, dialogue, cover and save controls with the long-form view. */
.story-reader .vn-shell {
  color: #192d34;
  background: linear-gradient(145deg, #284954 0%, #456a74 50%, #c7ccc2 100%);
}
.story-reader .stage-art { background-position: center; background-size: cover; }
.story-reader .vn-frame { display: none; }
.story-reader .curtain-card, .story-reader dialog.vn-modal {
  background: #faf8f2;
  border: 1px solid #d5d8ce;
  box-shadow: 0 12px 56px #17272c38;
  border-radius: 5px;
}
.story-reader .curtain-card { padding: clamp(24px, 5vw, 56px); }
.story-reader .curtain-card::before, .story-reader .curtain-card::after,
.story-reader .start-btn::before, .story-reader .choice::before { content: none; }
.story-reader .game-title { color: #213e48; }
.story-reader .game-title small:empty, .story-reader .game-subtitle:empty { display: none; }
.story-reader .start-btn, .story-reader .modal-btn, .story-reader .slot-btn {
  color: #fff; background: #2d505a; border: 1px solid #2d505a; padding: .62em 1em; border-radius: 3px;
}
.story-reader .story-play {
  min-height: 100dvh; height: auto; display: flex; flex-direction: column; justify-content: space-between;
  gap: clamp(30px, 16vh, 180px); align-items: center; padding: clamp(16px, 4vw, 48px);
}
.story-head, .story-card {
  position: relative; width: min(860px, 100%); background: #faf8f2f5; border-radius: 4px; z-index: 1;
  box-shadow: 0 12px 45px #16252b38;
}
.story-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding: 15px 24px; }
.story-head h1 { font-size: 1.1rem; margin: 2px 0 0; }
.story-link { background: none; border: 1px solid #627776; color: #213e48; border-radius: 3px; padding: .3em .7em; cursor: pointer; margin-left: .65em; }
.story-card { padding: clamp(18px, 3vw, 38px); }
.story-card h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin: .8em 0 .5em; color: #1c3942; }
.story-portrait { position: absolute; inset: 0; overflow: hidden; }
.story-portrait img { height: 85%; position: absolute; right: 12%; bottom: 0; object-fit: contain; }
.story-axes, .story-routes { display: flex; gap: .4em 1.1em; flex-wrap: wrap; font-size: .85rem; color: #3a565a; }
.story-promotion { color: #9a571e; font-weight: bold; }
.story-reader .story-card .dialogue { position: static; background: none; padding: 0; min-height: 4.7em; }
.story-reader .story-card .dialogue::after, .story-reader .story-card .dialogue::before { display: none; }
.story-reader .story-card .speaker { color: #44636b; }
.story-reader .story-card .line { color: #1b343a; margin: .3em 0; }
.story-choices { display: grid; gap: 8px; margin: 16px 0; }
.story-reader .story-choices .choice {
  width: 100%; text-align: left; white-space: normal; height: auto; min-height: 42px;
  padding: 9px 16px; background: #eef0e8; color: #213b42; border: 1px solid #b7c4bd; border-radius: 3px;
}
.story-reader .story-choices .choice:hover, .story-reader .story-choices .choice:focus-visible { background: #d7e4df; }

.story-reader .story-opening { justify-items: start; padding-inline: clamp(16px, 6vw, 100px); }
.story-reader .story-opening .curtain-card { width: min(520px, 55vw); margin: 0; }
@media (max-width: 640px) {
  .story-reader .story-opening { align-items: end; }
  .story-reader .story-opening .curtain-card { width: 100%; }
  .story-reader .story-portrait img { height: 70%; bottom: 26%; right: 5%; }
}

/* 章节与选项结果图把主要人物安排在舞台右侧。 */
@media (max-width: 710px) {
  .stage-art.narrative-art { background-position: 77% center; }
}

.challenge-goal { margin: .85rem auto; font-size: .94rem; color: #725425; }
.challenge-links, .challenge-result { display: flex; justify-content: center; flex-wrap: wrap; gap: .55rem 1rem; margin: .85rem 0; }
.challenge-links button {
  background: transparent; border: 0; border-bottom: 1px solid currentColor; color: #37595c;
  cursor: pointer; font: inherit; padding: .25rem .1rem;
}
.challenge-result { padding: .7rem 0; border-block: 1px solid #bcae8d; font-size: .9rem; }
.challenge-next { color: #3e5552; margin-bottom: .85rem; font-size: .92rem; }
.challenge-next summary { cursor: pointer; font-weight: 650; }
.challenge-next p { margin: .35rem 0; }
.story-reader .story-choices .choice:disabled { background: #eeede7; color: #686a63; border-color: #cccdc5; cursor: default; }
.story-choices .choice small { display: block; font-size: .79rem; margin-top: 3px; }
dialog.challenge-dialog {
  transform: none;
  position: fixed; inset: 0; margin: auto; width: min(34rem, calc(100vw - 1.5rem));
  max-height: 86dvh; overflow: auto; padding: clamp(18px, 4vw, 32px);
  border: 1px solid #9dafa8; border-radius: 8px; background: #faf8f2;
  color: #263f40; font: 1rem/1.55 system-ui, sans-serif; box-shadow: 0 18px 80px #12262640;
}
.challenge-dialog::backdrop { background: #11252199; }
.challenge-dialog header, .challenge-dialog nav { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.challenge-dialog header { justify-content: space-between; margin-bottom: .65rem; }
.challenge-dialog h2, .challenge-dialog h3 { margin: 0; }
.challenge-dialog h3 { margin-top: .8rem; }
.challenge-dialog button { cursor: pointer; border: 1px solid #9baa9c; border-radius: 4px; padding: .45rem .65rem; color: #294c49; background: #eef1e8; margin: .2rem .35rem .2rem 0; font: inherit; }
.challenge-dialog button:disabled { opacity: .58; }
.challenge-dialog nav { padding-bottom: .6rem; border-bottom: 1px solid #cdd3c7; }
.challenge-dialog nav button { border: 0; background: transparent; padding-left: 0; font-size: .9rem; }
.challenge-dialog label { display: grid; gap: .23rem; margin: .65rem 0 .18rem; font-size: .85rem; }
.challenge-dialog input { background: white; border: 1px solid #a3ada4; color: #203833; border-radius: 4px; padding: .5rem; font: inherit; }
.challenge-dialog table { margin: .65rem 0; border-collapse: collapse; width: 100%; font-size: .84rem; }
.challenge-dialog td, .challenge-dialog th { padding: .45rem .22rem; text-align: left; border-bottom: 1px solid #ced5ca; }
.challenge-dialog .room-code { letter-spacing: .12em; user-select: all; }
.challenge-history { list-style: none; margin: .45rem 0; padding: 0; }
.challenge-history li { display: grid; padding: .55rem 0; border-bottom: 1px solid #d9dcd3; }
.challenge-history li span { color: #566b66; font-size: .85rem; }
.challenge-dialog .hub-status { color: #983e35; margin: .5rem 0 0; }

.panel-card.journal-panel {
  display: flex;
  flex-direction: column;
  max-height: min(82dvh, 820px);
  overflow: hidden;
}
.journal-panel h2 { flex: none; padding-right: 32px; }
.journal-cards {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.journal-card {
  display: grid;
  grid-template-columns: clamp(112px, 19vw, 184px) minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.journal-card:first-child { padding-top: 2px; }
.journal-card:last-child { border-bottom: 0; }
.journal-image { display: block; align-self: start; }
.journal-image:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; }
.journal-image img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 2px;
  background: #e5dac3;
}
.journal-caption { overflow-wrap: anywhere; }
.journal-caption a { display: inline-block; padding-block: 4px; color: var(--vermilion-deep); font-size: 13px; text-underline-offset: 3px; }
.journal-caption a:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 2px; }
.journal-caption time { color: #695742; font-size: 12px; }
.journal-caption h3 { margin: 3px 0 6px; font: 700 17px/1.35 var(--display); color: var(--ink); }
.journal-caption p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--ink-soft); }
@media (max-width: 560px) {
  .panel-card.journal-panel { width: 100%; max-height: 86dvh; padding: 24px 16px; }
  .journal-card { grid-template-columns: 86px minmax(0, 1fr); align-items: start; gap: 12px; }
  .journal-caption h3 { font-size: 16px; }
}
@media (max-width: 710px) and (orientation: portrait) {
  .illustrated-journal .rail {
    position: absolute;
    top: 45%;
    right: 6px;
    transform: translateY(-50%);
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 6px 4px;
  }
  .illustrated-journal .rail-btn { min-height: 34px; }
}

/* 正戏专图铺满屏幕，轻压顶部和底部以保留文字对比。 */
.illustrated-journal .has-cg .stage-art {
  background-size: cover;
  background-repeat: no-repeat;
  filter: none;
  mask-image: none;
}
.illustrated-journal .has-cg .stage::after { content: none; }
.illustrated-journal .has-cg .stage-vignette {
  background: linear-gradient(180deg, rgba(26, 18, 12, .22), transparent 24%,
                                     transparent 70%, rgba(26, 18, 12, .28));
}

.stage-art.intro-art { background-position: 50% 11%; }

/* 竖屏自动使用对应分镜，快捷菜单位于下方。 */
@media (orientation: portrait) {
  .illustrated-journal .vn-shell.has-cg {
    display: grid;
    grid-template: auto minmax(0, 1fr) auto auto / minmax(0, 1fr);
  }
  .illustrated-journal .has-cg .topbar {
    position: relative;
    grid-row: 1;
    height: auto;
    padding: clamp(8px, 1.6vh, 20px) clamp(8px, 1.4vw, 20px) 0;
  }
  .illustrated-journal .has-cg .topbar-left { position: static; }
  .illustrated-journal .has-cg .stage-art.journal-art { background-position: 70% center; }
  .illustrated-journal .vn-shell .stage-art.has-portrait-stage {
    --stage-responsive: var(--stage-portrait);
    background-position: var(--stage-portrait-x, 50%) center;
  }
  .illustrated-journal .vn-shell:has(.stage-art.has-portrait-stage) .curtain { align-items: end; }
  .vn-shell:has(.has-portrait-stage) .scene-layer {
    align-items: end;
    padding: 0 6px max(6px, env(safe-area-inset-bottom));
    background: linear-gradient(transparent 54%, rgba(24, 16, 10, .3));
    backdrop-filter: none;
  }
  .vn-shell:has(.has-portrait-stage) .scene-card {
    width: min(100%, 620px);
    max-height: 40dvh;
    min-height: 0;
    padding: 12px 20px;
  }
  .vn-shell:has(.has-portrait-stage) .scene-text { margin-bottom: 6px; line-height: 1.55; }
  .vn-shell:has(.has-portrait-stage):has(.scene-layer) :is(.rail, .bottom) {
    visibility: hidden;
  }
  .illustrated-journal .has-cg .rail {
    position: relative;
    inset: auto;
    transform: none;
    grid-row: 3;
    justify-self: center;
    display: flex;
    gap: clamp(2px, 1vw, 10px);
    margin: 0 0 4px;
    padding: 4px 8px;
    background: var(--paper);
    border: 1px solid var(--gold-deep);
    border-radius: 5px;
  }
  .illustrated-journal .has-cg .rail-btn {
    width: auto;
    min-height: 34px;
    grid-auto-flow: column;
    align-items: center;
    gap: 4px;
    padding: 4px clamp(3px, 1vw, 9px);
  }
  .illustrated-journal .has-cg .bottom { position: relative; grid-row: 4; }
}

.illustrated-journal #startForm .name-input { min-width: 0; }
.illustrated-journal #startForm .start-btn { flex: none; white-space: nowrap; }

@media (max-width: 480px) {
  .illustrated-journal #startForm .scene-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .illustrated-journal #startForm :is(.name-input, .start-btn) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
}

/* 北燕正戏：第一行容纳状态，宫务菜单与晋升面板共用下一行的起点。 */
.illustrated-journal .vn-shell.court-menu {
  --menu-width: clamp(59px, 9vw, 94px);
  --left-edge: max(clamp(5px, 1vw, 16px), env(safe-area-inset-left));
  --right-edge: max(clamp(5px, 1vw, 16px), env(safe-area-inset-right));
  --hud-indent: clamp(8px, 1.4vw, 20px);
  --menu-gap: clamp(3px, .65dvh, 8px);
  --plaque-height: clamp(17px, 1.85vw, 24px);
  display: grid;
  grid-template: auto minmax(0, 1fr) auto / minmax(0, 1fr);
}
.vn-shell.court-menu > .topbar {
  position: relative;
  inset: auto;
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: 3px;
  height: auto;
  padding: max(clamp(8px, 1.6vh, 20px), env(safe-area-inset-top)) var(--right-edge) 0 var(--hud-indent);
}
.vn-shell.court-menu .topbar-left { position: static; width: max-content; }
.vn-shell.court-menu .status-strip { position: static; justify-self: end; margin: 0; width: max-content; }
/* Keep the six buttons inside both gold rails of the stage frame. */
.vn-shell.court-menu > .bottom {
  --frame-clearance: calc(var(--frame) + 12px);
  position: relative;
  inset: auto;
  grid-area: 3 / 1;
  min-width: 0;
  padding-bottom: max(var(--frame-clearance), env(safe-area-inset-bottom));
  padding-left: max(var(--frame-clearance), env(safe-area-inset-left));
  padding-right: max(var(--frame-clearance), env(safe-area-inset-right));
}

/* Nine-slicing keeps the gilded corners proportional as the text wraps. */
.court-menu :is(.panel-sheet, .journal-panel) {
  background: transparent;
  backdrop-filter: none;
  border: 0 solid transparent;
  border-image: url("../assets/ui-menu/ui_journal_paper.png") 62 84 fill /
    clamp(16px, 2.5vw, 25px) clamp(21px, 3.4vw, 34px) / 0 stretch;
  border-radius: 0;
  box-shadow: none;
}
.court-menu .panel-sheet { padding-inline: clamp(22px, 3.4vw, 48px); }
.court-menu :is(.panel-sheet .nameplate, .journal-panel h2) {
  position: relative;
  border-bottom: 1px solid #bf9d71;
}
.court-menu :is(.panel-sheet .nameplate, .journal-panel h2)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 5px;
  height: 5px;
  background: #f7efe2;
  border: 1px solid #b18b60;
  transform: translateX(-50%) rotate(45deg);
  pointer-events: none;
}
.court-controls {
  position: relative;
  z-index: 8;
  grid-area: 2 / 1;
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
  margin-top: clamp(4px, .8vh, 8px);
  min-height: 0;
  container-type: size;
  pointer-events: none;
}
.court-controls > .progress-line {
  grid-area: 1 / 1;
  align-self: start;
  margin-inline-start: calc(var(--hud-indent) + clamp(34px, 3.4vw, 58px) + clamp(6px, .7vw, 10px));
}
.vn-shell.court-menu :is(.rail, .court-tools) {
  position: relative;
  inset: auto;
  transform: none;
  width: var(--menu-width);
  min-width: 0;
  min-height: 0;
  padding: 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--menu-gap);
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  background: none;
  border: 0;
  box-shadow: none;
  pointer-events: auto;
}
.vn-shell.court-menu .rail {
  grid-area: 2 / 1;
  place-self: stretch start;
  justify-content: safe center;
  margin: 0 0 0 var(--left-edge);
}
.vn-shell.court-menu .court-tools {
  grid-area: 1 / 1 / 3 / 2;
  place-self: start end;
  max-height: 100%;
  justify-content: start;
  margin: 0 var(--right-edge) 0 0;
}
.vn-shell.court-menu .rail-btn {
  --emblem: clamp(27px, min(calc(var(--menu-width) - 10px), calc(20cqh - var(--plaque-height) - var(--menu-gap) - 18px)), 82px);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0;
  gap: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: #fff0ca;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.court-menu .rail-emblem {
  display: block;
  width: var(--emblem);
  height: var(--emblem);
  object-fit: contain;
  filter: drop-shadow(0 1px 2px #281507a3);
}
.court-menu .rail-btn > span {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: min(100%, calc(var(--emblem) + 13px));
  height: var(--plaque-height);
  margin-top: -3px;
  line-height: 1;
  white-space: nowrap;
  font-family: var(--display);
  font-size: clamp(12px, 1.2vw, 17px);
  font-weight: 600;
  letter-spacing: .1em;
  text-indent: .1em;
  text-shadow: 0 1px 2px #271308;
}
.court-menu .rail-plaque {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.vn-shell.court-menu .rail-btn:focus-visible { outline: 2px solid #ffdc90; outline-offset: -2px; }
@media (hover: hover) {
  .vn-shell.court-menu .rail-btn:hover { filter: brightness(1.16); }
}
.vn-shell.court-menu .rail-btn:active { filter: brightness(.85); }

.vn-shell.court-menu:has(.scene-layer) .court-tools { visibility: hidden; }
.vn-shell.court-menu .rail-btn:disabled { opacity: 1; color: #d3c5aa; cursor: default; }
.vn-shell.court-menu .rail-btn:disabled .rail-emblem { filter: saturate(.35) brightness(.77); }
.vn-shell.court-menu .court-actions {
  display: grid;
  width: min(100%, 1008px);
  margin-inline: auto;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(2px, .45vw, 7px);
  padding: 0;
  background: none;
}
.vn-shell.court-menu .actionbar .court-action {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  height: clamp(46px, 8.4dvh, 83px);
  padding: 2px;
  gap: 1px;
  background: none;
  border: 0;
  box-shadow: none;
  font-family: var(--display);
  color: #ffedc9;
  text-shadow: 0 1px 2px #211109;
}
.vn-shell.court-menu .actionbar .court-action::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-style: solid;
  border-width: 12px 11px 19px 24px;
  border-image: var(--action-frame) 48 44 76 94 fill / 12px 11px 19px 24px / 0 stretch;
  background: transparent;
  box-shadow: none;
  opacity: 1;
}
.court-action img {
  display: block;
  width: 64%;
  height: 49%;
  object-fit: contain;
  pointer-events: none;
}
.vn-shell.court-menu .court-action span { font-size: clamp(13px, 1.4vw, 19px); line-height: 1.1; letter-spacing: .1em; }
.vn-shell.court-menu .court-action::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 5px;
  box-shadow: inset 0 0 12px #e9bd645e, 0 0 5px #f8cc7a90;
  background: linear-gradient(115deg, #b5813a35, #f6d58e20);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}
.vn-shell.court-menu .court-action:focus-visible::after,
.vn-shell.court-menu .court-action:active:not(:disabled)::after { opacity: 1; }
.vn-shell.court-menu .court-action:focus-visible { outline: 2px solid #ffe4a1; outline-offset: -3px; }
@media (hover: hover) {
  .vn-shell.court-menu .court-action:hover:not(:disabled)::after { opacity: 1; }
  .vn-shell.court-menu .court-action:hover:not(:disabled)::before { filter: brightness(1.4); }
}
.vn-shell.court-menu .court-action:active:not(:disabled)::before { filter: brightness(1.55); }
.vn-shell.court-menu .court-action:is(:disabled, [data-rank-locked]) { opacity: 1; color: #c9bc9e; }
.vn-shell.court-menu .court-action:is(:disabled, [data-rank-locked]) img { filter: saturate(.4) brightness(.72); }
@media (max-width: 374px) {
  .vn-shell.court-menu { --hud-w: 120px; }
  .vn-shell.court-menu .status-strip { gap: 3px; padding-inline: 4px; }
}

/* 矮横屏的对白让出两侧，左右菜单都能利用到视口底部。 */
@media (orientation: landscape) and (max-height: 560px) {
  .illustrated-journal .vn-shell.court-menu {
    --menu-width: clamp(54px, 8vw, 72px);
    --plaque-height: 17px;
    grid-template-columns: calc(var(--left-edge) + var(--menu-width) + 4px) minmax(0, 1fr) calc(var(--right-edge) + var(--menu-width) + 4px);
  }
  .vn-shell.court-menu > .topbar { grid-column: 1 / -1; }
  .vn-shell.court-menu > .bottom { grid-column: 2; }
  .court-controls { grid-area: 2 / 1 / 4 / -1; margin-bottom: max(3px, env(safe-area-inset-bottom)); }
  .court-controls > .progress-line { margin-inline-start: calc(var(--left-edge) + var(--menu-width) + 4px); }
  .vn-shell.court-menu .rail { grid-row: 1 / 3; }
  .vn-shell.court-menu .rail-btn { --emblem: clamp(27px, min(calc(var(--menu-width) - 10px), calc(20cqh - var(--plaque-height) - var(--menu-gap))), 63px); }
}

@media (max-width: 600px) {
  .vn-shell.court-menu .actionbar .court-action::before { border-image-width: 10px 9px 16px 20px; }
}

/* 剧情卡贴底，领牌和结局卡居中。 */
.illustrated-journal .vn-shell:has(.sheet-body) > .vn-frame { z-index: 1; }
.illustrated-journal .vn-shell :is(.curtain, .scene-layer) {
  align-items: end;
  padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
}
.illustrated-journal .vn-shell :is(.curtain-card, .scene-card):has(> .sheet-body) {
  display: grid;
  grid-template-rows: minmax(min(2.4em, 9dvh), 1fr) auto;
  width: min(100%, 760px);
  height: 40vh;
  height: 40dvh;
  max-height: none;
  min-height: min-content;
  overflow: hidden;
  padding: clamp(9px, 1.9dvh, 19px) clamp(14px, 3.8vw, 36px) max(6px, env(safe-area-inset-bottom));
}
.sheet-body {
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  padding: 0 clamp(10px, 1.5vw, 16px) 6px;
}
.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px clamp(4px, .7vw, 8px);
  padding: 5px 2px 2px;
  border-top: 1px solid #c8ac80;
}
.sheet-actions > div { display: contents; }
.sheet-actions button {
  flex: 0 0 auto;
  max-width: 100%;
  width: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  margin: 0;
}
.illustrated-journal .sheet-actions :is(.start-btn, .choice, .act, .challenge-links button) {
  min-height: 40px;
  margin: 0;
  padding: 5px clamp(8px, 1.3vw, 16px);
  font-size: clamp(13px, 1.4vw, 16px);
  line-height: 1.3;
}
.sheet-actions .choice { gap: 3px; letter-spacing: 0; }
.sheet-body:focus-visible { outline: 1px solid #aa8152; outline-offset: -2px; }
:is(.sheet-body, .fengming-ui :is(.curtain-card, .panel-card, .menu-panel-body, .scroll-card, .journal-cards, .journal-list, .vn-modal, .slot-list, .challenge-dialog, .fengming-screen))::-webkit-scrollbar { width: 6px; height: 5px; }
:is(.sheet-body, .fengming-ui :is(.curtain-card, .panel-card, .menu-panel-body, .scroll-card, .journal-cards, .journal-list, .vn-modal, .slot-list, .challenge-dialog, .fengming-screen))::-webkit-scrollbar-track { background: #d5c1a23b; border-radius: 6px; }
:is(.sheet-body, .fengming-ui :is(.curtain-card, .panel-card, .menu-panel-body, .scroll-card, .journal-cards, .journal-list, .vn-modal, .slot-list, .challenge-dialog, .fengming-screen))::-webkit-scrollbar-thumb { background: #a88350; border: 1px solid #e7d5b5; border-radius: 6px; }
@supports not selector(::-webkit-scrollbar) {
  :is(.sheet-body, .fengming-ui :is(.curtain-card, .panel-card, .menu-panel-body, .scroll-card, .journal-cards, .journal-list, .vn-modal, .slot-list, .challenge-dialog, .fengming-screen)) { scrollbar-width: thin; scrollbar-color: #a88350 #ecdfc8; }
}
@keyframes sheet-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: no-preference) {
  .illustrated-journal .scene-layer .sheet-enter { animation: sheet-rise .25s cubic-bezier(.2,.7,.3,1) both; }
}
@media (prefers-reduced-motion: reduce) {
  .illustrated-journal :is(.curtain-card, .scene-card):has(> .sheet-body) { animation: none; }
}

@media (max-width: 374px) {
  .illustrated-journal .sheet-actions :is(.start-btn, .challenge-links button) {
    padding-inline: 4px;
    letter-spacing: 0;
  }
}

/* Scene footers show all choices in reading order, including the return action. */
.sheet-actions {
  max-height: 24dvh;
  overflow: auto;
  align-content: start;
}
.illustrated-journal .sheet-actions .scene-actions > button {
  min-width: 0;
  justify-content: center;
  padding-inline: clamp(3px, .7vw, 8px);
  text-align: center;
}
.sheet-actions .choice .index { width: 17px; height: 17px; }
.market-details { margin: 0; padding: 0; list-style: none; }
.market-details li { padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.sheet-actions:has(.scene-actions > :nth-child(9)) .choice .index { display: none; }

@media (max-height: 600px) {
  .illustrated-journal .sheet-actions .scene-actions > button { min-height: 28px; padding-block: 2px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .sheet-actions { gap: 3px; }
  .sheet-actions .choice { gap: 2px; }
}

/* On a small screen the catalog fits as four columns, with its descriptions above. */
@media (max-width: 374px), (orientation: landscape) and (max-height: 480px) {
  .illustrated-journal .sheet-actions:has(.scene-actions > :nth-child(9)) button {
    font-size: 12px;
    letter-spacing: 0;
    padding-inline: 2px;
    min-height: 26px;
  }
}
/* 宫中舆图：各行按屏幕高度分配，建筑和地名都留在格内。 */
.panel-layer:has(> .palace-map) {
  padding: clamp(8px, 3dvh, 24px) clamp(8px, 3vw, 24px);
}
.panel-card.palace-map {
  padding: clamp(14px, 3.5dvh, 36px) clamp(12px, 4vw, 34px);
}
.palace-map h2 { margin-bottom: clamp(5px, 1.5dvh, 14px); }
.palace-map .map-ground {
  grid-template: repeat(3, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr));
  height: min(49dvh, 380px);
  gap: 3px 2px;
}
.palace-map .map-plot {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  aspect-ratio: auto;
  padding: 2px 0;
}
.palace-map .map-label {
  position: relative;
  inset: auto;
  grid-area: 1 / 1;
  font-size: clamp(11px, 2.4vw, 13px);
}
.palace-map .map-building {
  grid-area: 2 / 1;
  width: min(84%, 152px);
  height: 100%;
  margin: 0;
  object-fit: contain;
}
.palace-map .map-plot button { z-index: 1; }
.palace-map .map-plot button:focus-visible { outline-offset: -2px; }
.palace-map .map-legend {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  padding: 0 clamp(8px, 4vw, 42px) 2px;
}
.palace-map .map-legend .act {
  min-width: 8em;
  padding-inline: .75em;
  white-space: nowrap;
}
.palace-map .map-caption strong { color: var(--ink); }

.fengming-screen {
  overflow: hidden auto;
  isolation: isolate;
  background: #280a08;
  color: #ffebbe;
  text-align: center;
  font-family: var(--display);
}
.fengming-screen::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 28%, #5c17092b, #1e0608e8 72%),
    var(--title-cover) center 38% / cover;
  filter: blur(20px);
}
.fengming-cover {
  position: relative;
  width: min(100%, 554px);
  min-height: 100%;
  margin-inline: auto;
  padding: max(12px, 1.8dvh, env(safe-area-inset-top)) clamp(18px, 5.2vw, 32px)
    max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, #330c0c14 0%, transparent 35%, #2a07080d 49%, #2a0708de 79%, #240607 100%),
    var(--title-cover) center top / 100% auto no-repeat,
    #270808;
  box-shadow: 0 0 62px #16030388;
}
.fengming-heading h1 {
  font: 800 clamp(46px, 15.5vw, 76px)/1.08 "STXingkai", "Kaiti SC", KaiTi, var(--display);
  letter-spacing: .035em;
  color: #f8d181;
  text-shadow: 0 2px 3px #441106, 0 0 24px #4e130b;
}
.fengming-heading img {
  display: block;
  width: min(74%, 292px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 2px 3px #441106);
}
.fengming-heading p {
  margin-top: 2px;
  font-size: clamp(14px, 4.4vw, 20px);
  line-height: 1.3;
  letter-spacing: .16em;
  font-weight: 700;
  text-shadow: 0 1px 5px #2c0707;
}
.fengming-intro {
  margin-top: clamp(92px, 24.8dvh, 230px);
  padding: clamp(11px, 1.8dvh, 18px) clamp(17px, 6vw, 44px);
  color: #49230d;
  border: 3px double #9e6021;
  border-radius: 10px;
  background: #fff0c8 url("../assets/ui/ui_panel_rect-a.png") center / 100% 100% no-repeat;
  box-shadow: 0 0 0 2px #ffd48b, 0 6px 17px #2607078c;
}
.fengming-intro h2 {
  margin-bottom: 4px;
  color: #781709;
  font-size: clamp(20px, 5.2vw, 28px);
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.4;
}
.fengming-intro p {
  text-align: start;
  font-size: clamp(12px, 3.3vw, 15px);
  font-weight: 600;
  line-height: 1.54;
  overflow-wrap: anywhere;
}
.fengming-name {
  display: grid;
  justify-items: center;
  gap: 3px;
  margin-top: clamp(10px, 1.6dvh, 15px);
}
.fengming-name label {
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .12em;
  text-shadow: 0 1px 4px #3b1008;
}
#startForm.fengming-name .name-input {
  width: min(80%, 320px);
  min-height: 38px;
  margin: 0;
  padding: 3px 11px;
  color: #49230d;
  background: linear-gradient(115deg, #fff3d2, #f9e3aa);
  border: 3px double #a66a28;
  border-radius: 9px;
  box-shadow: 0 0 0 1px #f4c364, 0 2px 5px #310a0a90;
  font: 600 clamp(16px, 4.2vw, 18px)/1.3 var(--display);
}
.fengming-name .name-input::placeholder { color: #7b4b21; }
.fengming-name .form-error {
  margin: 0;
  color: #ffe6a9;
  font: 600 13px/1.45 var(--display);
}
.fengming-name .form-error:empty { display: none; }
.fengming-promise {
  margin: clamp(9px, 1.5dvh, 14px) 0 10px;
  line-height: 1.44;
  text-shadow: 0 1px 5px #270808;
  font-weight: 700;
}
.fengming-promise p { font-size: clamp(14px, 4.3vw, 20px); }
.fengming-promise ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px clamp(8px, 3vw, 22px);
  list-style: none;
  font-size: clamp(11px, 3.25vw, 15px);
}
.fengming-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-inline: clamp(0px, 1.4vw, 10px);
}
.fengming-actions button {
  min-width: 0;
  min-height: 41px;
  margin: 0;
  padding: 4px;
  border: 1px solid #efb75d;
  border-radius: 8px;
  background: linear-gradient(115deg, #47120cda, #220605e8);
  box-shadow: inset 0 0 0 1px #b66d363d;
  color: #ffebbc;
  font: 700 clamp(14px, 4.3vw, 21px)/1.3 var(--display);
  letter-spacing: .09em;
}
.fengming-actions :is(.start-btn, [data-command="friends"]) { grid-column: 1 / -1; }
.fengming-actions .start-btn {
  min-height: 49px;
  border: 4px double #f4bf69;
  background: #8d180d url("../assets/ui/ui_btn_red-a.png") center / 100% 100% no-repeat;
  color: #ffe9aa;
  font: 800 clamp(24px, 7.3vw, 33px)/1.15 "STXingkai", "Kaiti SC", KaiTi, var(--display);
  letter-spacing: .14em;
  text-shadow: 0 1px 3px #521005;
}
.fengming-actions button:hover { filter: brightness(1.16); }
.fengming-cover :is(button, input):focus-visible { outline-color: #ffdf92; }

@media (max-height: 720px) {
  .fengming-intro { margin-top: clamp(86px, 23dvh, 165px); }
}

@media (min-width: 601px) {
  .fengming-intro { margin-top: clamp(80px, 19.1dvh, 205px); }
}

.career-portrait {
  width: clamp(42px, 8vw, 58px);
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 26%;
  border: 1px solid var(--gold-deep);
  border-radius: 4px;
}

.illustrated-journal .vn-shell .curtain.curtain-centered,
.fengming-ui .vn-shell .curtain.curtain-centered {
  align-items: center;
  padding-block: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-bottom));
}

.curtain-centered > .curtain-card { align-self: center; }

.fengming-ui .curtain-centered > .curtain-card:has(> .sheet-body) {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 40dvh;
  max-height: 80dvh;
  overflow: hidden;
}
.fengming-ui .curtain-centered .sheet-body { flex: 1 1 auto; }
.fengming-ui .curtain-centered .sheet-actions {
  flex: none;
  max-height: 36dvh;
}

.panel-card.menu-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.menu-panel-header { position: relative; }
.menu-panel-header h2 { padding-inline: 32px; }
.menu-panel-header .panel-close {
  top: 0;
  right: 0;
  z-index: 1;
}
.menu-panel-body {
  min-height: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
  padding-block: 3px;
}
.menu-panel-body:focus-visible { outline: 1px solid var(--gold-deep); outline-offset: -1px; }
.menu-panel[data-panel-card] .menu-panel-body .scroll-card {
  max-height: none;
  overflow: visible;
  mask-image: none;
}
.fengming-ui .map-legend .act {
  min-width: 0;
  padding-inline: 1.35em;
}

/* 复用舆图的透明描金牌匾，按钮两端留出花饰位置。 */
.fengming-ui :is(.scene-actions .act.primary, .curtain-card .start-btn, .vn-modal .modal-btn:first-of-type, .fengming-actions .start-btn) {
  width: fit-content;
  max-width: 100%;
  padding-inline: 1.4em;
  justify-self: center;
  align-self: center;
  border: 0;
  background: transparent url("../assets/ui/ui_plaque_gold-a.png") center / 100% 100% no-repeat;
  box-shadow: none;
  color: #33240f;
  text-shadow: none;
  white-space: normal;
}
.fengming-ui :is(.scene-actions .act.primary, .curtain-card .start-btn)::before { content: none; }
.fengming-ui :is(.scene-actions .act.primary, .curtain-card .start-btn, .vn-modal .modal-btn:first-of-type, .fengming-actions .start-btn):hover {
  filter: brightness(.95);
}
.fengming-ui .sheet-actions .scene-actions > .choice {
  flex: 0 1 auto;
  width: fit-content;
  padding-inline: 1.15em;
}
.fengming-ui .fengming-actions .start-btn { min-width: 7em; }
