﻿/* ==========================================================================
   卫戍协议 · 盟约与特质数据库
   样式表 —— 深色工业终端风格 / 支持明暗主题
   ========================================================================== */

/* ---------- 设计变量 ---------- */
:root {
  --font-sans: "Inter", "HarmonyOS Sans SC", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --accent: #ffd93d;
  --accent-ink: #12140a;
  --mint: #3ee0b0;
  --amber: #ffb454;
  --violet: #b18cff;
  --pink: #ff7ab6;
  --blue: #5ac8fa;
  --red: #ff6b6b;

  --radius: 4px;
  --radius-lg: 8px;

  --shadow-1: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 30px -18px rgba(0, 0, 0, .9);
  --shadow-2: 0 30px 80px -30px rgba(0, 0, 0, .95);

  --topbar-h: 64px;
  --maxw: 1560px;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- 深色主题（默认） ---------- */
:root,
[data-theme="dark"] {
  --bg: #050807;
  --bg-2: #080c0a;
  --panel: #0b100e;
  --panel-2: #0f1512;
  --panel-3: #141c18;
  --line: #1d2a24;
  --line-2: #27382f;
  --text: #e8f0e9;
  --text-dim: #9cad9f;
  --text-mute: #647569;
  --chip: #121a16;
  --chip-hover: #17211c;
  --glass: rgba(8, 12, 10, .72);
  --grid: rgba(120, 220, 180, .05);
  --grid-strong: rgba(120, 220, 180, .085);
  --hud-line: rgba(62, 224, 176, .38);
  --hud-strong: rgba(62, 224, 176, .62);
  --sweep-a: 62, 224, 176;
  --scan-line: rgba(255, 255, 255, .022);
  --shadow-color: rgba(0, 0, 0, .6);
}

/* ---------- 亮色主题 ---------- */
[data-theme="light"] {
  --bg: #efeee7;
  --bg-2: #f6f5ef;
  --panel: #fffef8;
  --panel-2: #f7f6ee;
  --panel-3: #efeee4;
  --line: #d9d8cb;
  --line-2: #c6c5b5;
  --text: #17211b;
  --text-dim: #55645a;
  --text-mute: #808c83;
  --chip: #f1f0e6;
  --chip-hover: #e8e7da;
  --glass: rgba(250, 250, 244, .78);
  --grid: rgba(26, 42, 35, .055);
  --grid-strong: rgba(26, 42, 35, .10);
  --hud-line: rgba(26, 42, 35, .32);
  --hud-strong: rgba(26, 42, 35, .55);
  --sweep-a: 200, 138, 0;
  --scan-line: rgba(26, 42, 35, .035);
  --accent: #b08d00;
  --accent-ink: #fffef8;
  --mint: #0f9e7a;
  --amber: #c47616;
  --violet: #7a4fd6;
  --pink: #d2457f;
  --blue: #1b7fb8;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 10px 24px -18px rgba(30, 40, 30, .45);
  --shadow-2: 0 30px 80px -30px rgba(30, 40, 30, .35);
  --shadow-color: rgba(40, 50, 40, .25);
}

/* 浅色主题下的对比度微调 */
[data-theme="light"] .op__rarity,
[data-theme="light"] .badge--rarity { filter: brightness(.72) saturate(1.15); }
[data-theme="light"] .rankbadge { filter: brightness(.88) saturate(1.1); }
[data-theme="light"] .hero__deco { opacity: .5; }
[data-theme="light"] .bg-noise { opacity: .18; }
[data-theme="light"] .bg-ring { opacity: .07; }
[data-theme="light"] .bg-sweep { opacity: .35; }
[data-theme="light"] .hud-corner { opacity: .3; }
[data-theme="light"] .bg-scan { opacity: .3; }

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- 背景装饰 ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg);
}

