/* OneOneTyping v6 — design tokens.
 *
 * Two lessons are baked into this file, both learned by measuring rather than
 * guessing.
 *
 * 1. THE ACCENT IS A GARNISH, NOT A SURFACE.
 *    On andromeld — the page whose green reads so well — only 91 elements out
 *    of thousands carry the green, and its total painted background is 42,000
 *    px² against 2,200,000 px² of near-neutral off-white. Every heading on that
 *    page is near-black (#101012). The accent shows up on kickers, small icon
 *    chips, buttons, caption indices and links, and nowhere else.
 *
 *    The previous revision of this file did the opposite: blue headings, a 2px
 *    blue border on every card. That is what made it look cheap. Here the
 *    accent is rationed the same way and headings are near-black again.
 *
 * 2. BLUE NEEDS TO BE DARKER THAN GREEN TO CARRY THE SAME WEIGHT.
 *    sRGB simply cannot hold a blue as chromatic as #0e8f45 at the same
 *    lightness. Matching on L* and contrast instead gives #0e7fd4:
 *
 *      andromeld green  #0e8f45   L* 52.0   C* 57.6   contrast-on-white 4.17
 *      our blue         #0e7fd4   L* 51.9   C* 51.6   contrast-on-white 4.20
 *
 *    and for the solid button fill, matching #0c7f3e (L* 46.5, 5.10):
 *
 *      andromeld button #0c7f3e   L* 46.5   C* 52.2   contrast 5.10
 *      our button       #0f74c4   L* 47.7   C* 49.1   contrast 4.87
 *
 * Four semantic roles, never mixed:
 *   structure = blue   (links, buttons, kickers, progress, active states)
 *   action    = gold   (the one primary CTA per page, VIP, medals)
 *   done      = green  (completed, correct glyphs)
 *   error     = red    (mistyped characters, error stats)
 */

