/* ══════════════════════════════════════════════════════════════════
   ⚠️ 变量定义已经搬到 tokens.css —— 那里是"界面长什么样"的唯一出处，
      目的就是让后期整套换美术资产时只改那一个文件。

      这里只留**旧变量名的别名**，让下面几百处 var(--amber) 之类
      不用一次性全改完（那种大改动最容易改坏）。
      以后新增样式请直接用 tokens.css 的名字（--primary / --gold …）。
   ══════════════════════════════════════════════════════════════════ */
:root {
  --amber: var(--gold);          /* 旧名 → 新名 */
  --amber-2: var(--gold);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(217,166,83,.08), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(120,90,60,.10), transparent 60%);
  z-index: 0;
}

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.mt { margin-top: 16px; }

.view { position: relative; z-index: 1; height: 100%; }

/* ---------------- 通用控件 ---------------- */

input[type="text"], input:not([type]), textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 13px;
  font: inherit;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--amber); }

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 11px 16px;
  transition: filter .15s, background .15s, border-color .15s, opacity .15s;
  color: var(--text);
  background: transparent;
}
button:disabled { opacity: .45; cursor: not-allowed; }

.primary {
  background: linear-gradient(180deg, var(--amber-2), var(--amber));
  color: var(--bg);
  font-weight: 600;
  width: 100%;
}
.primary:hover:not(:disabled) { filter: brightness(1.08); }

.ghost { border-color: var(--line); color: var(--text-dim); background: transparent; }
.ghost:hover:not(:disabled) { border-color: var(--amber); color: var(--amber-2); }
.small { padding: 6px 11px; font-size: 13px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-dim); }

.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 8px 0 0; }

/* ---------------- 入口 ---------------- */

.gate { display: grid; place-items: center; padding: 24px; }

/*
 * 入口卡片。
 * ⚠️ 初版只有 480px 宽，在 1920 屏幕上显得只占了中间一小条、两侧大片空白。
 *    现在放宽到 720px，并让角色列表用两列 —— 屏幕越大越好看，同时不牺牲窄屏可用性。
 */
.gate-card {
  width: min(720px, 100%);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
}
.gate-card h1 {
  margin: 0 0 4px;
  font-size: 32px; letter-spacing: .22em;
  color: var(--amber-2); text-align: center; font-weight: 600;
}
.gate-sub { margin: 0 0 26px; text-align: center; color: var(--text-dim); font-size: 13px; }
.auth-line { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 8px; }
.auth-box { display: flex; flex-direction: column; gap: 9px; margin: 0 auto 18px; width: min(360px, 100%); }
.auth-input {
  width: 100%; padding: 9px 11px; font-size: 14px;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px;
}
.auth-input:focus { outline: none; border-color: var(--amber); }
.auth-box .primary, .auth-box .ghost { width: 100%; }
.gate-account-note { margin: -2px 0 14px; text-align: center; line-height: 1.5; }
.gm-invites { margin: 0 0 14px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
.gm-invite-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.invite-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.invite-code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--amber-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.invite-code.used { color: var(--text-dim); text-decoration: line-through; }
.gate-actions { margin-bottom: 4px; }
.gate-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 14px; color: var(--text-dim); font-size: 12px;
}
.gate-divider::before, .gate-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gate-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 10px 0 0; text-align: center; }
.gate-model { color: var(--text-dim); font-size: 12px; text-align: center; margin: 6px 0 0; }

/* 角色列表：宽屏两列，窄屏一列 */
.save-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.save-empty { grid-column: 1 / -1; color: var(--text-dim); font-size: 13px; padding: 8px 0; }
.save-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 13px; cursor: pointer; text-align: left; width: 100%;
}
.save-row:hover { border-color: var(--amber); }
.save-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.save-name { font-weight: 600; }
.save-sub { font-size: 12px; color: var(--text-dim); }

/* ---------------- 顶栏 ---------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(28, 22, 17, .9);
  backdrop-filter: blur(6px);
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand { color: var(--amber-2); letter-spacing: .16em; font-weight: 600; }
.world-name { color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.badge {
  font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.badge.warn { color: var(--amber-2); border-color: var(--amber); }

/* ---------------- 面板 ---------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.panel h3 {
  margin: 0 0 10px;
  font-size: 12px; letter-spacing: .16em; color: var(--amber); font-weight: 600;
}

/* ---------------- 角色创建 ---------------- */

