/* 效立方 · GEO外贸实战课 — 延续既有阅读站样式 */

:root {
  --primary: #5b4bb8;
  --primary-hover: #493a9e;
  --primary-soft: #f0ecff;
  --accent: #8b7cf0;
  --success: #0d8b70;
  --warning: #ad6500;
  --text: #2c2d34;
  --text-secondary: #4c4a5e;
  --text-muted: #707283;
  --bg: #f6f7fb;
  --bg-secondary: #f8f6ff;
  --surface: #ffffff;
  --border: #e8e6f3;
  --border-strong: #d7d0ed;
  --sidebar-bg: #ffffff;
  --sidebar-text: #555563;
  --sidebar-text-active: #5b4bb8;
  --sidebar-hover: #f4f1ff;
  --sidebar-active: #f0ecff;
  --sidebar-border: #e8e6f3;
  --sidebar-width: 280px;
  --header-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 36px rgba(15, 23, 42, 0.12);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --content-pad-x: 48px;
  --content-pad-y: 40px;
}

[data-theme="dark"] {
  --primary: #3b8bff;
  --primary-hover: #6aa4ff;
  --primary-soft: rgba(59, 139, 255, 0.16);
  --accent: #2dd4bf;
  --warning: #fbbf24;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --surface: #1e293b;
  --border: #334155;
  --border-strong: #475569;
  --sidebar-bg: #0b1220;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #f8fafc;
  --sidebar-hover: #334155;
  --sidebar-active: rgba(59, 139, 255, 0.22);
  --sidebar-border: #1e293b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

/* ---------- Reading progress ---------- */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 1000;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

/* ---------- Header ---------- */
.header {
  position: fixed; top: 3px; left: 0; right: 0; height: var(--header-height);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-center { flex: 1; max-width: 520px; margin: 0 auto; }
.header-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.menu-toggle {
  display: none;
  width: 36px; height: 36px; border: 1.5px solid var(--border);
  background: var(--bg-secondary); border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
  transition: all var(--transition);
}
.menu-toggle:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.menu-toggle .icon-close { display: none; }
.sidebar-open .menu-toggle .icon-menu { display: none; }
.sidebar-open .menu-toggle .icon-close { display: block; }

.logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none !important;
}
.logo-img {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.logo-img-dark { display: none; }
[data-theme="dark"] .logo-img-light { display: none; }
[data-theme="dark"] .logo-img-dark { display: block; }
.logo-text {
  display: flex; flex-direction: column; justify-content: center;
  line-height: 1.2;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.logo-sub { font-size: 12px; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
[data-theme="dark"] .logo-sub { color: #e2e8f0; }

.search-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg-secondary); color: var(--text-muted);
  cursor: pointer; font-size: 14px; transition: all var(--transition);
}
.search-trigger:hover { border-color: var(--primary); color: var(--text-secondary); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd,
.search-input-wrap kbd {
  font-size: 11px; padding: 2px 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); font-family: inherit; line-height: 1.4;
}

.overall-progress { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.progress-label { color: var(--text-muted); white-space: nowrap; }
.progress-bar-mini {
  width: 80px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.progress-fill-mini {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px; transition: width 0.45s ease;
}
.progress-pct { font-weight: 650; color: var(--primary); min-width: 36px; font-variant-numeric: tabular-nums; }

.theme-toggle {
  width: 36px; height: 36px; border: none; background: var(--bg-secondary);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--border); color: var(--text); }
.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: calc(var(--header-height) + 3px);
  left: 0; bottom: 0; width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  z-index: 90;
  overflow: hidden;
}
.sidebar-meta {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-meta .meta-line {
  font-size: 12px; color: var(--sidebar-text); font-weight: 600;
  letter-spacing: 0.04em;
}
.sidebar-meta .meta-progress {
  margin-top: 10px; display: flex; flex-direction: column;
  align-items: stretch; gap: 7px; font-size: 12px; color: var(--text-muted);
}
.sidebar-meta .bar {
  width: 100%; height: 4px; background: var(--border-strong); border-radius: 2px; overflow: hidden;
}
.sidebar-meta .meta-count { line-height: 1.3; }
.sidebar-meta .bar > span {
  display: block; height: 100%; background: var(--primary); border-radius: 2px;
  transition: width 0.45s ease;
}

.sidebar-nav {
  overflow-y: auto; padding: 10px 8px 28px;
  flex: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.mod-block { margin-bottom: 4px; }
.mod-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 0; background: transparent;
  color: var(--sidebar-text); cursor: pointer; text-align: left;
  border-radius: 8px; transition: background var(--transition);
  font-size: 13px; font-weight: 600; line-height: 1.35;
}
.mod-toggle:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.mod-toggle.is-current { color: var(--sidebar-text-active); }
.mod-ico {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  background: var(--sidebar-hover);
  display: grid; place-items: center; color: var(--primary);
}
.mod-ico svg { width: 15px; height: 15px; }
.mod-toggle .mod-name { flex: 1; min-width: 0; }
.mod-toggle .mod-num {
  font-size: 10px; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700;
  display: block; margin-bottom: 1px;
}
.mod-chevron {
  width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted);
  transition: transform var(--transition);
}
.mod-block.is-open .mod-chevron { transform: rotate(90deg); }

.mod-list { display: none; padding: 2px 0 8px 0; }
.mod-block.is-open .mod-list { display: block; }

.ch-link {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px 7px 14px; margin: 1px 0;
  border-radius: 8px; color: var(--sidebar-text);
  text-decoration: none !important; font-size: 12.5px; line-height: 1.5;
  border-left: 2px solid transparent;
  transition: background var(--transition), color var(--transition);
}
.ch-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.ch-link.is-active {
  background: var(--sidebar-active); color: var(--sidebar-text-active);
  border-left-color: var(--primary);
  font-weight: 600;
}
.ch-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  margin-top: 6px;
  background: var(--border-strong); box-shadow: inset 0 0 0 1px var(--text-muted);
}
.ch-link.is-done .ch-dot { background: var(--success); box-shadow: none; }
.ch-link.is-active .ch-dot { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ch-link .ch-title { flex: 1; min-width: 0; }

/* 避免侧栏长标题末字孤行（模块名与章名）；.nowrap 保护完整双字词，不从中间断开 */
.mod-toggle .mod-name,
.ch-link .ch-title {
  text-wrap: pretty;
}
.nowrap {
  white-space: nowrap;
}

.ch-link.is-upcoming { opacity: 0.62; }
.ch-link.is-upcoming .ch-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-muted); }
.ch-link.is-draft .ch-dot { background: #f59e0b; box-shadow: none; }
.ch-link.is-review .ch-dot { background: #60a5fa; box-shadow: none; }

/* ---------- Page ---------- */
.page-wrapper {
  padding-left: var(--sidebar-width);
  padding-top: calc(var(--header-height) + 3px);
  min-height: 100vh;
}
.main-content {
  padding: var(--content-pad-y) var(--content-pad-x) 80px;
  max-width: 1180px;
  outline: none;
}

/* ---------- Home ---------- */
.home-hero { max-width: 760px; padding: 12px 0 8px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 650; letter-spacing: 0.04em;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
}
.home-hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(32px, 4vw, 42px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.2;
  color: var(--text);
}
.home-hero h1 em {
  font-style: normal;
  color: var(--primary);
}
[data-theme="dark"] .home-hero h1 em { color: var(--primary); }
.home-lead {
  font-size: 16px; line-height: 1.8; color: var(--text-secondary);
  max-width: 640px;
}
.home-stats {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 0;
  margin: 32px 0 28px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0 32px 0 0; }
.stat + .stat { border-left: 1px solid var(--border); padding-left: 32px; }
.stat strong {
  font-size: 28px; font-weight: 800; color: var(--primary);
  line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em;
}
.stat span { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px; border: 0;
  background: var(--primary); color: #fff !important;
  font-size: 15px; font-weight: 650; cursor: pointer;
  box-shadow: 0 6px 16px rgba(91, 75, 184, 0.22);
  text-decoration: none !important;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(91, 75, 184, 0.28); }
.btn-primary:active { transform: none; }

.section-heading {
  margin: 48px 0 16px;
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.module-card {
  display: flex; flex-direction: column;
  padding: 20px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit; text-decoration: none !important;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  min-height: 188px;
}
.module-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.module-card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; margin-bottom: 14px;
}
.module-card-icon svg { width: 22px; height: 22px; }
.module-card-num {
  font-size: 11px; color: var(--text-muted); font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 4px;
}
.module-card-title {
  font-size: 15px; font-weight: 650; color: var(--text);
  margin-bottom: 8px; line-height: 1.4;
}
.module-card-desc {
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  flex: 1;
}
.module-card-foot {
  margin-top: 14px; font-size: 12px; color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.module-card.is-partial .module-card-foot { color: var(--text-secondary); }

/* ---------- Lesson ---------- */
.lesson-layout { display: block; }
.lesson-body { min-width: 0; max-width: 900px; }

.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 18px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border-strong); }

.module-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 650; margin-bottom: 12px;
}

.lesson-body h1 {
  font-size: 32px; font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.28; color: var(--text); margin: 0 0 12px;
}

.lesson-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 28px;
}
.lesson-meta .meta-item { display: inline-flex; align-items: center; gap: 6px; }
.lesson-meta svg { flex-shrink: 0; opacity: 0.8; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block;
}
.status-dot.final { background: var(--success); }
.status-dot.codex-review { background: var(--primary); }
.status-dot.draft { background: var(--warning); }

