:root {
  /* 墨玉主题 */
  --bg: #0b1114;
  --bg-deep: #0e171c;
  --panel: #16212a;
  --panel-2: #1a252d;
  --line: #2b3d47;
  --line-soft: #22323c;

  --ink: #dde7ec;
  --ink-mid: #a8bcc6;
  --ink-soft: #7e919d;
  --ink-dim: #5b707b;

  --jade: #4e7a72;
  --jade-bright: #8fe0cf;
  --jade-soft: #1c3138;

  --gold: #e8b856;
  --gold-soft: #2a2318;

  --seal: #c9684f;
  --good: #5cae86;
  --bad: #d16a58;

  --shadow: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, .62);
}

/* 夜晚（同一套，稍微变冷） */
body.night {
  --bg: #080d10;
  --bg-deep: #0a1116;
  --panel: #121b21;
  --panel-2: #162027;
  --line: #24333b;
  --line-soft: #1d2a31;
  --ink: #ccd9e0;
  --ink-mid: #94a8b3;
  --ink-soft: #6d818d;
  --jade-bright: #7fd0c0;
  --gold: #d8ac52;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%; height: 100dvh;
  background: var(--bg-deep); color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  transition: background .5s, color .5s;
}

#app {
  position: relative;
  max-width: 560px; height: 100%; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: background .5s;
}

/* 宣纸纹理 */
#app::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(120,100,70,.02) 3px 4px),
    radial-gradient(circle at 15% 8%, rgba(255,255,255,.5), transparent 55%),
    radial-gradient(circle at 88% 92%, rgba(200,170,120,.12), transparent 45%);
}
body.night #app::before {
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.012) 3px 4px),
    radial-gradient(circle at 15% 8%, rgba(120,150,180,.12), transparent 55%);
}