/* 底色 / 光域 */
.bg-base {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -8%, rgba(62, 224, 176, .08), transparent 62%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
[data-theme="light"] .bg-base {
  background:
    radial-gradient(ellipse 55% 45% at 10% -8%, rgba(230, 168, 12, .15), transparent 62%),
    radial-gradient(ellipse 50% 40% at 96% 4%, rgba(12, 122, 99, .10), transparent 62%),
    linear-gradient(180deg, #f8f7f0 0%, #f0eee4 55%, #e8e5d9 100%);
}

/* 工程网格 */
.bg-grid {
  position: absolute;
  inset: -12%;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px);
  background-size: 26px 26px, 26px 26px, 104px 104px, 104px 104px;
  -webkit-mask-image: radial-gradient(ellipse 95% 80% at 50% 0%, #000 18%, transparent 82%);
  mask-image: radial-gradient(ellipse 95% 80% at 50% 0%, #000 18%, transparent 82%);
  animation: gridDrift 60s linear infinite;
}
@keyframes gridDrift { to { background-position: 26px 26px, 26px 26px, 104px 104px, 104px 104px; } }

/* 网格交点十字标记（日间） */
.bg-ticks {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='104' height='104'%3E%3Cpath d='M52 46.5v11M46.5 52h11' stroke='%231a2a23' stroke-opacity='.45' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 104px 104px;
  opacity: 0;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 55% 8%, #000 10%, transparent 78%);
  mask-image: radial-gradient(ellipse 85% 75% at 55% 8%, #000 10%, transparent 78%);
}
[data-theme="light"] .bg-ticks { opacity: .6; }

/* 斜切警示纹理（日间） */
.bg-stripes {
  position: absolute;
  display: none;
  background: repeating-linear-gradient(135deg, rgba(214, 150, 8, .30) 0 2px, transparent 2px 13px);
  animation: stripeDrift 36s linear infinite;
  will-change: background-position;
}
[data-theme="light"] .bg-stripes { display: block; }
.bg-stripes--tr {
  top: var(--topbar-h);
  right: 0;
  width: 30vw;
  height: 200px;
  opacity: .38;
  -webkit-mask-image: linear-gradient(200deg, #000 0%, transparent 78%);
  mask-image: linear-gradient(200deg, #000 0%, transparent 78%);
}
.bg-stripes--bl {
  bottom: 0;
  left: 0;
  width: 22vw;
  height: 160px;
  opacity: .26;
  -webkit-mask-image: linear-gradient(0deg, #000 0%, transparent 80%);
  mask-image: linear-gradient(0deg, #000 0%, transparent 80%);
}
@keyframes stripeDrift { to { background-position: 130px 130px; } }

/* 侧边技术标注 */
.bg-annot {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .38em;
  color: var(--text-mute);
  opacity: .5;
  writing-mode: vertical-rl;
  text-transform: uppercase;
  white-space: nowrap;
}
[data-theme="light"] .bg-annot { color: rgba(26, 42, 35, .45); opacity: .8; letter-spacing: .4em; }
.bg-annot--l { left: 12px; top: 30%; transform: rotate(180deg); }
.bg-annot--r { right: 12px; bottom: 24%; }

/* 雷达扫描光 */
.bg-sweep {
  position: absolute;
  width: 170vmax;
  height: 170vmax;
  left: 50%;
  top: 50%;
  margin: -85vmax 0 0 -85vmax;
  background: conic-gradient(from 0deg, transparent 0deg 296deg,
    rgba(var(--sweep-a), .10) 322deg,
    rgba(var(--sweep-a), .22) 338deg,
    transparent 350deg);
  -webkit-mask-image: radial-gradient(circle, transparent 10%, #000 52%, transparent 78%);
  mask-image: radial-gradient(circle, transparent 10%, #000 52%, transparent 78%);
  animation: bgSpin 44s linear infinite;
  will-change: transform;
  opacity: .85;
}
@keyframes bgSpin { to { transform: rotate(360deg); } }

/* 粒子画布 */
.bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .9;
}
[data-theme="light"] .bg-canvas { opacity: 1; }

/* 右上角 HUD 环 */
.bg-ring {
  position: absolute;
  top: -16vw;
  right: -13vw;
  width: 46vw;
  height: 46vw;
  min-width: 540px;
  min-height: 540px;
  color: var(--hud-strong);
  opacity: .14;
  animation: bgSpin 200s linear infinite reverse;
  will-change: transform;
}
[data-theme="light"] .bg-ring { opacity: .22; }

/* 扫描线 */
.bg-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, var(--scan-line) 0 1px, transparent 1px 3px);
  opacity: .55;
  mix-blend-mode: overlay;
}
[data-theme="light"] .bg-scan { opacity: .5; mix-blend-mode: multiply; }

/* 四角 HUD 标记 */
.hud-corner {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 1px solid var(--hud-line);
  opacity: .55;
}
.hud-corner--tl { top: calc(var(--topbar-h) + 14px); left: 16px; border-right: 0; border-bottom: 0; }
.hud-corner--tr { top: calc(var(--topbar-h) + 14px); right: 16px; border-left: 0; border-bottom: 0; }
.hud-corner--bl { bottom: 16px; left: 16px; border-right: 0; border-top: 0; }
.hud-corner--br { bottom: 16px; right: 16px; border-left: 0; border-top: 0; }
[data-theme="light"] .hud-corner { opacity: .75; }

.bg-glow {
  position: absolute;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
}
.bg-glow--a { top: -30vw; right: -18vw; background: radial-gradient(circle, rgba(62, 224, 176, .16), transparent 62%); }
.bg-glow--b { bottom: -38vw; left: -20vw; background: radial-gradient(circle, rgba(255, 217, 61, .1), transparent 62%); }
[data-theme="light"] .bg-glow { display: none; }

.bg-noise {
  position: absolute;
  inset: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
[data-theme="light"] .bg-noise { opacity: .2; mix-blend-mode: multiply; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 40px);
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  color: var(--accent);
  flex: none;
  filter: drop-shadow(0 0 10px rgba(255, 217, 61, .25));
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: .16em; font-weight: 700; }
.brand-text em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-dim);
  transition: color .18s, border-color .18s, background .18s, transform .18s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--chip-hover); }
.icon-btn:active { transform: scale(.96); }

.i-sun { display: none; }
[data-theme="light"] .i-sun { display: block; }
[data-theme="light"] .i-moon { display: none; }

/* ---------- 赛季选择器 ---------- */
.season-static {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px 0 8px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text-dim);
}
.season-static em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--text-mute);
}

.season { position: relative; }

.season-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px 0 8px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s, background .18s;
}
.season-btn:hover { border-color: var(--line-2); background: var(--chip-hover); }
.season-btn svg { width: 10px; height: 10px; color: var(--text-mute); transition: transform .2s; }
.season-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.season-btn__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--accent-ink);
  background: var(--accent);
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 700;
}
.season-btn__name { font-size: 14.5px; font-weight: 600; white-space: nowrap; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 76px) clamp(16px, 3vw, 40px) clamp(26px, 3vw, 40px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
}

