/* ============================================================
   WP Lab — 工程蓝图暗色（Blueprint Dark）
   暗色是默认；亮色由 <html data-mode="light"> 覆盖（app.js 切换）。
   所有颜色集中在 :root，改配色只动这一块。
   ============================================================ */

:root {
  /* 底层 */
  --bg: #0B1220;
  --surface: #111A2B;
  --surface-2: #16223A;
  --line: #23314C;
  --line-soft: #1A2538;
  --canvas: #0E1727;   /* 笔记正文画布，比 bg 亮一点、比 surface 暗一点 */

  /* 文字 */
  --ink: #E6EDF7;
  --ink-2: #A9B8D0;
  --ink-3: #74859F;

  /* 主色 */
  --accent: #2A7FFF;
  --accent-soft: #19304F;
  --accent-2: #37E0C8;   /* Learn */
  --amber: #FFB84D;      /* Fix */
  --danger: #FF6B81;

  /* 网格 */
  --grid: rgba(42, 127, 255, 0.055);
  --grid-size: 44px;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --glow: 0 0 0 1px rgba(42, 127, 255, 0.35), 0 0 28px rgba(42, 127, 255, 0.18);

  --font-display: 'Space Grotesk', 'Noto Sans SC', system-ui, sans-serif;
  --font-body: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --max: 1400px;
  --header-h: 106px;   /* 顶栏总高：内容 62 + 上下 padding 各 22 */
}

html[data-mode="light"] {
  --bg: #F2F5FA;
  --surface: #FFFFFF;
  --surface-2: #EDF2FA;
  --line: #D3DEEE;
  --line-soft: #E4EBF5;
  --canvas: #FFFFFF;
  --ink: #10203A;
  --ink-2: #41536E;
  --ink-3: #6B7C96;
  --accent: #1B5FD0;
  --accent-soft: #DCE8FB;
  --accent-2: #0E8F7E;
  --amber: #B8761A;
  --danger: #C2344A;
  --grid: rgba(27, 95, 208, 0.07);
  --shadow: 0 14px 34px rgba(16, 32, 58, 0.1);
  --glow: 0 0 0 1px rgba(27, 95, 208, 0.25), 0 0 20px rgba(27, 95, 208, 0.1);
}

* { box-sizing: border-box; }

/* hidden 属性要能盖过下面那些 display: grid/flex/block 的规则
   （否则 JS 设 el.hidden = true 不会生效：搜索浮层关不掉、工具墙筛选藏不住卡片） */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* 蓝图网格背景（固定，轻微视差由 app.js 微调） */
.grid-bg {
  position: fixed;
  inset: -10% -10% -10% -10%;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px),
    radial-gradient(circle at 18% -5%, rgba(42, 127, 255, 0.14), transparent 55%),
    radial-gradient(circle at 92% 8%, rgba(55, 224, 200, 0.08), transparent 50%);
  background-size: var(--grid-size) var(--grid-size), var(--grid-size) var(--grid-size), auto, auto;
  transform: translateY(var(--grid-shift, 0px));
}

html[data-mode="light"] .grid-bg {
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

/* ===================== 换页淡入淡出 ===================== */

/* 进站 / 换页后淡入；.is-leaving 由 app.js 在点击站内链接时加上 */
body {
  animation: wplab-page-in .28s ease both;
}
body.is-leaving {
  opacity: .25;
  transition: opacity .16s ease;
  animation: none;
}
@keyframes wplab-page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* 关掉动画偏好时完全不做效果 */
@media (prefers-reduced-motion: reduce) {
  body, body.is-leaving { animation: none; opacity: 1; transform: none; transition: none; }
}

/* ===================== 顶部导航 ===================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 26px;
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.brand-accent { color: var(--accent-2); }

/* 导航置中：绝对定位在 topbar 正中间，不受左右两边宽度影响 */
.topnav {
  display: flex; gap: 26px;
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}

.topnav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 2px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: color .16s;
}

/* hover / 当前页：底线由中间向两边展开 */
.topnav-link::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; border-radius: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .2s ease;
}
.topnav-link:hover::after, .topnav-link.is-active::after { transform: scaleX(1); }

.topnav-link:hover { color: var(--ink); }
.topnav-link.is-active { color: var(--accent-2); }

.topbar-tools { margin-left: auto; display: flex; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: color .16s, border-color .16s, transform .16s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--accent); transform: translateY(-1px); }
.icon-sun { display: none; }
html[data-mode="light"] .icon-sun { display: block; }
html[data-mode="light"] .icon-moon { display: none; }

