/* =========================================================================
   LLM Serving 实战教程 · 样式
   颜色有语义：钴蓝 = prefill / 主色，琥珀 = decode。全站组件、图表、主页动画共用。
   字体只用系统字体（不加载网络字体，保证国内访问速度）。
   ========================================================================= */

:root {
  --paper: #ffffff;
  --paper-2: #f5f6f8;
  --paper-3: #eaedf1;
  --ink: #101317;        /* 标题 */
  --text: #262b33;       /* 正文 */
  --ink-2: #4c5563;
  --ink-3: #78818e;
  --rule: #e2e5ea;
  --rule-strong: #c6ccd4;

  --prefill: #2448c8;
  --prefill-ink: #1a3596;
  --prefill-soft: #e9eefc;
  --decode: #b5720a;
  --decode-ink: #82510a;
  --decode-soft: #fcf2de;
  --ok: #2f7d4f;
  --ok-soft: #e4f2e9;
  --err: #b73a3a;
  --err-soft: #f8e6e6;

  --series-1: #5b7393;
  --series-2: #3a8a7b;
  --series-3: #8566a3;
  --series-4: #9a6b4f;

  --code-bg: #f5f6f8;
  --code-ink: #232a34;
  --term-bg: #1b1f26;
  --term-ink: #dfe4ec;

  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --font-head: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 880px;
  --radius: 6px;

  /* docsify 主题变量 */
  --theme-color: var(--prefill);
  --docsifytabs-border-color: var(--rule);
  --docsifytabs-tab-highlight-color: var(--prefill);
  --docsifytabs-tab-color: var(--ink-3);
  --docsifytabs-tab-background: transparent;
  --docsifytabs-tab-background--active: transparent;
  --docsifytabs-tab-color--active: var(--ink);
  --docsifytabs-content-background: transparent;
}

:root[data-theme="dark"] {
  --paper: #15171b;
  --paper-2: #1b1e23;
  --paper-3: #272b32;
  --ink: #f2f4f6;
  --text: #d3d7dd;
  --ink-2: #a7aeb9;
  --ink-3: #7e8794;
  --rule: #2a2e35;
  --rule-strong: #3b4049;

  --prefill: #8fa8ff;
  --prefill-ink: #b8c7ff;
  --prefill-soft: #1f2742;
  --decode: #e9b14f;
  --decode-ink: #f4ca7c;
  --decode-soft: #33291a;
  --ok: #6cc394;
  --ok-soft: #1f3529;
  --err: #e88080;
  --err-soft: #3d2222;

  --series-1: #8ea3c2;
  --series-2: #6fbcac;
  --series-3: #b49ad0;
  --series-4: #c99c80;

  --code-bg: #1c1f25;
  --code-ink: #d5dae2;
  --term-bg: #0f1114;
  --term-ink: #d5dae2;
}

/* ------------------------------------------------------------------ 基础 */
/* 不用全局的平滑滚动：页面很长，跨页跳转时回到顶部的动画会被打断 */
html, body { background: var(--paper); }
body {
  font-family: var(--font-body);
  color: var(--text);
  font-size: 16px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--prefill-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--prefill); outline-offset: 2px; border-radius: 2px; }

/* 顶部阅读进度条 */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  background: transparent;
  pointer-events: none;
}
.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--prefill);
  transition: width 0.08s linear;
}
body.is-home .reading-progress { display: none; }

/* ------------------------------------------------------------------ 版心 */
.content { padding-top: 56px; }
.markdown-section {
  max-width: var(--measure);
  padding: 28px 44px 56px;
  margin: 0 auto;
  color: var(--text);
  line-height: 1.88;
  letter-spacing: 0.012em;
}
.markdown-section p, .markdown-section ul, .markdown-section ol { line-height: 1.88; }
.markdown-section p { margin: 0.95em 0; }
.markdown-section li { margin: 0.35em 0; }
.markdown-section li > p { margin: 0.35em 0; }

/* ------------------------------------------------------------------ 标题 */
.markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4 {
  color: var(--ink);
  font-family: var(--font-head);
  letter-spacing: -0.005em;
}
.markdown-section h1 {
  font-size: 2.08rem;
  font-weight: 700;
  line-height: 1.32;
  margin: 0.35em 0 0.55em;
}
.markdown-section h2 {
  font-size: 1.48rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 2.6em 0 0.75em;
  padding: 0 0 0.32em;
  border-bottom: 1px solid var(--rule);
}
.markdown-section h3 {
  font-size: 1.16rem;
  font-weight: 700;
  margin: 1.9em 0 0.5em;
}
.markdown-section h4 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 650;
  margin: 1.5em 0 0.4em;
}
.markdown-section h1 a, .markdown-section h2 a, .markdown-section h3 a, .markdown-section h4 a,
.markdown-section h5 a, .markdown-section h6 a, .anchor span {
  color: inherit !important;
  border: 0 !important;
  font-weight: inherit !important;
}
.markdown-section h2 + h3 { margin-top: 1.2em; }

/* ------------------------------------------------------------------ 正文元素 */
.markdown-section a { color: var(--prefill); font-weight: 500; text-decoration: none; border-bottom: 1px solid transparent; }
.markdown-section a:hover { border-bottom-color: currentColor; }
.markdown-section strong { color: var(--ink); font-weight: 650; }
.markdown-section em { color: inherit; }
.markdown-section hr { border: 0; border-top: 1px solid var(--rule); margin: 2.8em 0; }

/* 普通引用 */
.markdown-section blockquote {
  border-left: 3px solid var(--rule-strong);
  color: var(--ink-2);
  margin: 1.4em 0;
  padding: 0.1em 0 0.1em 1.1em;
  background: transparent;
}
.markdown-section blockquote p { font-weight: 400; margin: 0.4em 0; }

