/* ═══ Tarkov Profile Viewer v3 — 全新设计系统 ═══
 * 配色：军旅深底 + 橙金主强调 + 语义色分层（参考 tracker.gg/csstats 档案站）
 */
:root {
  --bg: #0b0f14;
  --surface: #131a22;
  --surface-2: #1a232e;
  --surface-3: #212c39;
  --border: #26303c;
  --border-soft: #1b242e;
  --fg: #e6edf3;
  --fg-dim: #8b98a5;
  --fg-faint: #566270;

  --gold: #f0a63c;        /* 主强调：竞技/荣誉 */
  --gold-soft: rgba(240, 166, 60, 0.12);
  --green: #3ddc97;       /* 正面/成功 */
  --green-soft: rgba(61, 220, 151, 0.1);
  --red: #e5484d;         /* 负面 */
  --red-soft: rgba(229, 72, 77, 0.1);
  --blue: #4c9aff;        /* 信息 */
  --blue-soft: rgba(76, 154, 255, 0.1);
  --violet: #8b5cf6;      /* 稀有/荣誉 */
  --olive: #7a8450;       /* 军用点缀 */

  --radius: 12px;
  --radius-sm: 8px;
  --font-display: 'Orbitron', 'Segoe UI', sans-serif;
  --font-data: 'JetBrains Mono', 'Consolas', monospace;
  --font-body: 'Segoe UI', system-ui, sans-serif;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --glow-gold: 0 0 0 1px rgba(240, 166, 60, 0.4), 0 0 24px rgba(240, 166, 60, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 70% 45% at 50% -12%, rgba(240, 166, 60, 0.05), transparent),
    radial-gradient(ellipse 55% 40% at 95% 105%, rgba(76, 154, 255, 0.04), transparent);
}
a { color: var(--gold); }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

.wrap { max-width: 1120px; margin: 0 auto; padding: 14px 22px 90px; }

/* ── 顶栏 ── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; margin-bottom: 18px;
  background: rgba(19, 26, 34, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  position: sticky; top: 10px; z-index: 50;
  box-shadow: var(--shadow);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #b8791f);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #14100a; font-weight: 900;
  box-shadow: 0 0 14px rgba(240, 166, 60, 0.35);
}
.logo .name { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 2px; color: var(--fg); }
.logo .name small { color: var(--fg-faint); letter-spacing: 1.5px; font-weight: 400; }
.spacer { flex: 1; }

/* 模式切换（胶囊 + 下划线） */
.mode-switch {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.mode-switch[hidden] { display: none !important; }
.mode-btn {
  border: 0; background: transparent; color: var(--fg-dim);
  font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
  padding: 7px 16px; border-radius: 7px; transition: all 0.18s;
  position: relative;
}
.mode-btn:hover { color: var(--fg); background: var(--surface-3); }
.mode-btn.active { background: var(--gold-soft); color: var(--gold); }
.mode-btn.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px;
  background: var(--gold); border-radius: 1px;
}
.mode-btn:not(.arena).active { background: var(--green-soft); color: var(--green); }
.mode-btn:not(.arena).active::after { background: var(--green); }