/* ===================== 搜索浮层 ===================== */

.search-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  display: grid; place-items: start center;
  padding-top: 12vh;
}
.search-panel {
  width: min(680px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search-input {
  width: 100%;
  padding: 18px 20px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.02rem;
  outline: none;
}
.search-results { max-height: 52vh; overflow-y: auto; }
.search-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}
.search-row:hover, .search-row.is-cursor { background: var(--surface-2); }
.search-row-kind {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
  flex: none;
}
.search-row-group { color: var(--ink-3); font-size: .8rem; margin-left: auto; flex: none; }
.search-hint { padding: 9px 20px; color: var(--ink-3); font-size: .76rem; font-family: var(--font-mono); }
.search-empty { padding: 20px; color: var(--ink-3); }

/* ===================== 通用版块 ===================== */

.wrap { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: 0 22px; }

.section-head {
  display: flex; align-items: flex-end; gap: 14px;
  margin: 52px 0 18px;
}
.section-num {
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .14em;
  color: var(--accent-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
}
.section-title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -0.015em; }
.section-sub { color: var(--ink-3); margin-left: auto; font-size: .88rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

/* 卡片 hover：边框流光 */
.card-link { display: block; color: inherit; transition: transform .18s, border-color .18s, box-shadow .18s; }
.card-link:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--glow); }
.card-link::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(42,127,255,.12) 50%, transparent 65%);
  transition: opacity .25s;
}
.card-link:hover::after { opacity: 1; }

/* ===================== 首页 ===================== */

.hero { position: relative; z-index: 1; padding: 54px 0 10px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }

.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.4vw, 3.3rem);
  line-height: 1.12; letter-spacing: -0.03em;
  margin: 18px 0 14px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-type { font-family: var(--font-mono); color: var(--ink-2); min-height: 1.6em; font-size: .96rem; }
.hero-type .cursor { color: var(--accent-2); animation: blink 1.05s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-lead { color: var(--ink-2); max-width: 46ch; margin: 14px 0 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 20px; border-radius: 11px;
  font-family: var(--font-display); font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: transform .16s, border-color .16s, box-shadow .16s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--glow); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { box-shadow: 0 10px 30px rgba(42,127,255,.35); }
.btn-ghost { background: transparent; }

.hero-stats { display: flex; gap: 26px; margin-top: 30px; }
.hero-stat-num { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.hero-stat-label { color: var(--ink-3); font-size: .8rem; letter-spacing: .04em; }

/* 解剖图 */
.anatomy { position: relative; }
.anatomy svg { width: 100%; height: auto; display: block; }
.anatomy-layer { cursor: pointer; }
.anatomy-layer .layer-box { fill: var(--surface); stroke: var(--line); transition: stroke .2s, fill .2s; }
.anatomy-layer .layer-label { fill: var(--ink-2); font-family: var(--font-display); font-size: 13px; font-weight: 600; }
.anatomy-layer .layer-tag { fill: var(--ink-3); font-family: 'JetBrains Mono', monospace; font-size: 9.5px; letter-spacing: .1em; }
.anatomy-layer:hover .layer-box, .anatomy-layer.is-active .layer-box { stroke: var(--accent); fill: var(--surface-2); }
.anatomy-layer:hover .layer-label, .anatomy-layer.is-active .layer-label { fill: var(--ink); }
.anatomy-layer.is-active .layer-box { filter: drop-shadow(0 0 10px rgba(42,127,255,.35)); }

.anatomy-info {
  margin-top: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 92px;
}
.anatomy-info-title { font-family: var(--font-display); font-weight: 600; margin-bottom: 4px; }
.anatomy-info-text { color: var(--ink-2); font-size: .88rem; }
.anatomy-info-links { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.anatomy-info-links a {
  font-family: var(--font-mono); font-size: .74rem;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--ink-2);
}
.anatomy-info-links a:hover { border-color: var(--accent); color: var(--ink); }

/* 三入口 */
.entries { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 10px; }
.entry { padding: 24px; position: relative; }
.entry-badge {
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3);
}
.entry h3 { font-family: var(--font-display); font-size: 1.42rem; margin: 10px 0 8px; letter-spacing: -0.02em; }
.entry p { color: var(--ink-2); font-size: .9rem; margin: 0 0 16px; }
.entry-meta { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-3); }
.entry-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.entry-learn .entry-bar { background: var(--accent-2); }
.entry-toolbox .entry-bar { background: var(--accent); }
.entry-fix .entry-bar { background: var(--amber); }
.entry-learn:hover { border-color: var(--accent-2); }
.entry-fix:hover { border-color: var(--amber); }

