/* 2026 CV 面经 · 全站样式（浅色，面经卡片体系；与 SubEx 架构同构但视觉全新） */

:root {
  --bg: #f5f6f9;
  --card: #ffffff;
  --text: #23272f;
  --muted: #5c6370;
  --faint: #8b91a0;
  --line: #e4e7ee;
  --line-soft: #edeff4;
  --accent: #4263eb;
  --accent-deep: #3b5bdb;
  --accent-tint: #eef2ff;
  /* 频率配色：必考 玫红 / 高频 橙 / 中频 蓝 / 低频 灰 */
  --freq-must: #d6336c;
  --freq-must-bg: #fdf0f5;
  --freq-hot: #e8590c;
  --freq-hot-bg: #fdf1e7;
  --freq-mid: #1971c2;
  --freq-mid-bg: #eaf3fb;
  --freq-low: #737b8a;
  --freq-low-bg: #f1f2f5;
  --ok: #0ca678;
  --ok-bg: #f0faf6;
  --fu: #7048e8;
  --fu-bg: #f7f5fe;
  --warn: #c92a2a;
  --warn-bg: #fdf3f3;
  --gold: #e67700;
  --gold-bg: #fffaeb;
  --slate: #57606a;
  --slate-bg: #f7f9fb;
  --code-bg: #f6f8fa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(23, 30, 51, 0.05), 0 4px 16px rgba(23, 30, 51, 0.06);
  --shadow-lift: 0 4px 10px rgba(23, 30, 51, 0.08), 0 12px 32px rgba(23, 30, 51, 0.1);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 700; }
p { margin: 0.7em 0; }
::selection { background: #dbe4ff; }

/* ── 顶部导航 ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topnav .brand {
  font-weight: 800;
  color: var(--accent-deep);
  font-size: 17px;
  white-space: nowrap;
}
.topnav .brand:hover { text-decoration: none; }
.topnav .crumb {
  color: var(--muted);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 布局容器 ── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 72px;
}
.container-wide { max-width: 1120px; }
.subtitle { color: var(--muted); font-size: 15px; }
.footer-note { text-align: center; margin-top: 48px; font-size: 13px; }
.loading { text-align: center; margin-top: 120px; }

/* ── 首页 hero ── */
.home-hero { padding: 22px 0 10px; }
.home-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: 0.5px;
  background: linear-gradient(120deg, var(--accent-deep), var(--fu));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.home-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 6px; }
.home-stats span {
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 600;
}
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.cat-chip {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.cat-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ── 首页分类与卡片 ── */
.cat-section { margin: 30px 0; }
.cat-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 19px;
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
.cat-count { font-size: 13px; font-weight: 500; color: var(--faint); }
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.topic-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.topic-card:hover {
  text-decoration: none;
  border-color: #c9d4f6;
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-deep);
  background: var(--accent-tint);
  padding: 2px 10px;
  border-radius: 999px;
}
.card-count { font-size: 12.5px; color: var(--faint); }
.card-name { font-size: 19px; font-weight: 800; }
.card-title { color: var(--muted); font-size: 14px; margin-top: 2px; }
.card-intro {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 返回条 ── */
.back-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 22px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--muted);
  width: fit-content;
}
.back-bar:hover { border-color: var(--accent); text-decoration: none; color: var(--accent); }
.back-arrow { font-size: 16px; line-height: 1; }
.back-label { font-weight: 600; }
.back-ctx { color: var(--faint); }
.back-bar-end { margin: 30px 0 0; }

/* ── 板块目录：小节列表 ── */
.meta-box {
  background: var(--accent-tint);
  border: 1px solid #dfe7fb;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin: 18px 0;
}
.meta-box b { color: var(--accent-deep); }
.meta-box p { margin: 4px 0 0; color: var(--muted); }
.sec-list { list-style: none; margin: 20px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.sec-item {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--faint);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.sec-item:hover { text-decoration: none; box-shadow: var(--shadow); }
.sec-item.freq-must { border-left-color: var(--freq-must); }
.sec-item.freq-hot { border-left-color: var(--freq-hot); }
.sec-item.freq-mid { border-left-color: var(--freq-mid); }
.sec-item.freq-low { border-left-color: var(--freq-low); }
.sec-item.freq-plain { border-left-color: var(--accent); }
.sec-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-line .num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  font-weight: 700;
}
.sec-title { font-weight: 700; font-size: 15.5px; flex: 1; min-width: 200px; }
.sec-summary { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.65; }

