/* ============================================================
   tokens.css — 设计令牌（单一源，两站共用）
   4 套 UI 风格 × 明暗 = 8 种组合
   风格差异体现在：圆角 / 间距 / 边框 / 阴影 / 字号 / 字重 / 控件形态
   组件只引用变量，不写死数值与颜色
   ============================================================ */

:root {
  /* ---- 字体 ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* ---- 字号 ---- */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 22px;
  --text-2xl: 30px;

  /* ---- 间距 ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  /* ---- 结构（默认扁平） ---- */
  --r-xs: 3px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-pill: 6px;
  --ctrl-h: 36px;
  --ctrl-px: 12px;
  --ctrl-bw: 1.5px;
  --card-pad: 20px;
  --grid-gap: 14px;
  --blur: 0px;
  --saturate: 100%;
  --sh-card: none;
  --sh-pop: 0 8px 24px rgba(15, 23, 42, 0.12);
  --track: #d8dce4;
  --seg-track: #f2f4f7;
  --label-size: 11px;
  --label-weight: 700;
  --label-tracking: 0.08em;
  --label-transform: uppercase;
  --title-weight: 650;
  --title-size: var(--text-xl);
  --body-lh: 1.6;
  --focus-ring: 0 0 0 3px rgba(43, 92, 255, 0.25);

  /* ---- 颜色（扁平 · 浅色兜底） ---- */
  --bg: #f3f4f6;
  --bg-pattern: none;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e6e9ef;
  --surface-inset: #f7f8fa;
  --text: #14161a;
  --text-muted: #5f6672;
  --text-faint: #98a0ad;
  --border: #d9dde5;
  --border-strong: #1a1d23;
  --line: #1a1d23;
  --accent: #2b5cff;
  --accent-hover: #1e47d6;
  --accent-soft: #e8eeff;
  --accent-text: #ffffff;
  --success: #12854a;
  --success-soft: #e4f6ec;
  --warning: #a35b00;
  --warning-soft: #fdf2e0;
  --danger: #c0272d;
  --danger-soft: #fdeaea;
  --overlay: rgba(10, 12, 16, 0.45);
}

/* ============================================================
   风格 1：Apple 毛玻璃
   大圆角、悬浮玻璃卡片、药丸控件、留白充足、轻字重
   ============================================================ */
:root[data-skin="apple"] {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", sans-serif;
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;
  --ctrl-h: 40px;
  --ctrl-px: 18px;
  --ctrl-bw: 1px;
  --card-pad: 24px;
  --grid-gap: 18px;
  --blur: 26px;
  --saturate: 180%;
  --sh-card: 0 12px 40px rgba(15, 23, 42, 0.10);
  --sh-pop: 0 16px 48px rgba(15, 23, 42, 0.18);
  --label-size: 12px;
  --label-weight: 500;
  --label-tracking: 0;
  --label-transform: none;
  --title-weight: 600;
  --title-size: 26px;
  --body-lh: 1.65;
  --accent: #0a7cff;
  --accent-hover: #0066dd;
  --accent-text: #ffffff;
  --focus-ring: 0 0 0 4px rgba(10, 124, 255, 0.28);
}

:root[data-skin="apple"][data-mode="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --bg-pattern:
    radial-gradient(1100px 520px at 12% -8%, rgba(10, 124, 255, 0.16), transparent 60%),
    radial-gradient(900px 520px at 88% 4%, rgba(186, 104, 255, 0.14), transparent 62%),
    radial-gradient(800px 600px at 60% 110%, rgba(0, 200, 180, 0.10), transparent 60%);
  --surface: rgba(255, 255, 255, 0.76);
  --surface-2: rgba(255, 255, 255, 0.54);
  --surface-3: rgba(255, 255, 255, 0.36);
  --surface-inset: rgba(255, 255, 255, 0.62);
  --text: #101014;
  --text-muted: #63636b;
  --text-faint: #9b9ba3;
  --border: rgba(16, 16, 20, 0.10);
  --border-strong: rgba(16, 16, 20, 0.22);
  --line: rgba(16, 16, 20, 0.12);
  --accent-soft: rgba(10, 124, 255, 0.14);
  --success: #1f9d4d;
  --success-soft: rgba(31, 157, 77, 0.14);
  --warning: #c97a00;
  --warning-soft: rgba(201, 122, 0, 0.14);
  --danger: #e0332c;
  --danger-soft: rgba(224, 51, 44, 0.12);
  --sh-card: 0 14px 44px rgba(15, 23, 42, 0.09);
  --track: rgba(16, 16, 20, 0.18);
  --seg-track: rgba(120, 120, 128, 0.14);
}