/* 继续上次 */
.resume { margin-top: 18px; padding: 16px 20px; display: flex; align-items: center; gap: 14px; }
.resume-label { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); }
.resume-title { font-family: var(--font-display); font-weight: 600; }
.resume-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.resume-progress { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-3); }

/* 工具墙预览 */
.tool-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.tool-chip {
  padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); display: block;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.tool-chip:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--glow); }
.tool-chip-name { font-family: var(--font-display); font-weight: 600; font-size: .96rem; }
.tool-chip-meta { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); margin-top: 3px; }
.tool-chip-cat { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); }

/* 分类色条（工具墙按分类上色） */
.cat-backup { --cat: #8B7BFF; }
.cat-builder { --cat: #2A7FFF; }
.cat-ecommerce { --cat: #FF8FB1; }
.cat-email { --cat: #46C8E8; }
.cat-hosting { --cat: #37E0C8; }
.cat-performance { --cat: #FFB84D; }
.cat-security { --cat: #FF6B81; }
.cat-seo { --cat: #9BE564; }
.cat-social-media { --cat: #C58BFF; }
.tool-chip[class*="cat-"] { border-left: 3px solid var(--cat, var(--accent)); }
.tool-chip[class*="cat-"] .tool-chip-cat { color: var(--cat, var(--accent-2)); }

/* ===================== Learn：路线图 ===================== */

.route { position: relative; padding: 10px 0 28px; }
.route-track { display: flex; gap: 0; overflow-x: auto; padding: 26px 2px 16px; scrollbar-width: thin; }
.route-stop { position: relative; flex: none; width: 196px; padding-right: 18px; }
.route-stop::before {
  content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 2px;
  background: var(--line);
}
.route-stop:first-child::before { left: 50%; }
.route-stop:last-child::before { right: 50%; }
.route-dot {
  position: relative; z-index: 1;
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--bg);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: .62rem; color: var(--ink-3);
  margin: 0 auto;
}
.route-stop.is-done .route-dot { border-color: var(--accent-2); color: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 16%, transparent); }
.route-stop.is-current .route-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.route-card {
  margin-top: 14px; padding: 12px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: inherit; display: block;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.route-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--glow); }
.route-sec { font-family: var(--font-mono); font-size: .74rem; color: var(--accent-2); letter-spacing: .08em; }
.route-label { font-family: var(--font-display); font-weight: 600; font-size: .92rem; margin-top: 3px; line-height: 1.35; }
.route-count { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-3); margin-top: 6px; }

/* Learn hub 的 Section 列表 */
.sec-list { display: grid; gap: 12px; }
.sec-row { display: flex; align-items: center; gap: 16px; padding: 16px 18px; }
.sec-num {
  font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700;
  color: var(--accent-2); width: 46px; flex: none;
}
.sec-main { min-width: 0; }
.sec-title { font-family: var(--font-display); font-weight: 600; }
.sec-eps { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); margin-top: 2px; }
.sec-progress { margin-left: auto; flex: none; width: 112px; }
.bar { height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line-soft); }
.bar > span { display: block; height: 100%; background: var(--accent-2); width: 0; transition: width .3s; }
.bar-text { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-3); margin-top: 5px; text-align: right; }

/* ===================== Toolbox ===================== */

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 18px 0 24px; }
.filter-input {
  flex: 1 1 220px; min-width: 180px;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: var(--font-body); outline: none;
}
.filter-input:focus { border-color: var(--accent); box-shadow: var(--glow); }
.filter-pill {
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-family: var(--font-mono); font-size: .76rem; letter-spacing: .04em;
  transition: color .15s, border-color .15s;
}
.filter-pill:hover { color: var(--ink); }
.filter-pill.is-on { color: var(--ink); border-color: var(--accent); box-shadow: var(--glow); }

.cat-block { margin-bottom: 34px; }
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--cat, var(--accent)); flex: none; }
.cat-name { font-family: var(--font-display); font-size: 1.18rem; font-weight: 700; }
.cat-count { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); }
.empty-note { color: var(--ink-3); font-size: .9rem; }

/* ===================== Fix ===================== */

.fix-hero { padding: 44px 0 6px; }
.fix-hero h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 3.6vw, 2.7rem); letter-spacing: -0.03em; margin: 12px 0 10px; }
.fix-hero p { color: var(--ink-2); max-width: 62ch; }

