/* =========================================================
   SSQ Data Lab · Atelier Stat
   编辑级数据工作台 · 双主题 · 零运行依赖
   v3 · 2026-05 · committed aesthetic: laboratory editorial
   ========================================================= */

/* ─────────────────────────────────────────────
 * §00 — Tokens · Theme-agnostic
 * ───────────────────────────────────────────── */
:root {
  color-scheme: dark light;

  /* —— 字体栈 —— 系统字体优先，零依赖、离线一致 —— */
  /* sans: 不再首选 Inter（generic），优先 system + 中文衬线兼顾 */
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI Variable Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei",
    "WenQuanYi Micro Hei", sans-serif;
  /* display serif：杂志感 italic，多 fallback 兼顾跨平台 */
  --serif: "Iowan Old Style", "Apple Garamond", "Hoefler Text", "Baskerville",
    "Garamond", "Cambria", "Source Serif Pro", "Noto Serif SC", "Songti SC",
    "STSong", ui-serif, Georgia, serif;
  /* mono：终端 + tabular numerics */
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular,
    "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono",
    "DejaVu Sans Mono", "Courier New", monospace;

  /* —— 节奏 (8pt grid + 4pt micro) —— */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* —— 圆角 —— 卡片刻意收紧成"票根"味道 —— */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  --max-w: 1240px;

  /* —— 动效曲线 —— */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 140ms;
  --t-base: 220ms;
  --t-slow: 420ms;
  --t-slower: 720ms;

  /* —— 字号梯度（以 16px 为基准） —— */
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-base: 14.5px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: clamp(34px, 4.6vw, 56px);
}

/* ─────────────────────────────────────────────
 * §01 — Theme · Dark (default) · Atelier Black
 * ───────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  /* 背景层：墨色 + 微暖 (避免泛科技纯黑) */
  --bg-0: #07080c;
  --bg-1: #0b0d14;
  --bg-2: #11141d;

  /* 表面层：半透明 surfaces 在 noise + grid 上漂浮 */
  --surface: rgba(255, 252, 244, 0.045);
  --surface-2: rgba(255, 252, 244, 0.08);
  --surface-3: rgba(255, 252, 244, 0.12);

  --stroke: rgba(255, 252, 244, 0.085);
  --stroke-2: rgba(255, 252, 244, 0.16);
  --stroke-strong: rgba(255, 252, 244, 0.28);

  /* 文字 */
  --text: rgba(247, 244, 235, 0.96);
  --text-2: rgba(247, 244, 235, 0.78);
  --muted: rgba(247, 244, 235, 0.58);
  --muted-2: rgba(247, 244, 235, 0.40);
  --muted-3: rgba(247, 244, 235, 0.24);

  /* 领域色（双色球红/蓝） */
  --red: #ff4757;
  --red-2: #ff8084;
  --red-deep: #c81d2a;
  --blue: #4aa8ff;
  --blue-2: #8fcaff;
  --blue-deep: #1a6fc9;

  /* 信号色（重塑） */
  --acid: #c8ff4d;        /* 电光酸绿（CTA + 强调） */
  --acid-2: #e2ff8c;
  --acid-deep: #8db300;
  --ember: #ff6a3d;       /* 朱砂橙（emphasis，新增冷暖对比） */
  --ember-2: #ffa07a;
  --ember-deep: #c43a14;
  --gold: #ffce6a;
  --plum: #d6a8ff;
  --jade: #5dd9b8;        /* (DLT 前区) */

  /* 阴影：纸张 sticker 感（偏移而非散射） */
  --shadow-sm: 2px 4px 0 rgba(0, 0, 0, 0.32),
               0 2px 6px rgba(0, 0, 0, 0.24);
  --shadow: 4px 8px 0 rgba(0, 0, 0, 0.42),
            0 14px 36px rgba(0, 0, 0, 0.45);
  --shadow-lg: 6px 12px 0 rgba(0, 0, 0, 0.48),
               0 28px 80px rgba(0, 0, 0, 0.55);

  /* 网格线 + 极光层 */
  --grid-line: rgba(255, 252, 244, 0.045);
  --aurora-1: rgba(200, 255, 77, 0.10);
  --aurora-2: rgba(74, 168, 255, 0.10);
  --aurora-3: rgba(255, 106, 61, 0.07);

  /* 文本印章色（新增） */
  --stamp-ink: #c8ff4d;
}

/* ─────────────────────────────────────────────
 * §02 — Theme · Light · Cream Notebook
 * ───────────────────────────────────────────── */
[data-theme="light"] {
  --bg-0: #f3efe4;
  --bg-1: #ece8db;
  --bg-2: #e3dfd0;

  --surface: rgba(28, 22, 14, 0.045);
  --surface-2: rgba(28, 22, 14, 0.08);
  --surface-3: rgba(28, 22, 14, 0.12);

  --stroke: rgba(28, 22, 14, 0.12);
  --stroke-2: rgba(28, 22, 14, 0.20);
  --stroke-strong: rgba(28, 22, 14, 0.34);

  --text: #1a1612;
  --text-2: rgba(26, 22, 18, 0.80);
  --muted: rgba(26, 22, 18, 0.62);
  --muted-2: rgba(26, 22, 18, 0.44);
  --muted-3: rgba(26, 22, 18, 0.26);

  --red: #c8202c;
  --red-2: #e0454f;
  --red-deep: #8c1018;
  --blue: #1a6fc9;
  --blue-2: #4aa8ff;
  --blue-deep: #0e4685;

  --acid: #6e8a14;
  --acid-2: #9bba36;
  --acid-deep: #4a5e0a;
  --ember: #c84a1c;
  --ember-2: #e07642;
  --ember-deep: #8b2a08;
  --gold: #b8862a;
  --plum: #6e3aa8;
  --jade: #1f8868;

  --shadow-sm: 2px 4px 0 rgba(20, 14, 6, 0.10),
               0 1px 4px rgba(20, 14, 6, 0.06);
  --shadow: 4px 8px 0 rgba(20, 14, 6, 0.12),
            0 12px 28px rgba(20, 14, 6, 0.08);
  --shadow-lg: 6px 12px 0 rgba(20, 14, 6, 0.14),
               0 24px 60px rgba(20, 14, 6, 0.10);

  --grid-line: rgba(28, 22, 14, 0.06);
  --aurora-1: rgba(180, 220, 60, 0.10);
  --aurora-2: rgba(90, 160, 230, 0.08);
  --aurora-3: rgba(220, 80, 40, 0.06);

  --stamp-ink: #c84a1c;
}

