:root {
  /* ── 字号 ────────────────────────────────────────────── */
  --font-size-caption: 0.75rem;   /* 极小说明、角标、状态 */
  --font-size-sm:      0.875rem;  /* 导航、按钮、辅助文案 */
  --font-size-md:      1rem;      /* 正文、输入框、默认文本 */
  --font-size-lg:      1.125rem;  /* 强调正文、小标题 */
  --font-size-xl:      1.25rem;   /* 卡片标题、模块标题 */
  --font-size-2xl:     1.5rem;    /* 页面标题 */
  --font-size-3xl:     2rem;      /* 价格、营销主标题 */

  --text-label:   var(--font-size-caption);
  --text-sm:      var(--font-size-sm);
  --text-body:    var(--font-size-md);
  --text-title:   var(--font-size-xl);
  --text-heading: var(--font-size-2xl);
  --text-display: var(--font-size-3xl);

  /* ── 配色 ────────────────────────────────────────────── */
  color-scheme: light;
  --theme-page-bg: #F4EDE4;
  --theme-sidebar-bg: #FDF9F1;
  --theme-surface: #FCF8F2;
  --theme-surface-soft: #EDE5DA;
  --theme-border: #D8CBBC;
  --theme-border-strong: #C4B5A3;
  --theme-text: #111827;
  --theme-muted: #6B7280;
  --theme-subtle: #9CA3AF;
  --theme-primary: #111827;
  --theme-primary-hover: #374151;
  --theme-primary-contrast: #FFFFFF;
  --theme-link: #1A56DB;
  --theme-accent: #08B34B;
  --theme-accent-hover: #069640;
  --theme-accent-soft: #DDF8E8;
  --theme-accent-contrast: #F8FCF9;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --theme-page-bg: #111418;
  --theme-sidebar-bg: #171B20;
  --theme-surface: #1B2127;
  --theme-surface-soft: #242B33;
  --theme-border: #2D3742;
  --theme-border-strong: #3A4653;
  --theme-text: #F3F4F6;
  --theme-muted: #C9D1D9;
  --theme-subtle: #8B98A7;
  --theme-primary: #0F1419;
  --theme-primary-hover: #161C22;
  --theme-primary-contrast: #F9FAFB;
  --theme-link: #8AB4FF;
  --theme-accent: #26D36B;
  --theme-accent-hover: #1DB35A;
  --theme-accent-soft: rgba(38, 211, 107, 0.16);
  --theme-accent-contrast: #0E1712;
}

body.theme-page {
  background: var(--theme-page-bg);
  color: var(--theme-text);
}

body.theme-page,
body.theme-page * {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, fill .18s ease, stroke .18s ease;
}

body.theme-page a {
  color: inherit;
}

body.theme-page a[href],
body.theme-page button,
body.theme-page summary,
body.theme-page [role="button"] {
  cursor: pointer;
}

body.theme-page .bg-gray-900 {
  background: var(--theme-primary) !important;
}

body.theme-page .text-white {
  color: var(--theme-primary-contrast) !important;
}

body.theme-page .hover\:bg-gray-700:hover {
  background: var(--theme-primary-hover) !important;
}

body.theme-page .theme-accent-btn {
  background:
    linear-gradient(180deg, rgba(121,255,198,0.26) 0%, rgba(121,255,198,0) 42%),
    linear-gradient(180deg, var(--theme-accent) 0%, var(--theme-accent-hover) 100%) !important;
  color: var(--theme-accent-contrast) !important;
  border-color: rgba(3, 108, 44, 0.16) !important;
  box-shadow:
    inset 0 1px 0 rgba(180,255,222,0.24),
    0 6px 14px rgba(8, 179, 75, 0.15),
    0 1px 3px rgba(6, 150, 64, 0.10);
}

