/* AI 比价 · design tokens —— 与 aibijia-design.md §3 一一对应，hex 以令牌为唯一真源 */
:root {
  --font-sans: "Inter", "Inter var", -apple-system, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  --dur-fast: 120ms;
  --dur-base: 180ms;
  --dur-slow: 240ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  --radius: 4px;
  --radius-sm: 2px;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-surface: #fafafa;
  --bg-raised: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #09090b;
  --text-2: #52525b;
  --text-3: #71717a;
  --text-4: #8a8a93;
  --accent: #1b4dff;
  --accent-ink: #ffffff;
  --accent-soft: #eef1ff;
  --focus: #1b4dff;
  --price-up: #b42318;
  --price-down: #067647;
  --warn: #a15c07;
  --danger: #b42318;
  --chart-claude: #b86f45;
  --scroll-thumb: #c8c8cf;
  --scroll-thumb-hover: #a1a1aa;
  --shadow: none;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-surface: #141417;
  --bg-raised: #1c1c20;
  --border: #26262b;
  --border-strong: #3a3a40;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #8a8a93;
  --text-4: #8a8a93;
  --accent: #6e8bff;
  --accent-ink: #0a0a0b;
  --accent-soft: #16182a;
  --focus: #6e8bff;
  --price-up: #f97066;
  --price-down: #4cc98b;
  --warn: #e3b341;
  --danger: #f97066;
  --chart-claude: #e2a37f;
  --scroll-thumb: #4a4a52;
  --scroll-thumb-hover: #6b6b75;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* 滚动条：全站统一细线、浅色、圆角。
   Chromium/Safari 走伪元素；注意 html 上不能再设 scrollbar-width/color，
   否则 Chromium 会对文档滚动条改用原生渲染，与内部滚动容器不一致。 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border: 2px solid transparent;
  border-radius: 8px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-thumb-hover); }

/* Firefox 无伪元素：标准属性保持同色同细 */
@supports not selector(::-webkit-scrollbar-thumb) {
  * { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
/* dd 的浏览器默认缩进会把摘要与抽屉里的数值顶离左边界，与各栏自设的 margin-top 冲突 */
dl, dt, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }

/* 价格与读数：等宽对齐数字，禁止比例字宽 */
.num {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.caption {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

.muted { color: var(--text-3); }
.unit { font-size: 12px; color: var(--text-3); font-weight: 400; }

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

.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;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 60;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 12px; }

/* 按钮：同屏只允许一个主按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(0.94); }
.btn-ghost { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-raised); }
.btn-text { background: none; border: 0; color: var(--accent); padding: 0; height: auto; font-weight: 500; }

/* 本表把 .btn 等元素显式设成了 display，会盖掉浏览器默认的 [hidden]；统一兜底 */
[hidden] { display: none !important; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-2);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--bg-raised); color: var(--text); }
.icon { width: 18px; height: 18px; stroke-width: 1.5; flex: none; }

/* 徽章：2px 圆角 + 文字，不用纯色块承担语义 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-2);
  white-space: nowrap;
}
.badge-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

/* 涨跌：色 + 字形，不单独依赖颜色 */
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; white-space: nowrap; }
.delta-up { color: var(--price-up); }
.delta-down { color: var(--price-down); }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

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