/* ─────────────────────────────────────────────
 * §03 — Reset & Document
 * ───────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { height: 100%; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11", "tnum", "ss02";
  color: var(--text);
  background: var(--bg-1);
  background-image:
    /* 角色光晕 */
    radial-gradient(900px 520px at 16% 4%, var(--aurora-1), transparent 65%),
    radial-gradient(820px 600px at 88% 14%, var(--aurora-2), transparent 60%),
    radial-gradient(780px 600px at 72% 92%, var(--aurora-3), transparent 60%),
    /* 主背景渐变 */
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 55%, var(--bg-0));
  background-attachment: fixed;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--ember);
  color: #0a0c10;
}
[data-theme="light"] ::selection {
  background: var(--acid);
  color: #1a1612;
}

a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--t-fast) var(--ease-out);
}

/* —— Utility classes —— 在 markup/JS 中被广泛引用 —— */
.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" on, "lnum" on;
}
.muted { color: var(--muted); }
.fine {
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.6;
}

/* ─────────────────────────────────────────────
 * §04 — Atmospheric layers
 * 网格 + 噪点 + (新) 光晕 + (新) 装饰刻度线
 * ───────────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image:
    radial-gradient(900px 600px at 25% 8%, #000 30%, transparent 75%);
  opacity: 0.7;
  mix-blend-mode: overlay;
}

.bg-noise {
  position: fixed;
  inset: -40px;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: soft-light;
}
[data-theme="light"] .bg-noise { opacity: 0.10; }

/* —— 屏幕阅读器 / Skip link —— */
.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;
  top: -100px; left: 50%;
  transform: translateX(-50%);
  background: var(--acid);
  color: #0a0c10;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  z-index: 100;
  transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ─────────────────────────────────────────────
 * §05 — Topbar · Editorial masthead
 * ───────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-5);
  padding: 14px max(20px, calc((100vw - var(--max-w)) / 2 + 20px));
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--bg-0) 90%, transparent),
    color-mix(in oklab, var(--bg-0) 64%, transparent));
}

/* (新) 顶栏底边的刻度线 — 像实验册边缘 */
.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 1px;
  background-image:
    repeating-linear-gradient(
      90deg,
      var(--stroke) 0,
      var(--stroke) 1px,
      transparent 1px,
      transparent 16px
    );
  opacity: 0.6;
  pointer-events: none;
}

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

.mark {
  width: 38px;
  height: 38px;
  display: grid;
  grid-template: repeat(2, 1fr) / repeat(2, 1fr);
  gap: 3px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  position: relative;
}
.mark::after {
  /* 微高光，像化学瓶口 */
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 9px;
  background: linear-gradient(155deg,
    rgba(255, 255, 255, 0.10),
    transparent 35%);
  pointer-events: none;
}
.mark .dot {
  border-radius: 999px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.32);
}
.mark .dot.red {
  background:
    radial-gradient(6px 6px at 30% 28%, rgba(255, 255, 255, 0.65), transparent 60%),
    linear-gradient(180deg, var(--red-2), var(--red));
}
.mark .dot.blue {
  background:
    radial-gradient(6px 6px at 30% 28%, rgba(255, 255, 255, 0.65), transparent 60%),
    linear-gradient(180deg, var(--blue-2), var(--blue));
}

.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-text .kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.20em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.brand-text .name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--text);
}

/* —— Tabs —— 编号化 chapter 切换 —— */
.tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  appearance: none;
  border: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  font-family: inherit;
  transition:
    color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out);
}
.tab:hover {
  color: var(--text);
  background: var(--surface-2);
}
.tab.is-active {
  color: #0a0c10;
  background: linear-gradient(180deg, var(--acid-2), var(--acid));
  box-shadow:
    0 4px 14px color-mix(in oklab, var(--acid) 32%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-weight: 600;
}
[data-theme="light"] .tab.is-active {
  color: #fff;
}

/* —— Top actions / icon buttons —— */
.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--stroke-2);
  transform: translateY(-1px);
}
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.is-loading svg { animation: spin 0.9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────
 * §06 — Layout · Shell + Hero
 * ───────────────────────────────────────────── */
.shell {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-8) max(20px, calc((100vw - var(--max-w)) / 2 + 20px)) var(--space-12);
}
@media (min-width: 1240px) {
  .shell { padding-left: 20px; padding-right: 20px; }
}

/* —— Hero · 杂志封面 —— */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: var(--space-6);
  align-items: stretch;
  margin-bottom: var(--space-10);
}

/* (新) Hero 左侧装饰：罗盘标号"§01"风格 */
.hero::before {
  content: "§ COVER";
  position: absolute;
  top: -8px;
  left: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.30em;
  color: var(--muted-3);
  text-transform: uppercase;
  pointer-events: none;
}

.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-4);
  padding-top: var(--space-3);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  align-self: flex-start;
  position: relative;
}
.hero-eyebrow .pulse {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--acid);
  box-shadow: 0 0 0 0 var(--acid);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--acid) 70%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* —— H1 · 编辑级 italic display —— */