/* ── 频率徽标 / 难度星 / 小节页 chips ── */
.freq-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.6;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.freq-badge.freq-must { color: var(--freq-must); background: var(--freq-must-bg); border-color: #f6c9da; }
.freq-badge.freq-hot { color: var(--freq-hot); background: var(--freq-hot-bg); border-color: #f8d5bd; }
.freq-badge.freq-mid { color: var(--freq-mid); background: var(--freq-mid-bg); border-color: #c4dcf3; }
.freq-badge.freq-low { color: var(--freq-low); background: var(--freq-low-bg); border-color: #d9dce2; }
.freq-badge.freq-plain { color: var(--muted); background: var(--line-soft); border-color: var(--line); }
.stars { color: var(--gold); font-size: 13px; letter-spacing: 1.5px; white-space: nowrap; }
.stars .stars-off { color: #d8dbe2; }
.sec-chips { display: flex; align-items: center; gap: 10px; margin: -6px 0 4px; }
.chip-plain {
  font-size: 12px;
  color: var(--muted);
  background: var(--line-soft);
  padding: 1px 10px;
  border-radius: 999px;
}
.prereq-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--slate-bg);
  border: 1px dashed #ccd4de;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13.5px;
  margin: 14px 0 0;
}
.prereq-box b { color: var(--slate); font-size: 13px; }
.prereq-box a {
  padding: 1px 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.prereq-box a:hover { border-color: var(--accent); text-decoration: none; }

/* ── 翻页 ── */
.pager {
  display: flex;
  gap: 10px;
  margin: 26px 0;
}
.pager a {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
  min-width: 0;
}
.pager a:last-child { text-align: right; align-items: flex-end; }
.pager a:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); }
.pager .dir { font-size: 12px; color: var(--faint); font-weight: 500; }
.pager a span:not(.dir) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ── 正文排版 ── */
.container > h1 { font-size: clamp(22px, 3.4vw, 28px); margin: 10px 0 14px; }
.content-body h2, .container h2 {
  font-size: 21px;
  margin: 2.1em 0 0.7em;
  padding-left: 12px;
  border-left: 4px solid var(--accent);
}
.container h3 { font-size: 17.5px; margin: 1.6em 0 0.5em; color: #1d2433; }
.container h4 { font-size: 15.5px; margin: 1.3em 0 0.4em; }
.container ul, .container ol { padding-left: 1.5em; }
.container li { margin: 0.28em 0; }
.container blockquote {
  margin: 1em 0;
  padding: 6px 18px;
  border-left: 4px solid #c6cad2;
  background: var(--slate-bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--accent-tint);
  color: #364fc7;
  padding: 1px 6px;
  border-radius: 5px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 13.5px;
  margin: 1em 0;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; border-radius: 0; }
.container table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.1em 0;
  font-size: 14px;
  background: var(--card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
}
.container th, .container td {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.container th { background: var(--accent-tint); color: #2b3a67; font-weight: 700; white-space: nowrap; }
.container tr:last-child td { border-bottom: none; }
.formula {
  margin: 1.1em 0;
  padding: 6px 8px;
  overflow-x: auto;
  text-align: center;
  font-size: 1.05em;
}
pre.mermaid {
  background: var(--card);
  text-align: center;
  cursor: zoom-in;
  border: 1px solid var(--line);
}
pre.mermaid:not(:has(svg)) { cursor: default; }
pre.mermaid svg { max-width: 100%; height: auto; }

/* highlight.js token 配色（GitHub Light 变体，对齐浅色主题） */
.hljs-comment, .hljs-quote { color: #857f74; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-deletion { color: #cf222e; }
.hljs-string, .hljs-regexp, .hljs-addition { color: #0a3069; }
.hljs-number, .hljs-literal, .hljs-built_in, .hljs-symbol, .hljs-link { color: #0550ae; }
.hljs-title, .hljs-section, .hljs-name, .hljs-selector-id, .hljs-selector-class { color: #8250df; }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-property, .hljs-params { color: #953800; }
.hljs-type, .hljs-title.class_, .hljs-class .hljs-title { color: #116329; }
.hljs-meta { color: var(--muted); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

/* ── 面经卡片（qa 容器） ── */
.qa {
  border-radius: var(--radius-sm);
  margin: 14px 0;
  padding: 12px 16px 10px;
  border: 1px solid var(--line);
  background: var(--card);
}
.qa > p:first-child { margin-top: 2px; }
.qa .qa-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0 9px;
  border-radius: 999px;
  margin-bottom: 6px;
}

/* 题目卡：左侧色条按频率 */
.qa-question { border-left: 4px solid var(--accent); padding-top: 10px; }
.qa-question .q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.qa-question .q-no {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: var(--accent-deep);
  border-radius: 6px;
  padding: 0 8px;
  line-height: 1.7;
}
.qa-question.freq-must { border-left-color: var(--freq-must); }
.qa-question.freq-must .q-no { background: var(--freq-must); }
.qa-question.freq-hot { border-left-color: var(--freq-hot); }
.qa-question.freq-hot .q-no { background: var(--freq-hot); }
.qa-question.freq-mid { border-left-color: var(--freq-mid); }
.qa-question.freq-mid .q-no { background: var(--freq-mid); }
.qa-question.freq-low { border-left-color: var(--freq-low); }
.qa-question.freq-low .q-no { background: var(--freq-low); }
.qa-question > p:first-of-type { font-weight: 600; }
.qa-question > p:first-of-type strong { font-weight: 700; }

/* 答案卡：答题纸质感 */
.qa-answer { background: var(--ok-bg); border-color: #d3efe6; }
.qa-answer .qa-tag { color: var(--ok); background: #ddf5eb; }

/* 追问链 */
.qa-followup { background: var(--fu-bg); border-color: #e4defb; }
.qa-followup .qa-fu-q { font-weight: 700; color: var(--fu); margin-bottom: 4px; }

/* 减分点 */
.qa-trap { background: var(--warn-bg); border-color: #f5dada; }
.qa-trap .qa-tag { color: var(--warn); background: #fbe3e3; }

/* 关键结论 */
.qa-keypoint { background: var(--gold-bg); border-color: #ffe8b3; }
.qa-keypoint .qa-tag { color: var(--gold); background: #fff1d6; }

/* 深入块 */
.qa-deep-dive { background: var(--slate-bg); border-color: #dde2ea; }
.qa-deep-dive .qa-tag { color: var(--slate); background: #e8ecf2; }

/* 未知容器兜底 */
.qa-callout { background: var(--line-soft); }

/* ── 页内目录（宽屏右侧浮动） ── */
.page-toc {
  position: fixed;
  top: 84px;
  right: max(28px, calc((100vw - 860px) / 2 - 228px));
  width: 224px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  font-size: 12.5px;
  z-index: 30;
  scrollbar-width: thin;
}
.page-toc-title {
  font-weight: 700;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 1px;
  padding: 0 10px 6px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.page-toc button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-toc button:hover { background: var(--accent-tint); color: var(--accent-deep); }
.page-toc .t-q {
  font-style: normal;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent-deep);
  background: var(--accent-tint);
  border-radius: 4px;
  padding: 0 5px;
  margin-right: 6px;
  font-size: 11px;
}

/* ── 回到顶部 ── */
#back-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #c9d4f6;
  background: var(--card);
  color: var(--accent-deep);
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 40;
}
#back-top.show { opacity: 1; visibility: visible; transform: none; }
#back-top:hover { background: var(--accent-tint); }

/* ── 错误卡片 ── */
.error {
  background: var(--warn-bg);
  border: 1px solid #f0c9c9;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 40px;
}
.error b { color: var(--warn); font-size: 17px; }
.error code { background: #fff; }

/* ── mermaid 灯箱 ── */
.diagram-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(18, 22, 33, 0.82);
  display: none;
}
.diagram-lightbox.open { display: block; }
.lb-canvas { position: absolute; inset: 0 0 56px 0; overflow: hidden; cursor: zoom-in; }
.lb-paper {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  cursor: grab;
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  padding: 6px;
}
.lb-paper.dragging { cursor: grabbing; }
.lb-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border-radius: 999px;
  padding: 4px 8px;
  box-shadow: var(--shadow-lift);
}
.lb-bar button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.lb-bar button:hover { border-color: var(--accent); color: var(--accent); }
.lb-scale {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  min-width: 44px;
  text-align: center;
}

/* ── 响应式 ── */
@media (max-width: 1359px) {
  .page-toc { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topic-grid { grid-template-columns: 1fr; }
  .pager { flex-direction: column; }
  .pager a:last-child { text-align: left; align-items: flex-start; }
  .sec-title { min-width: 140px; }
  .topnav { flex-wrap: wrap; }
}
