/* =========================================================================
   道场 · 全站样式
   只用系统字体；所有颜色都是 :root 上的 CSS 变量，深色模式重新定义变量。
   目录：
     1. 设计变量（浅色 / 深色）
     2. 基础与排版
     3. 通用组件（按钮、徽章、chip、进度条、腰带、卡片）
     4. 页头 / 页脚 / 搜索弹窗 / toast
     5. 首页
     6. 内页通用（page-hero、学习路线、知识库、栏目）
     7. 文章页（三栏布局、侧栏、目录、正文 prose、插图、步骤、小测）
     8. 词典 / 常见问题 / 进度 / 搜索 / 错误页
     9. 灯箱
    10. 响应式、减少动态效果、打印
   ========================================================================= */

/* ---------- 1. 设计变量 ---------- */
:root {
  color-scheme: light;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Microsoft YaHei", monospace;

  --brand: #d9442b;          /* 品牌朱红：装饰、图标、进度条 */
  --brand-strong: #c23a21;   /* 文字链接、按钮底色（保证对比度） */
  --brand-hover: #a93119;
  --brand-soft: #fdece8;     /* 浅底 */
  --brand-soft-2: #fbdcd4;
  --on-brand: #ffffff;

  --ink: #1f2328;            /* 墨色：正文 */
  --text-2: #57606a;         /* 次要文字 */
  --text-3: #656d76;         /* 辅助文字 */
  --bg: #faf8f4;             /* 宣纸暖白 */
  --bg-alt: #f3efe7;
  --surface: #ffffff;
  --surface-2: #f6f4ef;
  --surface-3: #efebe3;
  --border: #e6e0d6;
  --border-strong: #d0d7de;
  --focus: #0969da;

  --success: #1a7f37;
  --success-soft: #e6f4ea;
  --warning: #9a6700;
  --warning-soft: #fff8c5;
  --danger: #cf222e;
  --danger-soft: #ffebe9;
  --info: #0969da;
  --info-soft: #ddf4ff;
  --purple: #8250df;
  --purple-soft: #fbefff;
  --teal: #0a7c73;
  --teal-soft: #e3f5f2;
  /* 白色文字 / 图标下面的实色底：深浅模式相同，保证对比度 */
  --success-solid: #1f883d;
  --danger-solid: #cf222e;

  --figure-bg: #ffffff;
  --figure-border: #e3ddd2;
  --figure-filter: none;

  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.05);
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.04), 0 6px 20px rgba(31, 35, 40, 0.06);
  --shadow-lg: 0 2px 6px rgba(31, 35, 40, 0.06), 0 18px 48px rgba(31, 35, 40, 0.12);
  --header-bg: rgba(250, 248, 244, 0.86);
  --overlay: rgba(20, 22, 26, 0.45);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --header-h: 60px;
  --container: 1200px;
  --gutter: 24px;
  --prose-width: 46em;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #f06a50;
  --brand-strong: #ff8a70;
  --brand-hover: #ffa28c;
  --brand-soft: rgba(240, 106, 80, 0.14);
  --brand-soft-2: rgba(240, 106, 80, 0.24);
  --on-brand: #ffffff;
  --ink: #e6e8eb;
  --text-2: #b1b7bf;
  --text-3: #979ea7;
  --bg: #16181c;
  --bg-alt: #1b1e23;
  --surface: #1f2228;
  --surface-2: #262a31;
  --surface-3: #2d323a;
  --border: #30353d;
  --border-strong: #3d434c;
  --focus: #58a6ff;
  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, 0.14);
  --warning: #d29922;
  --warning-soft: rgba(210, 153, 34, 0.14);
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.14);
  --info: #58a6ff;
  --info-soft: rgba(88, 166, 255, 0.14);
  --purple: #bc8cff;
  --purple-soft: rgba(188, 140, 255, 0.14);
  --teal: #39c5b5;
  --teal-soft: rgba(57, 197, 181, 0.13);
  --figure-bg: #ffffff;
  --figure-border: #3a3f47;
  --figure-filter: brightness(0.92);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 18px 48px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(22, 24, 28, 0.86);
  --overlay: rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #f06a50;
    --brand-strong: #ff8a70;
    --brand-hover: #ffa28c;
    --brand-soft: rgba(240, 106, 80, 0.14);
    --brand-soft-2: rgba(240, 106, 80, 0.24);
    --on-brand: #ffffff;
    --ink: #e6e8eb;
    --text-2: #b1b7bf;
    --text-3: #979ea7;
    --bg: #16181c;
    --bg-alt: #1b1e23;
    --surface: #1f2228;
    --surface-2: #262a31;
    --surface-3: #2d323a;
    --border: #30353d;
    --border-strong: #3d434c;
    --focus: #58a6ff;
    --success: #3fb950;
    --success-soft: rgba(63, 185, 80, 0.14);
    --warning: #d29922;
    --warning-soft: rgba(210, 153, 34, 0.14);
    --danger: #f85149;
    --danger-soft: rgba(248, 81, 73, 0.14);
    --info: #58a6ff;
    --info-soft: rgba(88, 166, 255, 0.14);
    --purple: #bc8cff;
    --purple-soft: rgba(188, 140, 255, 0.14);
    --teal: #39c5b5;
    --teal-soft: rgba(57, 197, 181, 0.13);
    --figure-bg: #ffffff;
    --figure-border: #3a3f47;
    --figure-filter: brightness(0.92);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.35), 0 18px 48px rgba(0, 0, 0, 0.45);
    --header-bg: rgba(22, 24, 28, 0.86);
    --overlay: rgba(0, 0, 0, 0.6);
  }
}

