/* ============================================================
   jev-dashboard · 设计令牌与样式
   体系：semantic tokens（禁止裸 hex）· 圆角三级 6/10/14 ·
   间距 4 的倍数 · accent 单一冰青 · 数据语义色仅用于数据
   ============================================================ */

:root {
  /* 表面（同色相冷灰蓝，由深到浅） */
  --bg: #0a0e16;
  --surface-1: #111725;
  --surface-2: #182032;
  --surface-3: #202a40;
  --hairline: rgba(148, 166, 200, 0.13);
  --hairline-strong: rgba(148, 166, 200, 0.24);

  /* 文本 */
  --text-1: #e8edf6;
  --text-2: #a9b4ca;
  --text-3: #7e8aa3;

  /* 品牌 accent（唯一交互色，冰青） */
  --accent: #4cc9f0;
  --accent-ink: #0a0e16;
  --accent-soft: rgba(76, 201, 240, 0.12);
  --accent-line: rgba(76, 201, 240, 0.38);

  /* 数据语义色（仅用于数据，不作交互色） */
  --bullish: #3ecf8e;
  --bearish: #f2597a;
  --flat: #e2a63d;
  --escalate: #b58cff;

  /* 圆角三级 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* 间距（4 的倍数） */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* 动效 */
  --t-fast: 140ms;
  --t-med: 190ms;
  --ease: cubic-bezier(0.3, 0.7, 0.4, 1);

  /* 阴影（染背景色相，非纯黑） */
  --shadow-card: 0 1px 0 rgba(148, 166, 200, 0.05) inset,
    0 12px 32px -16px rgba(4, 8, 18, 0.9);

  /* 背景辉光 */
  --bg-glow: rgba(76, 201, 240, 0.06);
}

/* ---------- 亮色主题（覆盖令牌即可，组件层零改动） ---------- */

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f9;
  --surface-1: #ffffff;
  --surface-2: #edf1f7;
  --surface-3: #e2e8f2;
  --hairline: rgba(28, 44, 78, 0.12);
  --hairline-strong: rgba(28, 44, 78, 0.22);
  --text-1: #1a2337;
  --text-2: #45526b;
  --text-3: #5f6c86;
  --accent: #0e7ea8;
  --accent-ink: #ffffff;
  --accent-soft: rgba(14, 126, 168, 0.09);
  --accent-line: rgba(14, 126, 168, 0.35);
  --bullish: #0a7d55;
  --bearish: #c22e52;
  --flat: #8f6410;
  --escalate: #6d3fd0;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 12px 28px -18px rgba(30, 45, 80, 0.35);
  --bg-glow: rgba(14, 126, 168, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  background:
    radial-gradient(1100px 480px at 82% -12%, var(--bg-glow), transparent 70%),
    var(--bg);
  color: var(--text-1);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100dvh;
  padding: var(--sp-5) clamp(var(--sp-4), 4vw, 40px) 48px;
}

/* ---------- 布局容器 ---------- */

.shell { max-width: 1260px; margin: 0 auto; }

/* ---------- 跳转链接（可达性） ---------- */

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 0 0 var(--r-md) 0;
  font-size: 13px; font-weight: 600; text-decoration: none; z-index: 10;
}
.skip:focus-visible { left: 0; }

/* ---------- 焦点环 ---------- */

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

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-3); margin-bottom: var(--sp-5);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); }
.logo {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
}
.topbar h1 {
  font-size: 1.3rem; font-weight: 650; letter-spacing: -0.02em;
  line-height: 1.15; text-wrap: balance;
}
.sub { color: var(--text-3); font-size: 0.78rem; margin-top: 2px; letter-spacing: 0.01em; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }

/* 数据脉搏（记忆点：最近一次成功刷新的呼吸指示） */
.pulse { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--text-3); }
.pulse .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bullish); flex: none;
}
.pulse.is-live .dot { animation: breathe 2.4s var(--ease) infinite; }
.pulse.is-down .dot { background: var(--bearish); animation: none; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.45); }
  55% { box-shadow: 0 0 0 6px rgba(62, 207, 142, 0); }
}

