/* ───────── 侠义掌门 · 设计令牌 ─────────
   漆黑底 / 宣纸卷轴 / 朱砂印章 / 鎏金细线
   显示字体：马善政毛笔楷书；正文：思源宋体 */
:root {
  --lacquer: #17110F; --ink: #221A18; --ink-2: #2E2523; --ink-3: #3B302C;
  --paper: #E9DFC7; --paper-2: #DCCFAF; --paper-3: #CBBB95; --paper-ink: #2A211D; --paper-muted: #6E604E;
  --cinnabar: #B8321F; --cinnabar-2: #8F2415; --gold: #C9A04A; --gold-2: #9E7A2E; --jade: #5E8C6A; --jade-2: #3F6B4C;
  --text: #EADFCB; --muted: #A08F78; --line: rgba(201, 160, 74, .22); --line-2: rgba(201, 160, 74, .4);
  --r1: #4C79A8; --r2: #7B4FA3; --r3: #D1782A; --r4: #B8321F;
  --font-display: 'Ma Shan Zheng', 'STKaiti', 'KaiTi', 'Kaiti SC', 'BiauKai', serif;
  --font-body: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', 'Source Han Serif SC', serif;
  --shell-w: 430px; --nav-h: 64px; --top-h: 54px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body); font-size: 14px; line-height: 1.5; color: var(--text);
  background: #0E0A09;
  background-image:
    radial-gradient(ellipse 60% 50% at 20% 10%, rgba(184, 50, 31, .10), transparent 60%),
    radial-gradient(ellipse 50% 60% at 85% 90%, rgba(201, 160, 74, .07), transparent 60%);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font-family: inherit; font-size: inherit; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ───────── 外壳 ───────── */