.creator {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 1fr) minmax(260px, .9fr);
  gap: 16px;
  padding: 16px;
  height: calc(100% - 56px);
  overflow-y: auto;
  align-items: start;
}

.points-bar {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.points-bar strong { font-size: 22px; color: var(--amber-2); font-variant-numeric: tabular-nums; }

.attr-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.attr-row {
  display: grid;
  grid-template-columns: 52px 32px 44px 32px 1fr;
  align-items: center; gap: 8px;
}
.attr-row .attr-name { color: var(--text-dim); font-size: 13px; }
.attr-row .attr-value {
  text-align: center; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 0;
}
.attr-row .attr-hint { font-size: 12px; color: var(--text-dim); text-align: right; }
.attr-row button { padding: 2px 0; line-height: 1.2; font-size: 16px; }
.attr-row button:hover:not(:disabled) { border-color: var(--amber); color: var(--amber-2); }

.card-list { display: flex; flex-direction: column; gap: 8px; }
.card {
  text-align: left; width: 100%;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
}
.card:hover { border-color: var(--amber); }
.card.selected { border-color: var(--amber-2); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--amber); }
.card-title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card-desc { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.card-bonus { font-size: 12px; color: var(--ok); margin-top: 4px; }
.card-priority { font-size: 12px; color: var(--amber); margin-top: 4px; }

.preview-panel { position: sticky; top: 0; }

.stats { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 14px; }
.stats dt { color: var(--text-dim); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.stats.compact { font-size: 13px; gap: 3px 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.chip {
  font-size: 12px; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; background: var(--panel-2); color: var(--text-dim);
}
.chip.gain { color: var(--ok); border-color: rgba(111,155,106,.45); }
.chip.loss { color: var(--danger); border-color: rgba(217,83,79,.45); }
.chip.item { color: var(--text); }

/* ---------------- 城内大厅 ---------------- */

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  height: calc(100% - 56px);
  overflow: hidden;
}

.sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  overflow-y: auto;
}

.sheet-head { margin-bottom: 14px; }
.sheet-name { font-size: 19px; font-weight: 600; color: var(--amber-2); }
.sheet-sub { font-size: 12px; color: var(--text-dim); }

.vitals { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.vital-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.vital-top span:last-child { font-variant-numeric: tabular-nums; color: var(--text); }

.bar { height: 7px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; transition: width .3s ease; }
.bar.hp > i { background: linear-gradient(90deg, var(--danger-4), var(--hp)); }
.bar.stamina > i { background: linear-gradient(90deg, #8a6f1d, var(--stamina)); }
.bar.mp > i { background: linear-gradient(90deg, #3f5c96, var(--mp)); }
.bar.exp > i { background: linear-gradient(90deg, var(--amber), var(--amber-2)); }

.exp-line { margin-bottom: 14px; }

.sheet-row { display: flex; justify-content: space-between; font-size: 13px; margin-top: 8px; }
.sheet-row strong { font-variant-numeric: tabular-nums; }

.hall { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.hall-head h2 { margin: 0 0 2px; font-size: 22px; color: var(--amber-2); font-weight: 600; letter-spacing: .06em; }
.hall-head p { margin: 0 0 14px; font-size: 13px; }

.facility-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.facility {
  text-align: left;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  transition: transform .12s, border-color .12s;
}
.facility:hover { border-color: var(--amber); transform: translateY(-2px); }
.facility-icon { font-size: 24px; line-height: 1; }
.facility-name { font-weight: 600; margin-top: 6px; }
.facility-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.5; }
.facility-none { grid-column: 1 / -1; color: var(--text-dim); font-size: 13px; }

.facility-panel { margin-bottom: 16px; }
.facility-panel h3 { display: flex; align-items: center; gap: 8px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.action-row button { border-color: var(--line); }
.action-row button.ready { color: var(--amber-2); }
.action-row button:disabled { color: var(--text-dim); }

.dungeon-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.dungeon-row:last-child { border-bottom: none; }
.dungeon-rec { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.dungeon-desc { font-size: 12px; color: var(--text-dim); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1100px) {
  .creator { grid-template-columns: 1fr 1fr; }
  .preview-panel { grid-column: 1 / -1; position: static; }
}

@media (max-width: 860px) {
  .creator { grid-template-columns: 1fr; padding: 10px; height: auto; }
  .layout { grid-template-columns: 1fr; padding: 10px; height: auto; overflow-y: auto; }
  .sheet { order: 2; }
  .hall { order: 1; }
  .facility-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .topbar { padding: 9px 12px; }
  .brand { letter-spacing: .1em; }
  .world-name { display: none; }
  .attr-row { grid-template-columns: 46px 30px 40px 30px 1fr; }
}

/* ---------------- 商店 / 副本 / 旅馆（闭环玩法） ---------------- */

.sub-title {
  margin: 16px 0 8px;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--amber);
  font-weight: 600;
}
.sub-title:first-child { margin-top: 0; }

.item-list { display: flex; flex-direction: column; gap: 6px; }
.item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.item-row:hover { border-color: var(--line-strong); }
.item-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/**
 * 物品名（商店列表用）。
 *
 * ⚠️ 这里原来**只有字号字重、没有 color** —— 于是即使加了 `r-*` 类
 *    也不会变色（类只定义 `--r`，真正的颜色必须在这里读出来）。
 *    这就是"铁匠铺售卖/可卖出没改色"的直接原因：
 *    加了类但没人读它，界面看起来仍然是默认黑。
 */
.item-name { font-weight: 600; font-size: 14px; color: var(--r, var(--text)); }
.item-meta { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.item-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; margin-top: 2px; }

/* 副本战报 */
.result-head {
  font-size: 16px; font-weight: 600; padding: 10px 12px;
  border-radius: var(--radius); margin-bottom: 8px;
}
.result-head.win { background: rgba(111,155,106,.14); border: 1px solid rgba(111,155,106,.5); color: var(--ok-3); }
.result-head.lose { background: rgba(217,83,79,.12); border: 1px solid rgba(217,83,79,.5); color: var(--danger-3); }

.result-summary {
  font-size: 13px; color: var(--text-dim);
  padding: 8px 12px; margin-bottom: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}

.battle-log { display: flex; flex-direction: column; gap: 10px; }
.floor-line {
  border-left: 2px solid var(--line);
  padding-left: 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.floor-line > strong { font-size: 13px; color: var(--amber); }
.battle-line { font-size: 13px; color: var(--text-dim); }
.battle-line.win { color: var(--ok-3); }
.battle-line.lose { color: var(--danger-3); }

/* 轻提示 */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 50;
  box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
.toast.ok { border-color: rgba(111,155,106,.6); color: var(--ok-3); }
.toast.error { border-color: rgba(217,83,79,.6); color: var(--danger-3); }
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(8px); pointer-events: none; }

/* ---------------- 副本推进（叙事 + 状态） ---------------- */

.narrative {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
  background: linear-gradient(180deg, var(--panel-2), var(--bg));
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 14px;
  white-space: pre-wrap;
}
.narrative.small { font-size: 13px; padding: 9px 12px; margin: 6px 0 10px; color: var(--text-dim); }

.run-status {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.action-row .primary { width: auto; }

/* ================= 角色卡向导（4 步，手机竖屏长条） ================= */

.creator-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 12px 12px;
}

.wiz-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.wiz-progress { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wiz-dots { display: flex; gap: 6px; }
.wiz-dot {
  width: 26px; height: 3px; border-radius: 2px;
  background: var(--line); transition: background .2s;
}
.wiz-dot.active { background: var(--amber-2); }
.wiz-dot.done { background: var(--amber); }
.wiz-title { font-size: 15px; font-weight: 600; color: var(--amber-2); }
.wiz-count { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.wiz-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 0;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.wiz-foot {
  display: flex; gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
}
.wiz-foot .primary { flex: 1; }
.wiz-foot .ghost { flex: 0 0 auto; min-width: 96px; }

.wiz-error {
  color: var(--danger); font-size: 13px;
  min-height: 18px; margin: 6px 0 0; text-align: center;
}
.wiz-lead { margin: 0 0 4px; color: var(--text-dim); font-size: 13px; line-height: 1.7; }
.wiz-note { margin: 4px 0 0; color: var(--text-dim); font-size: 12px; line-height: 1.6; text-align: center; }

.wiz-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px;
}

.name-input {
  width: 100%; font-size: 20px; text-align: center;
  letter-spacing: .06em; padding: 14px 12px;
}
.name-counter {
  margin-top: 8px; text-align: right;
  font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.name-counter.over { color: var(--danger); }

/* 可选卡片（性格 / 技能 / 装备共用） */
.pick-card {
  text-align: left; width: 100%; display: block;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px;
  transition: border-color .15s, background .15s, transform .1s;
}
.pick-card:active { transform: scale(.99); }
.pick-card:hover { border-color: var(--line-strong); }
.pick-card.selected {
  border-color: var(--amber-2); background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--amber);
}
.pick-title { font-weight: 600; font-size: 15px; }
.pick-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pick-desc { font-size: 13px; color: var(--text-dim); margin-top: 5px; line-height: 1.65; }
.pick-trigger { font-size: 12px; color: var(--amber); margin-top: 6px; }
.mp-tag, .slot-tag {
  font-size: 11px; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 9px; white-space: nowrap; flex: 0 0 auto;
}
.pick-attrs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.attr-chip {
  display: inline-flex; align-items: baseline; gap: 5px;
  font-size: 12px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
}
.attr-chip-label { color: var(--text-dim); }
.attr-chip b { color: var(--amber-2); font-variant-numeric: tabular-nums; }

.pick-bar {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; padding: 8px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}

/* ================= 城内：分页标签（手机端） ================= */

.tab {
  background: transparent; border: 1px solid transparent;
  color: var(--text-dim); padding: 6px 14px; border-radius: 999px;
  font-size: 14px;
}
.tab.active { background: var(--panel-2); color: var(--amber-2); border-color: var(--line); }

.sheet-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 12px; border-radius: 999px; padding: 2px 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text-dim);
}
.tag.personality { color: var(--amber-2); border-color: rgba(217,166,83,.5); }

.vital-note { font-size: 11px; color: var(--text-dim); margin: 8px 0 0; line-height: 1.5; }

.level-line {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 10px 12px; margin-bottom: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.level-badge { font-size: 15px; color: var(--amber-2); font-weight: 600; }
.level-badge b { font-size: 19px; }

/* 技能卡 */
.skill-card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius); padding: 11px 13px;
}
.skill-name { font-weight: 600; color: var(--amber-2); }
.skill-desc { font-size: 12px; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }

/* 装备槽位 */
.equip-slots { display: flex; flex-direction: column; gap: 7px; }
.equip-slot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px;
}
.equip-slot.empty { opacity: .55; }
.equip-slot-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.equip-slot-name { font-size: 11px; color: var(--amber); letter-spacing: .1em; }
.equip-slot-item { font-size: 14px; font-weight: 600; }
.equip-slot-text { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* 仓库 */
.warehouse { display: flex; flex-direction: column; gap: 7px; }
.wh-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px;
}
.wh-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wh-name { font-size: 14px; font-weight: 600; }
/* 数量单独一个 span（原来拼在名字里，给名字上色会连数量一起染） */
.wh-qty { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.wh-text { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* 副本战斗里的技能触发行 */
.skill-line { font-size: 12px; color: var(--amber); padding-left: 8px; }
.skill-line.failed { color: var(--text-dim); }

/* ================= 手机端：卡片式布局 ================= */

@media (max-width: 860px) {
  .creator-view { padding: 0 10px 10px; max-width: none; }
  .wiz-card, .panel { border-radius: 10px; }
  .pick-card { padding: 12px; }
  .name-input { font-size: 18px; }

  /* 城内改成一屏一页，用顶部标签切换 */
  .layout { display: block; padding: 10px; height: calc(100% - 52px); overflow-y: auto; }
  .sheet, .hall { display: block; }
  .sheet.mobile-hidden, .hall.mobile-hidden { display: none; }
  .facility-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .facility { padding: 11px; }
  .facility-icon { font-size: 20px; }
  .topbar { padding: 8px 10px; }
  .badge { display: none; }
}

@media (min-width: 861px) {
  /* 宽屏：两个面板并排，标签栏仍可用但要保证都可见 */
  .sheet.mobile-hidden, .hall.mobile-hidden { display: block; }
}

/* ================= 副本探险：长篇剧情阅读 ================= */

.exp-progress {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 9px 13px; margin-bottom: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px;
}

/* 连续长文：段号做成左侧标尺，正文保持可读宽度 */
.exp-story {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 62vh; overflow-y: auto;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}
.exp-seg {
  display: flex; gap: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
  animation: expIn .25s ease;
}
@keyframes expIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.exp-seg-no {
  flex: 0 0 auto; font-size: 12px; color: var(--amber);
  font-variant-numeric: tabular-nums; padding-top: 2px; min-width: 34px;
}
.exp-seg-text { font-size: 15px; line-height: 1.9; white-space: pre-wrap; }

/* 获得的特质 */
.award-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--amber); border-left: 3px solid var(--amber-2);
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 8px;
}
.award-name { font-weight: 600; color: var(--amber-2); font-size: 15px; }
.award-desc { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.6; }
.award-why { font-size: 12px; color: var(--text-dim); margin-top: 6px; font-style: italic; }

/* 冒险日记 */
.diary-card {
  background: var(--bg);
  border: 1px solid var(--line); border-left: 3px solid var(--text-dim);
  border-radius: var(--radius); padding: 13px 15px;
  font-size: 14px; line-height: 1.9; white-space: pre-wrap;
  color: #ddd0b8;
}

/* ================= 阵亡标记 ================= */

.tag.dead { color: var(--danger-3); border-color: rgba(217,83,79,.6); }
.sheet.dead { filter: saturate(.45); }
.sheet.dead .sheet-name { color: #c98b88; }
.death-note {
  margin: 10px 0; padding: 10px 12px;
  background: rgba(217,83,79,.10); border: 1px solid rgba(217,83,79,.45);
  border-radius: var(--radius); font-size: 13px; color: var(--danger-3);
}
.diary-entry {
  border-left: 2px solid var(--line); padding-left: 10px;
  margin-bottom: 10px; font-size: 13px; line-height: 1.75; color: var(--text-dim);
}
.diary-entry b { color: var(--text); }
.trait-chip {
  display: inline-block; font-size: 12px; padding: 3px 10px; margin: 0 6px 6px 0;
  border: 1px solid var(--amber); border-radius: 999px; color: var(--amber-2);
  background: var(--panel-2);
}

/* ================= 铁匠铺锻造台 ================= */

.forge-label { font-size: 13px; color: var(--amber); margin: 14px 0 6px; }
.forge-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.forge-pick {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text); cursor: pointer; text-align: left;
  font-family: inherit; font-size: 13px; max-width: 100%;
}
.forge-pick:hover { border-color: var(--amber); }
.forge-pick.on { border-color: var(--amber-2); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--amber-2) inset; }
.forge-pick-name { font-weight: 600; }

/**
 * 稀有度上色的**唯一规则**（用户 2026-10-16："所有物品"）。
 *
 * ⚠️ 这些元素自己都被加了 `r-xxx` 类，类的唯一作用是定义 `--r`；
 *    真正的颜色必须**在这里读出来**。
 *    只加类、不写 `color: var(--r)` 的话，颜色不会出现 ——
 *    而界面看起来"有颜色"（继承来的黑色），所以很难发现漏了哪一处。
 *
 * ⚠️ 各处的兜底色不同（装备名原来是 --text，锻造名也是 --text），
 *    所以分开写，没有合并成一条选择器 —— 合并会丢掉各自的兜底。
 */
.wh-name { color: var(--r, var(--text)); }
.equip-slot-item { color: var(--r, var(--text)); }
.forge-pick-name { color: var(--r, var(--text)); }
.forge-pick-qty { color: var(--text-dim); }

/**
 * 稀有度胶囊（锻造面板用）。
 *
 * ⚠️ 这里原来**自己写了一套色号**（#9a9a8a / var(--ok-2) / #5b8fc7 / #a97bd1 / var(--gold)），
 *    和用户给定的五档色号**完全不是一套**。所以锻造面板上的稀有度
 *    和别处（结算卡片、背包）看起来是两个体系 ——
 *    用户报的"有的地方没替换干净"就是这个。
 *
 * 现在统一取 `--r`（由 .r-* 定义，见 ui.css），
 * 而 .r-* 又取 tokens.css 的 --rarity-* —— **全项目只有一个颜色来源**。
 */
.rarity-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid currentColor; opacity: .95;
  color: var(--r, var(--text-dim));
}

.forge-eval { margin-top: 12px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.forge-chance { display: flex; align-items: baseline; gap: 10px; }
.forge-chance-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.forge-chance-num.good { color: var(--ok-2); }
.forge-chance-num.mid  { color: var(--gold); }
.forge-chance-num.bad  { color: var(--danger); }
.forge-why { margin-top: 6px; }
.forge-why-item { font-size: 12px; line-height: 1.7; color: var(--text-dim); }
.forge-why-item.good { color: var(--ok-2); }
.forge-why-item.bad { color: var(--danger-2); }

.forge-out { padding: 10px 12px; border-radius: var(--radius); margin-top: 10px; font-size: 14px; line-height: 1.7; }
.forge-out.win  { background: rgba(111,155,106,.12); border: 1px solid rgba(111,155,106,.5); }
.forge-out.lose { background: rgba(217,83,79,.10); border: 1px solid rgba(217,83,79,.45); }
.forge-out-card { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.forge-out-name { font-weight: 600; color: var(--amber-2); display: inline-block; margin-right: 8px; }
.forge-up { color: var(--gold); font-size: 13px; margin: 4px 0; }

/* ================= 结算面板：血量 / 收益 / 掉落 ================= */

.result-cards {
  display: flex; flex-direction: column; gap: 10px; margin: 12px 0;
}
.result-card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px;
}
.result-card-title {
  font-size: 12px; color: var(--amber); letter-spacing: .06em; margin-bottom: 7px;
}

/* 血量账：进场 → 结束，右侧标出损耗 */
.result-hp-line { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.hp-from { color: var(--text-dim); font-size: 15px; }
.hp-arrow { color: var(--text-dim); font-size: 12px; }
.hp-to { color: var(--ok-2); font-size: 20px; font-weight: 700; }
.hp-to.dead { color: var(--danger); }
.hp-cost { margin-left: auto; color: var(--danger-2); font-size: 14px; font-weight: 600; }

/* 收益：三格并排 */
.result-gain-line { display: flex; gap: 16px; flex-wrap: wrap; }
.gain-cell { display: flex; flex-direction: column; gap: 2px; }
.gain-label { font-size: 11px; color: var(--text-dim); }
.gain-value { font-size: 17px; font-weight: 600; color: var(--amber-2); font-variant-numeric: tabular-nums; }

/**
 * ⚠️ 这里原来有 `.loot-list / .loot-row / .loot-name / .loot-qty` ——
 *    结算面板的"掉落品"那三张卡用的。
 *    用户 2026-10-16 取消了副本页的结算展示，这些类**已经没有任何调用方**，
 *    已删除。留着的话下次改物品名颜色会去改 `.loot-name`，
 *    而那个类根本不会被渲染 —— 白改一轮还找不到问题。
 */

/* ================================================================== */
/* 角色常驻横条（顶部）                                                */
/* 用户定案：常驻只留 三围 / 四维 / 特质位 / 装备名；                  */
/*           技能·日记·仓库收进折叠区。                                */
/* ================================================================== */

.charstrip {
  margin: 0 10px 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.cs-top {
  display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 8px; margin-bottom: 8px;
}
.cs-name { font-size: 17px; font-weight: 600; color: var(--amber-2); }
.cs-sub { font-size: 12px; color: var(--text-dim); }
.cs-tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.cs-spacer { flex: 1 1 auto; }
.cs-level { font-size: 13px; color: var(--text-dim); }
.cs-level b { color: var(--amber-2); font-size: 16px; }
.cs-gold { font-size: 12px; }

/* 三围横排 */
.cs-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 14px;
  margin-bottom: 8px;
}
.cs-bar { display: flex; align-items: center; gap: 7px; }
.cs-bar .bar { flex: 1 1 auto; margin: 0; }
.cs-num {
  font-size: 12px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; min-width: 62px; text-align: right;
}
.cs-ico { font-size: 14px; line-height: 1; opacity: .9; }

/* 四维横排 */
.cs-attrs {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-bottom: 8px; padding: 7px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cs-attr { display: inline-flex; align-items: baseline; gap: 5px; font-size: 13px; }
.cs-attr-name { color: var(--text-dim); }
.cs-attr-val { color: var(--amber-2); font-size: 15px; font-variant-numeric: tabular-nums; }

/* 特质与装备各占一行 */
.cs-line { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.cs-label {
  font-size: 12px; color: var(--text-dim);
  flex: 0 0 auto; min-width: 52px;
}
.cs-traits, .cs-equip { display: flex; flex-wrap: wrap; gap: 5px; }
.trait-chip.more { color: var(--amber); border-color: var(--amber); }

.cs-equip-item {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); font-size: 12px;
}
.cs-equip-item.empty { opacity: .45; }
.cs-equip-slot { font-size: 11px; color: var(--text-dim); }
/**
 * ⚠️ 原来写死 `color: var(--text)` —— 那会**盖掉**稀有度色
 *    （`.r-*` 只定义 `--r`，真正的 color 要靠这里读）。
 *    这是"物品名没上色"的第二类原因：不是没加类，是被固定色压住了。
 */
.cs-equip-name { color: var(--r, var(--text)); }

/* 折叠区 */
.cs-fold { margin-top: 10px; }
.charstrip.folded .cs-fold { display: none; }
#cs-toggle { margin-left: 4px; }

/* ================================================================== */
/* 世界探险日志（弹层）                                                */
/* ================================================================== */

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 6, 4, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  width: min(760px, 100%); max-height: 86vh;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 17px; color: var(--amber-2); }
.modal-body { overflow-y: auto; padding: 10px 14px 16px; }
#world-log-summary { padding: 8px 14px 0; margin: 0; }

.log-row {
  padding: 9px 11px; margin-bottom: 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--line); border-radius: 8px;
}
/* 左侧色条：一眼区分状态 */
.log-row.queued    { border-left-color: var(--text-dim); }
.log-row.running   { border-left-color: var(--amber); }
.log-row.done      { border-left-color: var(--ok); }
.log-row.abandoned { border-left-color: var(--muted-warm); opacity: .72; }
.log-row.failed    { border-left-color: var(--danger); }

.log-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.log-status {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid currentColor; flex: 0 0 auto;
}
.log-status.queued    { color: var(--text-dim); }
.log-status.running   { color: var(--amber); }
.log-status.done      { color: var(--ok); }
.log-status.abandoned { color: var(--muted-warm); }
.log-status.failed    { color: var(--danger); }
/* 编号用等宽字体：玩家要"对得上号"，等宽更好认 */
.log-id {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px; color: var(--text-dim);
}
.log-who { font-weight: 600; color: var(--text); }
.log-dungeon { font-size: 12px; color: var(--text-dim); }
.log-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 4px; font-size: 12px; color: var(--text-dim);
}
.log-queue { color: var(--amber); }
.log-loot { margin-top: 4px; }
.log-progress {
  margin-top: 6px; height: 4px; border-radius: 999px;
  background: var(--panel-2); overflow: hidden;
}
.log-progress i { display: block; height: 100%; background: var(--amber); }

/* ================================================================== */
/* 集结小队                                                            */
/* ================================================================== */

.party-form {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.party-form .sub-title { margin: 0; }
.party-select, .party-input {
  width: 100%; padding: 7px 10px; font-size: 14px;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px;
}
.party-select:focus, .party-input:focus { outline: none; border-color: var(--amber); }
.party-target {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 0 2px;
}
.party-target .muted { flex: 0 0 auto; }
.party-target .party-select { flex: 1 1 auto; min-width: 0; }
.party-invite { display: flex; flex-direction: column; gap: 4px; }
.party-invite.hidden { display: none; }

.party-card {
  padding: 10px 12px; margin-bottom: 9px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--amber); border-radius: 8px;
}
/* 已出发的队：淡一点，表示"满了/走了"，但仍看得见 */
.party-card.launched { border-left-color: var(--ok); opacity: .8; }

.party-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.party-dungeon-name { font-size: 15px; font-weight: 600; color: var(--amber-2); }
.party-count { font-size: 12px; color: var(--text-dim); }
.party-mode {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid currentColor;
}
/* 三种入队方式用颜色区分，扫一眼就知道能不能进 */
.party-mode.open   { color: var(--ok); }
.party-mode.invite { color: var(--amber); }
.party-mode.closed { color: var(--text-dim); }
.party-launched { font-size: 11px; color: var(--ok); }

.party-leader { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
/* 队长备注：用户明确要求界面上能看到，所以给它独立一行、字色亮一点 */
.party-note {
  margin-top: 4px; font-size: 13px; color: var(--text);
  padding-left: 8px; border-left: 2px solid var(--line);
}
.party-members { margin-top: 4px; }
.party-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

/* 小队码：用等宽字体 + 字距，方便念给别人听 / 手抄 */
.party-code {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 5px 9px;
  background: var(--panel-2); border: 1px dashed var(--amber);
  border-radius: 8px;
}
.party-code-label { font-size: 11px; color: var(--text-dim); }
.party-code-value {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 16px; letter-spacing: 2px; color: var(--amber-2);
}

.party-join {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.party-join .sub-title { margin: 0; }
.party-code-row { display: flex; gap: 8px; }
.party-code-input {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 3px; text-transform: uppercase;
}