/* ===== 顶栏 ===== */
.top {
  flex: 0 0 auto; position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  backdrop-filter: blur(6px);
}
.clock { display: flex; align-items: center; gap: 8px; font-size: 10px; }
.clock .day {
  color: var(--seal); border: 1px solid color-mix(in srgb, var(--seal) 40%, transparent);
  padding: 1px 6px; border-radius: 2px;
}
.clock .time { color: var(--jade); }
.clock .place { color: var(--ink-mid); }
.top-right { display: flex; align-items: center; gap: 8px; }
.step { font-size: 9px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ===== 场景背景（CSS 绘制）===== */
.portrait {
  flex: 0 0 auto;
  height: 18vh; max-height: 170px; min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  position: relative; padding-bottom: 6px; overflow: hidden;
  transition: background .6s;
}
/* 默认：山影 + 天光 */
.portrait::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,250,235,.85), transparent 55%),
    linear-gradient(180deg, #e9dfc8 0%, #f2ead8 40%, #e6dcc4 100%);
  z-index: 0;
}
.portrait::after {
  content: "";
  position: absolute; left: -8%; right: -8%; bottom: 0; height: 62%;
  background: linear-gradient(180deg, #c9bfa6, #b8ad93);
  clip-path: polygon(0 100%, 12% 52%, 26% 74%, 44% 36%, 60% 66%, 76% 44%, 90% 70%, 100% 100%);
  opacity: .55; z-index: 1;
}
body.night .portrait::before {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(140,170,200,.25), transparent 55%),
    linear-gradient(180deg, #1d2531 0%, #232c3a 45%, #1a212c 100%);
}
body.night .portrait::after {
  background: linear-gradient(180deg, #2f3a4a, #232c39);
  opacity: .7;
}

/* 夜晚的月亮 */
.moon {
  position: absolute; right: 26px; top: 18px; z-index: 1;
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #fdf6e0, #ddc99c 72%);
  box-shadow: 0 0 34px rgba(253,246,224,.55);
  opacity: 0; transition: opacity .6s;
}
body.night .moon { opacity: 1; }

/* 人物剪影 */
.figure {
  position: relative; z-index: 2;
  width: 190px; height: 280px;
  display: flex; align-items: flex-end; justify-content: center;
}
.fig-silhouette {
  width: 148px; height: 238px;
  background: linear-gradient(180deg, var(--c) 0%, color-mix(in srgb, var(--c) 50%, #000) 100%);
  border-radius: 52% 52% 12% 12% / 34% 34% 6% 6%;
  opacity: .34;
  box-shadow: 0 10px 40px color-mix(in srgb, var(--c) 25%, transparent);
  animation: breathe 4.5s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.012); } }

.fig-face {
  position: absolute; top: 8px;
  width: 64px; height: 64px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 38%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  display: grid; place-items: center;
  font-family: "STKaiti","KaiTi",serif; font-size: 25px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.fig-shadow {
  position: absolute; bottom: 0; width: 190px; height: 22px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(80,64,40,.22), transparent 70%);
}
.fig-name {
  position: relative; z-index: 2;
  font-family: "STKaiti","KaiTi",serif; font-size: 17px; letter-spacing: 4px;
  color: var(--c); margin-top: 4px;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.fig-title { position: relative; z-index: 2; font-size: 9px; color: var(--ink-soft); margin-top: 2px; letter-spacing: 1px; }

.portrait.unknown .fig-silhouette { opacity: .16; filter: blur(2px); }
.portrait.unknown .fig-face {
  background: rgba(255,255,255,.85);
  border-color: rgba(139,129,113,.4);
  color: var(--ink-soft); font-size: 28px;
  text-shadow: none;
}
.portrait.unknown .fig-name { color: var(--ink-soft); letter-spacing: 2px; font-size: 14px; }

.portrait.scene-mode { align-items: flex-end; justify-content: center; }
.portrait-scene {
  position: relative; z-index: 2;
  font-family: "STKaiti","KaiTi",serif;
  font-size: 26px; letter-spacing: 16px;
  padding-bottom: 26px;
  color: color-mix(in srgb, var(--ink) 26%, transparent);
  text-shadow: 0 0 20px rgba(255,255,255,.55);
  pointer-events: none;
}
body.night .portrait-scene { color: rgba(232,226,212,.32); text-shadow: 0 0 22px rgba(0,0,0,.4); }

/* ===== 对话框 ===== */
.dialog-box {
  flex: 0 0 auto; position: relative; z-index: 3;
  margin: 0 12px 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px);
  border-radius: 3px;
  box-shadow: 0 3px 16px rgba(90,72,40,.1);
  padding: 11px 14px 13px;
}
.speaker {
  font-size: 11px; color: var(--jade); letter-spacing: 2px;
  margin-bottom: 6px; padding-bottom: 5px;
  border-bottom: 1px solid color-mix(in srgb, var(--jade) 25%, transparent);
}
.dialog { max-height: 132px; overflow-y: auto; }
.dialog p { margin: 0 0 5px; font-size: 12.5px; line-height: 1.95; color: var(--ink); }
.ending-desc { color: var(--ink); }

/* ===== 选项 ===== */
.hint-bar {
  flex: 0 0 auto; position: relative; z-index: 3;
  text-align: center; font-size: 10px; color: var(--gold);
  padding: 4px 0 7px; letter-spacing: 2px;
  animation: hintPulse 2s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

.choices {
  flex: 0 0 auto; position: relative; z-index: 3;
  display: flex; flex-direction: column; gap: 6px;
  padding: 0 12px 10px;
}
/* 选项：宣纸签样式 */
.choice {
  appearance: none; width: 100%; text-align: left; cursor: pointer;
  position: relative;
  border: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(250,245,232,.5));
  color: var(--ink); font-family: inherit; font-size: 13px;
  letter-spacing: 1px;
  border-radius: 2px;
  padding: 13px 16px 13px 34px;
  display: flex; align-items: center; gap: 10px;
  box-shadow:
    inset 0 0 0 1px rgba(166,124,52,.22),
    0 2px 6px rgba(90,72,40,.08);
  transition: all .18s ease;
}
/* 左侧竖线：像竹简的编绳 */
.choice::before {
  content: "";
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 56%;
  background: linear-gradient(180deg, transparent, var(--gold), transparent);
  opacity: .55;
  transition: all .18s;
}
/* 右侧箭头 */
.choice::after {
  content: "";
  position: absolute; right: 12px; top: 50%;
  width: 5px; height: 5px;
  border-top: 1.5px solid var(--gold);
  border-right: 1.5px solid var(--gold);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0;
  transition: all .18s;
}
.choice:hover {
  background: linear-gradient(180deg, #fdfaf2, #f7f0de);
  box-shadow:
    inset 0 0 0 1px rgba(166,124,52,.5),
    0 3px 10px rgba(90,72,40,.13);
  transform: translateX(2px);
}
.choice:hover::before { height: 76%; opacity: 1; }
.choice:hover::after { opacity: 1; right: 14px; }
.choice:active { transform: translateX(2px) scale(.995); }

.choice.primary {
  justify-content: center; padding: 14px;
  font-family: "STKaiti","KaiTi",serif;
  font-size: 15px; letter-spacing: 5px;
  color: var(--jade);
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(232,244,238,.6));
  box-shadow:
    inset 0 0 0 1px rgba(63,127,106,.32),
    0 2px 8px rgba(63,127,106,.1);
}
.choice.primary::before,
.choice.primary::after { display: none; }
.choice.primary:hover {
  background: linear-gradient(180deg, #fff, rgba(220,240,232,.75));
  box-shadow:
    inset 0 0 0 1px rgba(63,127,106,.55),
    0 3px 12px rgba(63,127,106,.16);
}

.ci {
  flex: 0 0 auto;
  min-width: 30px; text-align: center;
  font-size: 9px; color: var(--gold);
  letter-spacing: 0;
  padding: 2px 5px;
  border-radius: 2px;
  background: rgba(166,124,52,.1);
}
.choice.back {
  justify-content: center; color: var(--ink-soft); font-size: 11.5px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(166,124,52,.14);
  padding: 10px;
  letter-spacing: 2px;
}
.choice.back::before, .choice.back::after { display: none; }
.choice.back:hover {
  background: rgba(166,124,52,.06);
  box-shadow: inset 0 0 0 1px rgba(166,124,52,.3);
  transform: none;
}
.obj-desc { color: var(--ink-soft); font-size: 12px; }

/* 对象卡片 */
.obj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
/* 对象卡片：木牌样式 */
.obj-card {
  appearance: none; cursor: pointer; text-align: left;
  position: relative;
  border: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.6), rgba(248,242,228,.42));
  color: var(--ink); font-family: inherit; font-size: 12.5px;
  letter-spacing: 1px;
  border-radius: 2px;
  padding: 11px 12px 11px 30px;
  display: flex; flex-direction: column; gap: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(166,124,52,.2),
    0 2px 5px rgba(90,72,40,.07);
  transition: all .18s ease;
}
/* 左侧标记：像钉在木牌上的铜钉 */
.obj-card::before {
  content: "";
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, rgba(200,164,92,.9), rgba(166,124,52,.5));
  box-shadow: 0 0 0 1.5px rgba(166,124,52,.16);
  transition: all .18s;
}
.obj-card:hover {
  background: linear-gradient(180deg, #fdfaf2, #f7f0de);
  box-shadow:
    inset 0 0 0 1px rgba(166,124,52,.46),
    0 3px 9px rgba(90,72,40,.12);
  transform: translateY(-1px);
}
.obj-card:hover::before {
  width: 8px; height: 8px;
  box-shadow: 0 0 0 2px rgba(166,124,52,.22), 0 0 8px rgba(200,164,92,.5);
}
.obj-card:active { transform: translateY(0) scale(.995); }

.obj-card.npc::before { background: radial-gradient(circle at 35% 32%, #7fc4ac, var(--jade)); }
.obj-card.item::before { background: radial-gradient(circle at 35% 32%, #d9b46a, var(--gold)); }
.obj-card.place::before { background: radial-gradient(circle at 35% 32%, #a9a08c, #8b7f68); }

.obj-card.npc:hover { box-shadow: inset 0 0 0 1px rgba(63,127,106,.42), 0 3px 9px rgba(63,127,106,.12); }
.obj-card.item:hover { box-shadow: inset 0 0 0 1px rgba(166,124,52,.5), 0 3px 9px rgba(166,124,52,.13); }

.obj-kind {
  font-size: 8px; color: var(--ink-soft);
  letter-spacing: 2px; opacity: .72;
  align-self: flex-start;
}
.obj-card.npc .obj-kind { color: var(--jade); }
.obj-card.item .obj-kind { color: var(--gold); }
.obj-card.place .obj-kind { color: #8b7f68; }
.obj-label { font-size: 13px; letter-spacing: 1.5px; }
.obj-card.place .obj-label em {
  font-style: normal; font-size: 8.5px; color: var(--ink-soft);
  margin-left: 5px; opacity: .8;
}

/* ===== 结局 ===== */
.ending { border: 1px solid var(--line); border-radius: 3px; padding: 14px; text-align: center; background: var(--panel); }
.ending-title { font-family: "STKaiti","KaiTi",serif; font-size: 21px; letter-spacing: 6px; }
.ending.gold { border-color: var(--gold); } .ending.gold .ending-title { color: var(--gold); }
.ending.jade { border-color: var(--jade); } .ending.jade .ending-title { color: var(--jade); }
.ending.gray .ending-title { color: var(--ink-soft); }

/* ===== 页面 ===== */
.page { display: none; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-bottom: 8px; position: relative; z-index: 3; }
.page.active { display: block; }
.page-story.active { display: flex; flex-direction: column; }

.page-head {
  font-size: 11px; color: var(--jade); letter-spacing: 3px;
  padding: 12px 14px 8px; border-bottom: 1px solid var(--line-soft);
  font-family: "STKaiti","KaiTi",serif;
}

/* 人物页：立绘卡片 */
.npc-list { padding: 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.npc-card {
  appearance: none; cursor: pointer; font-family: inherit; color: var(--ink);
  border: 1px solid var(--line); border-top: 2px solid var(--c);
  background: var(--panel);
  border-radius: 3px;
  padding: 10px 9px 11px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: all .18s; box-shadow: 0 1px 4px rgba(90,72,40,.06);
}
.npc-card:hover { border-color: var(--c); }
.npc-card.open { grid-column: span 2; }
.npc-fig {
  position: relative; width: 100%; height: 92px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: color-mix(in srgb, var(--c) 7%, transparent);
  border-radius: 2px;
}
.npc-silhouette {
  width: 58px; height: 80px; border-radius: 46% 46% 14% 14% / 32% 32% 8% 8%;
  background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 50%, #fff));
  opacity: .45;
}
.npc-card.unknown .npc-silhouette { opacity: .18; filter: blur(2px); }
.npc-face {
  position: absolute; top: 6px;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 42%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  color: #fff; font-family: "STKaiti","KaiTi",serif; font-size: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
}
.npc-card.unknown .npc-face {
  background: rgba(255,255,255,.9); border-color: rgba(139,129,113,.4);
  color: var(--ink-soft); font-size: 16px; box-shadow: none;
}
.npc-label { font-size: 12px; color: var(--c); letter-spacing: 1px; }
.npc-card.unknown .npc-label { color: var(--ink-soft); font-size: 10.5px; letter-spacing: 0; }
.npc-sub { font-size: 8.5px; color: var(--ink-soft); }
.npc-sub.dim { opacity: .6; }
.npc-more {
  width: 100%; text-align: left; margin-top: 6px; padding-top: 7px;
  border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 3px;
}
.npc-trait { font-size: 9.5px; color: var(--gold); }
.npc-doing { font-size: 9.5px; color: var(--ink-mid); }
.npc-rel { font-size: 11px; }
.npc-rel.good { color: var(--good); }
.npc-rel.bad { color: var(--bad); }
.npc-rel.mid { color: var(--ink-soft); }

/* 背包页 */
.bag-list { padding: 8px 12px; display: flex; flex-direction: column; gap: 7px; }
.bag-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-left: 2px solid var(--ink-soft);
  background: var(--panel); border-radius: 3px; padding: 10px 11px;
  box-shadow: 0 1px 4px rgba(90,72,40,.05);
}
.bag-row.gold { border-left-color: var(--gold); }
.bag-row.gold .bag-icon { color: var(--gold); }
.bag-row.jade { border-left-color: var(--jade); }
.bag-row.jade .bag-icon { color: var(--jade); }
.bag-row.violet { border-left-color: #8a6fa8; }
.bag-row.violet .bag-icon { color: #8a6fa8; }
.bag-icon {
  width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center;
  font-size: 16px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel-2) 80%, transparent);
  border-radius: 2px;
}
.bag-name { font-size: 12px; }
.bag-desc { font-size: 9.5px; color: var(--ink-soft); margin-top: 2px; line-height: 1.6; }
.empty-hint { text-align: center; color: var(--ink-soft); font-size: 11px; padding: 24px; }

/* 关系页 */
.rel-section { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.panel-title { font-size: 9px; color: var(--jade); letter-spacing: 2px; margin-bottom: 8px; }
.rel-row { display: flex; justify-content: space-between; font-size: 11px; padding: 3px 0; }
.rel-row .good { color: var(--good); } .rel-row .bad { color: var(--bad); } .rel-row .mid { color: var(--ink-soft); }
.fact-item { font-size: 10.5px; color: var(--ink-mid); line-height: 1.85; }
.fact-item.hint { color: var(--ink-soft); }

/* 传闻 */
.rumor-item { border-left: 2px solid color-mix(in srgb, var(--gold) 60%, transparent); padding-left: 8px; margin-bottom: 9px; }
.rumor-text { font-size: 10.5px; color: var(--ink); line-height: 1.7; }
.rumor-tag {
  display: inline-block; margin-left: 5px; font-size: 8px; padding: 0 4px;
  border: 1px solid color-mix(in srgb, var(--bad) 60%, transparent); color: var(--bad);
  border-radius: 2px;
}
.rumor-know { font-size: 9px; color: var(--ink-soft); margin-top: 2px; }

/* 见闻页 */
.journal-hint { font-size: 9.5px; color: var(--ink-soft); padding: 8px 14px 0; letter-spacing: 1px; }
.journal-list { padding: 8px 12px 16px; display: flex; flex-direction: column; gap: 7px; }
.journal-row {
  border-left: 2px solid color-mix(in srgb, var(--gold) 55%, transparent);
  background: var(--panel); border-radius: 3px; padding: 9px 11px;
  box-shadow: 0 1px 4px rgba(90,72,40,.05);
}
.journal-text { font-size: 11.5px; color: var(--ink); line-height: 1.75; }
.journal-src { font-size: 9px; color: var(--ink-soft); margin-top: 4px; }
.journal-count { text-align: center; font-size: 9px; color: var(--ink-soft); padding: 10px 0; letter-spacing: 1px; }

/* ===== 底部菜单栏 ===== */
.bottom-nav {
  flex: 0 0 auto; position: relative; z-index: 6;
  display: grid; grid-template-columns: repeat(6, 1fr);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--ink-soft); font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 1px 7px; font-size: 8.5px; letter-spacing: 0;
  position: relative; transition: color .15s;
}
.bottom-nav button .nav-icon { font-size: 16px; line-height: 1; }
.bottom-nav button.active { color: var(--jade); }
.bottom-nav button.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2px; background: var(--jade); border-radius: 0 0 2px 2px;
}

@media (max-width: 420px) {
  .stage { padding: 11px; }
}

/* ===== 本体页 ===== */
.page-self { padding-bottom: 16px; }
.self-card {
  margin: 12px; padding: 14px 12px 12px; text-align: center;
  border: 1px solid var(--line); border-radius: 3px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--jade) 8%, var(--panel)), var(--panel));
  box-shadow: 0 2px 8px rgba(90,72,40,.07);
}
.self-fig {
  position: relative; height: 84px;
  display: flex; align-items: center; justify-content: center;
}
.self-silhouette {
  width: 62px; height: 84px; border-radius: 46% 46% 14% 14% / 32% 32% 8% 8%;
  background: linear-gradient(180deg, var(--jade), color-mix(in srgb, var(--jade) 50%, #fff));
  opacity: .4;
}
.self-face {
  position: absolute; top: 6px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--jade) 55%, #fff);
  border: 1px solid color-mix(in srgb, var(--jade) 60%, transparent);
  color: #fff; font-family: "STKaiti","KaiTi",serif; font-size: 15px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.self-name { font-family: "STKaiti","KaiTi",serif; font-size: 16px; letter-spacing: 4px; margin-top: 4px; color: var(--ink); }
.self-title { font-size: 9px; color: var(--ink-soft); margin-top: 2px; letter-spacing: 1px; }

.self-section { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.self-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; padding: 4px 0;
}
.self-row span { color: var(--ink-soft); }
.self-row b { color: var(--ink); font-weight: 500; }
.self-row b.warn { color: var(--bad); }
.self-row b.good { color: var(--good); }
.self-impression { font-size: 10.5px; color: var(--ink-mid); line-height: 1.9; }
.imp-line { margin-bottom: 2px; }

/* ===== 场景背景图 ===== */
body .portrait.has-bg::before {
  background-color: var(--bg-deep);
  background-image:
    linear-gradient(180deg, rgba(238,242,244,.1) 0%, rgba(238,242,244,.03) 45%, rgba(238,242,244,.45) 100%),
    var(--scenebg);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-blend-mode: normal;
}
body.night .portrait.has-bg::before {
  background-image:
    linear-gradient(180deg, rgba(14,21,27,.52) 0%, rgba(14,21,27,.34) 45%, rgba(14,21,27,.74) 100%),
    var(--scenebg);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
/* 有背景图时，去掉 CSS 山影 */
body .portrait.has-bg::after { display: none; }
/* 有背景图时，人物名字加个底，保证可读 */



/* ===== 立绘 ===== */
.fig-photo {
  width: 100%; height: 100%;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
  filter: drop-shadow(0 8px 20px rgba(60,45,25,.28));
}
.portrait.unknown .fig-photo { filter: blur(9px) grayscale(1) brightness(.75); opacity: .5; }
.portrait.has-bg .figure { height: 300px; width: 240px; }

/* 人物页立绘 */
.npc-photo {
  width: 100%; height: 100%;
  background-size: cover;
  background-position: center 18%;
}
.npc-card.unknown .npc-photo { filter: blur(7px) grayscale(1) brightness(.85); opacity: .45; }
.npc-fig { height: 120px; background: color-mix(in srgb, var(--c) 8%, transparent); border-radius: 3px; overflow: hidden; }

/* 分组小标题 */
.section-mini {
  font-size: 9px; color: var(--ink-soft); letter-spacing: 2px;
  margin: 10px 0 5px;
}
.obj-card.place .obj-label em {
  font-style: normal; font-size: 8.5px; color: var(--ink-soft); margin-left: 4px;
}

/* 立绘图：铺满人物框 */
.figure { height: 300px; width: 250px; display: flex; align-items: flex-end; justify-content: center; }
.fig-photo {
  width: 250px; height: 300px;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
}
.portrait.npc-mode .fig-photo { display: block; }
.portrait.unknown .fig-photo { filter: blur(10px) grayscale(1) brightness(.7); opacity: .45; }




/* ===== 小地图 ===== */
.minimap {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 3px;
  padding: 8px 8px 6px;
  margin-bottom: 4px;
}
.mm-head {
  font-size: 9px; color: var(--ink-soft); letter-spacing: 2px;
  display: flex; justify-content: space-between; margin-bottom: 6px;
}
.mm-head em { font-style: normal; color: var(--jade); }
.mm-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, 44px);
  gap: 4px;
}
.mm-cell {
  position: relative;
  width: 100%; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
  color: var(--ink-soft);
  font-size: 12px; line-height: 1;
  overflow: hidden;
  box-sizing: border-box;
}
.mm-cell.void { border: 0; background: transparent; }
.mm-cell.near { border-color: color-mix(in srgb, var(--jade) 50%, transparent); color: var(--jade); }
.mm-cell.here {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 20%, var(--panel));
  color: var(--gold);
  font-size: 14px;
  box-shadow: 0 0 8px color-mix(in srgb, var(--gold) 35%, transparent);
}
.mm-name {
  position: absolute; bottom: 2px; left: 0; right: 0;
  text-align: center; font-size: 8px; line-height: 1;
  color: var(--ink-soft); white-space: nowrap;
}
.mm-cell.here .mm-name { color: var(--gold); }

/* ===== 方位按钮 ===== */
.dir-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 5px;
}
.dir-cell {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  padding: 8px 6px;
  border-radius: 3px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: all .15s;
}
.dir-cell:hover { border-color: var(--jade); background: color-mix(in srgb, var(--jade-soft) 55%, var(--panel)); }
.dir-cell.empty { opacity: .35; cursor: default; border-style: dashed; }
.dir-grid .dir-cell:nth-child(1) { grid-column: 2; grid-row: 1; }
.dir-grid .dir-cell:nth-child(2) { grid-column: 1; grid-row: 2; }
.dir-grid .dir-cell:nth-child(3) { grid-column: 3; grid-row: 2; }
.dir-grid .dir-cell:nth-child(4) { grid-column: 2; grid-row: 3; }
.dir-tag { font-size: 8.5px; color: var(--jade); letter-spacing: 1px; }
.dir-cell.empty .dir-tag { color: var(--ink-soft); }
.dir-name { font-size: 11.5px; }
.dir-name em { font-style: normal; font-size: 8px; color: var(--ink-soft); margin-left: 3px; }

/* 七菜单 */
.bottom-nav { grid-template-columns: repeat(7, 1fr) !important; }
.bottom-nav button { font-size: 8px !important; padding: 7px 1px 6px !important; }
.bottom-nav button .nav-icon { font-size: 14px; }

/* 品阶标签 */
.tier-tag {
  display: inline-block;
  font-size: 8.5px;
  padding: 1px 6px;
  border: 1px solid var(--tc, var(--line));
  color: var(--tc, var(--ink-soft));
  border-radius: 2px;
  margin-right: 3px;
}
.tier-mini { font-style: normal; font-size: 8px; opacity: .75; margin-left: 5px; }

/* 背包 */
.bag-tags { margin: 3px 0 2px; }

/* 图鉴 */
.codex-hint { font-size: 9.5px; color: var(--ink-soft); padding: 8px 14px 4px; }
.codex-list { padding: 6px 12px 16px; }
.codex-group { margin-bottom: 14px; }
.codex-group-title {
  font-size: 9.5px; color: var(--jade); letter-spacing: 2px;
  margin: 8px 0 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.codex-row {
  display: flex; gap: 10px; align-items: flex-start;
  border-left: 2px solid var(--tc, var(--line));
  background: var(--panel);
  padding: 8px 10px; margin-bottom: 5px; border-radius: 2px;
  box-shadow: 0 1px 3px rgba(90,72,40,.05);
}
.codex-icon { font-size: 16px; width: 22px; text-align: center; flex: 0 0 auto; padding-top: 1px; }
.codex-body { flex: 1; min-width: 0; }
.codex-name { font-size: 12.5px; letter-spacing: 1px; }
.codex-tags { margin: 3px 0; }
.nature-tag { font-size: 8.5px; padding: 1px 6px; border: 1px solid currentColor; border-radius: 2px; }
.codex-desc { font-size: 9.5px; color: var(--ink-soft); line-height: 1.7; margin-top: 2px; }

/* 数据错误提示 */
.data-error {
  display: none; position: fixed; left: 0; right: 0; top: 0; z-index: 999;
  background: #a8382a; color: #fff; font-size: 11px; padding: 10px 14px;
  line-height: 1.7; max-height: 40vh; overflow: auto;
}

/* ===== 立绘（透明 PNG） ===== */
.portrait.npc-mode .fig-photo {
  width: 300px; height: 340px;
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
  border-radius: 0;
  box-shadow: none;
  mix-blend-mode: normal;
  filter: drop-shadow(0 6px 18px rgba(60,45,25,.22));
  opacity: 1;
  -webkit-mask-image: none;
  mask-image: none;
}
.portrait.npc-mode .figure {
  height: auto; width: auto;
  align-items: flex-end;
}
.portrait.npc-mode .fig-shadow { display: none; }

/* 名字条：放在立绘底部右侧，不遮脸 */
.portrait.npc-mode .fig-name {
  position: absolute; right: 18px; bottom: 30px;
  background: linear-gradient(180deg, rgba(255,253,246,.95), rgba(250,244,230,.9));
  padding: 6px 18px 6px 20px;
  border-radius: 2px;
  font-size: 15px; letter-spacing: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(166,124,52,.32),
    0 3px 10px rgba(90,72,40,.14);
  margin: 0;
}
.portrait.npc-mode .fig-name::before {
  content: "";
  position: absolute; left: -4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--gold); opacity: .55; border-radius: 1px;
}
.portrait.npc-mode .fig-title {
  position: absolute; right: 20px; bottom: 10px;
  background: transparent; box-shadow: none;
  font-size: 9px; color: var(--ink-soft);
  letter-spacing: 2px; margin: 0; opacity: .85;
}
/* 夜晚 */
body.night .portrait.npc-mode .fig-photo {
  filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)) brightness(.9) saturate(.94);
}
body.night .portrait.npc-mode .fig-name {
  background: linear-gradient(180deg, rgba(28,36,50,.92), rgba(24,32,45,.88));
  color: #e8e2d4;
  box-shadow: inset 0 0 0 1px rgba(200,164,92,.4), 0 3px 10px rgba(0,0,0,.3);
}
body.night .portrait.npc-mode .fig-title { color: rgba(230,225,212,.6); }


/* ===== 层次与质感 ===== */
body {
  background: var(--bg);
  transition: background .5s;
}

/* 场景区：留白 + 圆角 */
.portrait {
  border-radius: 0 0 10px 10px;
  box-shadow: 0 6px 24px rgba(28,43,51,.1);
}

/* 对话框：浮起卡片 */
.dialog-box {
  background: var(--panel);
  border: 0;
  border-radius: 8px;
  margin: 8px 12px 0;
  padding: 14px 16px 12px;
  box-shadow: var(--shadow-md);
  position: relative;
}
.dialog-box::before {
  content: "";
  position: absolute; left: 16px; top: 0;
  width: 36px; height: 2px;
  background: var(--jade);
  border-radius: 0 0 2px 2px;
  opacity: .8;
}

.speaker {
  color: var(--jade);
  font-size: 10.5px;
  letter-spacing: 2px;
  margin-bottom: 6px;
  font-weight: 500;
}

.dialog p {
  color: var(--ink);
  line-height: 1.92;
  font-size: 13px;
}

/* 顶部状态条 */
.top {
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 1px 8px rgba(28,43,51,.05);
}

/* 底部导航 */
.bottom-nav {
  background: var(--panel);
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -2px 14px rgba(28,43,51,.06);
}
.bottom-nav button {
  color: var(--ink-soft);
  transition: color .18s;
}
.bottom-nav button.active {
  color: var(--jade);
}
.bottom-nav button.active .nav-icon {
  transform: translateY(-1px);
  filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--jade) 30%, transparent));
}

