/* ===== 中学数学公式与定理手册 ===== */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --ink-soft: #4b5563;
  --ink-faint: #9ca3af;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --accent: #0f766e;
  --accent-soft: #f0fdfa;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 14px rgba(15, 23, 42, .05);
  --topbar-h: 72px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}

.brand .subtitle {
  margin: 0;
  font-size: .76rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

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

.search-box input {
  width: min(320px, 42vw);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .9rem;
  background: var(--bg);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
  background: #fff;
}

.search-count {
  font-size: .78rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  font-size: 1.1rem;
  padding: 4px 10px;
  cursor: pointer;
}

.back-home {
  display: inline-block;
  margin-right: 12px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #333);
  font-size: .85rem;
  text-decoration: none;
  white-space: nowrap;
}
.back-home:hover { background: #eef2ff; }

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  flex: 0 0 264px;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 20px 14px 40px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.content {
  flex: 1;
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 56px) 90px;
  outline: none;
}

/* ---------- 侧边导航 ---------- */
.stage-block { margin-bottom: 22px; }

.stage-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 0 6px 8px;
}

.stage-title .badge-stage {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 6px;
  font-size: .78rem;
}

.group-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .92rem;
  transition: background .15s, color .15s;
}

.group-link:hover { background: var(--primary-soft); color: var(--primary); }

.group-link .count {
  margin-left: auto;
  font-size: .72rem;
  color: var(--ink-faint);
  background: var(--bg);
  border-radius: 999px;
  padding: 0 8px;
}

/* ---------- 章节与卡片 ---------- */
.stage-header {
  margin: 8px 0 6px;
  padding: 26px 28px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #1d4ed8, #0f766e);
  color: #fff;
  box-shadow: var(--shadow);
}

.stage-header h2 { margin: 0 0 4px; font-size: 1.5rem; }
.stage-header p { margin: 0; opacity: .85; font-size: .9rem; }

.group-section { margin-top: 34px; scroll-margin-top: calc(var(--topbar-h) + 12px); }

.group-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
  margin: 0 0 18px;
}

.group-heading h3 { margin: 0; font-size: 1.28rem; }
.group-heading .group-meta { color: var(--ink-faint); font-size: .82rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 18px;
  transition: transform .15s, box-shadow .15s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(15, 23, 42, .08), 0 10px 26px rgba(15, 23, 42, .08);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.kind-badge {
  flex: 0 0 auto;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 10px;
  letter-spacing: .05em;
}

.kind-公式, .kind-法则 { background: var(--primary-soft); color: var(--primary); }
.kind-定理, .kind-原理 { background: #fdf2f8; color: #be185d; }
.kind-性质 { background: var(--accent-soft); color: var(--accent); }
.kind-概念 { background: var(--warn-soft); color: var(--warn); }

.card-title { margin: 0; font-size: 1.08rem; font-weight: 700; }

.card-body {
  display: block;  /* 单列布局：静态图在上、正文在下，互不挤压 */
}

.latex-block {
  margin: 6px 0 12px;
  padding: 12px 16px;
  background: #fbfcfe;
  border: 1px dashed #dbe3ef;
  border-radius: 10px;
  /* 排版铁律：严禁横向滚动条——超长公式在数据层拆行，不得 overflow-x:auto */
}

.latex-block mjx-container[display="true"] { margin: .78em 0 !important; }

/* 多条独立公式：左对齐（单公式保持居中；等号对齐只用于解答区的关联推导块） */
.latex-block.latex-left .latex-line mjx-container[display="true"] { text-align: left !important; }

/* ---------- 法则集合逐条对照：公式在上、注解在下（单列，严禁横向滚动） ---------- */
.latex-row {
  display: block;
  padding: 10px 4px;
}

.latex-row + .latex-row,
.latex-row + .latex-row-solo,
.latex-row-solo + .latex-row { border-top: 1px dashed #e6ecf5; }

.latex-row .latex-cell mjx-container[display="true"] {
  margin: .3em 0 !important;
  text-align: left !important;
}

.latex-note {
  margin-top: 2px;
  font-size: .85rem;
  line-height: 1.75;
  color: #55657e;
  padding-left: 12px;
  border-left: 2px solid #e2e9f4;
}

.latex-row-solo { padding: 8px 4px; }

.statement {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: .95rem;
}

.analysis {
  margin: 0;
  padding: 10px 14px;
  background: var(--warn-soft);
  border-left: 3px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  font-size: .88rem;
  color: #7c5a10;
}

.analysis::before {
  content: "解析";
  display: inline-block;
  font-weight: 700;
  color: var(--warn);
  margin-right: 8px;
}

.card-figure {
  max-width: 640px;
  text-align: center;
}

.card-figure img {
  width: 100%;
  max-height: 700px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

/* ---------- 例题 ---------- */
.examples { margin-top: 12px; display: grid; gap: 10px; }

.example {
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  background: #f8fafc;
}

.example-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: .86rem;
  color: var(--primary);
}

.example-problem {
  margin: 0 0 6px;
  font-size: .92rem;
  white-space: pre-line; /* 保留数据中的换行，按卷面分行显示 */
}

.example-solution summary {
  cursor: pointer;
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent);
  padding: 2px 12px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: #fff;
  user-select: none;
  list-style: none;
}

.example-solution summary::-webkit-details-marker { display: none; }
.example-solution summary:hover { background: var(--accent-soft); }
.example-solution[open] summary { background: var(--accent-soft); }

.example-solution-body {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: .9rem;
  color: var(--ink-soft);
  white-space: pre-line; /* 保留数据中的换行，按卷面分行显示 */
}

.tag-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-size: .72rem;
  color: var(--ink-faint);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
}

mark {
  background: #fde68a;
  border-radius: 3px;
  padding: 0 1px;
}

.no-result {
  text-align: center;
  color: var(--ink-faint);
  padding: 60px 0;
  font-size: .95rem;
}

/* ---------- 总览页 ---------- */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.ov-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}