:root {
  color-scheme: light;

  /* ---- Accent: matched to andromeld's green ---------------------------
     The green is #0e8f45: L* 52.0, chroma 57.6, 4.17:1 on white. A blue at
     that exact lightness only reaches chroma 51.6 — sRGB cannot hold more —
     and because saturated blues read lighter than their L* suggests
     (Helmholtz-Kohlrausch), an exact lightness match still feels washed out.

     Going a few steps deeper closes the gap:

       #0e7fd4   L* 51.9   C* 51.6   4.20:1   exact match, still looks pale
       #0d76c9   L* 48.6   C* 50.7   4.72:1   what we use
       #0c6dbd   L* 45.2   C* 49.3   5.33:1   button fill

     The deeper accent is what makes it read as a confident blue, and 4.72:1
     also clears AA for text where the exact match only scraped it. */
  --accent: #0d76c9;
  --accent-deep: #0c6dbd;          /* solid fills under white text (5.33:1) */
  --accent-hover: #0a5ca6;
  --accent-ink: #0a5ca6;           /* accent as text on white (6.79:1) */
  --accent-soft: rgba(13, 118, 201, 0.1);
  --accent-tint: #eaf4fd;          /* the palest blue surface */
  --accent-line: rgba(13, 118, 201, 0.24);
  --accent-mid: #8fc8f0;

  --glow-a: rgba(63, 165, 240, 0.16);
  --glow-b: rgba(90, 130, 230, 0.12);

  /* Kept as names because components already reference them. */
  --blue: var(--accent);
  --blue-deep: var(--accent-deep);
  --blue-hover: var(--accent-hover);
  --blue-dark: var(--accent-ink);
  --blue-soft: var(--accent-tint);
  --blue-mid: var(--accent-line);
  --blue-ink: var(--accent-ink);
  --banner: var(--accent);
  --banner-ink: #ffffff;

  /* ---- Gold: the CTA family, from typing.com --------------------------- */
  --gold-100: #fcf2d9;
  --gold-200: #f9e4b2;
  --gold-300: #f7d78c;
  --gold-400: #f4c965;
  --gold-500: #f1bc3f;
  --gold-600: #d0a74d;

  --gold: var(--gold-400);
  --gold-ink: #604b19;
  --gold-soft: var(--gold-100);
  --gold-soft-ink: #604b19;
  --gold-dark: var(--gold-500);
  --gold-lip: var(--gold-600);

  /* ---- Functional ------------------------------------------------------ */
  --green: #71b16b;
  --green-ink: #2f855a;

  /* GitHub's contribution ramp, light mode — measured from the live page so the
     calendar reads as the same object as the one people already know. */
  --cal-0: #eff2f5;
  --cal-1: #aceebb;
  --cal-2: #4ac26b;
  --cal-3: #2da44e;
  --cal-4: #116329;
  --cal-line: rgba(31, 35, 40, 0.05);
  --green-soft: #effaf0;
  --green-line: #ace7b6;

  --red: #eb5757;
  --red-ink: #c53030;
  --red-soft: #fdecec;

  --orange: #b7791f;
  --orange-soft: #fdf6e3;

  --sem-structure: var(--accent);
  --sem-action: var(--gold);
  --sem-done: var(--green);
  --sem-error: var(--red);
  --brand: var(--accent);

  /* ---- Surfaces: near-neutral, barely tinted --------------------------- */
  /* andromeld's floor is #f3f7f4 — white with the faintest green cast. Ours is
     the same idea one hue over, and it stays this quiet on purpose: the accent
     has to be the only saturated thing on the page. */
  --bg: #f6f8fa;
  --bg-elevated: #ffffff;
  --bg-soft: #f3f7fa;
  --bg-sunken: #eceff3;
  --bg-tint: var(--accent-tint);
  --line: rgba(0, 0, 0, 0.11);
  --line-soft: rgba(0, 0, 0, 0.07);
  --border: var(--line);
  --border-strong: rgba(0, 0, 0, 0.18);

  /* ---- Ink -------------------------------------------------------------- */
  /* Headings are near-black. This is the single biggest correction from the
     previous revision, which painted them blue. */
  --text: #56565e;                 /* 7.3:1 — body */
  --text-strong: #101012;          /* 18.9:1 — every heading */
  --text-muted: #63676e;           /* 5.7:1 */
  --text-dim: #686c71;             /* 5.3:1 白底、4.9:1 浅灰底（10-28 从 #6f7378 加深：浅灰底上只有 4.4:1） */
  --text-invert: #ffffff;

  /* ---- Typing surfaces --------------------------------------------------- */
  --lesson-ink: #4a4a4a;
  --correct: var(--green);
  --correct-ink: #5f9e59;
  --correct-soft: var(--green-soft);
  --wrong: var(--red);
  --wrong-ink: #c53030;
  --caret: #0099ff;
  --rule: #d9d9d9;              /* the hairline under each passage line */

  /* ---- Geometry ----------------------------------------------------------- */
  --radius-ctl: 6px;
  --radius-card: 12px;
  --radius-card-lg: 16px;
  --radius-pill: 9999px;
  --radius: var(--radius-card);
  --radius-sm: var(--radius-ctl);
  --radius-btn: 8px;

  /* Cards are defined by a hairline and a barely-there shadow, not a colour. */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 10px -2px rgba(16, 24, 40, 0.08),
    0 2px 4px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 18px 32px -12px rgba(16, 24, 40, 0.18),
    0 4px 10px -4px rgba(16, 24, 40, 0.08);
  --shadow-banner: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-shot: 0 1px 2px rgba(16, 24, 40, 0.06),
    0 24px 48px -28px rgba(16, 24, 40, 0.35);
  --shadow-key: 0 1px 0 var(--line);
  --shot-border: rgba(0, 0, 0, 0.08);
  --focus-ring: 0 0 0 3px rgba(13, 118, 201, 0.26);

  /* ---- Motion -------------------------------------------------------------- */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-rise: cubic-bezier(0.2, 0.7, 0.2, 1);

  /* ---- Type ---------------------------------------------------------------- */
  --font-sans: 'Quicksand', system-ui, -apple-system, BlinkMacSystemFont,
    'SF Pro SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
    'Noto Sans SC', sans-serif;
  --font-mono: 'Roboto Mono', ui-monospace, 'SF Mono', SFMono-Regular, Menlo,
    Consolas, 'Courier New', monospace;
  --font-brand: var(--font-sans);

  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 17px;
  --fs-xl: 21px;
  --fs-2xl: 28px;
  --fs-display: clamp(34px, 5.4vw, 60px);

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* ---- Layout ---------------------------------------------------------------- */
  --max: 1120px;
  --max-wide: 1280px;
  --maxw: 1072px;
  --max-prose: 680px;
  /* the page's side margin: every column (nav, page header, body) uses it, so their edges line up */
  --gutter: 24px;
  --nav-h: 56px;

  --nav-bg: rgba(255, 255, 255, 0.85);
  --nav-ink: #101012;
}