:root[data-skin="apple"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #0a0c11;
  --bg-pattern:
    radial-gradient(1100px 520px at 12% -8%, rgba(10, 124, 255, 0.26), transparent 60%),
    radial-gradient(900px 520px at 88% 4%, rgba(150, 80, 255, 0.22), transparent 62%),
    radial-gradient(800px 600px at 60% 110%, rgba(0, 190, 170, 0.14), transparent 60%);
  --surface: rgba(30, 32, 40, 0.72);
  --surface-2: rgba(44, 47, 57, 0.58);
  --surface-3: rgba(60, 64, 76, 0.46);
  --surface-inset: rgba(22, 24, 30, 0.66);
  --text: #f5f5f7;
  --text-muted: #a2a2ab;
  --text-faint: #6e6e78;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --line: rgba(255, 255, 255, 0.14);
  --accent: #3d9bff;
  --accent-hover: #6cb4ff;
  --accent-soft: rgba(61, 155, 255, 0.20);
  --accent-text: #06121f;
  --success: #3ddc74;
  --success-soft: rgba(61, 220, 116, 0.18);
  --warning: #ffb340;
  --warning-soft: rgba(255, 179, 64, 0.18);
  --danger: #ff6a5e;
  --danger-soft: rgba(255, 106, 94, 0.18);
  --sh-card: 0 18px 52px rgba(0, 0, 0, 0.46);
  --track: rgba(255, 255, 255, 0.28);
  --seg-track: rgba(120, 120, 128, 0.28);
  --focus-ring: 0 0 0 4px rgba(61, 155, 255, 0.34);
}

/* ============================================================
   风格 2：扁平（硬朗直角、粗边框、无阴影、紧凑密度）
   ============================================================ */
:root[data-skin="flat"][data-mode="light"] {
  color-scheme: light;
  --bg: #f1f2f5;
  --bg-pattern: none;
  --surface: #ffffff;
  --surface-2: #f4f5f8;
  --surface-3: #e7e9ee;
  --surface-inset: #f7f8fa;
  --text: #101318;
  --text-muted: #5a616c;
  --text-faint: #9299a4;
  --border: #cfd4dd;
  --border-strong: #101318;
  --line: #101318;
  --accent: #2b5cff;
  --accent-hover: #1c46d8;
  --accent-soft: #e7edff;
  --accent-text: #ffffff;
  --success: #0f7a43;
  --success-soft: #e2f5ea;
  --warning: #96530a;
  --warning-soft: #fdf1de;
  --danger: #b3232a;
  --danger-soft: #fce8e8;
}

:root[data-skin="flat"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #12151b;
  --bg-pattern: none;
  --surface: #1b1f27;
  --surface-2: #232833;
  --surface-3: #2e3542;
  --surface-inset: #171b22;
  --text: #e9edf3;
  --text-muted: #a0a8b5;
  --text-faint: #6d7684;
  --border: #333b48;
  --border-strong: #d7dee8;
  --line: #d7dee8;
  --accent: #6f95ff;
  --accent-hover: #8faaff;
  --accent-soft: #22304f;
  --accent-text: #08101f;
  --success: #46d98a;
  --success-soft: #16352a;
  --warning: #f0b45c;
  --warning-soft: #3a2c16;
  --danger: #ff7b74;
  --danger-soft: #3c2222;
  --track: #3b4350;
  --seg-track: #232833;
}

/* ============================================================
   风格 3：微信（灰底白卡、分组列表、发丝线、绿色）
   ============================================================ */
:root[data-skin="wechat"] {
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 10px;
  --r-pill: 6px;
  --ctrl-h: 36px;
  --ctrl-px: 12px;
  --ctrl-bw: 1px;
  --card-pad: 16px;
  --grid-gap: 0px;
  --blur: 0px;
  --sh-card: none;
  --sh-pop: 0 10px 30px rgba(0, 0, 0, 0.14);
  --label-size: 14px;
  --label-weight: 400;
  --label-tracking: 0;
  --label-transform: none;
  --title-weight: 500;
  --title-size: 17px;
  --body-lh: 1.55;
  --accent: #07c160;
  --accent-hover: #06ad56;
  --accent-text: #ffffff;
  --focus-ring: 0 0 0 3px rgba(7, 193, 96, 0.22);
}