/* 深色模式下按钮底色保持较深的朱红，保证白字对比度 */
:root { --btn-bg: #c63d24; --btn-bg-hover: #ad3219; }
:root[data-theme="dark"] { --btn-bg: #cc4127; --btn-bg-hover: #b83820; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --btn-bg: #cc4127; --btn-bg-hover: #b83820; }
}

/* ---------- 2. 基础与排版 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
  background: var(--bg);
}

html.is-scroll-locked {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

body > main {
  flex: 1 0 auto;
}

img,
svg,
video {
  max-width: 100%;
}

img,
video {
  height: auto;
}

a {
  color: var(--brand-strong);
  text-decoration: none;
}

a:hover {
  color: var(--brand-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.35;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.4em;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

[hidden] {
  display: none !important;
}

.no-js .js-only {
  display: none !important;
}

.js .no-js-only {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--brand-soft-2);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 8px 16px;
  background: var(--btn-bg);
  color: var(--on-brand);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 12px;
  color: var(--on-brand);
  text-decoration: none;
}

main:focus {
  outline: none;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container-narrow {
  max-width: 880px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand-strong);
}

.icon {
  flex: none;
  vertical-align: -0.15em;
}

/* ---------- 3. 通用组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--on-brand);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 4px 14px rgba(217, 68, 43, 0.25);
}

.btn-primary:hover {
  background: var(--btn-bg-hover);
  color: var(--on-brand);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.btn-light {
  background: #ffffff;
  color: #b8341e;
}

.btn-light:hover {
  background: #fff4f1;
  color: #9c2a15;
}

.btn-danger {
  background: var(--surface);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-lg {
  min-height: 48px;
  padding: 10px 24px;
  font-size: 1rem;
  border-radius: 12px;
}

.btn-sm {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.875rem;
  border-radius: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  transition: background-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}

.badge-level.level-basic {
  color: var(--success);
  background: var(--success-soft);
}

.badge-level.level-mid {
  color: var(--info);
  background: var(--info-soft);
}

.badge-level.level-pro {
  color: var(--purple);
  background: var(--purple-soft);
}

.badge-draft {
  color: var(--warning);
  background: var(--warning-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

a.chip:hover,
button.chip:hover {
  color: var(--brand-strong);
  border-color: var(--brand);
  text-decoration: none;
}

.chip.is-active {
  color: var(--on-brand);
  background: var(--btn-bg);
  border-color: var(--btn-bg);
}

.chip-static {
  min-height: 26px;
  padding: 1px 10px;
  font-size: 0.8125rem;
}

.chip-count {
  font-size: 0.75rem;
  opacity: 0.75;
}

.chip-num {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--on-brand);
  background: var(--btn-bg);
  border-radius: 50%;
}

.progress-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress {
  position: relative;
  flex: 1;
  height: 8px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.progress-bar {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #f08a4b);
  border-radius: inherit;
  transition: width 0.5s ease;
}

.progress-block.is-complete .progress-bar {
  background: linear-gradient(90deg, #2f9e5b, #3fb970);
}

.progress-text {
  flex: none;
  min-width: 5.5em;
  font-size: 0.8125rem;
  color: var(--text-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.progress-lg .progress {
  height: 10px;
}

.progress-sm .progress {
  height: 6px;
}

.progress-sm .progress-text {
  font-size: 0.75rem;
  min-width: 4.5em;
}

/* 腰带徽章：颜色由类名决定 */
.belt {
  --belt-color: #f4f1ea;
  --belt-stroke: #bdb4a3;
  flex: none;
  overflow: visible;
}

.belt .belt-part {
  fill: var(--belt-color);
  stroke: var(--belt-stroke);
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: fill 0.4s, stroke 0.4s;
}

.belt--white { --belt-color: #f4f1ea; --belt-stroke: #bdb4a3; }
.belt--yellow { --belt-color: #e3b21c; --belt-stroke: #b08810; }
.belt--green { --belt-color: #2f9e5b; --belt-stroke: #217846; }
.belt--blue { --belt-color: #2d6cb5; --belt-stroke: #1f5190; }
.belt--brown { --belt-color: #8a5a34; --belt-stroke: #6a4124; }
.belt--black { --belt-color: #22252a; --belt-stroke: #4a4f57; }

.empty-state {
  margin: 32px 0;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-2);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.empty-state-title {
  margin-bottom: 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ink);
}

.empty-note {
  color: var(--text-3);
  font-size: 0.9375rem;
}

.link-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}

.panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel-muted {
  background: var(--surface-2);
  box-shadow: none;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 1.0625rem;
}

.panel-title .icon {
  color: var(--brand);
}

.panel-desc {
  margin-bottom: 16px;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin: 0 8px;
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--text-2);
}

.breadcrumb a:hover {
  color: var(--brand-strong);
}

.breadcrumb [aria-current="page"] {
  color: var(--text-3);
  max-width: 22em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 4. 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1440px;
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.site-nav-list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.site-nav-link {
  display: block;
  padding: 6px 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
  border-radius: 8px;
  transition: color 0.15s, background-color 0.15s;
}

.site-nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
  text-decoration: none;
}

.site-nav-link.is-active {
  color: var(--brand-strong);
  font-weight: 700;
  background: var(--brand-soft);
}

.site-nav-extra {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  height: 38px;
  padding: 0 8px 0 12px;
  font-size: 0.875rem;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-trigger:hover {
  color: var(--text-2);
  border-color: var(--border-strong);
  text-decoration: none;
}

.search-trigger-text {
  flex: 1;
}

.theme-toggle .theme-icon {
  display: none;
}

.theme-toggle[data-mode="system"] .theme-icon-system,
.theme-toggle[data-mode="light"] .theme-icon-light,
.theme-toggle[data-mode="dark"] .theme-icon-dark {
  display: block;
}

.belt-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  transition: border-color 0.15s;
}

.belt-badge:hover {
  color: var(--ink);
  border-color: var(--brand);
  text-decoration: none;
}

.belt-badge-sep,
.belt-badge [data-belt-count] {
  color: var(--text-3);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.menu-toggle {
  display: none;
}

.menu-toggle .menu-icon-close {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-icon-open {
  display: none;
}

.menu-toggle[aria-expanded="true"] .menu-icon-close {
  display: block;
}

/* 阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 3px;
  pointer-events: none;
}

.reading-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #f08a4b);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 80px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr);
  gap: 40px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px var(--gutter) 32px;
}

.brand-footer .brand-name {
  font-size: 1.0625rem;
}

.footer-slogan {
  margin-top: 10px;
  font-weight: 600;
  color: var(--text-2);
}

.footer-note {
  margin-top: 8px;
  max-width: 28em;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.footer-col-title {
  margin-bottom: 10px;
  font-size: 0.875rem;
  font-weight: 700;
}

.footer-col ul {
  list-style: none;
  display: grid;
  gap: 6px;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--text-2);
}

.footer-col a:hover {
  color: var(--brand-strong);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px var(--gutter) 28px;
  font-size: 0.8125rem;
  color: var(--text-3);
  border-top: 1px solid var(--border);
}

.footer-bottom a {
  color: var(--text-2);
}

/* 返回顶部 */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, color 0.15s;
  pointer-events: none;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.back-to-top:hover {
  color: var(--brand-strong);
}

/* toast */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 120;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 0.9375rem;
  color: #ffffff;
  background: #24272d;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease both;
  pointer-events: auto;
}

.toast.is-leaving {
  animation: toast-out 0.25s ease both;
}

.toast .belt {
  width: 40px;
  height: 24px;
}

.toast-title {
  font-weight: 700;
}

.toast-text {
  color: #c9ced6;
  font-size: 0.8125rem;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ---------- 搜索弹窗 ---------- */
.search-dialog {
  width: min(680px, calc(100vw - 32px));
  max-width: none;
  max-height: min(640px, calc(100vh - 80px));
  margin: 10vh auto auto;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-dialog[open] {
  display: flex;
}

.search-dialog::backdrop {
  background: var(--overlay);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.search-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid var(--border);
}

.search-bar-icon {
  color: var(--brand);
}

.search-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  font-size: 1.0625rem;
  background: transparent;
  border: 0;
  outline: none;
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-close {
  padding: 0;
  background: none;
  border: 0;
}

.search-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
}

.search-status {
  padding: 16px 12px;
  font-size: 0.875rem;
  color: var(--text-3);
}

.search-status:empty {
  display: none;
}

.search-status a {
  font-weight: 600;
}

.search-results {
  list-style: none;
}

.search-hit {
  display: block;
  padding: 10px 12px;
  color: var(--ink);
  border-radius: 10px;
  scroll-margin: 8px;
}

.search-hit:hover {
  text-decoration: none;
  color: var(--ink);
  background: var(--surface-2);
}

.search-hit[aria-selected="true"] {
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}

.search-hit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-hit-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hit-section {
  flex: none;
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-3);
}

.search-hit-snippet {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  font-size: 0.8125rem;
  color: var(--text-2);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

mark {
  padding: 0 1px;
  color: inherit;
  background: rgba(255, 196, 0, 0.35);
  border-radius: 3px;
}

.type-tag {
  flex: none;
  padding: 0 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.7;
  border-radius: 5px;
}

.type-article { color: var(--brand-strong); background: var(--brand-soft); }
.type-glossary { color: var(--info); background: var(--info-soft); }
.type-faq { color: var(--success); background: var(--success-soft); }

.search-footer {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  font-size: 0.75rem;
  color: var(--text-3);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.search-footer span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.search-suggest {
  display: grid;
  gap: 6px;
  margin: 4px 12px 12px;
  padding-left: 1.2em;
  font-size: 0.875rem;
  color: var(--text-2);
}

/* ---------- 5. 首页 ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 56px 0 40px;
  background:
    radial-gradient(900px 420px at 88% -10%, var(--brand-soft), transparent 70%),
    radial-gradient(600px 300px at -10% 110%, var(--bg-alt), transparent 70%);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center;
  gap: 48px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 4px 12px 4px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--brand-strong);
  background: var(--surface);
  border: 1px solid var(--brand-soft-2);
  border-radius: 999px;
}

.hero-kicker-dot {
  width: 8px;
  height: 8px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.06em;
}

.hero-slogan {
  margin-top: 12px;
  font-size: clamp(1.25rem, 2.4vw, 1.625rem);
  font-weight: 700;
  color: var(--brand-strong);
  letter-spacing: 0.04em;
}

.hero-intro {
  max-width: 30em;
  margin-top: 16px;
  font-size: 1.0625rem;
  color: var(--text-2);
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 24px;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-2);
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hero-points .icon {
  color: var(--success);
}

.hero-art {
  padding: 10px;
  background: var(--figure-bg);
  border: 1px solid var(--figure-border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  filter: var(--figure-filter);
}

.hero-art-img {
  display: block;
  width: 100%;
  border-radius: 12px;
}

.home-overview {
  padding: 8px 0 24px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr);
  gap: 20px;
}

.belt-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.belt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.belt-card-kicker {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-2);
}

.belt-card-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.belt-card-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px 28px;
}

.belt-card-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.belt-card-name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.belt-card-motto {
  margin-top: 2px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.belt-card-hint {
  margin-top: 8px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.continue {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  background: var(--brand-soft);
  border-radius: var(--radius);
}

.continue-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--brand-strong);
  white-space: nowrap;
}

.continue-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px 10px 16px;
  color: var(--ink);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}

.continue-link:hover {
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.continue-title {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.continue-go {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--on-brand);
  background: var(--btn-bg);
  border-radius: 50%;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-tile dt {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.stat-tile dd {
  margin: 4px 0 0;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-tile dd small {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
}

.stat-tile dd.stat-tile-text {
  font-size: 1.125rem;
}

.home-section {
  padding: 56px 0;
}

.home-section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 28px;
}

.section-head-compact {
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(1.375rem, 2.6vw, 1.75rem);
}

.section-title-sm {
  font-size: 1.25rem;
}

.section-lead {
  margin-top: 8px;
  color: var(--text-2);
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  list-style: none;
}

.timeline-link {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 20px 18px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.timeline-link:hover {
  color: var(--ink);
  text-decoration: none;
  border-color: var(--brand-soft-2);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.timeline-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  font-weight: 800;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-radius: 50%;
}

.timeline-item.is-done .timeline-dot {
  color: #ffffff;
  background: var(--success-solid);
}

.timeline-title {
  font-weight: 700;
}

.timeline-subtitle {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
}

.timeline-meta {
  margin: 6px 0 8px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  list-style: none;
}

.section-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.section-card:hover {
  color: var(--ink);
  text-decoration: none;
  border-color: var(--brand-soft-2);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.section-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  padding: 16px 18px 18px;
}

.section-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.section-card-icon {
  font-size: 1.125rem;
}

.section-card-desc {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.65;
}

.section-card-meta {
  margin: 4px 0 6px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* 封面：图片或 icon 占位 */
.cover {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--figure-bg);
}

.cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--figure-filter);
}

/* 封面统一按 2:1 显示（推荐 800×400），比例不同的图片完整显示、不裁切 */
.cover-card {
  aspect-ratio: 2 / 1;
  border-bottom: 1px solid var(--border);
}

.cover-hero {
  flex: none;
  width: 400px;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--figure-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cover-thumb {
  width: 112px;
  aspect-ratio: 2 / 1;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.cover-placeholder {
  --tone: var(--brand);
  --tone-soft: var(--brand-soft);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.55), transparent 40%),
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(255, 255, 255, 0.18) 14px 15px),
    linear-gradient(135deg, var(--tone-soft), var(--surface-2));
}

.cover-placeholder::after {
  content: "";
  position: absolute;
  right: -18%;
  bottom: -40%;
  width: 70%;
  aspect-ratio: 1;
  border: 14px solid var(--tone);
  border-radius: 50%;
  opacity: 0.1;
}

.cover-tone-1 { --tone: var(--info); --tone-soft: var(--info-soft); }
.cover-tone-2 { --tone: var(--success); --tone-soft: var(--success-soft); }
.cover-tone-3 { --tone: var(--purple); --tone-soft: var(--purple-soft); }
.cover-tone-4 { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.cover-tone-5 { --tone: var(--teal); --tone-soft: var(--teal-soft); }

.cover-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  font-size: 2rem;
  line-height: 1;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.cover-thumb .cover-icon {
  width: 36px;
  height: 36px;
  font-size: 1.25rem;
  border-radius: 10px;
}

.home-duo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 24px;
  align-items: start;
}

/* 没有常见问题时，每日一词占满一行 */
.home-duo.home-duo-single {
  grid-template-columns: minmax(0, 1fr);
}

.daily-term {
  position: relative;
  overflow: hidden;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.daily-term::before {
  content: "词";
  position: absolute;
  right: -8px;
  top: -24px;
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
  color: var(--brand);
  opacity: 0.06;
  pointer-events: none;
}

.daily-term-word {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.daily-term-aliases {
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--text-3);
}

.daily-term-def {
  margin-top: 14px;
  font-size: 1rem;
  line-height: 1.8;
}

.daily-term-example {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 0.9375rem;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 10px;
}

.daily-term-example-label {
  flex: none;
  font-weight: 700;
  color: var(--brand-strong);
}

.daily-term-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.home-cta {
  padding: 8px 0 0;
}

.home-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 40px;
  padding-bottom: 40px;
  color: #ffffff;
  background:
    radial-gradient(500px 200px at 90% 0%, rgba(255, 255, 255, 0.16), transparent 70%),
    linear-gradient(120deg, #c23a21, #d9442b 55%, #e5663f);
  border-radius: 20px;
  max-width: calc(var(--container) - 2 * var(--gutter));
}

.home-cta-inner h2 {
  font-size: 1.5rem;
}

.home-cta-inner p {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.9);
}

/* ---------- 6. 内页通用 ---------- */
.page-hero {
  padding: 32px 0 28px;
  margin-bottom: 32px;
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-bottom: 1px solid var(--border);
}

.page-hero-compact {
  padding-bottom: 24px;
}

.page-hero .breadcrumb {
  margin-bottom: 16px;
}

.page-title {
  font-size: clamp(1.75rem, 3.6vw, 2.25rem);
  font-weight: 800;
}

.page-lead {
  max-width: 44em;
  margin-top: 10px;
  font-size: 1.0625rem;
  color: var(--text-2);
}

.page-hero-progress {
  max-width: 560px;
  margin-top: 20px;
}

/* 学习路线 */
.path-summary {
  display: grid;
  gap: 16px;
  max-width: 720px;
  margin-top: 20px;
}

.stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.stages {
  display: grid;
  gap: 0;
  list-style: none;
}

.stage {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 20px;
}

.stage-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.stage-rail::before {
  content: "";
  position: absolute;
  top: 48px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
}

.stage:last-child .stage-rail::before {
  display: none;
}

.stage-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: 16px;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--brand-strong);
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: 50%;
}

.stage.is-done .stage-dot {
  color: #ffffff;
  background: var(--success-solid);
  border-color: var(--success-solid);
}

.stage-card {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.stage:target .stage-card {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.stage-kicker {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-3);
}

.stage-title {
  margin-top: 2px;
  font-size: 1.375rem;
}

.stage-subtitle {
  margin-top: 4px;
  color: var(--text-2);
}

.stage-done-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 3px 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 999px;
}

.stage-goal {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  font-size: 0.9375rem;
  line-height: 1.7;
  background: var(--surface-2);
  border-radius: 10px;
}

.stage-goal .icon {
  margin-top: 3px;
  color: var(--brand);
}

.stage-missing {
  font-size: 0.875rem;
  color: var(--text-3);
}

.practice {
  padding: 16px 18px;
  background: var(--brand-soft);
  border-radius: var(--radius);
}

.practice-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.practice-title .icon {
  color: var(--brand);
}

.practice-hint {
  margin: 4px 0 10px;
  font-size: 0.8125rem;
  color: var(--text-2);
}

/* 文章列表（学习路线、知识库） */
.article-list {
  display: grid;
  gap: 2px;
  list-style: none;
}

.article-item-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--ink);
  border-radius: 10px;
  transition: background-color 0.15s;
}

