:root {
  --fs-micro: 10px;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-ui: 15px;
  --fs-body: 16px;
  --fs-reading: 17px;
  --fs-lg: 18px;
  --fs-card-title: 19px;
  --fs-xl: 20px;
  --fs-title-sm: 21px;
  --fs-title: 22px;
  --fs-title-lg: 24px;
  --fs-page-title: 26px;
  --fs-section-title: 28px;
  --fs-page-title-lg: 32px;
  --fs-page-title-xl: 38px;
  --fs-display-sm: 40px;
  --fs-display: 48px;
  --fs-home-hero: 56px;
  --fs-metric: 56px;
  --fs-hero-stat: 70px;
  --fs-hero-md: clamp(28px, 5vw, 48px);
  --fs-hero-xl: clamp(38px, 6vw, 76px);
  --fs-fluid-title: clamp(24px, 3vw, 36px);
  --fs-fluid-section: clamp(28px, 4vw, 42px);

  --lh-tight: 1.1;
  --lh-heading: 1.3;
  --lh-ui: 1.45;
  --lh-body: 1.7;
  --lh-reading: 1.95;

  --space-2xs: 4px;
  --space-xs: 6px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 28px;
  --space-4xl: 32px;
  --space-5xl: 40px;
  --space-6xl: 48px;

  --flow-tight: 8px;
  --flow-ui: 12px;
  --flow-body: 16px;
  --flow-reading: 20px;
  --flow-section: 32px;
}

html[data-theme="light"] {
  --bg: #eaf5f0;
  --bg-alt: #daeef8;
  --fg: #152535;
  --fg-muted: #5a8090;
  --accent: #c86010;
  --border: #b8d8e8;
  --nav-bg: rgba(234, 245, 240, 0.9);
  --accent-soft: rgba(200, 96, 16, 0.1);

  --ink: #152535;
  --ink-2: #2e5a6e;
  --ink-3: #5a8090;
  --muted: #5a8090;
  --line: #b8d8e8;
  --card: #ffffff;
  --panel: #ffffff;
  --paper: #eaf5f0;
  --brand: #c86010;
  --brand-soft: rgba(200, 96, 16, 0.1);
  --brand-line: #e9b887;
  --dark: #152535;

  --surface: #daeef8;
  --text: #152535;
  --text-dim: #5a8090;
  --text-mid: #2e5a6e;
  --gold: #c86010;
  --gold-lt: #e07828;
}