/* ---------- 按钮 / 标签页 ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--hairline-strong); border-radius: var(--r-md);
  padding: 0 var(--sp-4); cursor: pointer; font-size: 0.85rem; font-weight: 500;
  transition: background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--accent-line); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 15px; height: 15px; }

.tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.tab {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px;
  background: var(--surface-1); color: var(--text-2);
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 0 var(--sp-5); cursor: pointer; font-size: 0.9rem;
  transition: color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}
.tab:hover { color: var(--text-1); background: var(--surface-2); }
.tab:active { transform: scale(0.98); }
.tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text-1); font-weight: 600;
}
.tab .cc {
  font: 600 0.66rem/20px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  color: var(--text-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}
.tab.active .cc { color: var(--accent); border-color: var(--accent-line); }

/* ---------- 卡片 ---------- */

.layout {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--sp-4); align-items: start;
}
@media (max-width: 1023px) { .layout { grid-template-columns: 1fr; } }

.card {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5);
}
.side { display: grid; gap: var(--sp-4); }

.card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--sp-2); margin-bottom: var(--sp-4);
}
.card-head h2 { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; font-weight: 600; }
.card-head h2 .ico { width: 16px; height: 16px; color: var(--accent); flex: none; }
.meta { color: var(--text-3); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; }

.overview-card { margin-top: var(--sp-4); }

/* ---------- 锐评正文 ---------- */

.brief-body { font-size: 0.92rem; line-height: 1.8; overflow-wrap: break-word; color: var(--text-1); }
.brief-body h4 {
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: 0.86rem; font-weight: 600; letter-spacing: 0.01em; color: var(--accent);
  scroll-margin-top: var(--sp-5);
}
.brief-body h4:first-child { margin-top: 0; }
.brief-body b { color: #fff; font-weight: 650; }
.brief-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82em;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 1px 6px;
}
.brief-body ul { margin: var(--sp-1) 0 var(--sp-3) 20px; }
.brief-body li { margin: 3px 0; }
.brief-body li::marker { color: var(--text-3); }
.brief-body .quote {
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  padding: var(--sp-2) var(--sp-3);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: var(--sp-2) 0;
  color: var(--text-2);
}
.brief-body .quote b { color: var(--text-1); }
.badge-warn {
  display: inline-block;
  background: color-mix(in srgb, var(--flat) 12%, transparent);
  color: var(--flat); border: 1px solid color-mix(in srgb, var(--flat) 35%, transparent);
  border-radius: var(--r-sm); padding: 1px 7px; font-size: 0.72rem;
}

/* ---------- Jev 决策统计 ---------- */

