/* ============================================================
 * styles.css — 《深渊回响 / ABYSSAL LOOT》哥特暗黑样式表
 * 纯静态：无 CDN、无 @import、无外部字体；噪点使用内联 SVG data URI
 * 顺序：Tokens → Base → App Shell → 组件 → 视图 → 战斗 → 弹窗 → 动效
 * ============================================================ */

/* ============================================================
 * 0. Design Tokens（唯一色彩/字体/尺寸来源）
 * ============================================================ */
:root {
  --bg: #0b0a0d;
  --bg-2: #121016;
  --surface: #17151c;
  --surface-2: #1f1c25;
  --border: #332c2b;
  --border-lit: #5a4740;

  --gold: #c9a227;
  --gold-hi: #e6c04a;
  --gold-dim: #7d6519;

  --blood: #8e1f2b;
  --blood-hi: #c0453c;

  --text: #e9e2d4;
  --text-sub: #9c9187;
  --text-mute: #6b625c;

  --success: #5f8f5f;
  --warning: #d08a2a;
  --danger: #b03a2e;

  --font-display: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", Georgia, serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --font-mono: "Courier New", Consolas, monospace;

  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 6px;

  --sh-sm: 0 1px 2px rgba(0, 0, 0, .6);
  --sh-md: 0 6px 18px rgba(0, 0, 0, .55);

  --shell: 1100px;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

/* ============================================================
 * 1. Base / Reset
 * ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
b, strong { font-weight: 600; }
em, i { font-style: normal; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;   /* 去掉 iOS 双击缩放带来的 300ms 点击延迟 */
}

svg { display: block; }
.ic { display: inline-block; vertical-align: middle; flex: none; }

::selection { background: rgba(201, 162, 39, .28); color: #fff; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0e0d11; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 2px solid #0e0d11;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-lit); }

/* ---------- 氛围层：烛光暖晕 + 暗红余晖 + 噪点 + 暗角 ---------- */
.atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 560px at 50% -8%, rgba(201, 162, 39, .10), transparent 68%),
    radial-gradient(900px 520px at 50% 108%, rgba(142, 31, 43, .16), transparent 70%),
    radial-gradient(620px 420px at 6% 34%, rgba(201, 162, 39, .04), transparent 70%),
    radial-gradient(620px 420px at 94% 62%, rgba(142, 31, 43, .05), transparent 70%);
}
.atmos::before {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 220px 60px rgba(0, 0, 0, .85);
}
.atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============================================================
 * 2. App Shell（全站唯一定义：顶栏 + 页签）
 * ============================================================ */
.app-shell {
  position: sticky;
  top: 0;
  z-index: 30;
  max-width: var(--shell);
  margin: 0 auto;
  background: linear-gradient(180deg, #14121a, #0f0e13);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 20px -14px #000;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px 10px;
}

.hero-id { display: flex; align-items: center; gap: 10px; min-width: 0; }

.hero-sigil {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: linear-gradient(180deg, var(--surface-2), #100f14);
  border: 1px solid var(--border-lit);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 12px rgba(201, 162, 39, .10);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px);
}

.hero-meta { min-width: 0; }
.hero-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: .5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xp-block { flex: 1; min-width: 120px; max-width: 300px; }
.xp-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-sub);
  margin-bottom: 5px;
}
.xp-head b { color: var(--text); }

.wallet { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 资源小片 ---------- */
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-sub);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color .12s var(--ease), color .12s var(--ease);
}
.stat-chip b { color: var(--text); }
.stat-chip.gold { border-color: var(--gold-dim); color: var(--gold); }
.stat-chip.gold b { color: var(--gold-hi); }
.stat-chip.tp { border-style: dashed; }
.stat-chip.tp.on {
  border-style: solid;
  border-color: var(--gold);
  color: var(--gold-hi);
  box-shadow: 0 0 12px -4px var(--gold);
}
.stat-chip.tp.on b { color: var(--gold-hi); }
.chip-btn:hover { border-color: var(--border-lit); color: var(--text); }
.chip-btn:active { transform: translateY(1px); }