body.theme-page .theme-accent-btn:hover {
  background:
    linear-gradient(180deg, rgba(140,255,205,0.28) 0%, rgba(140,255,205,0) 42%),
    linear-gradient(180deg, #10C454 0%, var(--theme-accent-hover) 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(194,255,229,0.28),
    0 7px 16px rgba(8, 179, 75, 0.16),
    0 1px 4px rgba(6, 150, 64, 0.10);
}

body.theme-page .theme-accent-chip {
  background: var(--theme-accent-soft) !important;
  color: var(--theme-accent) !important;
}

body.theme-page .bg-white,
body.theme-page .bg-gray-50,
body.theme-page [style*="background:var(--theme-surface)"] {
  background: var(--theme-surface) !important;
}

body.theme-page .hover\:bg-gray-50:hover {
  background: var(--theme-surface-soft) !important;
}

body.theme-page .hover\:bg-gray-100:hover {
  background: var(--theme-surface-soft) !important;
}

body.theme-page .text-gray-900 {
  color: var(--theme-text) !important;
}

body.theme-page .text-gray-700,
body.theme-page .text-gray-600,
body.theme-page .text-gray-500 {
  color: var(--theme-muted) !important;
}

body.theme-page .text-gray-400,
body.theme-page .text-gray-300 {
  color: var(--theme-subtle) !important;
}

body.theme-page .border-gray-300,
body.theme-page .border-gray-200,
body.theme-page .border-gray-100 {
  border-color: var(--theme-border) !important;
}

body.theme-page .hover\:text-gray-900:hover,
body.theme-page .hover\:text-gray-700:hover,
body.theme-page .hover\:text-gray-600:hover {
  color: var(--theme-text) !important;
}

body.theme-page [class*="hover:bg-[#EDE5DA]"]:hover {
  background: var(--theme-surface-soft) !important;
}

body.theme-page [class*="border-[#D8CBBC]"] {
  border-color: var(--theme-border) !important;
}

body.theme-page [class*="hover:border-[#c4b5a3]"]:hover {
  border-color: var(--theme-border-strong) !important;
}







body.theme-page .shadow-md,
body.theme-page .shadow-[0_18px_40px_rgba(0,0,0,0.08)] {
  box-shadow: 0 18px 40px rgba(0,0,0,0.12) !important;
}

body.theme-page input,
body.theme-page textarea,
body.theme-page select {
  background: var(--theme-surface);
  color: var(--theme-text);
  border-color: var(--theme-border);
}

body.theme-page input::placeholder,
body.theme-page textarea::placeholder {
  color: var(--theme-subtle);
}

















body.theme-page #course-tab-toc a {
  transition: background-color 160ms ease, color 160ms ease;
}

body.theme-page #course-tab-toc a:hover {
  background: var(--theme-surface-soft);
}

/* ── 字号语义类 ────────────────────────────────────────── */
.text-caption {
  font-size: var(--font-size-caption) !important;
}

.text-sm-ui {
  font-size: var(--font-size-sm) !important;
}

.text-body {
  font-size: var(--font-size-md) !important;
}

.text-body-strong {
  font-size: var(--font-size-lg) !important;
}

.text-title {
  font-size: var(--font-size-xl) !important;
}

.text-heading {
  font-size: var(--font-size-2xl) !important;
}

.text-display {
  font-size: var(--font-size-3xl) !important;
}

/* ── Markdown 正文通用样式 ──────────────────────────────── */
.md-body {
  font-size: var(--font-size-md);
  line-height: 1.9;
  color: var(--theme-text);
  word-break: break-word;
  overflow-wrap: break-word;
}

@media (max-width: 767px) {
  .md-body {
    font-size: var(--font-size-md);
    line-height: 2;
  }
}

.md-body > :first-child { margin-top: 0; }
.md-body > :last-child  { margin-bottom: 0; }

/* 标题 */
.md-body h1 {
  margin-top: 0;
  margin-bottom: 1.25rem;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--theme-text);
}

.md-body h2 {
  margin-top: 2.75rem;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--theme-text);
}

.md-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--theme-text);
}

.md-body h4,
.md-body h5,
.md-body h6 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--theme-text);
}

/* 段落 */
.md-body p {
  margin-top: 0.9rem;
  margin-bottom: 0.9rem;
  color: var(--theme-muted);
}

/* 列表 */
.md-body ul,
.md-body ol {
  margin-top: 1rem;
  margin-bottom: 1.25rem;
  padding-left: 1.4rem;
  color: var(--theme-muted);
}

.md-body li {
  margin-top: 0.4rem;
  margin-bottom: 0.4rem;
}

.md-body li > ul,
.md-body li > ol {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

/* 链接 */
.md-body a {
  color: var(--theme-link);
  text-decoration: underline;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  word-break: break-word;
}

.md-body a:hover {
  opacity: 0.8;
}

/* 图片 */
.md-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.75rem auto;
  border: 1px solid var(--theme-border);
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

/* 引用 */
.md-body blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--theme-border-strong);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--theme-surface-soft);
  color: var(--theme-muted);
}

.md-body blockquote p {
  margin: 0;
}

/* 行内代码 */
.md-body code {
  padding: 0.15em 0.4em;
  font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--theme-surface-soft);
  color: #d86672;
  border-radius: 0.25rem;
}

/* 代码块 */
.md-body pre {
  margin: 1.5rem 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #0d1117;
  color: #c9d1d9;
  border-radius: 0.6rem;
}

.md-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* 分隔线 */
.md-body hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid var(--theme-border);
}

/* 表格 */
.md-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.md-body th,
.md-body td {
  padding: 0.6rem 0.9rem;
  text-align: left;
  border: 1px solid var(--theme-border);
}

.md-body th {
  font-weight: 600;
  background: var(--theme-surface-soft);
  color: var(--theme-text);
}

.md-body td {
  color: var(--theme-muted);
}

/* strong / em */
.md-body strong {
  font-weight: 700;
  color: var(--theme-text);
}

.md-body em {
  font-style: italic;
}
