:root {
  color-scheme: light dark;
  --theme-bg: #f7f8fc;
  --theme-bg-alt: #eef1f7;
  --theme-card: #ffffff;
  --theme-text: #18181b;
  --theme-muted: #5b6472;
  --theme-secondary: #3f4754;
  --theme-border: rgba(15, 23, 42, 0.12);
  --theme-border-strong: rgba(15, 23, 42, 0.2);
  --theme-nav: rgba(247, 248, 252, 0.82);
  --theme-code: #f1f3f8;
  --theme-shadow: rgba(15, 23, 42, 0.12);
  --topic-card-mask: rgba(255, 255, 255, 0.018);
  --accent: #4f46e5;
  --accent-light: #4338ca;
  --accent2: #087f8c;
  --accent3: #be185d;
  --green: #15803d;
}

:root[data-theme="dark"],
:root[data-theme="system"][data-resolved-theme="dark"] {
  --theme-bg: #09090b;
  --theme-bg-alt: #0c0c0f;
  --theme-card: #111114;
  --theme-text: #fafafa;
  --theme-muted: #8b8b96;
  --theme-secondary: #b4b4bd;
  --theme-border: rgba(255, 255, 255, 0.08);
  --theme-border-strong: rgba(255, 255, 255, 0.15);
  --theme-nav: rgba(9, 9, 11, 0.84);
  --theme-code: #0d0d10;
  --theme-shadow: rgba(0, 0, 0, 0.34);
  --topic-card-mask: rgba(255, 255, 255, 0.018);
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent2: #22d3ee;
  --accent3: #f472b6;
  --green: #22c55e;
}

html, body { background-color: var(--theme-bg); color: var(--theme-text); }
body { transition: background-color .22s ease, color .22s ease; }

/* Shared static pages */
:root {
  --bg: var(--theme-bg);
  --bg-alt: var(--theme-bg-alt);
  --bg-card: var(--theme-card);
  --text: var(--theme-text);
  --text-muted: var(--theme-muted);
  --text-secondary: var(--theme-secondary);
  --border: var(--theme-border);
  --border-hover: var(--theme-border-strong);
}
.nav, .nav.scrolled { background: var(--theme-nav); border-bottom-color: var(--theme-border); }
.mobile-menu { background: color-mix(in srgb, var(--theme-bg) 96%, transparent); }
.terminal, .terminal-window, .code-block, pre { box-shadow: 0 16px 36px var(--theme-shadow); }