.fix-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.fix-card { padding: 22px; border-left: 3px solid var(--amber); }
.fix-card h3 { font-family: var(--font-display); font-size: 1.22rem; margin: 6px 0 8px; }
.fix-card p { color: var(--ink-2); font-size: .89rem; margin: 0 0 14px; }

.steps { position: relative; margin-top: 26px; padding-left: 26px; }
.steps::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.step { position: relative; margin-bottom: 26px; }
.step::before {
  content: ""; position: absolute; left: -25px; top: 9px;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--amber); background: var(--bg);
}
.step-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; }
.step-note { color: var(--ink-2); font-size: .89rem; margin: 4px 0 12px; }
.step-items { display: grid; gap: 8px; }
.step-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .15s, border-color .15s;
}
.step-item:hover { transform: translateX(3px); border-color: var(--amber); }
.step-item-seq { font-family: var(--font-mono); font-size: .74rem; color: var(--amber); flex: none; }
.step-item-group { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-3); margin-left: auto; flex: none; }
.step-item.is-done { opacity: .62; }
.step-item.is-done .step-item-seq::after { content: " ✓"; color: var(--accent-2); }

/* ===================== 笔记页 ===================== */

.read-progress { position: fixed; top: var(--header-h); left: 0; right: 0; height: 2px; z-index: 39; background: transparent; }
.read-progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.note-layout {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto; padding: 26px 22px 60px;
  display: grid; grid-template-columns: 252px minmax(0, 1fr) 216px; gap: 26px;
  align-items: start;
}

/* 正文画布：比页面底色浅一阶的一块板，把正文跟蓝图背景分开 */
.note-main {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
}

.note-side-inner, .note-toc-inner { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; padding-right: 6px; }
.note-side-inner::-webkit-scrollbar, .note-toc-inner::-webkit-scrollbar { width: 6px; }
.note-side-inner::-webkit-scrollbar-thumb, .note-toc-inner::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }

.side-badge {
  font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700;
  color: var(--accent-2); letter-spacing: -0.02em; margin-bottom: 4px;
}
.side-group-title { font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; margin-bottom: 12px; line-height: 1.3; }
.side-list { display: grid; gap: 2px; margin-bottom: 20px; }
.side-item {
  display: flex; align-items: baseline; gap: 9px;
  padding: 7px 10px; border-radius: 8px;
  color: var(--ink-2); font-size: .875rem; line-height: 1.45;
  border: 1px solid transparent;
}
.side-item > span:last-child {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.side-item:hover { background: var(--surface); color: var(--ink); }
.side-item:hover > span:last-child, .side-item.is-active > span:last-child { -webkit-line-clamp: 4; }
.side-item.is-active { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--glow); }
.side-item-seq { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); flex: none; }
.side-item.is-done .side-item-seq { color: var(--accent-2); }
.side-item.is-done .side-item-seq::before { content: "✓ "; }
.side-sub { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 18px 0 8px; }
.side-nav-sec { display: grid; gap: 4px; }
.side-nav-sec a { color: var(--ink-2); font-size: .84rem; padding: 5px 10px; border-radius: 8px; }
.side-nav-sec a:hover { background: var(--surface); color: var(--ink); }

.crumbs { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--accent); }
.crumb-sep { opacity: .5; }
.crumb-current { color: var(--accent-2); }

.note-h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.3rem); line-height: 1.2; letter-spacing: -0.028em;
  margin: 12px 0 14px;
}

.note-subtitle {
  font-family: var(--font-mono); font-size: .82rem; color: var(--ink-3);
  margin: -6px 0 14px; letter-spacing: .01em;
}

.note-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.note-readtime { font-family: var(--font-mono); font-size: .76rem; color: var(--ink-3); }
.chip {
  font-family: var(--font-mono); font-size: .72rem;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--ink-2);
}
.done-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-family: var(--font-display); font-size: .84rem;
  transition: color .15s, border-color .15s;
}
.done-btn:hover { color: var(--ink); border-color: var(--accent-2); }
.done-box { width: 13px; height: 13px; border-radius: 4px; border: 1.5px solid currentColor; }
.done-btn.is-done { color: var(--accent-2); border-color: var(--accent-2); }
.done-btn.is-done .done-box { background: var(--accent-2); border-color: var(--accent-2); }

/* ---------- 笔记正文 ---------- */