.shell {
  position: relative; width: min(100vw, var(--shell-w)); height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--lacquer);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
  box-shadow: 0 0 0 1px rgba(201,160,74,.12), 0 0 80px rgba(0,0,0,.6);
  overflow: hidden;
}
.topbar {
  height: var(--top-h); flex: none; display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #1F1715, var(--lacquer));
}
.sect { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sect-glyph {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 18px; color: var(--paper);
  background: var(--cinnabar); border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.sect-name { font-family: var(--font-display); font-size: 20px; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res { display: flex; gap: 8px; }
.res-item { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text); }
.res-icon {
  width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-family: var(--font-display); font-size: 12px; color: var(--lacquer);
}
.res-icon.silver { background: linear-gradient(135deg, #E8E4DA, #9FA3A8); }
.res-icon.gold { background: linear-gradient(135deg, #F1D98A, var(--gold-2)); }
.res-icon.stam { background: linear-gradient(135deg, #9ED0A8, var(--jade-2)); }

.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 14px 24px; -webkit-overflow-scrolling: touch; }
.view::-webkit-scrollbar { width: 0; }

.nav {
  height: var(--nav-h); flex: none; display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line); background: linear-gradient(0deg, #100B0A, var(--lacquer));
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  position: relative; transition: color .2s;
}
.nav-glyph { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.nav-label { font-size: 11px; letter-spacing: 1px; }
.nav-item.active { color: var(--paper); }
.nav-item.active::after { content: ''; position: absolute; bottom: 8px; width: 6px; height: 6px; background: var(--cinnabar); transform: rotate(45deg); }
.nav-item .badge { position: absolute; top: 8px; right: calc(50% - 22px); width: 8px; height: 8px; border-radius: 50%; background: var(--cinnabar); box-shadow: 0 0 0 2px var(--lacquer); }

/* ───────── 通用 ───────── */
.h-display { font-family: var(--font-display); font-weight: 400; letter-spacing: 1px; }
.section { margin-bottom: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-family: var(--font-display); font-size: 20px; color: var(--paper); display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ''; width: 3px; height: 16px; background: var(--cinnabar); }
.section-sub { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.panel { background: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.panel + .panel { margin-top: 10px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13px; }
.empty b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--paper-2); font-weight: 400; margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 4px;
  border: 1px solid var(--line-2); background: var(--ink-2); color: var(--text); font-size: 14px; letter-spacing: 1px;
  transition: transform .08s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #CC3E29, var(--cinnabar-2)); border-color: rgba(0,0,0,.35); color: var(--paper); box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.btn-gold { background: linear-gradient(180deg, #D9B15C, var(--gold-2)); border-color: rgba(0,0,0,.35); color: var(--lacquer); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn .cost { font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); }
.tag.role { color: var(--paper-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 3px; background: var(--ink-2); border: 1px solid var(--line); font-size: 12px; }
.chip .dot { width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); }
.r1 { --rc: var(--r1); } .r2 { --rc: var(--r2); } .r3 { --rc: var(--r3); } .r4 { --rc: var(--r4); }
.rc { color: var(--rc); }

/* 印章 */
.seal {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 3px;
  font-family: var(--font-display); font-size: 14px; line-height: 1; color: var(--paper);
  background: var(--rc, var(--cinnabar)); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28), 0 1px 2px rgba(0,0,0,.4);
  transform: rotate(-4deg);
}

/* ───────── 弟子牌 ───────── */
.card {
  position: relative; aspect-ratio: 3 / 4.1; border-radius: 6px; overflow: hidden; cursor: pointer;
  background: var(--ink-2); border: 1px solid var(--line); transition: transform .12s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.card:active { transform: scale(.97); }
.card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,160,74,.35); }
.card.dim { opacity: .5; filter: grayscale(.6); }
.card-portrait {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--hue, #7A6A4F) 55%, transparent) 0%, transparent 62%),
    radial-gradient(circle at 30% 80%, rgba(0,0,0,.35), transparent 50%),
    linear-gradient(180deg, var(--ink-2), var(--ink));
}
.card-portrait .surname {
  font-family: var(--font-display); font-size: 58px; line-height: 1; color: var(--paper);
  text-shadow: 0 2px 8px rgba(0,0,0,.6); transform: translateY(-8px);
}
.card-plate {
  position: absolute; top: 6px; right: 6px; width: 22px; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--paper); color: var(--paper-ink); border-radius: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.card-plate .plate-name { writing-mode: vertical-rl; font-family: var(--font-display); font-size: 15px; letter-spacing: 2px; line-height: 1; }
.card-plate .seal { width: 18px; height: 18px; font-size: 12px; }
.card-foot {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 7px; display: flex; justify-content: space-between; align-items: flex-end;
  background: linear-gradient(0deg, rgba(0,0,0,.7), transparent); font-size: 11px;
}
.card-lv { color: var(--paper-2); font-variant-numeric: tabular-nums; }
.card-stars { color: var(--gold); letter-spacing: -1px; font-size: 10px; }
.card-title { position: absolute; left: 7px; top: 7px; max-height: 58%; font-size: 10px; color: var(--muted); writing-mode: vertical-rl; letter-spacing: 2px; opacity: .9; white-space: nowrap; overflow: hidden; }
.card .card-slot { position: absolute; left: 6px; bottom: 26px; font-size: 10px; color: var(--jade); }
.card-mini { aspect-ratio: 1; }
.card-mini .surname { font-size: 34px; transform: none; }
.card-mini .card-plate { display: none; }
.card-mini .card-foot { padding: 3px 5px; }

/* ───────── 卷轴弹层（宣纸） ───────── */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8, 5, 4, .7); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .18s; }
.sheet {
  width: min(100vw, var(--shell-w)); max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--paper-ink); border-radius: 10px 10px 0 0; position: relative;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(120, 90, 50, .06), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(120, 90, 50, .07), transparent 40%),
    repeating-linear-gradient(0deg, rgba(90, 70, 40, .025) 0 1px, transparent 1px 4px);
  box-shadow: 0 -8px 40px rgba(0,0,0,.6); animation: rise .22s cubic-bezier(.2, .8, .3, 1);
}
.sheet::before { content: ''; height: 8px; flex: none; background: linear-gradient(90deg, var(--cinnabar-2), var(--cinnabar), var(--cinnabar-2)); border-radius: 10px 10px 0 0; }
.sheet-close { position: absolute; top: 14px; right: 12px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(42,33,29,.25); background: transparent; color: var(--paper-ink); font-size: 18px; line-height: 1; z-index: 2; }
.sheet-body { overflow-y: auto; padding: 16px 18px calc(24px + env(safe-area-inset-bottom)); }
.sheet .muted { color: var(--paper-muted); }
.sheet .panel { background: rgba(255,255,255,.35); border-color: rgba(42,33,29,.15); }
.sheet .btn { background: rgba(255,255,255,.4); color: var(--paper-ink); border-color: rgba(42,33,29,.3); }
.sheet .btn-primary { background: linear-gradient(180deg, #CC3E29, var(--cinnabar-2)); color: var(--paper); border-color: rgba(0,0,0,.35); }
.sheet .btn-gold { background: linear-gradient(180deg, #D9B15C, var(--gold-2)); color: var(--lacquer); }
.sheet .tag { border-color: rgba(42,33,29,.3); color: var(--paper-muted); }
.sheet .tag.role { color: var(--paper-ink); }
.sheet .chip { background: rgba(255,255,255,.35); border-color: rgba(42,33,29,.2); }
.sheet .divider { background: rgba(42,33,29,.15); }
.sheet .section-title { color: var(--paper-ink); }
.sheet-title { font-family: var(--font-display); font-size: 26px; line-height: 1.1; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sheet-title .seal { width: 26px; height: 26px; font-size: 16px; }
.sheet-sub { font-size: 12px; color: var(--paper-muted); margin-bottom: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
.stat { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed rgba(42,33,29,.2); }
.stat b { font-variant-numeric: tabular-nums; font-weight: 600; }
.skill-box { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border: 1px solid rgba(42,33,29,.2); border-radius: 4px; background: rgba(255,255,255,.3); }
.skill-name { font-family: var(--font-display); font-size: 22px; line-height: 1.1; white-space: nowrap; writing-mode: vertical-rl; border-right: 1px solid rgba(42,33,29,.25); padding-right: 8px; }
.skill-desc { font-size: 13px; }
.skill-desc .move { color: var(--cinnabar); font-weight: 600; }
.bio { font-size: 13px; line-height: 1.7; color: #3F3430; text-indent: 2em; }
.bond { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed rgba(42,33,29,.2); font-size: 13px; }
.bond .members { font-size: 12px; color: var(--paper-muted); }
.bond .members .own { color: var(--paper-ink); }
.bond.active { color: var(--cinnabar-2); }
.bond.active .members .own { color: var(--cinnabar-2); }
.bond .bonus { font-variant-numeric: tabular-nums; white-space: nowrap; }
.star-row { display: flex; gap: 2px; font-size: 14px; color: var(--gold-2); }
.progress { height: 6px; background: rgba(42,33,29,.15); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--gold-2); }

/* ───────── 首页 ───────── */
.hero {
  position: relative; padding: 18px 16px 16px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 16px;
  background:
    radial-gradient(ellipse 70% 80% at 100% 0%, rgba(184,50,31,.22), transparent 60%),
    linear-gradient(180deg, #2A1F1C, var(--ink));
}
.hero-eyebrow { font-size: 11px; letter-spacing: 3px; color: var(--gold); margin-bottom: 4px; }
.hero-title { font-family: var(--font-display); font-size: 34px; line-height: 1.1; color: var(--paper); }
.hero-quote { font-size: 12px; color: var(--muted); margin-top: 8px; }
.hero-mark { position: absolute; right: -6px; bottom: -18px; font-family: var(--font-display); font-size: 110px; color: rgba(201,160,74,.07); line-height: 1; pointer-events: none; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-item { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; color: var(--text); text-align: left; }
.quick-item .glyph { width: 40px; height: 40px; border-radius: 4px; display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; background: var(--ink-3); color: var(--paper); flex: none; }
.quick-item b { display: block; font-weight: 600; font-size: 14px; }
.quick-item span { font-size: 11px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }

/* ───────── 弟子 / 阵容 ───────── */
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: none; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; }
.filter.active { background: var(--paper); color: var(--paper-ink); border-color: var(--paper); }
.formation { display: grid; grid-template-columns: 34px repeat(3, 1fr); gap: 10px; align-items: stretch; }
.formation .row-label { writing-mode: vertical-rl; display: grid; place-items: center; font-family: var(--font-display); font-size: 16px; color: var(--muted); letter-spacing: 4px; border-right: 1px solid var(--line); }
.slot { aspect-ratio: 3 / 4.1; border: 1px dashed var(--line-2); border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-size: 12px; cursor: pointer; background: rgba(255,255,255,.015); }
.slot .plus { font-size: 28px; font-family: var(--font-display); line-height: 1; }
.bonds-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.bonds-strip .chip.on { border-color: var(--cinnabar); color: var(--paper); background: rgba(184,50,31,.15); }
.power-line { display: flex; align-items: baseline; gap: 8px; }
.power-line b { font-family: var(--font-display); font-size: 28px; color: var(--gold); font-weight: 400; font-variant-numeric: tabular-nums; }

/* ───────── 闯关 ───────── */
.chapter { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 10px; cursor: pointer; }
.chapter.locked { opacity: .5; cursor: default; }
.chapter .ch-glyph { width: 48px; height: 60px; flex: none; display: grid; place-items: center; background: var(--paper); color: var(--paper-ink); border-radius: 2px; font-family: var(--font-display); font-size: 16px; writing-mode: vertical-rl; letter-spacing: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.chapter .ch-sub { font-size: 11px; letter-spacing: 2px; color: var(--gold); }
.chapter .ch-name { font-family: var(--font-display); font-size: 22px; color: var(--paper); line-height: 1.1; }
.chapter .ch-intro { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chapter .ch-prog { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.chapter .ch-prog b { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 400; color: var(--paper-2); }
.stage-list { display: flex; flex-direction: column; gap: 8px; }
.stage { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.stage.locked { opacity: .45; cursor: default; }
.stage.cleared { border-color: rgba(94,140,106,.5); }
.stage.current { border-color: var(--cinnabar); box-shadow: inset 0 0 0 1px rgba(184,50,31,.4); }
.stage .st-idx { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); font-family: var(--font-display); font-size: 15px; color: var(--paper-2); flex: none; }
.stage.cleared .st-idx { background: var(--jade-2); border-color: transparent; color: var(--paper); }
.stage.boss .st-idx { border-color: var(--cinnabar); color: var(--cinnabar); }
.stage .st-name { font-size: 15px; font-weight: 600; color: var(--paper); }
.stage .st-meta { font-size: 11px; color: var(--muted); }
.stage .st-right { margin-left: auto; text-align: right; font-size: 11px; color: var(--muted); white-space: nowrap; }
.enemy-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.story { font-size: 13px; line-height: 1.7; color: #3F3430; padding: 10px 12px; border-left: 3px solid var(--cinnabar); background: rgba(255,255,255,.3); }

/* ───────── 招募 ───────── */
.banner { position: relative; padding: 18px 16px; border-radius: 6px; border: 1px solid var(--line); overflow: hidden; margin-bottom: 12px; background: linear-gradient(135deg, #2C2220, var(--ink)); }
.banner.premium { border-color: rgba(201,160,74,.5); background: radial-gradient(ellipse 70% 100% at 100% 0%, rgba(201,160,74,.18), transparent 60%), linear-gradient(135deg, #2E2318, var(--ink)); }
.banner-title { font-family: var(--font-display); font-size: 28px; color: var(--paper); line-height: 1; }
.banner-desc { font-size: 12px; color: var(--muted); margin: 6px 0 12px; max-width: 75%; }
.banner-mark { position: absolute; right: 10px; top: 6px; font-family: var(--font-display); font-size: 84px; line-height: 1; color: rgba(233,223,199,.06); pointer-events: none; }
.banner-actions { display: flex; gap: 8px; }
.banner-actions .btn { flex: 1; flex-direction: column; gap: 0; padding: 8px; line-height: 1.3; }
.banner-rates { font-size: 11px; color: var(--muted); margin-top: 8px; display: flex; gap: 10px; }
.pity { font-size: 11px; color: var(--gold); margin-top: 6px; }

.reveal-backdrop { position: fixed; inset: 0; background: rgba(8,5,4,.92); z-index: 60; display: flex; align-items: center; justify-content: center; animation: fade .2s; }
.reveal { width: min(100vw, var(--shell-w)); padding: 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; max-height: 100dvh; overflow-y: auto; }
.reveal-title { font-family: var(--font-display); font-size: 30px; color: var(--paper); }
.reveal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; perspective: 800px; }
.reveal-grid.one { grid-template-columns: 140px; }
.reveal-card { position: relative; aspect-ratio: 3 / 4.1; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2,.7,.3,1); transform: rotateY(180deg); }
.reveal-card.flipped { transform: rotateY(0); }
.reveal-card .face, .reveal-card .back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 5px; }
.reveal-card .back { transform: rotateY(180deg); background: var(--ink-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-family: var(--font-display); font-size: 22px; color: var(--gold); background-image: repeating-linear-gradient(45deg, rgba(201,160,74,.06) 0 4px, transparent 4px 10px); }
.reveal-card .face { overflow: hidden; border: 1px solid var(--rc); background: var(--ink-2); box-shadow: 0 0 18px color-mix(in srgb, var(--rc) 45%, transparent); }
.reveal-card .face .card-portrait .surname { font-size: 34px; transform: none; }
.reveal-card .face .card-foot { padding: 3px 5px; font-size: 10px; flex-direction: column; align-items: flex-start; gap: 1px; }
.reveal-card .new { position: absolute; top: 4px; left: 4px; font-size: 10px; background: var(--cinnabar); color: var(--paper); padding: 0 4px; border-radius: 2px; }
.reveal-card.r4 .face { animation: glow 1.2s ease-in-out infinite alternate; }
.reveal-summary { font-size: 12px; color: var(--muted); text-align: center; }

/* ───────── 战斗 ───────── */
.battle { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: center; background: #0E0A09; animation: fade .2s; }
.bf { width: min(100vw, var(--shell-w)); height: 100dvh; display: flex; flex-direction: column; background: var(--lacquer); position: relative; overflow: hidden; }
.bf-top { height: 44px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.bf-top .round { font-family: var(--font-display); font-size: 18px; color: var(--paper); }
.bf-speed { display: flex; gap: 4px; }
.bf-speed .btn { padding: 4px 8px; font-size: 11px; }
.bf-speed .btn.active { background: var(--paper); color: var(--paper-ink); border-color: var(--paper); }
.bf-side { flex: 1; display: flex; align-items: center; padding: 8px 10px; }
.bf-side.enemy { background: linear-gradient(180deg, rgba(184,50,31,.08), transparent); }
.bf-side.ally { background: linear-gradient(0deg, rgba(94,140,106,.08), transparent); }
.bf-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bf-mid { flex: none; height: 76px; display: flex; flex-direction: column; justify-content: center; padding: 0 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(0,0,0,.25); overflow: hidden; }
.bf-log { font-size: 12px; color: var(--muted); line-height: 1.6; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bf-log div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-log .me { color: var(--paper-2); }
.bf-log .hi { color: var(--gold); }
.unit { position: relative; min-height: 84px; padding: 6px 6px 6px; border-radius: 5px; background: var(--ink); border: 1px solid var(--line); transition: transform .18s, opacity .3s, filter .3s; }
.unit.empty { visibility: hidden; }
.unit.acting { transform: translateY(-6px) scale(1.04); border-color: var(--gold); box-shadow: 0 0 14px rgba(201,160,74,.35); z-index: 2; }
.unit.enemy.acting { transform: translateY(6px) scale(1.04); }
.unit.hit { animation: shake .3s; }
.unit.dead { opacity: .28; filter: grayscale(1); }
.unit.dead .unit-face::after { content: '殁'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 22px; color: var(--cinnabar); }
.unit-head { display: flex; align-items: center; gap: 6px; }
.unit-face { position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 17px; color: var(--paper); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--hue, #7A6A4F) 70%, transparent), var(--ink-3)); border: 1px solid var(--rc, var(--line)); }
.unit-name { font-size: 12px; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-lv { font-size: 10px; color: var(--muted); }
.bar { height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; margin-top: 5px; position: relative; }
.bar i { display: block; height: 100%; transition: width .25s; border-radius: 3px; }
.bar.hp i { background: linear-gradient(90deg, #7FB08A, var(--jade)); }
.bar.hp i.low { background: linear-gradient(90deg, #D9583F, var(--cinnabar)); }
.bar.hp .sh { position: absolute; left: 0; top: 0; height: 100%; background: rgba(201,160,74,.55); }
.bar.rage { height: 3px; margin-top: 3px; }
.bar.rage i { background: var(--gold); }
.unit-tags { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; min-height: 12px; }
.unit-tags span { font-size: 9px; padding: 0 3px; border-radius: 2px; background: var(--ink-3); color: var(--paper-2); line-height: 12px; }
.unit-tags span.bad { background: rgba(184,50,31,.35); }
.unit-tags span.good { background: rgba(94,140,106,.4); }
.float { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font-family: var(--font-display); font-size: 18px; color: var(--paper); text-shadow: 0 1px 3px #000; pointer-events: none; animation: floatUp .9s forwards; z-index: 3; white-space: nowrap; }
.float.crit { color: #F2C04A; font-size: 24px; }
.float.heal { color: #9ED0A8; }
.float.miss, .float.info { color: var(--muted); font-size: 13px; }
.float.dot { color: #C98FE0; font-size: 14px; }

.splash { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.splash-inner { position: relative; display: flex; flex-direction: column; align-items: center; animation: splash .9s cubic-bezier(.2,.8,.3,1) forwards; }
.splash-inner::before { content: ''; position: absolute; inset: -30px -80px; background: radial-gradient(ellipse, rgba(14,10,9,.92), rgba(14,10,9,.7) 50%, transparent 75%); z-index: -1; }
.splash-name { font-family: var(--font-display); font-size: 46px; line-height: 1; color: var(--paper); letter-spacing: 4px; text-shadow: 0 0 24px rgba(233,223,199,.35); white-space: nowrap; }
.splash-move { font-family: var(--font-display); font-size: 22px; color: var(--gold); margin-top: 6px; letter-spacing: 6px; }
.splash-seal { position: absolute; right: -44px; bottom: -8px; width: 34px; padding: 5px 0; background: var(--cinnabar); color: var(--paper); font-family: var(--font-display); font-size: 16px; writing-mode: vertical-rl; letter-spacing: 3px; text-align: center; border-radius: 2px; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.3); transform: rotate(6deg); }
.splash.enemy .splash-name { color: #E6B4AB; }

.result { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; background: rgba(8,5,4,.78); animation: fade .3s; }
.result-box { width: 84%; padding: 26px 20px; text-align: center; background: var(--paper); color: var(--paper-ink); border-radius: 6px; box-shadow: 0 10px 50px rgba(0,0,0,.7); animation: rise .35s cubic-bezier(.2,.8,.3,1); }
.result-word { font-family: var(--font-display); font-size: 64px; line-height: 1; color: var(--cinnabar); }
.result-word.lose { color: var(--paper-muted); }
.result-sub { font-size: 12px; color: var(--paper-muted); margin: 6px 0 14px; }
.result-rewards { display: flex; justify-content: center; gap: 14px; margin-bottom: 18px; font-size: 14px; }
.result-rewards .res-item { color: var(--paper-ink); }

/* ───────── 开局 ───────── */
.intro { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; background: #0E0A09; }
.intro-inner { width: min(100vw, var(--shell-w)); height: 100dvh; overflow-y: auto; padding: 40px 22px 30px; background: var(--lacquer); display: flex; flex-direction: column; gap: 18px; }
.intro-title { font-family: var(--font-display); font-size: 56px; line-height: 1; color: var(--paper); letter-spacing: 6px; }
.intro-title small { display: block; font-size: 13px; letter-spacing: 6px; color: var(--gold); margin-bottom: 10px; font-family: var(--font-body); }
.intro p { color: var(--muted); font-size: 13px; margin: 0; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: 1px; }
.input { width: 100%; padding: 10px 12px; border-radius: 4px; border: 1px solid var(--line-2); background: var(--ink); color: var(--paper); font-family: var(--font-display); font-size: 22px; letter-spacing: 2px; }
.input:focus { outline: none; border-color: var(--gold); }
.starter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ───────── 提示 ───────── */
.toast-root { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { padding: 8px 14px; background: var(--paper); color: var(--paper-ink); border-radius: 4px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.5); animation: toastIn .2s, fade .3s 1.9s reverse forwards; border-left: 3px solid var(--cinnabar); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1); } }
@keyframes splash { 0% { opacity: 0; transform: scale(1.6); letter-spacing: 20px; } 25% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
@keyframes glow { from { box-shadow: 0 0 12px rgba(184,50,31,.4); } to { box-shadow: 0 0 30px rgba(184,50,31,.9); } }

/* ───────── 分段切换 ───────── */
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; margin-bottom: 12px; }
.seg button { flex: 1; padding: 7px; background: transparent; border: 0; color: var(--muted); font-family: var(--font-display); font-size: 17px; letter-spacing: 3px; transition: background .15s, color .15s; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--paper); color: var(--paper-ink); }

/* ───────── 装备 ───────── */
.item { display: flex; gap: 10px; align-items: center; padding: 10px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.item:active { transform: scale(.995); }
.item .slot-glyph { width: 42px; height: 42px; flex: none; border-radius: 4px; display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; color: var(--paper); background: var(--ink-3); border: 1px solid var(--rc); box-shadow: inset 0 0 10px color-mix(in srgb, var(--rc) 35%, transparent); }
.item .it-body { min-width: 0; flex: 1; }
.item .it-name { font-weight: 600; color: var(--rc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .it-stats { font-size: 12px; color: var(--paper-2); margin-top: 2px; }
.item .it-meta { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .it-right { flex: none; text-align: right; font-size: 11px; color: var(--muted); line-height: 1.5; }
.item .it-right b { font-family: var(--font-display); font-size: 18px; color: var(--gold); font-weight: 400; }
.sheet .item { background: rgba(255,255,255,.35); border-color: rgba(42,33,29,.15); }
.sheet .item .it-stats { color: var(--paper-ink); }
.sheet .item .it-meta, .sheet .item .it-right { color: var(--paper-muted); }
.sheet .item .slot-glyph { background: var(--ink-2); }
.equip-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.equip-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; min-height: 84px; border: 1px dashed rgba(42,33,29,.35); border-radius: 4px; background: rgba(255,255,255,.3); color: var(--paper-ink); font-size: 12px; text-align: center; line-height: 1.3; }
.equip-slot .g { font-family: var(--font-display); font-size: 22px; line-height: 1; }
.equip-slot.filled { border-style: solid; border-color: var(--rc); background: color-mix(in srgb, var(--rc) 10%, rgba(255,255,255,.3)); }
.equip-slot .n { color: var(--rc); font-weight: 600; }
.equip-slot .small { font-size: 10px; }

/* ───────── 竞技场 ───────── */
.rank-big { font-family: var(--font-display); font-size: 40px; line-height: 1; color: var(--paper); margin-top: 2px; }
.opp { padding: 12px; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; }
.opp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.opp-name { font-family: var(--font-display); font-size: 22px; color: var(--paper); line-height: 1.1; }
.opp-rank { font-family: var(--font-display); font-size: 20px; color: var(--gold); white-space: nowrap; }
.opp-team { display: flex; gap: 6px; margin: 10px 0; }
.opp-team .face { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-size: 19px; color: var(--paper); border: 1px solid var(--rc); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--hue, #7A6A4F) 70%, transparent), var(--ink-3)); }
.shop-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.shop-item:last-child { border-bottom: 0; }
.shop-item b { display: block; font-weight: 600; }

/* ───────── 立绘 ───────── */
.card-portrait .card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.card-portrait.has-img::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(23,17,15,.12), transparent 28%, transparent 68%, rgba(23,17,15,.6)); }
.card-mini .card-portrait .card-img { object-position: 50% 10%; }
.reveal-card .face .card-portrait .card-img { object-position: 50% 12%; }
.unit-face, .opp-team .face { overflow: hidden; }
.unit-face img, .opp-team .face img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; transform: scale(2.2); transform-origin: 50% 13%; }
.unit-face.has-img, .opp-team .face.has-img { background: var(--paper-2); }