/* Article typography */
.markdown-body {
  font-size: 16px; line-height: 1.85; color: var(--text);
}
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body p { margin: 0 0 16px; }
.markdown-body h2 {
  font-size: 22px; font-weight: 750; letter-spacing: -0.02em;
  margin: 44px 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text); line-height: 1.35;
  scroll-margin-top: 84px;
}
.markdown-body h3 {
  font-size: 17px; font-weight: 700;
  margin: 28px 0 10px; color: var(--text);
  scroll-margin-top: 84px; line-height: 1.4;
}
.markdown-body h4 { font-size: 15px; font-weight: 700; margin: 20px 0 8px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 16px; padding-left: 1.4em; }
.markdown-body li { margin: 0 0 6px; }
.markdown-body li > ul, .markdown-body li > ol { margin-top: 6px; margin-bottom: 4px; }
.markdown-body strong { font-weight: 650; color: var(--text); }
.markdown-body hr {
  border: 0; border-top: 1px solid var(--border); margin: 28px 0;
}
.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.88em; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 0.1em 0.35em; color: var(--text);
}
.markdown-body pre {
  position: relative;
  background: #0f172a; color: #e2e8f0;
  border-radius: 10px; padding: 16px 18px; margin: 16px 0 22px;
  overflow-x: auto; font-size: 13px; line-height: 1.6;
  border: 1px solid #1e293b;
}
.markdown-body pre code {
  background: none; border: 0; padding: 0; color: inherit; font-size: inherit;
}
.markdown-body blockquote {
  margin: 18px 0; padding: 12px 16px;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}