html[data-theme="dark"] {
  --bg: #1a1d23;
  --bg-alt: #2a2e37;
  --fg: #e8e8e8;
  --fg-muted: #9ba0a8;
  --accent: #ff5a1f;
  --border: #333842;
  --nav-bg: rgba(26, 29, 35, 0.92);
  --accent-soft: rgba(255, 90, 31, 0.12);

  --ink: #e8e8e8;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;
  --muted: #9ba0a8;
  --line: #333842;
  --card: #222831;
  --panel: #222831;
  --paper: #101828;
  --brand: #ff5a1f;
  --brand-soft: rgba(255, 90, 31, 0.14);
  --brand-line: rgba(255, 90, 31, 0.35);
  --dark: #f8fafc;

  --surface: #182840;
  --text: #f0ece5;
  --text-dim: #6b7a9a;
  --text-mid: #a8b4c8;
  --gold: #e07a2a;
  --gold-lt: #f5a050;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

button,
input,
select,
textarea {
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
}

h1,
h2,
h3 {
  line-height: var(--lh-heading);
}

.label,
.section-label,
.series-tag,
.article-series-tag,
.route-box-title,
.archive-label,
.contact-tag,
.work-tag,
.today-card-tag,
.latest-hub-tag,
.work-group-heading,
.subscribe-eyebrow,
.footer-contact-label {
  font-size: var(--fs-xs);
  line-height: var(--lh-ui);
  margin-bottom: var(--space-md);
}

.back-link,
.about-toc,
.nav-links,
.archive-item,
.archive-date,
.archive-name,
.archive-more,
.tab-btn,
.report-date,
.report-tag,
.sidebar-align,
.module-live,
.today-card-desc,
.today-card-cta,
.latest-meta,
.latest-hub-desc,
.contact-form input,
.contact-form textarea,
.btn-send,
.contact-feedback,
.footer-domain,
.footer-email,
.project-meta,
.project-tag,
.exp-time,
.hint,
.disc,
.pill,
.rt-topic,
.slide-nav,
.mode-btn,
.slide-counter {
  font-size: var(--fs-sm);
  line-height: var(--lh-ui);
}

.sub-title,
.latest-title,
.writing-link,
.now-list li,
.contact-value,
.module-desc,
.article-body,
.route-day-content,
.schedule-desc,
.pub-card-desc,
.about-text,
.structure-intro,
.lead,
.brief-list li,
.section-kicker,
.subscribe-sub,
.footer-brand,
.state-msg,
.line-item,
.project h4 {
  font-size: var(--fs-ui);
  line-height: var(--lh-body);
}

.prose p,
.article-body p,
.report-body p,
.project p,
.project li,
.banner p,
.exp-desc,
.report-body li {
  font-size: var(--fs-body);
  line-height: var(--lh-reading);
  margin-bottom: var(--flow-reading);
}

.report-body {
  font-size: var(--fs-body);
  line-height: var(--lh-reading);
  color: var(--fg);
  overflow-wrap: anywhere;
}

.report-body h1,
.report-body h2,
.report-body h3,
.article-body h2,
.article-body h3 {
  line-height: var(--lh-heading);
  letter-spacing: 0;
}

.report-body h1 {
  font-size: var(--fs-title-lg);
  margin: 0 0 var(--space-3xl);
}

.report-body h2 {
  font-size: var(--fs-card-title);
  margin: var(--space-5xl) 0 var(--space-lg);
  padding-bottom: var(--space-sm);
}

.report-body h3 {
  font-size: var(--fs-reading);
  margin: var(--space-3xl) 0 var(--space-md);
}

.report-body ul,
.report-body ol {
  margin: 0 0 var(--space-3xl);
  padding-left: 22px;
}

.report-body li {
  margin-bottom: var(--space-md);
}

.report-body blockquote,
.pull-quote {
  font-size: var(--fs-reading);
  line-height: var(--lh-reading);
  margin: var(--space-5xl) 0;
}

.report-body pre,
.report-body table {
  margin-bottom: var(--flow-reading);
}

.report-body code {
  font-size: var(--fs-sm);
}

.section-title,
.dir-title,
.subscribe-title {
  font-size: var(--fs-section-title);
  line-height: var(--lh-heading);
}

.name {
  font-size: var(--fs-page-title-xl);
  line-height: var(--lh-heading);
}

.hero-title {
  font-size: var(--fs-home-hero);
  line-height: var(--lh-tight);
}

.series-tag + .hero-title,
.hero-grid h1 {
  font-size: var(--fs-hero-xl);
  line-height: var(--lh-tight);
}

.hero-tagline,
.article-subtitle {
  font-size: var(--fs-reading);
  line-height: var(--lh-reading);
  margin-bottom: var(--space-2xl);
}

h1.article-title {
  font-size: var(--fs-fluid-title);
  line-height: var(--lh-heading);
  margin-bottom: var(--flow-reading);
}

.article-item .article-title {
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
}

.article-body h2 {
  font-size: var(--fs-title-lg);
  margin: var(--space-6xl) 0 var(--space-xl);
}

.article-body h3 {
  font-size: var(--fs-card-title);
  margin: var(--space-4xl) 0 var(--space-md);
}

.route-day,
.article-meta-row,
.report-meta,
.subscribe-bar p,
.writing-block p,
.core-stmt {
  margin-bottom: var(--flow-body);
}

.hero-sub,
.work-card p,
.today-card-desc,
.latest-hub-desc,
.rt-topic,
.about-text,
.structure-intro,
.pub-card-desc,
.subscribe-sub,
.footer-domain,
.disc,
.note,
.mats {
  line-height: var(--lh-body);
}

.tl-title,
.today-card-title,
.season-name,
.exp-title {
  font-size: var(--fs-reading);
  line-height: var(--lh-ui);
}

.work-title,
.writing-heading,
.dstat-num,
.brief-title,
.note-tile b,
.line-item.total,
.score-big .unit,
.article-num-tag {
  font-size: var(--fs-xl);
  line-height: var(--lh-heading);
}

.project-title,
.pub-card-title {
  font-size: var(--fs-card-title);
  line-height: var(--lh-heading);
}

.report-body table,
.report-body table td,
.skills .row,
.opt .box,
.chk .t {
  font-size: var(--fs-md);
  line-height: var(--lh-body);
}

.score-big .num {
  font-size: var(--fs-metric);
  line-height: var(--lh-tight);
}

.stat-value {
  font-size: var(--fs-display-sm);
  line-height: var(--lh-tight);
}

.pub-card-num {
  font-size: var(--fs-page-title-xl);
  line-height: var(--lh-tight);
}

.sub-header,
.topbar,
body > .header {
  background: var(--nav-bg) !important;
  border-color: var(--border) !important;
}

.site-theme-toggle {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 500;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--accent);
  box-shadow: 0 4px 14px rgba(21, 37, 53, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font: var(--fs-body)/1 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.2s, background 0.2s, color 0.2s;
}

.site-theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .project,
html[data-theme="dark"] .stage,
html[data-theme="dark"] .topic-card,
html[data-theme="dark"] .week-cell,
html[data-theme="dark"] .route-day,
html[data-theme="dark"] .schedule-card,
html[data-theme="dark"] .article-item,
html[data-theme="dark"] .pub-card,
html[data-theme="dark"] .opt .box,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background-color: var(--card) !important;
  border-color: var(--line, var(--border)) !important;
  color: var(--ink, var(--fg)) !important;
}

html[data-theme="dark"] .lead,
html[data-theme="dark"] .sub,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .disc,
html[data-theme="dark"] footer {
  color: var(--muted) !important;
}

html[data-theme="light"] .slide-card {
  background: #daeef8 !important;
  border-color: #b8d8e8 !important;
}

html[data-theme="light"] .slide-counter,
html[data-theme="light"] .mode-btn {
  background: rgba(200, 96, 16, 0.1) !important;
  border-color: rgba(200, 96, 16, 0.24) !important;
  color: #c86010 !important;
}

html[data-theme="light"] .mode-btn.active {
  background: #c86010 !important;
  border-color: #c86010 !important;
  color: #ffffff !important;
}

@media print {
  .site-theme-toggle {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .site-theme-toggle {
    width: 30px;
    height: 30px;
    right: 12px;
  }

  .section-title,
  .dir-title,
  .subscribe-title,
  h1.article-title {
    font-size: var(--fs-title-lg);
  }

  .hero-title,
  .series-tag + .hero-title,
  .hero-grid h1 {
    font-size: var(--fs-display-sm);
  }

  .name {
    font-size: var(--fs-page-title-lg);
  }

  .article-item .article-title,
  .report-body,
  .report-body p,
  .report-body li,
  .article-body p,
  .prose p {
    font-size: var(--fs-body);
  }
}