/* ---------- 页签 ---------- */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px;
  border-top: 1px solid rgba(51, 44, 43, .6);
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 11px;
  font-size: 13px;
  color: var(--text-sub);
  border-bottom: 2px solid transparent;
  transition: color .12s var(--ease), background .12s var(--ease);
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .02); }
.tab .ic { color: currentColor; }

/* active 唯一机制：body[data-tab] 与 .tab[data-tab] 相等 */
body[data-tab="gear"] .tab[data-tab="gear"],
body[data-tab="bag"] .tab[data-tab="bag"],
body[data-tab="talent"] .tab[data-tab="talent"],
body[data-tab="forge"] .tab[data-tab="forge"] {
  color: var(--gold-hi);
  border-bottom-color: var(--gold);
  background: linear-gradient(180deg, rgba(201, 162, 39, .08), transparent);
}

/* ============================================================
 * 3. 视图切换（body[data-view] 驱动，零漂移）
 * ============================================================ */
#views { position: relative; z-index: 10; }

.view { display: none; }
body[data-view="class-select"] .view[data-view="class-select"],
body[data-view="hub"] .view[data-view="hub"],
body[data-view="battle"] .view[data-view="battle"],
body[data-view="result"] .view[data-view="result"] { display: block; }

/* 顶栏与页签只在主城出现，避免出现无效跳转 */
body[data-view="class-select"] .app-shell,
body[data-view="battle"] .app-shell,
body[data-view="result"] .app-shell { display: none; }

body[data-view="battle"] {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

/* 页签页显隐 */
.tabpage { display: none; }
body[data-tab="gear"] .tabpage[data-page="gear"],
body[data-tab="bag"] .tabpage[data-page="bag"],
body[data-tab="talent"] .tabpage[data-page="talent"],
body[data-tab="forge"] .tabpage[data-page="forge"] {
  display: block;
  animation: pageIn .14s var(--ease) both;
}

/* ============================================================
 * 4. 通用组件：按钮 / 条 / 面板 / 空态
 * ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-lit);
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: all .12s var(--ease);
}
.btn:hover { border-color: var(--gold); color: var(--gold-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn:disabled:hover {
  color: var(--text-mute);
  border-color: var(--border);
  background: transparent;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  color: #1a1408;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  border-color: var(--gold-hi);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 0 14px -6px var(--gold);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.btn-primary:hover { color: #1a1408; background: linear-gradient(180deg, #f2d264, var(--gold-hi)); border-color: var(--gold-hi); }
.btn-primary:disabled,
.btn-primary:disabled:hover {
  color: var(--text-mute);
  background: linear-gradient(180deg, #3a3630, #2b2824);
  border-color: var(--border);
  box-shadow: none;
}

.btn-danger { color: #e8b3ad; background: rgba(142, 31, 43, .16); border-color: var(--blood-hi); }
.btn-danger:hover { color: #fff; background: rgba(142, 31, 43, .34); border-color: var(--blood-hi); }

.btn-ghost { color: var(--text-sub); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-lit); }

.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-xl { padding: 14px 34px; font-size: 16px; font-weight: 700; letter-spacing: 1px; }
.btn-block { width: 100%; margin-top: auto; }

/* ---------- 进度条 ---------- */
.bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.bar i { display: block; height: 100%; width: 0; transition: width .18s linear; }
.bar-xp i { background: linear-gradient(90deg, var(--gold-dim), var(--gold)); }
.bar-hp { height: 16px; }
.bar-hp i { background: linear-gradient(90deg, var(--blood), var(--blood-hi)); box-shadow: 0 0 8px rgba(192, 69, 60, .5); }
.bar-hp b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
  text-shadow: 0 1px 3px #000;
}

