/* ==========================================================================
   ILBB 文档站 · 样式表
   --------------------------------------------------------------------------
   一、设计令牌与重置
   二、页头 / 搜索
   三、三栏布局
   四、左侧导航
   五、正文（Markdown 渲染产物）
   六、右侧本页目录
   七、翻页与页脚
   八、访问统计后台
   九、深浅色
   十、响应式
   十一、主页与动效（首页专用，文档页不受影响）
   ========================================================================== */

/* ===== 一、设计令牌与重置 ============================================== */
:root {
  /* 与 ILBB 主站同一套：暖白纸面 + 陶土色 */
  --bg-0: #ffffff;
  --bg-1: #faf9f5;
  --bg-2: #f5f4ef;
  --bg-3: #ede9de;
  --border: #e3e0d4;
  --border-strong: #d3cdbb;
  --border-weak: #eceae0;

  --ink: #3d3929;
  --ink-2: #6e6d68;
  --ink-3: #9b988c;
  --ink-4: #c2c0b6;

  --brand: #c96442;
  --brand-strong: #b0562f;
  --brand-deep: #934828;
  --brand-ink: #8a4a26;
  --brand-soft: #f4e0d5;
  --brand-softer: #fbf2ed;
  --brand-border: #ebc6b6;

  --ok: #647649;
  --ok-soft: #e7ecdd;
  --ok-text: #4f5d3a;
  --amber: #b07a1e;
  --amber-soft: #f8eed8;
  --danger: #a8432f;
  --danger-soft: #f7e2dd;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px 0 rgba(40, 30, 16, .05), 0 1px 1px 0 rgba(40, 30, 16, .03);
  --shadow: 0 6px 18px -6px rgba(40, 30, 16, .10);
  --shadow-lg: 0 18px 40px -12px rgba(40, 30, 16, .16);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace;

  --glass: rgba(255, 254, 251, .78);
  --blur: blur(16px) saturate(150%);

  /* 正文与代码 */
  --code-bg: #f7f5ef;
  --code-border: #e6e2d6;
  --mark-bg: #f6e3b8;

  /* 语法着色（浅色） */
  --t-cm: #9b988c;
  --t-st: #6f7d46;
  --t-kw: #b0562f;
  --t-vr: #934828;
  --t-nm: #8a6a2e;
  --t-op: #6e6d68;
  --t-fn: #5b6b8a;
  --t-ky: #8a4a26;
  --t-de: #8a6a2e;
  --t-sec: #b0562f;
  --t-dr: #5b6b8a;

  --toolbar-h: 57px;
  --sidebar-w: 256px;
  --rail-w: 216px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-strong); text-decoration: none; }
a:hover { color: var(--brand-deep); text-decoration: underline; text-underline-offset: 2px; }

::selection { background: var(--brand-soft); color: var(--brand-deep); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* 环境层：暖色光斑 + 点阵网格，给玻璃条一点可透出的颜色 */
.bg-wall {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 620px at 10% 4%, rgba(201, 100, 66, .14), transparent 62%),
    radial-gradient(720px 520px at 92% 10%, rgba(176, 122, 30, .11), transparent 64%),
    radial-gradient(940px 700px at 50% 112%, rgba(100, 118, 73, .10), transparent 62%),
    linear-gradient(180deg, #faf9f5 0%, #f4f2ea 100%);
}
.bg-wall::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(61, 57, 41, .08) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
}

.app { position: relative; z-index: 1; min-height: 100vh; }

/* ===== 二、页头 / 搜索 ================================================= */
.toolbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 20px;
  min-height: var(--toolbar-h);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border-weak);
}
.toolbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }

.logo {
  font-size: 18px; font-weight: 700; letter-spacing: -.3px;
  color: var(--ink); white-space: nowrap;
}
.logo:hover { color: var(--ink); text-decoration: none; }
.logo::first-letter { color: var(--brand); }
.logo-tail { font-weight: 600; color: var(--ink-2); margin-left: 3px; }

.badge {
  font-size: 11px; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--bg-2); color: var(--ink-2);
  border: 1px solid var(--border); font-weight: 600; letter-spacing: .2px;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); border-color: var(--border); text-decoration: none; }
.nav-toggle { display: none; }

/* 中英互跳：只在 docs/zh 与 docs/en 有对应文件时出现 */
.lang-link {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px;
  flex: none; font-size: 12.5px; font-weight: 650; letter-spacing: .2px;
  color: var(--ink-2); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  transition: background .15s, color .15s, border-color .15s;
}
.lang-link:hover {
  color: var(--brand-deep); background: var(--brand-softer);
  border-color: var(--brand-border); text-decoration: none;
}