:root[data-skin="wechat"][data-mode="light"] {
  color-scheme: light;
  --bg: #ededed;
  --bg-pattern: none;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --surface-3: #efefef;
  --surface-inset: #fafafa;
  --text: #191919;
  --text-muted: #7f7f7f;
  --text-faint: #b2b2b2;
  --border: #e6e6e6;
  --border-strong: #d2d2d2;
  --line: #e6e6e6;
  --accent-soft: #e8f8ee;
  --success: #07c160;
  --success-soft: #e8f8ee;
  --warning: #d98600;
  --warning-soft: #fdf3e4;
  --danger: #fa5151;
  --danger-soft: #fdecec;
}

:root[data-skin="wechat"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --bg-pattern: none;
  --surface: #1e1e1e;
  --surface-2: #272727;
  --surface-3: #313131;
  --surface-inset: #191919;
  --text: #e6e6e6;
  --text-muted: #9a9a9a;
  --text-faint: #6a6a6a;
  --border: #333333;
  --border-strong: #4a4a4a;
  --line: #333333;
  --accent-soft: #17351f;
  --success: #2ad47c;
  --success-soft: #17351f;
  --warning: #e6a23c;
  --warning-soft: #3a2e1a;
  --danger: #fa5151;
  --danger-soft: #3d2222;
  --track: #3c3c3c;
  --seg-track: transparent;
}

/* ============================================================
   风格 4：小红书资料站（橙白双色、白卡描边、左侧色条标题、胶囊标签）
   来源：王OK 小红书资料站（you7.fun/wangok）的实际排版语言
   ============================================================ */
:root[data-skin="xhs"] {
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-xl: 12px;
  --r-pill: 999px;
  --ctrl-h: 36px;
  --ctrl-px: 14px;
  --ctrl-bw: 1px;
  --card-pad: 20px;
  --grid-gap: 14px;
  --blur: 0px;
  --saturate: 100%;
  --sh-card: none;
  --sh-pop: 0 12px 32px rgba(28, 28, 30, 0.14);
  --label-size: 12px;
  --label-weight: 700;
  --label-tracking: 0.02em;
  --label-transform: none;
  --title-weight: 700;
  --title-size: 21px;
  --body-lh: 1.72;
  --accent: #ff6a00;
  --accent-hover: #e85f00;
  --accent-text: #ffffff;
  --focus-ring: 0 0 0 3px rgba(255, 106, 0, 0.22);
}

:root[data-skin="xhs"][data-mode="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-pattern: none;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f0f0f4;
  --surface-inset: #f7f7f9;
  --text: #1c1c1e;
  --text-muted: #6b6b70;
  --text-faint: #a1a1a6;
  --border: #e5e5ea;
  --border-strong: #c8c8cf;
  --line: #e5e5ea;
  --accent-soft: #fff2e6;
  --success: #0f8a4d;
  --success-soft: #e8f7ee;
  --warning: #b34a00;
  --warning-soft: #fff8e6;
  --danger: #e5342b;
  --danger-soft: #fdeceb;
  --track: #d8d8de;
  --seg-track: #f0f0f4;
}

:root[data-skin="xhs"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #0e0e10;
  --bg-pattern: none;
  --surface: #1a1a1d;
  --surface-2: #232326;
  --surface-3: #2c2c31;
  --surface-inset: #141416;
  --text: #f2f2f4;
  --text-muted: #a3a3ab;
  --text-faint: #6f6f78;
  --border: #313137;
  --border-strong: #46464e;
  --line: #313137;
  --accent: #ff7d1f;
  --accent-hover: #ff9445;
  --accent-soft: rgba(255, 125, 31, 0.16);
  --accent-text: #1a0d00;
  --success: #3ddc84;
  --success-soft: rgba(61, 220, 132, 0.16);
  --warning: #ffb340;
  --warning-soft: rgba(255, 179, 64, 0.16);
  --danger: #ff6a5e;
  --danger-soft: rgba(255, 106, 94, 0.16);
  --track: #3a3a41;
  --seg-track: #232326;
  --focus-ring: 0 0 0 3px rgba(255, 125, 31, 0.32);
}

/* 毛玻璃不可用时的降级：提高不透明度，保证可读 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root[data-skin="apple"][data-mode="light"] {
    --surface: rgba(255, 255, 255, 0.97);
    --surface-2: rgba(255, 255, 255, 0.92);
    --surface-3: rgba(255, 255, 255, 0.86);
    --surface-inset: rgba(255, 255, 255, 0.94);
  }
  :root[data-skin="apple"][data-mode="dark"] {
    --surface: rgba(32, 34, 42, 0.98);
    --surface-2: rgba(44, 47, 57, 0.94);
    --surface-3: rgba(60, 64, 76, 0.9);
    --surface-inset: rgba(26, 28, 34, 0.96);
  }
}

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