/* 小地图 */
.minimap {
  background: var(--panel);
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px;
}
.mm-head {
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 8px;
}
.mm-cell {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  transition: all .2s;
}
.mm-cell.near {
  border-color: color-mix(in srgb, var(--jade) 40%, transparent);
  background: color-mix(in srgb, var(--jade-soft) 70%, var(--panel));
}
.mm-cell.here {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 22%, var(--panel));
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 40%, transparent);
}
.mm-name { color: var(--ink-soft); }
.mm-cell.here .mm-name { color: var(--gold); font-weight: 500; }

/* 分组标题 */
.section-mini {
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: 3px;
  margin: 14px 0 6px;
  padding-left: 2px;
  position: relative;
}
.section-mini::after {
  content: "";
  position: absolute; left: 0; bottom: -3px;
  width: 14px; height: 1.5px;
  background: var(--jade);
  opacity: .5;
  border-radius: 1px;
}

/* 方位按钮 */
.dir-grid { gap: 6px; }
.dir-cell {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  box-shadow: var(--shadow);
}
.dir-cell:not(.empty):hover {
  border-color: var(--jade);
  background: color-mix(in srgb, var(--jade-soft) 60%, var(--panel));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.dir-cell.empty {
  background: transparent;
  border: 1px dashed var(--line-soft);
  box-shadow: none;
}
.dir-tag { color: var(--jade); font-size: 8.5px; letter-spacing: 2px; }
.dir-name { color: var(--ink); font-size: 12px; }

/* 页面标题 */
.page-head {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 4px;
  padding: 16px 16px 10px;
  font-family: "STKaiti","KaiTi",serif;
  position: relative;
}
.page-head::after {
  content: "";
  position: absolute; left: 16px; bottom: 6px;
  width: 26px; height: 2px;
  background: var(--jade);
  opacity: .55;
  border-radius: 1px;
}


/* ===== 修正：剧情页高度分配 ===== */
#pageStory.page-story {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* 场景区：固定占比 */
#pageStory .portrait {
  flex: 1 1 0;
  min-height: 220px;
  max-height: 46vh;
}