/* ---------- 面板 ---------- */
.panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent 40%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
}
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.panel::before {
  top: 0;
  left: 0;
  border-top: 1px solid var(--border-lit);
  border-left: 1px solid var(--border-lit);
}
.panel::after {
  right: 0;
  bottom: 0;
  border-right: 1px solid var(--border-lit);
  border-bottom: 1px solid var(--border-lit);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-bottom: 1px solid var(--border);
}
.panel-head .ic { color: var(--gold); }
.panel-head h3 {
  flex: 1;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .5px;
}
.panel-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-mute);
}
.panel-note b { color: var(--gold-hi); }

/* ---------- 空态 ---------- */
.empty-state {
  padding: 42px 22px;
  text-align: center;
  color: var(--text-mute);
}
.empty-state .ic { margin: 0 auto 12px; color: var(--border-lit); }
.empty-state p { font-size: 13px; color: var(--text-sub); margin-bottom: 5px; }
.empty-state span { font-size: 11px; color: var(--text-mute); }

/* ============================================================
 * 5. 职业选择
 * ============================================================ */
.title-block {
  padding: 46px 20px 28px;
  text-align: center;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dim);
}
.title-block h1 {
  margin: 12px 0 10px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 2px;
}
.title-block p {
  max-width: 540px;
  margin: 0 auto;
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.85;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 20px;
}

.class-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 18px 18px;
  overflow: hidden;
  text-align: center;
  background: var(--surface);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 46%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  animation: cardIn .42s var(--ease) both;
  transition: border-color .14s var(--ease), transform .14s var(--ease), box-shadow .14s var(--ease);
}
.class-card:hover {
  border-color: var(--border-lit);
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}
.cc-glow {
  position: absolute;
  top: -120px;
  left: 50%;
  width: 240px;
  height: 240px;
  margin-left: -120px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(201, 162, 39, .16), transparent 68%);
}
.cc-sigil {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: linear-gradient(180deg, var(--surface-2), #100f14);
  border: 1px solid var(--border-lit);
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 16px rgba(201, 162, 39, .12);
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.cc-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: 1px; }
.cc-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--gold);
}
.cc-blurb {
  min-height: 66px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-sub);
}
.cc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  padding: 12px 0;
  text-align: left;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}
.cc-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.cc-stat span { color: var(--text-mute); }
.cc-stat b { font-family: var(--font-mono); color: var(--text); }

.cc-skill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.cc-skill-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--gold);
  border-right: 1px solid var(--border);
  padding-right: 10px;
}
.cc-skill div { min-width: 0; }
.cc-skill b { display: block; font-size: 13px; }
.cc-skill em { display: block; margin-top: 2px; font-size: 11px; line-height: 1.6; color: var(--text-mute); }

.footnote {
  padding: 26px 20px 44px;
  text-align: center;
  font-size: 11px;
  color: var(--text-mute);
}

/* ============================================================
 * 6. 主城布局
 * ============================================================ */
.hub-wrap {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 18px 20px 118px;
}

.hub-enter {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
  background: linear-gradient(to top, var(--bg) 42%, rgba(11, 10, 13, .86) 72%, transparent);
}
.hub-enter .btn { pointer-events: auto; }
.enter-hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }

/* ---------- 页签 1：装备 ---------- */
.gear-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

.slot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
}

.gear-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 96px;
  padding: 10px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color .12s var(--ease), transform .12s var(--ease), box-shadow .12s var(--ease);
}
.gear-slot:not(.empty) {
  border-color: var(--rc);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), 0 0 14px -6px var(--rc);
}
.gear-slot:not(.empty):hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), 0 0 18px -4px var(--rc); }
.gear-slot.empty { background: transparent; border-style: dashed; color: var(--text-mute); }
.gear-slot.empty:hover { border-color: var(--border-lit); }
.gs-ic { color: var(--rc, var(--text-mute)); }
.gear-slot.empty .gs-ic { color: var(--text-mute); opacity: .7; }
.gs-name {
  max-width: 100%;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.gear-slot.empty .gs-name { color: var(--text-sub); }
.gs-hint { margin-top: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); }

