:root {
  --bg: #f6f1e8;
  --paper: #fffdf8;
  --ink: #1f1a14;
  --muted: #6b6258;
  --line: #e4d8c4;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --ok: #166534;
  --card: #fff7ed;
  --shadow: 0 8px 24px rgba(60, 40, 10, 0.08);
  --side-w: 260px;
  --top-h: 58px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fde7c7 0%, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #e7f0e4 0%, transparent 45%),
    var(--bg);
  line-height: 1.7;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 700; color: var(--accent); cursor: pointer; white-space: nowrap;
}
.mod-nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.mod-nav button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: inherit;
}
.mod-nav button.active, .mod-nav button:hover {
  background: var(--accent-soft); color: var(--accent);
}

/* 板块切换：数学 / 逻辑 两个大按钮 */
.board-nav { display: flex; gap: 6px; flex: none; padding: 3px; background: var(--accent-soft); border-radius: 999px; }
.board-nav button {
  border: 0; background: transparent; color: var(--muted);
  padding: 6px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  font: inherit; font-weight: 600;
}
.board-nav button.active {
  background: var(--accent); color: #fff;
}

/* 逻辑真题年份切换标签 */
.year-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.year-tab {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 6px 16px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 600;
}
.year-tab.active, .year-tab:hover {
  background: var(--exam-tone, var(--accent)); color: #fff; border-color: transparent;
}

.search-wrap { position: relative; width: min(280px, 32vw); }
.search-wrap input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; background: #fff; font: inherit;
}
.search-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(360px, 80vw);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 360px; overflow: auto; z-index: 50;
}
.search-results.hidden { display: none; }
.search-results button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 10px 12px; cursor: pointer; font: inherit; border-bottom: 1px solid #f3ebe0;
}
.search-results button:hover { background: var(--accent-soft); }
.search-results .meta { display: block; color: var(--muted); font-size: 12px; }

.layout { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: calc(100vh - var(--top-h) - 40px); }
.sidebar {
  position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h));
  overflow: auto; border-right: 1px solid var(--line);
  background: rgba(255,253,248,.7); padding: 16px 12px 40px;
}
.sidebar-title { font-size: 12px; color: var(--muted); letter-spacing: .08em; margin: 0 8px 10px; }
.side-nav a {
  display: block; color: var(--ink); text-decoration: none;
  padding: 6px 10px; border-radius: 8px; font-size: 14px;
}
.side-nav a:hover, .side-nav a.active { background: var(--accent-soft); color: var(--accent); }
.side-nav .sec { margin-top: 12px; font-size: 12px; color: var(--muted); padding: 0 10px; }