.article-item-link:hover {
  color: var(--ink);
  text-decoration: none;
  background: var(--surface-2);
}

.article-item-status,
.article-card-status,
.doc-nav-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  color: transparent;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.is-learned .article-item-status,
.is-learned .article-card-status,
.is-learned .doc-nav-check {
  color: #ffffff;
  background: var(--success-solid);
  border-color: var(--success-solid);
}

.article-item-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.article-item-title {
  font-weight: 600;
}

.article-item-link:hover .article-item-title {
  color: var(--brand-strong);
}

.article-item-desc {
  font-size: 0.8125rem;
  color: var(--text-2);
}

.article-item-meta,
.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  flex: none;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.article-item-meta > span,
.article-card-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta-section {
  color: var(--text-2);
}

/* 知识库 */
.learn-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.learn-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.learn-section-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.learn-section-cover {
  flex: none;
}

.learn-section-text {
  flex: 1;
  min-width: 0;
}

.learn-section-title {
  font-size: 1.1875rem;
}

.learn-section-title a {
  color: var(--ink);
}

.learn-section-title a:hover {
  color: var(--brand-strong);
}

.learn-section-desc {
  margin-top: 2px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.article-list-compact .article-item-link {
  padding: 8px 10px;
}

/* 栏目页 */
.section-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.section-hero-text {
  flex: 1;
  min-width: 0;
}

.section-hero-meta {
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--text-3);
}

.article-cards {
  display: grid;
  gap: 14px;
  list-style: none;
}