/* ── 搜索页 ── */
.search-hero { padding: 44px 0 28px; text-align: center; }
.search-hero h1 {
  font-family: var(--font-display); font-size: 26px; letter-spacing: 4px;
  background: linear-gradient(180deg, #fff, var(--fg-dim));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.search-hero p { color: var(--fg-dim); font-size: 13.5px; margin-top: 6px; letter-spacing: 0.5px; }
.search-console { position: relative; max-width: 680px; margin: 26px auto 0; }
.search-box {
  display: flex; margin: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within { border-color: var(--gold); box-shadow: var(--glow-gold); }
.search-box input {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--fg);
  font-size: 17px; padding: 16px 22px; font-family: var(--font-data);
}
.search-box input::placeholder { color: var(--fg-faint); }
.search-box button {
  border: 0; background: linear-gradient(135deg, var(--gold), #d98f2b); color: #171007;
  font-weight: 800; padding: 0 30px; font-size: 15px; letter-spacing: 1.5px; transition: filter 0.15s;
}
.search-box button:hover { filter: brightness(1.1); }
.search-box button:disabled { opacity: 0.55; cursor: wait; }
.search-status-row {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px;
  pointer-events: none;
}
.cache-hint {
  display: none; width: fit-content; max-width: 48%; min-width: 0; padding: 5px 9px;
  border: 1px solid rgba(61,220,151,0.35); border-radius: 7px;
  background: rgba(61,220,151,0.08); color: var(--green); font-size: 11px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-hint { display: none; margin-left: auto; min-width: 0; }

.list-head { font-size: 12px; color: var(--fg-faint); margin: 20px 4px 10px; letter-spacing: 1.5px; text-transform: uppercase; }
.candidates { display: grid; gap: 9px; }
.candidate-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 20px; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  width: 100%; color: inherit; font: inherit; text-align: left; min-height: 68px;
}
.candidate-card:hover { border-color: var(--gold); transform: translateY(-1px); background: var(--surface-2); }
/* 点击候选后的明确加载反馈；不使用无信息量转圈。 */
.candidate-card.card-loading { opacity: 0.72; pointer-events: none; padding-right: 132px; }
.candidate-card.card-loading::after {
  content: '正在获取档案…'; position: absolute; right: 16px;
  color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .5px;
}
.candidate-card { position: relative; }
.candidate-card .avatar {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--gold);
}
.candidate-card .candidate-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.candidate-card .nick { font-family: var(--font-display); font-size: 15px; letter-spacing: 1px; }
.candidate-card .aid { font-family: var(--font-data); color: var(--fg-faint); font-size: 12px; }
.tag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 5px; border: 1px solid var(--border);
  color: var(--fg-dim); background: var(--surface-2);
}
.tag.gold { border-color: rgba(240,166,60,0.45); color: var(--gold); background: var(--gold-soft); }
.tag.green { border-color: rgba(61,220,151,0.45); color: var(--green); background: var(--green-soft); }
.tag.red { border-color: rgba(229,72,77,0.45); color: var(--red); background: var(--red-soft); }
.tag.blue { border-color: rgba(76,154,255,0.45); color: var(--blue); background: var(--blue-soft); }
.side-badge {
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 2px;
  padding: 4px 10px; border-radius: 6px; border: 1px solid;
}
.side-badge.usec { color: var(--gold); border-color: rgba(240,166,60,0.5); background: var(--gold-soft); }
.side-badge.bear { color: var(--blue); border-color: rgba(76,154,255,0.5); background: var(--blue-soft); }
.empty-state { text-align: center; color: var(--fg-faint); padding: 50px 0; font-size: 14px; line-height: 2; }

/* ── 详情页 ── */
.back-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--fg-dim);
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
  transition: all 0.15s;
}
.back-btn:hover { color: var(--fg); border-color: var(--gold); }

/* Hero 区：重点信息大卡 */
.hero {
  background:
    radial-gradient(ellipse 60% 120% at 85% -30%, rgba(240, 166, 60, 0.12), transparent),
    linear-gradient(160deg, #16202c 0%, var(--surface) 55%, #10161e 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px 20px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(240,166,60,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(240,166,60,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 90% at 80% 0%, black, transparent);
}
.hero .name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero h2 { font-family: var(--font-display); font-size: 27px; letter-spacing: 2.5px; color: #fff; }
.hero .sub { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; color: var(--fg-dim); font-size: 13px; position: relative; z-index: 1; }
.hero .sub b { color: var(--fg); font-family: var(--font-data); font-weight: 600; }

/* Hero 大指标 */
.hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-top: 20px; position: relative; z-index: 1;
}
.hero-stat {
  background: rgba(11, 15, 20, 0.55);
  border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 12px 16px;
  backdrop-filter: blur(4px);
  transition: border-color 0.15s, transform 0.15s;
}
.hero-stat:hover { border-color: var(--gold); transform: translateY(-2px); }
.hero-stat .hs-label {
  font-size: 10.5px; color: var(--fg-faint); text-transform: uppercase;
  letter-spacing: 1.5px; display: flex; justify-content: space-between;
}
.hero-stat .hs-value { min-width: 0; white-space: nowrap; font-family: var(--font-data); font-size: 27px; font-weight: 700; margin-top: 4px; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.hero-stat .hs-note { font-size: 11px; color: var(--fg-faint); margin-top: 2px; font-family: var(--font-data); }
.hero-stat.gold .hs-value { color: var(--gold); }
.hero-stat.green .hs-value { color: var(--green); }
.hero-stat.red .hs-value { color: var(--red); }
.hero-stat.blue .hs-value { color: var(--blue); }

.mode-tabs { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); position: relative; z-index: 1; }

/* ── 区块 ── */
.section { margin-top: 26px; }
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-size: 13.5px; letter-spacing: 2px;
  color: var(--fg); text-transform: uppercase; margin-bottom: 12px;
}
.section-title::before { content: ''; width: 4px; height: 16px; background: var(--gold); border-radius: 2px; box-shadow: 0 0 8px rgba(240,166,60,0.5); }
.section-title.blue::before { background: var(--blue); box-shadow: 0 0 8px rgba(76,154,255,0.5); }
.section-title.green::before { background: var(--green); box-shadow: 0 0 8px rgba(61,220,151,0.5); }
.section-title.violet::before { background: var(--violet); box-shadow: 0 0 8px rgba(139,92,246,0.5); }
.section-title .hint { font-size: 11px; font-weight: 400; letter-spacing: 0.5px; color: var(--fg-faint); text-transform: none; margin-left: 4px; }
.section-title .toggle-btn {
  margin-left: auto; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg-dim); font-size: 11px; padding: 4px 12px; border-radius: 6px; letter-spacing: 1px;
  transition: all 0.15s;
}
.section-title .toggle-btn:hover { color: var(--gold); border-color: var(--gold); }