/* 搜索 */
.search { position: relative; display: flex; align-items: center; }
.search-ico {
  position: absolute; left: 10px; color: var(--ink-3); pointer-events: none;
}
.search-input {
  width: 246px; height: 34px;
  padding: 0 62px 0 32px;
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  transition: border-color .15s, box-shadow .15s, width .18s;
  -webkit-appearance: none; appearance: none;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-input:focus {
  outline: none; border-color: var(--brand-border);
  box-shadow: 0 0 0 3px var(--brand-softer);
}
.search-kbd {
  position: absolute; right: 8px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; pointer-events: none;
}

.search-pop {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: min(66vh, 560px);
  display: flex; flex-direction: column;
  background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-pop[hidden] { display: none; }
.search-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border-weak);
  background: var(--bg-1);
}
.search-title { font-size: 12.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .3px; }
.search-count { font-size: 12px; color: var(--ink-3); }
.search-list { overflow-y: auto; padding: 6px; }

.hit {
  display: block; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid transparent; color: var(--ink);
}
.hit:hover, .hit.active {
  background: var(--brand-softer); border-color: var(--brand-border);
  text-decoration: none; color: var(--ink);
}
.hit-title { display: block; font-size: 14px; font-weight: 650; color: var(--brand-ink); }
.hit-path {
  display: block; font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); margin-top: 1px;
}
.hit-snippet {
  display: block; font-size: 12.5px; color: var(--ink-2);
  margin-top: 5px; line-height: 1.6;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.hit mark, .search-list mark {
  background: var(--mark-bg); color: var(--brand-deep);
  padding: 0 2px; border-radius: 3px;
}
.search-empty, .search-tip {
  padding: 20px 14px; text-align: center;
  font-size: 13px; color: var(--ink-3);
}

/* ===== 三、三栏布局 ==================================================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--rail-w);
  gap: 34px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 26px 0;
  align-items: start;
}
.main { min-width: 0; padding-bottom: 34px; }

/* ===== 四、左侧导航 ==================================================== */
.sidebar {
  position: sticky; top: calc(var(--toolbar-h) + 26px);
  max-height: calc(100vh - var(--toolbar-h) - 46px);
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.nav-scroll { overflow-y: auto; padding: 12px 10px 6px; flex: 1; }

.nav-close {
  display: none;
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border: 0; border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--ink-2);
  font-size: 17px; line-height: 1; cursor: pointer;
}

.nav-group { margin-bottom: 12px; }
.nav-label {
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--ink-3);
  padding: 6px 10px 4px;
}
.nav-list { list-style: none; }
.nav-link {
  display: block; padding: 5px 10px;
  font-size: 13.5px; color: var(--ink-2); line-height: 1.5;
  border-left: 2px solid transparent; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background .12s, color .12s, border-color .12s;
}
.nav-link:hover { background: var(--bg-2); color: var(--ink); text-decoration: none; }
.nav-link.active {
  background: var(--brand-softer); color: var(--brand-ink);
  border-left-color: var(--brand); font-weight: 650;
}

.nav-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 14px;
  border-top: 1px solid var(--border-weak);
  background: var(--bg-1);
  font-size: 11.5px; color: var(--ink-3);
}
.nav-foot a { color: var(--ink-2); }

.scrim {
  position: fixed; inset: 0; z-index: 38;
  background: rgba(30, 24, 16, .34);
  backdrop-filter: blur(1px);
}
.scrim[hidden] { display: none; }

/* ===== 五、正文（Markdown 渲染产物） ================================== */
.doc {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 40px 46px 46px;
  overflow-wrap: break-word;
}

.doc > :first-child { margin-top: 0; }

.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6 {
  position: relative;
  font-weight: 700; line-height: 1.35; color: var(--ink);
  scroll-margin-top: calc(var(--toolbar-h) + 18px);
}
.doc h1 { font-size: 28px; letter-spacing: -.5px; margin: 0 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.doc h2 { font-size: 21px; letter-spacing: -.2px; margin: 38px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border-weak); }
.doc h3 { font-size: 17px; margin: 28px 0 10px; }
.doc h4 { font-size: 15.5px; margin: 22px 0 8px; color: var(--ink-2); }
.doc h5, .doc h6 { font-size: 14.5px; margin: 18px 0 6px; color: var(--ink-2); }

/* 标题右侧的 # 锚点 */
.ha {
  position: absolute; left: -0.62em;
  color: var(--ink-4); font-weight: 500;
  opacity: 0; transition: opacity .15s;
}
.doc h1 .ha, .doc h2 .ha, .doc h3 .ha,
.doc h4 .ha, .doc h5 .ha, .doc h6 .ha { text-decoration: none; }
.doc h1:hover .ha, .doc h2:hover .ha, .doc h3:hover .ha,
.doc h4:hover .ha, .doc h5:hover .ha, .doc h6:hover .ha { opacity: 1; }
.ha:hover { color: var(--brand); }