.hero h1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--fs-3xl);
  line-height: 1.02;
  letter-spacing: -0.018em;
  margin: 0;
  color: var(--text);
}
.hero h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  font-family: var(--serif);
}
/* "理性的"-style ink mark：手工荧光高亮 */
.hero .ink {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  font-style: italic;
  color: var(--text);
}
.hero .ink::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  bottom: 8%;
  height: 32%;
  background: linear-gradient(90deg,
    rgba(255, 106, 61, 0),
    color-mix(in oklab, var(--ember) 55%, transparent),
    color-mix(in oklab, var(--gold) 35%, transparent),
    rgba(255, 106, 61, 0));
  z-index: -1;
  border-radius: 4px;
  filter: blur(0.6px);
  transform: skewX(-3deg);
}

.hero .sub {
  color: var(--muted);
  font-size: var(--fs-md);
  max-width: 60ch;
  margin: 0;
  line-height: 1.6;
}
.hero .sub strong {
  color: var(--text);
  font-weight: 600;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.metric {
  position: relative;
  padding: 14px 14px 12px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--stroke);
  overflow: hidden;
  transition:
    transform var(--t-base) var(--ease-out),
    border-color var(--t-base) var(--ease-out);
}
.metric:hover {
  transform: translateY(-2px);
  border-color: var(--stroke-2);
}
.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 32px;
  height: 2px;
  background: var(--ember);
}
.metric .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.metric .value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-top: var(--space-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.metric .value.skeleton {
  width: 60%;
  height: 18px;
  background: linear-gradient(90deg,
    var(--surface), var(--surface-3), var(--surface));
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.hero-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ─────────────────────────────────────────────
 * §07 — Card · Sticker / Tear-off paper
 * ───────────────────────────────────────────── */
.card {
  position: relative;
  padding: var(--space-5);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition:
    border-color var(--t-base) var(--ease-out),
    transform var(--t-base) var(--ease-out);
}
.card::before {
  /* 顶部双辉光（acid 左 + ember 右） */
  content: "";
  position: absolute;
  inset: -1px;
  background:
    radial-gradient(540px 200px at 8% 0%,
      color-mix(in oklab, var(--acid) 14%, transparent), transparent 60%),
    radial-gradient(540px 220px at 92% 0%,
      color-mix(in oklab, var(--ember) 12%, transparent), transparent 60%);
  opacity: 0.55;
  pointer-events: none;
  border-radius: inherit;
}
.card > * { position: relative; }

/* (新) 卡片悬停轻微抬起 */
.card:hover {
  border-color: var(--stroke-2);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--text-2);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.card-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--acid);
  box-shadow: 0 0 12px color-mix(in oklab, var(--acid) 60%, transparent);
}
.card-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted-3);
  margin-left: auto;
  text-transform: uppercase;
}

.disclaimer ul {
  margin: var(--space-2) 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.disclaimer li::marker { color: var(--muted-3); }

.latest-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.latest-row .mono { font-size: 13px; }

/* ─────────────────────────────────────────────
 * §08 — Ball · 化学瓶玻璃球
 * ───────────────────────────────────────────── */
.balls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  align-items: center;
}

.ball {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0;
  color: #fff;
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255, 255, 255, 0.14);
  /* 三层光感：内底阴 + 顶高光 + 外阴影 */
  box-shadow:
    inset 0 -3px 6px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 6px 14px rgba(0, 0, 0, 0.38);
  user-select: none;
  transition:
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
.ball:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 -3px 6px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 10px 22px rgba(0, 0, 0, 0.45);
}

.ball.red {
  background:
    radial-gradient(11px 11px at 32% 26%, rgba(255, 255, 255, 0.65), transparent 65%),
    linear-gradient(160deg, var(--red-2) 0%, var(--red) 55%, var(--red-deep) 100%);
}
.ball.blue {
  background:
    radial-gradient(11px 11px at 32% 26%, rgba(255, 255, 255, 0.65), transparent 65%),
    linear-gradient(160deg, var(--blue-2) 0%, var(--blue) 55%, var(--blue-deep) 100%);
}
.ball.plus {
  position: relative;
}
.ball.plus::before {
  content: "+";
  position: absolute;
  left: -14px;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted-2);
  font-size: 16px;
  font-weight: 400;
}

/* ─────────────────────────────────────────────
 * §09 — Panel · Chapter switching
 * ───────────────────────────────────────────── */
.panel {
  display: none;
  margin-top: var(--space-5);
  animation: panelIn 360ms var(--ease-out);
}
.panel.is-active { display: block; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--stroke);
  position: relative;
}
.panel-header::after {
  /* 章节分隔线右下 dot */
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--ember);
}

.panel-header h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.panel-header .meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted-2);
  text-transform: uppercase;
  white-space: nowrap;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.panel-grid > .span-full { grid-column: 1 / -1; }
.panel-grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1080px) {
  .panel-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .panel-grid,
  .panel-grid-3 { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────
 * §10 — Charts
 * ───────────────────────────────────────────── */
.chart {
  position: relative;
  height: 200px;
  padding: 8px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.20), rgba(0, 0, 0, 0.06));
  overflow: hidden;
}
[data-theme="light"] .chart {
  background:
    linear-gradient(180deg, rgba(28, 22, 14, 0.05), rgba(28, 22, 14, 0.02));
}
.chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.chart-bar {
  cursor: pointer;
  transition:
    filter var(--t-fast) var(--ease-out),
    opacity var(--t-fast) var(--ease-out);
}
.chart-bar:hover {
  filter: brightness(1.20)
    drop-shadow(0 4px 10px color-mix(in oklab, var(--acid) 30%, transparent));
}
.chart-tip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--bg-1);
  border: 1px solid var(--stroke-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow);
  transition: opacity var(--t-fast) var(--ease-out);
}

.hint {
  margin-top: var(--space-3);
  font-size: 12px;
  color: var(--muted-2);
  line-height: 1.6;
  position: relative;
  padding-left: 14px;
}
.hint::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 1px;
  background: var(--ember);
}
.hint strong { color: var(--text-2); }