/* Big screens: the content column grows with the window, smoothly and only
   so far — a 1440 laptop keeps 1072px, a 1536 one (1920 at 125%) about 1100,
   a 1080p screen about 1240, a 2K screen stops at 1360. Wider than that read
   as too wide (2026-10-09: 1552px on 2K). Pages lay out in fluid grids, so
   more width is more columns, not stretched lines; prose keeps --max-prose. */
@media (min-width: 1440px) {
  :root {
    --max: clamp(1120px, 35vw + 616px, 1408px);
    --maxw: calc(var(--max) - 48px);
    --max-wide: calc(var(--max) + 160px);
  }
}
@media (max-width: 720px) {
  :root { --gutter: 18px; }
}

/* Dark theme — same roles, re-pitched. The accent lifts so it still reads as
   the one saturated thing on the page. */
html[data-theme='dark'] {
  --skel-a: rgba(255, 255, 255, 0.05);
  --skel-b: rgba(255, 255, 255, 0.1);
  color-scheme: dark;

  --accent: #3d9ae4;
  --accent-deep: #1a659e;
  --accent-hover: #14507c;
  --accent-ink: #74bcf0;
  --accent-soft: rgba(61, 154, 228, 0.14);
  --accent-tint: #13202c;
  --accent-line: rgba(61, 154, 228, 0.28);
  --accent-mid: #2b5f8a;

  --glow-a: rgba(63, 159, 232, 0.14);
  --glow-b: rgba(90, 130, 230, 0.1);

  --gold-100: #33280f;
  --gold-200: #4a3a15;
  --gold-300: #6b5320;
  --gold-400: #e8b93d;
  --gold-500: #f0cd6a;
  --gold-600: #b8912f;

  --gold: var(--gold-400);
  --gold-ink: #2a2212;
  --gold-soft: var(--gold-100);
  --gold-soft-ink: var(--gold-500);
  --gold-dark: var(--gold-500);
  --gold-lip: var(--gold-600);

  --green: #57b957;
  --green-ink: #8ed08c;
  --cal-0: #21262d;
  --cal-1: #0e4429;
  --cal-2: #006d32;
  --cal-3: #26a641;
  --cal-4: #39d353;
  --cal-line: rgba(240, 246, 252, 0.06);
  --green-soft: #16331a;
  --green-line: #2f5c39;

  --red: #fc8181;
  --red-ink: #fc8181;
  --red-soft: #3a2224;
  --orange: #e0a34a;
  --orange-soft: #33260f;

  --bg: #101113;
  --bg-elevated: #17191c;
  --bg-soft: #131518;
  --bg-sunken: #0b0c0d;
  --bg-tint: #13202c;
  --line: rgba(255, 255, 255, 0.13);
  --line-soft: rgba(255, 255, 255, 0.08);
  --border: var(--line);
  --border-strong: rgba(255, 255, 255, 0.22);

  --text: #b9b9bf;
  --text-strong: #f4f4f5;
  --text-muted: #a1a1a8;
  --text-dim: #8e8e96;
  --text-invert: #101113;

  --lesson-ink: #c9c9ce;
  --correct-ink: #8ed08c;
  --wrong-ink: #fc8181;
  --caret: #63b3ed;
  --rule: rgba(255, 255, 255, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);
  --shadow-shot: 0 1px 2px rgba(0, 0, 0, 0.5),
    0 24px 50px -26px rgba(0, 0, 0, 0.8);
  --shadow-key: 0 1px 0 rgba(255, 255, 255, 0.06);
  --shot-border: rgba(255, 255, 255, 0.12);

  --nav-bg: rgba(16, 17, 19, 0.85);
  --nav-ink: #f4f4f5;
  --focus-ring: 0 0 0 3px rgba(63, 159, 232, 0.35);
}

/* ==========================================================================
   OneOne 设计体系 · 地基（2026-11-10，docs/方案/OneOne设计体系-2026-11-10.md）
   只加新变量，上面已有的一个没动，所以现在的页面不会变样。
   三层：原始色阶（--c-*，不分深浅色）→ 语义（上面的 --accent、--text-strong…）→ 场景（前台 / 后台 / 打字台各自的皮）。
   以后新颜色先从色阶里挑，不再在页面里写颜色值；design-drift 检查会拦。
   ========================================================================== */