/* 对话框：自适应内容，不压缩 */
#pageStory .dialog-box {
  flex: 0 0 auto;
}

/* 内容区：可滚动 */
#pageStory .choices {
  flex: 1 1 0;
  min-height: 120px;
  max-height: 40vh;
  overflow-y: auto;
  padding-bottom: 6px;
}
#pageStory .choices::-webkit-scrollbar { width: 3px; }
#pageStory .choices::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 2px;
}


/* ============================================================
   HUD 顶部
   ============================================================ */
.hud {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 9px;
  background: linear-gradient(180deg, var(--panel), #111a20);
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto; z-index: 20;
}

.hud-avatar {
  width: 48px; height: 48px; border-radius: 10px; position: relative; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2a3d48, #17232b);
  border: 1.5px solid var(--jade);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 0 14px rgba(78,122,114,.4);
}
.hud-face {
  font-family: "STKaiti","KaiTi",serif; font-size: 15px; color: #9fded1;
}
.hud-realm {
  position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%);
  font-size: 7.5px; padding: 1px 7px; border-radius: 7px; white-space: nowrap;
  background: var(--jade); color: #06120e; letter-spacing: .5px;
}

.hud-stats { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hud-row { display: flex; gap: 5px; }
.hud-box {
  flex: 1; display: flex; align-items: center; gap: 5px;
  padding: 3px 6px 3px 3px; border-radius: 6px; min-width: 0;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(126,206,190,.14);
}
.hud-icon {
  width: 17px; height: 17px; border-radius: 4px; flex: 0 0 auto; object-fit: cover;
  display: block;
}
.hud-k { font-size: 8px; color: var(--ink-soft); flex: 0 0 auto; }
.hud-v {
  font-size: 11.5px; font-weight: 700; margin-left: auto;
  color: var(--jade-bright); text-shadow: 0 0 8px rgba(143,224,207,.55);
  font-variant-numeric: tabular-nums;
}
.hud-v.gold { color: var(--gold); text-shadow: 0 0 8px rgba(232,184,86,.55); }

/* 小地图按钮 */
.minimap-btn {
  width: 62px; height: 62px; border-radius: 10px; flex: 0 0 auto;
  position: relative; overflow: hidden; padding: 0; cursor: pointer;
  border: 1.5px solid var(--jade); background: var(--bg-deep);
  box-shadow: inset 0 0 14px rgba(78,122,114,.28), 0 0 12px rgba(78,122,114,.3);
  transition: all .2s;
}
.minimap-btn:hover { border-color: var(--gold); box-shadow: 0 0 18px rgba(232,184,86,.45); }
.minimap-btn .mmgrid {
  position: absolute; inset: 5px; display: grid;
  grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr);
  gap: 1px;
}
.minimap-btn .mmc { border-radius: 1px; background: rgba(126,206,190,.16); }
.minimap-btn .mmc.void { background: transparent; }
.minimap-btn .mmc.near { background: rgba(126,206,190,.48); }
.minimap-btn .mmc.here { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.minimap-btn .mmtag {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  font-size: 7px; padding: 1px 0;
  background: rgba(11,17,20,.85); color: #9fded1; letter-spacing: .5px;
}

/* ============================================================
   场景区
   ============================================================ */
.portrait {
  flex: 0 0 auto; height: 34vh; min-height: 190px; max-height: 300px;
  position: relative; overflow: hidden;
}
.place-plate {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 3;
  padding: 4px 22px; border-radius: 3px; white-space: nowrap;
  font-family: "STKaiti","KaiTi",serif; font-size: 16px; letter-spacing: 8px;
  background: rgba(11,17,20,.62); border: 1px solid rgba(232,184,86,.34);
  color: var(--gold); text-shadow: 0 0 15px rgba(232,184,86,.55);
}

/* 立绘层 */
.npc-layer {
  position: absolute; inset: 0; z-index: 2;
  display: none; align-items: flex-end; justify-content: center;
}
.npc-layer.show { display: flex; }
.npc-layer .fig-photo {
  width: 62%; height: 94%; max-width: 240px;
  background-size: contain; background-position: center bottom; background-repeat: no-repeat;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,.5));
}
.npc-layer .fig-photo.unknown {
  filter: grayscale(1) brightness(.42) drop-shadow(0 6px 20px rgba(0,0,0,.5));
}
.npc-layer .fig-name {
  position: absolute; right: 14px; bottom: 118px;
  padding: 5px 16px; border-radius: 3px;
  font-family: "STKaiti","KaiTi",serif; font-size: 14px; letter-spacing: 3px;
  background: rgba(11,17,20,.82); border: 1px solid var(--tc, var(--gold));
  color: var(--tc, var(--gold));
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.npc-layer .fig-title {
  position: absolute; right: 16px; bottom: 96px;
  font-size: 8.5px; letter-spacing: 2px; color: var(--ink-soft);
}

/* ============================================================
   对话框
   ============================================================ */
.dialog-box {
  margin: 8px 9px 0; padding: 11px 13px; border-radius: 10px; flex: 0 0 auto;
  background: linear-gradient(180deg, var(--panel), #141d24);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), var(--shadow-md);
}
.speaker { font-size: 9px; letter-spacing: 2.5px; margin-bottom: 5px; color: var(--jade-bright); }
.dialog p { color: var(--ink); line-height: 1.75; font-size: 12.5px; }

/* ============================================================
   方格内容区
   ============================================================ */
.choices {
  flex: 1 1 0; min-height: 0; overflow-y: auto;
  padding: 0 9px 6px;
}
.choices::-webkit-scrollbar { width: 3px; }
.choices::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.sec {
  display: flex; align-items: center; gap: 7px;
  font-size: 8.5px; letter-spacing: 2.5px; color: var(--ink-dim);
  margin: 9px 0 6px;
}
.sec::after { content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-soft), transparent); }