/* ─────────────────────────────────────────────
 * §11 — Forms · Field & inputs
 * ───────────────────────────────────────────── */
.row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 180px;
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--stroke);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--muted);
  font-size: 13px;
  transition:
    border-color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
}
.field:focus-within {
  border-color: color-mix(in oklab, var(--acid) 60%, var(--stroke));
  background: var(--surface-2);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--acid) 18%, transparent);
}
.field > span:first-child {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  text-transform: uppercase;
  white-space: nowrap;
}

.field input,
.field select {
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  width: 110px;
  font-variant-numeric: tabular-nums;
}
.field select {
  width: 220px;
  font-family: var(--sans);
  font-size: 13px;
  cursor: pointer;
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 4l3 3 3-3' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 10px;
}
.field select option,
.field select optgroup {
  background-color: var(--bg-2);
  color: var(--text);
  font-family: var(--sans);
  padding: 6px 8px;
}

/* —— Range slider · 实验室刻度尺 —— */
.field input[type="range"] {
  width: 200px;
  height: 18px;
  background: transparent;
  cursor: pointer;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
}
.field input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  background: var(--acid);
  border-radius: 999px;
  border: 2px solid var(--bg-1);
  box-shadow:
    0 0 0 1px var(--stroke-strong),
    0 0 12px color-mix(in oklab, var(--acid) 40%, transparent);
  cursor: grab;
  transition: transform var(--t-fast) var(--ease-out);
}
.field input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.15);
  cursor: grabbing;
}
.field input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 999px;
}
.field input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--acid);
  border-radius: 999px;
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 0 1px var(--stroke-strong);
  cursor: grab;
}

.field input[type="text"] { width: 240px; }
.field input::placeholder { color: var(--muted-3); }

@media (max-width: 980px) {
  .field input[type="text"],
  .field select { width: 100%; }
}

.field.grow { display: flex; }
.field.grow input { flex: 1; width: auto; }

/* ─────────────────────────────────────────────
 * §12 — Buttons · 印章按压
 * ───────────────────────────────────────────── */
.btn {
  appearance: none;
  border: 1px solid var(--stroke-2);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  transition: all var(--t-fast) var(--ease-out);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--stroke-strong);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--acid) 30%, transparent);
}

.btn.primary {
  border-color: color-mix(in oklab, var(--acid) 50%, transparent);
  background: linear-gradient(180deg, var(--acid-2), var(--acid));
  color: #0a0c10;
  font-weight: 600;
  box-shadow:
    0 4px 14px color-mix(in oklab, var(--acid) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
[data-theme="light"] .btn.primary { color: #fff; }
.btn.primary:hover {
  filter: brightness(1.06);
  box-shadow:
    0 6px 18px color-mix(in oklab, var(--acid) 36%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn.ghost {
  background: transparent;
  border-color: var(--stroke);
}
.btn.ghost:hover { background: var(--surface); }

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}
.btn:disabled:hover {
  background: var(--surface);
  border-color: var(--stroke-2);
  filter: none;
}

.btn.is-loading {
  opacity: 0.7;
  cursor: progress;
}
.btn.is-loading::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}

/* ─────────────────────────────────────────────
 * §13 — Lists / Ranks / Chips / Callout
 * ───────────────────────────────────────────── */
.rank {
  margin: var(--space-2) 0 0;
  padding-left: 0;
  list-style: none;
}
.rank li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  color: var(--text-2);
  border-bottom: 1px dashed var(--stroke);
  font-size: 13px;
}
.rank li:last-child { border-bottom: 0; }
.rank li .mono { color: var(--text); }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-3);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.chip strong {
  color: var(--acid);
  font-weight: 700;
}
.chip-ok {
  background: color-mix(in oklab, var(--acid) 14%, transparent);
  border-color: color-mix(in oklab, var(--acid) 40%, transparent);
  color: var(--acid);
}
.chip-warn {
  background: color-mix(in oklab, var(--gold) 14%, transparent);
  border-color: color-mix(in oklab, var(--gold) 45%, transparent);
  color: var(--gold);
}
.chip-bad {
  background: color-mix(in oklab, var(--ember) 14%, transparent);
  border-color: color-mix(in oklab, var(--ember) 45%, transparent);
  color: var(--ember-2);
}

/* —— Callout · 编辑批注 —— */
.callout {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--acid) 30%, var(--stroke));
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--acid) 12%, transparent),
    color-mix(in oklab, var(--acid) 4%, transparent));
  position: relative;
}
.callout::before {
  /* 装饰：左上角"PS:"标签 */
  content: "";
  position: absolute;
  top: -1px;
  left: var(--space-4);
  width: 28px;
  height: 2px;
  background: var(--acid);
}
.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--acid) 90%, var(--text));
  font-size: 11px;
  margin-bottom: 8px;
}
.callout-title::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--acid);
}
.callout-body {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
}
.callout-body strong { color: var(--text); }
.callout-body ul { padding-left: 18px; margin: 6px 0 0; }
.callout-body li { padding: 2px 0; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}
.check:hover { color: var(--text); }
.check input {
  accent-color: var(--acid);
  width: 14px;
  height: 14px;
}

/* ─────────────────────────────────────────────
 * §14 — Trend grid
 * ───────────────────────────────────────────── */
.trend-wrap {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.24), rgba(0, 0, 0, 0.08));
  overflow: auto;
  max-height: 640px;
}
[data-theme="light"] .trend-wrap {
  background: linear-gradient(180deg, rgba(28, 22, 14, 0.05), rgba(28, 22, 14, 0.02));
}
.trend-svg { display: block; }
.trend-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.trend-wrap::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 999px;
}
.trend-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--stroke-2);
}

/* ─────────────────────────────────────────────
 * §15 — Distribution · ratio rows
 * ───────────────────────────────────────────── */