/* 宽松别名锚点（中文标题） */
.anchor-alias {
  display: block; height: 0; overflow: hidden;
  scroll-margin-top: calc(var(--toolbar-h) + 18px);
}

.doc p { margin: 13px 0; }
.doc strong { font-weight: 700; color: var(--ink); }
.doc em { font-style: italic; }
.doc del { color: var(--ink-3); }

.doc a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.doc a.ext::after {
  content: "↗"; font-size: .78em; margin-left: 2px;
  color: var(--ink-3); text-decoration: none; display: inline-block;
}

.doc ul, .doc ol { margin: 13px 0; padding-left: 26px; }
.doc li { margin: 5px 0; }
.doc li > ul, .doc li > ol { margin: 5px 0; }
.doc ul { list-style: disc; }
.doc ul ul { list-style: circle; }
.doc ol { list-style: decimal; }
.doc li::marker { color: var(--ink-3); }

.doc li.task { list-style: none; margin-left: -22px; display: flex; align-items: flex-start; gap: 8px; }
.doc li.task input[type="checkbox"] {
  flex: none; width: 14px; height: 14px; margin-top: 6px;
  accent-color: var(--brand); cursor: default;
}
.doc li.task input:checked + span { color: var(--ink-3); text-decoration: line-through; }

.doc blockquote {
  margin: 15px 0; padding: 4px 18px;
  border-left: 3px solid var(--brand-border);
  background: var(--brand-softer);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-2);
}
.doc blockquote > :first-child { margin-top: 8px; }
.doc blockquote > :last-child { margin-bottom: 8px; }

.doc hr { margin: 30px 0; border: 0; border-top: 1px solid var(--border); }

.doc img {
  max-width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-1); display: block; margin: 16px 0;
}

/* 行内代码 */
.doc code {
  font-family: var(--mono); font-size: .875em;
  background: var(--code-bg); color: var(--brand-ink);
  border: 1px solid var(--code-border); border-radius: 5px;
  padding: 1.5px 5px; word-break: break-word;
}