.hero__inner { max-width: 780px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .26em;
  color: var(--mint);
  margin-bottom: 18px;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px var(--mint);
  animation: pulse 2.4s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.hero h1 {
  font-size: clamp(34px, 5.4vw, 66px);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: .02em;
  margin-bottom: 18px;
}
.hero h1 i {
  font-style: normal;
  color: var(--accent);
  text-shadow: 0 0 30px rgba(255, 217, 61, .35);
}

.lede {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 620px;
  line-height: 1.75;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
}
.stat b {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.stat span { font-size: 12px; color: var(--text-mute); letter-spacing: .12em; }

.hero__deco {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: clamp(20px, 3vw, 40px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: .06em;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-2);
  user-select: none;
  opacity: .8;
}
.hero__deco span:nth-child(2) { color: transparent; -webkit-text-stroke-color: var(--line); }

/* ---------- 布局 ---------- */
/* 不建立层叠上下文：移动端抽屉（fixed z-index）需要盖过 .scrim 遮罩 */
.layout {
  position: relative;
  z-index: auto;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 40px) 80px;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* ---------- 筛选侧栏 ---------- */
.filters {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  max-height: calc(100vh - var(--topbar-h) - 40px);
  overflow-y: auto;
  padding: 20px 18px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  scrollbar-width: thin;
}

.filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.filters__head-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn--xs { width: 30px; height: 30px; border-radius: 50%; }
.icon-btn--xs svg { width: 14px; height: 14px; }
.filters__head h2 {
  font-size: 13px;
  letter-spacing: .28em;
  color: var(--text-dim);
  font-weight: 700;
}
.text-btn {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12.5px;
  color: var(--text-mute);
  transition: color .15s;
}
.text-btn:hover { color: var(--accent); }

.fgroup { padding: 14px 0; border-bottom: 1px solid var(--line); }
.fgroup:last-of-type { border-bottom: 0; }

.fgroup__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.fgroup__label { font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.fgroup__en {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--text-mute);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

#rankChips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
#rankChips .chip { padding: 6px 0; justify-content: center; }

/* 图标在浅色主题下也保持可见：统一深色底 */
.chip img,
.bond img,
.mbond__top img,
.tpill img,
.op__meta img {
  background: #0c1210;
  border-radius: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.3;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
  position: relative;
}
.chip:hover { border-color: var(--line-2); color: var(--text); background: var(--chip-hover); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.chip img { width: 16px; height: 16px; object-fit: contain; flex: none; }
.chip[aria-pressed="true"] img { filter: brightness(0); background: transparent; }

.chip--rank {
  font-family: var(--font-mono);
  font-weight: 700;
  min-width: 34px;
  justify-content: center;
  letter-spacing: .04em;
}
.chip--rank[data-rank="1"] { --rk: #9aa8a1; }
.chip--rank[data-rank="2"] { --rk: #7fd7c4; }
.chip--rank[data-rank="3"] { --rk: #5ac8fa; }
.chip--rank[data-rank="4"] { --rk: #8f9dff; }
.chip--rank[data-rank="5"] { --rk: #ffd93d; }
.chip--rank[data-rank="6"] { --rk: #ff9f43; }
.chip--rank { color: var(--rk); border-color: color-mix(in srgb, var(--rk) 35%, transparent); }
.chip--rank[aria-pressed="true"] { background: var(--rk); border-color: var(--rk); color: #0a0c0b; }

.chip--trait { --tc: var(--mint); }
.chip--trait[aria-pressed="true"] { background: var(--tc); border-color: var(--tc); color: #07100c; }
.chip--trait img { width: 14px; height: 14px; }
.chip--trait[data-t="整备能力"] { --tc: var(--blue); }
.chip--trait[data-t="作战能力"] { --tc: var(--amber); }
.chip--trait[data-t="单次叠加"] { --tc: var(--violet); }
.chip--trait[data-t="特异化"] { --tc: var(--pink); }

kbd {
  font-family: var(--font-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--text-dim);
  background: var(--chip);
}

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.search {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .18s, box-shadow .18s;
}
.search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.search svg { width: 18px; height: 18px; color: var(--text-mute); flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: 0;
  font-size: 15.5px;
}
.search input::placeholder { color: var(--text-mute); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { flex: none; }

.toolbar__right { display: flex; align-items: center; gap: 10px; }

.select { position: relative; }
.select select {
  appearance: none;
  height: 44px;
  padding: 0 34px 0 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color .18s, color .18s;
}
.select select:hover { border-color: var(--line-2); color: var(--text); }
.select svg {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  color: var(--text-mute);
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--text);
  font-size: 14px;
  transition: background .16s, border-color .16s, transform .12s;
}
.btn:hover { background: var(--chip-hover); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); border-color: var(--accent); }
.btn--ghost { background: transparent; }

.only-mobile { display: none; }

/* ---------- 结果条 ---------- */
.resultbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 30px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.resultbar__count {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .08em;
  color: var(--text-dim);
  white-space: nowrap;
}
.resultbar__count b { color: var(--accent); font-size: 15px; }

.activefilters { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.tag button {
  display: grid;
  place-items: center;
  width: 14px; height: 14px;
  border: 0; background: none; padding: 0;
  color: var(--text-mute);
  font-size: 13px; line-height: 1;
}
.tag button:hover { color: var(--red); }

/* ---------- 干员列表 ---------- */
.oplist { display: flex; flex-direction: column; gap: 10px; }

.op {
  position: relative;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 18px;
  padding: 12px 18px 12px 16px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2) 140%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
  animation: cardIn .4s var(--ease);
  animation-delay: calc(var(--i, 0) * 8ms);
}
@keyframes cardIn { from { transform: translateY(8px); } to { transform: none; } }

.op::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 2px;
  background: var(--rk, var(--line-2));
  opacity: .9;
}
.op:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -28px var(--shadow-color);
}
.op:focus-visible { outline-offset: 3px; }

.op__id { display: flex; align-items: center; gap: 12px; min-width: 0; }

.op__info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.portrait {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  flex: none;
}
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, .55));
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; }
.portrait[data-rarity="6"] { border-color: color-mix(in srgb, #ff9f43 60%, var(--line)); box-shadow: inset 0 0 24px rgba(255, 159, 67, .14); }
.portrait[data-rarity="5"] { border-color: color-mix(in srgb, #ffd93d 55%, var(--line)); box-shadow: inset 0 0 22px rgba(255, 217, 61, .1); }
.portrait[data-rarity="4"] { border-color: color-mix(in srgb, #b18cff 50%, var(--line)); box-shadow: inset 0 0 22px rgba(177, 140, 255, .1); }

.rankbadge {
  position: absolute;
  top: 0; left: 0;
  z-index: 2;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  color: #080a09;
  background: var(--rk, #9aa8a1);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 85% 100%, 0 100%);
}

.op__name { color: var(--text); font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: .02em; }
.op__rarity { display: flex; gap: 1px; color: var(--rarity, #ffd93d); font-size: 9.5px; letter-spacing: 0; line-height: 1; }
.op__meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--text-mute);
  display: flex; align-items: center; gap: 4px;
}
.op__meta img { width: 13px; height: 13px; opacity: .85; }

.op__body { min-width: 0; display: flex; flex-direction: column; justify-content: center; }

.tier {
  display: grid;
  grid-template-columns: 62px minmax(88px, auto) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 7px 0;
}
.tier + .tier { border-top: 1px dashed var(--line); }

.tier__label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-mute);
  padding-top: 2px;
  white-space: nowrap;
}
.tier__label i {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--line-2);
}
.tier--elite .tier__label { color: var(--accent); }
.tier--elite .tier__label i { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.bonds { display: flex; flex-wrap: wrap; gap: 5px; }

.bond {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 3px;
  border-radius: 3px;
  background: var(--chip);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.bond img { width: 18px; height: 18px; object-fit: contain; }
.bond--none { border-style: dashed; color: var(--text-mute); font-style: normal; padding: 2px 8px; }
.bond--core { border-color: color-mix(in srgb, var(--mint) 22%, var(--line)); }
.bond--sub { color: var(--text-mute); }

.traits { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.trait-line { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }

.tpill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--tc, var(--mint));
  background: color-mix(in srgb, var(--tc, var(--mint)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc, var(--mint)) 30%, transparent);
  white-space: nowrap;
}
.tpill img { width: 12px; height: 12px; }
.tpill[data-t="整备能力"] { --tc: var(--blue); }
.tpill[data-t="作战能力"] { --tc: var(--amber); }
.tpill[data-t="单次叠加"] { --tc: var(--violet); }
.tpill[data-t="特异化"] { --tc: var(--pink); }

.ttext {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-dim);
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ttext .hl { color: var(--accent); font-weight: 600; }
.ttext .hl.rem { color: var(--text-mute); font-weight: 400; }
.ttext .hl.acrem { color: var(--mint); }
.ttext .hl.down { color: var(--red); }
.ttext .cond {
  display: inline-block;
  padding: 0 4px;
  margin-right: 2px;
  border-radius: 2px;
  font-size: 11px;
  color: var(--mint);
  background: color-mix(in srgb, var(--mint) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--mint) 22%, transparent);
  line-height: 1.5;
}

.op__more {
  position: absolute;
  right: 14px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--text-mute);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s, transform .2s;
}
.op:hover .op__more { opacity: 1; transform: none; color: var(--accent); }

/* ---------- 空状态 / 列表脚注 ---------- */
.empty {
  padding: 70px 20px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.empty__glyph {
  font-family: var(--font-mono);
  font-size: 46px;
  color: var(--line-2);
  line-height: 1;
  margin-bottom: 16px;
}
.empty h3 { font-size: 18px; margin-bottom: 6px; }
.empty p { color: var(--text-mute); font-size: 14px; margin-bottom: 20px; }

.listfoot {
  margin-top: 18px;
  padding: 14px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .16em;
  color: var(--text-mute);
  border-top: 1px dashed var(--line);
}

/* ---------- 页脚 ---------- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px clamp(16px, 3vw, 40px);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
}
.footer__brand strong { font-size: 15px; letter-spacing: .04em; }
.footer__brand p { color: var(--text-mute); font-size: 12.5px; margin-top: 6px; max-width: 560px; line-height: 1.7; }
.footer__meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-mute);
  text-align: right;
  line-height: 1.9;
}
.footer__meta a { color: var(--text-dim); border-bottom: 1px solid var(--line-2); }
.footer__meta a:hover { color: var(--accent); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .68);
  backdrop-filter: blur(6px);
}
@keyframes fadeIn { from { opacity: 0; } }

.modal__panel:focus,
.modal__panel:focus-visible { outline: none; }

.modal__panel {
  position: relative;
  width: min(880px, 100%);
  max-height: min(86vh, 900px);
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.modal__close {
  position: sticky;
  top: 12px;
  margin-left: auto;
  margin-right: 12px;
  z-index: 5;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  float: right;
}
.modal__close:hover { color: var(--text); border-color: var(--line-2); }
.modal__close svg { width: 16px; height: 16px; }

.modal__body { padding: 26px 28px 30px; }

.mop__head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.mop__portrait {
  width: 108px; height: 108px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  flex: none;
}
.mop__portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; }

.mop__title h3 { font-size: 28px; line-height: 1.2; margin-bottom: 6px; }
.mop__title .mop__sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  color: var(--text-mute);
}
.mop__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  border-radius: 2px;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.badge--rank { color: #080a09; background: var(--rk, #9aa8a1); border-color: transparent; font-weight: 800; font-family: var(--font-mono); }
.badge--rarity { color: var(--rarity, var(--accent)); border-color: color-mix(in srgb, var(--rarity, var(--accent)) 35%, transparent); }

.mop__section { padding-top: 20px; }
.mop__section h4 {
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mop__section h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.mop__bonds { display: flex; flex-wrap: wrap; gap: 8px; }
.mbond {
  flex: 1 1 240px;
  padding: 10px 12px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-left: 2px solid var(--mint);
  border-radius: 3px;
}
.mbond--sub { border-left-color: var(--line-2); }
.mbond__top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.mbond__top img { width: 22px; height: 22px; }
.mbond__top b { font-size: 14.5px; }
.mbond__top span { margin-left: auto; font-family: var(--font-mono); font-size: 9px; color: var(--text-mute); letter-spacing: .1em; }
.mbond__desc { font-size: 13px; color: var(--text-mute); line-height: 1.65; }

.mtiers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mtier {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.mtier--elite { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.mtier__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
}
.mtier__head b { font-size: 14.5px; letter-spacing: .08em; }
.mtier--elite .mtier__head b { color: var(--accent); }
.mtier__head span { font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); }

.mtrait { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.mtrait:last-child { margin-bottom: 0; }
.mtrait .ttext { -webkit-line-clamp: unset; display: block; font-size: 14px; }

.mop__actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- 关于面板 ---------- */
.about__lede { color: var(--text-dim); font-size: 15px; line-height: 1.8; }
.about-list { display: flex; flex-direction: column; gap: 6px; }
.about-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 12px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.about-row__name { font-size: 14px; font-weight: 700; min-width: 140px; }
.about-row__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--text-mute);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.about-row__num { font-family: var(--font-mono); font-size: 10.5px; color: var(--mint); white-space: nowrap; }
.about__meta p { color: var(--text-dim); font-size: 12.5px; line-height: 1.85; margin-bottom: 8px; }
.about__meta a { color: var(--accent); border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.about__meta code,
.about__meta b {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  background: var(--chip);
  border: 1px solid var(--line);
  padding: 0 5px;
  border-radius: 2px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  background: var(--panel-3);
  border: 1px solid var(--line-2);
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--text);
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s var(--ease);
  z-index: 120;
}
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 骨架屏 ---------- */
.skeleton {
  height: 132px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--panel) 20%, var(--panel-3) 40%, var(--panel) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
  border: 1px solid var(--line);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* ---------- 移动端遮罩 ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: rgba(0, 0, 0, .62);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s;
}
.scrim[data-open="true"] { opacity: 1; pointer-events: auto; }
@media (min-width: 1181px) { .scrim { display: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .bg-annot { display: none; }
  .filters {
    position: fixed;
    inset: var(--topbar-h) 0 0 auto;
    width: min(340px, 88vw);
    max-height: none;
    border-radius: 0;
    border-right: 0;
    z-index: 80;
    transform: translateX(105%);
    transition: transform .28s var(--ease);
    box-shadow: -20px 0 60px rgba(0, 0, 0, .5);
  }
  .filters[data-open="true"] { transform: none; }
  .only-mobile { display: inline-flex; }
  .hero__deco { display: none; }
}

@media (max-width: 820px) {
  .op { grid-template-columns: 1fr; gap: 14px; }
  .op__id { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
  .portrait { width: 64px; height: 64px; }
  .op__name, .op__meta { text-align: left; }
  .op__id > :not(.portrait) { min-width: 0; }
  .op__id { flex-wrap: wrap; }
  .op__more { display: none; }
  .tier { grid-template-columns: 1fr; gap: 8px; padding: 10px 0; }
  .mtiers { grid-template-columns: 1fr; }
  .mop__head { flex-direction: row; gap: 14px; align-items: center; }
  .mop__portrait { width: 84px; height: 84px; }
  .mop__title h3 { font-size: 22px; }
  .mop__title .mop__sub { font-size: 9.5px; letter-spacing: .08em; }
  .modal { padding: 0; }
  .modal__panel { max-height: 100vh; height: 100%; border-radius: 0; width: 100%; }
  .modal__body { padding: 20px; }
  .hero { padding-top: 34px; }
  .stats .stat { flex: 1 1 120px; }
}

@media (max-width: 560px) {
  .brand-text em { display: none; }
  .season-static { padding: 0 2px 0 0; background: none; border-color: transparent; gap: 0; }
  .season-static .season-btn__tag,
  .season-static em { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .season-btn__name { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .toolbar { flex-wrap: wrap; }
  .toolbar__right { width: 100%; }
  .select { flex: 1; }
  .select select { width: 100%; }
  .resultbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer__meta { text-align: left; }
}

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

/* ---------- 顶栏下缘细节线 ---------- */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent) 10%, transparent 30%, transparent 70%, var(--accent) 90%, transparent);
  opacity: .45;
}