.cell-grid {
  display: flex; gap: 6px;
  flex: 0 0 auto;
  min-height: 0;
  overflow-x: auto; overflow-y: hidden;
  padding: 0 12px 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
}
.cell-grid::-webkit-scrollbar { display: none; }
.cell-grid > * { flex: 0 0 auto; }
.cell-grid.g3 { grid-template-columns: repeat(3, 1fr); }
.cell-grid.g4 { grid-template-columns: repeat(4, 1fr); }

.cell {
  position: relative; border-radius: 8px; overflow: hidden;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  padding: 0; cursor: pointer; font-family: inherit; text-align: center;
  transition: all .18s;
}
.cell:hover {
  border-color: var(--jade);
  box-shadow: inset 0 1px 0 rgba(126,206,190,.15), 0 0 14px rgba(78,122,114,.3);
  transform: translateY(-1px);
}
.cell.npc-cell { height: 84px; }
.cell.go-cell { height: 74px; }
.cell.act-cell { height: 66px; }
.cell.off { height: 74px; opacity: .3; cursor: default; }
.cell.off:hover { transform: none; border-color: var(--line-soft); box-shadow: none; }

.cell-thumb {
  flex: 1; min-height: 0; width: 100%;
  background-size: cover; background-position: center;
}
.cell-thumb.char {
  background-size: contain; background-repeat: no-repeat;
  background-position: center top;
  opacity: .92;
}
.cell.npc-cell.unknown .cell-thumb {
  filter: grayscale(1) brightness(.34);
}
.cell-label {
  font-size: 9.5px; line-height: 1.25; padding: 2px 3px 5px;
  color: var(--ink-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell:hover .cell-label { color: var(--jade-bright); }
.cell-dir {
  position: absolute; left: 4px; top: 3px; z-index: 3;
  font-size: 9px; font-weight: 700; color: var(--gold);
  background: rgba(0,0,0,.5); padding: 1px 4px; border-radius: 3px;
}
.cell-cost {
  position: absolute; right: 3px; top: 3px; z-index: 3;
  font-size: 7.5px; color: var(--ink-soft);
  background: rgba(0,0,0,.5); padding: 1px 4px; border-radius: 3px;
}
.cell .dot {
  position: absolute; right: 4px; top: 4px; z-index: 3;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--jade); box-shadow: 0 0 7px var(--jade);
}

/* NPC 动作行 */
.action-row {
  height: auto; min-height: 52px; flex-direction: row; align-items: center;
  gap: 10px; padding: 0 12px; margin-bottom: 6px; text-align: left;
}
.action-row .cell-dir {
  position: static; font-size: 9px; color: var(--gold);
  background: rgba(232,184,86,.12); border: 1px solid rgba(232,184,86,.3);
  min-width: 30px; text-align: center;
}
.action-text { font-size: 12.5px; color: var(--ink); }

/* ============================================================
   人物页卡片
   ============================================================ */
.npc-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  padding: 4px 10px 10px;
}
.ncard {
  border-radius: 10px; overflow: hidden; position: relative; cursor: pointer;
  background: linear-gradient(180deg, var(--panel-2), #131b21);
  border: 1px solid var(--line-soft); padding: 0; font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  transition: all .18s; text-align: left;
}
.ncard:hover { border-color: var(--jade); transform: translateY(-1px); }
.ncard-photo {
  height: 108px; background-size: contain; background-repeat: no-repeat;
  background-position: center bottom; background-color: rgba(0,0,0,.2);
}
.ncard.unknown .ncard-photo {
  filter: grayscale(1) brightness(.34);
}
.ncard-body { padding: 5px 8px 7px; }
.ncard-name { font-size: 11.5px; letter-spacing: .5px; }
.ncard-sub { font-size: 8px; color: var(--ink-dim); margin-top: 1px; }
.ncard-meta { font-size: 8px; color: var(--ink-soft); margin-top: 3px; }
.ncard-meta .good { color: var(--good); }
.ncard-meta .bad { color: var(--bad); }
.ncard-meta .mid { color: var(--ink-soft); }
.ncard .badge {
  position: absolute; right: 6px; top: 6px; z-index: 2;
  font-size: 7.5px; padding: 1px 6px; border-radius: 3px;
  background: rgba(0,0,0,.55); border: 1px solid currentColor;
}

/* ============================================================
   底部导航
   ============================================================ */
.bottom-nav {
  display: flex; flex: 0 0 auto; z-index: 20;
  background: linear-gradient(180deg, #131c23, #0c1418);
  border-top: 1px solid var(--line-soft);
}
.bottom-nav button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 6px 0 5px; font-family: inherit; color: var(--ink-dim);
}
.bottom-nav .nav-ic {
  width: 34px; height: 34px; border-radius: 9px; overflow: hidden;
  border: 1px solid #25353e; background: rgba(255,255,255,.04);
  background-size: cover; background-position: center;
  opacity: .62; transition: all .2s;
}
.bottom-nav button span:last-child { font-size: 8.5px; }
.bottom-nav button.active .nav-ic {
  border-color: var(--gold); opacity: 1;
  box-shadow: 0 0 16px rgba(232,184,86,.45);
}
.bottom-nav button.active { color: var(--gold); }

/* ============================================================
   宗门地图（全屏浮层）
   ============================================================ */
.map-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: radial-gradient(ellipse at 50% 30%, #14232b 0%, #080d10 70%);
  flex-direction: column;
}
.map-overlay.show { display: flex; }
.map-overlay::before {
  content: ""; position: absolute; inset: 0;
  background-image: url("assets/bg/climb.jpg");
  background-size: cover; background-position: center;
  opacity: .12; filter: blur(2px); pointer-events: none;
}
.map-head {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 9px;
  padding: 14px 14px 8px;
}
.map-title {
  font-family: "STKaiti","KaiTi",serif; font-size: 18px; letter-spacing: 6px;
  color: var(--gold); text-shadow: 0 0 16px rgba(232,184,86,.45);
}
.map-line { flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(232,184,86,.4), transparent); }
.map-close {
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.04);
  color: var(--ink-soft); display: grid; place-items: center; font-size: 14px;
}
.map-close:hover { border-color: var(--seal); color: var(--seal); }

.map-canvas {
  position: relative; z-index: 2; flex: 1; margin: 0 10px; min-height: 0;
}
.map-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.map-node {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: default;
}
.map-node .mn-thumb {
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  border: 2px solid #2e4250; background-size: cover; background-position: center;
  box-shadow: 0 3px 10px rgba(0,0,0,.6); position: relative;
  transition: all .22s;
}
.map-node .mn-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(11,17,20,.44); transition: all .22s;
}
.map-node .mn-name {
  font-size: 8.5px; color: var(--ink-soft); white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}