.jev-stats { display: grid; gap: var(--sp-3); }
.stat-row { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: 0.86rem; }
.stat-row .k { color: var(--text-3); }
.stat-row .v { font-variant-numeric: tabular-nums; font-weight: 500; }
.big-num { font-size: 1.7rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big-label { font-size: 0.75rem; color: var(--text-3); }

.dist { margin-top: var(--sp-1); }
.dist-bar {
  display: flex; height: 12px; border-radius: var(--r-sm);
  overflow: hidden; background: var(--surface-2);
}
.dist-bar span { display: block; height: 100%; transition: width var(--t-med) var(--ease); }
.dist-legend {
  display: flex; gap: var(--sp-4); margin-top: var(--sp-2);
  font-size: 0.75rem; color: var(--text-2); flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot.bullish { background: var(--bullish); }
.dot.bearish { background: var(--bearish); }
.dot.neutral { background: var(--flat); }

/* ---------- 决策明细 ---------- */

.decisions {
  list-style: none; max-height: 440px; overflow-y: auto;
  display: grid; gap: var(--sp-2);
}
.decision {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  transition: background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.decision:hover { background: var(--surface-3); border-color: var(--hairline-strong); }
.decision .d-title { font-size: 0.82rem; line-height: 1.55; margin-bottom: 7px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.72rem; }
.chip {
  border-radius: var(--r-sm);
  padding: 1px 7px;
  border: 1px solid var(--hairline);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.chip.bullish { color: var(--bullish); border-color: color-mix(in srgb, var(--bullish) 38%, transparent); background: color-mix(in srgb, var(--bullish) 9%, transparent); }
.chip.bearish { color: var(--bearish); border-color: color-mix(in srgb, var(--bearish) 38%, transparent); background: color-mix(in srgb, var(--bearish) 9%, transparent); }
.chip.neutral { color: var(--flat); border-color: color-mix(in srgb, var(--flat) 38%, transparent); background: color-mix(in srgb, var(--flat) 9%, transparent); }
.chip.conf { color: var(--text-3); }
.chip.escalate { color: var(--escalate); border-color: color-mix(in srgb, var(--escalate) 40%, transparent); background: color-mix(in srgb, var(--escalate) 9%, transparent); }
.chip.src { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- 全市场概览 ---------- */

.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-3); }
.ov-item {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.ov-item .ov-name { font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.ov-item .ov-num { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ov-item .ov-num small { font-size: 0.75rem; font-weight: 400; color: var(--text-3); letter-spacing: 0; }
.ov-item .ov-line { color: var(--text-3); font-size: 0.74rem; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ---------- 三态 ---------- */

.placeholder { color: var(--text-3); font-size: 0.85rem; padding: var(--sp-2) 0; }

.error-box {
  background: color-mix(in srgb, var(--bearish) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--bearish) 32%, transparent);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.error-box .msg { color: var(--bearish); }

.empty-hint { color: var(--text-3); font-size: 0.85rem; line-height: 1.9; }
.empty-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 1px 6px;
}

/* 骨架屏 */
.skel {
  border-radius: var(--r-sm);
  background: linear-gradient(
    100deg,
    var(--surface-2) 40%,
    var(--surface-3) 50%,
    var(--surface-2) 60%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-line { height: 12px; margin-bottom: 10px; }
.skel-line.w60 { width: 60%; }
.skel-line.w80 { width: 80%; }
.skel-block { height: 84px; border-radius: var(--r-md); margin-top: var(--sp-3); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 主题分段控件 ---------- */

.theme-seg {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-md);
  overflow: hidden;
}
.theme-seg button {
  min-height: 44px; padding: 0 var(--sp-4);
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-3); font-size: 0.8rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.theme-seg button + button { border-left: 1px solid var(--hairline); }
.theme-seg button:hover { color: var(--text-1); }
.theme-seg button[aria-pressed="true"] {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}

/* ---------- 锐评目录 ---------- */

.toc {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: var(--sp-4); padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--hairline);
}
.toc a {
  font-size: 0.76rem; color: var(--text-2); text-decoration: none;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 3px 10px;
  transition: color var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}
.toc a:hover { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* ---------- 决策筛选 ---------- */

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-3); }
.fbtn {
  min-height: 44px; padding: 0 var(--sp-3);
  background: transparent; color: var(--text-2);
  border: 1px solid var(--hairline); border-radius: var(--r-md);
  cursor: pointer; font-size: 0.78rem;
  transition: color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease);
}
.fbtn:hover { color: var(--text-1); background: var(--surface-2); }
.fbtn[aria-pressed="true"] {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-line); font-weight: 600;
}
.fbtn .n { color: var(--text-3); font-variant-numeric: tabular-nums; margin-left: 3px; }
.fbtn[aria-pressed="true"] .n { color: var(--accent); }

/* ---------- 页脚 ---------- */

.footer {
  margin-top: var(--sp-6); color: var(--text-3);
  font-size: 0.76rem; text-align: center; line-height: 2;
}
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--accent); }
.footer .disclaim { color: var(--text-3); opacity: 0.8; }

/* ---------- 入场动效（记忆点之二：按卡错落浮现） ---------- */

.anim-in { animation: fadeUp 320ms var(--ease) both; }
.anim-in:nth-child(2) { animation-delay: 60ms; }
.anim-in:nth-child(3) { animation-delay: 120ms; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

/* ---------- 响应式（375 / 768 / 1024 / 1440） ---------- */

@media (min-width: 1440px) {
  body { font-size: 15.5px; }
}

@media (max-width: 767px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .card { padding: var(--sp-4); }
  .tabs { gap: 6px; }
  .tab { padding: 0 var(--sp-3); }
  .overview { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .overview { grid-template-columns: 1fr; }
  .pulse .label { display: none; }
}
