/* ============================================================================
   《轮回：主神空间》玩家工作台 · 样式表
   基调：虚空 / 近黑 / 冷白光晕 / 宋体与等宽混排 / 细线不用圆角卡片
   移动端优先（375px 为首要目标），再向桌面放宽
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg:        #0a0a0c;
  --bg-1:      #0c0c11;
  --bg-2:      #101016;
  --bg-3:      #14141c;

  --line:      #1d1d25;
  --line-2:    #2a2a35;
  --line-3:    #3a3a48;

  --ink:       #e6e3dd;
  --ink-2:     #a9a6a1;
  --dim:       #6b6b78;

  --cold:      #9dc0cf;
  --cold-dim:  #4c6774;
  --warn:      #c9a879;
  --gold:      #c8b07a;
  --blood:     #b3352f;
  --blood-dim: #5c2320;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", "Heiti SC",
               "WenQuanYi Micro Hei", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC",
                "Source Han Serif SC", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas",
               "Liberation Mono", "Courier New", monospace;

  --pad: 20px;
  --radius: 2px;
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(120% 55% at 50% -8%, rgba(140, 180, 200, 0.085), transparent 62%),
    radial-gradient(90% 45% at 50% 108%, rgba(80, 110, 130, 0.05), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

h1, h2, h3, p, dl, dd, dt, ul, li { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

::selection { background: rgba(157, 192, 207, 0.22); }

/* ---------- 3. 骨架与视图切换 ---------- */
.frame {
  position: relative;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.view { display: none; flex: 1; min-height: 0; }
.view.is-on { display: flex; flex-direction: column; }

/* 通用可滚动容器（首页 / 结算页） */
.scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px var(--pad) calc(24px + env(safe-area-inset-bottom));
}

/* ---------- 4. 排版工具 ---------- */
.micro {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.foot {
  margin-top: 14px;
  font-size: 11.5px;
  line-height: 1.7;
  color: #55555f;
}
.foot.center { text-align: center; }

.link {
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.04em;
  padding: 6px 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.link:hover { color: var(--ink-2); border-bottom-color: var(--line-2); }

.warn-text { color: var(--warn); }

/* ---------- 5. 按钮 ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--ink);
  font-size: 14.5px;
  letter-spacing: 0.05em;
  text-align: center;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { background: var(--bg-3); border-color: var(--line-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn:focus-visible { outline: 1px solid var(--cold-dim); outline-offset: 2px; }

.btn-block { display: flex; width: 100%; }

.btn-primary {
  border-color: #3f5a67;
  background: #10191e;
  color: #d9ecf3;
}
.btn-primary:hover:not(:disabled) { background: #14212a; border-color: #54788a; }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); }

/* 撤离二次确认态 */
.btn.is-armed {
  color: #e2a49e;
  border-color: var(--blood-dim);
  background: #130e0f;
}

.btn-sm { min-height: 36px; padding: 6px 13px; font-size: 12.5px; letter-spacing: 0.08em; }

/* 进入副本：沉重、暗红压边 */
.btn-enter {
  flex-direction: column;
  gap: 2px;
  min-height: 62px;
  margin-top: 18px;
  border-color: #4a2e2c;
  background: linear-gradient(180deg, #171114, #100e11);
  color: #e8dcd8;
}
.btn-enter:hover:not(:disabled) { border-color: #6d3c37; background: linear-gradient(180deg, #1d1417, #12100f); }
.btn-enter:disabled { border-color: var(--line-2); }
.enter-main { font-family: var(--font-serif); font-size: 17px; letter-spacing: 0.14em; }
.enter-sub { font-size: 10.5px; letter-spacing: 0.06em; color: #7d6f6c; }

/* 按钮加载态：文字后追加省略号脉冲 */
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--cold);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 6. 表单 ---------- */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--dim);
  text-transform: uppercase;
}
.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #08080b;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.04em;
  appearance: none;
  transition: border-color 0.18s, background 0.18s;
}
.field input::placeholder { color: #43434e; }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--cold-dim);
  background: #0a0d10;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) 20px, calc(100% - 11px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.form-error {
  min-height: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--blood);
  letter-spacing: 0.02em;
}
.form-error:empty { display: none; }