/* ---------- 角色属性 ---------- */
.power-box {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(201, 162, 39, .12), rgba(142, 31, 43, .12));
  border: 1px solid var(--border-lit);
  border-radius: var(--r-sm);
}
.power-box span { font-size: 11px; letter-spacing: 2px; color: var(--text-sub); }
.power-box b {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(201, 162, 39, .35);
}

.stat-list { padding: 0 14px 14px; }
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed rgba(51, 44, 43, .75);
}
.stat-row:last-child { border-bottom: 0; }
.stat-row span { color: var(--text-sub); }
.stat-row b { font-family: var(--font-mono); color: var(--text); }

.career-box {
  margin: 0 14px 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.career-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold-dim);
}
.career-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; margin-top: 9px; }
.career-grid div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 11.5px; }
.career-grid span { color: var(--text-mute); }
.career-grid b { font-family: var(--font-mono); color: var(--text-sub); }

/* ---------- 页签 2：背包 ---------- */
.bag-tools { display: flex; flex-direction: column; gap: 9px; padding: 13px 14px 0; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tool-row > .ic { color: var(--text-mute); margin-right: 2px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg-btn {
  padding: 4px 9px;
  font-size: 11px;
  color: var(--text-sub);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: all .12s var(--ease);
}
.seg-btn:hover { border-color: var(--border-lit); color: var(--text); }
.seg-btn.on {
  color: var(--gold-hi);
  background: rgba(201, 162, 39, .10);
  border-color: var(--gold);
}

.bag-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 14px; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.item-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 10px 9px 12px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--rc);
  border-radius: var(--r-sm);
  box-shadow: 0 0 12px -7px var(--rc);
  transition: transform .12s var(--ease), border-color .12s var(--ease), box-shadow .12s var(--ease);
}
.item-tile:hover {
  transform: translateY(-1px);
  border-color: var(--border-lit);
  border-left-color: var(--rc);
  box-shadow: 0 0 18px -5px var(--rc);
}
.tile-slot { color: var(--rc); opacity: .92; }
.tile-name { font-size: 12.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); }
.tile-score { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--text-sub); }
.tile-score .ic { color: var(--text-mute); }
.tile-enh {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold-hi);
  background: rgba(201, 162, 39, .14);
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-sm);
}

/* ---------- 页签 3：天赋 ---------- */
.talent-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, .16);
  border-bottom: 1px solid var(--border);
}
.talent-bar > span { font-size: 11.5px; color: var(--text-sub); }
.tp-b { font-family: var(--font-mono); font-size: 13px; color: var(--gold-hi); }

.talent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 14px; }

.talent-col {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 2px solid var(--bc);
  border-radius: var(--r-sm);
}
.tc-head {
  padding-bottom: 10px;
  margin-bottom: 12px;
  text-align: center;
  border-bottom: 1px dashed var(--border);
}
.tc-head b { display: block; font-family: var(--font-display); font-size: 15px; letter-spacing: 1px; color: var(--bc); }
.tc-head span { display: block; margin-top: 3px; font-size: 11px; color: var(--text-mute); }
.tc-head em {
  display: block;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-sub);
}
.tc-nodes { display: flex; flex-direction: column; }

.talent-node {
  padding: 9px 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent);
  border: 1px solid var(--border);
  border-left: 3px solid var(--bc);
  border-radius: var(--r-sm);
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease), opacity .12s var(--ease);
}
.talent-node.locked { opacity: .42; border-left-color: var(--border); filter: grayscale(.6); }
.talent-node.maxed { border-color: var(--bc); box-shadow: 0 0 14px -6px var(--bc); }