.ratio-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px;
  gap: 12px;
  align-items: center;
  padding: 5px 0;
  font-size: 12.5px;
}
.ratio-bar {
  display: block;
  height: 8px;
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  position: relative;
}
.ratio-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--acid) 92%, transparent),
    color-mix(in oklab, var(--ember) 75%, transparent));
  border-radius: 6px;
  transition: width var(--t-slow) var(--ease-out);
}
.ratio-val {
  text-align: right;
  color: var(--muted);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.ratio-key {
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.chart-gold .chart-bar {
  filter: hue-rotate(28deg);
}

/* ─────────────────────────────────────────────
 * §16 — Tools · Result big / metric blocks
 * ───────────────────────────────────────────── */
.result-big {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--acid) 30%, var(--stroke));
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--acid) 10%, transparent),
    color-mix(in oklab, var(--acid) 2%, transparent));
  min-height: 64px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13.5px;
}
.big-num {
  font-size: 28px;
  color: var(--acid);
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.table.mini th,
.table.mini td {
  padding: 6px 10px;
  font-size: 12px;
}

.analysis-box {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.metric-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.metric-line > span {
  color: var(--muted);
  font-size: 12px;
}
.metric-line > strong {
  color: var(--text);
  font-family: var(--mono);
}

/* ─────────────────────────────────────────────
 * §17 — Generator · tickets · 票根
 * ───────────────────────────────────────────── */
.results {
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition:
    border-color var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}
.ticket::before {
  /* 票面侧条：编号锚点 */
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--acid), var(--ember));
  opacity: 0.5;
}
.ticket:hover {
  border-color: var(--stroke-2);
  background: var(--surface-2);
}
.ticket .meta {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.ticket .nums {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.ticket .nums .ball {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.ticket-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-copy {
  padding: 6px 10px;
  font-size: 12px;
}

.banner-embedded {
  border-color: color-mix(in oklab, var(--gold) 40%, var(--stroke));
}
.banner-embedded .card-title { color: var(--gold); }
.banner-embedded .card-title::before {
  background: var(--gold);
  box-shadow: 0 0 12px color-mix(in oklab, var(--gold) 60%, transparent);
}

/* ─────────────────────────────────────────────
 * §18 — Data table
 * ───────────────────────────────────────────── */
.table-wrap {
  margin-top: var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  overflow: hidden;
  background: var(--surface);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th,
.table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--stroke);
  text-align: left;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr {
  transition: background var(--t-fast) var(--ease-out);
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table th {
  font-family: var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
}
.table td { color: var(--text-2); }
.table .red-num {
  color: var(--red-2);
  font-family: var(--mono);
  font-weight: 600;
}
.table .blue-num {
  color: var(--blue-2);
  font-family: var(--mono);
  font-weight: 600;
}

/* ─────────────────────────────────────────────
 * §19 — Footer · colophon
 * ───────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-6) max(20px, calc((100vw - var(--max-w)) / 2 + 20px)) var(--space-8);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  border-top: 1px solid var(--stroke);
  color: var(--muted-2);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.footer a {
  color: var(--muted);
  transition: color var(--t-fast) var(--ease-out);
}
.footer a:hover { color: var(--acid); }

/* ─────────────────────────────────────────────
 * §20 — Toast
 * ───────────────────────────────────────────── */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 10px 16px;
  background: var(--bg-1);
  border: 1px solid var(--stroke-2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn 220ms var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.toast::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--acid);
}
.toast.is-out {
  animation: toastOut 200ms var(--ease-out) forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* ─────────────────────────────────────────────
 * §21 — Countdown
 * ───────────────────────────────────────────── */
.countdown {
  border-color: color-mix(in oklab, var(--ember) 22%, var(--stroke));
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--ember) 6%, var(--surface-2)),
    color-mix(in oklab, var(--acid) 4%, var(--surface)));
}
.countdown .card-title {
  color: color-mix(in oklab, var(--ember) 80%, var(--text));
}
.countdown .card-title::before {
  background: var(--ember);
  box-shadow: 0 0 12px color-mix(in oklab, var(--ember) 80%, transparent);
}
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}
.cd-cell {
  position: relative;
  padding: 12px 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  overflow: hidden;
}
.cd-cell::after {
  /* 顶部细线，像数字框上沿 */
  content: "";
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: var(--ember);
  opacity: 0.4;
}
.cd-num {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-feature-settings: "tnum" on;
  line-height: 1;
}
.cd-unit {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.cd-meta {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
}
.cd-meta strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 460px) {
  .cd-num { font-size: 20px; }
  .cd-unit { font-size: 9px; }
}

/* ─────────────────────────────────────────────
 * §22 — Time series wrap
 * ───────────────────────────────────────────── */
.ts-wrap {
  margin-top: var(--space-3);
  height: 220px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.20), rgba(0, 0, 0, 0.06));
  padding: 6px;
  overflow: hidden;
}
[data-theme="light"] .ts-wrap {
  background: linear-gradient(180deg, rgba(28, 22, 14, 0.05), rgba(28, 22, 14, 0.02));
}
.ts-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ─────────────────────────────────────────────
 * §23 — Sampler diagnostics
 * ───────────────────────────────────────────── */
.sampler-diag {
  margin-top: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--blue) 28%, var(--stroke));
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--blue) 8%, var(--surface-2)),
    color-mix(in oklab, var(--blue) 2%, var(--surface)));
}
.diag-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.diag-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--blue) 80%, var(--text));
}
.diag-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 12px color-mix(in oklab, var(--blue) 80%, transparent);
}
.diag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 760px) {
  .diag-grid { grid-template-columns: 1fr; }
}
.diag-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.diag-line > span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.diag-line > strong {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
}

/* ─────────────────────────────────────────────
 * §24 — LSTM panel
 * ───────────────────────────────────────────── */
