:root {
  --bg: #f7f5f0;
  --paper: #fffdf8;
  --ink: #2b2b28;
  --muted: #77736a;
  --line: #e5e0d5;
  --accent: #1a5276;
  --header-bg: #202b3a;
  --radius: 12px;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --serif: "Noto Serif CJK SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.8;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ===== 顶部导航 ===== */
.site-header {
  background: var(--header-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 1px 8px rgba(0,0,0,.18);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand {
  color: #fff; font-weight: 700; font-size: 18px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1;
}
.brand:hover { text-decoration: none; }
.main-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav-link {
  color: #d9e2ec; font-size: 14px; padding: 6px 10px; border-radius: 8px;
  font-family: var(--sans);
}
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(255,255,255,.15); color: #fff; }
.header-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.icon-btn {
  background: none; border: 1px solid rgba(255,255,255,.35); color: #fff;
  border-radius: 8px; padding: 6px 11px; font-size: 16px; cursor: pointer;
  min-width: 40px; min-height: 40px; line-height: 1;
}
.menu-toggle { display: none; }
.search-box { background: var(--header-bg); padding: 0 0 12px; }
.search-box input {
  width: 100%; max-width: 1080px; display: block; margin: 0 auto;
  padding: 12px 14px; border-radius: 10px; border: 1px solid #46586e;
  background: #16202c; color: #fff; font-size: 16px; outline: none;
}
.search-results {
  max-width: 1080px; margin: 8px auto 0; max-height: 62vh; overflow: auto;
}
.search-results a {
  display: block; background: #16202c; color: #e8eef5; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 6px; border: 1px solid #2d3d50;
}
.search-results .sr-title { font-weight: 700; font-size: 15px; }
.search-results .sr-guide { color: #9fb6cc; font-size: 12px; margin-left: 8px; }
.search-results .sr-snippet { color: #b9c4d0; font-size: 13px; margin-top: 4px; }
.search-results .sr-empty { color: #9fb6cc; padding: 12px 14px; font-size: 14px; }

/* ===== 布局 ===== */
.layout { display: flex; gap: 26px; padding-top: 24px; padding-bottom: 44px; align-items: flex-start; }
.toc-toggle { display: none; }
.content {
  flex: 1; min-width: 0; background: var(--paper); padding: 34px 40px;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.content h1 { font-size: 28px; line-height: 1.4; margin: 0 0 18px; }
.content h2 {
  font-size: 22px; margin: 30px 0 14px; padding-bottom: 6px;
  border-bottom: 2px solid var(--line); color: #33414f;
}
.content h3 { font-size: 18px; margin: 24px 0 10px; color: #3d4b59; }
.content p { margin: 12px 0; }
.content ul, .content ol { padding-left: 26px; }
.content li { margin: 5px 0; }
.content blockquote {
  margin: 14px 0; padding: 10px 16px; border-left: 4px solid #c9b458;
  background: #fbf7ea; color: #5f5735; border-radius: 0 8px 8px 0;
}
.content code { background: #f0ede4; border-radius: 4px; padding: 1px 5px; font-size: .9em; }
.content pre {
  background: #f0ede4; border-radius: 8px; padding: 14px 16px; overflow: auto;
  font-size: 14px; line-height: 1.6; -webkit-overflow-scrolling: touch;
}
.content pre code { background: none; padding: 0; }
.content hr { border: none; border-top: 1px solid var(--line); margin: 26px 0; }
.content img { max-width: 100%; height: auto; }
.lead { font-size: 18px; color: #4d4a42; }
.muted { color: var(--muted); font-size: 14px; }

/* 表格 */
.content table {
  border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 15px;
}
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 16px 0; }
.tbl-scroll table { margin: 0; }
.content th, .content td {
  border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top;
}
.content th { background: #f1efe7; font-weight: 700; white-space: nowrap; }
.content tr:nth-child(even) td { background: #fbfaf5; }
.tbl-hint { color: var(--muted); font-size: 12px; text-align: right; margin: -8px 0 14px; display: none; }

/* ===== 目录侧栏 ===== */
.toc {
  width: 260px; flex-shrink: 0; position: sticky; top: 76px;
  max-height: calc(100vh - 96px); overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px;
}
.toc nav { display: flex; flex-direction: column; gap: 2px; }
.toc a {
  font-size: 13.5px; color: #4a4a44; padding: 6px 8px; border-radius: 8px;
  font-family: var(--sans); line-height: 1.45;
}
.toc a:hover { background: #f1efe7; text-decoration: none; }
.toc a.on { background: var(--accent); color: #fff; }

/* ===== 首页卡片 ===== */
.guide-grid { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 24px 0; }
.guide-card {
  display: flex; gap: 18px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; color: var(--ink);
  border-left: 6px solid var(--accent);
}
.guide-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); text-decoration: none; }
.card-icon { font-size: 40px; line-height: 1.2; }
.card-body { min-width: 0; }
.card-body h2 { margin: 0 0 4px; font-size: 21px; }
.card-sub { color: var(--accent); font-weight: 600; margin: 0 0 8px; font-size: 15px; }
.card-desc { margin: 0 0 10px; color: #4d4a42; font-size: 15px; line-height: 1.7; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-meta a { margin-right: 10px; }

.chapter-list { padding-left: 22px; }
.chapter-list li { margin: 6px 0; }
.dl-list { list-style: none; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.dl-list li a {
  display: inline-block; border: 1px solid var(--accent); color: var(--accent);
  padding: 8px 18px; border-radius: 24px; font-size: 14px; font-family: var(--sans);
}
.dl-list li a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.guide-pdf { margin-top: 34px; border-top: 2px solid var(--line); padding-top: 12px; }
.guide-pdf h2 { border: none; font-size: 18px; margin: 8px 0; }

.pager {
  max-width: 1080px; margin: 0 auto; padding: 0 20px 34px;
  display: flex; justify-content: space-between; gap: 16px;
}
.pn {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; font-size: 14px; color: #4a4a44; max-width: 48%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--sans);
}
.pn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.site-footer {
  background: #eceae2; border-top: 1px solid var(--line); padding: 22px 0; font-size: 14px;
}
.site-footer p { margin: 4px 0; }
.site-footer .icp a { color: var(--muted); font-size: 13px; }
.site-footer .icp a:hover { color: var(--accent); }

/* 回顶按钮 */
.back-top {
  position: fixed; right: 18px; bottom: 22px; z-index: 55;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none; font-size: 20px;
  box-shadow: 0 3px 10px rgba(0,0,0,.25); cursor: pointer;
  display: none; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.back-top.show { display: flex; opacity: 1; }

/* ===== 移动端（≤1024px：收起侧栏） ===== */
@media (max-width: 1024px) {
  .layout { gap: 18px; }
  .toc { width: 220px; }
}

/* ===== 手机端（≤820px） ===== */
@media (max-width: 820px) {
  body { font-size: 16px; line-height: 1.75; }
  .wrap { padding: 0 14px; }
  .site-header .wrap { min-height: 52px; gap: 8px; }
  .brand { font-size: 16px; }

  /* 汉堡菜单 */
  .menu-toggle { display: inline-flex; }
  .main-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--header-bg); flex-direction: column; padding: 8px 14px 14px;
    border-top: 1px solid #35465a; box-shadow: 0 8px 16px rgba(0,0,0,.25);
  }
  .main-nav.open { display: flex; }
  .nav-link { padding: 12px 12px; font-size: 15px; border-radius: 10px; }

  /* 布局 */
  .layout { flex-direction: column; padding-top: 14px; gap: 12px; }
  .content { padding: 20px 18px; border-radius: 10px; }
  .content h1 { font-size: 23px; margin-bottom: 14px; }
  .content h2 { font-size: 19px; margin: 24px 0 12px; }
  .content h3 { font-size: 16.5px; margin: 20px 0 8px; }
  .lead { font-size: 16.5px; }

  /* 目录：切换按钮 + 抽屉 */
  .toc-toggle {
    display: block; width: 100%; text-align: left;
    background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; font-size: 15px; color: var(--accent); font-weight: 700;
    font-family: var(--sans); cursor: pointer;
  }
  .toc-toggle .arrow { float: right; transition: transform .2s; }
  .toc-toggle.open .arrow { transform: rotate(180deg); }
  .toc {
    display: none; width: 100%; position: static; max-height: 52vh;
    margin-top: 8px;
  }
  .toc.open { display: block; }

  /* 表格：横向滚动 + 小屏卡片化 */
  .content table { font-size: 13.5px; }
  .tbl-hint { display: block; }
  table.stack, table.stack thead, table.stack tbody, table.stack tr, table.stack th, table.stack td {
    display: block;
  }
  table.stack { border: none; }
  table.stack thead { display: none; }
  table.stack tr {
    background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
    margin-bottom: 10px; padding: 8px 12px;
  }
  table.stack td {
    border: none; padding: 5px 0; display: flex; gap: 8px; align-items: baseline;
  }
  table.stack td::before {
    content: attr(data-label); flex-shrink: 0; min-width: 68px;
    font-weight: 700; font-size: 12px; color: var(--muted); font-family: var(--sans);
  }
  table.stack tr:nth-child(even) td { background: transparent; }

  /* 首页卡片 */
  .guide-card { flex-direction: column; padding: 18px; border-left-width: 5px; }
  .card-icon { font-size: 34px; }
  .card-body h2 { font-size: 19px; }

  /* 翻页 */
  .pager { flex-direction: column; padding: 0 14px 28px; gap: 10px; }
  .pn { max-width: 100%; white-space: normal; padding: 12px 14px; }

  .back-top { right: 14px; bottom: 16px; width: 44px; height: 44px; }
}

/* 小屏（≤480px） */
@media (max-width: 480px) {
  body { font-size: 15.5px; }
  .content { padding: 16px 14px; }
  .content h1 { font-size: 21px; }
  .search-toggle { display: none; }
  .header-actions { gap: 4px; }
}
