/* 本章与 07 同套样式 */
.book-shell { grid-template-columns: 340px 1fr; }
.toc-scroll { padding: 12px 18px; overflow: visible; max-height: none; }
.toc-scroll .toc__title::before { content: ''; }
.toc__box { padding: 0; background: transparent; border: 0; box-shadow: none; }
.toc__title { font-weight: 700; color: var(--ink); font-size: 13px; display: flex; align-items: center; gap: 10px; padding: 10px 0 10px; margin: 0 0 10px; border-bottom: 1px solid var(--border); }
.toc__title::before { content: ''; }
.toc a { color: var(--ink); text-decoration: none !important; }
.toc a:hover { color: var(--accent-hover); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc .lv1 { display: block; padding: 6px 0 4px; font-weight: 700; font-size: 14px; color: var(--ink); }
.toc.book-nav > li + li { margin-top: 4px; }
.toc .lv1 .n { color: var(--accent); font-weight: 900; min-width: 18px; }
.toc .lv2 { margin: 4px 0 12px 12px; padding-left: 12px; border-left: 2px solid rgba(231,229,228,0.95); display: grid; gap: 2px; }
.toc .lv2 a { display: flex; gap: 8px; padding: 5px 0; color: var(--ink-light); font-size: 12px; border-radius: 0; }
.toc .lv2 .n { color: var(--ink-muted); font-weight: 800; min-width: 26px; }
.toc .lv3 { margin: 2px 0 6px 24px; padding-left: 12px; border-left: 1px solid rgba(231,229,228,0.7); display: grid; gap: 1px; }
.toc .lv3 a { display: flex; gap: 6px; padding: 4px 0; color: var(--ink-muted); font-size: 11px; border-radius: 0; }
.toc .lv3 .n { color: var(--ink-muted); font-weight: 700; min-width: 32px; }
.toc a.is-active { color: var(--accent-hover); font-weight: 700; }
.toc .lv2 a.is-active { position: relative; }
.toc .lv2 a.is-active::before { content: ''; position: absolute; left: -14px; top: 6px; width: 2px; height: calc(100% - 12px); background: var(--accent); border-radius: 1px; }
.article { padding: 0; }
.callout { border-left: 3px solid var(--accent); padding: 10px 12px; margin: 12px 0 16px; background: transparent; }
.exercise { border-left: 3px solid #f59e0b; padding: 12px 14px; margin: 16px 0 20px; background: #fffbeb; border-radius: 4px; }
.exercise strong { color: #92400e; font-weight: 700; }
.exercise p { margin-bottom: 0.8em; }
.exercise ul, .exercise ol { margin: 0.6em 0 0.8em; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { border: 1px solid rgba(231,229,228,0.9); background: rgba(255,255,255,0.86); border-radius: 14px; padding: 12px; box-shadow: var(--shadow-sm); }
.card .t { font-weight: 700; margin-bottom: 6px; }
.card .d { color: var(--ink-light); font-size: 13px; }
.copy-btn { position: absolute; top: 8px; right: 8px; border: 1px solid #e5e5e5; background: #fff; color: var(--ink); border-radius: 6px; padding: 4px 8px; font-size: 12px; cursor: pointer; box-shadow: none; }
.copy-btn:hover { background: #f7f7f7; }
.copy-btn[data-state="ok"] { border-color: rgba(13,148,136,0.35); color: var(--accent-hover); }
.book-main pre code.hljs { padding: 0; background: transparent; }
.book-main .hljs-keyword, .book-main .hljs-selector-tag, .book-main .hljs-addition { color: var(--accent-hover); font-weight: 600; }
.book-main .hljs-string, .book-main .hljs-attr { color: #0d6e66; }
.book-main .hljs-comment { color: var(--ink-muted); font-style: italic; }
.book-main .hljs-number, .book-main .hljs-literal { color: #b45309; }
.book-main .hljs-built_in, .book-main .hljs-title.function_ { color: var(--ink); }
.book-main .hljs-title.class_ { color: var(--accent); }
/* ── 正文排版：行距与段间距 ── */
.article p {
  margin-bottom: 1.1em;
  line-height: 1.8;
}
.article p + ul,
.article p + ol,
.article p + .cols  { margin-top: 0.9em; }
.article ul + p,
.article ol + p,
.article ul + h3,
.article ol + h3,
.article .cols + p  { margin-top: 1.25em; }
.article h2 { margin-top: 2.2rem; margin-bottom: 1rem; padding-bottom: 0.35rem; }
.article h2:first-of-type { margin-top: 0; }
.article h3 { margin-top: 1.8rem; margin-bottom: 0.7rem; }
.article h4 { margin: 1.2rem 0 0.5rem; font-size: 1em; }

/* ── 无序列表：自定义圆点，加大行距 ── */
.article ul {
  margin: 0.9em 0 1.2em;
  padding-left: 0;
  list-style: none;
}
.article ul > li {
  position: relative;
  padding-left: 1.5em;
  margin-bottom: 0.75em;
  line-height: 1.8;
}
.article ul > li::before {
  content: '';
  position: absolute;
  left: 0.3em;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.article ul > li:last-child { margin-bottom: 0; }

/* 嵌套无序列表 */
.article ul ul {
  margin: 0.5em 0 0.3em;
  padding-left: 0.8em;
}
.article ul ul > li { margin-bottom: 0.4em; }
.article ul ul > li::before {
  width: 4px;
  height: 4px;
  background: transparent;
  border: 1.5px solid var(--accent);
  top: 0.66em;
}

/* ── 有序列表：accent 色序号，加大行距 ── */
.article ol {
  margin: 0.9em 0 1.2em;
  padding-left: 0;
  list-style: none;
  counter-reset: ol-counter;
}
.article ol > li {
  position: relative;
  padding-left: 2.2em;
  margin-bottom: 0.75em;
  line-height: 1.8;
  counter-increment: ol-counter;
}
.article ol > li::before {
  content: counter(ol-counter);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.article ol > li:last-child { margin-bottom: 0; }

/* card 内部列表不套用大行距 */
.card ul, .card ol {
  margin: 0.4em 0 0;
  padding-left: 0;
  list-style: none;
}
.card ul > li, .card ol > li {
  padding-left: 1.3em;
  margin-bottom: 0.35em;
  line-height: 1.65;
}
.card ul > li::before {
  width: 5px;
  height: 5px;
  top: 0.6em;
  left: 0.2em;
}
.card ol { counter-reset: card-ol; }
.card ol > li { counter-increment: card-ol; }
.card ol > li::before {
  content: counter(card-ol);
  width: 1.3em;
  height: 1.3em;
  font-size: 10px;
  top: 0.1em;
}

/* ── 代码块留白 ── */
.article pre { margin: 1.25em 0 1.5em; }
.article p + pre { margin-top: 1em; }

/* ── 图表区块 ── */
.figure-block { margin: 18px 0 8px; display: flex; flex-direction: column; align-items: flex-start; }
.figure-block svg { border-radius: 8px; }
.fig-caption { font-size: 12px; color: var(--ink-muted); margin-top: 6px; line-height: 1.5; max-width: 720px; }

/* ── 数学公式 ── */
.MathJax { font-size: 1em !important; }

@media (max-width: 980px) { .book-shell { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .figure-block svg { max-width: 100% !important; }
}
