/* ============================================================
   设计令牌 —— 雅思工作台
   配色取自 dataviz 技能已校验色板（明暗双主题）
   ============================================================ */

:root {
  /* 页面与表面 */
  --page: #f9f9f7;
  --surface: #ffffff;
  --surface-2: #f2f1ec;
  --line: #e1e0d9;
  --grid: #e1e0d9;

  /* 文字 */
  --ink: #1c1c1a;
  --ink-2: #57564f;
  --ink-3: #6f6e66;

  /* 品牌与学科色（听=蓝 读=橙 写=青 说=黄，图表槽位同源） */
  --brand: #2266b8;        /* 大面积底色（白字对比度 ≥4.5） */
  --brand-ink: #1a4f8f;   /* 文字/边框/焦点环用色（浅底上对比度 ≥4.5） */
  --brand-soft: #e3eefb;
  --L: #2a78d6;
  --L-soft: #e3eefb;
  --R: #eb6834;
  --R-soft: #fde8de;
  --W: #1baf7a;
  --W-soft: #ddf2ea;
  --S: #eda100;
  --S-soft: #fdf1d4;

  /* 语义色 */
  --good: #0ca30c;
  --good-soft: #e0f4e0;
  --warn: #fab219;
  --warn-soft: #fdf0d3;
  --critical: #d03b3b;
  --critical-soft: #fbe3e3;

  /* 学科/语义色对应的文字色（配 soft 底，小字对比度 ≥4.5） */
  --L-ink: #1a5cb0;
  --R-ink: #b34715;
  --W-ink: #0c7d54;
  --S-ink: #8a6200;
  --good-ink: #087a08;
  --warn-ink: #8a6200;
  --critical-ink: #b32424;

  /* 形状与层次 */
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --shadow-s: 0 1px 3px rgba(28, 28, 26, 0.08);
  --shadow-m: 0 4px 16px rgba(28, 28, 26, 0.12);
  --shadow-l: 0 12px 40px rgba(28, 28, 26, 0.2);

  /* 尺寸 */
  --header-h: 48px;
  --tabbar-h: 56px;
  --content-max: 720px;

  /* 字体 */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-num: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* 深色主题 */
:root[data-theme="dark"] {
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --line: #33332f;
  --grid: #3a3a36;
  --ink: #ffffff;
  --ink-2: #b8b7ae;
  --ink-3: #8f8e86;
  --brand-ink: #6aa7ea;
  --brand-soft: #17324f;
  --L-soft: #17324f;
  --R-soft: #4b2a18;
  --W-soft: #14382b;
  --S-soft: #46380f;
  --good-soft: #14351a;
  --warn-soft: #46360f;
  --critical-soft: #4b1d1d;
  --L-ink: #6aa7ea;
  --R-ink: #f0a281;
  --W-ink: #63d6a8;
  --S-ink: #f5c34a;
  --good-ink: #5fd35f;
  --warn-ink: #f5c34a;
  --critical-ink: #ee8484;
  --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-m: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-l: 0 12px 40px rgba(0, 0, 0, 0.65);
}

/* 自动模式：跟随系统 */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --line: #33332f;
    --grid: #3a3a36;
    --ink: #ffffff;
    --ink-2: #b8b7ae;
    --ink-3: #8f8e86;
    --brand-ink: #6aa7ea;
    --brand-soft: #17324f;
    --L-soft: #17324f;
    --R-soft: #4b2a18;
    --W-soft: #14382b;
    --S-soft: #46380f;
    --good-soft: #14351a;
    --warn-soft: #46360f;
    --critical-soft: #4b1d1d;
    --L-ink: #6aa7ea;
    --R-ink: #f0a281;
    --W-ink: #63d6a8;
    --S-ink: #f5c34a;
    --good-ink: #5fd35f;
    --warn-ink: #f5c34a;
    --critical-ink: #ee8484;
    --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-m: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-l: 0 12px 40px rgba(0, 0, 0, 0.65);
  }
}

/* ============================================================
   基础重置与排版
   ============================================================ */

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

* {
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--page);
  min-height: 100dvh;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
}

a {
  color: var(--brand-ink);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input, textarea, select {
  font: inherit;
  color: inherit;
  caret-color: var(--brand-ink);
}

::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

svg.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

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

::selection {
  background: var(--brand);
  color: #fff;
}

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