.tn-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tn-top b { font-size: 12.5px; }
.tn-lv { font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); }
.tn-desc { margin: 4px 0 8px; font-size: 11px; line-height: 1.65; color: var(--text-sub); }

.tn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 5px;
  font-size: 11px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-lit);
  border-radius: var(--r-sm);
  transition: all .12s var(--ease);
}
.tn-btn:hover { border-color: var(--gold); color: var(--gold-hi); }
.tn-btn:disabled { color: var(--text-mute); border-color: var(--border); cursor: not-allowed; }
.tn-btn:disabled:hover { color: var(--text-mute); border-color: var(--border); }
.tn-btn.done { color: var(--success); background: rgba(95, 143, 95, .10); border-color: var(--success); }
.tn-btn.locked { color: var(--text-mute); border-style: dashed; border-color: var(--border); }

.tn-link {
  width: 2px;
  height: 16px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bc), var(--border));
  opacity: .5;
}

/* ---------- 页签 4：铁匠 ---------- */
.forge-grid { display: grid; grid-template-columns: 330px 1fr; gap: 16px; align-items: start; }
.forge-list { display: flex; flex-direction: column; gap: 6px; padding: 12px; }

.forge-pick {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: all .12s var(--ease);
}
.forge-pick[data-uid]:not(.on) { border-left: 3px solid var(--rc); }
.forge-pick[data-uid]:hover { border-color: var(--border-lit); }
.forge-pick.on {
  border-color: var(--gold);
  background: rgba(201, 162, 39, .07);
  box-shadow: inset 3px 0 0 var(--gold);
}
.forge-pick.empty { opacity: .45; border-style: dashed; cursor: default; }
.fp-name { font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fp-score { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }

.forge-detail { padding: 14px; }
.fd-head { padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.fd-head b { font-family: var(--font-display); font-size: 15px; letter-spacing: .5px; }
.fd-head span { display: block; margin-top: 3px; font-size: 11px; color: var(--text-mute); }

.fd-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.fd-stat span { display: block; font-size: 11px; color: var(--text-sub); }
.fd-stat b { font-family: var(--font-display); font-size: 22px; color: var(--text); }
.fd-stat i {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--success);
}
.fd-enh { font-size: 11px; color: var(--text-mute); }
.fd-enh b { font-family: var(--font-mono); color: var(--gold-hi); }

.fd-max {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  font-size: 12px;
  color: var(--gold);
  background: rgba(201, 162, 39, .06);
  border: 1px dashed var(--gold-dim);
  border-radius: var(--r-sm);
}
.fd-note { margin-top: 10px; font-size: 11px; line-height: 1.75; color: var(--text-mute); }

/* ============================================================
 * 7. 战斗
 * ============================================================ */
.stage {
  position: relative;
  width: 100%;
  height: 100vh;    /* 旧浏览器回退 */
  height: 100dvh;   /* iOS Safari：100vh 含地址栏区域，会把底部技能按钮顶到屏幕外 */
  overflow: hidden;
  background: radial-gradient(900px 600px at 50% 40%, #14121a, #08070a 72%);
}
/* touch-action:none 是 iOS 可玩性的硬性要求。缺了它，Safari 会把画布上的拖动判定为页面
   滚动手势并抛出 pointercancel，虚拟摇杆直接失效 —— pointer events 下 touch-action 的
   优先级高于 ev.preventDefault()，所以必须在 CSS 里关掉。 */
#cv {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;   /* 防止长按摇杆弹出"拷贝/查询"菜单 */
}

.battle-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: calc(16px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
  pointer-events: none;
  font-family: var(--font-body);
}

.hud-left { display: flex; flex-direction: column; gap: 7px; width: 232px; }
.hud-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sub); }
.hud-line .ic { color: var(--text-mute); }
.hud-line b { font-family: var(--font-mono); color: var(--text); }
.hud-line.gold b { color: var(--gold-hi); }