/* KPI 卡 */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 13px 16px; transition: transform 0.15s, border-color 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border); }
.kpi-card .kpi-label { font-size: 11px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 1px; display: flex; justify-content: space-between; }
.kpi-card .kpi-value { font-family: var(--font-data); font-size: 22px; font-weight: 700; margin-top: 5px; color: var(--fg); }
.kpi-card .kpi-value.gold { color: var(--gold); }
.kpi-card .kpi-value.green { color: var(--green); }
.kpi-card .kpi-value.red { color: var(--red); }
.kpi-card .kpi-value.blue { color: var(--blue); }
.kpi-card .kpi-value.dim { color: var(--fg-faint); font-weight: 500; }
.kpi-card .kpi-note { font-size: 11px; color: var(--fg-faint); margin-top: 3px; font-family: var(--font-data); }

/* 进度条 */
.bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), #2bb77f); border-radius: 4px; transition: width 0.5s ease; }
.bar.elite > i { background: linear-gradient(90deg, var(--gold), #f7c766); box-shadow: 0 0 8px rgba(240,166,60,0.4); }

/* 技能/熟练度 */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.skill-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 13px 16px; }
.skill-card .row { display: flex; justify-content: space-between; align-items: baseline; }
.skill-card .name { font-size: 13.5px; font-weight: 600; }
.skill-card .lv { font-family: var(--font-data); font-size: 12.5px; color: var(--fg-dim); }
.skill-card .lv.elite { color: var(--gold); font-weight: 700; }
.skill-meta { font-size: 10px; color: var(--fg-faint); font-family: var(--font-data); margin-top: 3px; }

/* 装备 */
.gear-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; }
.gear-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 0; text-align: center; position: relative; transition: transform 0.15s, border-color 0.15s;
  color: inherit; font: inherit; cursor: pointer; min-height: 150px; overflow: hidden;
}
.gear-card[open] { grid-column: 1 / -1; text-align: left; cursor: default; }
.gear-card > summary {
  display: block; min-height: 150px; padding: 12px 14px; position: relative; text-align: center;
  list-style: none; cursor: pointer; outline: none;
}
.gear-card > summary::marker, .gear-card > summary::-webkit-details-marker { display: none; content: ''; }
.gear-card > summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.gear-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.gear-card[open]:hover { transform: none; }
.gear-card .gear-icon-box { height: 60px; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle, var(--surface-3), var(--surface-2)); border-radius: 8px; margin-bottom: 8px; }
.gear-card img { max-width: 52px; max-height: 52px; object-fit: contain; }
.gear-card .gear-slot {
  position: absolute; top: 8px; left: 8px; font-size: 9px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--fg-faint); background: rgba(0,0,0,0.55); padding: 2px 7px; border-radius: 4px;
}
.gear-card .gear-name { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.gear-card .gear-id { font-size: 10px; color: var(--fg-faint); font-family: var(--font-data); margin-top: 2px; }
.gear-card .dura { font-family: var(--font-data); font-size: 11px; color: var(--fg-dim); margin-top: 5px; }
.gear-card .dura.warn { color: var(--red); }
.gear-detail-inline {
  border-top: 1px solid var(--border-soft); padding: 12px 14px 14px; background: var(--surface-2);
  text-align: left; cursor: default;
}
.gear-detail-inline .raw-block { margin-top: 14px; }
/* file:// fallback: native details becomes the same floating inspection surface without JS. */
.gear-card[open]::before {
  content: ''; position: fixed; inset: 0; z-index: 199;
  background: rgba(4, 6, 10, 0.6); backdrop-filter: blur(3px); pointer-events: auto;
}
.gear-card[open] > summary {
  position: fixed; z-index: 201; top: clamp(20px, 5vh, 70px); left: 50%; transform: translateX(-50%);
  width: min(860px, calc(100vw - 32px)); height: 68px; min-height: 0;
  display: flex; align-items: center; gap: 12px; padding: 10px 18px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--gold); border-bottom: 0;
  border-radius: 14px 14px 0 0;
}
.gear-card[open] > summary .gear-icon-box { display: none; }
.gear-card[open] > summary .gear-slot { position: static; color: var(--gold); background: var(--gold-soft); }
.gear-card[open] > summary .gear-name { font-size: 14px; }
.gear-card[open] > summary .gear-id { margin-left: auto; }
.gear-card[open] > summary .dura { margin-top: 0; }
.gear-card[open] .gear-detail-inline {
  position: fixed; z-index: 200; top: calc(clamp(20px, 5vh, 70px) + 68px); bottom: clamp(20px, 5vh, 70px);
  left: 50%; transform: translateX(-50%); width: min(860px, calc(100vw - 32px));
  max-height: none; overflow-y: auto; padding: 16px 18px 22px;
  border: 1px solid var(--gold); border-top: 0; border-radius: 0 0 14px 14px;
  background: var(--surface); box-shadow: 0 18px 50px rgba(0,0,0,.6); pointer-events: auto;
}