.article-card-link {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.article-card-link:hover {
  color: var(--ink);
  text-decoration: none;
  border-color: var(--brand-soft-2);
  box-shadow: var(--shadow);
}

.article-card-index {
  flex: none;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.article-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
  min-width: 0;
}

.article-card-title {
  font-size: 1.0625rem;
  font-weight: 700;
}

.article-card-link:hover .article-card-title {
  color: var(--brand-strong);
}

.article-card-desc {
  font-size: 0.875rem;
  color: var(--text-2);
}

.article-card-meta {
  margin-top: 4px;
}

/* ---------- 7. 文章页 ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 232px;
  gap: 40px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  flex: 1 0 auto;
}

.doc-sidebar,
.doc-toc {
  position: relative;
}

.doc-sidebar > .doc-nav,
.doc-toc-inner {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.doc-sidebar {
  padding-top: 24px;
}

.drawer-head {
  display: none;
}

.doc-nav {
  padding-bottom: 24px;
}

.doc-nav-heading {
  margin: 0 8px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-3);
}

.doc-nav-section {
  margin-bottom: 2px;
}

.doc-nav-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  border-radius: 8px;
}

.doc-nav-summary::-webkit-details-marker {
  display: none;
}

.doc-nav-summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(-45deg);
  transition: transform 0.2s;
}

.doc-nav-section[open] > .doc-nav-summary::after {
  transform: rotate(45deg);
}

.doc-nav-summary:hover {
  background: var(--surface-2);
}

.doc-nav-name {
  flex: 1;
}

.doc-nav-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-3);
}

.doc-nav-list {
  margin: 2px 0 8px 14px;
  padding-left: 10px;
  list-style: none;
  border-left: 1px solid var(--border);
}

.doc-nav-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-2);
  border-radius: 6px;
}

.doc-nav-link:hover {
  color: var(--ink);
  text-decoration: none;
  background: var(--surface-2);
}

.doc-nav-link[aria-current="page"] {
  color: var(--brand-strong);
  font-weight: 700;
  background: var(--brand-soft);
}

.doc-nav-check {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border-width: 1.5px;
}

.doc-main {
  min-width: 0;
  padding: 24px 0 40px;
}

.article {
  max-width: var(--prose-width);
  margin: 0 auto;
  font-size: 17px;
}

.article-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.drawer-toggle {
  display: none;
}

.article-section {
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--brand-strong);
}

.article-title {
  font-size: clamp(1.75rem, 3.6vw, 2.375rem);
  font-weight: 800;
  line-height: 1.3;
}

.article-desc {
  margin-top: 12px;
  font-size: 1.0625rem;
  color: var(--text-2);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-3);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

a.meta-link {
  color: var(--text-2);
}

a.meta-link:hover {
  color: var(--brand-strong);
}

.meta-figures .icon {
  color: var(--brand);
}

.meta-learned {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 999px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  list-style: none;
}

.tag {
  padding: 1px 10px;
  font-size: 0.8125rem;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 999px;
}

.article-header {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-cover {
  margin: 24px 0 0;
  overflow: hidden;
  background: var(--figure-bg);
  border: 1px solid var(--figure-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  filter: var(--figure-filter);
}

.article-cover img {
  display: block;
  width: 100%;
}

.toc-inline {
  display: none;
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toc-inline > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.9375rem;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.toc-inline > summary::-webkit-details-marker {
  display: none;
}

.toc-inline > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.2s;
}

.toc-inline[open] > summary::after {
  transform: rotate(-135deg);
}

.toc-inline-count {
  margin-left: auto;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
}

.toc-inline .toc {
  padding: 0 16px 12px;
}

.goals {
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--success-soft);
  border: 1px solid rgba(26, 127, 55, 0.18);
  border-radius: var(--radius);
}

.goals-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--success);
}

.goals-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  list-style: none;
  font-size: 0.9375rem;
}

.goals-list li {
  position: relative;
  padding-left: 26px;
}

.goals-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.45em;
  width: 14px;
  height: 14px;
  background: var(--success-solid);
  border-radius: 50%;
}

.goals-list li::after {
  content: "";
  position: absolute;
  left: 6.5px;
  top: calc(0.45em + 3px);
  width: 4px;
  height: 7px;
  border-right: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(45deg);
}

/* 目录 */
.doc-toc {
  padding-top: 24px;
}

.toc-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.toc-list {
  list-style: none;
  border-left: 1px solid var(--border);
}

.toc-link {
  display: block;
  margin-left: -1px;
  padding: 4px 0 4px 12px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-2);
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.toc-level-3 .toc-link {
  padding-left: 24px;
  font-size: 0.78125rem;
  color: var(--text-3);
}

.toc-link:hover {
  color: var(--ink);
  text-decoration: none;
}

.toc-link.is-active {
  color: var(--brand-strong);
  font-weight: 600;
  border-left-color: var(--brand);
}

.toc-compact .toc-list {
  border-left: 0;
}

.toc-compact .toc-link {
  border-left: 0;
  padding-left: 0;
  font-size: 0.875rem;
}

.toc-compact .toc-level-3 .toc-link {
  padding-left: 14px;
}

.toc-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* ---------- 正文 prose ---------- */
.prose {
  line-height: 1.8;
}

.article-body {
  margin-top: 28px;
}

.prose > * + * {
  margin-top: 1em;
}

.prose h2,
.prose h3,
.prose h4 {
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.prose h2 {
  margin-top: 2.2em;
  margin-bottom: 0.2em;
  padding-bottom: 0.4em;
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  margin-top: 1.8em;
  font-size: 1.2rem;
}

.prose h4 {
  margin-top: 1.5em;
  font-size: 1.05rem;
}

.prose > :first-child {
  margin-top: 0;
}

.heading-anchor {
  margin-left: 0.35em;
  font-weight: 500;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s;
}

.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.prose h4:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--brand-strong);
  text-decoration: none;
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li + li,
.prose li > ul,
.prose li > ol {
  margin-top: 0.35em;
}

.prose li > p + p,
.prose li > p + figure,
.prose li > figure + p {
  margin-top: 0.6em;
}

.prose li::marker {
  color: var(--text-3);
}

.prose ol > li::marker {
  font-weight: 700;
  color: var(--brand-strong);
}

.prose strong {
  font-weight: 700;
  color: var(--ink);
}

.prose hr {
  height: 1px;
  margin: 2em 0;
  background: var(--border);
  border: 0;
}

.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding: 4px 0 4px 16px;
  color: var(--text-2);
  border-left: 4px solid var(--border-strong);
}

.prose blockquote > * + * {
  margin-top: 0.6em;
}

.prose code {
  padding: 0.12em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  font-size: 0.875rem;
  line-height: 1.65;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.prose pre code {
  padding: 0;
  font-size: inherit;
  background: none;
  border: 0;
}

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--brand-soft-2);
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose a.heading-anchor {
  text-decoration: none;
}

.prose a.external-link::after {
  content: "↗";
  display: inline-block;
  margin-left: 2px;
  font-size: 0.75em;
  text-decoration: none;
}

.prose del,
.prose s {
  color: var(--text-3);
}

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.prose th {
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-2);
}

/* 单元格保留最小宽度（border-box，含内边距），别被右侧长文字挤成一行一个字；
   第一列通常是“项目 / 类型”这类短标签，再宽一些。列多放不下时在 .table-wrap 内横向滚动。 */
.prose td {
  min-width: 5em;
}

.prose td:first-child {
  min-width: 6.5em;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose tbody tr:hover td {
  background: var(--surface-2);
}

.prose-sm {
  font-size: 0.9375rem;
  line-height: 1.75;
}

/* 可勾选清单 */
.task-list {
  padding-left: 0 !important;
  list-style: none;
}

.task-item {
  position: relative;
}

.task-item > label,
.task-item > p > label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.15s;
}

.task-item > label:hover,
.task-item > p > label:hover {
  background: var(--surface-2);
}

.task-checkbox {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0.3em 0 0;
  accent-color: var(--success);
  cursor: pointer;
}

.task-item.is-checked > label,
.task-item.is-checked > p > label {
  color: var(--text-3);
}

.task-item.is-checked strong {
  color: var(--text-2);
}

/* 提示框 */
.callout {
  --c: var(--info);
  --c-soft: var(--info-soft);
  margin: 1.4em 0;
  padding: 14px 18px 14px 18px;
  font-size: 0.96em;
  line-height: 1.75;
  background: var(--c-soft);
  border-left: 4px solid var(--c);
  border-radius: 4px 10px 10px 4px;
}

.callout > * + * {
  margin-top: 0.6em;
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--c);
}

.callout-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
}

.callout-tip { --c: var(--teal); --c-soft: var(--teal-soft); }
.callout-info { --c: var(--info); --c-soft: var(--info-soft); }
.callout-warning { --c: var(--warning); --c-soft: var(--warning-soft); }
.callout-danger { --c: var(--danger); --c-soft: var(--danger-soft); }
.callout-bobo { --c: var(--brand-strong); --c-soft: var(--brand-soft); }
.callout-example { --c: var(--purple); --c-soft: var(--purple-soft); }
.callout-good { --c: var(--success); --c-soft: var(--success-soft); }
.callout-bad { --c: var(--danger); --c-soft: var(--danger-soft); }

.callout-avatar {
  width: 26px;
  height: 26px;
  font-size: 0.875rem;
  font-weight: 800;
  color: #ffffff;
  background: var(--btn-bg);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(217, 68, 43, 0.3);
}