.map-node.near { cursor: pointer; }
.map-node.near .mn-thumb { border-color: #5fa89a; box-shadow: 0 0 14px rgba(95,168,154,.5); }
.map-node.near .mn-thumb::after { background: rgba(11,17,20,.16); }
.map-node.near .mn-name { color: #9fded1; }
.map-node.here .mn-thumb { width: 58px; height: 58px; border-color: var(--gold);
  box-shadow: 0 0 22px rgba(232,184,86,.7); }
.map-node.here .mn-thumb::after { background: transparent; }
.map-node.here .mn-name { color: var(--gold); font-size: 9.5px; font-weight: 700; }
.map-node.here::before {
  content: ""; position: absolute; top: 26px; left: 50%;
  transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%;
  border: 2px solid rgba(232,184,86,.6);
  animation: mapPulse 2s ease-out infinite;
}
@keyframes mapPulse {
  0% { transform: translate(-50%,-50%) scale(1); opacity: .8; }
  100% { transform: translate(-50%,-50%) scale(1.9); opacity: 0; }
}
.map-node .mn-cost {
  position: absolute; top: -1px; right: -8px; z-index: 3;
  font-size: 7px; padding: 0 4px; border-radius: 5px; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft);
}
.map-node.near .mn-cost { border-color: #5fa89a; color: #9fded1; }

.map-legend {
  position: relative; z-index: 2; display: flex; gap: 16px; justify-content: center;
  padding: 10px 0 16px; font-size: 8.5px; color: var(--ink-dim);
}
.map-legend i {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.map-legend .l-here { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
.map-legend .l-near { background: #5fa89a; }
.map-legend .l-far { background: #2e4250; }

/* 罗盘 */
.compass {
  position: absolute; right: 14px; top: 46px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(232,184,86,.35);
  background: rgba(11,17,20,.6);
  display: grid; place-items: center;
  font-size: 8px; color: var(--ink-soft);
}
.compass .cn { position: absolute; top: 2px; color: var(--seal); font-weight: 700; }
.compass .cs { position: absolute; bottom: 2px; }
.compass .cw { position: absolute; left: 3px; }
.compass .ce { position: absolute; right: 3px; }
.compass .needle {
  width: 2px; height: 16px;
  background: linear-gradient(180deg, var(--seal) 50%, var(--ink-dim) 50%);
  border-radius: 1px;
}


/* ===== 浮动提示 ===== */
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translate(-50%, 8px);
  z-index: 200; pointer-events: none;
  padding: 8px 20px; border-radius: 6px;
  background: rgba(11, 17, 20, .92);
  border: 1px solid rgba(232, 184, 86, .5);
  color: var(--gold);
  font-size: 12.5px; letter-spacing: 1.5px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .6), 0 0 20px rgba(232, 184, 86, .18);
  opacity: 0; transition: opacity .25s, transform .25s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast { z-index: 300; }


/* ===== 物品图标 ===== */
.item-icon {
  position: relative; flex: 0 0 auto; border-radius: 6px;
  border: 1px solid var(--line); background: rgba(0,0,0,.28);
  overflow: hidden; display: grid; place-items: center;
}
.item-icon img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.item-icon .fallback {
  position: absolute; font-size: 18px; display: none;
}
.item-icon.no-img .fallback { display: block; }

.bag-row { display: flex; gap: 10px; align-items: flex-start; }
.codex-row { display: flex; gap: 10px; align-items: flex-start; }


/* ============================================================
   本体页
   ============================================================ */
.self-top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 12px;
}
.self-avatar {
  width: 62px; height: 62px; border-radius: 12px; position: relative;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2a3d48, #17232b);
  border: 1.5px solid var(--jade);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 0 18px rgba(78,122,114,.4);
}
.self-face { font-family: "STKaiti",serif; font-size: 24px; color: #9fded1; }
.self-badge {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  font-size: 8px; padding: 1px 9px; border-radius: 8px; white-space: nowrap;
  background: var(--jade); color: #06120e; letter-spacing: .5px;
}
.self-info .self-name {
  font-family: "STKaiti",serif; font-size: 19px; letter-spacing: 3px; color: var(--ink);
}
.self-info .self-sub { font-size: 9.5px; color: var(--ink-dim); margin-top: 3px; letter-spacing: 1px; }

.self-block {
  margin: 0 10px 8px; padding: 10px 12px; border-radius: 9px;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.block-title {
  font-size: 8.5px; letter-spacing: 2.5px; color: var(--ink-dim);
  margin-bottom: 8px; display: flex; align-items: center; gap: 7px;
}
.block-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--line-soft), transparent);
}

.realm-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.realm-name {
  font-family: "STKaiti",serif; font-size: 15px; letter-spacing: 2px;
  color: var(--gold); text-shadow: 0 0 10px rgba(232,184,86,.4);
}
.realm-prog { font-size: 9px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.prog-track {
  height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(0,0,0,.4); border: 1px solid var(--line-soft);
}
.prog-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--jade), var(--jade-bright));
  box-shadow: 0 0 10px rgba(143,224,207,.6);
  transition: width .5s ease;
}

.attr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.attr-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 4px; border-radius: 6px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(126,206,190,.12);
}
.attr-k { font-size: 8px; color: var(--ink-dim); }
.attr-v {
  font-size: 16px; font-weight: 700; color: var(--jade-bright);
  text-shadow: 0 0 10px rgba(143,224,207,.5);
  font-variant-numeric: tabular-nums;
}
.attr-n { font-size: 7.5px; color: var(--ink-soft); }

.self-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; font-size: 11.5px; color: var(--ink-mid);
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.self-row:last-child { border-bottom: 0; }
.self-row b { color: var(--ink); font-weight: 500; }
.self-row b.warn { color: var(--seal); }
.self-row b.good { color: var(--good); }

.self-impression { font-size: 10.5px; line-height: 1.9; color: var(--ink-mid); }
.imp-line { padding-left: 2px; }

/* 见闻页 */
.journal-head {
  padding: 4px 14px 8px; font-size: 9px; color: var(--ink-dim); letter-spacing: 1px;
}
.journal-head b { color: var(--gold); font-size: 11px; }
.journal-row {
  margin: 0 10px 6px; padding: 10px 12px; border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--jade);
}
.journal-text { font-size: 11.5px; line-height: 1.7; color: var(--ink); }
.journal-src { font-size: 8.5px; color: var(--ink-dim); margin-top: 4px; }

/* 图鉴页 */
.codex-hint { padding: 8px 14px 4px; font-size: 9.5px; color: var(--ink-dim); line-height: 1.7; }
.codex-group-title {
  font-size: 9px; letter-spacing: 2.5px; color: var(--jade-bright);
  margin: 10px 14px 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.codex-row {
  margin: 0 10px 5px; padding: 8px 10px; border-radius: 7px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--tc, var(--line));
}
.codex-name { font-size: 12px; }
.codex-tags { margin: 3px 0; }
.codex-desc { font-size: 9.5px; color: var(--ink-dim); line-height: 1.65; }


/* 地图方向标签 */
.map-dirlabel {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  font-size: 9px; font-weight: 700; color: #5fa89a;
  background: rgba(11,17,20,.85); border: 1px solid rgba(95,168,154,.5);
  padding: 1px 6px; border-radius: 8px; pointer-events: none;
  text-shadow: 0 0 8px rgba(95,168,154,.8);
}
.map-node .mn-tag {
  position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%);
  font-size: 7px; padding: 0 6px; border-radius: 6px; white-space: nowrap;
  background: var(--gold); color: #1a1206; letter-spacing: .5px;
}
/* 地图节点加派系色环 */
.map-node.here .mn-thumb { animation: hereGlow 2.4s ease-in-out infinite; }
@keyframes hereGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(232,184,86,.6); }
  50% { box-shadow: 0 0 32px rgba(232,184,86,.95); }
}


/* ===== 修正：方格缩略图裁切 ===== */
.cell { overflow: hidden; }
.cell .cell-thumb {
  background-size: cover;
  background-position: center;
  min-height: 0;
}
/* 人物格：立绘保证头肩可见 */
.cell.npc-cell .cell-thumb.char {
  background-size: cover;
  background-position: center 8%;
}
/* 去往格：场景图 cover，标签独立一行 */
.cell.go-cell .cell-thumb {
  background-size: cover;
  background-position: center;
  flex: 0 0 46px;
}
.cell.go-cell .cell-label {
  padding: 3px 3px 5px;
  font-size: 9.5px;
}
/* 行动格：图标完整显示 */
.cell.act-cell .cell-thumb {
  background-size: cover;
  background-position: center;
  flex: 0 0 42px;
}
.cell.act-cell .cell-label {
  padding: 2px 3px 5px;
}

/* 本体页：名字重影修正 */
.self-info .self-name {
  position: relative;
  text-shadow: none;
}
.self-info .self-sub {
  position: relative;
  opacity: 1;
}