/* 成就 */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }
.ach-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 12px 8px; text-align: center; transition: border-color 0.15s, transform 0.15s;
}
.ach-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.ach-card img { width: 42px; height: 42px; object-fit: contain; margin-bottom: 6px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.ach-card .ach-icon { font-size: 28px; line-height: 1.3; }
.ach-card .ach-time { font-size: 10px; color: var(--fg-faint); font-family: var(--font-data); margin-top: 4px; }

/* 计数器分组 */
.counter-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.counter-group {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 14px 18px;
}
.counter-group .group-name {
  font-family: var(--font-display); font-size: 11.5px; letter-spacing: 2px;
  color: var(--gold); margin-bottom: 6px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.counter-group .group-name::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }
.counter-group table { width: 100%; border-collapse: collapse; }
.counter-group td { padding: 6.5px 4px; font-size: 13.5px; border-bottom: 1px solid rgba(38,48,60,0.35); }
.counter-group tr:last-child td { border-bottom: 0; }
.counter-group tr:hover td { background: rgba(240,166,60,0.03); }
.counter-group td:first-child { color: var(--fg-dim); }
.counter-group td:last-child { text-align: right; font-family: var(--font-data); font-weight: 700; font-size: 14px; color: var(--fg); }
.counter-group td.zero { color: var(--fg-faint); font-weight: 400; }

/* Arena 模式 tabs */
.arena-mode-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 16px 0 14px; }
.arena-mode-tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--fg-dim);
  padding: 8px 16px; border-radius: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: 1px;
  transition: all 0.15s;
}
.arena-mode-tab:hover { color: var(--fg); border-color: var(--border-soft); background: var(--surface-2); }
.arena-mode-tab.active { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 12px rgba(240,166,60,0.1); }
.mode-panel { display: none; animation: fadeIn 0.25s ease; }
.mode-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 原始数据折叠区 */
.raw-block {
  margin-top: 26px; border: 1px dashed var(--border); border-radius: 12px; overflow: hidden;
}
.raw-block summary {
  cursor: pointer; padding: 12px 18px; font-family: var(--font-display); font-size: 12px;
  letter-spacing: 2px; color: var(--fg-faint); text-transform: uppercase;
  list-style: none; display: flex; align-items: center; gap: 8px; user-select: none;
  background: var(--surface-2);
}
.raw-block summary:hover { color: var(--fg-dim); }
.raw-block summary::before { content: '▸'; transition: transform 0.2s; }
.raw-block[open] summary::before { transform: rotate(90deg); }
.raw-block pre {
  padding: 14px 18px; font-family: var(--font-data); font-size: 11.5px; line-height: 1.6;
  color: var(--fg-dim); overflow-x: auto; max-height: 420px; white-space: pre-wrap;
  background: var(--bg);
}

/* 信息行（外观等键值） */
.info-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.info-chip {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 8px 13px; font-size: 12px; color: var(--fg-dim);
}
.info-chip b { color: var(--fg); font-family: var(--font-data); font-weight: 600; margin-left: 6px; }

