/* site.css - 前台页面样式（移植自原 server.js SSR 内联样式） */
:root {
  --primary: #FF2442;
  --primary-light: #FFF1F2;
  --primary-hover: #E5202E;
  --bg-page: #F4F6F9;
  --bg-card: #FFFFFF;
  --text-primary: #1F1F1F;
  --text-body: #333333;
  --text-sub: #595959;
  --text-muted: #909399;
  --border: #E5E7EB;
  --link: #2563EB;
  --hover-bg: #F7F8FA;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }

/* ===== 顶栏 ===== */
.header {
  height: 60px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
}
.header .logo { color: var(--primary); font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.header .divider { width: 1px; height: 20px; background: var(--border); margin: 0 16px; }
.header .site-title { font-size: 16px; color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.header .site-title .hamburger { color: var(--primary); margin-right: 6px; font-weight: 700; }
.header .nav { display: flex; gap: 8px; margin-left: 40px; align-items: center; flex-wrap: wrap; }
.header .nav a { font-size: 15px; color: var(--text-body); padding: 7px 16px; border-radius: 6px; transition: background .15s, color .15s; white-space: nowrap; }
.header .nav a:hover, .header .nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 500; }
.header .spacer { flex: 1; }
.header .search-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 15px; cursor: pointer;
  border: none; background: transparent;
}
.header .search-btn:hover { background: #F5F5F5; }
.header .brand {
  color: var(--primary); font-weight: 700; font-size: 18px; letter-spacing: 0.5px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.header .brand:hover { color: var(--primary-hover); }
.header .search { display: flex; align-items: center; gap: 6px; position: relative; }
/* 输入框 + 内嵌清除按钮 */
.header .search-input-wrap { position: relative; display: flex; align-items: center; }
.header .search-input {
  width: 0; padding: 0; height: 32px; border: 1px solid transparent; border-radius: 4px;
  font-size: 14px; outline: none; background: #fff; color: var(--text-body);
  transition: width 0.2s, padding 0.2s, border-color 0.2s;
}
.header .search.open .search-input { width: 240px; padding: 0 28px 0 10px; border-color: var(--border); }
.header .search-input:focus { border-color: var(--primary); }
/* 清除按钮：仅在有内容时出现，贴在输入框右侧内缘 */
.header .search-clear {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #C9CCD1; color: #fff; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.header .search-clear[hidden] { display: none; }
.header .search-clear:hover { background: #A8ADB5; }
.header .search-clear svg { width: 11px; height: 11px; }
.header .search-count { font-size: 12px; color: var(--text-muted); min-width: 38px; text-align: center; white-space: nowrap; }
.header .search-count:empty { display: none; }
.header .search-nav {
  display: none; width: 26px; height: 26px; font-size: 11px;
  border: 1px solid var(--border); background: #fff; border-radius: 4px;
  color: var(--text-sub); cursor: pointer; align-items: center; justify-content: center;
}
.header .search.open .search-nav { display: inline-flex; }
.header .search-nav:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 主体布局 ===== */
.container {
  max-width: 1400px; margin: 0 auto;
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 24px; padding: 24px;
  align-items: start;
}

/* ===== 侧边栏 ===== */
.sidebar {
  background: var(--bg-card); border-radius: 8px;
  padding: 16px 12px 24px;
  position: sticky; top: 84px;
  max-height: calc(100vh - 108px); overflow-y: auto;
}
.platform-select {
  position: relative; margin: 4px 4px 12px;
}
/* 小标题：把「文档分类」这个语义显式写出来 */
.platform-select .ps-caption {
  display: block; margin: 0 2px 8px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.04em;
}
/* ---- 气泡条：横向排列全部分类，超出隐藏、可滑动 ---- */
.platform-select .pchip-bar {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  padding: 1px 2px 4px;
  scrollbar-width: none;              /* Firefox */
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab; user-select: none;
  /* 注意：不要用 scroll-behavior:smooth —— 拖拽时每次赋值 scrollLeft 都会变成动画，手感发飘 */
}
.platform-select .pchip-bar::-webkit-scrollbar { display: none; } /* WebKit */
.platform-select .pchip-bar.dragging { cursor: grabbing; scroll-behavior: auto; }
/* 两端渐隐：提示「还有更多」，滑到头自动弱化 */
.platform-select .pchip-bar.fade-l {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px);
  mask-image: linear-gradient(to right, transparent 0, #000 18px);
}
.platform-select .pchip-bar.fade-r {
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 18px);
  mask-image: linear-gradient(to left, transparent 0, #000 18px);
}
.platform-select .pchip-bar.fade-l.fade-r {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
/* 单个气泡 */
.platform-select .pchip {
  flex: 0 0 auto;                     /* 不压缩，保证横向排布 */
  display: inline-flex; align-items: center;
  max-width: 200px;
  height: 30px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: #fff; color: var(--text-body);
  font-size: 13px; font-weight: 500; font-family: inherit; line-height: 1;
  white-space: nowrap; cursor: pointer; user-select: none;
  outline: none;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s;
}
.platform-select .pchip > .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.platform-select .pchip:hover { border-color: #D6DAE0; background: #FCFCFD; color: var(--text-primary); }
.platform-select .pchip:focus-visible { box-shadow: 0 0 0 3px rgba(255, 36, 66, 0.12); }
/* 选中态：主色实底气泡 */
.platform-select .pchip.active {
  color: #fff; font-weight: 600;
  background: var(--primary); border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(255, 36, 66, 0.22);
}
.platform-select .pchip.active:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.platform-select .pchip-empty { padding: 6px 2px; font-size: 13px; color: var(--text-muted); }
.menu-group { margin-bottom: 2px; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px; font-size: 15px; color: var(--text-primary);
  font-weight: 700; cursor: pointer; border-radius: 4px; user-select: none;
}
.menu-item:hover { background: var(--hover-bg); }
.menu-item.expanded { color: var(--text-primary); font-weight: 700; }
.menu-item .arrow {
  width: 8px; height: 8px; flex-shrink: 0;
  border-right: 1.5px solid #B0B3B8; border-bottom: 1.5px solid #B0B3B8;
  transform: rotate(45deg); transition: transform 0.2s;
  margin-right: 4px;
}
.menu-item.expanded .arrow { transform: rotate(-135deg); border-color: var(--text-primary); }
.menu-children { padding: 2px 0 6px 12px; }
.menu-children .child-row {
  display: flex; align-items: center; border-radius: 0 4px 4px 0;
  margin-bottom: 1px; border-left: 3px solid transparent;
}
.menu-children .child-row:hover { background: var(--hover-bg); }
.menu-children .child-row.active { background: var(--primary-light); border-left-color: var(--primary); }
.menu-children .child {
  flex: 1; display: block; padding: 9px 8px 9px 14px;
  font-size: 14px; color: var(--text-sub); cursor: pointer;
}
.menu-children .child:hover { color: var(--text-body); }
.menu-children .child-row.active .child { color: var(--primary); font-weight: 500; }
/* 二级目录（子分组）层级缩进 */
.menu-item.sub-item { padding-left: 26px; font-size: 13.5px; color: var(--text-body); font-weight: 600; }
.menu-item.sub-item.expanded { color: var(--text-primary); }
.menu-children.sub-children { padding-left: 26px; }
.menu-children.sub-children .child { padding-left: 16px; font-size: 13.5px; }
.copy-link {
  border: none; background: transparent; cursor: pointer; font-size: 13px;
  color: var(--text-muted); padding: 4px 8px; border-radius: 4px;
  opacity: 0; transition: opacity .15s; flex-shrink: 0;
}
.child-row:hover .copy-link { opacity: 1; }
.copy-link:hover { background: #F0F1F3; color: var(--primary); }

/* ===== 更新公告（独立卡片，不参与正文连载/搜索高亮） ===== */
#announceBox:empty { display: none; }
.announce-card {
  border: 1px solid #FFE0E4; border-left: 3px solid var(--primary);
  background: #FFFCFD; border-radius: 8px;
  padding: 0; margin: 0 0 28px; overflow: hidden;
}
.announce-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; cursor: pointer; user-select: none;
}
.announce-head:hover { background: var(--primary-light); }
.announce-icon { font-size: 15px; line-height: 1; }
.announce-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
/* 有关联链接的公告：标题本身即入口（加粗蓝色），不再单列「查看关联文档」 */
a.announce-title.is-link {
  color: var(--link); font-weight: 700;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
a.announce-title.is-link:hover { color: var(--primary); border-bottom-color: currentColor; }
.announce-date {
  font-size: 12px; color: var(--primary);
  background: var(--primary-light); border-radius: 4px; padding: 1px 8px;
}
.announce-spacer { flex: 1; }
.announce-fold { font-size: 12px; color: var(--text-muted); }
.announce-body {
  padding: 0 18px 14px 18px; font-size: 14px; color: var(--text-body); line-height: 1.75;
}
.announce-card.folded .announce-body { display: none; }
/* 公告内部样式限定作用域，避免与正文标题/表格等规则互相影响 */
.announce-body h2 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 12px 0 8px; }
.announce-body h3 { font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 10px 0 6px; }
.announce-body h4 { font-size: 14px; font-weight: 600; color: var(--text-body); margin: 8px 0 6px; }
.announce-body p { margin: 0 0 6px; }
.announce-body ul, .announce-body ol { margin: 6px 0; padding-left: 22px; }
.announce-body li { margin-bottom: 4px; }
.announce-body a { color: var(--link); }
.announce-body blockquote {
  margin: 8px 0; padding: 8px 12px;
  background: var(--primary-light); border-left: 3px solid var(--primary);
  border-radius: 0 4px 4px 0; font-size: 13px;
}
.announce-body code {
  background: #F5F6F7; border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 5px; font-size: 12px; color: #D6336C;
}
.announce-body table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.announce-body th, .announce-body td { border: 1px solid var(--border); padding: 6px 12px; text-align: left; }
.announce-body img { max-width: 100%; border-radius: 4px; cursor: zoom-in; }
/* 公告「一条条更新」：与更新日志中心同款紧凑列表 */
.announce-items {
  list-style: none; margin: 0 0 6px; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.announce-items li {
  position: relative; padding-left: 15px;
  font-size: 13.5px; color: var(--text-body); line-height: 1.7;
}
.announce-items li::before {
  content: ''; position: absolute; left: 3px; top: 9px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary); opacity: .75;
}
.announce-items li strong { color: var(--primary); font-weight: 600; }
.announce-items li code {
  background: #F5F6F7; border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 5px; font-size: 12px; color: #D6336C;
}
/* 公告缩略图：统一排在内容下方，尺寸收小（不做大封面） */
.announce-thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.announce-thumbs .announce-thumb {
  display: block; width: 58px; height: 44px; border-radius: 6px;
  overflow: hidden; background: #fff; border: 1px solid var(--border);
  padding: 0; cursor: zoom-in;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.announce-thumbs .announce-thumb:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 36, 66, .14);
}
.announce-thumbs img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .25s ease;
}
.announce-thumbs .announce-thumb:hover img { transform: scale(1.06); }

/* ===== 正文 ===== */
.content {
  background: var(--bg-card); border-radius: 8px;
  padding: 20px 40px 64px; min-height: 70vh;
}
.content h1 {
  font-size: 26px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 10px; line-height: 1.4;
}
.content .doc-meta { color: var(--text-muted); font-size: 13px; padding-bottom: 20px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.content .doc-meta:empty { display: none; }
.content h2 {
  font-size: 20px; font-weight: 700; color: var(--text-primary);
  margin: 32px 0 16px; line-height: 1.5;
}
.content h3 { font-size: 17px; font-weight: 600; color: var(--text-primary); margin: 24px 0 12px; }
.content h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 20px 0 10px; }
.content p { margin-bottom: 12px; }
.content strong.hl { color: var(--primary); font-weight: 600; }
.content a { color: var(--link); }
.content a:hover { text-decoration: underline; }
/* ---- 正文链接的「图标化」（见 markdown.js 的 linkIcon 开关，仅前台） ----
   ① .lk-url：显示文字本就是网址（长地址撑满一行）→ 压缩成一枚小链接图标，完整地址悬停可见
   ② .lk-text：有正常文字的链接 → 保留文字 + 尾部一枚外链小标（提示会新开页面） */
.content a.lk-url {
  display: inline-flex; align-items: center; gap: 3px;
  vertical-align: -3px;
  padding: 2px 7px; margin: 0 2px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-card); color: var(--link); line-height: 1;
  transition: background .15s, border-color .15s, color .15s;
}
.content a.lk-url:hover {
  text-decoration: none;
  background: var(--primary-light); border-color: var(--link);
}
.content a.lk-url .lk-ico { width: 15px; height: 15px; display: block; }
.content a.lk-url .lk-ext { width: 11px; height: 11px; display: block; opacity: .75; }
/* 兜底：这两个图标 SVG 只有 viewBox、没有内联宽高，一旦逃出上面两条选择器的作用域
   （例如被非法结构挤出 <a>），就会按默认尺寸撑成几百 px 的巨图。这里再加一道保险，
   让 .content 内任何位置的图标 SVG 都拿不到大尺寸。 */
.content svg.lk-ico { width: 15px; height: 15px; max-width: 15px; max-height: 15px; display: inline-block; vertical-align: middle; }
.content svg.lk-ext { width: 11px; height: 11px; max-width: 11px; max-height: 11px; display: inline-block; vertical-align: middle; }
/* 图标里内嵌的地址文字：视觉上隐藏（0 尺寸），但读屏可读、textContent 取值可用
   —— 本文目录标题、复制链接等依赖 textContent，纯 SVG 的话会取到空串 */
.content a.lk-url .lk-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.content a.lk-text .lk-ext {
  width: 12px; height: 12px; display: inline-block;
  vertical-align: -1px; margin-left: 3px; opacity: .75;
}
.content a.lk-text:hover .lk-ext { opacity: 1; }
.content ol, .content ul { margin: 8px 0 16px; padding-left: 28px; }
.content li { margin-bottom: 6px; }
.content blockquote {
  margin: 16px 0; padding: 12px 16px;
  background: var(--primary-light); border-left: 3px solid var(--primary);
  border-radius: 0 4px 4px 0; color: var(--text-body); font-size: 14px;
}
.content blockquote strong.hl { color: var(--primary); }
.content code {
  background: #F5F6F7; border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px; color: #D6336C;
}
.content pre {
  background: #F8F9FA; border: 1px solid var(--border);
  border-radius: 6px; padding: 16px 20px;
  margin: 16px 0; overflow-x: auto;
}
.content pre code { background: transparent; border: none; padding: 0; color: #2C3E50; font-size: 13px; line-height: 1.7; }
.content img {
  max-width: 100%; border-radius: 4px; margin: 8px 0; display: block;
  cursor: zoom-in; transition: filter 0.15s;
}
.content img:hover { filter: brightness(0.97); }
.content .img-broken {
  border: 1px dashed #e0a0a0; background: #fdf2f2; color: #c0392b;
  padding: 10px 14px; border-radius: 4px; margin: 8px 0; font-size: 13px;
  cursor: default;
}
/* 视频：preload="none"，打开文档不下载任何视频数据，点播放才开始加载 */
.content video {
  max-width: 100%; width: 100%; max-height: 480px;
  border-radius: 6px; margin: 10px 0; display: block;
  background: #000; cursor: pointer;
}
.content .video-broken {
  border: 1px dashed #e0a0a0; background: #fdf2f2; color: #c0392b;
  padding: 10px 14px; border-radius: 4px; margin: 8px 0; font-size: 13px;
}
/* 右侧本文目录栏：固定在正文右侧，随阅读位置高亮当前章节 */
.toc-side {
  position: sticky; top: 84px;
  max-height: calc(100vh - 108px); overflow-y: auto;
}
.toc-side:empty { display: none; }
/* 文档内目录（三级目录） */
.doc-toc {
  background: #FAFBFC; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; font-size: 13px;
}
.doc-toc .toc-title {
  font-weight: 600; color: var(--text-primary); margin-bottom: 8px;
  font-size: 14px;
}
.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc li { margin: 5px 0; line-height: 1.6; }
.doc-toc li.toc-l2 { padding-left: 0; }
.doc-toc li.toc-l3 { padding-left: 12px; }
.doc-toc li.toc-l4 { padding-left: 24px; }
.doc-toc a { color: var(--text-sub); display: block; border-radius: 4px; padding: 2px 6px; transition: color .15s, background .15s; }
.doc-toc a:hover { color: var(--primary); }
.doc-toc a.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }
.content h2, .content h3, .content h4 { scroll-margin-top: 84px; }
.content table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0 24px; font-size: 14px;
}
.content th, .content td {
  border: 1px solid var(--border);
  padding: 10px 16px; text-align: left; vertical-align: middle;
}
.content th {
  background: #F2F3F5; color: var(--text-primary);
  font-weight: 600; white-space: nowrap;
}
.content tr:hover td { background: #FCFCFD; }
.empty-doc { padding: 80px 0; text-align: center; color: var(--text-muted); }
.empty-tip { padding: 20px 0; text-align: center; color: var(--text-muted); font-size: 13px; }

/* 文内搜索高亮 */
.content mark.search-hit {
  background: #FFF3A3; color: inherit; border-radius: 2px; padding: 0 1px;
  scroll-margin-top: 84px;
}
.content mark.search-hit.active { background: var(--primary); color: #fff; }

/* 滚动条 */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #D8DADF; border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

/* 连载章节分隔 */
.doc-section { scroll-margin-top: 84px; }
.doc-sep {
  border-top: 1px dashed var(--border); margin: 40px 0 10px; padding-top: 16px;
  color: var(--text-muted); font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
}

/* 图片灯箱 */
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.82);
  display: none; align-items: center; justify-content: center; z-index: 300;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 6px; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4); transition: transform .12s ease; transform-origin: center center; }
.lightbox .lb-bar {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px; padding: 6px 10px; backdrop-filter: blur(4px);
}
.lightbox .lb-btn {
  border: none; background: rgba(255, 255, 255, 0.14); color: #fff;
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.lightbox .lb-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox .lb-zoom { color: #fff; font-size: 13px; min-width: 44px; text-align: center; user-select: none; }
.lightbox .lb-close { background: rgba(255, 80, 80, 0.85); }
.lightbox .lb-close:hover { background: rgba(255, 80, 80, 1); }
.lightbox .lb-count {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; background: rgba(0, 0, 0, 0.4);
  padding: 3px 12px; border-radius: 20px;
}

/* 前端轻提示 */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); padding: 9px 18px;
  font-size: 13px; color: var(--text-primary); z-index: 999;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { border-color: #fbb; color: var(--danger); }

/* 全文搜索结果下拉 */
.search-results {
  position: absolute; top: 44px; right: 0; width: 380px; max-width: 86vw;
  max-height: 64vh; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12); display: none; z-index: 120;
}
/* 结果区顶部粘性小结条：滚动时始终能看到"共 N 条 / 当前第几条" */
.sr-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 14px; font-size: 12px; color: var(--text-muted);
  background: #FAFBFC; border-bottom: 1px solid var(--border);
}
.sr-head .sr-head-n { color: var(--text-sub); font-weight: 500; }
.sr-head .sr-head-tip { font-size: 11px; color: var(--text-muted); }
.sr-item { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--hover-bg); }
.sr-item.active { background: var(--primary-light); box-shadow: inset 3px 0 0 var(--primary); }
.sr-item.active .sr-title { color: var(--primary); }
.sr-title { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.sr-group { font-size: 12px; color: var(--text-muted); margin: 2px 0; }
.sr-snippet { font-size: 12px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-snippet em.kw { color: var(--primary); font-style: normal; background: #FFF3A3; border-radius: 2px; padding: 0 1px; }
.sr-empty { padding: 14px; color: var(--text-muted); font-size: 13px; }
/* 滚动到底部自动追加下一批时的加载提示 */
.sr-more {
  padding: 9px 14px; text-align: center; font-size: 12px; color: var(--text-muted);
  background: #FAFBFC;
}
.sr-more.done { color: #B8BCC2; }

@media (max-width: 900px) {
  .container { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; order: 0; }
  .toc-side { position: static; max-height: none; order: 1; margin-bottom: 16px; }
  .content { order: 2; padding: 24px 20px 48px; }
  .header .nav { display: none; }
  .search-results { width: 300px; }
}

/* ===== 页脚（版权信息） ===== */
.site-footer {
  text-align: center;
  padding: 8px 16px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 8px;
  background: var(--bg-card);
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--primary); }

/* ===== MD 直连按钮（文档大标题行最右侧） ===== */
#docTitle { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
/* margin-left:auto 把按钮顶到标题行最右；标题过长换行时按钮仍独占右侧一段 */
.md-export-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: auto;
  font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1;
  color: var(--primary); background: var(--primary-light);
  border: 1px solid rgba(255, 36, 66, .25); border-radius: 8px;
  padding: 8px 12px; cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.md-export-btn svg { width: 14px; height: 14px; }
.md-export-btn:hover {
  background: #FFE3E7; border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(255, 36, 66, .15);
}

/* ===== MD 直连弹窗 ===== */
.md-export-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: mdMaskIn .15s ease;
}
@keyframes mdMaskIn { from { opacity: 0; } to { opacity: 1; } }
.md-export-dialog {
  width: 560px; max-width: 100%; background: #fff;
  border-radius: 14px; padding: 20px 22px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, .2);
  animation: mdDialogIn .18s ease;
}
@keyframes mdDialogIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.md-export-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.md-export-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.md-export-x {
  border: none; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text-muted); padding: 0 2px;
}
.md-export-x:hover { color: var(--text-primary); }
.md-export-desc { font-size: 13px; color: var(--text-sub, #6B7280); line-height: 1.7; margin: 0 0 14px; }
.md-export-linkrow { display: flex; gap: 8px; }
.md-export-linkrow input {
  flex: 1; min-width: 0; font-family: Consolas, Monaco, monospace; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  background: #F9FAFB; color: var(--text-primary);
}
.md-export-copy {
  flex-shrink: 0; font-family: inherit; font-size: 13px; font-weight: 600;
  color: #fff; background: var(--primary); border: none; border-radius: 8px;
  padding: 0 16px; cursor: pointer; transition: background .16s;
}
.md-export-copy:hover { background: var(--primary-hover); }
.md-export-actions { margin-top: 14px; text-align: right; }
.md-export-open { font-size: 12.5px; color: var(--primary); text-decoration: none; font-weight: 500; }
.md-export-open:hover { text-decoration: underline; }
