:root {
  color-scheme: light dark;

  /* 背景层阶 */
  --bg: #f6f8fb;
  --bg-sunken: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --focus: #2563eb;

  /* 文字 */
  --text: #1e293b;
  --text-2: #475569;
  --text-3: #64748b;
  --text-inv: #ffffff;

  /* 品牌 */
  --brand: #2563eb;
  --brand-soft: #eff4ff;
  --brand-2: #10b981;

  /* 产品色：ink 用于线与文字（>= 3:1），tint 用于面积与装饰 */
  --ss: #167dcc;
  --ss-tint: #57baff;
  --ss-soft: #e8f4fd;

  --fd: #e5484d;
  --fd-tint: #ff6b6b;
  --fd-soft: #fff0f0;

  --total: #334155;

  /* 语义涨跌色（不与产品色复用） */
  --up: #059669;
  --up-soft: #ecfdf5;
  --down: #dc2626;
  --down-soft: #fef2f2;
  --flat: #64748b;
  --flat-soft: #f1f5f9;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --info-soft: #eff6ff;

  /* 阴影 */
  --sh-1: 0 1px 2px rgb(15 23 42 / 0.04), 0 1px 1px rgb(15 23 42 / 0.03);
  --sh-2: 0 4px 16px -4px rgb(15 23 42 / 0.08), 0 2px 4px rgb(15 23 42 / 0.04);
  --sh-pop: 0 12px 32px -8px rgb(15 23 42 / 0.18);

  /* 圆角与间距 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;

  --gap: clamp(12px, 1.6vw, 20px);
  --pad-card: clamp(16px, 2vw, 24px);

  /* 字阶与排版 */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: clamp(0.75rem, 0.72rem + 0.1vw, 0.8125rem);
  --fs-sm: clamp(0.8125rem, 0.79rem + 0.12vw, 0.875rem);
  --fs-md: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
  --fs-lg: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-hero: clamp(2.25rem, 1.6rem + 2.8vw, 3.5rem);

  --lh-tight: 1.15;
  --lh: 1.6;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;
  --dur-slow: 320ms;
}

:root[data-theme="dark"] {
  --bg: #16162b;
  --bg-sunken: #121224;
  --surface: #1e1e36;
  --surface-2: #25253f;
  --surface-hover: #2a2a47;
  --border: #2f2f4d;
  --border-strong: #3d3d60;
  --focus: #7aa7ff;

  --text: #e8e8ec;
  --text-2: #b6b6c8;
  --text-3: #8c8ca4;
  --text-inv: #ffffff;

  --brand: #7aa7ff;
  --brand-soft: #232a4a;
  --brand-2: #34d399;
  --gold: #ffd23f;

  --ss: #57baff;
  --ss-tint: #57baff;
  --ss-soft: #1c2e48;

  --fd: #ffaf27;
  --fd-tint: #ffaf27;
  --fd-soft: #3a2c17;

  --total: #c8c8d8;

  --up: #34d399;
  --up-soft: #173a30;
  --down: #f87171;
  --down-soft: #3d1f26;
  --flat: #9a9ab0;
  --flat-soft: #2a2a44;
  --warn: #fbbf24;
  --warn-soft: #3a3018;
  --info-soft: #1f2a48;

  --sh-1: 0 1px 2px rgb(0 0 0 / 0.3);
  --sh-2: 0 6px 20px -6px rgb(0 0 0 / 0.5);
  --sh-pop: 0 16px 40px -10px rgb(0 0 0 / 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16162b;
    --bg-sunken: #121224;
    --surface: #1e1e36;
    --surface-2: #25253f;
    --surface-hover: #2a2a47;
    --border: #2f2f4d;
    --border-strong: #3d3d60;
    --focus: #7aa7ff;

    --text: #e8e8ec;
    --text-2: #b6b6c8;
    --text-3: #8c8ca4;
    --text-inv: #ffffff;

    --brand: #7aa7ff;
    --brand-soft: #232a4a;
    --brand-2: #34d399;
    --gold: #ffd23f;

    --ss: #57baff;
    --ss-tint: #57baff;
    --ss-soft: #1c2e48;

    --fd: #ffaf27;
    --fd-tint: #ffaf27;
    --fd-soft: #3a2c17;

    --total: #c8c8d8;

    --up: #34d399;
    --up-soft: #173a30;
    --down: #f87171;
    --down-soft: #3d1f26;
    --flat: #9a9ab0;
    --flat-soft: #2a2a44;
    --warn: #fbbf24;
    --warn-soft: #3a3018;
    --info-soft: #1f2a48;

    --sh-1: 0 1px 2px rgb(0 0 0 / 0.3);
    --sh-2: 0 6px 20px -6px rgb(0 0 0 / 0.5);
    --sh-pop: 0 16px 40px -10px rgb(0 0 0 / 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font: 400 var(--fs-md) / var(--lh) var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

button,
input {
  font: inherit;
  color: inherit;
}

.num,
td.num,
[data-num] {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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