.hud-right {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.skill-dock {
  position: absolute;
  right: calc(22px + env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  pointer-events: auto;
}

.skill-btn {
  position: relative;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: radial-gradient(circle at 50% 40%, var(--surface-2), #0b0a0e 76%);
  border: 1px solid var(--border-lit);
  border-radius: 50%;
  box-shadow: 0 6px 18px -8px #000, inset 0 0 16px rgba(0, 0, 0, .6);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease), transform .1s var(--ease);
}
.skill-btn:active { transform: scale(.96); }
.skill-btn.ready {
  border-color: var(--gold);
  box-shadow: 0 0 20px -4px var(--gold), inset 0 0 14px rgba(201, 162, 39, .16);
  animation: skillReady 2.4s ease-in-out infinite;
}
.skill-ring { position: absolute; inset: 0; }
.skill-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .10); stroke-width: 2.5; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
.skill-ico { position: relative; color: var(--gold); display: grid; place-items: center; }
.skill-btn.ready .skill-ico { color: var(--gold-hi); }
.skill-name {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  white-space: nowrap;
  color: var(--text-sub);
}
.skill-cd {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text);
  text-shadow: 0 1px 4px #000;
  background: rgba(0, 0, 0, .48);
  border-radius: 50%;
}
.skill-cd:empty { display: none; }

.hud-tip {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  color: var(--text-mute);
  opacity: .8;
}

/* ============================================================
 * 8. 结算
 * ============================================================ */
.result-wrap { max-width: 760px; margin: 0 auto; padding: 30px 20px 64px; }

.result-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 40%);
  border: 1px solid var(--border-lit);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  animation: cardIn .3s var(--ease) both;
}

.rs-head {
  padding: 26px 20px 20px;
  text-align: center;
  background: linear-gradient(180deg, rgba(201, 162, 39, .08), transparent);
  border-bottom: 1px solid var(--border);
}
.rs-title { font-family: var(--font-display); font-size: 24px; letter-spacing: 1px; }
.rs-verdict { margin-top: 8px; font-size: 12px; letter-spacing: 1px; color: var(--gold-dim); }

.rs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
}
.rs-cell { padding: 13px 10px; text-align: center; background: var(--surface); }
.rs-cell span { display: block; font-size: 11px; color: var(--text-mute); }
.rs-cell b { display: block; margin-top: 4px; font-family: var(--font-display); font-size: 20px; color: var(--text); }

.rs-levelup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px;
  padding: 10px;
  font-size: 12px;
  color: var(--gold-hi);
  background: rgba(201, 162, 39, .08);
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-sm);
}
.rs-levelup em { margin-left: 6px; font-size: 11px; color: var(--gold-dim); }
.rs-levelup.dim { color: var(--text-mute); background: transparent; border-color: var(--border); }
.rs-levelup.dim .ic { color: var(--text-mute); }

.rs-loot { margin: 14px; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.rs-loot-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.rs-loot-head .ic { color: var(--gold); }
.rs-loot-head b { flex: 1; }

.tile-grid.compact { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
.loot-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 11.5px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--border);
  border-left: 3px solid var(--rc);
  border-radius: var(--r-sm);
}
.lc-ic { color: var(--rc); }
.lc-meta { font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); }

.rs-actions { display: flex; justify-content: center; gap: 10px; padding: 6px 14px 18px; }

.rs-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 11.5px;
  color: var(--text-sub);
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, .18);
}
.rs-rank .ic { color: var(--gold-dim); }
.rs-rank b { font-family: var(--font-mono); color: var(--gold-hi); }

/* ============================================================
 * 9. 弹窗
 * ============================================================ */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .14s ease, visibility .14s;
}
.modal-layer.on { opacity: 1; visibility: visible; pointer-events: auto; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.modal-box {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow: auto;
  background: var(--surface);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .028), transparent 34%);
  border: 1px solid var(--border-lit);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
  transform: scale(.96);
  transition: transform .14s var(--ease);
}
.modal-layer.on .modal-box { transform: scale(1); }
.modal-box.wide { max-width: 640px; }

