/* ===== 变量与基础（参考 GitBook 浅色主题：白底、克制配色、蓝色强调） ===== */
:root {
  --font: "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --ink: #1c1d1f;
  --ink-soft: #383a3f;
  --muted: #6a6e77;
  --line: #e2e6ec;
  --line-soft: #edf0f4;
  --panel: #ffffff;
  --canvas: #ffffff;

  --accent: #346ddb;
  --accent-dark: #2555b3;
  --accent-soft: #eef3fd;

  --green: #1a8f5e;
  --green-soft: #eaf7f1;
  --amber: #b3720f;
  --amber-soft: #fdf5e8;
  --red: #c23a4c;
  --red-soft: #fceeef;

  --nav-bg: #ffffff;
  --nav-bg-active: #eef3fd;
  --nav-text: #383a3f;
  --nav-muted: #80858f;
  --nav-line: #e2e6ec;

  --header-h: 60px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-header: 0 1px 0 rgba(20, 21, 26, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部栏 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-header);
}

.icon-button {
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex: none;
}
.brand div { display: flex; flex-direction: column; line-height: 1.25; }
.brand strong { font-size: 14.5px; color: var(--ink); font-weight: 700; }
.brand span { font-size: 12px; color: var(--muted); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  margin-left: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  color: var(--muted);
}
.search input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: 0;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
}
.search input::placeholder { color: var(--muted); }

.header-meta { margin-left: auto; color: var(--muted); font-size: 12.5px; flex: none; }

/* ===== 整体布局 ===== */
.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  align-items: start;
}

/* ---- 侧边栏 ---- */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-line);
  padding: 18px 0 14px;
  overflow: hidden;
}

#toc {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 12px;
  scrollbar-width: thin;
  scrollbar-color: #cfd5df transparent;
}
#toc::-webkit-scrollbar { width: 7px; }
#toc::-webkit-scrollbar-track { background: transparent; }
#toc::-webkit-scrollbar-thumb { background: #d3d8e0; border-radius: 4px; }
#toc::-webkit-scrollbar-thumb:hover { background: #b9c1cd; }

.toc-group {
  margin: 16px 8px 6px;
  color: var(--nav-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.toc-group:first-child { margin-top: 2px; }

.toc-chapter { margin: 1px 0; }
.toc-chapter summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 600;
}
.toc-chapter summary::-webkit-details-marker { display: none; }
.toc-chapter summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--nav-muted);
  transition: transform .15s, border-color .15s;
}
.toc-chapter[open] summary::before { transform: rotate(90deg); border-left-color: var(--accent); }
.toc-chapter summary:hover { background: var(--line-soft); }
.toc-chapter summary small { margin-left: auto; color: var(--nav-muted); font-weight: 500; font-size: 11px; }