.lstm-status {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}
.lstm-status.is-ok {
  border-color: color-mix(in oklab, var(--acid) 38%, var(--stroke));
  color: color-mix(in oklab, var(--acid) 80%, var(--text));
}
.lstm-status.is-warn {
  border-color: color-mix(in oklab, var(--gold) 42%, var(--stroke));
  color: var(--gold);
}
.lstm-status.is-bad {
  border-color: color-mix(in oklab, var(--ember) 42%, var(--stroke));
  color: var(--ember-2);
}

.lstm-progress {
  height: 6px;
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  overflow: hidden;
}
.lstm-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--acid));
  transition: width 280ms var(--ease-out);
}

.lstm-curves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 760px) {
  .lstm-curves { grid-template-columns: 1fr; }
}

.curve-wrap {
  position: relative;
  padding: 8px 10px 4px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
}
.curve-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 2px;
}
.curve-legend {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* —— Prediction —— */
.prediction-pick {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--acid) 30%, var(--stroke));
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--acid) 10%, transparent),
    color-mix(in oklab, var(--acid) 2%, transparent));
  margin-bottom: 14px;
}
.prediction-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--acid) 80%, var(--text));
  font-weight: 700;
}
.prediction-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) {
  .prediction-cols { grid-template-columns: 1fr; }
}

.prob-row {
  display: grid;
  grid-template-columns: 32px 1fr 56px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 12.5px;
}
.prob-bar {
  display: block;
  height: 8px;
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.prob-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--blue) 80%, transparent),
    color-mix(in oklab, var(--acid) 80%, transparent));
  border-radius: 6px;
  transition: width 280ms var(--ease-out);
}
.prob-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.muted-ball {
  filter: grayscale(0.6) brightness(0.85);
  opacity: 0.55;
}

/* —— Backtest table —— */
.bt-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
}
.bt-table-wrap .table { margin: 0; }
.bt-table-wrap .row-primary {
  background: color-mix(in oklab, var(--blue) 10%, transparent);
}
.bt-table-wrap .row-primary td:first-child {
  color: color-mix(in oklab, var(--blue) 80%, var(--text));
  font-weight: 600;
}
.bt-table-wrap .row-theory {
  background: color-mix(in oklab, var(--gold) 8%, transparent);
}
.bt-table-wrap .row-theory td:first-child {
  font-style: italic;
  color: var(--muted);
}

/* ─────────────────────────────────────────────
 * §25 — Print
 * ───────────────────────────────────────────── */
@media print {
  .topbar,
  .footer,
  .top-actions,
  .tabs,
  .btn,
  .skip-link {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .card {
    box-shadow: none;
    border-color: #ddd;
    break-inside: avoid;
  }
}

/* ─────────────────────────────────────────────
 * §26 — Responsive · 桌面 → 平板 → 移动
 * 基于真实视口断点：1280 / 1080 / 760 / 600 / 460 / 400 / 360
 * ───────────────────────────────────────────── */

/* —— ≤1180 顶栏：tabs 独立行 —— */
@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px max(16px, calc((100vw - var(--max-w)) / 2 + 16px));
  }
  .tabs {
    grid-column: 1 / -1;
    order: 3;
    margin-top: 4px;
    -webkit-mask-image: linear-gradient(90deg,
      transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
            mask-image: linear-gradient(90deg,
      transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
  }
  .tab {
    padding: 8px 12px;
    font-size: 12.5px;
  }
}

/* —— ≤980 hero 单列 —— */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .ticket {
    align-items: flex-start;
    flex-direction: column;
  }
  .ticket-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* —— ≤760 移动端核心断点 —— */
@media (max-width: 760px) {
  /* 顶栏紧凑 */
  .topbar {
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 8px;
  }
  .brand-text .kicker { display: none; }
  .mark {
    width: 32px;
    height: 32px;
    padding: 3px;
  }
  .brand-text .name {
    font-size: 15px;
    line-height: 1.15;
  }

  /* 触摸友好的图标按钮 */
  .icon-btn {
    width: 38px;
    height: 38px;
  }
  .top-actions { gap: 6px; }

  /* 表格在窄屏强制横滚 */
  .table-wrap,
  .bt-table-wrap {
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg,
      #000 0, #000 calc(100% - 24px), transparent 100%);
            mask-image: linear-gradient(90deg,
      #000 0, #000 calc(100% - 24px), transparent 100%);
  }
  #prizeTable,
  #ssqPrizeTable { min-width: 540px; }
  .bt-matrix { min-width: 280px; }

  /* 表单元素 ≥40px 触摸高度 + 16px 防 iOS 自动放大 */
  .field input[type="number"],
  .field input[type="text"],
  .field input[type="email"],
  .field select {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 16px;
    line-height: 1.3;
    -webkit-appearance: none;
       -moz-appearance: textfield;
            appearance: none;
  }
  .field select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='none' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2 4l4 4 4-4'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
  }
  .field input[type="number"]::-webkit-outer-spin-button,
  .field input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }

  /* 顶栏 tab 触摸高度 */
  .tab {
    min-height: 36px;
    padding: 9px 13px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
  }

  /* footer 链接触摸 */
  .footer a {
    padding: 10px 8px;
    min-height: 36px;
    line-height: 1.4;
    display: inline-block;
    vertical-align: middle;
  }
  .footer {
    font-size: 12.5px;
    line-height: 1.6;
    gap: 8px;
  }
  .footer > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
  }

  /* hero 字号 */
  .hero {
    gap: var(--space-4);
    margin-bottom: var(--space-6);
  }
  .hero h1 {
    font-size: clamp(28px, 7vw, 42px) !important;
    line-height: 1.15 !important;
  }
  .hero .sub { font-size: 14px; }
  .hero-metrics { gap: 10px; }
  .metric { padding: 12px; }
  .metric .value { font-size: 16px; }

  /* 走势矩阵保留滚动 */
  .trend-wrap,
  .trend-svg-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* :focus 在小屏更明显 */
  .field input:focus,
  .field select:focus {
    outline: 2px solid color-mix(in oklab, var(--acid) 70%, transparent);
    outline-offset: 1px;
    border-color: var(--acid);
  }

  /* prize 表 */
  #prizeTable,
  #ssqPrizeTable {
    font-size: 12px;
  }
  #prizeTable th,
  #prizeTable td,
  #ssqPrizeTable th,
  #ssqPrizeTable td {
    padding: 6px 6px;
  }
}