/* 本体页顶栏与 HUD 之间的过渡 */
.page-self { padding-top: 0; }


/* 时间格剩余时辰 */
.hud-left {
  font-size: 7.5px; color: var(--ink-dim); margin-left: 3px; white-space: nowrap;
}
.hud-v { font-size: 10.5px; }

/* 境界阶段 */
.realm-stage {
  font-size: 9px; color: var(--ink-soft); letter-spacing: 1px;
  background: rgba(255,255,255,.05); padding: 1px 8px; border-radius: 8px;
  border: 1px solid var(--line-soft);
}
.realm-row + .realm-row { margin-top: -2px; }


/* ===== 丹毒条 ===== */
.toxicity-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 10px 8px; padding: 8px 12px; border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  font-size: 9px; color: var(--ink-dim);
}
.tox-track {
  flex: 1; height: 6px; border-radius: 3px; overflow: hidden;
  background: rgba(0,0,0,.4); border: 1px solid var(--line-soft);
}
.tox-fill {
  height: 100%; border-radius: 3px; transition: width .4s;
  background: linear-gradient(90deg, #7a5c9e, #9a5a7a);
}
.toxicity-bar b { color: #9a5a7a; font-size: 11px; }

/* ===== 丹方行 ===== */
.recipe-row {
  display: flex; align-items: center; gap: 9px;
  margin: 0 10px 6px; padding: 9px 10px; border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--jade);
}
.recipe-row.disabled { opacity: .5; border-left-color: var(--line); }
.recipe-body { flex: 1; min-width: 0; }
.recipe-name { font-size: 11.5px; color: var(--ink); }
.recipe-mat { font-size: 8.5px; margin-top: 3px; }
.recipe-mat .ok { color: var(--good); margin-right: 6px; }
.recipe-mat .lack { color: var(--seal); margin-right: 6px; }
.recipe-chance { font-size: 8.5px; color: var(--ink-dim); margin-top: 2px; }
.craft-btn {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  background: rgba(78,122,114,.16); border: 1px solid var(--jade);
  color: var(--jade-bright); font-family: inherit; font-size: 12px;
  transition: all .18s;
}
.craft-btn:hover { background: rgba(78,122,114,.3); box-shadow: 0 0 12px rgba(78,122,114,.4); }


/* ===== 终测 ===== */
.final-ability {
  font-size: 10px; color: var(--gold); margin-top: 6px;
  padding-top: 6px; border-top: 1px solid var(--line-soft);
}
.final-hint {
  font-size: 9.5px; color: var(--ink-soft); letter-spacing: 1px;
  padding: 4px 2px 8px;
}
.herb-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin-bottom: 10px;
}
.herb-cell {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  padding: 9px 4px; border-radius: 7px; cursor: pointer;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  color: var(--ink-mid); font-family: inherit; text-align: center;
  transition: all .16s;
}
.herb-cell:hover { border-color: var(--jade); }
.herb-cell.picked {
  border-color: var(--seal); background: rgba(168,56,42,.14);
  color: var(--ink);
}
.herb-no { font-size: 8px; color: var(--ink-dim); }
.herb-desc { font-size: 9px; line-height: 1.3; }
.herb-mark {
  position: absolute; right: 3px; top: 3px;
  font-size: 7px; padding: 0 4px; border-radius: 3px;
  background: var(--seal); color: #fff; letter-spacing: 0;
}
.choice.primary[disabled] { opacity: .45; cursor: not-allowed; }


/* ===== 结局 ===== */
.ending-big {
  text-align: center; padding: 16px 0 12px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}
.ending-big .ending-title {
  font-family: "STKaiti","KaiTi",serif; font-size: 26px; letter-spacing: 8px;
}
.ending-big.gold .ending-title { color: var(--gold); text-shadow: 0 0 24px rgba(232,184,86,.55); }
.ending-big.jade .ending-title { color: var(--jade-bright); text-shadow: 0 0 20px rgba(143,224,207,.45); }
.ending-big.gray .ending-title { color: var(--ink-soft); }

.ending-desc {
  font-size: 12px; line-height: 1.9; color: var(--ink);
  text-align: center; margin-bottom: 16px; padding: 0 8px;
}
.ending-extra {
  background: rgba(255,255,255,.03); border-left: 2px solid var(--line);
  padding: 10px 12px; margin-bottom: 16px; border-radius: 4px;
}
.ending-extra p { font-size: 11.5px; line-height: 1.85; color: var(--ink-mid); }
.ending-extra p.spacer { height: 8px; }
.ending-hook {
  text-align: center; font-size: 9px; letter-spacing: 4px;
  color: var(--seal); padding: 8px 0 12px;
  border-top: 1px dashed var(--line);
}