.modal-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  color: var(--text-mute);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: all .12s var(--ease);
}
.modal-x:hover { color: var(--text); border-color: var(--border-lit); }

/* ---------- 装备详情 / 对比 ---------- */
.im-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 14px 13px;
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 3px 0 0 var(--rc, var(--gold));
}
.im-ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--rc, var(--gold));
  background: rgba(0, 0, 0, .32);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.im-head > div { flex: 1; min-width: 0; }
.im-head b { display: block; font-family: var(--font-display); font-size: 15px; letter-spacing: .5px; }
.im-head span { display: block; margin-top: 3px; font-size: 11px; color: var(--text-mute); }

.im-body { padding: 14px; }
.im-stats { display: flex; flex-direction: column; gap: 4px; }
.im-stat { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12px; }
.im-stat span { color: var(--text-sub); }
.im-stat b { font-family: var(--font-mono); color: var(--text); }
.im-stat.main {
  padding-bottom: 9px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.im-stat.main span { color: var(--text); }
.im-stat.main b { font-family: var(--font-display); font-size: 16px; color: var(--gold-hi); }

.im-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0;
  font-size: 11px;
  color: var(--text-mute);
}
.im-score .ic { color: var(--gold-dim); }
.im-score b { font-family: var(--font-mono); font-size: 15px; color: var(--gold-hi); }

.im-cmp { margin-top: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-sm); }
.im-cmp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  font-size: 11px;
  color: var(--text-sub);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.im-cmp-head .ic { color: var(--gold-dim); }
.cmp-score { margin-left: auto; font-family: var(--font-mono); font-size: 12px; }
.cmp-score.up { color: var(--success); }
.cmp-score.down { color: var(--blood-hi); }
.cmp-score.same { color: var(--text-mute); }

.cmp-grid { padding: 7px 11px 11px; }
.cmp-row {
  display: grid;
  grid-template-columns: 1fr 60px 76px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 11.5px;
  border-bottom: 1px dashed rgba(51, 44, 43, .6);
}
.cmp-row:last-child { border-bottom: 0; }
.cmp-row span { color: var(--text-sub); }
.cmp-row b { font-family: var(--font-mono); text-align: right; color: var(--text-mute); }
.cmp-row em {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}
em.up { color: var(--success); }
em.down { color: var(--blood-hi); }
em.same { color: var(--text-mute); }

.im-actions { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.im-actions .btn:last-child { margin-left: auto; }

/* ---------- 确认弹窗 ---------- */
.cf-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.cf-head .ic { color: var(--gold); }
.cf-head b { flex: 1; font-family: var(--font-display); font-size: 14px; letter-spacing: .5px; }
.cf-body { padding: 16px 14px; font-size: 13px; line-height: 1.85; color: var(--text-sub); }
.cf-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }

/* ---------- 深渊榜 ---------- */
.ladder { max-height: 58vh; overflow: auto; padding: 11px 14px 14px; }

.skeleton-row {
  height: 34px;
  margin-bottom: 6px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2), rgba(51, 44, 43, .7), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.ladder-row {
  display: grid;
  grid-template-columns: 26px 20px 1fr 62px 62px 78px;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  font-size: 12px;
  border-bottom: 1px solid rgba(51, 44, 43, .6);
}
.ladder-row:last-child { border-bottom: 0; }
.lr-rank { font-family: var(--font-display); font-size: 15px; text-align: center; color: var(--gold-dim); }
.lr-sigil { display: grid; place-items: center; color: var(--text-mute); }
.lr-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lr-name em { margin-left: 6px; font-size: 10px; color: var(--text-mute); }
.lr-wave, .lr-kill { text-align: right; font-size: 11px; color: var(--text-sub); }
.lr-score { text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--gold-hi); }
.ladder-row.me { background: rgba(201, 162, 39, .08); box-shadow: inset 3px 0 0 var(--gold); }