/* 同一份后端进度事件的紧凑 HUD：搜索放在输入框两侧，详情放进 Hero 信息行。 */
.profile-loading { display: flex; align-items: center; justify-content: center; min-height: 44px; margin: 4px 0 18px; }
#refreshBadge { flex: 0 1 auto; max-width: 100%; margin-left: auto; }
.operation-hud {
  --hud-progress: 0.08;
  display: inline-grid; grid-template-columns: 6px minmax(0,1fr) auto; align-items: center; gap: 7px 9px;
  min-height: 34px; max-width: min(100%, 560px); padding: 7px 10px;
  border: 1px solid rgba(240,166,60,0.38); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--fg-dim); font-size: 11px; line-height: 1.2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035); overflow: hidden;
}
.operation-hud .hud-pip { width: 6px; height: 6px; flex: 0 0 6px; background: var(--gold); box-shadow: 0 0 8px rgba(240,166,60,0.55); }
.operation-hud .hud-body { min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr); gap: 2px 8px; }
.operation-hud .hud-title { color: var(--gold); font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: .6px; }
.operation-hud .hud-stage { color: var(--fg); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.operation-hud .hud-context { grid-column: 1 / -1; color: var(--fg-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.operation-hud .hud-reason { grid-column: 1 / -1; color: var(--gold); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.operation-hud .hud-side { display: grid; justify-items: end; gap: 3px; min-width: 94px; }
.operation-hud .hud-rail { width: 94px; height: 3px; overflow: hidden; background: var(--surface-3); }
.operation-hud .hud-rail i { display: block; width: 100%; height: 100%; background: var(--gold); transform: scaleX(var(--hud-progress)); transform-origin: left; transition: transform .18s ease-out; }
.operation-hud .hud-phase, .operation-hud .hud-elapsed { color: var(--fg-faint); font-family: var(--font-data); font-size: 10px; white-space: nowrap; }
.operation-hud.terminal .hud-rail { display: none; }
.operation-hud.terminal .hud-side { min-width: 0; }
.operation-hud.ok, .operation-hud.completed { border-color: rgba(61,220,151,0.4); }
.operation-hud.ok .hud-pip, .operation-hud.completed .hud-pip, .operation-hud.ok .hud-rail i, .operation-hud.completed .hud-rail i { background: var(--green); box-shadow: 0 0 8px rgba(61,220,151,0.5); }
.operation-hud.ok .hud-title, .operation-hud.completed .hud-title { color: var(--green); }
.operation-hud.err, .operation-hud.error, .operation-hud.failed, .operation-hud.stopped, .operation-hud.canceled { border-color: rgba(229,72,77,0.46); }
.operation-hud.err .hud-pip, .operation-hud.error .hud-pip, .operation-hud.failed .hud-pip, .operation-hud.stopped .hud-pip, .operation-hud.canceled .hud-pip, .operation-hud.err .hud-rail i, .operation-hud.error .hud-rail i, .operation-hud.failed .hud-rail i, .operation-hud.stopped .hud-rail i, .operation-hud.canceled .hud-rail i { background: var(--red); box-shadow: 0 0 8px rgba(229,72,77,0.5); }
.operation-hud.err .hud-title, .operation-hud.error .hud-title, .operation-hud.failed .hud-title, .operation-hud.stopped .hud-title, .operation-hud.canceled .hud-title { color: var(--red); }

.error-box { text-align: center; padding: 44px; color: var(--red); border: 1px solid rgba(229,72,77,0.4); border-radius: var(--radius); background: var(--red-soft); }
.error-box button { margin-top: 14px; }

/* 响应式 */
@media (max-width: 720px) {
  .wrap { padding: 10px 12px 60px; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; }
  .logo .name { font-size: 12px; }
  .mode-btn { padding: 6px 10px; font-size: 12px; }
  .search-hero { padding: 26px 0 38px; }
  .search-hero h1 { font-size: 18px; }
  .search-box input { font-size: 15px; padding: 13px 16px; }
  .operation-hud { grid-template-columns: 6px minmax(0,1fr) auto; gap: 6px 7px; }
  .operation-hud .hud-phase { display: none; }
  .operation-hud .hud-side { min-width: 74px; }
  .operation-hud .hud-rail { width: 74px; }
  .hero { padding: 18px 16px 16px; }
  .hero h2 { font-size: 20px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hero-stat .hs-value { font-size: 21px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .skill-grid { grid-template-columns: 1fr; }
  .counter-groups { grid-template-columns: 1fr; }
  .gear-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .ach-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ═══ v4：高密度模式 ═══ */
.kpi-grid.dense { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 7px; }
.kpi-grid.dense .kpi-card { padding: 9px 11px; border-radius: 8px; }
.kpi-grid.dense .kpi-value { font-size: 17px; margin-top: 3px; }
.kpi-grid.dense .kpi-note { font-size: 10px; }

/* Arena 模式平铺 */
.arena-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.arena-mode-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: 14px 16px;
}
.arena-mode-card:hover { border-color: var(--border); }
.amc-head { display: flex; align-items: center; margin-bottom: 10px; }
.amc-name {
  font-family: var(--font-display); font-size: 13px; letter-spacing: 2px; color: var(--gold);
}
.amc-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.amc-core {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 7px; padding: 6px 8px; text-align: center;
}
.amc-label { display: block; font-size: 9.5px; color: var(--fg-faint); text-transform: uppercase; letter-spacing: 1px; }
.amc-val { display: block; font-family: var(--font-data); font-size: 14.5px; font-weight: 700; margin-top: 2px; }
.amc-detail { margin-top: 10px; }
.amc-detail summary {
  cursor: pointer; font-size: 11px; color: var(--fg-dim); letter-spacing: 1px;
  user-select: none; padding: 6px 0; text-transform: uppercase;
}
.amc-detail summary:hover { color: var(--gold); }
@media (max-width: 720px) { .arena-grid { grid-template-columns: 1fr; } }

/* ═══ v5：图标徽章 + 右侧抽屉 + 更紧凑 + 数字防溢出 ═══ */
/* 统计图标徽章 */
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px; font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--border-soft);
  margin-right: 6px; flex-shrink: 0; line-height: 1;
}
.kpi-label .icon-badge, .amc-label .icon-badge, .amc-core .icon-badge { display: inline-flex; }
.amc-core { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 5px 4px; }
.amc-label { display: flex; align-items: center; justify-content: center; gap: 2px; font-size: 9px; }
.amc-val { font-size: 13.5px; margin-top: 1px; }
.amc-val.long { font-size: 11.5px; }
.kpi-value.long { font-size: 15px; }
.hero-stat .hs-value.long { font-size: 19px; letter-spacing: 0; }

/* 右侧抽屉 */
.drawer-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 6, 10, 0.6); backdrop-filter: blur(3px);
  display: none; align-items: stretch; justify-content: flex-end;
  animation: maskIn 0.2s ease;
}
.drawer-mask.open { display: flex; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  width: min(460px, 94vw); background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  animation: drawerIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes drawerIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display); font-size: 14px; letter-spacing: 2px; color: var(--gold);
}
.drawer-close {
  margin-left: auto; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--fg-dim); width: 28px; height: 28px; border-radius: 7px; font-size: 13px;
  line-height: 1; transition: all 0.15s;
}
.drawer-close:hover { color: var(--fg); border-color: var(--gold); }
.drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.drawer-body .counter-group { margin-bottom: 12px; }
.drawer-body .counter-group:last-child { margin-bottom: 0; }