.note-body { font-size: 1.015rem; }
.note-body h2 {
  font-family: var(--font-display); font-size: 1.42rem; letter-spacing: -0.02em;
  margin: 42px 0 14px; padding-top: 10px; scroll-margin-top: calc(var(--header-h) + 30px);
  border-top: 1px solid var(--line-soft);
}
.note-body h2:first-child { border-top: 0; margin-top: 8px; padding-top: 0; }
.note-body h3 {
  font-family: var(--font-display); font-size: 1.12rem; margin: 30px 0 10px; scroll-margin-top: calc(var(--header-h) + 30px);
  color: var(--ink);
}
.note-body h3::before { content: "▸ "; color: var(--accent-2); }
.note-body p { margin: 14px 0; color: var(--ink); }
.note-body strong { color: var(--ink); font-weight: 600; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 22%, transparent) 62%); }
.note-body ul, .note-body ol { padding-left: 1.35em; margin: 14px 0; }
.note-body li { margin: 7px 0; }
.note-body li::marker { color: var(--accent-2); }
.note-body a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.note-body a:hover { border-bottom-color: var(--accent); }
.note-body img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.note-body hr { border: 0; border-top: 1px dashed var(--line); margin: 30px 0; }

.note-body code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 1px 5px; color: var(--accent-2);
}
.note-body pre {
  position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 16px 16px 14px;
  overflow-x: auto; margin: 18px 0;
}
.note-body pre code {
  background: none; border: 0; padding: 0; color: var(--ink);
  font-size: .86rem; line-height: 1.7;
}
.note-body pre::before {
  content: attr(data-lang);
  position: absolute; top: 0; right: 0;
  font-family: var(--font-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2);
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  border-radius: 0 var(--radius-sm) 0 6px; padding: 3px 9px;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px; opacity: 0;
  font-family: var(--font-mono); font-size: .68rem;
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px;
  background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  transition: opacity .15s, color .15s;
}
.note-body pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--ink); border-color: var(--accent); }
.copy-btn.is-copied { color: var(--accent-2); border-color: var(--accent-2); }
.note-body pre.mermaid { background: var(--surface); text-align: center; }
.note-body pre.mermaid::before { content: none; }

.note-body table {
  width: 100%; border-collapse: collapse; margin: 20px 0;
  font-size: .92rem; display: block; overflow-x: auto;
}
.note-body table thead th {
  background: var(--surface-2); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; text-align: left;
  border-bottom: 1px solid var(--line);
}
.note-body table th, .note-body table td {
  border: 1px solid var(--line-soft); padding: 9px 12px; vertical-align: top;
}
.note-body table tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.note-body blockquote {
  margin: 18px 0; padding: 14px 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
}
.note-body blockquote p { margin: 0; }

.callout {
  margin: 18px 0; padding: 14px 17px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  border-left: 3px solid var(--accent-2);
}
.callout-tip { border-left-color: var(--accent-2); }
.callout-warn { border-left-color: var(--danger); }
.callout-note { border-left-color: var(--amber); }
.callout p { margin: 0; }

/* Markdown 解析器产生的章节分隔波浪线（.sec-divider.v-wave） */
.note-body .sec-divider { display: flex; align-items: center; justify-content: center; margin: 34px 0 26px; }
.note-body .sec-divider.v-wave { width: 100%; }
.note-body .sec-divider.v-wave svg { width: 100%; height: 14px; display: block; }
.note-body .sec-divider.v-wave path {
  fill: none; stroke: var(--accent-2); stroke-width: 1.4; stroke-linecap: round; opacity: .42;
}