.markdown-body blockquote p:last-child { margin-bottom: 0; }

.table-wrap {
  overflow: auto; margin: 16px 0 24px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface);
  max-width: 100%;
  max-height: calc(100vh - var(--header-height) - 96px);
  -webkit-overflow-scrolling: touch;
}
.markdown-body table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.markdown-body th, .markdown-body td {
  padding: 10px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); color: var(--text);
  word-break: keep-all;
  overflow-wrap: break-word;
  min-width: 5.5em;
}
.markdown-body thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--bg-secondary), color-mix(in srgb, var(--primary-soft) 55%, var(--bg-secondary)));
  font-weight: 700; color: var(--text); white-space: nowrap; font-size: 13px;
}
.markdown-body td:first-child,
.markdown-body th:first-child {
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border);
}
.markdown-body thead th:first-child {
  z-index: 3;
  background: linear-gradient(180deg, var(--bg-secondary), color-mix(in srgb, var(--primary-soft) 55%, var(--bg-secondary)));
}
.markdown-body tbody tr:last-child td { border-bottom: 0; }
.markdown-body tbody tr:hover td { background: var(--bg-secondary); }

label.task {
  display: flex; align-items: flex-start; gap: 8px; cursor: default;
}
label.task input { margin-top: 5px; accent-color: var(--primary); }