/* 标题下方的第一个引用：本节对应的书中章节等元信息 */
.markdown-section h1 + blockquote {
  border: 0;
  border-left: 2px solid var(--prefill);
  background: var(--paper-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.55em 1em;
  margin: 0.2em 0 2.1em;
  color: var(--ink-2);
  font-size: 0.88rem;
  line-height: 1.7;
}
.markdown-section h1 + blockquote p { margin: 0.15em 0; }
.markdown-section h1 + blockquote strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ 代码 */
.markdown-section code, .markdown-section pre, .markdown-section kbd {
  font-family: var(--font-mono);
}
.markdown-section code {
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.855em;
  padding: 0.16em 0.42em;
  border-radius: 4px;
  border: 1px solid var(--rule);
  margin: 0 1px;
  white-space: break-spaces;
}
.markdown-section pre {
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin: 1.35em 0;
  padding: 0;
  line-height: 1.62;
}
.markdown-section pre > code {
  background: transparent;
  color: var(--code-ink);
  font-size: 0.84rem;
  padding: 1.15em 1.35em;
  border: 0;
  margin: 0;
  white-space: pre;
}
.markdown-section pre::after { color: var(--ink-3); font-size: 0.7rem; top: 4px; right: 10px; }
.docsify-copy-code-button {
  background: var(--paper) !important;
  color: var(--ink-2) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 4px !important;
  font-family: var(--font-body) !important;
  font-size: 0.75rem !important;
  padding: 0.2em 0.7em !important;
}

/* 代码高亮：浅色 */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #7a8494; font-style: normal; }
.token.punctuation, .token.operator { color: #5a6473; }
.token.keyword, .token.selector, .token.important, .token.atrule { color: #2d50c4; }
.token.string, .token.char, .token.attr-value, .token.regex { color: #2f7d4f; }
.token.number, .token.boolean, .token.constant, .token.symbol { color: #a5560a; }
.token.function, .token.class-name { color: #7a3fa8; }
.token.property, .token.tag, .token.attr-name, .token.builtin { color: #8a5a06; }
.token.variable, .token.parameter { color: var(--code-ink); }
:root[data-theme="dark"] .token.comment { color: #7d8696; }
:root[data-theme="dark"] .token.punctuation, :root[data-theme="dark"] .token.operator { color: #a3abb8; }
:root[data-theme="dark"] .token.keyword, :root[data-theme="dark"] .token.atrule { color: #8aa4f2; }
:root[data-theme="dark"] .token.string, :root[data-theme="dark"] .token.attr-value { color: #8fd1a8; }
:root[data-theme="dark"] .token.number, :root[data-theme="dark"] .token.boolean { color: #f0b46a; }
:root[data-theme="dark"] .token.function, :root[data-theme="dark"] .token.class-name { color: #c9a3ef; }
:root[data-theme="dark"] .token.property, :root[data-theme="dark"] .token.builtin { color: #e0ad4a; }

/* ------------------------------------------------------------------ 表格 */
.markdown-section table {
  display: table;
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.92rem;
  line-height: 1.62;
  font-variant-numeric: tabular-nums;
}
.markdown-section th, .markdown-section td {
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0.6em 1em 0.6em 0.35em;
  text-align: left;
  vertical-align: top;
}
.markdown-section th:first-child, .markdown-section td:first-child { padding-left: 0.25em; }
.markdown-section th:last-child, .markdown-section td:last-child { padding-right: 0.25em; }
.markdown-section th {
  font-weight: 650;
  color: var(--ink);
  background: transparent;
  border-bottom: 1.5px solid var(--ink-2);
}
.markdown-section tr { background: transparent !important; border: 0; transition: background-color 0.12s ease; }
.markdown-section tbody tr:hover { background: var(--paper-2) !important; }
.markdown-section td code { overflow-wrap: anywhere; }
/* 窄屏：表格整体横向滚动，单元格不折行 */
@media (max-width: 768px) {
  .markdown-section table { display: block; width: max-content; max-width: 100%; overflow-x: auto; }
  .markdown-section th, .markdown-section td:first-child { white-space: nowrap; }
  .markdown-section td { min-width: 9em; max-width: 18em; }
  .mermaid svg { min-width: 560px; }
}

/* ------------------------------------------------------------------ 公式与图 */
.markdown-section .katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.3em 0; margin: 1.2em 0; }
.markdown-section .katex { font-size: 1.05em; }
.mermaid { margin: 1.8em 0; text-align: center; overflow-x: auto; }
.mermaid svg { max-width: 100%; height: auto; }

/* ------------------------------------------------------------------ 提示块 */
.markdown-section .alert.flat {
  background: var(--paper-2) !important;
  border: 0 !important;
  border-left: 3px solid var(--ink-3) !important;
  border-radius: 0 var(--radius) var(--radius) 0 !important;
  color: var(--text) !important;
  padding: 0.8em 1.2em !important;
  margin: 1.5em 0 !important;
  font-size: 0.95rem;
}
.markdown-section .alert.flat .title { color: var(--ink-2) !important; font-size: 0.85rem; letter-spacing: 0.02em; }
.markdown-section .alert.flat .icon { display: none; }
.markdown-section .alert.flat.note { border-left-color: var(--prefill) !important; }
.markdown-section .alert.flat.note .title { color: var(--prefill-ink) !important; }
.markdown-section .alert.flat.tip { border-left-color: var(--ok) !important; }
.markdown-section .alert.flat.tip .title { color: var(--ok) !important; }
.markdown-section .alert.flat.warning, .markdown-section .alert.flat.attention { border-left-color: var(--decode) !important; background: var(--decode-soft) !important; }
.markdown-section .alert.flat.warning .title, .markdown-section .alert.flat.attention .title { color: var(--decode-ink) !important; }

/* ------------------------------------------------------------------ 折叠块（参考答案、分步提示） */
.markdown-section details {
  border-top: 1px solid var(--rule);
  margin: 0;
  padding: 0;
}
.markdown-section details + details { border-top: 1px dashed var(--rule); }
.markdown-section details:last-of-type { border-bottom: 1px solid var(--rule); }
.markdown-section details + :not(details) { margin-top: 1.4em; }
.markdown-section summary {
  cursor: pointer;
  list-style: none;
  padding: 0.65em 0;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 0.95rem;
}
.markdown-section summary::-webkit-details-marker { display: none; }
.markdown-section summary::before {
  content: "";
  display: inline-block;
  width: 0.45em; height: 0.45em;
  margin: 0 0.75em 0.15em 0.1em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.markdown-section details[open] > summary::before { transform: rotate(45deg); }
.markdown-section details[open] > summary { color: var(--ink); }
.markdown-section summary:hover { color: var(--prefill); }
.markdown-section details > :not(summary) { margin-left: 1.3em; }
.markdown-section details[open] { padding-bottom: 0.6em; }

/* ------------------------------------------------------------------ Tabs 插件 */
.markdown-section .docsify-tabs__tab { font-family: var(--font-body); font-weight: 600; font-size: 0.88rem; }

/* ------------------------------------------------------------------ 侧边栏 */
.sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--rule);
  width: 288px;
  padding-top: 20px;
  color: var(--ink-2);
}
@media screen and (min-width: 769px) { body.close .sidebar { transform: translateX(-288px); } }
.content { left: 288px; }
body.close .content { left: 0; }
.sidebar > h1 { margin: 6px 24px 18px; text-align: left; }
.sidebar > h1 .app-name-link {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
}
.sidebar .search { border-bottom: 0; padding: 20px 20px 10px; margin: 0; }
.sidebar .search .input-wrap { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.sidebar .search input {
  background: transparent; color: var(--ink); font-family: var(--font-body);
  font-size: 0.88rem; padding: 0.55em 0.8em;
}
.sidebar .search input::placeholder { color: var(--ink-3); }
.sidebar .search .clear-button svg { stroke: var(--ink-3); }
.sidebar .search .results-panel { padding: 0 4px; }
.sidebar .search .matching-post { border-bottom: 1px solid var(--rule); }
.sidebar .search .matching-post h2 { color: var(--ink); font-size: 0.9rem; }
.sidebar .search .matching-post p { color: var(--ink-2); font-size: 0.8rem; }
.sidebar .search .matching-post em { color: var(--prefill); font-style: normal; font-weight: 600; }

.sidebar-nav { padding: 0 0 48px; }
.sidebar ul { margin: 0; }
.sidebar ul li { margin: 0; }
.sidebar ul li a {
  color: var(--ink-2);
  font-size: 0.89rem;
  line-height: 1.5;
  padding: 5px 20px 5px 24px;
  white-space: normal; overflow: visible; text-overflow: clip;
  border-left: 2px solid transparent;
  display: block;
}
.sidebar ul li a:hover { color: var(--ink); text-decoration: none; }
.sidebar ul li.active > a {
  color: var(--prefill-ink);
  font-weight: 650;
  border-left-color: var(--prefill);
  background: var(--prefill-soft);
}
.sidebar ul li ul { padding-left: 0; }
.sidebar ul li ul li a { padding-left: 38px; }
.sidebar ul li ul li ul li a { padding-left: 52px; font-size: 0.83rem; color: var(--ink-3); }
.sidebar ul li ul li ul li.active > a { background: transparent; border-left-color: transparent; color: var(--prefill-ink); }
.app-sub-sidebar li::before { content: none !important; display: none !important; }
.sidebar-nav hr { border: 0; border-top: 1px solid var(--rule); margin: 14px 24px; }

/* 部分标题与进度 */
.sidebar-nav > ul > li > p, .sidebar-nav > ul > li > strong {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 22px 20px 6px 24px;
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
}
.sidebar-nav > ul > li > p strong { font-weight: 700; color: var(--ink); }
.part-progress {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.part-progress.is-full { color: var(--ok); }
.sidebar-nav a.is-cleared::after {
  content: "";
  display: inline-block;
  width: 0.32em; height: 0.62em;
  margin-left: 0.6em;
  border-right: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(45deg) translateY(-0.15em);
}
.sidebar-nav a[href*="boss"], .sidebar-nav a[href*="walkthrough"] { color: var(--ink); }

.sidebar-toggle { background: transparent; width: auto; padding: 14px; }
.sidebar-toggle .sidebar-toggle-button span { background: var(--ink-2); }
body.sticky .sidebar, body.sticky .sidebar-toggle { position: fixed; }

/* ------------------------------------------------------------------ 顶部导航 */
.app-nav {
  margin: 0;
  right: 0;
  top: 12px;
  height: 31px;
  padding: 0 32px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
}
.app-nav > ul { display: inline-flex; align-items: center; height: 31px; margin: 0; padding: 0; }
.app-nav > ul > li { display: flex; align-items: center; height: 31px; line-height: 1; }
.app-nav li { margin: 0 6px; }
.app-nav a, .app-nav li > p, .nav-gh {
  color: var(--ink-2) !important;
  font-size: 0.88rem;
  font-weight: 500;
  border: 0 !important;
}
.app-nav a:hover, .nav-gh:hover { color: var(--ink) !important; }
.app-nav a.active { color: var(--ink) !important; }
.app-nav li ul {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(20, 28, 40, 0.08);
  padding: 6px 0;
}
.app-nav li ul a { padding: 4px 16px; font-size: 0.86rem; }
.nav-gh { margin: 0 6px 0 12px; text-decoration: none; }
.theme-toggle {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: 500 0.82rem var(--font-body);
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
}
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.app-nav { padding-right: 104px !important; }
/* 手机上只留图标，放在右下角，减少对正文的遮挡 */
@media (max-width: 768px) {
  .theme-toggle { top: auto; bottom: 12px; right: 12px; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
  .theme-toggle span { display: none; }
}
.github-corner { display: none; }

/* ------------------------------------------------------------------ 页底 */
.docsify-pagination-container {
  max-width: var(--measure);
  margin: 2.2em auto 0;
  padding: 1.5em 44px 0;
  border-top: 1px solid var(--rule);
}
.docsify-pagination-container .pagination-item a .pagination-item-label { color: var(--ink-3) !important; font-size: 0.8rem; opacity: 1 !important; }
.docsify-pagination-container .pagination-item a .pagination-item-title { color: var(--ink) !important; font-family: var(--font-head); font-size: 1.02rem; line-height: 1.5; opacity: 1 !important; }
.docsify-pagination-container .pagination-item a .pagination-item-subtitle { color: var(--ink-3); font-size: 0.8rem; text-transform: none; opacity: 1 !important; }
.docsify-pagination-container .pagination-item a:hover .pagination-item-title { color: var(--prefill) !important; }
.docsify-pagination-container .pagination-item-label > svg { stroke: var(--ink-3) !important; }

.clear-box { margin: 3.2em 0 0; padding-top: 1.4em; border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.clear-btn {
  cursor: pointer;
  font: 600 0.9rem var(--font-body);
  padding: 0.58em 1.25em;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.clear-btn:hover { border-color: var(--ok); color: var(--ok); }
.clear-btn.done { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }

.site-footer {
  margin-top: 2.4em;
  font-size: 0.8rem;
  color: var(--ink-3);
  line-height: 1.7;
}
.site-footer a { margin-left: 0.5em; }

/* =========================================================================
   交互组件
   ========================================================================= */
.llm-widget { margin: 2em 0; font-family: var(--font-body); }
.lw-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  color: var(--ink);
  line-height: 1.6;
}
.lw-header {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 16px;
  margin: 0 0 14px;
}
.lw-title-group { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lw-badge { display: none; }
.lw-title {
  margin: 0 !important;
  font-family: var(--font-head) !important;
  font-size: 1.02rem !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
}
.lw-title code { font-size: 0.85em; }
.lw-subtitle { font-size: 0.86rem; color: var(--ink-2); margin: -6px 0 14px; line-height: 1.6; }

.lw-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 22px;
  padding: 14px 0 16px;
  margin: 0 0 14px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.lw-control { display: flex; flex-direction: column; gap: 6px; }
.lw-control label { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.lw-control label .lw-val, .lw-val { font-family: var(--font-mono); color: var(--prefill-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.lw-control input[type="range"] { width: 100%; accent-color: var(--prefill); cursor: pointer; }
.lw-control select, .lw-control input[type="text"], .lw-control input[type="number"] {
  font: 0.86rem var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 5px 8px;
}

.lw-tabs, .lw-btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.lw-btn, .lw-tab {
  cursor: pointer;
  font: 600 0.82rem var(--font-body);
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 5px 12px;
  line-height: 1.45;
  text-align: left;
}
.lw-btn:hover, .lw-tab:hover { color: var(--ink); border-color: var(--ink-3); }
.lw-btn.active, .lw-tab.active { color: var(--prefill-ink); border-color: var(--prefill); background: var(--prefill-soft); }
.lw-btn.primary { color: #fff; background: var(--prefill); border-color: var(--prefill); }
:root[data-theme="dark"] .lw-btn.primary { color: #10131a; }
.lw-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.lw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 0; margin: 4px 0 14px; border-top: 1px solid var(--rule); }
.lw-stat { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule); background: transparent; border-left: 0; }
.lw-stat-label { font-size: 0.78rem; color: var(--ink-3); margin-bottom: 2px; }
.lw-stat-value { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.35; }
.lw-stat-sub { font-size: 0.76rem; color: var(--ink-3); margin-top: 2px; }
.lw-stat.ok .lw-stat-value { color: var(--ok); }
.lw-stat.warn .lw-stat-value { color: var(--decode-ink); }
.lw-stat.err .lw-stat-value { color: var(--err); }
.lw-stat.info .lw-stat-value { color: var(--prefill-ink); }

.lw-stack-bar { display: flex; height: 26px; border-radius: 4px; overflow: hidden; background: var(--paper-3); margin: 8px 0; }
.lw-stack-seg {
  display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap;
  font-size: 0.72rem; font-weight: 600; color: #fff; transition: width 0.25s ease;
}
.lw-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.8rem; color: var(--ink-2); margin: 6px 0 10px; }
.lw-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.lw-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

.lw-terminal {
  background: var(--term-bg);
  color: var(--term-ink);
  font: 0.8rem/1.7 var(--font-mono);
  border-radius: 4px;
  padding: 12px 14px;
  margin: 10px 0;
  overflow-x: auto;
  white-space: pre-wrap;
}
.lw-terminal .hl-green { color: #8fd1a8; }
.lw-terminal .hl-amber { color: #f0c877; }
.lw-terminal .hl-red { color: #f1a0a0; }
.lw-terminal .hl-blue { color: #a9bdf7; }

.lw-callout {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--ink-2);
  border-left: 2px solid var(--prefill);
  padding: 2px 0 2px 12px;
  margin: 12px 0 0;
  background: transparent;
}
.lw-callout.warn, .lw-callout.err { border-left-color: var(--decode); }
.lw-callout.ok { border-left-color: var(--ok); }
.lw-callout strong { color: var(--ink); }

.lw-grid-blocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 10px 0; }
.lw-block { border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; background: var(--paper); }
.lw-block-title { font-size: 0.72rem; color: var(--ink-3); margin-bottom: 4px; font-family: var(--font-mono); }
.lw-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.lw-slot {
  height: 20px; border-radius: 2px; background: var(--paper-3);
  font: 600 0.66rem/20px var(--font-mono); text-align: center; color: var(--ink-2);
  overflow: hidden;
}

.lw-error { color: var(--err); font-size: 0.86rem; padding: 10px 0; }

/* 组件内由 JS 写死的颜色在深色模式下的兜底：浅底色块降亮度 */
:root[data-theme="dark"] .lw-card [style*="background:#f8fafc"],
:root[data-theme="dark"] .lw-card [style*="background: #f8fafc"],
:root[data-theme="dark"] .lw-card [style*="background:#fff"],
:root[data-theme="dark"] .lw-card [style*="background: #fff"] { background: var(--paper-2) !important; }

/* ------------------------------------------------------------------ 自测题 */
.lw-quiz-card.is-all-correct { border-color: var(--ok); }
.lw-quiz-card .lw-header { border-bottom: 1px solid var(--rule); padding-bottom: 10px; align-items: center; }
.lw-quiz-badge {
  display: inline-block;
  font: 600 0.74rem var(--font-body);
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid var(--ok);
  border-radius: 999px;
  padding: 1px 9px;
}
.lw-quiz-meta { display: inline-flex; align-items: center; gap: 10px; }
.lw-quiz-score { font-size: 0.82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lw-quiz-score strong { color: var(--ink); }
.lw-quiz-reset {
  cursor: pointer;
  font: 500 0.76rem var(--font-body);
  color: var(--ink-3);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px 8px;
}
.lw-quiz-reset:hover { color: var(--ink); border-color: var(--rule-strong); }
.lw-quiz-list { counter-reset: q; }
.lw-quiz-item { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.lw-quiz-item:last-child { border-bottom: 0; padding-bottom: 0; }
.lw-quiz-q { font-size: 0.95rem; line-height: 1.75; color: var(--ink); margin-bottom: 10px; }
.lw-quiz-q strong { color: var(--ink-3); font-weight: 600; margin-right: 4px; font-variant-numeric: tabular-nums; }
.lw-quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.lw-quiz-opt {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  cursor: pointer; text-align: left;
  font: 0.9rem/1.65 var(--font-body);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 8px 12px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.lw-quiz-opt:hover { border-color: var(--rule-strong); background: var(--paper-2); }
.lw-quiz-opt .opt-letter {
  flex: none; width: 1.4em; text-align: center;
  font: 600 0.82rem/1.9 var(--font-mono); color: var(--ink-3);
}
.lw-quiz-opt:disabled { cursor: default; }
.lw-quiz-opt.opt-correct { border-color: var(--ok); background: var(--ok-soft); }
.lw-quiz-opt.opt-correct .opt-letter { color: var(--ok); }
.lw-quiz-opt.opt-wrong { border-color: var(--err); background: var(--err-soft); }
.lw-quiz-opt.opt-wrong .opt-letter { color: var(--err); }
.lw-quiz-opt.opt-dim { opacity: 0.6; }
.lw-quiz-explain { margin-top: 10px; font-size: 0.88rem; line-height: 1.75; color: var(--ink-2); padding-left: 12px; border-left: 2px solid var(--rule-strong); }
.lw-quiz-explain.exp-ok { border-left-color: var(--ok); }
.lw-quiz-explain.exp-err { border-left-color: var(--err); }
.lw-quiz-explain strong { color: var(--ink); }
.lw-quiz-retry { margin-top: 8px; font: 600 0.8rem var(--font-body); color: var(--prefill); background: none; border: 0; padding: 0; cursor: pointer; }

/* =========================================================================
   主页
   ========================================================================= */
body.is-home .markdown-section { max-width: 1120px; padding-top: 8px; margin-left: auto; margin-right: auto; }
body.is-home .markdown-section > h1 { display: none; }
body.is-home .markdown-section > div:first-child:not([class]) { display: none; }
body.is-home .sidebar .app-sub-sidebar { display: none !important; }
.kv-pool {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 14px 16px 12px;
}
.kv-pool-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.kv-pool-title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}
.kv-pool-fig {
  font: 600 0.7rem/1 var(--font-mono);
  letter-spacing: 0.05em;
  color: var(--prefill-ink);
  background: var(--prefill-soft);
  padding: 3px 6px;
  border-radius: 3px;
  white-space: nowrap;
  font-family: var(--font-body);
  flex-shrink: 0;
}
.kv-pool-ctrls { display: inline-flex; gap: 4px; flex-shrink: 0; }
.kv-pool-btn {
  cursor: pointer;
  font: 500 0.72rem/1.2 var(--font-mono);
  color: var(--ink-2);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3px 8px;
  white-space: nowrap;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.kv-pool-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.kv-pool-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
}
.kv-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--paper-3);
  cursor: crosshair;
  transition: background-color 0.3s ease, opacity 0.2s ease, transform 0.12s ease;
}
.kv-cell.is-prefill { background: var(--prefill); }
.kv-cell.is-decode { background: var(--decode); }
.kv-pool-grid.has-hover .kv-cell:not(.is-hi) { opacity: 0.22; }
.kv-pool-grid.has-hover .kv-cell.is-hi {
  opacity: 1;
  outline: 1.5px solid var(--ink);
  outline-offset: 1px;
  z-index: 1;
}
.kv-pool-inspect {
  margin-top: 10px;
  padding: 6px 8px;
  background: var(--paper-2);
  border-radius: 4px;
  font: 0.74rem/1.45 var(--font-mono);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kv-pool-inspect strong { color: var(--ink); font-weight: 600; }
.kv-pool-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--ink-3);
}
.kv-pool-legend { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; }
.kv-pool-caption .lw-dot { margin-right: 5px; vertical-align: -1px; }
.kv-pool-stat { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

body.is-home .markdown-section h2 { border-bottom: 0; padding-bottom: 0; }

/* 课程地图 */
.cm-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 0 0 10px;
}
.cm-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.86rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.cm-summary-stat strong { color: var(--ink); font-family: var(--font-mono); }
.cm-summary-next a { font-weight: 600; }
.cm-toggle-btn {
  cursor: pointer;
  font: 500 0.78rem var(--font-body);
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  padding: 4px 10px;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.cm-toggle-btn:hover { color: var(--ink); border-color: var(--ink-3); }

.course-map { border-top: 1.5px solid var(--ink-2); }
.cm-part {
  display: grid;
  grid-template-columns: 3.4em minmax(0, 1fr);
  gap: 0 16px;
  padding: 15px 0 16px;
  border-bottom: 1px solid var(--rule);
  align-items: start;
}
.cm-num-col { padding-top: 1px; }
.cm-num {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-3);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.cm-part.is-current .cm-num { color: var(--prefill); }
.cm-part.is-done .cm-num { color: var(--ok); }

.cm-body { min-width: 0; }
.cm-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.cm-head-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.cm-part-btn {
  cursor: pointer;
  font: 500 0.72rem/1.2 var(--font-body);
  color: var(--ink-3);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 2px 7px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.cm-part-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.cm-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--ink);
}
.cm-title a { color: inherit !important; }
.cm-title a:hover { color: var(--prefill) !important; border-bottom-color: transparent !important; }
.cm-extra-badge {
  font: 500 0.7rem/1.2 var(--font-body);
  color: var(--ink-3);
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  padding: 1px 6px;
}
.cm-meta {
  font: 500 0.78rem var(--font-mono);
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cm-desc {
  font-size: 0.87rem;
  color: var(--ink-2);
  line-height: 1.7;
}
.cm-bar {
  display: flex;
  gap: 3px;
  margin-top: 8px;
}
.cm-bar-seg {
  flex: 1;
  height: 4px;
  border-radius: 1px;
  background: var(--paper-3);
  border: 0 !important;
  transition: background-color 0.15s ease, transform 0.12s ease;
}
.cm-bar-seg:hover { background: var(--prefill); transform: scaleY(1.6); }
.cm-bar-seg.is-done { background: var(--ok); }

.cm-chapters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 20px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.cm-chap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--ink-2) !important;
  border-bottom: 0 !important;
  min-width: 0;
}
.cm-chap:hover { color: var(--prefill) !important; }
.cm-chap-code {
  flex: none;
  font: 500 0.76rem var(--font-mono);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.cm-chap-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-chap.is-proj {
  color: var(--ink) !important;
  font-weight: 600;
}
.cm-chap.is-proj .cm-chap-code {
  color: var(--decode-ink);
  background: var(--decode-soft);
  padding: 0 5px;
  border-radius: 3px;
  font-size: 0.72rem;
}
.cm-chap.is-done .cm-chap-code { color: var(--ok); }
.cm-chap.is-done::after {
  content: "";
  flex: none;
  display: inline-block;
  width: 0.3em;
  height: 0.58em;
  margin-left: 2px;
  border-right: 1.8px solid var(--ok);
  border-bottom: 1.8px solid var(--ok);
  transform: rotate(45deg) translateY(-1px);
}

/* =========================================================================
   响应式与动效偏好
   ========================================================================= */
@media screen and (max-width: 1100px) {
  .markdown-section, .docsify-pagination-container { margin-left: 0; }
}
@media screen and (max-width: 768px) {
  /* 手机上侧栏是抽屉：默认藏在左侧，body.close 表示展开（docsify 的约定） */
  .sidebar { width: 288px; left: -288px; padding-bottom: 72px; }
  body.close .sidebar { transform: translateX(288px); box-shadow: 4px 0 24px rgba(20, 28, 40, 0.12); }
  .content { left: 0; padding-top: 24px; }
  body.close .content { transform: translateX(288px); }
  /* docsify 在手机上把顶部导航（项目、附录）挪进了侧栏：标题放最上，其后是搜索，再是这组导航 */
  .sidebar { display: flex; flex-direction: column; }
  .sidebar > * { flex-shrink: 0; }
  .sidebar > h1 { order: -2; margin: 4px 24px 0; }
  .sidebar > nav > ul > li:first-child { display: none; } /* 下面的目录里已有首页 */
  .sidebar > .search { order: -1; }
  .sidebar > nav { padding: 0 24px 12px; margin-bottom: 8px; border-bottom: 1px solid var(--rule); font-size: 0.9rem; }
  .sidebar > nav ul { margin: 0; padding: 0; }
  .sidebar > nav > ul > li { margin: 0; padding-top: 4px; color: var(--ink-3); font-size: 0.82rem; }
  .sidebar > nav li li { margin: 0; padding-left: 12px; font-size: 0.9rem; }
  .sidebar > nav ul li a, .sidebar > nav ul li ul li a { display: block; padding: 8px 0; border: 0; background: none; color: var(--ink-2); font-size: 0.9rem; }
  .sidebar .sidebar-nav ul li > a { padding-top: 9px; padding-bottom: 9px; }
  /* 表单控件：字号不到 16px 时 iOS 聚焦会自动放大整页；滑块和下拉框也放大到好点的尺寸 */
  .lw-control select, .lw-control input[type="text"], .lw-control input[type="number"], .sidebar .search input { font-size: 16px; }
  .lw-control select, .lw-control input[type="text"], .lw-control input[type="number"] { min-height: 42px; }
  .lw-control input[type="range"] { height: 32px; }
  .docsify-copy-code-button { min-height: 32px; min-width: 52px; }
  /* 菜单按钮：与右下角的主题按钮成对，圆形、带底色，不再压在正文上 */
  .sidebar-toggle, body.close .sidebar-toggle {
    left: 12px; bottom: 12px; width: 38px; height: 38px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--paper); border: 1px solid var(--rule);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); transition: none;
  }
  .sidebar-toggle .sidebar-toggle-button { display: flex; flex-direction: column; align-items: center; }
  .sidebar-toggle span { width: 15px; margin-bottom: 3.5px; }
  .sidebar-toggle span:last-child { margin-bottom: 0; }
  .markdown-section pre[data-lang]::after { display: none; }
  .markdown-section { padding: 16px 20px 40px; }
  .docsify-pagination-container { padding: 1.5em 20px 0; }
  .markdown-section h1 { font-size: 1.7rem; }
  .markdown-section h2 { font-size: 1.3rem; margin-top: 2em; }
  .app-nav { padding-right: 12px; }
  .cm-part { grid-template-columns: 2.8em minmax(0, 1fr); gap: 0 10px; }
  .cm-chapters { grid-template-columns: 1fr; }
}
/* 手机上的图表：组件里的 SVG 按 640 宽设计，缩到一半时坐标字只剩 5px。
   core.js 给每张图套了 .lw-svgscroll；窄屏给图一个最小宽度，在容器里横向滑动，边缘渐隐提示还能滑 */
.lw-svgscroll { overflow-x: auto; overflow-y: hidden; }
@media screen and (max-width: 640px) {
  .lw-svgscroll > svg { min-width: 580px; }
  .lw-svgscroll::after {
    content: "图可以左右滑动"; display: block; position: sticky; left: 0; width: max-content;
    margin-top: 2px; font-size: 0.74rem; color: var(--ink-3);
  }
}
@media screen and (max-width: 768px) {
  .markdown-section table,
  .mermaid,
  .lw-table-wrap,
  .lw-svgscroll {
    background:
      linear-gradient(to right, var(--paper) 30%, rgba(255, 255, 255, 0)) left center / 28px 100% no-repeat local,
      linear-gradient(to left, var(--paper) 30%, rgba(255, 255, 255, 0)) right center / 28px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(20, 28, 40, 0.16), rgba(20, 28, 40, 0)) left center / 10px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(20, 28, 40, 0.16), rgba(20, 28, 40, 0)) right center / 10px 100% no-repeat scroll;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .sidebar-toggle, .app-nav, .clear-box, .docsify-pagination-container, .site-footer { display: none !important; }
  .content { left: 0 !important; padding-top: 0; }
}

/* 批处理时间线模拟器 */
.bt-rows { margin: 6px 0 4px; }
.bt-row { display: grid; grid-template-columns: 5.2em minmax(0, 1fr) 7.5em; gap: 10px; align-items: center; padding: 3px 0; }
.bt-label { font: 600 0.8rem var(--font-mono); color: var(--ink); }
.bt-label span { display: block; font-weight: 400; font-size: 0.7rem; color: var(--ink-3); }
.bt-track { position: relative; height: 20px; background: transparent; border-bottom: 1px solid var(--rule); }
.bt-seg { position: absolute; top: 2px; bottom: 2px; border-radius: 2px; transition: left 0.2s ease, width 0.2s ease; }
.bt-seg.is-prefill { background: var(--prefill); }
.bt-seg.is-decode { background: var(--decode); }
.bt-seg.is-wait, .bt-dot-wait { background: repeating-linear-gradient(135deg, var(--paper-3) 0 3px, transparent 3px 6px); outline: 1px solid var(--rule-strong); }
.bt-seg.is-stall { background: var(--err-soft); outline: 1px solid var(--err); }
.bt-arrive { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1.5px solid var(--ink); }
.bt-num { font: 0.78rem var(--font-mono); color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.bt-num span { color: var(--ink-3); margin: 0 3px; }
.bt-head .bt-num { font-family: var(--font-body); color: var(--ink-3); font-size: 0.72rem; }
.bt-axis { display: flex; justify-content: space-between; font: 0.7rem var(--font-mono); color: var(--ink-3); }

/* 组件内的表格 */
.lw-table-wrap { overflow-x: auto; margin: 4px 0 8px; }
.markdown-section .lw-table-wrap table.lw-table { display: table; width: 100%; max-width: none; font-size: 0.84rem; margin: 0; }
.lw-table td, .lw-table th { white-space: nowrap; }
.lw-table tr.lw-row-hi td { background: var(--prefill-soft); font-weight: 600; }

/* =========================================================================
   术语提示
   ========================================================================= */
.markdown-section .term {
  text-decoration: underline dotted;
  text-decoration-color: var(--ink-3);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: help;
  border-radius: 2px;
}
.markdown-section .term:hover,
.markdown-section .term:focus-visible { text-decoration-color: var(--prefill); color: var(--prefill-ink); outline: none; }
.term-pop {
  position: absolute;
  z-index: 80;
  background: var(--paper);
  color: var(--text);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(16, 22, 32, 0.14);
  padding: 10px 14px 11px;
  font: 400 0.84rem/1.68 var(--font-body);
}
.term-pop[hidden] { display: none; }
.term-pop-name { font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.term-pop-def { color: var(--ink-2); }
.term-pop-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 0.8rem; }
.term-pop-links a { color: var(--prefill) !important; font-weight: 600; text-decoration: none; }
.term-pop-links a:hover { text-decoration: underline; }
@media print { .markdown-section .term { text-decoration: none; } .term-pop { display: none !important; } }

/* 路线页：学习记录的导出、导入与清空 */
.progress-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0.6em 0 1.4em; }
.progress-tools button {
  font: 500 0.88rem var(--font-body); color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 7px 14px; cursor: pointer;
}
.progress-tools button:hover { border-color: var(--ink-3); }
.progress-tools button[data-armed="1"] { color: var(--err); border-color: var(--err); }
.progress-tools-msg { font-size: 0.86rem; color: var(--ink-2); flex-basis: 100%; min-height: 1.4em; }

/* =========================================================================
   首页
   主图是一条请求时间线：一整块钴蓝的 prefill，后面跟着一串琥珀色的 decode 步。
   其余部分只用字号、留白和细线组织，不加卡片和阴影。
   ========================================================================= */
body.is-home {
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
}
body.is-home .markdown-section { padding-left: 56px; padding-right: 56px; padding-bottom: 72px; }
body.is-home .markdown-section h2,
body.is-home .markdown-section h3 { border: 0; padding: 0; }
body.is-home .markdown-section a { text-decoration: none; }

/* ---------------------------------------------------------------- 开篇 */
.hp-hero { margin: 28px 0 0; }
.hp-kicker { margin: 0 0 22px !important; font-size: 0.95rem; color: var(--ink-2); line-height: 1.6 !important; }
.hp-hero-head {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 27em);
  justify-content: space-between;
  gap: 48px;
  align-items: end;
  margin-bottom: 44px;
}
.markdown-section h1.hp-title {
  font-family: var(--font-display);
  font-size: clamp(2.7rem, 6.6vw, 5.6rem);
  line-height: 1.06;
  white-space: nowrap;
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 0;
  color: var(--ink);
  font-feature-settings: "lnum";
}
.hp-lede { margin: 0 0 0.5em !important; font-size: 1.06rem; line-height: 1.9 !important; color: var(--text); max-width: 27em; }

/* ---------------------------------------------------------------- 请求时间线 */
.rt { margin: 0; }
.rt-cap {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--ink);
}
.rt-cap-title { font-family: var(--font-head); font-weight: 700; font-size: 1.06rem; color: var(--ink); }
.rt-cap-note { font-size: 0.86rem; color: var(--ink-3); }
.rt-cap-note a { color: inherit !important; border-bottom: 1px solid var(--rule-strong); }
.rt-replay {
  margin-left: auto; font: 500 0.82rem var(--font-body); color: var(--ink-2);
  background: none; border: 0; border-bottom: 1px solid var(--rule-strong); padding: 0 0 1px; cursor: pointer;
}
.rt-replay:hover { color: var(--ink); border-color: var(--ink-2); }

.rt-track { display: flex; gap: 4px; height: 88px; }
.rt-prefill {
  flex: 0 0 var(--rt-p);
  background: var(--prefill);
  color: var(--paper);
  display: flex; align-items: flex-end;
  padding: 0 0 10px 14px;
  font: 600 0.92rem var(--font-mono);
  letter-spacing: 0.01em;
  transform-origin: left center;
  border-radius: 2px;
}
.rt-decode { flex: 1 1 0; display: flex; gap: 3px; min-width: 0; }
.rt-tok { flex: 1 1 0; background: var(--decode); border-radius: 2px; }

.rt.is-playing .rt-prefill { animation: rt-grow 0.9s cubic-bezier(0.22, 0.7, 0.2, 1) both; }
.rt.is-playing .rt-prefill span { animation: rt-fade 0.3s 0.75s both; }
.rt.is-playing .rt-tok { animation: rt-pop 0.18s calc(1s + var(--i) * 55ms) both; }
.rt.is-playing .rt-mark-ttft { animation: rt-fade 0.3s 0.95s both; }
.rt.is-playing .rt-mark-itl { animation: rt-fade 0.3s 1.25s both; }
@keyframes rt-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rt-pop { from { opacity: 0; transform: scaleY(0.35); } to { opacity: 1; transform: scaleY(1); } }
@keyframes rt-fade { from { opacity: 0; } to { opacity: 1; } }

/* 刻度：TTFT 跨整块 prefill，ITL 只跨一个 decode 步 */
.rt-marks { position: relative; height: 34px; margin-top: 6px; }
.rt-mark {
  position: absolute; top: 0; height: 7px;
  border: 1px solid var(--ink-2); border-top: 0;
  font-size: 0.8rem; color: var(--ink-2); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rt-mark b { font-weight: 650; color: var(--ink); }
.rt-mark::after { content: ""; }
.rt-mark-ttft { left: 0; width: var(--rt-p); padding-top: 11px; text-indent: 0; }
.rt-mark-itl {
  left: calc(var(--rt-p) + 4px);
  width: calc((100% - var(--rt-p) - 4px) / var(--rt-steps));
  padding-top: 11px;
}

.rt-notes { display: grid; grid-template-columns: var(--rt-p) minmax(0, 1fr); gap: 4px; margin-top: 10px; }
.rt-note { padding-right: 36px; }
.rt-note-d { padding-right: 0; }
.rt-note h3 {
  font-family: var(--font-head) !important; font-size: 1.08rem !important; font-weight: 700;
  margin: 0 0 6px !important; color: var(--ink);
}
.rt-note-p h3 { color: var(--prefill-ink); }
.rt-note-d h3 { color: var(--decode-ink); }
.rt-note p { margin: 0 0 6px !important; font-size: 0.93rem; line-height: 1.8 !important; color: var(--text); max-width: 31em; }
.rt-note .rt-links { color: var(--ink-3); font-size: 0.86rem; }
.rt-links a { color: var(--ink-2) !important; border-bottom: 1px solid var(--rule-strong); }
.rt-links a:hover { color: var(--ink) !important; border-color: var(--ink-2); }

/* ---------------------------------------------------------------- 入口 */
.hp-start {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px;
  margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--rule);
}
.hp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.hp-actions a { font-weight: 600; font-size: 0.95rem; color: var(--ink) !important; border-bottom: 1px solid var(--rule-strong); padding-bottom: 2px; }
.hp-actions a:hover { border-color: var(--ink); }
.hp-actions a.hp-btn {
  background: var(--ink); color: var(--paper) !important; border: 0;
  padding: 0.72em 1.5em; border-radius: 2px;
}
.hp-actions a.hp-btn:hover { background: var(--prefill); }
:root[data-theme="dark"] .hp-actions a.hp-btn:hover { color: #0d1020 !important; }
.hp-scope { margin: 0 !important; font-size: 0.86rem; color: var(--ink-3); line-height: 1.7 !important; max-width: 30em; }

/* ---------------------------------------------------------------- 分节 */
.hp-section { margin-top: 104px; }
.markdown-section h2.hp-h2 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.6vw, 2.15rem);
  font-weight: 700; letter-spacing: -0.005em; line-height: 1.25;
  margin: 0 0 14px; color: var(--ink);
}
.hp-section-note { margin: 0 0 30px !important; color: var(--ink-2); font-size: 0.98rem; line-height: 1.85 !important; max-width: 40em; }

/* 两笔账：公式是标题 */
.hp-ledgers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.hp-ledger { padding: 30px 44px 6px 0; }
.hp-ledger + .hp-ledger { padding: 30px 0 6px 44px; border-left: 1px solid var(--rule); }
.hp-eq { font-size: 1.62rem; color: var(--ink); min-height: 2.2em; display: flex; align-items: center; overflow-x: auto; }
.hp-eq .katex { font-size: 1em; }
.hp-ledger h3 { font-family: var(--font-head) !important; font-size: 1.1rem !important; margin: 14px 0 8px !important; color: var(--ink); }
.hp-ledger p { margin: 0 !important; font-size: 0.95rem; line-height: 1.88 !important; color: var(--text); }
.hp-ledger p strong { color: var(--ink); font-weight: 650; }

/* 每一节怎样学：五步是先后顺序，用序号 */
.hp-steps {
  list-style: none; margin: 30px 0 0 !important; padding: 0 !important;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--ink); counter-reset: hp-step;
}
.hp-steps li { counter-increment: hp-step; margin: 0 !important; padding: 20px 22px 0 0; position: relative; }
.hp-steps li + li { padding-left: 22px; border-left: 1px solid var(--rule); }
.hp-steps li::before {
  content: counter(hp-step);
  display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1; color: var(--ink-3);
  margin-bottom: 14px; font-feature-settings: "lnum";
}
.hp-steps h3 { font-family: var(--font-head) !important; font-size: 1.02rem !important; margin: 0 0 6px !important; color: var(--ink); }
.hp-steps p { margin: 0 !important; font-size: 0.88rem; line-height: 1.78 !important; color: var(--ink-2); }

/* 实战项目：整行可点 */
.hp-projects { border-top: 1px solid var(--ink); }
a.hp-proj {
  display: grid; grid-template-columns: 6.4em minmax(0, 1fr) 13em; gap: 8px 28px; align-items: baseline;
  padding: 22px 0; border-bottom: 1px solid var(--rule); color: inherit !important;
}
.hp-proj-idx { font-size: 0.88rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.hp-proj-body { display: block; min-width: 0; }
.hp-proj-name { display: block; font-family: var(--font-head); font-size: 1.14rem; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
a.hp-proj:hover .hp-proj-name { color: var(--prefill); }
.hp-proj-desc { display: block; font-size: 0.92rem; line-height: 1.8; color: var(--ink-2); font-weight: 400; }
.hp-proj-meta { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; text-align: right; font-size: 0.82rem; color: var(--ink-3); font-weight: 400; }
.hp-proj-meta code { font-size: 0.8rem !important; }

/* 页尾两栏 */
.hp-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; }
.hp-foot-col { min-width: 0; }
.hp-foot-col > p { font-size: 0.95rem; line-height: 1.88 !important; color: var(--text); margin: 0 0 1.2em !important; }
.hp-specs { margin: 0; border-top: 1px solid var(--rule); }
.hp-specs dt { font-weight: 650; color: var(--ink); font-size: 0.92rem; padding-top: 12px; }
.hp-specs dd { margin: 2px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--rule); font-size: 0.9rem; line-height: 1.78; color: var(--ink-2); }
.hp-foot pre { margin-top: 0; }

/* 首页的课程地图沿用组件自身的样式，只把标题让给外层 */
body.is-home .site-footer { margin-top: 88px; }

@media screen and (max-width: 1100px) {
  body.is-home .markdown-section { padding-left: 36px; padding-right: 36px; }
  .hp-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (min-width: 769px) and (max-width: 1100px) {
  .hp-steps li:nth-child(4) { padding-left: 0; border-left: 0; }
  .hp-steps li:nth-child(n+4) { margin-top: 26px !important; }
}
@media screen and (max-width: 1100px) {
  a.hp-proj { grid-template-columns: 5.4em minmax(0, 1fr); }
  .hp-proj-meta { grid-column: 2; flex-direction: row; gap: 14px; align-items: baseline; text-align: left; }
}
@media screen and (max-width: 768px) {
  body.is-home .markdown-section { padding-left: 20px; padding-right: 20px; }
  .hp-hero { margin-top: 12px; }
  .hp-hero-head { grid-template-columns: 1fr; gap: 20px; margin-bottom: 32px; }
  .rt-track { height: 64px; }
  .rt-decode { gap: 2px; }
  .rt-notes { grid-template-columns: 1fr; gap: 22px; margin-top: 4px; }
  .rt-note { padding-right: 0; }
  .rt-mark-itl { text-indent: 0; }
  .hp-section { margin-top: 72px; }
  .hp-ledgers { grid-template-columns: 1fr; }
  .hp-ledger, .hp-ledger + .hp-ledger { padding: 24px 0 18px; border-left: 0; }
  .hp-ledger + .hp-ledger { border-top: 1px solid var(--rule); }
  .hp-eq { font-size: 1.3rem; }
  .hp-steps { grid-template-columns: 1fr; }
  .hp-steps li, .hp-steps li + li { padding: 16px 0 16px 2.6em; border-left: 0; margin-top: 0 !important; }
  .hp-steps li + li { border-top: 1px solid var(--rule); }
  .hp-steps li::before { position: absolute; left: 0; top: 16px; font-size: 1.5rem; }
  a.hp-proj { grid-template-columns: 1fr; gap: 4px; padding: 18px 0; }
  .hp-proj-meta { grid-column: 1; }
  .hp-foot { grid-template-columns: 1fr; gap: 56px; }
}