/* Server-rendered collections, articles and About page */
.wrap, main, .panel, .post, .about, .guide, .rel-card { color: var(--theme-text); }
.post, .about, .panel, .rel-card { background-color: var(--theme-card) !important; border-color: var(--theme-border) !important; }
.post h2 a, .rel-title, .about strong, .article-content h2, .article-content h3, .article-content h4, .article-content strong { color: var(--theme-text) !important; }
.post p, .hero p, .lead, .muted, .post-meta, .meta, .breadcrumb, .rel-meta, .article-deck { color: var(--theme-muted) !important; }
body > nav { background: var(--theme-nav) !important; border-bottom-color: var(--theme-border) !important; }
.article-content { color: var(--theme-secondary) !important; }
.article-content h2 { border-bottom-color: var(--theme-border) !important; }
.article-content pre { background: var(--theme-code) !important; border-color: var(--theme-border) !important; }
.article-content pre code { color: var(--theme-secondary) !important; }
.article-content code, .tag, .rtag, .chip { background-color: var(--theme-bg-alt) !important; }
.cover, .article-content img, .article-content table, .article-content th, .article-content td, .related { border-color: var(--theme-border) !important; }
.article-header { border-bottom-color: var(--theme-border) !important; }
.button.alt, .save-button, .stat, .card, article, .searchbox, body > main:only-child { background-color: var(--theme-card) !important; border-color: var(--theme-border) !important; color: var(--theme-text) !important; }
input, textarea, select { color: var(--theme-text) !important; caret-color: var(--theme-text); }
.result, .nav, footer { border-color: var(--theme-border) !important; }
.result p, .status, .empty, .hint, .card p, .card time, p { color: var(--theme-muted); }
.actitle, .card h2, h1, h2, h3 { color: var(--theme-text); }
:root[data-theme="light"] body,
:root[data-theme="system"][data-resolved-theme="light"] body {
  background-image: radial-gradient(circle at 15% 0, rgba(79,70,229,.09), transparent 32rem), radial-gradient(circle at 92% 12%, rgba(8,145,178,.07), transparent 26rem) !important;
}
:root[data-theme="light"] a:not(.button):not(.btn):not(.btn-primary):not(.nav-cta):not(.nav-home):not(.nav-logo):not(.nav-link):not(.mobile-cta):not(.read-btn):not(.visit),
:root[data-theme="system"][data-resolved-theme="light"] a:not(.button):not(.btn):not(.btn-primary):not(.nav-cta):not(.nav-home):not(.nav-logo):not(.nav-link):not(.mobile-cta):not(.read-btn):not(.visit) { color: #4338ca; }
:root[data-theme="light"] a:not(.button):not(.btn):not(.btn-primary):not(.nav-cta):not(.nav-home):not(.nav-logo):not(.nav-link):not(.mobile-cta):not(.read-btn):not(.visit):hover,
:root[data-theme="system"][data-resolved-theme="light"] a:not(.button):not(.btn):not(.btn-primary):not(.nav-cta):not(.nav-home):not(.nav-logo):not(.nav-link):not(.mobile-cta):not(.read-btn):not(.visit):hover { color: #312e81; }
:root[data-theme="light"] .nav-links a,
:root[data-theme="light"] .mobile-menu a,
:root[data-theme="system"][data-resolved-theme="light"] .nav-links a,
:root[data-theme="system"][data-resolved-theme="light"] .mobile-menu a { color: #4b5563; }
:root[data-theme="light"] .nav-links a[aria-current="page"],
:root[data-theme="system"][data-resolved-theme="light"] .nav-links a[aria-current="page"] { color: #18181b; }
:root[data-theme="light"] .tag,
:root[data-theme="light"] .rtag,
:root[data-theme="light"] .chip,
:root[data-theme="light"] .atag,
:root[data-theme="system"][data-resolved-theme="light"] .tag,
:root[data-theme="system"][data-resolved-theme="light"] .rtag,
:root[data-theme="system"][data-resolved-theme="light"] .chip,
:root[data-theme="system"][data-resolved-theme="light"] .atag { color: #475569 !important; background: #e8ebf2 !important; }
:root[data-theme="light"] .hero::before,
:root[data-theme="light"] .eyebrow,
:root[data-theme="light"] .section-tag,
:root[data-theme="system"][data-resolved-theme="light"] .hero::before,
:root[data-theme="system"][data-resolved-theme="light"] .eyebrow,
:root[data-theme="system"][data-resolved-theme="light"] .section-tag { color: #0e7490 !important; }
:root[data-theme="light"] .guide,
:root[data-theme="system"][data-resolved-theme="light"] .guide { background: linear-gradient(135deg, rgba(79,70,229,.08), rgba(8,127,140,.045)) !important; border-color: rgba(67,56,202,.28) !important; }
:root[data-theme="light"] .toc,
:root[data-theme="system"][data-resolved-theme="light"] .toc {
  background: rgba(255,255,255,.82) !important;
  border-color: rgba(15,23,42,.14) !important;
  box-shadow: 0 12px 32px rgba(15,23,42,.07) !important;
  backdrop-filter: blur(18px) saturate(130%);
}
:root[data-theme="light"] .toc strong,
:root[data-theme="system"][data-resolved-theme="light"] .toc strong { color: #111827 !important; }
:root[data-theme="light"] .toc a,
:root[data-theme="system"][data-resolved-theme="light"] .toc a { color: #1d4ed8 !important; text-decoration: none; font-weight: 560; }
:root[data-theme="light"] .toc a:hover,
:root[data-theme="system"][data-resolved-theme="light"] .toc a:hover { color: #1e3a8a !important; text-decoration: underline; text-underline-offset: .18em; }
:root[data-theme="light"] .toc li::marker,
:root[data-theme="system"][data-resolved-theme="light"] .toc li::marker { color: #64748b !important; }
:root[data-theme="light"] .topic-nav,
:root[data-theme="system"][data-resolved-theme="light"] .topic-nav { background: #eef4ff !important; border-color: rgba(29,78,216,.2) !important; }
:root[data-theme="light"] .topic-nav span,
:root[data-theme="system"][data-resolved-theme="light"] .topic-nav span { color: #475569 !important; }
:root[data-theme="light"] .topic-links,
:root[data-theme="system"][data-resolved-theme="light"] .topic-links { border-top-color: rgba(15,23,42,.1) !important; }
:root[data-theme="light"] .evidence,
:root[data-theme="system"][data-resolved-theme="light"] .evidence { background: #f0f9ff !important; border-color: rgba(8,127,140,.22) !important; }
:root[data-theme="light"] .follow,
:root[data-theme="system"][data-resolved-theme="light"] .follow { background: #fff !important; border-color: rgba(15,23,42,.12) !important; }
:root[data-theme="light"] .follow a,
:root[data-theme="system"][data-resolved-theme="light"] .follow a { background: #eef1f7 !important; color: #334155 !important; }
:root[data-theme="light"] .article-content code,
:root[data-theme="system"][data-resolved-theme="light"] .article-content code { color: #0f766e !important; background: #e7f3f2 !important; }
:root[data-theme="light"] .article-content pre code,
:root[data-theme="system"][data-resolved-theme="light"] .article-content pre code { color: #334155 !important; background: transparent !important; }
:root[data-theme="light"] .code-frame,
:root[data-theme="system"][data-resolved-theme="light"] .code-frame { background:#0d1117 !important; border-color:rgba(15,23,42,.24) !important; box-shadow:0 18px 44px rgba(15,23,42,.16) !important; }
:root[data-theme="light"] .code-toolbar,
:root[data-theme="system"][data-resolved-theme="light"] .code-toolbar { background:#161b22 !important; border-bottom-color:rgba(148,163,184,.16) !important; }
:root[data-theme="light"] .code-frame pre,
:root[data-theme="system"][data-resolved-theme="light"] .code-frame pre { background:#0d1117 !important; border:0 !important; }
:root[data-theme="light"] .code-frame pre code,
:root[data-theme="system"][data-resolved-theme="light"] .code-frame pre code { color:#dbe4ee !important; background:transparent !important; }
:root[data-theme="light"] .article-content blockquote,
:root[data-theme="system"][data-resolved-theme="light"] .article-content blockquote { color: #475569 !important; background: linear-gradient(90deg,rgba(79,70,229,.08),rgba(79,70,229,.025)) !important; }
:root[data-theme="light"] .article-content table,
:root[data-theme="system"][data-resolved-theme="light"] .article-content table { background:#fff !important; }
:root[data-theme="light"] .article-content th,
:root[data-theme="system"][data-resolved-theme="light"] .article-content th { background:#eef1f7 !important; color:#1e293b !important; }
:root[data-theme="light"] .article-content tbody tr:nth-child(even),
:root[data-theme="system"][data-resolved-theme="light"] .article-content tbody tr:nth-child(even) { background:#f8fafc !important; }
:root[data-theme="light"] .evidence ul,
:root[data-theme="system"][data-resolved-theme="light"] .evidence ul { color: #475569 !important; }
:root[data-theme="light"] .topic-card p,
:root[data-theme="light"] .art-summary,
:root[data-theme="light"] .post p,
:root[data-theme="system"][data-resolved-theme="light"] .topic-card p,
:root[data-theme="system"][data-resolved-theme="light"] .art-summary,
:root[data-theme="system"][data-resolved-theme="light"] .post p { color: #4b5563 !important; }
main p a:not(.button):not(.btn):not(.read-btn):not(.visit) { text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .18em; }

/* 日报源标签：内联了亮青/亮粉/亮紫 (为深底设计)，浅底下整体压暗，保留各源配色身份 */
:root[data-theme="light"] .ds-tag,
:root[data-theme="system"][data-resolved-theme="light"] .ds-tag { filter: brightness(.72) saturate(1.15); }

/* 文章详情页来源徽章：#818cf8 在浅底对比不足 */
:root[data-theme="light"] .badge,
:root[data-theme="system"][data-resolved-theme="light"] .badge { color: #4338ca; }

/* 服务端渲染页面的胶囊导航 / 任务页分类小字 */
:root[data-theme="light"] .wrap .nav a,
:root[data-theme="system"][data-resolved-theme="light"] .wrap .nav a { border-color: rgba(15,23,42,.16); }
:root[data-theme="light"] main.wrap article > span,
:root[data-theme="system"][data-resolved-theme="light"] main.wrap article > span { color: #5b6472; }

/* ===== 浅色模式：带背景的区块/徽章/面板 ===== */
/* Hero 网格线与幽灵按钮：白色叠加在浅底不可见 → 翻转为深色系 */
:root[data-theme="light"] .hero-grid-bg,
:root[data-theme="system"][data-resolved-theme="light"] .hero-grid-bg {
  background-image: linear-gradient(rgba(15,23,42,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.05) 1px, transparent 1px);
}
:root[data-theme="light"] .btn-ghost:hover,
:root[data-theme="light"] .btn-outline:hover,
:root[data-theme="system"][data-resolved-theme="light"] .btn-ghost:hover,
:root[data-theme="system"][data-resolved-theme="light"] .btn-outline:hover { background: rgba(15,23,42,.05); }
:root[data-theme="light"] .btn-primary-hero,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-hero {
  background: #4338ca;
  color: #fff;
  box-shadow: 0 8px 22px rgba(67,56,202,.2);
}
:root[data-theme="light"] .btn-primary-hero::before,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-hero::before {
  background: linear-gradient(135deg, #3730a3, #0e7490);
}
:root[data-theme="light"] .btn-primary-github,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-github {
  background: #24292f;
  color: #fff;
  box-shadow: 0 8px 22px rgba(36,41,47,.2);
}
:root[data-theme="light"] .btn-primary-github::before,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-github::before {
  background: #0d1117;
}
:root[data-theme="light"] .btn-primary-hero:hover,
:root[data-theme="light"] .btn-primary-hero:focus-visible,
:root[data-theme="light"] .btn-primary-github:hover,
:root[data-theme="light"] .btn-primary-github:focus-visible,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-hero:hover,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-hero:focus-visible,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-github:hover,
:root[data-theme="system"][data-resolved-theme="light"] .btn-primary-github:focus-visible { color: #fff; }
:root[data-theme="light"] .section-tag,
:root[data-theme="system"][data-resolved-theme="light"] .section-tag { border-color: rgba(8,127,140,.35); }

/* 终端窗口刻意保持深色（Stripe/Vercel 风格），内部文字固定为浅色，
   否则浅色变量 (--text-secondary 等) 会变成深底深字 */
:root[data-theme="light"] .hero-terminal,
:root[data-theme="system"][data-resolved-theme="light"] .hero-terminal { background: #101014; border-color: rgba(15,23,42,.2); }
:root[data-theme="light"] .terminal-title, :root[data-theme="light"] .terminal-output,
:root[data-theme="system"][data-resolved-theme="light"] .terminal-title,
:root[data-theme="system"][data-resolved-theme="light"] .terminal-output { color: #8b8b96; }
:root[data-theme="light"] .cmd,
:root[data-theme="system"][data-resolved-theme="light"] .cmd { color: #b4b4bd; }
:root[data-theme="light"] .prompt,
:root[data-theme="system"][data-resolved-theme="light"] .prompt { color: #22d3ee; }
:root[data-theme="light"] .cursor,
:root[data-theme="system"][data-resolved-theme="light"] .cursor { color: #818cf8; }

/* 日报页：日期面板 / 时间轴磁贴 / 分区 / 条目 / 归档 */
:root[data-theme="light"] .daily-date-panel,
:root[data-theme="system"][data-resolved-theme="light"] .daily-date-panel {
  background: linear-gradient(135deg, rgba(79,70,229,.07), rgba(8,127,140,.035) 55%, rgba(255,255,255,.55));
  border-color: rgba(79,70,229,.16);
  box-shadow: 0 12px 32px rgba(15,23,42,.06);
}
:root[data-theme="light"] .timeline-day,
:root[data-theme="light"] .daily-day-nav button,
:root[data-theme="system"][data-resolved-theme="light"] .timeline-day,
:root[data-theme="system"][data-resolved-theme="light"] .daily-day-nav button { background: #fff; border-color: rgba(15,23,42,.12); }
:root[data-theme="light"] .timeline-day:hover,
:root[data-theme="system"][data-resolved-theme="light"] .timeline-day:hover { background: #f4f6fb; border-color: rgba(15,23,42,.2); }
:root[data-theme="light"] .timeline-day.active,
:root[data-theme="system"][data-resolved-theme="light"] .timeline-day.active {
  border-color: rgba(79,70,229,.55);
  background: linear-gradient(145deg, rgba(79,70,229,.14), rgba(8,127,140,.05));
  box-shadow: 0 10px 26px rgba(79,70,229,.14);
}
:root[data-theme="light"] .timeline-day.active::before,
:root[data-theme="system"][data-resolved-theme="light"] .timeline-day.active::before { background: #4f46e5; box-shadow: none; }
:root[data-theme="light"] .timeline-day.active .timeline-weekday,
:root[data-theme="light"] .timeline-day.active small,
:root[data-theme="system"][data-resolved-theme="light"] .timeline-day.active .timeline-weekday,
:root[data-theme="system"][data-resolved-theme="light"] .timeline-day.active small { color: #3730a3; }
:root[data-theme="light"] .dsection,
:root[data-theme="system"][data-resolved-theme="light"] .dsection { background: rgba(255,255,255,.72); border-color: rgba(15,23,42,.1); }
:root[data-theme="light"] .ditem:hover,
:root[data-theme="system"][data-resolved-theme="light"] .ditem:hover { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.14); }
:root[data-theme="light"] .ai-section,
:root[data-theme="system"][data-resolved-theme="light"] .ai-section {
  background: linear-gradient(135deg, rgba(79,70,229,.05), rgba(8,127,140,.035), rgba(190,24,93,.04));
  border-color: rgba(79,70,229,.2);
}
:root[data-theme="light"] .ah-item,
:root[data-theme="system"][data-resolved-theme="light"] .ah-item { background: rgba(255,255,255,.82); border-color: rgba(15,23,42,.1); }
:root[data-theme="light"] .ah-item:hover,
:root[data-theme="system"][data-resolved-theme="light"] .ah-item:hover { background: #fff; border-color: rgba(79,70,229,.35); }
:root[data-theme="light"] .archive-card,
:root[data-theme="system"][data-resolved-theme="light"] .archive-card { background: #fff; border-color: rgba(15,23,42,.12); }
:root[data-theme="light"] .archive-card:hover,
:root[data-theme="system"][data-resolved-theme="light"] .archive-card:hover { background: #f4f6fb; }
:root[data-theme="light"] .daily-related,
:root[data-theme="system"][data-resolved-theme="light"] .daily-related { background: radial-gradient(circle at 50% 0, rgba(79,70,229,.05), transparent 36rem); }
:root[data-theme="light"] .daily-related-card,
:root[data-theme="system"][data-resolved-theme="light"] .daily-related-card {
  background: linear-gradient(155deg, #fff, #f7f8fc);
  border-color: rgba(15,23,42,.12);
}
:root[data-theme="light"] .daily-related-card:hover,
:root[data-theme="system"][data-resolved-theme="light"] .daily-related-card:hover { border-color: rgba(79,70,229,.45); box-shadow: 0 18px 40px rgba(15,23,42,.1); }
:root[data-theme="light"] .daily-related-card small,
:root[data-theme="system"][data-resolved-theme="light"] .daily-related-card small { background: #eef0fa; border-color: rgba(79,70,229,.22); color: #4338ca; }

/* 首页专题卡片：亮青/亮粉/亮绿改为深色系 (通过 --topic-rgb 整体派生) */
:root[data-theme="light"] .topic-card,
:root[data-theme="system"][data-resolved-theme="light"] .topic-card { --topic-rgb: 67,56,202; background: linear-gradient(155deg, rgba(var(--topic-rgb),0.07), rgba(255,255,255,0.5) 48%); }
:root[data-theme="light"] .topic-card-content,
:root[data-theme="system"][data-resolved-theme="light"] .topic-card-content { --topic-rgb: 8,127,140; }
:root[data-theme="light"] .topic-card-ops,
:root[data-theme="system"][data-resolved-theme="light"] .topic-card-ops { --topic-rgb: 4,120,87; }
:root[data-theme="light"] .topic-card-eval,
:root[data-theme="system"][data-resolved-theme="light"] .topic-card-eval { --topic-rgb: 190,24,93; }

/* 徽章：亮青 #22d3ee / 亮粉 #f472b6 / 亮绿 #22c55e 在白底对比度不足 → 加深 */
:root[data-theme="light"] .cl-tag-improve,
:root[data-theme="light"] .art-account-badge,
:root[data-theme="light"] .art-source-original,
:root[data-theme="light"] .badge-original,
:root[data-theme="system"][data-resolved-theme="light"] .cl-tag-improve,
:root[data-theme="system"][data-resolved-theme="light"] .art-account-badge,
:root[data-theme="system"][data-resolved-theme="light"] .art-source-original,
:root[data-theme="system"][data-resolved-theme="light"] .badge-original { color: #0e7490; }
:root[data-theme="light"] .cl-tag-fix,
:root[data-theme="system"][data-resolved-theme="light"] .cl-tag-fix { color: #be185d; }
:root[data-theme="light"] .cl-tag-content,
:root[data-theme="light"] .art-source-wechat,
:root[data-theme="system"][data-resolved-theme="light"] .cl-tag-content,
:root[data-theme="system"][data-resolved-theme="light"] .art-source-wechat { color: #15803d; }
:root[data-theme="light"] .art-source-original,
:root[data-theme="light"] .art-account-badge,
:root[data-theme="system"][data-resolved-theme="light"] .art-source-original,
:root[data-theme="system"][data-resolved-theme="light"] .art-account-badge { border-color: rgba(8,127,140,.35); }
:root[data-theme="light"] .art-source-wechat,
:root[data-theme="system"][data-resolved-theme="light"] .art-source-wechat { border-color: rgba(21,128,61,.35); }
:root[data-theme="light"] .badge-original,
:root[data-theme="system"][data-resolved-theme="light"] .badge-original { background: rgba(8,127,140,.08); border-color: rgba(8,127,140,.3); }
:root[data-theme="light"] .art-status-expired,
:root[data-theme="light"] .art-status-badge.expired,
:root[data-theme="system"][data-resolved-theme="light"] .art-status-expired,
:root[data-theme="system"][data-resolved-theme="light"] .art-status-badge.expired { color: #b91c1c; }
:root[data-theme="light"] .art-status-badge.draft,
:root[data-theme="system"][data-resolved-theme="light"] .art-status-badge.draft { color: #a16207; }
:root[data-theme="light"] .cl-version,
:root[data-theme="system"][data-resolved-theme="light"] .cl-version { background: #e8ebf2; color: #475569; }
:root[data-theme="light"] .tnav,
:root[data-theme="system"][data-resolved-theme="light"] .tnav { background: rgba(15,23,42,.04); border-color: rgba(15,23,42,.12); }
:root[data-theme="light"] .tnav:hover,
:root[data-theme="system"][data-resolved-theme="light"] .tnav:hover { color: #4338ca; }
:root[data-theme="light"] .acard,
:root[data-theme="system"][data-resolved-theme="light"] .acard { background: #fff; border-color: rgba(15,23,42,.12); }

/* 卡片悬浮阴影：黑色阴影过重 → 换成柔和灰 */
:root[data-theme="light"] .pcard:hover,
:root[data-theme="light"] .skill-card:hover,
:root[data-theme="light"] .site-card:hover,
:root[data-theme="system"][data-resolved-theme="light"] .pcard:hover,
:root[data-theme="system"][data-resolved-theme="light"] .skill-card:hover,
:root[data-theme="system"][data-resolved-theme="light"] .site-card:hover { box-shadow: 0 16px 40px rgba(15,23,42,.12); }
:root[data-theme="light"] .topic-card:hover,
:root[data-theme="system"][data-resolved-theme="light"] .topic-card:hover { box-shadow: 0 18px 45px rgba(15,23,42,.12), 0 0 0 1px rgba(var(--topic-rgb),.08); }
:root[data-theme="light"] .art-card-original,
:root[data-theme="system"][data-resolved-theme="light"] .art-card-original { box-shadow: 0 14px 40px rgba(15,23,42,.08); }
:root[data-theme="light"] .post:hover,
:root[data-theme="system"][data-resolved-theme="light"] .post:hover { box-shadow: 0 22px 48px rgba(15,23,42,.1); }
:root[data-theme="light"] .post-link,
:root[data-theme="system"][data-resolved-theme="light"] .post-link { border-top-color: rgba(15,23,42,.12); }

/* 订阅页：黑底卡片 → 白底 */
:root[data-theme="light"] .subscribe-card,
:root[data-theme="system"][data-resolved-theme="light"] .subscribe-card { background: rgba(255,255,255,.85); border-color: rgba(15,23,42,.12); }
:root[data-theme="light"] .subscribe-card.featured,
:root[data-theme="system"][data-resolved-theme="light"] .subscribe-card.featured { background: linear-gradient(145deg, rgba(79,70,229,.1), rgba(255,255,255,.92) 58%); }
:root[data-theme="light"] .subscribe-card:hover,
:root[data-theme="system"][data-resolved-theme="light"] .subscribe-card:hover { border-color: rgba(79,70,229,.45); }
:root[data-theme="light"] .subscribe-note,
:root[data-theme="system"][data-resolved-theme="light"] .subscribe-note { background: #ecfeff; border-color: rgba(8,127,140,.28); }
:root[data-theme="light"] .pwa-install-nudge,
:root[data-theme="system"][data-resolved-theme="light"] .pwa-install-nudge {
  background: rgba(255,255,255,.95); color: #18181b; border-color: rgba(79,70,229,.45);
  box-shadow: 0 14px 42px rgba(15,23,42,.14);
}

/* 工具库收藏胶囊 / 我的阅读 / 离线页 / 搜索分组标题 */
:root[data-theme="light"] .site-save,
:root[data-theme="system"][data-resolved-theme="light"] .site-save { background: rgba(255,255,255,.92); border-color: rgba(15,23,42,.16); color: #475569; }
:root[data-theme="light"] .me-panel,
:root[data-theme="system"][data-resolved-theme="light"] .me-panel { background: #fff; border-color: rgba(15,23,42,.12); }
:root[data-theme="light"] .me-item,
:root[data-theme="system"][data-resolved-theme="light"] .me-item { background: #f4f6fb; color: #18181b; }
:root[data-theme="light"] .me-item small,
:root[data-theme="system"][data-resolved-theme="light"] .me-item small { color: #5b6472; }
:root[data-theme="light"] .me button, :root[data-theme="light"] .me .button,
:root[data-theme="system"][data-resolved-theme="light"] .me button,
:root[data-theme="system"][data-resolved-theme="light"] .me .button { background: #fff; border-color: rgba(15,23,42,.16); color: #18181b; }
:root[data-theme="light"] .progress,
:root[data-theme="system"][data-resolved-theme="light"] .progress { background: #e2e6ef; }
:root[data-theme="light"] .group h2,
:root[data-theme="system"][data-resolved-theme="light"] .group h2 { color: #4338ca; }
:root[data-theme="light"] .actions button,
:root[data-theme="system"][data-resolved-theme="light"] .actions button { background: #e8ebf2; color: #18181b; }
:root[data-theme="light"] body > main:only-child,
:root[data-theme="system"][data-resolved-theme="light"] body > main:only-child { border-color: var(--theme-border) !important; box-shadow: 0 12px 32px rgba(15,23,42,.08) !important; }
/* 服务端渲染的工具详情页 hero 区块 (main.wrap > section.hero)，不影响首页全屏 hero */
:root[data-theme="light"] .wrap > section.hero,
:root[data-theme="system"][data-resolved-theme="light"] .wrap > section.hero { background-color: var(--theme-card) !important; border-color: var(--theme-border) !important; }

.theme-switcher {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 10001;
  display: flex;
  gap: .2rem;
  padding: .28rem;
  border: 1px solid var(--theme-border-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-card) 90%, transparent);
  box-shadow: 0 10px 30px var(--theme-shadow);
  backdrop-filter: blur(18px) saturate(150%);
}
.theme-switcher button {
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: .45rem .62rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--theme-muted);
  cursor: pointer;
  font: 600 .75rem/1 system-ui, sans-serif;
}
.theme-switcher button:hover { color: var(--theme-text); background: var(--theme-bg-alt); }
.theme-switcher button.is-active { color: #fff; background: #4f46e5; }
.theme-switcher button:focus-visible { outline: 3px solid #06b6d4; outline-offset: 2px; }
.theme-switcher-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* 全站微信公众号悬浮入口；原页面底部二维码保持原样。 */
.wechat-float {
  --wechat-mouse-x: 0px;
  --wechat-mouse-y: 0px;
  position: fixed;
  top: clamp(6.5rem, var(--wechat-top, 34vh), calc(100vh - 15.5rem));
  z-index: 9998;
  width: max-content;
  color: var(--theme-text);
  font-family: Inter, "Noto Sans SC", system-ui, sans-serif;
  user-select: none;
}
.wechat-float[data-side="left"] { left: max(.65rem, env(safe-area-inset-left)); }
.wechat-float[data-side="right"] { right: max(.65rem, env(safe-area-inset-right)); }
.wechat-float-drift {
  animation: wechat-edge-drift var(--wechat-duration, 10s) ease-in-out var(--wechat-delay, 0s) infinite alternate;
}
.wechat-float-inner {
  display: flex;
  align-items: center;
  transform: translate3d(var(--wechat-mouse-x), var(--wechat-mouse-y), 0);
  transition: transform .18s ease-out;
  will-change: transform;
}
.wechat-float-card {
  appearance: none;
  display: grid;
  justify-items: center;
  width: 9.2rem;
  padding: .7rem .7rem .62rem;
  border: 1px solid var(--theme-border-strong);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--theme-card) 94%, transparent);
  color: var(--theme-text);
  box-shadow: 0 16px 42px var(--theme-shadow);
  backdrop-filter: blur(20px) saturate(145%);
  cursor: grab;
  font: inherit;
  text-align: center;
  touch-action: none;
}
.wechat-float-card:active, .wechat-float.is-dragging .wechat-float-card { cursor: grabbing; }
.wechat-float-card:focus-visible { outline: 3px solid #06b6d4; outline-offset: 3px; }
.wechat-float-card strong { margin-bottom: .48rem; color: var(--theme-text); font-size: .78rem; }
.wechat-float-card img {
  display: block;
  width: 7.35rem;
  height: 7.35rem;
  padding: .2rem;
  border: 1px solid var(--theme-border);
  border-radius: .75rem;
  background: #fff;
  object-fit: contain;
  pointer-events: none;
}
.wechat-float-card span { margin-top: .45rem; color: var(--theme-text); font-size: .75rem; font-weight: 700; }
.wechat-float:hover .wechat-float-drift,
.wechat-float:focus-within .wechat-float-drift,
.wechat-float.is-dragging .wechat-float-drift { animation-play-state: paused; }
.wechat-float.is-dragging .wechat-float-drift { animation: none; }

@keyframes wechat-edge-drift {
  0% { transform: translate3d(0, -7px, 0) rotate(-.35deg); }
  48% { transform: translate3d(3px, 4px, 0) rotate(.25deg); }
  100% { transform: translate3d(-2px, 9px, 0) rotate(-.1deg); }
}

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
  .wechat-float-drift { animation: none; }
  .wechat-float-inner { transform: none; transition: none; }
}
@media (max-width: 640px) {
  .theme-switcher { right: .75rem; bottom: .75rem; }
  .theme-switcher button { min-width: 2.1rem; min-height: 2.1rem; padding: .4rem .52rem; }
}

@media (max-width: 720px) {
  .wechat-float {
    top: clamp(5rem, var(--wechat-top, 42vh), calc(100vh - 12rem));
  }
  .wechat-float-card { width: 7.9rem; padding: .58rem .58rem .54rem; }
  .wechat-float-card img { width: 6.45rem; height: 6.45rem; }
  .wechat-float-card strong { margin-bottom: .38rem; font-size: .72rem; }
  .wechat-float-card span { margin-top: .38rem; font-size: .7rem; }
}