.ov-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 8px rgba(15, 23, 42, .08), 0 10px 26px rgba(15, 23, 42, .08);
}

.ov-card h4 { margin: 0 0 4px; font-size: 1rem; }
.ov-card .ov-meta { margin: 0; font-size: .78rem; color: var(--ink-faint); }

/* ---------- 章节页 ---------- */
.chapter-banner { margin-bottom: 18px; }

.chapter-crumb {
  display: inline-flex;
  align-items: center;
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 7px 16px;
  margin: 0 0 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.chapter-crumb:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .18);
  transform: translateX(-2px);
}

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
}

.chapter-nav-link {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--primary);
  text-decoration: none;
  font-size: .86rem;
  transition: border-color .15s, background .15s;
}

.chapter-nav-link:hover { border-color: var(--primary); background: var(--primary-soft); }

.loading {
  padding: 80px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: .95rem;
}

.group-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.home-link { font-weight: 700; }

.card.flash { animation: cardflash 1.8s ease; }

@keyframes cardflash {
  0% { box-shadow: 0 0 0 3px rgba(37, 99, 235, .5); }
  100% { box-shadow: var(--shadow); }
}

/* ---------- 搜索结果下拉 ---------- */
.search-box { position: relative; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(440px, 82vw);
  max-height: 62vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
  z-index: 70;
  padding: 6px;
}

.sr-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.sr-item:hover { background: var(--primary-soft); }

.sr-item .sr-title { font-size: .9rem; }

.sr-item .sr-path {
  margin-left: auto;
  font-size: .72rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.sr-hint {
  padding: 6px 10px;
  font-size: .72rem;
  color: var(--ink-faint);
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}

.sr-empty {
  padding: 16px;
  text-align: center;
  color: var(--ink-faint);
  font-size: .85rem;
}

/* ---------- 回到顶部 ---------- */
.back-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  box-shadow: var(--shadow);
  z-index: 40;
}

.back-top.show { opacity: 1; pointer-events: auto; }
.back-top:hover { transform: translateY(-3px); }