/* ---------- 7. 登录页 ---------- */
.view-login.is-on {
  justify-content: center;
  padding: 24px var(--pad) calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.login-head { margin-bottom: 26px; }
.glyph {
  font-family: var(--font-serif);
  font-size: 30px;
  letter-spacing: 0.34em;
  color: var(--ink);
  text-indent: 0.34em;
  text-shadow: 0 0 26px rgba(157, 192, 207, 0.28);
}
.lede {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.tabs {
  display: flex;
  gap: 22px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.tab {
  position: relative;
  padding: 8px 0 9px;
  font-size: 13.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
  transition: color 0.18s;
}
.tab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: transparent;
  transition: background 0.18s;
}
.tab.is-on { color: var(--ink); }
.tab.is-on::after { background: var(--cold-dim); }

/* ---------- 8. 首页 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px var(--pad) 12px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: 0.26em;
  color: var(--ink);
}

/* 休整倒计时 */
.rest {
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.rest-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.rest-count {
  margin: 8px 0 10px;
  font-family: var(--font-mono);
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: #e8f2f6;
  text-shadow: 0 0 22px rgba(157, 192, 207, 0.22);
}
.rest-count.is-expired {
  color: var(--blood);
  text-shadow: 0 0 22px rgba(179, 53, 47, 0.3);
  font-size: 24px;
  letter-spacing: 0.1em;
}
.rest-note { margin-top: 9px; font-size: 11.5px; color: #5a5a66; }

/* 进度条 */
.bar {
  position: relative;
  height: 2px;
  background: #191921;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cold-dim), var(--cold));
  transition: width 0.55s ease;
}
.bar-sanity > i { background: linear-gradient(90deg, #46606d, #b8d6e2); }
.bar-sanity.is-low > i { background: linear-gradient(90deg, #5c2320, #b3352f); }

/* 面板 */
.panel {
  padding: 16px 0 4px;
  border-top: 1px solid var(--line);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-title {
  font-family: var(--font-serif);
  font-size: 21px;
  letter-spacing: 0.14em;
  color: var(--ink);
  font-weight: 400;
}
.panel-desc {
  margin: 10px 0 6px;
  font-size: 12px;
  line-height: 1.75;
  color: #63636f;
}

.tag {
  padding: 2px 8px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}
.tag.is-dead { border-color: var(--blood-dim); color: var(--blood); }

/* 五维 */
.attrs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08080b;
}
.attr {
  padding: 10px 4px 9px;
  text-align: center;
  border-left: 1px solid var(--line);
}
.attr:first-child { border-left: 0; }
.attr-val {
  display: block;
  font-family: var(--font-mono);
  font-size: 19px;
  line-height: 1.25;
  color: #dbe9ef;
  font-variant-numeric: tabular-nums;
}
.attr-name { display: block; margin-top: 2px; font-size: 10.5px; color: var(--ink-2); letter-spacing: 0.04em; }
.attr-key { display: block; font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.1em; color: #45454f; }

/* 数值列表 */
.stat-list { margin-top: 12px; }
.stat-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.stat-list > div:last-child { border-bottom: 0; }
.stat-list dt { font-size: 12.5px; color: var(--dim); letter-spacing: 0.04em; }
.stat-list dd {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* 警示条 */
.alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 14px 0;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-left-width: 2px;
  border-radius: var(--radius);
  background: var(--bg-1);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}
.alert strong { font-size: 13px; letter-spacing: 0.1em; font-weight: 600; }
.alert-warn { border-color: #3a3226; border-left-color: var(--warn); }
.alert-warn strong { color: var(--warn); }
.alert-danger { border-color: #3d1f1d; border-left-color: var(--blood); background: #120d0e; }
.alert-danger strong { color: #d2564c; }

/* ---------- 9. 对局页 ---------- */
.view-round.is-on { height: 100dvh; }

/* 氛围图区（占位色块） */
.atmo {
  position: relative;
  flex: 0 0 auto;
  height: 96px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(80% 120% at 18% 0%, rgba(96, 132, 148, 0.22), transparent 58%),
    radial-gradient(60% 100% at 88% 10%, rgba(120, 60, 55, 0.16), transparent 62%),
    linear-gradient(165deg, #131a20 0%, #0b0d11 55%, #08080a 100%);
}
.atmo-fog {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px);
  mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 90%);
}
.atmo-body {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.atmo-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: #e7e2da;
  text-shadow: 0 0 20px rgba(150, 185, 200, 0.25);
}

/* 固定状态条 */
.statusbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 10px;
  padding: 10px var(--pad) 11px;
  border-bottom: 1px solid var(--line);
  background: #0b0b10;
}
.statusbar .sanity {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 9px;
}
.statusbar .cell { display: flex; flex-direction: column; gap: 1px; }
.sval {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s;
}
.sval.is-hurt { color: #e07a70; }
.sval.is-curse { color: var(--warn); }
.sanity .sval { min-width: 58px; font-size: 15px; }
.sanity .bar { flex: 1; min-width: 0; }

/* 数值变化时的高亮（用 class 触发，1 秒后移除） */
.flash { animation: flash 0.9s ease-out; }
@keyframes flash {
  0%   { color: #fff; text-shadow: 0 0 12px rgba(255, 255, 255, 0.45); }
  100% { text-shadow: none; }
}

/* 剧情正文 */
.story {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px var(--pad) 14px;
  scroll-behavior: smooth;
}
.story-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--cold);
  margin-bottom: 12px;
}
.story-title::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 1px;
  margin-right: 8px;
  vertical-align: middle;
  background: var(--cold-dim);
}
.story-text {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: 0.045em;
  color: #d6d2ca;
  white-space: pre-wrap;
  word-break: break-word;
}
.story-meta {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #43434d;
}
/* 主神播报：节点结算说明，贴在正文下方 */
.story-notes {
  margin-top: 16px;
  padding-left: 10px;
  border-left: 1px solid #37322a;
  font-size: 12.5px;
  line-height: 1.8;
  letter-spacing: 0.02em;
  color: #8c8474;
}
.story-notes p + p { margin-top: 6px; }
/* 节点切换时的淡入 */
.node-in { animation: nodeIn 0.42s ease-out; }
@keyframes nodeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* 操作条 */
.round-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px var(--pad) 0;
}
/* 返回空间：最淡的一个，靠右，避免误触 */
.btn-quiet { margin-left: auto; color: #5c5c68; font-size: 11.5px; }
.btn-quiet:hover:not(:disabled) { color: var(--ink-2); }

/* 选项组：单列、拇指可达 */
.options {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px var(--pad) calc(12px + env(safe-area-inset-bottom));
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, rgba(10, 10, 12, 0), rgba(10, 10, 12, 0.92) 18%);
}
.opt {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  padding: 11px 12px;
  border: 1px solid #26262f;
  border-radius: var(--radius);
  background: #0d0d12;
  color: #dcd8d1;
  font-size: 14.5px;
  line-height: 1.55;
  text-align: left;
  transition: background 0.16s, border-color 0.16s, transform 0.08s, opacity 0.16s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover:not(:disabled) { background: #12121a; border-color: #363642; }
.opt:active:not(:disabled) { transform: translateY(1px); }
.opt:disabled { opacity: 0.4; cursor: not-allowed; }
.opt:focus-visible { outline: 1px solid var(--cold-dim); outline-offset: 2px; }
.opt .idx {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: #55555f;
}
.opt .txt { min-width: 0; }
.opt .hint {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: #6d6250;
  white-space: nowrap;
}
.opt.is-risk { border-left: 2px solid var(--blood-dim); }
.opt.is-risk .hint { color: #a86058; }
.opt.is-hidden-opt .txt { color: #8f8b84; }
.opt.is-picked { border-color: var(--cold-dim); background: #0f161a; }

.options-empty {
  padding: 14px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--dim);
}

/* ---------- 10. 结算页 ---------- */
.view-settle.is-on { justify-content: flex-start; }

/* 结算页的附注与按钮之间留出呼吸 */
.view-settle .story-notes { margin-bottom: 18px; }

.result-wrap {
  padding: 26px 0 20px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.result-big {
  margin: 12px 0 8px;
  font-family: var(--font-serif);
  font-size: 54px;
  line-height: 1.1;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: var(--ink);
}
.result-desc {
  font-size: 12.5px;
  line-height: 1.7;
  color: #6c6c78;
  letter-spacing: 0.04em;
}

/* 四种结局配色 */
.result-survive  { color: #8e99a3; text-shadow: 0 0 26px rgba(140, 155, 165, 0.22); }
.result-standard { color: #d8dfe3; text-shadow: 0 0 26px rgba(200, 220, 232, 0.24); }
.result-perfect  { color: #d9be79; text-shadow: 0 0 30px rgba(217, 190, 121, 0.3); }
.result-destroy  { color: #c33a31; text-shadow: 0 0 30px rgba(195, 58, 49, 0.35); }

.reward { margin-top: 4px; }
.reward li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--dim);
}
.reward li:last-child { border-bottom: 0; }
.reward li b {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.reward li.is-gain b { color: #9fd0b4; }
.reward li.is-loss b { color: #e07a70; }

/* ---------- 11. 飘字与轻提示 ---------- */
.delta-host {
  position: fixed;
  left: 50%;
  bottom: 30%;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}
.delta {
  padding: 3px 10px;
  border: 1px solid currentColor;
  background: rgba(8, 8, 11, 0.82);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.26s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.3, 1);
  will-change: opacity, transform;
}
.delta.on { opacity: 1; transform: translateY(-16px) scale(1); }
.delta.off { opacity: 0; transform: translateY(-44px) scale(1); }
.delta.up { color: #9fc4d3; }
.delta.down { color: #d98b84; }
.delta.disturb { color: var(--warn); }

.toast-host {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(90vw, 420px);
  pointer-events: none;
}
.toast {
  padding: 9px 14px;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--dim);
  border-radius: var(--radius);
  background: rgba(12, 12, 17, 0.96);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.toast.on { opacity: 1; transform: none; }
.toast.is-error { border-left-color: var(--blood); color: #e2b3ae; }
.toast.is-ok { border-left-color: var(--cold-dim); color: #c4dbe4; }

/* ---------- 12. 顶部状态条 / 空间入口 / 商城 / 背包（增量） ---------- */

/* 12.1 顶部状态条：点数 / 心魔 / 背包，常驻不随内容滚动 */
.hud {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: #0b0b10;
}
.hud-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 8px 10px 9px;
  border-left: 1px solid var(--line);
}
.hud-cell:first-child { border-left: 0; padding-left: var(--pad); }
.hud-cell:last-child { padding-right: var(--pad); }
.hud-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.hud-val {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-val.is-warn { color: var(--warn); }
.hud-flag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--warn);
  white-space: nowrap;
}
/* 心魔接近 100：警示；满值转血字（会被强制送进心魔副本） */
.hud-cell.is-warn .hud-val { color: var(--warn); }
.hud-cell.is-critical .hud-val {
  color: #e06055;
  text-shadow: 0 0 14px rgba(179, 53, 47, 0.45);
}
.hud-cell.is-critical .hud-flag { color: #e06055; }

/* 12.2 首页入口：商城 / 背包 */
.gates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.gate {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 66px;
  padding: 12px 12px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
  text-align: left;
  transition: background 0.16s, border-color 0.16s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}
.gate:hover { border-color: var(--line-3); background: var(--bg-3); }
.gate:active { transform: translateY(1px); }
.gate:focus-visible { outline: 1px solid var(--cold-dim); outline-offset: 2px; }
.gate-k {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.gate-s {
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--dim);
}

/* 12.3 子页顶栏（商城 / 背包） */
.topbar-sub { gap: 8px; }
.topbar-sub .brand-sub {
  flex: 1;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--ink-2);
}
.pt {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--cold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* 商城页头：余额 / 心魔 两行叠放，不额外占宽 */
.pt-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  line-height: 1.35;
}
.pt-sub {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--dim);
}
.pt-sub.is-warn { color: var(--warn); }
.pt-sub.is-critical { color: #e06055; }
.scroll-area-tight { padding-top: 14px; }

/* 12.4 分类筛选 chips：横向滚动，不外溢 */
.filters {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px var(--pad);
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  background: #0a0a0e;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: transparent;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  white-space: nowrap;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { color: var(--ink); border-color: var(--line-3); }
.chip.is-on { border-color: var(--cold-dim); background: #0f161a; color: #d9ecf3; }
.chip:focus-visible { outline: 1px solid var(--cold-dim); outline-offset: 2px; }

/* 12.5 商品卡：375px 单列 */
.shop-list { display: flex; flex-direction: column; gap: 10px; }

.shop-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 13px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0b10;
}
.sc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.sc-name {
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.08em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.sc-type {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: #4b4b57;
  white-space: nowrap;
}
.sc-desc {
  font-size: 12.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  color: #7b7b87;
  overflow-wrap: anywhere;
}
.sc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sc-chip {
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: var(--dim);
  white-space: nowrap;
}
.sc-chip.is-mind { color: var(--warn); border-color: #3a3226; }
.sc-chip.is-ease { color: #8fb8a4; border-color: #27352f; }
.sc-chip.is-scope { color: #8fa3ad; border-color: #263139; }
.sc-chip.is-bound { color: #a08f74; border-color: #332d24; }
/* 支线碎片等级 D/C/B/A/S */
.sc-chip.lv-D { color: #8b8b96; border-color: #2c2c36; }
.sc-chip.lv-C { color: #9dc0cf; border-color: #2f4750; }
.sc-chip.lv-B { color: #c8b07a; border-color: #3a3323; }
.sc-chip.lv-A { color: #d19a63; border-color: #4a3524; }
.sc-chip.lv-S { color: #d2564c; border-color: var(--blood-dim); }

.sc-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
  min-width: 0;
}
.sc-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}
.sc-price b {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.2;
  color: #e8f2f6;
  font-variant-numeric: tabular-nums;
}
.sc-price span {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.sc-limit {
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--dim);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 操作行：左原因 / 右按钮。按钮禁用时必须配原因文案 */
.sc-action {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  min-width: 0;
}
.sc-reason {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #6f6f7b;
  overflow-wrap: anywhere;
}
.sc-reason.is-warn { color: #b3895c; }
.sc-reason.is-ok { color: var(--cold); }

.btn-buy {
  flex: 0 0 auto;
  min-width: 88px;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
  letter-spacing: 0.08em;
  border-color: #33454e;
  background: #0f181d;
  color: #cfe4ec;
}
.btn-buy:hover:not(:disabled) { background: #14212a; border-color: #54788a; }
.btn-buy:disabled {
  border-color: var(--line);
  background: transparent;
  color: #5c5c68;
}
.btn-buy.is-done {
  border-color: var(--cold-dim);
  background: #0e1417;
  color: var(--cold);
}

.shop-empty {
  padding: 26px 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--dim);
}

/* 12.6 背包 */
.bag-summary {
  flex: 0 0 auto;
  padding: 12px var(--pad) 13px;
  border-bottom: 1px solid var(--line);
  background: #0b0b10;
}
.bag-summary-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.bag-usage {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.bag-usage.is-warn { color: var(--warn); }
.bag-usage.is-full { color: #e06055; }
.bar-bag { margin-top: 8px; height: 3px; }
.bar-bag.is-warn > i { background: linear-gradient(90deg, #5a4426, #c9a879); }
.bag-note {
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.6;
  color: #5a5a66;
}

.bag-list { display: flex; flex-direction: column; gap: 8px; }
.bag-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0b10;
}
.bag-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.bag-name {
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0.06em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.bag-qty {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--cold);
  font-variant-numeric: tabular-nums;
}
.bag-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.bag-desc {
  font-size: 11.5px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  color: #6f6f7b;
  overflow-wrap: anywhere;
}
.bag-action {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1px;
  min-width: 0;
}
.btn-use {
  flex: 0 0 auto;
  min-width: 80px;
  min-height: 38px;
  padding: 7px 14px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  border-color: #33454e;
  background: #0f181d;
  color: #cfe4ec;
}
.btn-use:hover:not(:disabled) { background: #14212a; border-color: #54788a; }
.btn-use:disabled {
  border-color: var(--line);
  background: transparent;
  color: #5c5c68;
}

/* 12.7 「即将开放」占位 */
.stub {
  padding: 30px 18px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  text-align: center;
}
.stub-mark {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.28em;
  color: #45454f;
}
.stub-title {
  margin: 10px 0 8px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--ink-2);
  text-indent: 0.18em;
}
.stub-desc {
  max-width: 300px;
  margin: 0 auto 16px;
  font-size: 12px;
  line-height: 1.75;
  color: #62626e;
}

/* ---------- 13. 桌面放宽 ---------- */
@media (min-width: 600px) {
  :root { --pad: 28px; }
  .frame {
    border-left: 1px solid #131319;
    border-right: 1px solid #131319;
  }
  .atmo { height: 120px; }
  .rest-count { font-size: 38px; }
  .result-big { font-size: 60px; }
  .story-text { font-size: 17px; }
  /* 增量：桌面下 HUD 与卡片略微放大，仍保持单列（frame 上限 520px） */
  .hud-val { font-size: 17px; }
  .sc-name { font-size: 17px; }
  .sc-desc { font-size: 13px; }
}

/* 高对比度 / 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