.toc-overview, .toc-section-link {
  display: block;
  margin-left: 15px;
  padding: 6px 10px 6px 13px;
  border-left: 1px solid var(--nav-line);
  color: var(--nav-muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
}
.toc-overview:hover, .toc-section-link:hover {
  color: var(--ink);
  background: var(--line-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.toc-overview.active, .toc-section-link.active {
  border-left-color: var(--accent);
  background: var(--nav-bg-active);
  color: var(--accent-dark);
  font-weight: 600;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar footer {
  flex: none;
  border-top: 1px solid var(--nav-line);
  margin-top: 12px;
  padding: 13px 20px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---- 正文 ---- */
.content {
  width: min(768px, 100%);
  margin: 0 auto;
  padding: 40px 24px 100px;
}

.hero { margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .5px; color: var(--accent); }
.hero h2 { margin: 8px 0 12px; font-size: 34px; line-height: 1.28; font-weight: 700; color: var(--ink); }
.hero p { max-width: 640px; margin: 0; color: var(--muted); line-height: 1.75; font-size: 16px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.hero-stats span {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--line-soft);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.quick-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  background: var(--panel);
}
.quick-card b { display: block; margin-bottom: 5px; color: var(--ink); font-size: 13.5px; }
.quick-card p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.6; }

.chapter { scroll-margin-top: calc(var(--header-h) + 12px); margin: 56px 0; }
.chapter:first-of-type { margin-top: 0; }
.chapter-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 22px;
}
.chapter-index {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 13.5px;
}
.chapter h2 { font-size: 24px; margin: 0; font-weight: 700; color: var(--ink); }
.chapter-head > span { margin-left: auto; color: var(--muted); font-size: 12.5px; flex: none; }

.chapter-intro { color: var(--muted); font-size: 16px; margin-bottom: 26px; line-height: 1.75; }

.section {
  scroll-margin-top: calc(var(--header-h) + 12px);
  margin: 0 0 34px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--line-soft);
}
.section:last-child { border-bottom: 0; padding-bottom: 0; }
.section h3 {
  font-size: 18px;
  margin: 0 0 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
  color: var(--ink);
}
.section h3::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.card { background: transparent; border: 0; padding: 0; }
.card p:first-child { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.guide-copy { margin: 2px 0 16px; color: var(--ink-soft); font-size: 16px; line-height: 1.8; }

/* ---- 提示条 / callout（GitBook hint 风格） ---- */
.guide-callout {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  margin: 0 0 12px;
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--line-soft);
  font-size: 14px;
  line-height: 1.7;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
}
.guide-callout b { color: var(--ink-soft); font-weight: 700; font-size: 12.5px; }
.guide-callout.use { border-left-color: var(--accent); background: var(--accent-soft); border-color: #d7e3fa; }
.guide-callout.use b { color: var(--accent-dark); }
.guide-callout.prepare { border-left-color: var(--amber); background: var(--amber-soft); border-color: #f3e2c2; }
.guide-callout.prepare b { color: var(--amber); }
.guide-callout.result { border-left-color: var(--green); background: var(--green-soft); border-color: #c9e9d9; }
.guide-callout.result b { color: var(--green); }
.guide-callout.trouble { border-left-color: var(--red); background: var(--red-soft); border-color: #f3d3d8; margin-top: 16px; }
.guide-callout.trouble b { color: var(--red); }

/* ---- 步骤 ---- */
.step-title {
  margin: 20px 0 12px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.steps { counter-reset: steps; list-style: none; margin: 0 0 18px; padding: 0; }
.steps li {
  counter-increment: steps;
  position: relative;
  padding: 0 0 14px 34px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 22px;
}

/* ---- 表格 ---- */
.key-settings { margin: 20px 0 6px; }
.key-settings h4 { margin: 0 0 8px; font-size: 14px; color: var(--ink); font-weight: 700; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.field-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 13.5px; }
.field-table td, .field-table th {
  border-bottom: 1px solid var(--line);
  padding: 10px 13px;
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
}
.field-table tr:last-child td { border-bottom: 0; }
.field-table th { background: var(--line-soft); font-weight: 700; color: var(--ink); }
.field-table td:first-child { font-weight: 600; width: 25%; color: var(--ink); white-space: nowrap; }

/* ---- 说明 / note ---- */
.label-note { margin: 20px 0 6px; color: var(--ink); font-size: 14px; font-weight: 700; }
.note { border-radius: var(--radius); padding: 12px 15px; margin: 0 0 14px; font-size: 13.5px; line-height: 1.7; border: 1px solid; }
.note.tip { background: var(--green-soft); border-color: #c9e9d9; border-left: 3px solid var(--green); color: #146245; }
.note.warn { background: var(--amber-soft); border-color: #f3e2c2; border-left: 3px solid var(--amber); color: #7d5407; }
.note.danger { background: var(--red-soft); border-color: #f3d3d8; border-left: 3px solid var(--red); color: #8f2c3b; }

.tag {
  display: inline-block;
  border-radius: 4px;
  padding: 1px 7px;
  margin: 0 2px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12.5px;
}

/* ---- 截图（当前纯文字版隐藏） ---- */
.screens, .shot, .placeholder, dialog { display: none; }

/* ---- 章节翻页 ---- */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 36px 0 0;
}
.chapter-nav > a {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 16px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.chapter-nav > a:hover { border-color: var(--accent); background: var(--accent-soft); }
.chapter-nav .next { text-align: right; align-items: flex-end; }
.chapter-nav span { color: var(--muted); font-size: 11.5px; }
.chapter-nav b { font-size: 14px; margin-top: 3px; }

/* ---- 搜索为空 ---- */
.empty-search {
  margin-top: 60px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  background: var(--panel);
  text-align: center;
}
.empty-search b { font-size: 16px; }
.empty-search p { margin: 8px 0 0; color: var(--muted); }

/* ---- 返回顶部 ---- */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--accent-dark);
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(20, 21, 26, .1);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  transform: translateY(6px);
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ===== 移动端 ===== */
@media (max-width: 820px) {
  .icon-button { display: inline-block; }
  .search { display: none; }
  .header-meta { display: none; }

  .shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 25;
    left: 0;
    top: var(--header-h);
    width: min(280px, 86vw);
    height: calc(100vh - var(--header-h));
    transform: translateX(-101%);
    transition: transform .2s;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 12px 0 30px rgba(0, 0, 0, .12); }

  .content { padding: 28px 18px 70px; }
  .hero h2 { font-size: 25px; }
  .quick-grid { grid-template-columns: 1fr; }
  .guide-callout { grid-template-columns: 1fr; gap: 3px; }
  .field-table { min-width: 540px; font-size: 12.5px; }
  .field-table td, .field-table th { padding: 8px 10px; }
  .chapter h2 { font-size: 20px; }
  .chapter-head > span { display: none; }
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-nav .next { text-align: left; align-items: flex-start; }
}