.main { width: 100%; min-width: 0; padding: 24px 28px 80px; max-width: 920px; }
.content { min-width: 0; }
.content-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px;
}
.k-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.k-head h2 { margin: 0; font-size: 1.35rem; flex: 1 1 auto; }
.badge {
  font-size: 12px; border-radius: 999px; padding: 2px 8px;
  background: #f5efe4; color: var(--muted); border: 1px solid var(--line);
}
.badge.tag { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge.freq-高 { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge.freq-中 { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge.L4, .badge.L5 { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge-ok { background: #ecfdf5; color: #166534; border-color: #bbf7d0; }
.badge-warn { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.row-unverified { background: #fffbeb; }
.src-self { color: #1d4ed8; }
.src-exam { color: #166534; }
.src-warn { color: #c2410c; }

.block-title {
  margin: 20px 0 10px; font-size: 13px; letter-spacing: .12em;
  color: var(--accent); text-transform: uppercase; font-weight: 700;
}
.block-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; }

.lecture, .drill, .cards, .exam-box { margin-top: 4px; }
.lecture ul, .drill ul, .plain-list { padding-left: 1.2em; }
.lecture li, .drill li, .plain-list li { margin: 4px 0; }

/* ========== 公式可视化（KaTeX 公式卡） ========== */
.formula-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 10px 0 14px;
}
.formula-card {
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #fbf8f2 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 12px 16px;
  box-shadow: 0 2px 10px rgba(60, 40, 10, 0.04);
  border-left: 4px solid #d97706;
  overflow-x: auto;
}
.formula-card:hover {
  border-left-color: var(--accent);
  box-shadow: 0 6px 18px rgba(60, 40, 10, 0.07);
}
.formula-card-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.formula-idx {
  width: 22px; height: 22px; border-radius: 7px;
  background: #fff7ed; color: var(--accent);
  border: 1px solid #fed7aa;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.formula-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
}
.formula-name {
  font-size: 13px; font-weight: 700; color: #44403c;
}
.formula-tex {
  padding: 6px 4px 2px;
  font-size: 1.08em;
  line-height: 1.6;
  min-height: 1.8em;
}
.formula-plain {
  font-family: "New York", "Songti SC", "Source Han Serif SC", "Noto Serif SC", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #1c1917;
  padding: 8px 6px;
  line-height: 1.7;
}
.formula-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: #f0fdf4;
  border: 1px dashed #86efac;
  border-radius: 8px;
  font-size: 12.5px;
  color: #166534;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
}
.formula-note-label {
  font-size: 11px; font-weight: 700;
  background: #dcfce7; color: #15803d;
  border-radius: 4px; padding: 1px 6px;
}

/* KaTeX 可读性增强 */
.katex { font-size: 1.12em; }
.katex-display-wrap {
  margin: 8px 0;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #f0e6d6;
  border-radius: 10px;
  overflow-x: auto;
  text-align: center;
}
.katex-display { margin: 0.4em 0; }
.math-inline .katex { font-size: 1.05em; }
.formula-tex .katex-display { margin: 0.25em 0; }
.flash-face .katex { font-size: 1em; }
.example .katex { font-size: 1.06em; }
code {
  font-family: var(--mono);
  background: #f5f5f4;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}
.tip {
  background: linear-gradient(90deg, #fff7ed, #fffdf8);
  border-left: 4px solid var(--accent);
  padding: 10px 14px; border-radius: 0 12px 12px 0; margin: 12px 0;
}
.danger {
  background: #fef2f2; border-left: 4px solid #dc2626;
  padding: 10px 14px; border-radius: 0 12px 12px 0; margin: 12px 0;
}
.example {
  background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 12px;
  padding: 12px 14px; margin: 12px 0;
}
.example .src { color: var(--muted); font-size: 12px; margin-top: 6px; }
.example .fig-example {
  margin: 12px 0 10px;
  padding: 10px 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  background: transparent;
}
.example .fig-example .fig-title { min-height: 0; text-align: left; }
.example .fig-example .fig-cap { text-align: left; }
.fold > summary {
  cursor: pointer; color: var(--accent); font-weight: 600; list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "▸ "; }
.fold[open] > summary::before { content: "▾ "; }
.fold .body { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps li {
  counter-increment: step; position: relative;
  padding: 8px 10px 8px 42px; margin: 6px 0;
  background: #fffaf3; border-radius: 10px; border: 1px solid var(--line);
}
.steps li::before {
  content: counter(step); position: absolute; left: 10px; top: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}

.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.flash {
  perspective: 900px; min-height: 150px; height: auto; cursor: pointer;
}
.flash-inner {
  position: relative; width: 100%; min-height: 150px; height: 100%;
  transition: transform .45s; transform-style: preserve-3d;
}
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 14px; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  padding: 18px 12px 12px; text-align: center; font-size: 14px;
  min-height: 150px;
}
.flash-body { width: 100%; overflow-x: auto; }
.flash-body .katex { font-size: 1.05em; }
.flash-front { background: var(--card); }
.flash-back { background: #ecfdf5; color: var(--ok); transform: rotateY(180deg); }
.flash-type { position: absolute; top: 8px; left: 10px; font-size: 11px; color: var(--muted); }

.fig {
  margin: 14px 0; padding: 10px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; overflow-x: auto; text-align: center;
}
.fig svg { max-width: 100%; height: auto; }
.fig-cap { color: var(--muted); font-size: 12px; margin-top: 6px; }
.fig-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  margin: 16px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fig-grid .fig-panel {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
  text-align: left;
}
.fig-grid .fig-panel svg {
  display: block;
  width: 100%;
  margin: 0 auto;
}
.fig-title {
  min-height: 2em;
  margin-bottom: 8px;
  color: #44403c;
  font-size: 13px;
  font-weight: 700;
}
.fig-grid .fig-cap {
  line-height: 1.55;
  text-align: left;
}

.exam-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.exam-table th, .exam-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.exam-table th { color: var(--muted); font-weight: 600; }

.module-hero {
  padding: 8px 0 18px;
}
.module-hero h1 { margin: 0 0 8px; font-size: 1.8rem; }
.module-hero p { margin: 0; color: var(--muted); }

/* ========== 2025 真题对照阅读 ========== */
.exam-hero {
  padding: 6px 0 24px;
  border-bottom: 2px solid #1f2937;
  margin-bottom: 28px;
}
.exam-eyebrow {
  color: #0f766e;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.exam-hero h1 {
  margin-top: 6px;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 2rem;
  letter-spacing: 0;
}
.exam-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 560px;
  margin-top: 20px;
  border: 1px solid #cbd5e1;
  background: #fff;
}
.exam-stats > div {
  min-height: 68px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid #cbd5e1;
}
.exam-stats > div:last-child { border-right: 0; }
.exam-stats strong { color: #111827; font-size: 1.15rem; }
.exam-stats span { color: #64748b; font-size: 12px; }

.exam-section { margin: 0 0 42px; }
.exam-section-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
}
.exam-section-heading > div { flex: 0 0 auto; }
.exam-section-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.5rem;
  letter-spacing: 0;
}
.exam-section-kicker {
  display: block;
  color: #64748b;
  font-size: 12px;
}
.exam-section-rule { height: 1px; flex: 1; background: #94a3b8; }

.exam-question {
  --exam-tone: #b45309;
  position: relative;
  scroll-margin-top: calc(var(--top-h) + 18px);
  margin: 0 0 14px;
  padding: 18px 20px 0;
  background: #fff;
  border: 1px solid #d7dee7;
  border-left: 5px solid var(--exam-tone);
  border-radius: 6px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .05);
  overflow: hidden;
  min-width: 0;
}
.exam-tone-math { --exam-tone: #b45309; }
.exam-tone-logic { --exam-tone: #0f766e; }
.exam-tone-writing { --exam-tone: #be123c; }
.exam-question-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin-bottom: 10px;
}
.exam-number {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--exam-tone);
  color: #fff;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
}
.exam-question-title {
  color: #111827;
  font-weight: 700;
}
.exam-group-mark {
  margin-left: auto;
  color: #64748b;
  font-size: 11px;
}
.exam-stem {
  color: #1f2937;
  font-size: 15px;
  line-height: 1.85;
}
.exam-raw-question {
  color: #1f2937;
  font-size: 15px;
  line-height: 1.85;
  white-space: normal;
}
.exam-section-note {
  margin: -2px 0 18px;
  padding: 10px 13px;
  border-left: 3px solid #0f766e;
  background: #f0fdfa;
  color: #24524e;
  font-size: 14px;
  line-height: 1.7;
}
.exam-conditions {
  margin: 12px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}
.exam-conditions > div:not(.exam-sub-label) { margin: 5px 0; }
.exam-sub-label,
.exam-analysis-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}
.condition-index {
  display: inline-flex;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid #94a3b8;
  border-radius: 50%;
  color: #334155;
  font-family: var(--mono);
  font-size: 11px;
}
.exam-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
  margin: 14px 0 18px;
  padding-left: 30px;
}
.exam-options li {
  min-width: 0;
  padding: 5px 7px;
  color: #334155;
  line-height: 1.65;
  break-inside: avoid;
}
.exam-options li::marker {
  color: var(--exam-tone);
  font-family: var(--mono);
  font-weight: 800;
}
.exam-visual {
  max-width: 100%;
  margin: 16px 0;
  padding: 14px 0;
  border-top: 1px solid #d7dee7;
  border-bottom: 1px solid #d7dee7;
  text-align: center;
  overflow-x: auto;
}
.exam-visual-title {
  margin-bottom: 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}
.exam-visual svg { display: block; width: min(100%, 560px); height: auto; margin: 0 auto; }
.exam-visual figcaption { margin-top: 8px; color: #64748b; font-size: 12px; text-align: left; }
.exam-stack-visual {
  min-width: 310px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 28px;
}
.exam-stack-visual .stack { display: flex; flex-direction: column; }
.exam-stack-visual .stack span {
  width: 76px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #334155;
  border-bottom-width: 1px;
  background: #f8fafc;
  font-family: var(--mono);
  font-weight: 700;
}
.exam-stack-rule { color: #0f766e; font-family: var(--mono); text-align: left; }
.exam-token-map {
  min-width: 360px;
  padding: 4px 16px;
  color: #334155;
}
.exam-token-map > div:not(.map-arrow) {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.exam-token-map span {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #64748b;
  background: #fff;
  color: #0f172a;
  font-size: 24px;
}
.exam-token-map .map-arrow { margin: 8px 0; color: #0f766e; font-size: 12px; }
.exam-token-map p { margin: 10px auto 0; max-width: 480px; font-size: 13px; text-align: left; }
.exam-logic-flow {
  min-width: 620px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.exam-logic-flow > div {
  padding: 8px 12px;
  border: 1px solid #0f766e;
  background: #f0fdfa;
  color: #115e59;
  font-size: 13px;
}
.exam-logic-flow > span { color: #64748b; }
.exam-logic-flow .flow-conflict { border-color: #be123c; background: #fff1f2; color: #9f1239; }
.exam-logic-flow p { flex: 0 0 100%; margin: 8px 0 0; color: #334155; font-size: 13px; text-align: center; }

.exam-solution {
  margin: 0 -20px;
  border-top: 1px solid #d7dee7;
  background: #f8fafc;
}
.exam-solution > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--exam-tone);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.exam-solution > summary::-webkit-details-marker { display: none; }
.exam-solution > summary::before { content: "＋"; width: 24px; font-size: 18px; }
.exam-solution[open] > summary::before { content: "−"; }
.exam-solution[open] > summary { border-bottom: 1px solid #d7dee7; }
.exam-solution-body { padding: 18px 20px 20px; }
.exam-answer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 10px;
  border: 2px solid #be123c;
  color: #9f1239;
  background: #fff1f2;
  transform: rotate(-1deg);
  font-family: "Songti SC", "STSong", serif;
}
.exam-answer-label { font-size: 11px; font-family: var(--font); font-weight: 700; }
.exam-ai-knowledge {
  margin: 2px 0 16px;
  padding: 12px 14px 11px;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--exam-tone);
  background: #f8fafc;
}
.exam-ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.exam-ai-badge {
  padding: 2px 6px;
  color: #fff;
  background: var(--exam-tone);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.exam-ai-label {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.exam-ai-title {
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
}
.exam-ai-formula {
  margin: 7px 0 3px;
  color: #0f172a;
  line-height: 1.7;
}
.exam-ai-formula .katex-display-wrap { margin: 4px 0; }
.exam-ai-knowledge ul {
  margin: 6px 0 0;
  padding-left: 1.25em;
  color: #475569;
  font-size: 13px;
  line-height: 1.75;
}
.exam-ai-knowledge li { margin: 2px 0; }
.exam-analysis { color: #334155; line-height: 1.85; }
.exam-analysis-label { margin-bottom: 4px; color: #0f766e; }

/* AI 讲解块：口语化补充，紫色系，与青色「AI 提供」知识块区分 */
.ai-explain {
  margin: 10px 0 4px;
  padding: 11px 13px 9px;
  border: 1px solid #ddd6fe;
  border-left: 4px solid #7c3aed;
  border-radius: 4px;
  background: #faf5ff;
}
.ai-explain-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.ai-explain-badge {
  padding: 2px 6px;
  color: #fff;
  background: #7c3aed;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}
.ai-explain-label {
  color: #7c3aed;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}
.ai-explain-body { color: #3b2f4a; line-height: 1.8; font-size: 14px; }
.ai-explain-body p { margin: 4px 0; }
.ai-explain-body p:first-child { margin-top: 0; }
.ai-explain-body p:last-child { margin-bottom: 0; }
.exam-source-note {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-left: 3px solid #e11d48;
  background: #fff1f2;
  color: #9f1239;
  font-size: 13px;
}
.exam-outline { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #94a3b8; }
.exam-outline ol { margin: 5px 0 0; padding-left: 1.5em; }
.exam-outline li { margin: 4px 0; }

.exam-question-group {
  scroll-margin-top: calc(var(--top-h) + 18px);
  margin: 18px 0 22px;
}
.exam-group-heading {
  margin-bottom: 0;
  padding: 7px 12px;
  color: #fff;
  background: #334155;
  font-size: 13px;
  font-weight: 700;
}
.exam-passage {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #eef6f5;
  border-bottom: 1px solid #99bdb8;
  color: #26423f;
  line-height: 1.85;
}
.exam-passage-label {
  display: block;
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
}
.exam-writing-question .exam-stem { font-family: "Songti SC", "STSong", Georgia, serif; font-size: 16px; }
.exam-writing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .95fr);
  gap: 24px;
  padding-bottom: 20px;
}
.exam-writing-prompt { min-width: 0; }
.exam-writing-solution {
  min-width: 0;
  padding: 16px 18px 18px;
  border: 1px solid #fecdd3;
  border-top: 4px solid var(--exam-tone);
  background: #fff8f8;
}
.exam-writing-solution-title {
  margin-bottom: 12px;
  color: var(--exam-tone);
  font-size: 13px;
  font-weight: 800;
}
.exam-writing-solution .exam-answer { margin-bottom: 16px; }
.exam-writing-solution .exam-analysis { color: #334155; }
.exam-writing-solution .exam-outline { margin-bottom: 0; }

.exam-mini-table,
.exam-schedule {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  background: #fff;
  font-size: 13px;
}
.exam-mini-table th, .exam-mini-table td,
.exam-schedule th, .exam-schedule td {
  padding: 8px;
  border: 1px solid #94a3b8;
  text-align: center;
}
.exam-mini-table th, .exam-schedule th { background: #f1f5f9; }
.exam-schedule .fixed { color: #64748b; background: #e2e8f0; }
.exam-flavor-grid {
  width: 280px;
  height: 280px;
  margin: 0 auto;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}
.exam-flavor-grid td { border: 1px solid #64748b; text-align: center; font-size: 16px; }
.exam-flavor-grid .unknown { color: #be123c; background: #fff1f2; font-weight: 800; }

.footer {
  text-align: center; color: var(--muted); font-size: 12px;
  padding: 12px; border-top: 1px solid var(--line);
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; top: 0; height: auto; max-height: 220px; }
  .main { padding: 16px; }
  .search-wrap { width: 140px; }
  .fig-grid { grid-template-columns: 1fr; gap: 20px; }
  .fig-title { min-height: 0; }
  .exam-options { grid-template-columns: 1fr; gap: 3px; }
  .exam-question { padding: 16px 14px 0; }
  .exam-solution { margin: 0 -14px; }
  .exam-solution > summary, .exam-solution-body { padding-left: 14px; padding-right: 14px; }
  .exam-writing-layout { grid-template-columns: 1fr; gap: 18px; }
  .exam-writing-solution { padding: 14px; }
  .exam-section-heading { align-items: end; }
}

@media (max-width: 560px) {
  .exam-hero h1 { font-size: 1.6rem; }
  .exam-stats { grid-template-columns: 1fr; }
  .exam-stats > div { min-height: 54px; border-right: 0; border-bottom: 1px solid #cbd5e1; }
  .exam-stats > div:last-child { border-bottom: 0; }
  .exam-question-head { align-items: flex-start; }
  .exam-number { width: 32px; height: 32px; flex-basis: 32px; }
  .exam-group-mark { display: none; }
  .exam-flavor-grid { width: 240px; height: 240px; }
}

/* ========== 图解板块 ========== */
/* 精细图按 1:1 显示才清楚，所以带精细图的模块把正文列放宽（图解板块 + 逻辑兵法）；
   跟的是「卡片里有精细图」而不是「板块叫图解」，其它模块不受影响。 */
body.fig-wide .main { max-width: 1180px; }

.visual-card { --vis-tone: #3730a3; }
.visual-card .k-head h2, .tactic-card .k-head h2 { color: var(--vis-tone); }
.visual-card .block-title, .tactic-card .block-title { color: var(--vis-tone); }
.visual-card .block-title::before, .tactic-card .block-title::before { background: var(--vis-tone); }
/* .exam-ai-badge 依赖 --exam-tone，而该变量只定义在 .exam-question 上，
   放到别处会退化成透明底白字，所以图解板块另起一个徽章。 */
.badge-ai { background: #ede9fe; color: #5b21b6; border-color: #ddd6fe; }
.kp-link {
  margin-left: auto; color: var(--vis-tone); font-size: 13px;
  text-decoration: none; border-bottom: 1px dashed currentColor; white-space: nowrap;
}
.kp-link:hover { background: #eef2ff; }
.visual-gist { margin: 2px 0 14px; color: #44403c; }

/* 精细图：引擎已输出 width/min-width，这里只补滚动条与提示的样式。
   缩到 78% 以下就横向滚动，而不是继续压小到看不清标注。 */
.fig-fine { padding: 14px 12px 12px; border-color: #d6d3d1; overflow-x: auto; }
.fig-fine .fig-title { min-height: 0; margin-bottom: 10px; text-align: left; font-size: 14px; }
.fig-fine .fig-cap { text-align: left; line-height: 1.6; }
.fig-fine svg { height: auto; }

/* 推导 / 边界 / 抓手：与 .tip（直观）、.danger（易错）凑成一套语义色。 */
.derive {
  margin: 10px 0 14px; padding: 12px 16px;
  background: #f8fafc; border: 1px solid #dbe3ec; border-left: 4px solid var(--vis-tone);
  border-radius: 0 12px 12px 0;
}
.derive ul { margin: 0; }
.bounds {
  margin: 12px 0; padding: 10px 16px;
  background: #fefce8; border-left: 4px solid #ca8a04; border-radius: 0 12px 12px 0;
}
.bounds ul { margin: 6px 0 0; }
.hook {
  display: flex; gap: 10px; align-items: baseline;
  margin: 16px 0 4px; padding: 12px 16px;
  background: linear-gradient(90deg, #eef2ff, #fffdf8);
  border: 1px dashed #a5b4fc; border-radius: 12px; font-size: 1.05rem;
}
.hook-label {
  flex: 0 0 auto; padding: 3px 9px; border-radius: 999px;
  background: var(--vis-tone); color: #fff; font-size: 11px; font-weight: 700;
}

/* 参考范文：解析书作者写的文章，与站内自编内容分开呈现，作者与来源必须可见。 */
.exam-essay {
  margin-top: 14px; padding: 14px 16px;
  background: #fffdf8; border: 1px solid #e7e5e4;
  border-left: 4px solid var(--exam-tone, #be123c); border-radius: 0 12px 12px 0;
}
.exam-essay-head { display: flex; flex-wrap: wrap; gap: 9px; align-items: baseline; }
.exam-essay-badge {
  flex: 0 0 auto; padding: 2px 9px; border-radius: 999px;
  background: var(--exam-tone, #be123c); color: #fff; font-size: 11px; font-weight: 700;
}
.exam-essay-title { font-size: 1.05rem; font-weight: 700; color: #1f2937; }
.exam-essay-meta { margin-top: 5px; font-size: 12px; color: var(--muted); }
.exam-essay-body { margin-top: 10px; font-family: "Songti SC", "STSong", Georgia, serif; line-height: 1.85; }
.exam-essay-body p { margin: 0 0 10px; text-indent: 2em; }
.exam-essay-body p:last-child { margin-bottom: 0; }

/* ========== 逻辑兵法 ========== */
/* --vis-tone 必须定义：.hook-label 的底色与 .derive 的左边框都取它，
   缺了会退化成透明底白字（与上面 .exam-ai-badge 是同一个坑）。 */
.tactic-card { --vis-tone: #9f1239; }
.tactic-card .kp-link:hover { background: #fff1f2; }

/* 触发信号：决定这条兵法要不要启动，所以排在图之前、用最跳的框。 */
.trigger {
  margin: 10px 0 16px; padding: 10px 14px;
  background: #fff7ed; border: 1px dashed #fdba74; border-radius: 12px;
}
.trigger-label {
  margin-bottom: 7px; font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: var(--vis-tone);
}
.trigger-words { display: flex; flex-wrap: wrap; gap: 6px; }
.trigger-word {
  padding: 2px 9px; border-radius: 999px; background: #fff;
  border: 1px solid #fdba74; color: #9a3412; font-size: 13px; white-space: nowrap;
}
.trigger-note { margin-top: 8px; font-size: 13px; color: #57534e; }
.trigger-avoid { color: #b91c1c; }

/* 真题实演：走法默认折叠，读者可以先自己走一遍再对答案。 */
.demo {
  margin: 14px 0; padding: 12px 14px;
  background: #f8fafc; border: 1px solid #cbd5e1;
  border-left: 4px solid var(--vis-tone); border-radius: 0 12px 12px 0;
}
.demo-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.demo-src { font-size: 12px; font-weight: 700; color: var(--vis-tone); }
.demo-goto {
  color: var(--vis-tone); font-size: 12px;
  text-decoration: none; border-bottom: 1px dashed currentColor; white-space: nowrap;
}
.demo-stem { font-family: "Songti SC", "STSong", Georgia, serif; line-height: 1.75; }
.demo-fold > summary { cursor: pointer; margin-top: 8px; font-size: 13px; color: var(--vis-tone); }
.demo-walk { padding-top: 6px; }
.demo-answer { margin-top: 8px; font-weight: 700; color: #166534; }

/* 脚手架表：底样式吃 .exam-mini-table，这里只加高亮与记号配色。
   min-width 归零是因为它常常只有 4–6 列，不需要 540px 的下限。 */
.scaffold-table { margin: 0 auto; min-width: 0; width: auto; table-layout: fixed; }
.scaffold-table td { height: 38px; min-width: 62px; font-size: 15px; }
.scaffold-table .hi { background: #fef3c7; }
.scaffold-table .m-yes { color: #166534; font-weight: 800; }
.scaffold-table .m-no { color: #b91c1c; font-weight: 800; }
.scaffold-table .m-maybe { color: var(--muted); }
.scaffold-table .m-fix { background: #ecfdf5; }
.scaffold-table sub { color: var(--muted); font-size: 10px; vertical-align: super; }
.scaffold-foot { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: center; }
/* 两张表并排：空白版给读者照着填，填完版给读者对答案。窄屏自动堆叠。 */
.scaffold-row { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; }
.scaffold-cell { flex: 0 1 auto; }
.scaffold-cap { margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--vis-tone); text-align: center; }

/* 分步图选静态方案就是为了能直接打印当纸质讲义。 */
@media print {
  .topbar, .sidebar, .footer, .search-wrap { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  body { background: #fff; }
  .main, body.fig-wide .main { max-width: none; padding: 0; }
  .content-card { box-shadow: none; border-radius: 0; break-inside: avoid; }
  .fig, .fig-fine { break-inside: avoid; border-color: #999; overflow: visible; }
  /* 打印没有横向滚动可用，所以放弃 78% 下限，让图缩到纸宽。 */
  .fig-fine svg { min-width: 0 !important; max-width: 100% !important; }
  .derive, .bounds, .hook, .tip, .danger, .formula-card,
  .trigger, .demo, .scaffold-table { break-inside: avoid; }
  /* 表格跨页时表头要重复，否则第二页全是无名列。 */
  .scaffold-table thead { display: table-header-group; }
  /* 未展开的 <details> 打印不出内容，而 display 覆盖不了 UA 的 content-visibility。
     真正生效的是 app.js 里的 beforeprint 钩子；这两条只是新版 Chrome 上的兜底。 */
  .demo-fold::details-content { content-visibility: visible !important; }
  .demo-fold > summary { list-style: none; }
}

@media (max-width: 860px) {
  .kp-link { margin-left: 0; }
  .hook { flex-direction: column; }
  .trigger-word { white-space: normal; }
  .demo-head { row-gap: 4px; }
}
