/* 流星雨模块框架 · 文档站样式（浅色默认 / 深色跟随切换） */
:root {
  --accent: #2f6fed;
  --accent-hov: #2a63d4;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --side: #fbfcfe;
  --line: #e6e9ef;
  --txt: #24292f;
  --txt2: #6a7480;
  --code-bg: #f4f6fa;
  --code-txt: #24292f;
  --shadow: 0 8px 30px rgba(20, 30, 50, .10);
}
html.dark {
  --accent: #6ea1ff;
  --accent-hov: #89b2ff;
  --bg: #16191e;
  --bg-soft: #1b1f26;
  --side: #13161b;
  --line: #2a3038;
  --txt: #dbe2ea;
  --txt2: #97a1ad;
  --code-bg: #1d2229;
  --code-txt: #d8e0e8;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  font: 15px/1.75 "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--txt); background: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd {
  font: 11px/1 Consolas, monospace; padding: 3px 5px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--txt2);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: 56px; z-index: 30;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--txt); font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 20px; height: 20px; border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #7db0ff); flex: none; }
.brand-sub { color: var(--txt2); font-weight: 400; font-size: 13px; margin-left: 2px; }
.search-open {
  margin-left: auto; width: 240px; height: 34px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--bg-soft);
  color: var(--txt2); font-size: 13px; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-open:hover { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.icon-btn {
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg-soft); color: var(--txt2); font-size: 15px; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 布局 ---------- */
.layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 0 36px; max-width: 1240px; margin: 0 auto; padding: 76px 24px 60px;
}
.sidebar { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 100px);
  overflow-y: auto; padding-bottom: 20px; }
.nav-group { margin-bottom: 22px; }
.nav-label { font-size: 12px; font-weight: 600; color: var(--txt2);
  letter-spacing: .05em; margin: 0 0 6px 10px; text-transform: uppercase; }
.nav-item {
  display: block; padding: 5px 12px; border-radius: 7px; margin: 1px 0;
  color: var(--txt2); font-size: 13.5px;
  transition: background-color .13s ease, color .13s ease;
}
.nav-item:hover { background: var(--bg-soft); color: var(--txt); text-decoration: none; }
.nav-item.active { background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); font-weight: 600; }

/* ---------- 正文 ---------- */
.content { min-width: 0; padding-bottom: 40px; }
.content h1 { font-size: 30px; line-height: 1.3; margin: 6px 0 20px; letter-spacing: -.01em; }
.content h2 {
  font-size: 21px; margin: 38px 0 14px; padding-top: 18px;
  border-top: 1px solid var(--line); letter-spacing: -.01em;
}
.content h3 { font-size: 16.5px; margin: 26px 0 10px; }
.content h4 { font-size: 14.5px; margin: 20px 0 8px; color: var(--txt2); }
.content p { margin: 10px 0; text-wrap: pretty; }
.content ul.md-list, .content ol.md-list { margin: 10px 0; padding-left: 26px; }
.content li { margin: 4px 0; }
.content li label.task { display: flex; gap: 8px; align-items: baseline; cursor: default; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.content blockquote {
  margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--accent);
  border-radius: 0 9px 9px 0; background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--txt2); font-size: 14px;
}
.content blockquote p { margin: 4px 0; }
.ic {
  font: 87%/1.5 Consolas, "JetBrains Mono", monospace; padding: 2px 6px;
  border-radius: 5px; background: var(--code-bg); color: var(--code-txt); border: 1px solid var(--line);
}
.content code { font-family: Consolas, "JetBrains Mono", monospace; }

/* 代码块 */
figure.code {
  margin: 16px 0; border: 1px solid var(--line); border-radius: 11px;
  overflow: hidden; background: var(--code-bg);
}
figure.code figcaption {
  padding: 6px 14px; font: 11px/1.4 Consolas, monospace; letter-spacing: .06em;
  color: var(--txt2); border-bottom: 1px solid var(--line);
  text-transform: uppercase; background: color-mix(in srgb, var(--line) 35%, transparent);
}
figure.code pre {
  padding: 13px 16px; overflow-x: auto; font-size: 13px; line-height: 1.65;
  color: var(--code-txt);
}

/* 表格 */
.tbl { margin: 14px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.content table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.content th, .content td { padding: 8px 13px; text-align: left; border-bottom: 1px solid var(--line); }
.content thead th { background: var(--bg-soft); font-weight: 600; font-size: 12.5px; color: var(--txt2); }
.content tbody tr:last-child td { border-bottom: 0; }
.content tbody tr { transition: background-color .12s ease; }
.content tbody tr:hover { background: var(--bg-soft); }

/* ---------- 右侧目录 ---------- */
.toc { position: sticky; top: 76px; align-self: start; font-size: 12.5px; }
.toc-title { font-weight: 600; color: var(--txt2); margin-bottom: 8px; padding-left: 12px; }
.toc a { display: block; padding: 3px 12px; color: var(--txt2); border-left: 2px solid transparent;
  transition: color .12s ease, border-color .12s ease; line-height: 1.5; }
.toc a:hover { color: var(--txt); text-decoration: none; }
.toc a.toc-3 { padding-left: 26px; }
.toc a.cur { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

/* ---------- 搜索弹层 ---------- */
.search-mask {
  position: fixed; inset: 0; z-index: 50; background: rgba(12, 16, 22, .45);
  display: flex; justify-content: center; padding-top: 12vh;
  animation: fadeIn .14s ease;
}
.search-mask.hidden { display: none; }
.search-panel {
  width: min(620px, 90vw); max-height: 64vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; animation: popIn .16s cubic-bezier(.2, .7, .3, 1);
}
#search-input {
  height: 50px; border: 0; border-bottom: 1px solid var(--line); outline: 0;
  padding: 0 18px; font-size: 15px; background: transparent; color: var(--txt);
}
.search-results { overflow-y: auto; padding: 8px; flex: 1; }
.search-hit { display: block; padding: 9px 12px; border-radius: 9px; color: var(--txt); }
.search-hit:hover, .search-hit.sel { background: var(--bg-soft); text-decoration: none; }
.search-hit .hit-title { font-weight: 600; font-size: 13.5px; }
.search-hit .hit-path { color: var(--txt2); font-size: 11.5px; margin-left: 8px; }
.search-hit .hit-text { color: var(--txt2); font-size: 12.5px; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit mark { background: color-mix(in srgb, var(--accent) 25%, transparent);
  color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { text-align: center; color: var(--txt2); padding: 30px 0; font-size: 13px; }
.search-hint { padding: 8px 16px; border-top: 1px solid var(--line);
  color: var(--txt2); font-size: 11.5px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.97); } }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) { .toc { display: none; } .layout { grid-template-columns: 250px minmax(0, 1fr); } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-bottom: 1px solid var(--line); padding: 6px 0 16px; }
  .search-open { width: auto; }
  .search-open kbd { display: none; }
}