/* ===== 新手引导 ===== */
.guide-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(6, 10, 12, .82);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.guide-overlay.show { display: flex; }
.guide-card {
  width: 100%; max-width: 330px;
  background: linear-gradient(180deg, var(--panel), #141d24);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 20px 18px 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.7), 0 0 32px rgba(232,184,86,.16);
  animation: guideIn .3s ease;
}
@keyframes guideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.guide-no {
  font-size: 8.5px; color: var(--ink-dim); letter-spacing: 2px; text-align: center;
}
.guide-title {
  font-family: "STKaiti","KaiTi",serif; font-size: 19px; letter-spacing: 4px;
  color: var(--gold); text-align: center; margin: 8px 0 14px;
  text-shadow: 0 0 16px rgba(232,184,86,.4);
}
.guide-body {
  font-size: 12px; line-height: 2; color: var(--ink);
  margin-bottom: 12px;
}
.guide-tip {
  font-size: 9.5px; color: var(--jade-bright);
  padding: 8px 10px; border-radius: 5px;
  background: rgba(78,122,114,.12);
  border-left: 2px solid var(--jade);
  margin-bottom: 16px;
}
.guide-actions { display: flex; gap: 8px; }
.guide-skip {
  flex: 1; padding: 10px; border-radius: 7px; cursor: pointer;
  background: transparent; border: 1px solid var(--line);
  color: var(--ink-soft); font-family: inherit; font-size: 11px;
}
.guide-next {
  flex: 2; padding: 10px; border-radius: 7px; cursor: pointer;
  background: rgba(232,184,86,.14); border: 1px solid var(--gold);
  color: var(--gold); font-family: inherit; font-size: 12px; letter-spacing: 2px;
}
.guide-next:hover { background: rgba(232,184,86,.26); box-shadow: 0 0 16px rgba(232,184,86,.3); }


/* ===== 花田 ===== */
.flower-empty {
  font-size: 10px; color: var(--ink-dim); padding: 10px 12px;
  text-align: center; background: rgba(255,255,255,.02);
  border: 1px dashed var(--line-soft); border-radius: 7px; margin: 0 10px 8px;
}
.flower-list { margin: 0 10px 8px; }
.flower-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; margin-bottom: 5px;
  background: linear-gradient(180deg, var(--panel-2), #141c23);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--tc, var(--jade));
}
.flower-icon { font-size: 18px; width: 24px; text-align: center; flex: 0 0 auto; }
.flower-body { flex: 1; min-width: 0; }
.flower-name { font-size: 11.5px; }
.flower-stage { font-size: 8.5px; color: var(--ink-dim); margin-top: 2px; }
.flower-actions { display: flex; gap: 5px; flex: 0 0 auto; }
.flower-btn {
  padding: 5px 10px; border-radius: 5px; cursor: pointer;
  background: rgba(78,122,114,.16); border: 1px solid var(--jade);
  color: var(--jade-bright); font-family: inherit; font-size: 10px;
}
.flower-btn.gold {
  background: rgba(232,184,86,.14); border-color: var(--gold); color: var(--gold);
}
.flower-btn:hover { filter: brightness(1.3); }
.flower-wait { font-size: 9px; color: var(--ink-dim); flex: 0 0 auto; }


/* ===== 见闻卡片 ===== */
.lore-card {
  margin: 10px; padding: 14px 16px; border-radius: 9px;
  background: linear-gradient(180deg, rgba(232,184,86,.08), rgba(232,184,86,.02));
  border: 1px solid rgba(232,184,86,.35);
}
.lore-title {
  font-family: "STKaiti","KaiTi",serif; font-size: 15px; letter-spacing: 3px;
  color: var(--gold); margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(232,184,86,.4);
}
.lore-text {
  font-size: 11px; line-height: 1.95; color: var(--ink-mid);
}


/* ============================================================
   移动端布局优化：三区块横向滚动，一屏全可见
   ============================================================ */

/* 区块标题更紧凑 */
.section-mini {
  margin: 6px 0 3px;
  padding-left: 12px;
  flex: 0 0 auto;
  font-size: 8.5px;
}

/* 各区宽度和高度（保证图片 + 文字都能显示） */
.cell.npc-cell  { width: 86px; height: 92px; }
.cell.act-cell  { width: 86px; height: 74px; }
.cell.go-cell   { width: 74px; height: 74px; }
.cell.off       { width: 74px; height: 74px; }

/* 场景图上的地点名更小 */
.portrait-scene {
  font-size: 12px !important;
  padding: 4px 14px !important;
}

/* 对话框更紧凑 */
.dialog-box {
  margin: 0 10px 4px !important;
  padding: 7px 11px !important;
  font-size: 11.5px !important;
  line-height: 1.6 !important;
}
.dialog-box p { margin: 0 0 4px; }
.dialog-box p:last-child { margin-bottom: 0; }

/* 选项区紧凑 */
.choices { padding: 0 10px 8px !important; gap: 5px !important; }
.choice { padding: 11px 14px !important; font-size: 12.5px !important; }

/* 小屏（手机竖屏）进一步压缩 */
@media (max-height: 750px) {
  .portrait { height: 18vh; min-height: 110px; }
  .cell.npc-cell { height: 84px; }
  .cell.act-cell { height: 68px; }
  .cell.go-cell, .cell.off { height: 68px; }
  .section-mini { margin: 5px 0 3px; }
  .dialog-box { font-size: 11.5px !important; padding: 8px 11px !important; }
}

@media (max-height: 640px) {
  .portrait { height: 14vh; min-height: 90px; }
  .cell.npc-cell { height: 76px; }
  .cell.act-cell { height: 62px; }
  .cell.go-cell, .cell.off { height: 62px; }
}


/* ============================================================
   最终布局覆盖：确保一屏显示完整
   ============================================================ */

/* 场景图：固定高度，不抢空间 */
.portrait {
  flex: 0 0 auto !important;
  height: 17vh !important;
  max-height: 155px !important;
  min-height: 100px !important;
}

/* 选项区：按内容撑开，可滚动但不挤占 */
.choices {
  flex: 0 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 0 9px 4px !important;
  gap: 4px !important;
}

/* 区块标题更紧凑 */
.sec {
  margin: 5px 0 4px !important;
  font-size: 8.5px !important;
}

/* 对话框基准 */
.dialog-box {
  flex: 0 0 auto !important;
}

/* ---- 极窄/极矮屏幕 ---- */
@media (max-height: 700px) {
  .portrait { height: 14vh !important; min-height: 88px !important; max-height: 125px !important; }
  .cell.npc-cell { height: 80px; }
  .cell.act-cell { height: 62px; }
  .cell.go-cell, .cell.off { height: 62px; }
}

@media (max-height: 620px) {
  .portrait { height: 12vh !important; min-height: 76px !important; }
  .cell.npc-cell { height: 72px; }
  .cell.act-cell { height: 58px; }
  .cell.go-cell, .cell.off { height: 58px; }
  .dialog-box { font-size: 11px !important; padding: 6px 10px !important; }
}


/* ============================================================
   方案 C：场景图 + 内容融合
   ============================================================ */

/* 场景图横向铺满（去掉右侧白边） */
.portrait {
  width: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* 内容区撑满剩余高度 */
.choices {
  flex: 1 1 auto !important;
}

.portrait {
  flex: 0 0 auto !important;
  height: 22vh !important;
  min-height: 130px !important;
  max-height: 190px !important;
  position: relative;
  overflow: hidden;
  left: 0; right: 0;
}

.portrait::after {
  content: "" !important;
  position: absolute !important;
  left: 0; right: 0; bottom: 0;
  height: 45% !important;
  background: linear-gradient(180deg, transparent 0%, rgba(11,17,20,.25) 50%, rgba(11,17,20,.75) 85%, var(--bg) 100%) !important;
  clip-path: none !important;
  opacity: 1 !important;
  z-index: 2 !important;
  pointer-events: none;
}

.place-plate {
  position: absolute !important;
  left: 50% !important;
  bottom: 34px !important;
  transform: translateX(-50%) !important;
  z-index: 5 !important;
  font-family: "STKaiti","KaiTi",serif !important;
  font-size: 15px !important;
  letter-spacing: 6px !important;
  color: var(--gold) !important;
  text-shadow: 0 2px 12px rgba(0,0,0,.95), 0 0 20px rgba(232,184,86,.45) !important;
  padding: 2px 14px !important;
  background: rgba(11,17,20,.5) !important;
  border: 1px solid rgba(232,184,86,.35) !important;
  border-radius: 3px !important;
}

.dialog-box {
  position: relative;
  z-index: 6;
  margin: -18px 10px 6px !important;
  padding: 9px 12px !important;
  background: rgba(22,33,42,.95) !important;
  border: 1px solid rgba(78,122,114,.45) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,.5) !important;
  font-size: 11.5px !important;
  line-height: 1.65 !important;
}

.choices {
  flex: 0 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 0 9px 4px !important;
  gap: 3px !important;
}

.sec {
  margin: 5px 0 3px !important;
  font-size: 8px !important;
  letter-spacing: 2.5px !important;
}

.cell.npc-cell { width: 84px !important; height: 88px !important; }
.cell.act-cell { width: 84px !important; height: 66px !important; }
.cell.go-cell, .cell.off { width: 72px !important; height: 66px !important; }

@media (max-height: 720px) {
  .portrait { height: 19vh !important; min-height: 115px !important; }
  .cell.npc-cell { height: 82px !important; }
  .cell.act-cell { height: 62px !important; }
  .cell.go-cell, .cell.off { height: 62px !important; }
}

@media (max-height: 640px) {
  .portrait { height: 16vh !important; min-height: 100px !important; }
  .cell.npc-cell { height: 76px !important; }
  .cell.act-cell { height: 58px !important; }
  .cell.go-cell, .cell.off { height: 58px !important; }
  .dialog-box { margin-top: -20px !important; }
}


/* ============================================================
   最终修正：场景图铺满宽度 + 内容区撑满高度
   ============================================================ */

/* 场景图：横向铺满，去掉圆角和边距 */
.portrait {
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  border-radius: 0 !important;
  left: 0 !important;
  right: 0 !important;
}

/* 场景图伪元素铺满整个宽度 */
.portrait::before,
.portrait.has-bg::before {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}

/* 内容区：撑满剩余高度，避免底部空白 */
.choices {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  display: block !important;
}

/* 区块之间更紧凑 */
.sec {
  display: block !important;
  margin: 6px 0 3px !important;
  padding: 0 9px !important;
}

/* 格子容器允许横向滚动 */
.cell-grid {
  display: flex !important;
  gap: 5px !important;
  padding: 0 9px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex-wrap: nowrap !important;
}
.cell-grid::-webkit-scrollbar { display: none; }
.cell-grid > * { flex: 0 0 auto !important; }

/* 桌面端：限制最大宽度，两侧居中（已经有了，强化） */
#app {
  max-width: 560px !important;
  margin: 0 auto !important;
}

/* ============================================================
   手机画框：桌面浏览器居中显示，手机上全屏
   ============================================================ */

@media (min-width: 620px) {
  html, body { height: 100vh; overflow: hidden; background: #070b0e; }
  body {
    display: flex; align-items: center; justify-content: center;
    background:
      radial-gradient(ellipse at 50% 0%, rgba(78,122,114,.10), transparent 60%),
      radial-gradient(ellipse at 50% 100%, rgba(232,184,86,.06), transparent 60%),
      #070b0e;
  }
  #app {
    width: 390px; height: 844px;
    max-height: calc(100vh - 40px); max-width: calc(100vw - 40px);
    margin: 0; border-radius: 36px; overflow: hidden; position: relative;
    box-shadow:
      0 0 0 8px #14181b, 0 0 0 9px #2b3238, 0 0 0 11px #0a0d0f,
      0 24px 70px rgba(0,0,0,.85), 0 0 90px rgba(78,122,114,.14);
  }
  #app::after {
    content: ""; position: absolute;
    top: 8px; left: 50%; transform: translateX(-50%);
    width: 104px; height: 22px; background: #0a0d0f;
    border-radius: 0 0 14px 14px; z-index: 999; pointer-events: none;
  }
  body::after {
    content: "手机端体验更佳 · 最终发布为微信小游戏";
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    font-size: 10px; letter-spacing: 2px; color: rgba(126,145,157,.5);
    pointer-events: none;
  }
  #app *::-webkit-scrollbar { width: 0; height: 0; }
}

@media (max-width: 619px) {
  #app {
    width: 100%; height: 100dvh; margin: 0;
    border-radius: 0; box-shadow: none; max-width: 100%; max-height: 100%;
  }
}

/* ============================================================
   手机画框修正
   ============================================================ */

/* 1. 去掉刘海（挡 HUD），改为只加圆角 */
#app::after {
  content: none !important;
}

/* 2. 场景图铺满宽度 */
.portrait {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
}
.portrait::before {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}

/* 3. 底部菜单留出安全区 */
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  flex-shrink: 0 !important;
}

/* 4. 画框内所有内容不超出 */
#app > * {
  max-width: 100%;
  box-sizing: border-box;
}

/* ============================================================
   场景图修正：去掉发白的覆盖层，让背景图清晰
   ============================================================ */

body .portrait.has-bg::before {
  background-color: var(--bg-deep) !important;
  background-image: var(--scenebg) !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

body.night .portrait.has-bg::before {
  background-image:
    linear-gradient(180deg, rgba(14,21,27,.35) 0%, rgba(14,21,27,.2) 45%, rgba(14,21,27,.55) 100%),
    var(--scenebg) !important;
  background-size: cover, cover !important;
}