/* —— 600~760 之间保留 panel-grid 2 列 —— */
@media (min-width: 601px) and (max-width: 760px) {
  .panel-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .panel-grid > .span-full { grid-column: 1 / -1; }
  .panel-grid > .card { padding: 14px; }
}

/* —— ≤640 中手机 —— */
@media (max-width: 640px) {
  .row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .field {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
  }
  .field input[type="number"],
  .field input[type="text"],
  .field select {
    width: 100% !important;
    min-width: 0;
  }
  .topbar { padding: 10px 14px; }
  .lottery-switcher a {
    padding: 5px 10px;
    font-size: 11.5px;
  }
  .btn {
    padding: 9px 14px;
    font-size: 13px;
  }
  .btn-copy {
    padding: 6px 10px;
    font-size: 11.5px;
  }
  .toast {
    left: 16px;
    right: 16px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    transform: none;
    max-width: none;
  }
}

/* —— ≤600 panel-grid 单列且更紧凑 —— */
@media (max-width: 600px) {
  .panel-grid { gap: 12px; }
  .panel-grid > .card { padding: 14px; }
  .card-title { font-size: 10.5px; }
}

/* —— ≤460 两列 metric —— */
@media (max-width: 460px) {
  .hero h1 { font-size: 26px !important; }
  .hero-metrics { grid-template-columns: 1fr 1fr; }
  .hero-metrics > .metric:nth-child(3) { grid-column: 1 / -1; }
  .rank li {
    padding: 6px 8px;
    gap: 6px;
  }
  .rank .ball {
    width: 22px !important;
    height: 22px !important;
    font-size: 10px !important;
  }
}

/* —— ≤414 (iPhone 13/14/15) —— */
@media (max-width: 414px) {
  .hero h1 { font-size: clamp(24px, 7.5vw, 32px) !important; }
  .hero {
    gap: 14px;
    margin-bottom: 18px;
  }
  .hero-eyebrow {
    font-size: 11px;
    padding: 5px 10px;
  }
  .hero .sub { font-size: 13px; }
  .metric { padding: 10px; }
  .metric .label { font-size: 9px; }
  .metric .value {
    font-size: 14px;
    margin-top: 6px;
  }
  .panel-grid > .card { padding: 13px; }
  .card-title {
    font-size: 10px;
    gap: 8px;
  }
  .btn {
    min-height: 40px;
    padding: 10px 14px;
    font-size: 13px;
  }
  .btn.ghost,
  .btn.primary { min-height: 40px; }
  .btn-copy {
    min-height: 30px;
    padding: 6px 10px;
  }
  .check {
    min-height: 36px;
    padding: 6px 0;
  }
  .check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    transform: scale(1.05);
  }
  .icon-btn {
    width: 38px !important;
    height: 38px !important;
  }
}

/* —— ≤400 极窄 —— */
@media (max-width: 400px) {
  .field { flex: 1 1 100%; }
  .ball {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .ball.plus::before { font-size: 14px; }
  .latest-row { gap: 12px; }
  .countdown-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .cd-cell { padding: 8px 4px; }
  .cd-num { font-size: 17px; }
  .cd-unit { font-size: 9px; }
  .cd-meta {
    font-size: 10.5px;
    line-height: 1.5;
  }
  .skip-link { left: 8px; top: 8px; }
}

/* —— ≤360 折叠屏 —— */
@media (max-width: 360px) {
  .hero h1 { font-size: 22px !important; }
  .topbar {
    padding-left: 10px;
    padding-right: 10px;
    gap: 6px;
  }
  .mark {
    width: 28px;
    height: 28px;
  }
  .brand-text .name { font-size: 13px; }
  .icon-btn {
    width: 36px !important;
    height: 36px !important;
  }
  .icon-btn svg {
    width: 14px;
    height: 14px;
  }
  .ball {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }
  .latest-row > div { font-size: 11px; }
  .cd-num { font-size: 14px; }
  .cd-cell { padding: 6px 2px; }
}

/* —— iOS 横屏 —— */
@media (max-width: 932px) and (orientation: landscape) {
  .topbar { position: relative; }
}

/* —— 安全区 —— */
@supports (padding: max(0px)) {
  .topbar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ─────────────────────────────────────────────
 * §27 — Model manager dialog
 * ───────────────────────────────────────────── */
.model-manager-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  color: var(--text);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.model-manager-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
}
.model-manager-dialog .mm-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--stroke);
}
.model-manager-dialog .mm-head strong {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--text-2);
}
.model-manager-dialog .mm-head .muted {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
}
.model-manager-dialog .mm-actions {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--stroke);
  background: var(--surface-2);
}
.model-manager-dialog .mm-actions input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}
.model-manager-dialog .mm-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px 18px;
}
.model-manager-dialog .mm-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--stroke);
}
.model-manager-dialog .mm-item:last-child { border-bottom: 0; }
.model-manager-dialog .mm-item.is-current {
  background: color-mix(in oklab, var(--acid) 8%, transparent);
  border-radius: 8px;
  padding-left: 12px;
  padding-right: 12px;
}
.model-manager-dialog .mm-meta {
  flex: 1;
  min-width: 0;
}
.model-manager-dialog .mm-key {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-manager-dialog .mm-meta .muted {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}
.model-manager-dialog .mm-row-actions {
  display: flex;
  gap: 4px;
}
.model-manager-dialog .btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
  min-height: 30px;
}
.model-manager-dialog .mm-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--stroke);
  background: var(--surface-2);
}