/* 提示块 */
.alert {
  margin: 16px 0; padding: 13px 16px;
  border: 1px solid var(--border); border-left: 3px solid var(--ink-3);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.alert-title { font-weight: 700; font-size: 13.5px; margin: 0 0 4px; }
.alert > :last-child { margin-bottom: 0; }
.alert-note { border-left-color: #7d8ba8; background: #f2f4f8; }
.alert-note .alert-title { color: #4c5b76; }
.alert-tip { border-left-color: var(--ok); background: var(--ok-soft); }
.alert-tip .alert-title { color: var(--ok-text); }
.alert-important { border-left-color: #8a6bb0; background: #f4f0f9; }
.alert-important .alert-title { color: #63478a; }
.alert-warning { border-left-color: var(--amber); background: var(--amber-soft); }
.alert-warning .alert-title { color: #8a5f13; }
.alert-caution { border-left-color: var(--danger); background: var(--danger-soft); }
.alert-caution .alert-title { color: var(--danger); }

/* 表格 */
.tw {
  margin: 16px 0; overflow-x: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.tw table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tw th, .tw td {
  padding: 9px 14px; text-align: left;
  border-bottom: 1px solid var(--border-weak);
  vertical-align: top;
}
.tw thead th {
  background: var(--bg-2); font-weight: 700; color: var(--ink);
  white-space: nowrap; border-bottom: 1px solid var(--border);
}
.tw tbody tr:last-child td { border-bottom: 0; }
.tw tbody tr:hover { background: var(--bg-1); }

/* 代码块 */
.cb {
  position: relative; margin: 16px 0;
  border: 1px solid var(--code-border); border-radius: var(--radius);
  background: var(--code-bg); overflow: hidden;
}
.cb-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 6px 10px 6px 14px;
  border-bottom: 1px solid var(--code-border);
  background: var(--bg-2);
}
.cb-lang {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--ink-3); letter-spacing: .4px;
}
.cb-copy {
  font-family: inherit; font-size: 11.5px;
  padding: 3px 10px; cursor: pointer;
  color: var(--ink-2); background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  transition: color .12s, background .12s, border-color .12s;
}
.cb-copy:hover { color: var(--brand-strong); border-color: var(--brand-border); background: var(--brand-softer); }
.cb-copy.done { color: var(--ok-text); border-color: var(--ok); background: var(--ok-soft); }
.cb pre { margin: 0; overflow-x: auto; }
.cb pre code {
  display: block; padding: 14px 16px;
  font-size: 13px; line-height: 1.65;
  background: none; border: 0; border-radius: 0;
  color: inherit; white-space: pre; word-break: normal;
  tab-size: 4;
}

/* 语法着色（类名由 mdrender.py 产出） */
.t-cm { color: var(--t-cm); font-style: italic; }
.t-st { color: var(--t-st); }
.t-kw { color: var(--t-kw); font-weight: 600; }
.t-vr { color: var(--t-vr); }
.t-nm { color: var(--t-nm); }
.t-op { color: var(--t-op); }
.t-fn { color: var(--t-fn); }
.t-ky { color: var(--t-ky); font-weight: 600; }
.t-de { color: var(--t-de); }
.t-sec { color: var(--t-sec); font-weight: 700; }
.t-dr { color: var(--t-dr); font-weight: 600; }

/* ===== 六、右侧本页目录 ================================================ */
.rail { position: sticky; top: calc(var(--toolbar-h) + 26px); }
.rail-sticky { max-height: calc(100vh - var(--toolbar-h) - 46px); overflow-y: auto; padding-right: 4px; }
.rail-title {
  font-size: 11px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; color: var(--ink-3);
  padding: 0 0 8px 11px;
}
.rail-empty { font-size: 12.5px; color: var(--ink-4); padding-left: 11px; }

.toc { display: flex; flex-direction: column; border-left: 1px solid var(--border); }
.toc-link {
  display: block; padding: 4px 10px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink-2);
  border-left: 2px solid transparent; margin-left: -1px;
  transition: color .12s, border-color .12s;
}
.toc-link:hover { color: var(--ink); text-decoration: none; }
.toc-link.lv2 { padding-left: 10px; }
.toc-link.lv3 { padding-left: 22px; font-size: 12px; }
.toc-link.lv4 { padding-left: 34px; font-size: 12px; color: var(--ink-3); }
.toc-link.active {
  color: var(--brand-ink); border-left-color: var(--brand);
  font-weight: 650;
}

/* ===== 七、翻页与页脚 ================================================== */
.pager {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-top: 22px;
}
.pg {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(255, 255, 255, .7);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pg:hover { border-color: var(--brand-border); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.pg span { font-size: 11.5px; color: var(--ink-3); }
.pg b { font-size: 14px; font-weight: 650; color: var(--brand-ink); }
.pg-next { text-align: right; grid-column: 2; }

.doc-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 26px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--ink-3);
}
.doc-foot code { font-family: var(--mono); font-size: 11.5px; }
.to-top { color: var(--ink-2); }

/* ===== 八、访问统计后台 ================================================ */
.admin-body { background: var(--bg-1); }
.admin-wrap {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto; padding: 30px 22px 60px;
}
.admin-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.admin-head h1 { font-size: 25px; letter-spacing: -.4px; }
.admin-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; font-size: 13px; font-family: inherit;
  color: var(--ink); background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--brand-border); background: var(--brand-softer); color: var(--brand-ink); text-decoration: none; }
.btn-warn { color: var(--danger); border-color: #e6c6bd; background: #fdf3f0; }
.btn-warn:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-ghost { background: transparent; cursor: pointer; }
.btn-ghost input[type="checkbox"] { accent-color: var(--brand); margin: 0; }

.admin-hint {
  margin-bottom: 16px; padding: 10px 15px;
  background: var(--ok-soft); color: var(--ok-text);
  border: 1px solid var(--ok); border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.admin-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.card {
  padding: 15px 18px; background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card .k { font-size: 12px; color: var(--ink-3); letter-spacing: .3px; }
.card .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; color: var(--brand-ink); margin-top: 3px; }

.admin-panel {
  padding: 18px 20px 20px; margin-bottom: 18px;
  background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.admin-panel h2 { font-size: 15px; margin-bottom: 14px; color: var(--ink); }

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 48px 1fr 46px; align-items: center; gap: 10px; }
.bar .d { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.bar .track { height: 9px; background: var(--bg-3); border-radius: var(--radius-pill); overflow: hidden; }
.bar .track i { display: block; height: 100%; min-width: 2px; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); border-radius: var(--radius-pill); }
.bar .n { font-size: 12px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }

.hot-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.hot-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: var(--radius-sm); }
.hot-list li:hover { background: var(--bg-1); }
.hot-list li.muted { color: var(--ink-3); }
.hot-list a { font-size: 13.5px; }
.hot-list b { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.admin-table th, .admin-table td {
  padding: 8px 10px; text-align: left;
  border-bottom: 1px solid var(--border-weak);
  vertical-align: top;
}
.admin-table thead th {
  font-size: 11.5px; color: var(--ink-3); font-weight: 700;
  letter-spacing: .3px; background: var(--bg-1);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table tbody tr:hover { background: var(--bg-1); }
.admin-table .ip { font-family: var(--mono); }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.admin-table .time { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.admin-table .ago { display: block; font-family: var(--font); font-size: 11px; color: var(--ink-3); }
.admin-table .muted {
  max-width: 240px; color: var(--ink-3); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.muted { color: var(--ink-3); }

.admin-foot { margin-top: 4px; font-size: 12.5px; color: var(--ink-3); }
.admin-foot code {
  font-family: var(--mono); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px;
}

/* ===== 九、深浅色 ====================================================== */
[data-theme="dark"] {
  --bg-0: #1c1a16;
  --bg-1: #141210;
  --bg-2: #232019;
  --bg-3: #2c2820;
  --border: #35302a;
  --border-strong: #474038;
  --border-weak: #262219;

  --ink: #ece7dc;
  --ink-2: #b5afa2;
  --ink-3: #8b8578;
  --ink-4: #635d53;

  --brand: #e08a63;
  --brand-strong: #f0a37c;
  --brand-deep: #c96442;
  --brand-ink: #eaa98a;
  --brand-soft: #3a2a22;
  --brand-softer: #2a1f1a;
  --brand-border: #4e372c;

  --ok: #8fa870;
  --ok-soft: #242c1d;
  --ok-text: #a9be8b;
  --amber: #d9a441;
  --amber-soft: #332915;
  --danger: #e08268;
  --danger-soft: #38211c;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, .3);
  --shadow: 0 6px 18px -6px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 40px -12px rgba(0, 0, 0, .6);

  --glass: rgba(28, 26, 22, .8);

  --code-bg: #1a1815;
  --code-border: #322d26;
  --mark-bg: #4a3b1c;

  --t-cm: #7c766a;
  --t-st: #a8bd8a;
  --t-kw: #e79b74;
  --t-vr: #f0b494;
  --t-nm: #d9a441;
  --t-op: #a5a094;
  --t-fn: #8fa8ce;
  --t-ky: #eaa98a;
  --t-de: #d9a441;
  --t-sec: #e79b74;
  --t-dr: #8fa8ce;
}
[data-theme="dark"] .bg-wall {
  background:
    radial-gradient(900px 620px at 10% 4%, rgba(201, 100, 66, .12), transparent 62%),
    radial-gradient(720px 520px at 92% 10%, rgba(176, 122, 30, .09), transparent 64%),
    radial-gradient(940px 700px at 50% 112%, rgba(100, 118, 73, .08), transparent 62%),
    linear-gradient(180deg, #141210 0%, #100e0c 100%);
}
[data-theme="dark"] .bg-wall::after {
  background-image: radial-gradient(rgba(236, 231, 220, .07) 1px, transparent 1px);
}
[data-theme="dark"] .doc { background: var(--bg-0); }
[data-theme="dark"] .sidebar { background: rgba(28, 26, 22, .6); }
[data-theme="dark"] .pg { background: rgba(28, 26, 22, .6); }
[data-theme="dark"] .alert-note { background: #1e2530; }
[data-theme="dark"] .alert-note .alert-title { color: #a7b7d4; }
[data-theme="dark"] .alert-important { background: #251f30; }
[data-theme="dark"] .alert-important .alert-title { color: #bda8db; }
[data-theme="dark"] .alert-warning .alert-title { color: #e0b464; }
[data-theme="dark"] .alert-caution .alert-title { color: var(--danger); }
[data-theme="dark"] .btn-warn { background: #2e1d19; border-color: #55332b; }
[data-theme="dark"] .bar .track { background: #2c2820; }

.ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: block; }

/* ===== 十、响应式 ====================================================== */
@media (max-width: 1240px) {
  :root { --rail-w: 196px; }
  .layout { gap: 26px; }
  .doc { padding: 34px 36px 40px; }
}

@media (max-width: 1080px) {
  .layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .rail { display: none; }
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px 14px 0;
    gap: 0;
  }
  .nav-toggle { display: inline-flex; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: min(300px, 84vw);
    max-height: none; border-radius: 0;
    border: 0; border-right: 1px solid var(--border);
    background: var(--bg-0);
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-close { display: block; }
  .nav-scroll { padding-top: 40px; }

  .doc { padding: 26px 20px 30px; border-radius: var(--radius); }
  .doc h1 { font-size: 23px; }
  .doc h2 { font-size: 19px; }

  .toolbar { padding: 9px 13px; }
  .search-input { width: 40vw; min-width: 118px; padding-right: 34px; }
  .search-kbd { display: none; }
  .logo-tail { display: none; }

  .pager { grid-template-columns: 1fr; }
  .pg-next { grid-column: 1; text-align: left; }
  .doc-foot { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .badge { display: none; }
  .search-pop { right: -46px; }
  .doc { font-size: 14.5px; }
  .cb pre code { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  .toolbar, .sidebar, .rail, .pager, .doc-foot, .scrim { display: none !important; }
  .layout { display: block; padding: 0; }
  .doc { border: 0; box-shadow: none; padding: 0; }
}

/* ===== 十一、主页与动效（首页专用，文档页不受影响） ==================== */

/* --- 11.1 骨架：首页是单栏，没有侧边栏与本页目录 --- */
.app.home { display: flex; flex-direction: column; }
.home-main { flex: 1 1 auto; }

/* 首页没有侧边栏，汉堡按钮点不出东西，窄屏下也一并藏掉 */
.app.home .nav-toggle { display: none; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 26px; }

/* 首页正文里的行内代码，取自文档页的观感但不依赖 .doc 作用域 */
.home-main code {
  font-family: var(--mono); font-size: .89em; white-space: nowrap;
  padding: 1px 6px; border-radius: 5px;
  background: var(--bg-2); border: 1px solid var(--border-weak);
  color: var(--brand-ink);
}

/* --- 11.2 首屏 --- */
.hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center;
  min-height: calc(100vh - var(--toolbar-h) - 60px);
  padding: 76px 0 96px;
}
.hero-halo {
  position: absolute; z-index: -1; top: 42%; left: 50%;
  width: min(1000px, 132vw); aspect-ratio: 1;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(circle,
    rgba(201, 100, 66, .20) 0%, rgba(201, 100, 66, .07) 34%, transparent 66%);
}
.hero-inner { position: relative; }

.hero-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12.5px; font-weight: 650; letter-spacing: .1em;
  color: var(--brand-ink);
}
.hero-kicker::before {
  content: ""; width: 26px; height: 1px; flex: none;
  background: var(--brand); opacity: .75;
}

.hero-title {
  margin-top: 18px;
  font-size: clamp(38px, 7.4vw, 74px);
  line-height: 1.04; font-weight: 800; letter-spacing: -.035em;
}
.hero-line { display: block; }
.hero-accent { color: var(--brand); }

.hero-lede {
  max-width: 628px; margin-top: 22px;
  font-size: 17px; line-height: 1.72; color: var(--ink-2);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.hero-actions .btn {
  height: 46px; padding: 0 24px; font-size: 14.5px; font-weight: 650;
  box-shadow: var(--shadow-sm);
}
.hero-meta {
  margin-top: 26px; font-size: 12.5px; letter-spacing: .04em; color: var(--ink-3);
}

.hero-scroll {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-3);
}
.hero-scroll:hover { color: var(--brand-ink); text-decoration: none; }
.hero-scroll svg { animation: nudge 2.2s ease-in-out infinite; }

/* --- 11.3 按钮（沿用后台的 .btn 底座，只补主页需要的两种） --- */
.btn-primary {
  background: var(--brand-strong); border-color: var(--brand-strong); color: #fff;
}
.btn-primary:hover {
  background: var(--brand-deep); border-color: var(--brand-deep); color: #fff;
  transform: translateY(-2px); box-shadow: var(--shadow);
}
.btn-primary svg { transition: transform .16s ease; }
.btn-primary:hover svg { transform: translateX(3px); }
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary:hover { color: #201712; }

.btn-sm { height: 34px; padding: 0 15px; font-size: 13px; }

/* --- 11.4 分段区块 --- */
.band { position: relative; padding: 84px 0; border-top: 1px solid var(--border-weak); }
.band-alt {
  background: linear-gradient(180deg, transparent,
    rgba(201, 100, 66, .055) 16%, rgba(201, 100, 66, .055) 84%, transparent);
}
[data-theme="dark"] .band-alt {
  background: linear-gradient(180deg, transparent,
    rgba(224, 138, 99, .07) 16%, rgba(224, 138, 99, .07) 84%, transparent);
}

.band-label {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .12em;
  color: var(--brand-ink); white-space: nowrap;
}
.band-label::before {
  content: ""; width: 18px; height: 2px; flex: none;
  border-radius: 2px; background: var(--brand);
}

.band-grid {
  display: grid; grid-template-columns: 176px minmax(0, 1fr);
  gap: 24px 44px; align-items: start;
}
.band-body p { color: var(--ink-2); }
.band-body > p + p { margin-top: 15px; }
.band-lead { font-size: 18px; line-height: 1.68; font-weight: 500; color: var(--ink); }
.band-lede { max-width: 720px; margin-top: 14px; font-size: 15.5px; color: var(--ink-2); }

/* --- 11.5 能做什么 --- */
.feats { list-style: none; margin-top: 26px; border-top: 1px solid var(--border-weak); }
.feat {
  display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 22px;
  padding: 26px 0; border-bottom: 1px solid var(--border-weak);
}
.feat:last-child { border-bottom: 0; padding-bottom: 0; }
.feat-num {
  padding-top: 4px; font-family: var(--mono);
  font-size: 12.5px; font-weight: 700; letter-spacing: .08em; color: var(--brand);
}
.feat-body h3 { font-size: 17px; letter-spacing: -.2px; }
.feat-body h3 code { font-size: 13.5px; background: var(--brand-softer); border-color: var(--brand-border); }
.feat-body p { max-width: 760px; margin-top: 7px; font-size: 14.5px; color: var(--ink-2); }

/* --- 11.6 文档入口（由 server.py 按 content/ 实际文件生成） --- */
.doc-entries { display: grid; gap: 30px; margin-top: 26px; }
.doc-group-name {
  margin-bottom: 13px; font-size: 12px; font-weight: 700;
  letter-spacing: .12em; color: var(--ink-3);
}
.doc-list {
  list-style: none; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}
.doc-entry {
  display: flex; align-items: baseline; gap: 12px;
  min-height: 52px; padding: 13px 16px;
  color: var(--ink); background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: transform .16s ease, border-color .16s, background .16s, box-shadow .16s;
}
.doc-entry:hover {
  transform: translateY(-2px); text-decoration: none; color: var(--ink);
  border-color: var(--brand-border); background: var(--brand-softer);
  box-shadow: var(--shadow-sm);
}
.de-name { font-size: 14px; font-weight: 600; }
.de-path {
  max-width: 46%; margin-left: auto;
  font-family: var(--mono); font-size: 11px; color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
[data-theme="dark"] .doc-entry { background: var(--bg-2); }

/* --- 11.7 投喂 --- */
.give { text-align: center; }
.give-title {
  margin-top: 16px; line-height: 1.1;
  font-size: clamp(30px, 5.4vw, 48px); font-weight: 800; letter-spacing: -.03em;
}
.give-title em { font-style: normal; color: var(--brand); }
.give-sub { margin-top: 12px; font-size: 15.5px; color: var(--ink-2); }

.qr-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 30px; margin-top: 36px; }
.qr { width: 240px; margin: 0; }
.qr-pic {
  padding: 10px; background: #fff;              /* 二维码要白底才好扫，暗色下也不翻 */
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease;
}
.qr-pic img { display: block; width: 100%; height: auto; border-radius: 8px; }
.qr figcaption { margin-top: 14px; }
.qr figcaption b { display: block; font-size: 13.5px; font-weight: 650; }
.qr figcaption span { display: block; margin-top: 3px; font-size: 12px; color: var(--ink-3); }
.qr:hover .qr-pic { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.qr-row .qr:nth-child(1):hover .qr-pic { transform: translateY(-5px) rotate(-.7deg); }
.qr-row .qr:nth-child(2):hover .qr-pic { transform: translateY(-5px) rotate(.7deg); }
.give-tip { margin-top: 22px; font-size: 12.5px; color: var(--ink-3); }

.beg { display: flex; flex-direction: column; align-items: center; gap: 15px; margin-top: 30px; }
.beg-line {
  min-height: 1.6em; font-size: clamp(18px, 2.6vw, 22px);
  font-weight: 700; color: var(--brand-ink);
}
.beg-line.pop { animation: begPop .34s ease; }
.beg-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.beg-btns .btn { transition: transform .16s ease, border-color .16s, background .16s, color .16s; }
.beg-btns .btn:hover { transform: translateY(-2px); }

/* --- 11.8 页脚 --- */
.home-foot { border-top: 1px solid var(--border-weak); padding: 40px 0 58px; }
.home-foot-inner {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 14px 30px; font-size: 13px; color: var(--ink-3);
}
.foot-brand { font-size: 14px; font-weight: 700; color: var(--ink); }
.foot-brand span { margin-left: 9px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.foot-links { display: flex; flex-wrap: wrap; gap: 18px; margin-left: auto; }
.foot-links a { font-size: 12.5px; color: var(--ink-2); }
.foot-links a:hover { color: var(--brand-strong); }
.foot-note {
  flex: 1 1 100%; margin-top: 4px; padding-top: 14px;
  border-top: 1px solid var(--border-weak); font-size: 12px; color: var(--ink-4);
}

/* --- 11.9 复制提示条 --- */
.toast {
  position: fixed; z-index: 80; left: 50%; bottom: 34px;
  transform: translate(-50%, 12px);
  padding: 10px 19px; border-radius: var(--radius-pill);
  background: var(--ink); color: var(--bg-1);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[hidden] { display: none; }

/* --- 11.10 动效 ---
   滚动进场：JS 确认环境可用后才给元素加 .reveal-armed 把它藏起来，
   脚本没跑、浏览器不支持观察器、视口异常时元素一律保持可见，
   不会出现"内容隐形"的死局。首屏入场用纯 CSS 递延，末态即正常状态。 */
.reveal-armed {
  opacity: 0; transform: translateY(20px);
  transition: opacity .5s ease, transform .5s cubic-bezier(.22, .68, .3, 1);
}
.reveal-armed.in { opacity: 1; transform: none; }

@keyframes rise { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: none; } }
@keyframes halo { from { opacity: 0; transform: translate(-50%, -50%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes begPop { from { opacity: 0; transform: translateY(9px) scale(.97); } to { opacity: 1; transform: none; } }

.hero-halo { animation: halo 1.1s cubic-bezier(.22, .68, .3, 1) both; }
.hero-kicker { animation: rise .6s cubic-bezier(.22, .68, .3, 1) .05s both; }
.hero-title .hero-line:nth-child(1) { animation: rise .68s cubic-bezier(.22, .68, .3, 1) .12s both; }
.hero-title .hero-line:nth-child(2) { animation: rise .68s cubic-bezier(.22, .68, .3, 1) .22s both; }
.hero-lede { animation: rise .68s cubic-bezier(.22, .68, .3, 1) .32s both; }
.hero-actions { animation: rise .68s cubic-bezier(.22, .68, .3, 1) .42s both; }
.hero-meta { animation: rise .68s cubic-bezier(.22, .68, .3, 1) .5s both; }
.hero-scroll { animation: rise .6s ease .7s both; }

/* --- 11.11 主页的响应式补充 --- */
@media (max-width: 860px) {
  .wrap { padding: 0 18px; }
  .hero { min-height: 0; padding: 54px 0 76px; }
  .hero-title { font-size: clamp(34px, 10vw, 52px); }
  .hero-lede { font-size: 15.5px; }
  .hero-scroll { display: none; }
  .band { padding: 58px 0; }
  .band-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .feat { grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 22px 0; }
  .qr-row { gap: 22px; }
  .qr { width: min(240px, 78vw); }
  .foot-links { margin-left: 0; }
}

@media (max-width: 520px) {
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
  .doc-list { grid-template-columns: minmax(0, 1fr); }
  .de-path { max-width: 40%; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-armed { opacity: 1; transform: none; }
  .hero-halo, .hero-kicker, .hero-lede, .hero-actions, .hero-meta, .hero-scroll,
  .hero-title .hero-line:nth-child(1), .hero-title .hero-line:nth-child(2) { animation: none; }
  .hero-scroll svg { animation: none; }
}

@media print {
  .hero-halo, .hero-scroll, .beg-btns, .toast, .pg-veil { display: none !important; }
  .hero, .band { min-height: 0; padding: 20px 0; }
}

/* ==========================================================================
   12. 站内跳转过渡
   --------------------------------------------------------------------------
   点站内链接换页（文档之间互相跳同样算）时，旧页淡出、新页淡入。
   能自己做过场的浏览器走原生；不能的由 site.js 接管站内链接兜底，
   观感基本一致。两条路都不成立时就还是普通跳转，不影响打开页面。
   ========================================================================== */

/* --- 12.1 原生跨文档视图过渡 ---
   Chrome / Edge 126+、Safari 18.2+ 会把旧页拍张快照再画新页，
   跳转不用等脚本，速度不受影响。 */
@view-transition { navigation: auto; }

@keyframes pgOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes pgIn { from { opacity: 0; transform: translateY(9px); } }

::view-transition-old(root) { animation: pgOut .2s cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: pgIn .34s cubic-bezier(.22, .68, .3, 1) both; }

/* --- 12.2 兜底的那一半：遮罩淡出 + 正文淡入 ---
   遮罩盖住正文层，但压在页头（z-index 50）底下：页头在两个页面上
   长得一模一样，这样看起来就是"页头一直没动，只有正文换了"。
   底板色跟 body 同色，所以看不出这层遮罩的存在。
   这两个层级都得在 .app 里比：.app 自己是层叠上下文，所以 site.js
   把遮罩挂进 .app，挂到 body 上会反过来压住页头。 */
.pg-veil {
  position: fixed; inset: 0; z-index: 45;
  background: var(--bg-1);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.pg-veil.on { opacity: 1; }

/* 只有走兜底路径的文档页才需要补这记进场，原生过渡自己会淡入 */
.pg-fallback .app:not(.home) .main { animation: pgIn .34s cubic-bezier(.22, .68, .3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .pg-fallback .app:not(.home) .main { animation: none; }
  .pg-veil { transition: none; }
}