/* 更紧凑的 arena 核心数字 */
.arena-mode-card { padding: 12px 13px; }
.amc-cores { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 5px; }
.hero-stats { gap: 8px; }
.hero-stat { padding: 9px 12px; }
.hero-stat .hs-value { font-size: 22px; }
.kpi-grid:not(.dense) { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px; }
.kpi-card { padding: 10px 12px; }

/* ═══ v5 图标样式 ═══ */
.ic { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; color: inherit; flex-shrink: 0; }
.icon-badge .ic { width: 12px; height: 12px; vertical-align: -2px; }
.sec-ic { display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 6px; background: var(--gold-soft); color: var(--gold); margin-right: 2px; }
.sec-ic .ic { width: 13px; height: 13px; }
.hs-label .ic { width: 12px; height: 12px; margin-right: 5px; color: var(--fg-faint); }
.amc-label .ic { width: 11px; height: 11px; margin-right: 3px; color: var(--fg-faint); }
.section-title .sec-ic + span, .section-title .sec-ic + .hint { margin-left: 4px; }
.amc-detail-btn {
  margin-top: 10px; width: 100%; border: 1px dashed var(--border); background: var(--surface-2);
  color: var(--fg-dim); font-size: 11.5px; letter-spacing: 1px; padding: 7px 10px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.15s;
}
.amc-detail-btn:hover { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.amc-detail-btn .ic { width: 12px; height: 12px; }

/* ═══ v6：行式统计布局（参考 op.gg/tracker.gg 统计行）+ 彩色徽章 ═══ */
/* 彩色图标徽章 */
.icon-badge {
  width: 24px; height: 24px; border-radius: 7px; border: 0;
}
.icon-badge.b-red { background: rgba(229, 72, 77, 0.16); color: #ff8a8e; }
.icon-badge.b-green { background: rgba(61, 220, 151, 0.14); color: #5ce6ae; }
.icon-badge.b-gold { background: rgba(240, 166, 60, 0.16); color: #f7c766; }
.icon-badge.b-blue { background: rgba(76, 154, 255, 0.15); color: #7db8ff; }
.icon-badge.b-gray { background: rgba(139, 152, 165, 0.14); color: #a8b4c0; }

/* 行式统计（stat row）：图标 | 名称 | 数值右对齐 */
.stat-rows { display: flex; flex-direction: column; }
.stat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; border-bottom: 1px solid rgba(38, 48, 60, 0.3);
  min-height: 36px;
}
.stat-row:last-child { border-bottom: 0; }
.stat-row .sr-name { flex: 1; font-size: 13px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-row .sr-val { font-family: var(--font-data); font-size: 13.5px; font-weight: 700; color: var(--fg); text-align: right; white-space: nowrap; }
.stat-row .sr-val.zero { color: var(--fg-faint); font-weight: 400; }

/* 模式卡：整卡可点（点击开抽屉） */
.arena-mode-card {
  cursor: pointer; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column;
  color: inherit; font: inherit; text-align: left; min-height: 44px;
}
.arena-mode-card:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.35); }
.amc-head { margin-bottom: 6px; }
.amc-name { font-size: 12.5px; }
.amc-more {
  margin-left: auto; font-size: 10px; color: var(--fg-faint); letter-spacing: 1px;
  display: flex; align-items: center; gap: 4px;
}
.arena-mode-card:hover .amc-more { color: var(--gold); }
.amc-more .ic { width: 11px; height: 11px; }
.arena-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.amc-detail-btn { display: none; }

/* ═══ v7：game-icons 彩色游戏图标 ═══ */
.gi { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; }
.gi.sm { width: 13px; height: 13px; }
.icon-badge {
  width: 27px; height: 27px; border-radius: 8px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.055); border: 1px solid rgba(255, 255, 255, 0.09);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-badge .gi { width: 18px; height: 18px; display: block; }
.sec-ic {
  display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center;
  border-radius: 7px; background: rgba(255, 255, 255, 0.06); margin-right: 2px;
}
.sec-ic .gi { width: 16px; height: 16px; display: block; }
.hs-label .gi { width: 13px; height: 13px; margin-right: 6px; }
.stat-row .icon-badge { width: 25px; height: 25px; }
.stat-row .icon-badge .gi { width: 17px; height: 17px; }
.amc-more .gi { width: 11px; height: 11px; }

/* ═══ v8：模式图标 + 本地成就图 ═══ */
.amc-head { gap: 6px; }
.amc-name { display: flex; align-items: center; gap: 10px; font-size: 15px; letter-spacing: 2px; }
.mode-ic { width: 36px; height: 36px; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45)); }
.ach-card img { width: 48px; height: 42px; object-fit: contain; }

/* Accessibility and equipment details */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
button:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 3px;
}
.mode-btn, .search-box button, .back-btn, .toggle-btn { min-height: 44px; }
.drawer-close { width: 44px; height: 44px; }
.equipment-tree, .equipment-tree ul { list-style: none; margin: 0; padding-left: 18px; }
.equipment-tree > li { padding-left: 0; }
.equipment-node {
  display: grid; grid-template-columns: minmax(120px, 1fr) auto; gap: 4px 12px;
  margin: 8px 0; padding: 10px 12px; border: 1px solid var(--border-soft);
  border-radius: 8px; background: var(--surface-2); font-size: 12px;
}
.equipment-node code { color: var(--fg-faint); overflow-wrap: anywhere; }
.arena-mode-card > summary { display: block; list-style: none; outline: none; }
.arena-mode-card > summary::marker, .arena-mode-card > summary::-webkit-details-marker { display: none; content: ''; }
.arena-mode-card:not([open]) > .arena-detail-inline { display: none; }
.arena-mode-card[open]::before {
  content: ''; position: fixed; inset: 0; z-index: 199;
  background: rgba(4, 6, 10, 0.6); backdrop-filter: blur(3px); pointer-events: auto;
}
.arena-mode-card[open] > summary {
  position: fixed; z-index: 201; top: clamp(20px, 5vh, 70px); left: 50%; transform: translateX(-50%);
  width: min(860px, calc(100vw - 32px)); height: 58px; padding: 13px 18px;
  background: var(--surface-2); border: 1px solid var(--gold); border-bottom: 0;
  border-radius: 14px 14px 0 0;
}
.arena-mode-card[open] > summary .amc-head { margin: 0; }
.arena-mode-card[open] > summary .stat-rows { display: none; }
.arena-mode-card[open] .arena-detail-inline {
  position: fixed; z-index: 200; top: calc(clamp(20px, 5vh, 70px) + 58px); bottom: clamp(20px, 5vh, 70px);
  left: 50%; transform: translateX(-50%); width: min(860px, calc(100vw - 32px));
  overflow-y: auto; padding: 16px 18px 22px;
  border: 1px solid var(--gold); border-top: 0; border-radius: 0 0 14px 14px;
  background: var(--surface); box-shadow: 0 18px 50px rgba(0,0,0,.6); pointer-events: auto;
}
.error-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.error-detail { font-size: 12px; color: var(--fg-dim); margin-bottom: 10px; }

@media (max-width: 520px) {
  .search-box { flex-direction: column; overflow: visible; background: transparent; border: 0; gap: 8px; }
  .search-hero { padding-bottom: 40px; }
  .cache-hint { max-width: calc(42% - 4px); }
  .queue-hint { max-width: calc(58% - 4px); }
  .operation-hud { width: fit-content; max-width: 100%; }
  .operation-hud .hud-stage { max-width: 15ch; }
  .operation-hud .hud-rail { width: 56px; height: 2px; }
  .operation-hud .hud-side { min-width: 56px; }
  .search-box input, .search-box button { border-radius: 10px; border: 1px solid var(--border); min-height: 48px; }
  .candidate-card { align-items: flex-start; flex-wrap: wrap; padding: 13px 14px; }
  .candidate-card.card-loading { padding-right: 14px; padding-bottom: 42px; }
  .candidate-card.card-loading::after { left: 66px; right: auto; bottom: 13px; }
  .candidate-card .spacer { display: none; }
  .drawer { width: 100vw; }
}

/* ═══ v9：桌面端监控侧边栏（LIVE+排队 → 内存/CPU/运行 → 槽位卡 → 底部小字段）═══ */
.monitor-rail {
  position: fixed; left: 14px; top: 14px; max-height: calc(100vh - 28px); z-index: 40;
  width: 238px; display: flex; flex-direction: column; gap: 10px;
  padding: 12px; overflow-y: auto;
  background: rgba(19, 26, 34, 0.9);
  border: 1px solid var(--border); border-radius: var(--radius);
  backdrop-filter: blur(20px); box-shadow: var(--shadow);
}
.monitor-head { display: flex; align-items: center; gap: 8px; }
.monitor-live { font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: 3px; color: var(--fg); }
.monitor-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px rgba(229,72,77,0.6); }
.monitor-dot.ok { background: var(--green); box-shadow: 0 0 8px rgba(61,220,151,0.6); }
.monitor-proc { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--fg-faint); font-family: var(--font-data); }
.monitor-proc b { color: var(--fg-dim); font-weight: 600; font-size: 12px; }
.monitor-queue {
  display: none; margin-left: auto;
  padding: 2px 8px; border-radius: 6px;
  font-family: var(--font-data); font-size: 12px; font-weight: 700; color: var(--red);
  background: var(--red-soft); border: 1px solid rgba(229,72,77,0.4);
}
.monitor-queue.warn { display: inline-block; }
.monitor-slots { display: grid; gap: 6px; }
.monitor-slot {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 4px 7px;
  padding: 7px 9px; background: var(--surface);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
}
.monitor-slot.busy { border-color: rgba(240,166,60,0.38); }
.monitor-slot-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.monitor-slot.busy .monitor-slot-dot { background: var(--gold); box-shadow: 0 0 7px rgba(240,166,60,0.55); }
.monitor-slot-name {
  font-family: var(--font-data); font-size: 12px; color: var(--fg);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.monitor-slot-port { font-family: var(--font-data); font-size: 11px; color: var(--fg-faint); }
.monitor-slot-state { grid-column: 1 / -1; font-size: 10.5px; color: var(--fg-faint); }
.monitor-slot.busy .monitor-slot-state { color: var(--gold); }
.monitor-slot:not(.busy) .monitor-slot-progress { visibility: hidden; }
.monitor-slot-progress {
  grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px; align-items: center;
}
.monitor-stage-text {
  font-size: 11px; color: var(--fg-dim);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 16px; line-height: 16px;
}
.monitor-step { font-family: var(--font-data); font-size: 10px; color: var(--fg-faint); white-space: nowrap; }
.monitor-bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.monitor-bar i {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), #f7c766);
  transition: width 0.3s ease;
}
.monitor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.monitor-field { padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 6px; }
.monitor-field span { display: block; font-size: 10px; color: var(--fg-faint); letter-spacing: 0.5px; }
.monitor-field b {
  display: block; font-family: var(--font-data); font-size: 14px; font-weight: 700;
  color: var(--fg); margin-top: 1px; font-variant-numeric: tabular-nums;
}
@media (min-width: 1100px) {
  body { padding-left: 254px; }
  .wrap { max-width: min(1120px, calc(100vw - 310px)); }
}
@media (max-width: 1099px) {
  .monitor-rail { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .monitor-bar i { transition: none; }
}