@media (max-width: 600px) {
  .model-manager-dialog {
    width: calc(100vw - 16px);
  }
  .model-manager-dialog .mm-list {
    max-height: 50vh;
    padding: 6px 12px;
  }
  .model-manager-dialog .mm-head,
  .model-manager-dialog .mm-actions,
  .model-manager-dialog .mm-foot {
    padding: 10px 12px;
  }
  .model-manager-dialog .mm-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .model-manager-dialog .mm-row-actions {
    justify-content: flex-end;
  }
}

/* —— A/B compare —— */
.model-manager-dialog .mm-cmp-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
}
.model-manager-dialog .mm-cmp-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--acid);
}
.model-manager-dialog .mm-compare-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: color-mix(in oklab, var(--acid) 6%, var(--surface-2));
  border-bottom: 1px solid var(--stroke);
  font-size: 12px;
}
.model-manager-dialog .mm-compare-bar #mmCompareHint {
  flex: 1;
  color: var(--muted);
}

.cmp-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(135deg,
    color-mix(in oklab, var(--acid) 6%, transparent),
    transparent 50%,
    color-mix(in oklab, var(--ember) 6%, transparent));
  border: 1px solid var(--stroke);
  border-radius: 12px;
}
.cmp-head-cell {
  min-width: 0;
}
.cmp-head-cell .cmp-tag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1.5px;
}
.cmp-head-cell .cmp-key {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
  word-break: break-all;
}
.cmp-head-cell .fine {
  display: block;
  margin-top: 2px;
}
.cmp-vs {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 24px;
  color: var(--ember);
  text-align: center;
  padding: 0 8px;
}

.cmp-metrics th,
.cmp-metrics td {
  padding: 8px 10px;
}

.cmp-curves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 720px) {
  .cmp-head {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 14px;
  }
  .cmp-vs {
    font-size: 16px;
    padding: 4px 0;
  }
  .cmp-curves { grid-template-columns: 1fr; }
  .model-manager-dialog .mm-cmp-check {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 4px;
  }
  .model-manager-dialog .mm-compare-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .model-manager-dialog .mm-compare-bar #mmCompareHint {
    flex: 1 1 100%;
  }
}

/* ─────────────────────────────────────────────
 * §28 — Backtest stats / explainer / tracker / conformal / RB
 * ───────────────────────────────────────────── */
.bt-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.bt-stat-card {
  padding: var(--space-4);
}
@media (max-width: 760px) {
  .bt-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* —— PWA update banner —— */
.pwa-update-banner {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--stroke-2);
  box-shadow: var(--shadow);
  font-size: 13px;
  max-width: calc(100vw - 24px);
  animation: pwaBannerIn 0.3s var(--ease-out);
}
@keyframes pwaBannerIn {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}
.pwa-update-banner .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}
@media (max-width: 480px) {
  .pwa-update-banner {
    left: 12px;
    right: 12px;
    transform: none;
    border-radius: 12px;
  }
}

/* —— Explainer card (号码体检) —— */
.explainer-card {
  padding: 14px;
}
.explainer-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 12px;
}
.explainer-score {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border: 2px solid var(--stroke);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
}
.explainer-score strong {
  font-size: 24px;
  line-height: 1;
}
.explainer-meta {
  flex: 1;
  min-width: 0;
}
.explainer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
}
.explainer-dim {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px 12px;
}
.explainer-dim-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.explainer-dim-icon {
  font-size: 16px;
}
.explainer-dim-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  margin: 6px 0;
  overflow: hidden;
}
.explainer-dim-bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s var(--ease-out);
}
.explainer-dim-reason {
  margin-top: 4px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .explainer-grid { grid-template-columns: 1fr; }
  .explainer-head { gap: 10px; }
  .explainer-score {
    width: 56px;
    height: 56px;
  }
  .explainer-score strong { font-size: 20px; }
}

/* —— Prediction Tracker —— */
.tracker-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.tracker-stat {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}
.tracker-stat-num {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1.1;
  color: var(--text);
}
.tracker-metric .diag-grid { margin-bottom: 10px; }
.tracker-hist {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}
.tracker-hist-row {
  display: grid;
  grid-template-columns: 24px 1fr 92px;
  align-items: center;
  gap: 8px;
}
.tracker-hist-label {
  font-size: 11px;
  color: var(--text-2);
  text-align: right;
}
.tracker-hist-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
}
.tracker-hist-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--acid), var(--blue));
  border-radius: 4px;
  transition: width 0.3s var(--ease-out);
}
.tracker-hist-val {
  font-size: 11px;
  color: var(--text-2);
}
.tracker-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.tracker-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tracker-table th,
.tracker-table td {
  padding: 6px 8px;
  font-size: 12px;
}
.tracker-table tr.row-pending { opacity: 0.55; }

@media (max-width: 600px) {
  .tracker-summary {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .tracker-stat { padding: 10px 4px; }
  .tracker-stat-num { font-size: 20px; }
  .tracker-hist-row {
    grid-template-columns: 18px 1fr 78px;
  }
  .tracker-table { font-size: 11px; }
}

/* —— Conformal slider —— */
.conformal-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 10px;
}
.conformal-controls .field {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}
.conformal-controls input[type="range"] {
  width: 100%;
  accent-color: var(--acid);
}
.conformal-controls #conformalAlphaVal {
  font-size: 14px;
  color: var(--acid);
  font-weight: 600;
}
.card-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 720px) {
  .card-group { grid-template-columns: 1fr; }
  .conformal-controls .field {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* —— Rational Betting —— */
.rb-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.rb-controls .field {
  flex: 1;
  min-width: 160px;
}
.rb-controls input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}
.rb-controls input[type="number"]:focus {
  outline: none;
  border-color: var(--acid);
}
@media (max-width: 600px) {
  .rb-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .rb-controls .field { min-width: 0; }
}