.callout .table-wrap {
  background: var(--surface);
}

.callout ul,
.callout ol {
  padding-left: 1.3em;
}

/* ---------- 插图：图片 / 动图 / 视频 ---------- */
.figure {
  margin: 1.8em 0;
}

.figure-frame {
  position: relative;
  padding: 12px;
  background: var(--figure-bg);
  border: 1px solid var(--figure-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  filter: var(--figure-filter);
}

.figure-frame img,
.figure-frame video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.figure-zoom {
  position: relative;
  display: block;
  cursor: zoom-in;
  border-radius: 6px;
}

.figure-zoom:focus-visible {
  outline-offset: 4px;
}

.figure-zoom-hint {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #ffffff;
  background: rgba(31, 35, 40, 0.62);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.figure-zoom:hover .figure-zoom-hint,
.figure-zoom:focus-visible .figure-zoom-hint {
  opacity: 1;
}

.figure figcaption {
  margin-top: 0.7em;
  padding: 0 1em;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
  color: var(--text-2);
}

.figure-num {
  font-weight: 700;
  color: var(--ink);
}

.figure-num::after {
  content: " ·";
}

/* 动图：角标骑在卡片右上角的边框上，重播按钮放在图片下方的独立条里，都不遮挡图片内容 */
.figure-anim .figure-frame {
  padding-bottom: 50px;
}

.figure-anim .figure-frame::after {
  content: "动图演示 · 自动循环播放";
  position: absolute;
  left: 16px;
  bottom: 16px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #6e7781;
  pointer-events: none;
}

.figure-badge {
  position: absolute;
  top: -11px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  color: #ffffff;
  background: rgba(194, 58, 33, 0.92);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  pointer-events: none;
}

.figure-badge-dot {
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  animation: badge-pulse 1.6s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.figure-replay {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 11px 3px 9px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1f2328;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d0d7de;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(31, 35, 40, 0.12);
  opacity: 0.85;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}

.figure-replay:hover,
.figure-replay:focus-visible {
  color: #c23a21;
  border-color: #d9442b;
  opacity: 1;
}

.figure-replay.is-spinning .icon {
  animation: spin-once 0.6s ease;
}

@keyframes spin-once {
  to { transform: rotate(-360deg); }
}

.inline-img {
  display: inline-block;
  max-height: 1.6em;
  vertical-align: middle;
}

.inline-video {
  display: block;
  width: 100%;
  border-radius: 8px;
}

/* ---------- 分步教程 ---------- */
.steps {
  margin: 1.6em 0;
  padding: 22px 22px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.steps > ol {
  margin: 0;
  padding: 0 !important;
  list-style: none;
  counter-reset: step;
}

.steps > ol > li {
  position: relative;
  margin: 0;
  padding: 0 0 20px 52px;
  counter-increment: step;
}

.steps > ol > li + li {
  margin-top: 0;
}

.steps > ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  background: var(--btn-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.steps > ol > li::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 42px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(var(--brand-soft-2), var(--border));
  border-radius: 2px;
}

.steps > ol > li:last-child::after {
  display: none;
}

.steps > ol > li > p:first-child,
.steps > ol > li:not(:has(> p)) {
  padding-top: 4px;
}

.steps > ol > li > p:first-child > strong:first-child,
.steps > ol > li > strong:first-child {
  font-size: 1.06em;
  color: var(--ink);
}

.steps > ol > li > .figure {
  margin: 0.9em 0 0.4em;
}

.steps > ol > li > ul,
.steps > ol > li > ol {
  margin-top: 0.5em;
}

/* ---------- 小测 ---------- */
.quiz {
  margin-top: 48px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.quiz-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.375rem;
}

.quiz-title .icon {
  color: var(--brand);
}

.quiz-intro {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.quiz-list {
  display: grid;
  gap: 24px;
  margin-top: 20px;
  list-style: none;
}

.quiz-q {
  display: flex;
  gap: 10px;
  font-weight: 700;
  line-height: 1.6;
}

.quiz-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  font-size: 0.875rem;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-radius: 8px;
}

.quiz-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9375rem;
  line-height: 1.6;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s, background-color 0.15s;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-letter {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 50%;
}

.quiz-option-text {
  flex: 1;
}

.quiz-mark {
  flex: none;
  font-weight: 800;
}

.quiz-option.is-correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.quiz-option.is-correct .quiz-letter {
  color: #ffffff;
  background: var(--success-solid);
}

.quiz-option.is-correct .quiz-mark::after {
  content: "✓";
  color: var(--success);
}

.quiz-option.is-wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.quiz-option.is-wrong .quiz-letter {
  color: #ffffff;
  background: var(--danger-solid);
}

.quiz-option.is-wrong .quiz-mark::after {
  content: "✕";
  color: var(--danger);
}

.quiz-option.is-dimmed {
  opacity: 0.6;
}

.quiz-feedback {
  margin-top: 10px;
  padding: 12px 14px;
  font-size: 0.9375rem;
  line-height: 1.7;
  background: var(--surface-2);
  border-radius: 10px;
}

.quiz-feedback.is-correct {
  background: var(--success-soft);
}

.quiz-feedback.is-wrong {
  background: var(--danger-soft);
}

.quiz-verdict {
  font-weight: 700;
}

.quiz-feedback.is-correct .quiz-verdict {
  color: var(--success);
}

.quiz-feedback.is-wrong .quiz-verdict {
  color: var(--danger);
}

.quiz-explain {
  margin-top: 4px;
  color: var(--text-2);
}

.quiz-reveal {
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.quiz-reveal summary {
  cursor: pointer;
  color: var(--brand-strong);
}

.js .quiz-reveal {
  display: none;
}

.quiz-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--brand-soft);
  border-radius: var(--radius);
}

.quiz-result.is-perfect {
  background: var(--success-soft);
}

.quiz-score {
  font-weight: 700;
}

/* 标记已学完 */
.learn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 48px;
  padding: 28px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.btn-learn {
  min-height: 52px;
  padding: 10px 28px 10px 14px;
  font-size: 1.0625rem;
  border: 2px solid var(--success);
  border-radius: 999px;
  color: var(--success);
  background: var(--surface);
}

.btn-learn-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--success);
  border: 2px solid var(--success);
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.btn-learn:hover {
  background: var(--success-soft);
  color: var(--success);
}

.btn-learn[aria-pressed="true"] {
  color: #ffffff;
  background: var(--success-solid);
  border-color: var(--success-solid);
}

.btn-learn[aria-pressed="true"] .btn-learn-icon {
  color: var(--success);
  background: #ffffff;
  border-color: #ffffff;
}

.btn-learn[aria-pressed="true"]:hover {
  background: #17702f;
  color: #ffffff;
}

.learn-action-hint {
  font-size: 0.875rem;
  color: var(--text-3);
}

/* 上一篇 / 下一篇 */
.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.pager-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pager-link:hover {
  color: var(--ink);
  text-decoration: none;
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.pager-empty {
  visibility: hidden;
}

.pager-next {
  align-items: flex-end;
  text-align: right;
}

.pager-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.pager-title {
  font-weight: 700;
}

.pager-link:hover .pager-title {
  color: var(--brand-strong);
}

.back-to-path {
  margin-top: 20px;
  text-align: center;
  font-size: 0.9375rem;
}

.back-to-path a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.drawer-overlay {
  display: none;
}

/* ---------- 8. 词典 ---------- */
.glossary-tools {
  position: sticky;
  top: var(--header-h);
  z-index: 10;
  display: grid;
  gap: 12px;
  margin: -8px 0 24px;
  padding: 14px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.filter-box {
  position: relative;
  max-width: 560px;
}

.filter-box-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--text-3);
  transform: translateY(-50%);
}

.filter-input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.filter-status {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.category-index {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.glossary-groups {
  display: grid;
  gap: 36px;
}

.glossary-group {
  scroll-margin-top: calc(var(--header-h) + 150px);
}

.glossary-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 1.25rem;
}

.glossary-group-count {
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 999px;
}

.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.term-card {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  scroll-margin-top: calc(var(--header-h) + 160px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.term-card:target,
.term-card.is-highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.term-card.is-highlight {
  animation: term-flash 1.6s ease;
}

@keyframes term-flash {
  0%, 30% { background: var(--brand-soft); }
  100% { background: var(--surface); }
}

.term-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.term-name {
  font-size: 1.125rem;
}

.term-anchor {
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s;
}

.term-card:hover .term-anchor,
.term-anchor:focus {
  opacity: 1;
}

.term-aliases {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.term-alias {
  padding: 0 8px;
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 6px;
}

.term-def {
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.75;
}

.term-example {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  font-size: 0.875rem;
  color: var(--text-2);
  border-top: 1px dashed var(--border);
}

.term-example-label {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-radius: 5px;
}

/* ---------- 常见问题 ---------- */
.faq-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.faq-toggle-all {
  display: flex;
  gap: 8px;
}

.faq-group {
  margin-bottom: 36px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.faq-group-title {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.faq-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.faq-item + .faq-item {
  border-top: 1px solid var(--border);
}

.faq-item {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  transition: background-color 0.15s;
}

.faq-q::-webkit-details-marker {
  display: none;
}

.faq-q::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.2s;
}

.faq-item[open] > .faq-q::after {
  transform: rotate(-135deg);
}

.faq-q:hover {
  background: var(--surface-2);
}

.faq-item[open] > .faq-q {
  color: var(--brand-strong);
}

.faq-item:target > .faq-q,
.faq-item.is-highlight > .faq-q {
  background: var(--brand-soft);
}

.faq-a {
  padding: 0 18px 16px;
  color: var(--ink);
}

.faq-permalink {
  font-size: 0.8125rem;
}

.faq-list-compact .faq-q {
  padding: 12px 16px;
  font-size: 0.9375rem;
}

.faq-more {
  padding: 16px 18px;
  font-size: 0.9375rem;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: var(--radius);
}

/* ---------- 进度页 ---------- */
.progress-page {
  display: grid;
  gap: 24px;
}

.rank-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 36px;
  padding: 32px;
  background:
    radial-gradient(500px 240px at 0% 0%, var(--brand-soft), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.rank-belt {
  display: grid;
  place-items: center;
  width: 220px;
  height: 160px;
  background: var(--surface-2);
  border-radius: 20px;
}

.rank-kicker {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-3);
}

.rank-name {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.rank-motto {
  margin: 4px 0 18px;
  font-size: 1.125rem;
  color: var(--brand-strong);
  font-weight: 600;
}

.rank-next {
  margin-top: 10px;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.belt-ladder {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
}

.belt-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  opacity: 0.6;
}

.belt-step.is-achieved {
  opacity: 1;
}

.belt-step.is-current {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.belt-step-name {
  font-weight: 700;
}

.belt-step-rule {
  font-size: 0.75rem;
  color: var(--text-3);
}

.belt-step-motto {
  font-size: 0.8125rem;
  color: var(--text-2);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-3);
}

.stat-value {
  margin-top: 4px;
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-3);
}

.progress-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.progress-rows {
  display: grid;
  gap: 14px;
  list-style: none;
}

.progress-row {
  display: grid;
  gap: 6px;
}

.progress-row-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
}

.learned-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  list-style: none;
}

.learned-list:empty {
  display: none;
}

.learned-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface-2);
  border-radius: 10px;
}

.learned-item a:hover {
  color: var(--brand-strong);
  text-decoration: none;
}

.learned-item .icon {
  color: var(--success);
}

.learned-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.9375rem;
}

.learned-item-date {
  flex: none;
  font-size: 0.75rem;
  color: var(--text-3);
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.confirm-dialog::backdrop {
  background: var(--overlay);
}

.confirm-panel {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.confirm-title {
  font-size: 1.1875rem;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ---------- 搜索页 ---------- */
.inline-search {
  position: relative;
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin-top: 20px;
}

.inline-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.inline-search-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px 0 42px;
  font-size: 1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
}

.inline-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.inline-search .btn {
  min-height: 46px;
}

.search-tips,
.search-count {
  margin-bottom: 16px;
  color: var(--text-2);
}

.suggest-list {
  display: inline-grid;
  gap: 6px;
  margin-top: 8px;
  padding-left: 1.2em;
  text-align: left;
}

.result-list {
  display: grid;
  gap: 12px;
  list-style: none;
}

.result-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.result-link:hover {
  color: var(--ink);
  text-decoration: none;
  border-color: var(--brand);
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.result-title {
  font-size: 1.0625rem;
  font-weight: 700;
}

.result-snippet {
  font-size: 0.875rem;
  color: var(--text-2);
}

/* ---------- 错误页 ---------- */
.page-error {
  display: flex;
  align-items: center;
  padding: 64px 0;
}

.error-box {
  text-align: center;
}

.error-code {
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 900;
  line-height: 1;
  color: var(--brand);
  opacity: 0.2;
  letter-spacing: 0.08em;
}

.error-box .page-lead {
  margin-left: auto;
  margin-right: auto;
}

.error-box .inline-search {
  margin-left: auto;
  margin-right: auto;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.error-stack {
  margin-top: 28px;
  text-align: left;
}

.error-stack pre {
  overflow-x: auto;
  padding: 16px;
  font-size: 0.8125rem;
  background: var(--surface-2);
  border-radius: 10px;
}

/* ---------- 9. 灯箱 ---------- */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 24px;
  background: transparent;
  border: 0;
  overflow: hidden;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgba(12, 13, 16, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lightbox-panel {
  display: contents;
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(1200px, 100%);
  max-height: 100%;
  margin: 0;
  animation: lightbox-in 0.2s ease both;
}

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}

.lightbox-media {
  min-height: 0;
  padding: 14px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  filter: var(--figure-filter);
}

.lightbox-media img {
  display: block;
  width: auto;
  max-width: calc(100vw - 80px);
  max-height: calc(100vh - 150px);
  object-fit: contain;
}

.lightbox-media img[src$=".svg"],
.lightbox-media img[src*=".svg?"] {
  width: min(1100px, calc(100vw - 80px));
}

.lightbox-caption {
  max-width: 48em;
  font-size: 0.9375rem;
  text-align: center;
  color: #e6e8eb;
}

.lightbox-caption .figure-num {
  color: #ffffff;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  transition: background-color 0.15s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.lightbox-pan-hint {
  display: none;
  margin: 0;
  font-size: 0.8125rem;
  text-align: center;
  color: #c9ced4;
}

/* 触屏设备没有 hover：常驻显示放大图标，提示图片可以点开 */
@media (hover: none) {
  .figure-zoom-hint {
    opacity: 0.85;
  }
}

/* ---------- 10. 响应式 ---------- */
@media (max-width: 1199.98px) {
  .doc-layout {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 36px;
  }

  .doc-toc {
    display: none;
  }

  .toc-inline {
    display: block;
  }
}

@media (max-width: 1023.98px) {
  .search-trigger {
    min-width: 0;
  }

  .search-trigger-text,
  .search-trigger-kbd {
    display: none;
  }

  .hero-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .hero-art {
    max-width: 640px;
  }

  .overview-grid,
  .home-duo {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .learn-sections {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .belt-ladder {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 899.98px) {
  .menu-toggle {
    display: inline-grid;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    padding: 8px var(--gutter) 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav-list {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav-link {
    padding: 10px 12px;
    font-size: 1rem;
  }

  .site-nav-extra {
    display: block;
  }

  /* 没有 JS 时，导航以横向滚动条的形式显示在页头下方 */
  .no-js .site-header {
    height: auto;
  }

  .no-js .header-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
  }

  .no-js .site-nav {
    position: static;
    display: block;
    order: 3;
    width: 100%;
    padding: 0 0 8px;
    overflow-x: auto;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .no-js .site-nav-list {
    flex-direction: row;
  }
}

@media (max-width: 767.98px) {
  :root {
    --gutter: 16px;
    --header-h: 56px;
  }

  .header-inner {
    gap: 12px;
  }

  .brand-name {
    font-size: 1.0625rem;
  }

  .belt-badge {
    padding: 0 10px 0 6px;
  }

  .belt-badge-sep,
  .belt-badge [data-belt-count] {
    display: none;
  }

  .hero {
    padding: 32px 0 24px;
  }

  .hero-intro {
    font-size: 1rem;
  }

  .hero-actions .btn {
    flex: 1 1 140px;
  }

  .hero-art {
    padding: 6px;
    border-radius: 14px;
  }

  .belt-card {
    padding: 18px;
  }

  .belt-card-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .continue {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .stat-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-section {
    padding: 40px 0;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .home-cta-inner {
    flex-direction: column;
    align-items: flex-start;
    margin: 0 var(--gutter);
    padding: 28px 20px;
    max-width: none;
    width: auto;
  }

  .timeline {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline {
    gap: 10px;
  }

  .timeline-link {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 2px;
    padding: 14px 16px;
  }

  .timeline-link > * {
    grid-column: 2;
  }

  .timeline-link > .timeline-dot {
    grid-column: 1;
    grid-row: 1 / span 4;
    margin: 0;
  }

  .timeline-meta {
    margin: 2px 0 6px;
  }

  .page-hero {
    padding: 24px 0 20px;
    margin-bottom: 24px;
  }

  .section-hero {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 16px;
  }

  .cover-hero {
    width: 100%;
    max-width: 420px;
  }

  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .stage-rail {
    display: none;
  }

  .stage-card {
    padding: 18px;
  }

  .stage-head {
    flex-direction: column;
    gap: 8px;
  }

  .article-item-link {
    flex-wrap: wrap;
    padding: 10px 8px;
  }

  .article-item-main {
    flex-basis: calc(100% - 40px);
  }

  .article-item-meta {
    width: 100%;
    padding-left: 34px;
  }

  .learn-section {
    padding: 16px;
  }

  .learn-section-head {
    flex-wrap: wrap;
  }

  .cover-thumb {
    width: 88px;
  }

  .article-card-link {
    gap: 12px;
    padding: 14px;
  }

  .article-card-index {
    display: none;
  }

  /* 文章页：单栏 + 抽屉导航 */
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .doc-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    width: min(320px, 86vw);
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }

  .doc-sidebar.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.25s ease;
  }

  .no-js .doc-sidebar {
    position: static;
    width: auto;
    transform: none;
    visibility: visible;
    box-shadow: none;
    order: 2;
    background: none;
  }

  .doc-sidebar > .doc-nav {
    position: static;
    max-height: none;
    padding: 8px 12px 24px;
  }

  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .no-js .drawer-head {
    display: none;
  }

  .drawer-title {
    font-weight: 700;
  }

  .drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: block;
    background: var(--overlay);
    animation: fade-in 0.2s ease both;
  }

  .drawer-overlay[hidden] {
    display: none;
  }

  .drawer-toggle {
    display: inline-flex;
    flex: none;
  }

  .doc-main {
    padding-top: 16px;
  }

  .article {
    font-size: 16px;
  }

  .article-topbar {
    margin-bottom: 14px;
  }

  .breadcrumb [aria-current="page"] {
    max-width: 9em;
  }

  .prose h2 {
    font-size: 1.3125rem;
  }

  .prose h3 {
    font-size: 1.125rem;
  }

  .figure-frame {
    padding: 6px;
    border-radius: 10px;
  }

  .figure-anim .figure-frame {
    padding-bottom: 44px;
  }

  .figure-anim .figure-frame::after {
    left: 10px;
    bottom: 13px;
  }

  .figure-badge {
    right: 10px;
    font-size: 0.6875rem;
  }

  .figure-replay {
    right: 8px;
    bottom: 7px;
    min-height: 28px;
    padding: 2px 9px 2px 7px;
    font-size: 0.75rem;
    opacity: 1;
  }

  .figure figcaption {
    padding: 0;
  }

  .steps {
    padding: 16px 14px 2px;
  }

  .steps > ol > li {
    padding-left: 42px;
  }

  .steps > ol > li::before {
    width: 30px;
    height: 30px;
    font-size: 0.9375rem;
  }

  .steps > ol > li::after {
    left: 14px;
    top: 36px;
  }

  /* 手机上步骤里的插图占满卡片宽度（不再缩进 42px），图里的字大一些 */
  .steps > ol > li > .figure {
    position: relative;
    z-index: 1;
    margin-left: -42px;
    background: var(--surface);
  }

  /* 手机上表格：收紧单元格内边距（最小宽度见上方 .prose td），列多时在表格内横向滚动 */
  .prose th,
  .prose td {
    padding: 8px 10px;
  }

  .callout {
    padding: 12px 14px;
  }

  .quiz {
    padding: 18px 16px;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager-empty {
    display: none;
  }

  .glossary-tools {
    position: static;
    padding: 10px 0;
  }

  .glossary-group,
  .term-card {
    scroll-margin-top: calc(var(--header-h) + 16px);
  }

  .term-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .faq-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .rank-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 20px;
    text-align: center;
  }

  .rank-belt {
    width: 100%;
    height: 140px;
  }

  .rank-name {
    font-size: 2rem;
  }

  .belt-ladder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .progress-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel {
    padding: 18px;
  }

  .inline-search .btn {
    padding: 0 14px;
  }

  .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .back-to-top {
    right: 16px;
    bottom: 16px;
  }

  .lightbox {
    padding: 12px;
  }

  .lightbox-media {
    padding: 6px;
  }

  .lightbox-media img {
    max-width: calc(100vw - 36px);
  }

  .lightbox-media img[src$=".svg"],
  .lightbox-media img[src*=".svg?"] {
    width: calc(100vw - 36px);
  }

  /* 手机竖屏：SVG 以接近原始尺寸（800 宽画布）显示，左右滑动查看，图里的小字也能看清 */
  .lightbox.is-pannable {
    grid-template-columns: minmax(0, 1fr);
    padding: 64px 0 16px;
  }

  .lightbox.is-pannable .lightbox-figure {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    align-items: stretch;
    gap: 10px;
  }

  .lightbox.is-pannable .lightbox-media {
    width: 100%;
    min-width: 0;
    max-height: calc(100vh - 170px);
    padding: 8px;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 0;
  }

  .lightbox.is-pannable .lightbox-media img[src$=".svg"],
  .lightbox.is-pannable .lightbox-media img[src*=".svg?"] {
    width: 760px;
    max-width: none;
    max-height: none;
  }

  .lightbox.is-pannable .lightbox-pan-hint {
    display: block;
  }

  .lightbox.is-pannable .lightbox-caption {
    padding: 0 16px;
  }
}

@media (max-width: 479.98px) {
  .belt-badge-text {
    display: none;
  }

  .belt-badge {
    padding: 0 6px;
  }

  .stat-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .stat-tile dd {
    font-size: 1.5rem;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .figure-badge-dot {
    animation: none;
  }

  .figure-anim .figure-frame::after {
    content: "已按系统设置暂停动画，显示完成后的画面";
  }

  .figure-replay {
    display: none;
  }
}

/* 打印：只打印正文 */
@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --ink: #000000;
    --text-2: #333333;
    --figure-filter: none;
  }

  .site-header,
  .site-footer,
  .reading-progress,
  .doc-sidebar,
  .doc-toc,
  .drawer-overlay,
  .article-topbar,
  .toc-inline,
  .learn-action,
  .pager,
  .back-to-path,
  .back-to-top,
  .toast-region,
  .quiz,
  .figure-replay,
  .figure-badge,
  .figure-zoom-hint,
  .heading-anchor,
  .skip-link,
  dialog {
    display: none !important;
  }

  body {
    display: block;
    font-size: 12pt;
    background: #ffffff;
  }

  .doc-layout {
    display: block;
    padding: 0;
  }

  .article {
    max-width: none;
  }

  .prose a {
    color: #000000;
  }

  .figure,
  .callout,
  .table-wrap,
  .steps > ol > li {
    break-inside: avoid;
  }

  .figure-frame,
  .steps,
  .callout {
    box-shadow: none;
  }
}

/* ---------- 口令卡片（上锁文章） ---------- */
.page-lock {
  padding: clamp(32px, 8vh, 88px) 0;
}

.lock-wrap {
  display: flex;
  justify-content: center;
}

.lock-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 40px 32px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: lock-card-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.lock-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), #e3b21c);
  transition: background 0.3s;
}

.lock-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-soft);
  transition: color 0.3s, background 0.3s;
  animation: lock-bob 3.2s ease-in-out 0.6s infinite;
}

.lock-svg {
  overflow: visible;
}

.lock-shackle {
  stroke: currentColor;
  transform-box: fill-box;
  transform-origin: 100% 100%;
  transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.lock-body {
  fill: currentColor;
}

.lock-hole {
  fill: var(--surface);
}

.lock-spark {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success-solid);
  opacity: 0;
}

.lock-spark-1 { top: 8px; left: 6px; --dx: -16px; --dy: -14px; }
.lock-spark-2 { top: 0; right: 14px; --dx: 10px; --dy: -18px; }
.lock-spark-3 { bottom: 10px; right: 0; --dx: 18px; --dy: 8px; }

.lock-eyebrow {
  margin: 0 0 4px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.lock-title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  line-height: 1.35;
}

.lock-lead {
  margin: 0 0 24px;
  color: var(--text-2);
}

.lock-form {
  text-align: left;
}

.lock-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.lock-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 14px;
  color: var(--text-3);
  background: var(--surface);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lock-field:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.18);
}

.lock-input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  font: inherit;
  font-size: 1.125rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.lock-message {
  min-height: 1.5em;
  margin: 8px 2px 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--danger);
}

.lock-submit {
  width: 100%;
  justify-content: center;
}

.lock-submit[disabled] {
  opacity: 0.75;
  cursor: progress;
}

.lock-note {
  margin: 14px 0 0;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--text-3);
}

/* 输错：卡片左右抖、锁梁晃、输入框变红 */
.lock-card.is-error {
  animation: lock-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.lock-card.is-error .lock-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.lock-card.is-error .lock-shackle {
  animation: lock-rattle 0.5s ease both;
}

.lock-card.is-error .lock-field {
  border-color: var(--danger);
}

/* 输对：锁梁弹开、变绿、冒出小圆点，然后卡片淡出 */
.lock-card.is-unlocked {
  animation: lock-card-out 0.35s ease 0.6s both;
}

.lock-card.is-unlocked::before {
  background: var(--success-solid);
}

.lock-card.is-unlocked .lock-icon {
  color: var(--success-solid);
  background: var(--success-soft);
  animation: lock-pop 0.5s ease both;
}

.lock-card.is-unlocked .lock-shackle {
  transform: translateY(-8px) rotate(30deg);
}

.lock-card.is-unlocked .lock-spark {
  animation: lock-spark 0.7s ease-out 0.15s both;
}

.lock-card.is-unlocked .lock-field {
  border-color: var(--success);
}

.lock-card.is-unlocked .lock-message {
  color: var(--success);
}

@keyframes lock-card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

@keyframes lock-card-out {
  to { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

@keyframes lock-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes lock-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

@keyframes lock-rattle {
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(9deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(3deg); }
}

@keyframes lock-pop {
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes lock-spark {
  0% { opacity: 1; transform: scale(0.3); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.2); }
}

@media (max-width: 520px) {
  .lock-card {
    padding: 32px 20px 24px;
  }
}

.badge-lock {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--brand-strong);
  background: var(--brand-soft);
}

.doc-nav-lock {
  vertical-align: -1px;
  color: var(--text-3);
}

/* ---------- 文章里的小工具（利润计算器 / 选品评分卡） ---------- */
.tool {
  margin: 1.6em 0;
  padding: 18px 20px 20px;
  font-size: 0.95em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tool-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 1.05em;
  font-weight: 800;
}

.tool-fallback > :last-child {
  margin-bottom: 0;
}

.tool-form {
  display: grid;
  gap: 16px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
}

.tool-grid-2 {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.tool-field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.tool-label {
  display: grid;
  gap: 2px;
  font-weight: 700;
  line-height: 1.4;
}

.tool-hint {
  font-size: 0.82em;
  font-weight: 400;
  color: var(--text-3);
}

.tool-control {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-control:focus-within,
.tool-textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

.tool-input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.tool-textarea {
  width: 100%;
  resize: vertical;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.tool-unit {
  padding: 0 10px;
  font-size: 0.85em;
  color: var(--text-2);
  white-space: nowrap;
}

.tool-output {
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.tool-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.tool-stat {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tool-stat-label {
  font-size: 0.82em;
  color: var(--text-2);
}

.tool-stat-value {
  font-size: 1.15em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.tool-stat.is-key {
  border-color: var(--brand-soft-2);
  background: var(--brand-soft);
}

.tool-verdict {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface);
  border-left: 4px solid var(--border-strong);
  border-radius: 4px 8px 8px 4px;
}

.tool-verdict.is-good { color: var(--success); border-left-color: var(--success); background: var(--success-soft); }
.tool-verdict.is-warn { color: var(--warning); border-left-color: var(--warning); background: var(--warning-soft); }
.tool-verdict.is-bad { color: var(--danger); border-left-color: var(--danger); background: var(--danger-soft); }

.tool-note {
  margin: 10px 0 0;
  font-size: 0.82em;
  color: var(--text-3);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.score-row {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.score-legend {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px;
  font-weight: 800;
}

.score-weight {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--text-3);
}

.score-options {
  display: flex;
  gap: 8px;
  margin: 6px 0 8px;
}

.score-option {
  cursor: pointer;
}

.score-dot {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-weight: 800;
  color: var(--text-2);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 50%;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}

.score-option:hover .score-dot {
  border-color: var(--brand);
}

.score-option input:checked + .score-dot {
  color: var(--on-brand);
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  transform: scale(1.06);
}

.score-option input:focus-visible + .score-dot {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.score-anchors {
  display: grid;
  gap: 2px;
  margin: 0;
  font-size: 0.82em;
  color: var(--text-3);
}

.score-total {
  margin: 0;
  font-weight: 700;
}

.score-total-value {
  font-size: 2em;
  font-weight: 900;
  color: var(--brand-strong);
  font-variant-numeric: tabular-nums;
}

.score-total-max {
  color: var(--text-3);
}

/* ---------- Wi-Fi 样式的口令卡片（lock.wifi） ---------- */
.wifi-card {
  max-width: 420px;
  padding: 18px 18px 20px;
  text-align: left;
}

.wifi-card::before {
  display: none;
}

.wifi-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.wifi-head-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  color: #ffffff;
  background: #0969da;
  border-radius: 50%;
  transition: background 0.3s;
}

.wifi-head-text {
  flex: 1;
  min-width: 0;
}

.wifi-head-title {
  margin: 0;
  font-weight: 800;
  line-height: 1.3;
}

.wifi-head-sub {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.wifi-toggle {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  background: #0969da;
  border-radius: 12px;
}

.wifi-toggle-knob {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
}

.wifi-scan {
  margin: 12px 2px 8px;
  font-size: 0.8125rem;
  color: var(--text-3);
}

.wifi-scan-dots span {
  animation: wifi-dot-blink 1.4s infinite both;
}

.wifi-scan-dots span:nth-child(2) { animation-delay: 0.2s; }
.wifi-scan-dots span:nth-child(3) { animation-delay: 0.4s; }

.wifi-network {
  padding: 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.3s, background 0.3s;
}

.wifi-net-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.wifi-signal {
  position: relative;
  flex: none;
  color: #0969da;
  transition: color 0.3s;
}

.wifi-signal svg {
  display: block;
  overflow: visible;
}

.wifi-arc {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.4;
  stroke-linecap: round;
}

.wifi-dot {
  fill: currentColor;
}

.wifi-lock-badge {
  position: absolute;
  right: -6px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
}

.wifi-net-text {
  min-width: 0;
}

.wifi-ssid {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-all;
}

.wifi-security {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--text-2);
  transition: color 0.3s;
}

.wifi-label {
  font-size: 0.875rem;
}

.wifi-field {
  padding-left: 12px;
}

.wifi-field .lock-input {
  letter-spacing: 0.04em;
}

.wifi-actions {
  display: flex;
  justify-content: flex-end;
}

.wifi-connect {
  min-width: 128px;
  justify-content: center;
  gap: 8px;
}

.wifi-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
}

.wifi-foot {
  margin: 14px 2px 0;
  font-size: 0.875rem;
  color: var(--text-2);
}

.wifi-card .lock-note {
  margin-top: 6px;
  text-align: left;
}

/* 正在连接：信号一格格亮起来、按钮转圈 */
.wifi-card.is-connecting .wifi-arc {
  animation: wifi-wave 1s ease-in-out infinite;
}

.wifi-card.is-connecting .wifi-arc-2 { animation-delay: 0.15s; }
.wifi-card.is-connecting .wifi-arc-3 { animation-delay: 0.3s; }

.wifi-card.is-connecting .wifi-spinner {
  display: inline-block;
  animation: wifi-spin 0.8s linear infinite;
}

.wifi-card.is-connecting .wifi-network {
  border-color: #0969da;
}

/* 密码不对：变红、抖动 */
.wifi-card.is-error .wifi-network {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.wifi-card.is-error .wifi-signal {
  color: var(--danger);
}

/* 连上了：变绿 */
.wifi-card.is-unlocked {
  animation: lock-card-out 0.35s ease 1.05s both;
}

.wifi-card.is-unlocked .wifi-head-icon,
.wifi-card.is-unlocked .wifi-toggle {
  background: var(--success-solid);
}

.wifi-card.is-unlocked .wifi-network {
  border-color: var(--success);
  background: var(--success-soft);
}

.wifi-card.is-unlocked .wifi-signal {
  color: var(--success-solid);
  animation: lock-pop 0.5s ease both;
}

.wifi-card.is-unlocked .wifi-security {
  color: var(--success);
  font-weight: 700;
}

.wifi-card.is-unlocked .wifi-scan {
  visibility: hidden;
}

@keyframes wifi-wave {
  0%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@keyframes wifi-spin {
  to { transform: rotate(360deg); }
}

@keyframes wifi-dot-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

.wifi-card .lock-message {
  min-height: 1.4em;
  margin: 6px 2px 8px;
}

.wifi-card.is-unlocked .wifi-connect {
  background: var(--success-solid);
  box-shadow: none;
}

/* 输入法提示：不是报错，用提醒色 */
.lock-message.is-hint {
  color: var(--warning);
}