/* Callouts */
.callout {
  margin: 18px 0 22px; padding: 14px 16px 14px 18px;
  border-radius: 0 10px 10px 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
}
.callout-title {
  font-size: 12px; font-weight: 750; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 8px;
}
.callout p, .callout li { color: var(--text); }
.callout p:last-child, .callout ul:last-child, .callout ol:last-child { margin-bottom: 0; }
.callout-goal { border-left-color: var(--primary); }
.callout-objectives { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.callout-objectives .callout-title { color: #0f766e; }
[data-theme="dark"] .callout-objectives .callout-title { color: var(--accent); }

/* Pending figures — restrained, not audit-red */
.fig-pending {
  margin: 20px 0 24px; padding: 20px 18px;
  border: 1px dashed var(--border-strong);
  background: var(--bg-secondary);
  border-radius: 12px;
  color: var(--text-secondary);
}
.fig-pending-tag {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px; margin-bottom: 8px;
}
.fig-pending strong {
  display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; font-weight: 650;
}
.fig-pending p { margin: 0; font-size: 13px; color: var(--text-muted); }

/* Prev / next */
.lesson-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
}
.lesson-nav-btn {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  color: inherit; text-decoration: none !important;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 84px;
}
.lesson-nav-btn:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.lesson-nav-btn .dir { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.lesson-nav-btn .name { font-size: 14px; font-weight: 650; color: var(--text); line-height: 1.4; }
.lesson-nav-btn.is-next { text-align: right; align-items: flex-end; }
.lesson-nav-btn.is-disabled { visibility: hidden; pointer-events: none; border: 0; background: transparent; box-shadow: none; }
.lesson-nav-btn .soon { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.lesson-actions {
  display: flex; justify-content: center; margin-top: 8px; grid-column: 1 / -1;
}
.btn-complete {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 650; cursor: pointer;
  transition: all var(--transition);
}
.btn-complete:hover { border-color: var(--success); color: var(--success); }
.btn-complete.is-done {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  border-color: var(--success); color: #047857;
}
[data-theme="dark"] .btn-complete.is-done { color: #6ee7b7; }

/* Coming soon */
.coming-soon {
  max-width: 640px; padding: 8px 0 40px;
}
.coming-soon h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 14px; line-height: 1.28; }
.coming-panel {
  margin: 8px 0 28px; padding: 22px 22px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.coming-panel p { color: var(--text-secondary); font-size: 15px; line-height: 1.8; }
.coming-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 8px; }

/* ---------- Search modal ---------- */
.search-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 20px 40px;
}
.search-modal[hidden] { display: none; }
.search-dialog {
  width: min(640px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.search-input-wrap input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 16px; color: var(--text);
}
.search-results { max-height: min(52vh, 440px); overflow: auto; padding: 8px; }
.search-empty, .search-hint {
  padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 14px;
}
.search-item {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: 0; background: transparent;
  border-radius: 8px; cursor: pointer; color: inherit;
}
.search-item:hover, .search-item.is-active { background: var(--primary-soft); }
.search-item .s-title { font-size: 14px; font-weight: 650; color: var(--text); }
.search-item .s-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-item .s-snip { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.search-item mark {
  background: color-mix(in srgb, #fbbf24 45%, transparent);
  color: inherit; padding: 0 1px; border-radius: 2px;
}

/* Back to top */
.back-to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer;
  box-shadow: var(--shadow);
  display: grid; place-items: center;
  transition: all var(--transition);
}
.back-to-top:hover { color: var(--primary); border-color: var(--primary); }
.back-to-top[hidden] { display: none; }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.45);
  z-index: 85;
}


/* Overview / principle diagrams — token-colored, readable in light and dark */
.overview-fig {
  margin: 20px 0 28px;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.overview-fig figcaption {
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.overview-fig-kicker {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 4px;
}
.overview-fig figcaption strong {
  display: block;
  font-size: 17px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
}
.overview-fig-note {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.overview-fig-body { display: flex; flex-direction: column; gap: 14px; word-break: keep-all; overflow-wrap: break-word; }

/* Horizontal / wrapping flow */
.fig-flow {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
}
.fig-flow > .fig-node {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 12px 10px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.4;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 覆盖 .overview-fig-body 的 keep-all，长句在盒内换行，不溢出边框 */
  word-break: normal;
  overflow-wrap: break-word;
  overflow: hidden;
}
.fig-flow > .fig-node + .fig-node { margin-left: 22px; }
.fig-flow > .fig-node + .fig-node::before {
  content: "→";
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.fig-node.is-center {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border-strong));
  color: var(--text);
}

/* Side annotation bands */
.fig-sides {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.fig-side {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.fig-side-label {
  display: block;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin-bottom: 4px;
}
.fig-side p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Unequal chain: 提及 ≠ 引用 ≠ ... */
.fig-unequal {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: 0;
}
.fig-unequal-item {
  position: relative;
  flex: 1 1 96px;
  min-width: 96px;
  margin: 0 0 12px;
  padding: 10px 8px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fig-unequal-item + .fig-unequal-item { margin-left: 24px; }
.fig-unequal-item + .fig-unequal-item::before {
  content: "≠";
  position: absolute;
  left: -21px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--warning);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.fig-unequal-item.is-result {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border-strong));
}
.fig-unequal-name {
  font-size: 15px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.3;
}
.fig-unequal-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  white-space: nowrap;
}
.fig-callouts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.fig-callouts li {
  margin: 0;
  padding: 8px 12px;
  background: var(--bg);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.fig-callouts strong { color: var(--text); font-weight: 700; }

/* Chapter 2 dimensions + decisions */
.fig-dims {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
}
.fig-dim {
  margin: 0;
  padding: 12px 8px;
  text-align: center;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
}
.fig-hub {
  text-align: center;
  padding: 12px 14px;
  background: var(--primary-soft);
  border: 1.5px solid color-mix(in srgb, var(--primary) 50%, var(--border-strong));
  border-radius: 8px;
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.fig-hub-label {
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--primary);
}
.fig-hub-combo {
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
  white-space: nowrap;
}
.fig-decisions {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
}
.fig-decisions:has(> :nth-child(4):last-child) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.fig-decision {
  margin: 0;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 750;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
}
.fig-decision.is-go {
  border-color: color-mix(in srgb, var(--success) 55%, var(--border-strong));
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
}
.fig-decision.is-adjust {
  border-color: color-mix(in srgb, var(--warning) 55%, var(--border-strong));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}
.fig-decision.is-stop {
  border-color: color-mix(in srgb, #dc2626 50%, var(--border-strong));
  background: color-mix(in srgb, #dc2626 10%, var(--surface));
}
[data-theme="dark"] .fig-decision.is-go {
  background: color-mix(in srgb, var(--success) 22%, var(--bg));
  border-color: color-mix(in srgb, var(--success) 70%, var(--border-strong));
  color: #d1fae5;
}
[data-theme="dark"] .fig-decision.is-adjust {
  background: color-mix(in srgb, var(--warning) 22%, var(--bg));
  border-color: color-mix(in srgb, var(--warning) 75%, var(--border-strong));
  color: #fde68a;
}
[data-theme="dark"] .fig-decision.is-stop {
  background: color-mix(in srgb, #f87171 18%, var(--bg));
  border-color: color-mix(in srgb, #f87171 70%, var(--border-strong));
  color: #fecaca;
}

/* Chapter 4 branches */
.fig-branches {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.fig-branch {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 10px;
  align-items: start;
}
.fig-branch-title {
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.4;
}
.fig-branch-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* Chapter 5 six stages */
.fig-stages {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.fig-stages li {
  margin: 0;
  padding: 6px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-secondary);
  background: var(--bg);
}

.fig-throughline {
  margin: 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.fig-throughline span {
  display: inline-block;
  margin-right: 8px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--primary);
}

/* Home course journey */
.overview-fig-home { margin: 28px 0 8px; max-width: none; }
.fig-journey {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin: 0;
  padding: 0;
  counter-reset: none;
}
.fig-journey-step {
  position: relative;
  margin: 0;
  padding: 12px 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.fig-journey-step + .fig-journey-step::before {
  content: "";
}
.fig-range {
  font-size: 12px;
  font-weight: 750;
  color: var(--primary);
  letter-spacing: 0.02em;
}
.fig-step-title {
  font-size: 16px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.3;
}
.fig-step-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.fig-journey-step.is-later {
  border-style: dashed;
}
@media (min-width: 961px) {
  .fig-journey-step:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    pointer-events: none;
  }
}

/* Analogy callouts */
.callout-analogy {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.callout-analogy .callout-title { color: #0f766e; }
[data-theme="dark"] .callout-analogy .callout-title { color: var(--accent); }
.callout-how { margin-top: 8px; }
.callout-how strong { color: var(--text); }

/* Coming soon: will-learn list */
.coming-soon { max-width: 680px; }
.coming-learn {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.coming-learn li {
  position: relative;
  margin: 0 0 8px;
  padding: 8px 12px 8px 14px;
  background: var(--bg);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.coming-learn-title {
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
  margin: 16px 0 8px;
}

.home-overview-heading {
  margin: 40px 0 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .menu-toggle { display: flex; }
  .sidebar {
    transform: translateX(-105%);
    transition: transform var(--transition);
    box-shadow: none;
  }
  .sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-open .sidebar-backdrop { display: block; }
  .page-wrapper { padding-left: 0; }
  .main-content { padding: 28px 20px 64px; }
  .home-hero h1 { font-size: 30px; }
  .lesson-body h1 { font-size: 26px; }
  .stat { padding-right: 18px; }
  .stat + .stat { padding-left: 18px; }
  .stat strong { font-size: 22px; }
  .overall-progress .progress-label { display: none; }
  .logo-sub { display: none; }
  .lesson-nav { grid-template-columns: 1fr; }
  .lesson-nav-btn.is-next { text-align: left; align-items: flex-start; }

  .fig-flow {
    flex-direction: column;
    gap: 8px;
  }
  .fig-flow > .fig-node + .fig-node { margin-left: 0; }
  .fig-flow > .fig-node + .fig-node::before {
    content: "↓";
    left: 50%;
    top: -16px;
    transform: translateX(-50%);
  }
  .fig-flow > .fig-node { padding-top: 16px; }
  .fig-sides { grid-template-columns: 1fr; }
  .fig-dims { grid-template-columns: repeat(3, 1fr); }
  .fig-journey { grid-template-columns: 1fr; }
  .fig-branch { grid-template-columns: 1fr; gap: 2px; }
  .fig-unequal {
    flex-direction: column;
  }
  .fig-unequal-item + .fig-unequal-item { margin-left: 0; }
  .fig-unequal-item + .fig-unequal-item::before {
    content: "≠";
    left: 50%;
    top: -16px;
    transform: translateX(-50%);
  }
  .fig-unequal-item { flex: 1 1 auto; min-width: 0; margin-bottom: 18px; padding-top: 16px; }
}

@media (max-width: 640px) {
  .header-right .source-map-link { display: none; }
  .header-right { gap: 8px; }
  .logo-img { height: 32px; }
  .logo-text { padding-left: 8px; }
  .header { gap: 8px; padding: 0 12px; }
  .header-center { max-width: none; }
  .search-trigger span { display: none; }
  .search-trigger { width: auto; padding: 8px 10px; }
  .search-trigger kbd { display: none; }
  .progress-bar-mini { width: 48px; }
  .home-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 8px; border: 0; padding: 16px 0; }
  .stat, .stat + .stat { border: 0; padding: 0; }

  .fig-dims { grid-template-columns: repeat(2, 1fr); }
  .fig-decisions { grid-template-columns: 1fr; }
  .fig-unequal {
    flex-direction: column;
  }
  .fig-unequal-item + .fig-unequal-item { margin-left: 0; }
  .fig-unequal-item + .fig-unequal-item::before {
    content: "≠";
    left: 50%;
    top: -16px;
    transform: translateX(-50%);
  }
  .fig-unequal-item { flex: 1 1 auto; min-width: 0; margin-bottom: 18px; padding-top: 16px; }
  .fig-node, .fig-dim, .fig-decision, .fig-unequal-name, .fig-step-title, .fig-hub, .fig-branch-title {
    font-size: 15px;
  }
  .fig-unequal-desc, .fig-side p, .fig-branch-desc, .fig-step-desc, .fig-throughline {
    font-size: 14px;
  }
  .fig-hub-combo { font-size: 13px; }
}

@media (max-width: 360px) {
  .header-right .overall-progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* 2026-11-10 ch11–20: four-cell dims (ch20 运行手册) */
.fig-dims.is-three { grid-template-columns: repeat(3, 1fr); }
.fig-dims.is-four { grid-template-columns: repeat(4, 1fr); }
.fig-dims.is-five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 640px) {
  .fig-dims.is-three,
  .fig-dims.is-four,
  .fig-dims.is-five { grid-template-columns: 1fr; }
  .fig-dims.is-four,
  .fig-dims.is-five { grid-template-columns: repeat(2, 1fr); }
}

/* 2026-11-10 logo: xiaolifang-logo-white.png 经逐像素比对为透明版的 RGB 反色派生件（非官方白版原件，品牌色被反转）。
   暗色主题改为在浅色底片上显示官方透明版原件，保证副标「EFFI·CUBED」可读、品牌色不变；待官方白版原件到位再换回。 */
[data-theme="dark"] .logo-img-dark { display: none; }
[data-theme="dark"] .logo-img-light {
  display: block;
  background: #ffffff;
  border-radius: 8px;
  padding: 3px 8px;
  height: 40px;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  [data-theme="dark"] .logo-img-light { height: 32px; padding: 2px 6px; }
}

/* 2026-11-10 站点壳：初稿章节标识与章首提示 */
.ch-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: 10.5px; font-weight: 600; line-height: 1;
  padding: 3px 6px; border-radius: 999px;
  color: #fcd34d; background: rgba(245, 158, 11, 0.18);
}
.draft-notice {
  margin: 0 0 20px; padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.45); border-left: 4px solid #f59e0b;
  border-radius: 10px; background: rgba(245, 158, 11, 0.08);
  font-size: 14px; line-height: 1.6; color: var(--text);
}
.draft-notice strong {
  display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: 999px;
  background: #f59e0b; color: #1f1300; font-size: 12px;
}
.btn-complete.is-preview { cursor: default; opacity: 0.75; border-style: dashed; }
.btn-complete.is-preview:hover { border-color: var(--border); color: inherit; }

/* 2026-11-10 导图 390 宽优化：ch09 合并为一组有序环节；ch06/07/10 列表在窄屏改两列；ch08 补「关联 → 三种裁决」连接 */
.fig-connector {
  margin: 2px 0; text-align: center;
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
}
@media (max-width: 640px) {
  .fig-branches.is-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .fig-branches.is-compact .fig-branch { padding: 8px 9px; }
  .fig-branches.is-compact .fig-branch-title { font-size: 14px; }
  .fig-branches.is-compact .fig-branch-desc { font-size: 12.5px; line-height: 1.5; }
}

/* 2026-11-10 R4：第 1–3 章跟做示意图（表卡／漏斗／对照），对齐现有 overview-fig 层级 */
.fig-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.4;
}
.fig-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.fig-panel {
  margin: 0;
  padding: 12px 12px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 0;
}
.fig-panel.is-fill {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border-strong));
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--bg));
}
.fig-panel.is-blank {
  border-style: dashed;
}
.fig-panel-label {
  display: block;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin-bottom: 8px;
}
.fig-kv {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fig-kv li {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.fig-kv strong {
  font-weight: 750;
  margin-right: 4px;
}
.fig-kv .is-empty {
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border-strong);
  display: inline-block;
  min-width: 6em;
}
.fig-table-wrap {
  overflow: auto;
  margin: 0;
  max-width: 100%;
  max-height: calc(100vh - var(--header-height) - 96px);
  -webkit-overflow-scrolling: touch;
}
.fig-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.fig-table th,
.fig-table td {
  border: 1px solid var(--border-strong);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
  word-break: keep-all;
  overflow-wrap: break-word;
  min-width: 5.5em;
}
.fig-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-secondary);
  font-size: 13px;
  font-weight: 750;
  color: var(--text);
  white-space: nowrap;
}
.fig-table td:first-child,
.fig-table th:first-child {
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--border-strong);
}
.fig-table th:first-child {
  z-index: 3;
  background: var(--bg-secondary);
}
.fig-table td.is-blank {
  color: var(--text-muted);
  font-style: normal;
  background: var(--surface);
}
.fig-table td.is-break,
.fig-pill.is-break {
  color: #991b1b;
  font-weight: 750;
}
.fig-table td.is-ok { font-weight: 650; }
.fig-funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.fig-funnel-row {
  box-sizing: border-box;
  text-align: center;
  padding: 11px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}
.fig-funnel-row:nth-child(1) { width: 100%; }
.fig-funnel-row:nth-child(2) { width: 86%; }
.fig-funnel-row:nth-child(3) { width: 72%; background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 50%, var(--border-strong)); font-weight: 750; }
.fig-funnel-arrow {
  color: var(--primary);
  font-weight: 800;
  line-height: 1;
  font-size: 16px;
}
.fig-qgrid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.fig-qgrid.is-four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .fig-qgrid.is-four { grid-template-columns: 1fr 1fr; }
}
.fig-qgrid li {
  margin: 0;
  padding: 10px 10px 9px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  min-width: 0;
}
.fig-qnum {
  display: block;
  font-size: 12px;
  font-weight: 750;
  color: var(--primary);
  margin-bottom: 2px;
}
.fig-qgrid li span:last-child {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.4;
}
.fig-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fig-checks li {
  margin: 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.fig-checks li::before {
  content: "☐ ";
  font-weight: 700;
  color: var(--primary);
}
.fig-node.is-break {
  border-color: color-mix(in srgb, #dc2626 55%, var(--border-strong));
  background: color-mix(in srgb, #dc2626 9%, var(--surface));
}
.fig-node.is-weak {
  border-color: color-mix(in srgb, var(--warning) 60%, var(--border-strong));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}
.fig-link-notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fig-link-notes li {
  margin: 0;
  padding: 8px 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.fig-link-notes strong { display: block; color: var(--text); font-weight: 750; margin-bottom: 2px; }
.fig-chain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.fig-chain li {
  margin: 0;
  padding: 12px 10px;
  text-align: center;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
  line-height: 1.4;
  position: relative;
}
.fig-chain li.is-now {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 50%, var(--border-strong));
}
.fig-score {
  display: inline-block;
  min-width: 1.5em;
  text-align: center;
  font-weight: 800;
}
.fig-legend.is-strong { font-size: 15px; color: var(--text); font-weight: 650; }
.fig-legend {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
[data-theme="dark"] .fig-table td.is-break,
[data-theme="dark"] .fig-node.is-break { color: #fecaca; }

@media (max-width: 960px) {
  .fig-grid-2,
  .fig-qgrid,
  .fig-link-notes,
  .fig-chain { grid-template-columns: 1fr 1fr; }
  .fig-funnel-row { width: 100% !important; }
}
@media (max-width: 640px) {
  .fig-grid-2,
  .fig-qgrid,
  .fig-link-notes,
  .fig-chain { grid-template-columns: 1fr; }
}

/* 2026-11-10 ch11–14: wireframes, file snippets, simple sitemap */
.fig-wire {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
}
.fig-wire li {
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  background: var(--card, #fff);
  line-height: 1.5;
}
.fig-code {
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fig-sitemap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.fig-sitemap-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}
.fig-sitemap-row .fig-node {
  flex: 1 1 160px;
  max-width: 240px;
  text-align: center;
}
@media (max-width: 640px) {
  .fig-sitemap-row .fig-node { max-width: none; }
}

/* 第 30 章四种决定钮：始终保持四列、标签不换行（覆盖窄屏把 .fig-decisions 收成单列的规则） */
.fig-decisions:has(> :nth-child(4):last-child) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.fig-decisions:has(> :nth-child(4):last-child) .fig-decision {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .fig-decisions:has(> :nth-child(4):last-child) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .fig-decisions:has(> :nth-child(4):last-child) .fig-decision {
    font-size: 12px;
    padding: 8px 2px;
  }
}

/* 全课开篇思维导图 */
.course-opening { margin:0 0 36px; max-width:1060px; }
.opening-kicker { color:var(--primary); font-size:13px; font-weight:700; margin:0 0 10px; }
.opening-map-image { display:block; width:100%; }
.opening-map-image img { display:block; width:100%; height:auto; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.opening-map-tools { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; padding:10px 2px 0; color:var(--text-muted); font-size:12px; }
.opening-map-tools span { margin-right:auto; }
.opening-map-tools a { color:var(--primary); font-weight:600; }