.example-card {
  margin: 14px 0; padding: 13px 16px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.example-card .jp { color: var(--ink); }
.example-card .cn { color: var(--ink-3); font-size: .9rem; }

/* ---------- 右栏 ToC ---------- */

.toc-title { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.toc-title-sub { margin-top: 22px; }
.toc-link {
  display: block; padding: 5px 10px; border-left: 2px solid var(--line-soft);
  color: var(--ink-3); font-size: .83rem; line-height: 1.45;
}
.toc-link:hover { color: var(--ink); border-left-color: var(--accent); }
.toc-link.is-current { color: var(--accent-2); border-left-color: var(--accent-2); }
.toc-link.is-sub { padding-left: 20px; font-size: .78rem; }
.toc-scene { display: block; padding: 6px 10px; color: var(--ink-2); font-size: .82rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.toc-scene:hover { border-color: var(--amber); color: var(--ink); }

/* ---------- 上下篇 ---------- */

.note-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.note-nav-link {
  padding: 15px 17px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: grid; gap: 4px; transition: transform .16s, border-color .16s;
}
.note-nav-link:hover { transform: translateY(-2px); border-color: var(--accent); }
.note-nav-link.is-next { text-align: right; }
.note-nav-dir { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); }
.note-nav-title { font-family: var(--font-display); font-weight: 600; font-size: .94rem; }
.note-nav-link.is-disabled { opacity: .45; }

/* ===================== 测验（沿用 quiz.js 的 class 名） ===================== */

.quiz-section { margin-top: 52px; }
.quiz-heading { font-family: var(--font-display); font-size: 1.3rem; margin: 0 0 14px; letter-spacing: -0.02em; }
.quiz-box {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 12px; overflow: hidden;
}
.quiz-box > summary {
  cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 12px;
  list-style: none; background: var(--surface-2);
}
.quiz-box > summary::-webkit-details-marker { display: none; }
.quiz-box[open] > summary { border-bottom: 1px solid var(--line); }
.quiz-box-label { font-family: var(--font-display); font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.quiz-box-count { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-3); }
.quiz-box-score { margin-left: auto; font-family: var(--font-mono); font-size: .78rem; color: var(--accent-2); border: 1px solid var(--accent-2); border-radius: 999px; padding: 2px 10px; }
.quiz-box-body { padding: 18px; }

.quiz-question { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.quiz-question:last-of-type { border-bottom: 0; }
.quiz-question-text { font-weight: 600; margin-bottom: 10px; }
.quiz-options { display: grid; gap: 7px; }
.quiz-options label {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.quiz-options label:hover { border-color: var(--accent); }
.quiz-options input { margin-top: 5px; accent-color: var(--accent); }
.quiz-options label.is-correct { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, var(--bg)); }
.quiz-options label.is-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--bg)); }
.quiz-question input[type="text"] {
  width: 100%; padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font-family: var(--font-mono); outline: none;
}
.quiz-question input[type="text"]:focus { border-color: var(--accent); }
.quiz-explanation {
  margin-top: 9px; padding: 10px 13px; border-radius: 9px;
  background: var(--surface-2); color: var(--ink-2); font-size: .88rem;
  border-left: 3px solid var(--accent-2);
}
.quiz-correct-answer { color: var(--accent-2); font-family: var(--font-mono); font-size: .84rem; }
.quiz-actions { display: flex; gap: 10px; margin-top: 16px; }
.quiz-submit, .quiz-retry {
  padding: 9px 18px; border-radius: 10px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: .88rem;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
}
.quiz-retry { background: transparent; color: var(--ink-2); border-color: var(--line); }
.quiz-submit:hover { box-shadow: 0 8px 22px rgba(42,127,255,.3); }
.quiz-retry:hover { color: var(--ink); border-color: var(--accent); }
.quiz-page-nav { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.quiz-page-btn {
  min-width: 30px; height: 30px; padding: 0 8px; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); font-family: var(--font-mono); font-size: .78rem;
}
.quiz-page-btn.is-on { color: var(--ink); border-color: var(--accent); }
.quiz-page-btn:disabled { opacity: .4; cursor: default; }
.quiz-reorder-pool { display: flex; gap: 7px; flex-wrap: wrap; }
.quiz-reorder-chip {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  font-family: var(--font-mono); font-size: .82rem;
}
.quiz-reorder-chip.is-picked { border-color: var(--accent-2); color: var(--accent-2); }
.quiz-reorder-hint { color: var(--ink-3); font-size: .78rem; margin-top: 7px; font-family: var(--font-mono); }

/* ===================== footer ===================== */

.footer { position: relative; z-index: 1; border-top: 1px solid var(--line-soft); margin-top: 40px; }
.footer-inner {
  max-width: var(--max); margin: 0 auto; padding: 26px 22px 38px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.footer-brand { font-family: var(--font-display); font-weight: 700; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-3); font-size: .86rem; }
.footer-links a:hover { color: var(--ink); }
.footer-meta { margin-left: auto; font-family: var(--font-mono); font-size: .74rem; color: var(--ink-3); }

/* ===================== 响应式 ===================== */

@media (max-width: 1140px) {
  .note-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .note-toc { display: none; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .entries { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .note-layout { grid-template-columns: 1fr; padding-top: 18px; }
  .note-side { order: 2; }
  .note-side-inner { position: static; max-height: none; }
  .note-main { order: 1; }
  .note-nav { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
  .route-stop { width: 168px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