/* ---------- 载入 ---------- */
.boot-loader { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 36px 40px; text-align: center; }
.bl-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: var(--gold);
  background: radial-gradient(circle, rgba(201, 162, 39, .16), transparent 70%);
  border: 1px solid var(--border-lit);
  border-radius: 50%;
  animation: sigilPulse 1.8s ease-in-out infinite;
}
.boot-loader b { font-family: var(--font-display); font-size: 15px; letter-spacing: 1px; }
.bl-bar { width: 200px; height: 3px; overflow: hidden; background: rgba(0, 0, 0, .6); border-radius: 2px; }
.bl-bar i { display: block; width: 38%; height: 100%; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: blSweep 1.15s ease-in-out infinite; }
.boot-loader span { max-width: 270px; font-size: 11px; line-height: 1.75; color: var(--text-mute); }

/* ============================================================
 * 10. Toast
 * ============================================================ */
.toast-layer {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 90vw;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--text);
  background: rgba(23, 21, 28, .96);
  border: 1px solid var(--border-lit);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-md);
  animation: toastIn .22s var(--ease) both;
}
.toast .ic { color: var(--gold); }
.toast.bad { border-left-color: var(--blood-hi); }
.toast.bad .ic { color: var(--blood-hi); }
.toast.out { animation: toastOut .45s var(--ease) both; }

/* ============================================================
 * 11. 动效
 * ============================================================ */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(6px); }
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@keyframes sigilPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, .22); }
  50% { box-shadow: 0 0 22px 4px rgba(201, 162, 39, .16); }
}
@keyframes blSweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
@keyframes skillReady {
  0%, 100% { box-shadow: 0 0 18px -6px var(--gold), inset 0 0 14px rgba(201, 162, 39, .14); }
  50% { box-shadow: 0 0 26px -2px var(--gold), inset 0 0 16px rgba(201, 162, 39, .22); }
}

/* ============================================================
 * 12. 响应式
 * ============================================================ */
@media (max-width: 920px) {
  .class-grid { grid-template-columns: 1fr; max-width: 460px; }
  .gear-grid, .forge-grid { grid-template-columns: 1fr; }
  .talent-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .xp-block { order: 3; max-width: none; flex: 1 0 100%; }
  .wallet { order: 2; }
}

@media (max-width: 620px) {
  .title-block { padding: 32px 18px 22px; }
  .title-block h1 { font-size: 24px; }
  .hub-wrap { padding: 14px 14px 112px; }
  .rs-grid { grid-template-columns: repeat(2, 1fr); }
  .rs-title { font-size: 20px; }
  .ladder-row { grid-template-columns: 22px 18px 1fr 58px 72px; }
  .lr-kill { display: none; }
  .cmp-row { grid-template-columns: 1fr 52px 68px; }
  /* 手机窄屏仍保留文字标签：图标单独出现时玩家猜不出"背包/天赋/铁匠" */
  .tab { padding: 11px 7px; font-size: 12px; gap: 4px; }
  .tab .ic { width: 16px; height: 16px; }
  .hud-left { width: 150px; }
  .hud-tip { display: none; }
}

/* ---------- 触屏设备：放大触摸目标，去掉会"粘住"的 hover 位移 ---------- */
@media (pointer: coarse) {
  .seg-btn { padding: 7px 12px; font-size: 12px; }
  .tn-btn { padding: 9px; }
  .btn-sm { padding: 8px 12px; font-size: 12px; }
  .hud-right .btn-sm { padding: 11px 16px; font-size: 13px; }
  .modal-x { width: 32px; height: 32px; }
  .skill-btn { width: 80px; height: 80px; }
}

@media (hover: none) {
  .class-card:hover,
  .item-tile:hover,
  .gear-slot:not(.empty):hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
