/* ============================================================
   408 图示讲义 · 全局配色令牌（唯一允许出现色值的地方）
   ------------------------------------------------------------
   三套皮肤：day 日间 / night 夜间 / eye 护眼
   切换：<html data-theme="day|night|eye">
   规则：lesson.css / index.css / 所有页面 一律只写 var(--token)，
        禁止再出现任何十六进制或 rgb() 色值。
   ============================================================ */

:root,
html[data-theme="day"]{
  color-scheme: light;

  /* —— 底色与表面 —— */
  --bg:#f4f6fb;
  --hero-glow-1:#e8efff;
  --hero-glow-2:#eafaf3;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --surface-3:#fcfdff;
  --surface-4:#f1f5f9;
  --brand-tint:#f8fbff;

  /* —— 描边 —— */
  --line:#e6e9f0;
  --line-2:#dbe3f2;
  --line-3:#cbd5e1;

  /* —— 文字 —— */
  --ink:#111827;
  --ink-2:#334155;
  --ink-3:#1f2937;
  --muted:#646f7e;
  --faint:#9aa5b6;
  --on-brand:#ffffff;

  /* —— 主色 —— */
  --brand:#2563eb;
  --brand-strong:#1d4ed8;
  --brand-soft:#eff4ff;
  --brand-ink:#1e40af;
  --brand-edge:#bfd0f5;

  /* —— 成功 / 已确定 —— */
  --ok:#10b981;
  --ok-soft:#ecfdf5;
  --ok-fill:#f2fdf8;
  --ok-ink:#047857;
  --ok-deep:#134e4a;
  --ok-line:#bdf0da;
  --ok-line-2:#d9f7e9;

  /* —— 进行中 / 提示 —— */
  --move:#f59e0b;
  --move-soft:#fffbeb;
  --move-ink:#b45309;
  --warn:#ea580c;
  --warn-soft:#fff7ed;
  --warn-line:#fed7aa;
  --warn-ink:#78350f;

  /* —— 警示 / 反例 —— */
  --bad:#ef4444;
  --bad-soft:#fef2f2;
  --bad-ink:#b91c1c;
  --bad-line:#fecaca;

  /* —— 双旋 / 次要强调 —— */
  --violet:#7c3aed;
  --violet-soft:#f5f0ff;

  /* —— 判定右栏 —— */
  --sky:#0284c7;
  --sky-soft:#f0f9ff;

  /* —— 图内元素 —— */
  --node-fill:#ffffff;
  --node-stroke:#94a3b8;
  --node-ink:#334155;
  --edge:#cbd5e1;
  --edge-faint:#dbe3ef;

  /* —— 考情图表：四科序列色 —— */
  --chart-ds:#2563eb;
  --chart-co:#0ea5e9;
  --chart-os:#10b981;
  --chart-cn:#f59e0b;

  /* —— 考情图表：热力四档 + 格内文字 —— */
  --heat-0:#eef2f7;
  --heat-1:#dbeafe;
  --heat-2:#93c5fd;
  --heat-3:#3b82f6;
  --heat-ink-1:#1e3a8a;
  --heat-ink-2:#0b2545;
  --heat-ink-3:#ffffff;

  /* —— 渐变字 —— */
  --accent-grad:linear-gradient(100deg,#2563eb,#0ea5e9 55%,#10b981);

  /* —— 阴影 —— */
  --shadow:0 1px 2px rgba(16,24,40,.05), 0 12px 32px -18px rgba(16,24,40,.22);
  --shadow-soft:0 1px 2px rgba(16,24,40,.04), 0 6px 18px -12px rgba(16,24,40,.18);
  --glow-brand:0 8px 20px -12px rgba(37,99,235,.9);
  --glow-brand-soft:0 6px 18px -12px rgba(37,99,235,.6);
  --glow-hover:0 1px 2px rgba(16,24,40,.05), 0 18px 40px -20px rgba(37,99,235,.5);

  /* —— 皮肤预览色（描述三套皮肤本身，不随主题变化） —— */
  --swatch-day:#f4f6fb;
  --swatch-night:#0d1117;
  --swatch-eye:#dde9dc;
}

html[data-theme="night"]{
  color-scheme: dark;

  --bg:#0d1117;
  --hero-glow-1:#16223b;
  --hero-glow-2:#0f2a25;
  --surface:#151c28;
  --surface-2:#1a2331;
  --surface-3:#182030;
  --surface-4:#202a3a;
  --brand-tint:#16233a;

  --line:#263041;
  --line-2:#2f3b4f;
  --line-3:#3a475d;

  --ink:#e6ebf5;
  --ink-2:#c2ccdc;
  --ink-3:#d5dce9;
  --muted:#9aa8bf;
  --faint:#6b7a92;
  --on-brand:#0d1117;

  --brand:#6aa2ff;
  --brand-strong:#8ab4ff;
  --brand-soft:#182741;
  --brand-ink:#a8c7ff;
  --brand-edge:#33476b;

  --ok:#3ecf8e;
  --ok-soft:#0e2a22;
  --ok-fill:#102e26;
  --ok-ink:#6ee7b7;
  --ok-deep:#a7f3d0;
  --ok-line:#1f5c48;
  --ok-line-2:#174534;

  --move:#f3b64b;
  --move-soft:#2c2211;
  --move-ink:#fcd34d;
  --warn:#fb923c;
  --warn-soft:#2a2114;
  --warn-line:#6b5220;
  --warn-ink:#fde68a;

  --bad:#f56b6b;
  --bad-soft:#2c1618;
  --bad-ink:#fca5a5;
  --bad-line:#6b2b30;

  --violet:#a78bfa;
  --violet-soft:#241d3b;

  --sky:#38bdf8;
  --sky-soft:#0d2734;

  --node-fill:#151c28;
  --node-stroke:#4a5a75;
  --node-ink:#d5dce9;
  --edge:#3a475d;
  --edge-faint:#2f3b4f;

  --chart-ds:#6aa2ff;
  --chart-co:#38bdf8;
  --chart-os:#3ecf8e;
  --chart-cn:#f3b64b;

  --heat-0:#1a2331;
  --heat-1:#1e3a5f;
  --heat-2:#2b5ea8;
  --heat-3:#6aa2ff;
  --heat-ink-1:#bcd4f5;
  --heat-ink-2:#eaf2ff;
  --heat-ink-3:#0d1117;

  --accent-grad:linear-gradient(100deg,#7cb0ff,#56c9f5 55%,#4ade9b);

  --shadow:0 1px 2px rgba(0,0,0,.42), 0 14px 36px -18px rgba(0,0,0,.75);
  --shadow-soft:0 1px 2px rgba(0,0,0,.35), 0 6px 18px -12px rgba(0,0,0,.6);
  --glow-brand:0 8px 20px -12px rgba(106,162,255,.7);
  --glow-brand-soft:0 6px 18px -12px rgba(106,162,255,.5);
  --glow-hover:0 1px 2px rgba(0,0,0,.4), 0 18px 40px -20px rgba(106,162,255,.45);
}

html[data-theme="eye"]{
  color-scheme: light;

  --bg:#dde9dc;
  --hero-glow-1:#d3e4d2;
  --hero-glow-2:#e6efdd;
  --surface:#f2f7ef;
  --surface-2:#eaf2e6;
  --surface-3:#eef5ea;
  --surface-4:#e4eede;
  --brand-tint:#e9f2e6;

  --line:#c8d8c2;
  --line-2:#bccfb5;
  --line-3:#a9bfa2;

  --ink:#22301f;
  --ink-2:#33422e;
  --ink-3:#2a3a26;
  --muted:#556549;
  --faint:#7d8d74;
  --on-brand:#f7fbf4;

  --brand:#3b7355;
  --brand-strong:#2e5e44;
  --brand-soft:#dfeee0;
  --brand-ink:#2b5c42;
  --brand-edge:#a9c9ab;

  --ok:#4a8a63;
  --ok-soft:#e1f0e0;
  --ok-fill:#eaf5e7;
  --ok-ink:#2f6b4a;
  --ok-deep:#274d38;
  --ok-line:#b6d6b4;
  --ok-line-2:#d0e6cd;

  --move:#9a6b1f;
  --move-soft:#f4ecd4;
  --move-ink:#7d5514;
  --warn:#a3621c;
  --warn-soft:#f2e8d2;
  --warn-line:#d8c48c;
  --warn-ink:#6b4a12;

  --bad:#a83f37;
  --bad-soft:#f3e2de;
  --bad-ink:#8c322b;
  --bad-line:#dcb2ab;

  --violet:#6b5a9e;
  --violet-soft:#e8e3f2;

  --sky:#3a6f85;
  --sky-soft:#dfeef2;

  --node-fill:#f7fbf4;
  --node-stroke:#8ba07f;
  --node-ink:#33422e;
  --edge:#a9bfa2;
  --edge-faint:#bccfb5;

  --chart-ds:#3b7355;
  --chart-co:#3a6f85;
  --chart-os:#5b8f6f;
  --chart-cn:#9a6b1f;

  --heat-0:#e4eede;
  --heat-1:#d6e6d3;
  --heat-2:#a9c9ab;
  --heat-3:#3b7355;
  --heat-ink-1:#2b5c42;
  --heat-ink-2:#22301f;
  --heat-ink-3:#f7fbf4;

  --accent-grad:linear-gradient(100deg,#3b7355,#5b8f6f 55%,#7aa36a);

  --shadow:0 1px 2px rgba(58,80,48,.07), 0 12px 32px -18px rgba(58,80,48,.28);
  --shadow-soft:0 1px 2px rgba(58,80,48,.05), 0 6px 18px -12px rgba(58,80,48,.22);
  --glow-brand:0 8px 20px -12px rgba(59,115,85,.65);
  --glow-brand-soft:0 6px 18px -12px rgba(59,115,85,.45);
  --glow-hover:0 1px 2px rgba(58,80,48,.06), 0 18px 40px -20px rgba(59,115,85,.4);
}

/* ============================================================
   主题切换器（全局固定，由 theme.js 自动注入）
   ============================================================ */
.theme-switch{
  position:fixed;
  top:14px;right:18px;
  z-index:70;
  display:flex;gap:2px;
  padding:3px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:999px;
  box-shadow:var(--shadow-soft);
  -webkit-backdrop-filter:blur(8px);
  backdrop-filter:blur(8px);
}
.theme-switch button{
  display:inline-flex;align-items:center;gap:6px;
  border:0;background:transparent;cursor:pointer;
  font-family:inherit;font-size:12px;font-weight:700;line-height:1;
  color:var(--muted);
  padding:6px 11px;border-radius:999px;
  transition:background .2s ease, color .2s ease;
}
.theme-switch button:hover{color:var(--ink-2)}
.theme-switch button.is-active{background:var(--brand-soft);color:var(--brand)}
.theme-switch button i{
  display:block;width:10px;height:10px;border-radius:50%;
  border:1px solid var(--line-3);
}
.theme-switch button[data-set-theme="day"] i{background:var(--swatch-day)}
.theme-switch button[data-set-theme="night"] i{background:var(--swatch-night)}
.theme-switch button[data-set-theme="eye"] i{background:var(--swatch-eye)}
.theme-switch button:focus-visible{
  outline:2px solid var(--brand);outline-offset:2px;
}

@media (max-width:640px){
  .theme-switch{top:10px;right:10px}
  .theme-switch button span{display:none}
  .theme-switch button{padding:7px 9px}
}

@media print{
  .theme-switch{display:none}
}

/* 打印时强制回到日间配色，避免深色皮肤耗墨 */
@media print{
  html[data-theme="night"],
  html[data-theme="eye"]{
    color-scheme: light;
    --bg:#ffffff;
    --hero-glow-1:#ffffff;
    --hero-glow-2:#ffffff;
    --surface:#ffffff;
    --surface-2:#ffffff;
    --surface-3:#ffffff;
    --surface-4:#ffffff;
    --brand-tint:#ffffff;
    --line:#d8dde8;
    --line-2:#c9d0dd;
    --line-3:#c2c9d6;
    --ink:#111827;
    --ink-2:#334155;
    --ink-3:#1f2937;
    --muted:#4b5563;
    --faint:#6b7280;
    --on-brand:#ffffff;
    --brand:#2563eb;
    --brand-strong:#1d4ed8;
    --brand-soft:#eff4ff;
    --brand-ink:#1e40af;
    --brand-edge:#bfd0f5;
    --ok:#0f9d76;
    --ok-soft:#ecfdf5;
    --ok-fill:#f2fdf8;
    --ok-ink:#047857;
    --ok-deep:#134e4a;
    --ok-line:#bdf0da;
    --ok-line-2:#d9f7e9;
    --move:#c98008;
    --move-soft:#fffbeb;
    --move-ink:#b45309;
    --warn:#ea580c;
    --warn-soft:#fff7ed;
    --warn-line:#fed7aa;
    --warn-ink:#78350f;
    --bad:#dc2626;
    --bad-soft:#fef2f2;
    --bad-ink:#b91c1c;
    --bad-line:#fecaca;
    --violet:#7c3aed;
    --violet-soft:#f5f0ff;
    --sky:#0284c7;
    --sky-soft:#f0f9ff;
    --node-fill:#ffffff;
    --node-stroke:#94a3b8;
    --node-ink:#334155;
    --edge:#cbd5e1;
    --edge-faint:#dbe3ef;
    --accent-grad:linear-gradient(100deg,#2563eb,#0ea5e9 55%,#10b981);
    --shadow:none;
    --shadow-soft:none;
    --glow-brand:none;
    --glow-brand-soft:none;
    --glow-hover:none;
  }
}