:root {
  /* 原始色阶：node tools/design/scales.cjs 生成，换网站时改那里的本色重跑。
     白底上当文字用 600 以上（绿 700）；当图形、线条用 500 以上；深色底上用 400 以下。 */
  --c-blue-50: #e8f9ff; --c-blue-100: #daf0ff; --c-blue-200: #c0deff; --c-blue-300: #9fc8f4; --c-blue-400: #79b0e8; --c-blue-500: #5297db; --c-blue-600: #0d76c9; --c-blue-700: #005fad; --c-blue-800: #00448d; --c-blue-900: #002b6e;
  --c-sky-50: #e7f9ff; --c-sky-100: #d7f0ff; --c-sky-200: #b9e0ff; --c-sky-300: #92cafc; --c-sky-400: #58acf2; --c-sky-500: #4698dc; --c-sky-600: #2b7dbc; --c-sky-700: #09629d; --c-sky-800: #00487e; --c-sky-900: #002f61;
  --c-pink-50: #ffeff9; --c-pink-100: #ffe0f0; --c-pink-200: #ffc6df; --c-pink-300: #ffa2ca; --c-pink-400: #e48bb2; --c-pink-500: #c77499; --c-pink-600: #a85a7d; --c-pink-700: #8a4163; --c-pink-800: #6d294a; --c-pink-900: #511132;
  --c-gold-50: #fff6db; --c-gold-100: #ffebc0; --c-gold-200: #f8d78b; --c-gold-300: #f4c965; --c-gold-400: #cda543; --c-gold-500: #b38c29; --c-gold-600: #967100; --c-gold-700: #7a5700; --c-gold-800: #5f3e00; --c-gold-900: #452700;
  --c-green-50: #e9fdee; --c-green-100: #daf5e1; --c-green-200: #c0e6c9; --c-green-300: #9ed3ac; --c-green-400: #76be8b; --c-green-500: #2f9e5b; --c-green-600: #1c8e4d; --c-green-700: #007236; --c-green-800: #00571f; --c-green-900: #003d07;
  --c-teal-50: #e5fcff; --c-teal-100: #d5f3f8; --c-teal-200: #b7e4ec; --c-teal-300: #90d1db; --c-teal-400: #5ebbc9; --c-teal-500: #0ea5b7; --c-teal-600: #008899; --c-teal-700: #006d7d; --c-teal-800: #005261; --c-teal-900: #003947;
  --c-purple-50: #f4f3ff; --c-purple-100: #eae9ff; --c-purple-200: #d7d4ff; --c-purple-300: #bfbbff; --c-purple-400: #a69ef5; --c-purple-500: #8d80eb; --c-purple-600: #6b4fd8; --c-purple-700: #5c3fc3; --c-purple-800: #4622a0; --c-purple-900: #31007f;
  --c-red-50: #ffedea; --c-red-100: #ffe0dc; --c-red-200: #ffc7c3; --c-red-300: #ffa8a3; --c-red-400: #f88380; --c-red-500: #e5484d; --c-red-600: #cf373e; --c-red-700: #ad1527; --c-red-800: #8b000f; --c-red-900: #6b0000;
  --c-orange-50: #fff1e2; --c-orange-100: #ffe5d0; --c-orange-200: #ffcfb0; --c-orange-300: #f9b286; --c-orange-400: #e8833a; --c-orange-500: #d6752b; --c-orange-600: #b65a04; --c-orange-700: #974100; --c-orange-800: #782700; --c-orange-900: #5a0b00;
  --c-gray-50: #f5f7fa; --c-gray-100: #ebedf1; --c-gray-200: #d8dbe0; --c-gray-300: #c0c4cc; --c-gray-400: #a6abb5; --c-gray-500: #8c929e; --c-gray-600: #6b7280; --c-gray-700: #575e6b; --c-gray-800: #3f4551; --c-gray-900: #292e38;

  /* 圆角六档（同 网站设计风格.md 第五节） */
  --r-xs: 6px; --r-sm: 10px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-pill: 999px;

  /* 层级：谁盖在谁上面。新写 z-index 只用这几个 */
  --z-base: 0; --z-raised: 10; --z-sticky: 50; --z-menu: 60; --z-toast: 400; --z-sheet: 1000; --z-top: 1100;

  /* 高度（阴影）四档：平放、浮起（悬停的卡片）、菜单和提示、弹层 */
  --elev-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --elev-2: 0 1px 3px rgba(16, 24, 40, 0.06), 0 8px 20px -12px rgba(16, 24, 40, 0.22);
  --elev-3: 0 14px 38px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.06);
  --elev-4: 0 28px 70px rgba(15, 35, 60, 0.24), 0 3px 8px rgba(15, 35, 60, 0.08);

  /* 断点（CSS 媒体查询不能用变量，这里写给 JS 和人看）：手机 375 · 小屏 560 · 平板 820 · 电脑 1280。
     新写 @media 只用 560 / 820 / 1280 这三个切点。 */
  --bp-sm: 560px; --bp-md: 820px; --bp-lg: 1280px;

  /* 图表配色：系列按顺序取，颜色旁边一定写字。指标色一个指标全站同一个颜色。 */
  --chart-1: var(--c-blue-600); --chart-2: var(--c-teal-600); --chart-3: var(--c-gold-500);
  --chart-4: var(--c-purple-600); --chart-5: var(--c-pink-500); --chart-6: var(--c-green-600);
  --chart-speed: var(--c-blue-600);      /* 速度 */
  --chart-acc: var(--c-green-600);       /* 准确率 */
  --chart-time: var(--c-teal-600);       /* 时长 */
  --chart-xp: var(--c-gold-500);         /* 经验、成长值 */
  --chart-count: var(--c-purple-600);    /* 次数、字数 */
  --chart-error: var(--c-red-500);       /* 打错 */
  --chart-avg: var(--c-gold-400);        /* 平均线（和后台线上那条一样亮） */
  --chart-prev: var(--c-gray-300);       /* 上一期对照 */
  --chart-grid: var(--line-soft);
  /* 测速走势：柱子按准确率分三档；那张图的平均线是深蓝（收入、后台的平均线是金色） */
  /* 照测速页 11-07 站长选的 A 版：上浅下深两种颜色 */
  --chart-acc-hi: #0d76c9; --chart-acc-hi-top: #2f8bd8;
  --chart-acc-mid: #8fc8f0; --chart-acc-mid-top: #b4dbf6;
  --chart-acc-lo: #ef8a85; --chart-acc-lo-top: #f6a8a3;
  --chart-avg-ink: #22415f;
  /* 钱（收入、个人会员）：蜜黄，上浅下深；平均线深一档才看得清（11-11 站长在 A 金 / B 蜜黄 / C 暖橙里选了 B） */
  --chart-money: var(--c-gold-300); --chart-money-top: var(--c-gold-200); --chart-money-avg: var(--c-gold-500);
}
html[data-theme='dark'] {
  --elev-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --elev-2: 0 1px 3px rgba(0, 0, 0, 0.4), 0 10px 24px -12px rgba(0, 0, 0, 0.6);
  --elev-3: 0 14px 38px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --elev-4: 0 28px 70px rgba(0, 0, 0, 0.65), 0 3px 8px rgba(0, 0, 0, 0.4);
  --chart-1: var(--c-blue-400); --chart-2: var(--c-teal-400); --chart-3: var(--c-gold-300);
  --chart-4: var(--c-purple-400); --chart-5: var(--c-pink-300); --chart-6: var(--c-green-400);
  --chart-speed: var(--c-blue-400); --chart-acc: var(--c-green-400); --chart-time: var(--c-teal-400);
  --chart-xp: var(--c-gold-300); --chart-count: var(--c-purple-400); --chart-error: var(--c-red-400);
  --chart-avg: var(--c-gold-300); --chart-prev: var(--c-gray-700);
  --chart-acc-hi: #3d9ae4; --chart-acc-hi-top: #5aaaf2;
  --chart-acc-mid: #2b5f8a; --chart-acc-mid-top: #3b6d99;
  --chart-acc-lo: #d9736e; --chart-acc-lo-top: #e58a85;
  --chart-avg-ink: #dbe7f2;
  --chart-money: var(--c-gold-400); --chart-money-top: var(--c-gold-300); --chart-money-avg: var(--c-gold-200);
}

/* 密度：后台、老师大屏这种一屏要看很多的地方，在外层加 data-density="compact"，零件自己收紧 */
[data-density='compact'] { --ui-gap: 14px; --ui-pad: 16px; --sp-4: 12px; --sp-5: 16px; }