/* ---------- 页脚说明 ---------- */
.footnote {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: .8rem;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .card-figure { max-width: 640px; }
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .brand .subtitle { display: none; }
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    bottom: 0;
    z-index: 45;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .25s;
    box-shadow: 6px 0 24px rgba(15, 23, 42, .12);
  }
  .sidebar.open { transform: translateX(0); }
  .layout { display: block; }
  .content { padding: 20px 16px 80px; }
  .topbar { flex-wrap: wrap; height: auto; min-height: var(--topbar-h); padding: 10px 14px; }
  .search-box input { width: 100%; }
  .search-box { width: 100%; }
}

/* ============================================================
 * 第三轮视觉升级：章节 Hero 横幅、条目类型配色、衬线正文排版
 * ============================================================ */

/* ---------- 章节 Hero 横幅 ---------- */
.chapter-hero {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin: 4px 0 22px;
  padding: 24px 28px;
  border-radius: 14px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .16);
  position: relative;
  overflow: hidden;
}

.chapter-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}

.chapter-hero::before {
  content: "";
  position: absolute;
  right: 70px;
  bottom: -90px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
}

.theme-0 { background: linear-gradient(120deg, #1d4ed8, #0f766e); }
.theme-1 { background: linear-gradient(120deg, #7c3aed, #2563eb); }
.theme-2 { background: linear-gradient(120deg, #be185d, #ea580c); }
.theme-3 { background: linear-gradient(120deg, #0f766e, #16a34a); }
.theme-4 { background: linear-gradient(120deg, #b45309, #dc2626); }
.theme-5 { background: linear-gradient(120deg, #1e40af, #7c3aed); }

.hero-icon {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25);
  position: relative;
  z-index: 1;
}

.hero-icon svg { width: 38px; height: 38px; stroke: rgba(255, 255, 255, .95); }

.hero-body { position: relative; z-index: 1; min-width: 0; }

.hero-body h3 { margin: 2px 0 8px; font-size: 1.45rem; letter-spacing: .02em; }

.hero-intro {
  margin: 0 0 12px;
  max-width: 720px;
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  font-size: .92rem;
  line-height: 1.9;
  color: rgba(255, 255, 255, .92);
}

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

.hero-chips .chip {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  padding: 2px 12px;
}

/* ---------- 卡片类型配色（顶边条） ---------- */
.card { position: relative; overflow: hidden; }

.card-kind-公式, .card-kind-法则 { border-top: 3px solid #2563eb; }
.card-kind-定理, .card-kind-原理 { border-top: 3px solid #be185d; }
.card-kind-性质 { border-top: 3px solid #0f766e; }
.card-kind-概念 { border-top: 3px solid #b45309; }

/* 类型徽章装饰符号 */
.kind-badge::before { margin-right: 4px; font-weight: 400; }
.kind-公式::before   { content: "∑"; }
.kind-法则::before   { content: "🧮"; }
.kind-定理::before   { content: "📐"; }
.kind-原理::before   { content: "⚖"; }
.kind-性质::before   { content: "✦"; }
.kind-概念::before   { content: "📖"; }

/* ---------- 公式块微调 ---------- */
.latex-block {
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 1px 0 #f8fafc;
}

.latex-block mjx-container { font-size: 105% !important; }

/* ---------- 正文衬线排版（陈述 / 题目 / 解答） ---------- */
.statement,
.example-problem,
.example-solution-body {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
}

.statement { font-size: .98rem; line-height: 2; }

.example-problem { font-size: .95rem; line-height: 2; }

.example-solution-body {
  font-size: .95rem;
  line-height: 2.05;
  color: #374151;
}

.analysis { line-height: 1.9; }

/* 解答步骤左侧引导线 */
.example-solution-body {
  padding-left: 12px;
  border-left: 2px solid #ccfbf1;
}

/* ---------- 响应式：Hero ---------- */
@media (max-width: 720px) {
  .chapter-hero { flex-direction: column; gap: 14px; padding: 20px; }
  .hero-icon { width: 52px; height: 52px; }
  .hero-icon svg { width: 30px; height: 30px; }
  .hero-body h3 { font-size: 1.25rem; }
}

/* ============================================================
 * 第四轮：交互式动态演示区
 * ============================================================ */
.demo-box {
  margin: 8px 0 14px;
  padding: 12px 14px 10px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: linear-gradient(160deg, #fbfdff, #f5f8fc);
}

.demo-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: .02em;
}

.demo-box canvas {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.demo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin-top: 10px;
}

.demo-slider {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.demo-slider input[type="range"] {
  width: 110px;
  accent-color: var(--primary);
  cursor: pointer;
}

.demo-slider .val {
  min-width: 36px;
  text-align: right;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.demo-btn {
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 14px;
  border-radius: 999px;
  border: 1px solid #99f6e4;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
  transition: background .15s;
}

.demo-btn:hover { background: var(--accent-soft); }

/* ---------- 演示放大模式（覆盖层全功能交互） ---------- */
.demo-btn.demo-zoom { min-width: 32px; padding: 3px 8px; font-weight: 700; }

.demo-expand { margin-left: auto; }

.demo-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.demo-overlay-inner {
  position: relative;
  width: min(1240px, 96vw);
  max-height: 93vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 16px 20px 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
}

.demo-overlay-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: .82rem;
  cursor: pointer;
}

.demo-overlay-close:hover { border-color: var(--primary); color: var(--primary); }

.demo-overlay .demo-box { margin-top: 32px; }

.demo-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.demo-read {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: .82rem;
  line-height: 1.8;
  color: var(--ink-soft);
}

.demo-read b { color: var(--ink); }

.hero-chips .chip-demo {
  background: rgba(255, 255, 255, .32);
  font-weight: 700;
}

/* ---------- 数字输入框与视图交互 ---------- */
.demo-num {
  width: 56px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .78rem;
  text-align: right;
  color: var(--ink);
  background: #fff;
  outline: none;
  font-variant-numeric: tabular-nums;
  transition: border-color .2s, background .2s;
}

.demo-num:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }

.demo-num.bad {
  border-color: #dc2626;
  background: #fef2f2;
  color: #dc2626;
}

.demo-reset { order: 99; margin-left: auto; }

.demo-box canvas { cursor: grab; touch-action: none; }

.demo-box canvas.dragging { cursor: grabbing; }

/* ============================================================
 * 第五轮：图文分层与推导对齐
 * ============================================================ */

/* 静态示意图图注 */
.fig-cap {
  margin-top: 6px;
  font-size: .72rem;
  color: var(--ink-faint);
  letter-spacing: .06em;
  text-align: center;
}

/* 动静结合：演示通栏置于卡片底部，与上方内容分隔 */
.demo-full {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

/* 多行推导对齐块（aligned） */
.deriv-block {
  margin: 4px 0 4px 10px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid #ccfbf1;
  overflow-x: auto;
}

.deriv-block mjx-container[display="true"] {
  margin: .3em 0 !important;
  text-align: left !important;
  justify-content: flex-start !important;
}

/* ---------- 子组导航（侧边栏当前章节展开） ---------- */
.sub-list {
  display: none;
  margin: 2px 0 6px 4px;
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--line);
}
.group-link.expanded + .sub-list { display: block; }

.sub-link {
  display: block;
  padding: 5px 10px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--ink-faint);
  text-decoration: none;
  font-size: .84rem;
  transition: background .15s, color .15s;
}
.sub-link:hover { background: var(--primary-soft); color: var(--primary); }
.sub-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ---------- 章节概览：子组卡片网格 ---------- */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.section-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.section-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 8px rgba(15, 23, 42, .08), 0 10px 26px rgba(15, 23, 42, .08);
}
.section-card h4 { margin: 0 0 4px; font-size: 1rem; }
.section-card .ov-meta { margin: 0; font-size: .78rem; color: var(--ink-faint); }

/* ---------- 子组页：面包屑与标题 ---------- */
.section-crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .85rem;
  color: var(--ink-faint);
  margin: 0 0 10px;
}
.section-crumb a { color: var(--primary); text-decoration: none; font-weight: 600; }
.section-crumb a:hover { text-decoration: underline; }
.crumb-sep { color: var(--ink-faint); }
.crumb-current { color: var(--ink); font-weight: 600; }

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-soft);
}
