/* === 全局 === */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

:root {
  --c-bg:       #f8f9fa;
  --c-white:    #ffffff;
  --c-text:     #2c3e50;
  --c-muted:    #6b7280;
  --c-border:   #e5e7eb;
  --c-primary:  #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-code-bg:  #1e293b;
  --sidebar-w:  230px;
  --toc-w:      180px;
  --topbar-h:   56px;
}

body {
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.8;
  font-size: 15px;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === 顶部导航 === */
.topbar {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top:0; z-index:100;
  height: var(--topbar-h);
}
.topbar-inner {
  max-width: 94%; margin:0 auto;
  display:flex; align-items:center;
  height:100%; padding:0 24px; gap:28px;
}
.logo {
  font-weight:700; font-size:18px; color:var(--c-text);
  white-space:nowrap;
}
.top-nav { display:flex; gap:20px; }
.top-nav a {
  color:var(--c-muted); font-size:14px; white-space:nowrap;
}
.top-nav a:hover, .top-nav a.active { color:var(--c-primary); text-decoration:none; }

/* 搜索 */
.search-box { position:relative; margin-left:auto; }
.search-box input {
  width:200px; padding:6px 12px;
  border:1px solid var(--c-border); border-radius:6px;
  font-size:13px; outline:none; transition:border-color .2s;
}
.search-box input:focus { border-color:var(--c-primary); }
.search-dropdown {
  display:none; position:absolute; top:100%; right:0;
  width:300px; background:var(--c-white);
  border:1px solid var(--c-border); border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.1);
  max-height:360px; overflow-y:auto; z-index:200;
}
.search-dropdown.show { display:block; }
.search-dropdown a {
  display:block; padding:10px 14px; font-size:14px;
  border-bottom:1px solid var(--c-border); color:var(--c-text);
}
.search-dropdown a:hover { background:#f0f4ff; text-decoration:none; }
.search-dropdown .no-result { padding:14px; color:var(--c-muted); font-size:13px; }

/* === 三栏布局 === */
.page {
  max-width: 94%; margin:0 auto;
  display:flex; gap:0;
}

/* === 左侧边栏 === */
.sidebar {
  width:var(--sidebar-w); min-width:var(--sidebar-w);
  background:#dde1e6;
  border-right:1px solid var(--c-border);
  padding:20px 0; overflow-y:auto;
  height:calc(100vh - var(--topbar-h));
  position:sticky; top:var(--topbar-h);
}
.sidebar-title { font-weight:700; font-size:13px; color:var(--c-muted); padding:0 20px 12px; text-transform:uppercase; letter-spacing:.5px; }
.nav-tree { list-style:none; }
.nav-tree li { }
.nav-tree .category {
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 20px; font-size:14px; font-weight:600; color:var(--c-text);
  cursor:pointer; user-select:none;
}
.nav-tree .category:hover { background:#f0f4ff; }
.nav-tree .category .arrow { font-size:10px; transition:transform .2s; color:var(--c-muted); }
.nav-tree .category.open .arrow { transform:rotate(90deg); }
.nav-tree .sub-items { list-style:none; display:none; }
.nav-tree .sub-items.show { display:block; }
.nav-tree .sub-items a {
  display:block; padding:6px 20px 6px 36px; font-size:13px;
  color:var(--c-muted); border-left:3px solid transparent;
}
.nav-tree .sub-items a:hover, .nav-tree .sub-items a.active {
  color:var(--c-primary); background:#f0f4ff;
  border-left-color:var(--c-primary); text-decoration:none;
}
.nav-tree .sub-items .disabled-link {
  display:block; padding:6px 20px 6px 36px; font-size:13px;
  color:#8b95a6; cursor:default; user-select:none;
  border-left:3px solid transparent;
}
.nav-tree .sub-items .disabled-link:hover {
  background:transparent; border-left-color:transparent; text-decoration:none;
}
.nav-tree .sub-items .disabled-link em {
  font-size:11px; font-style:normal; color:#a8b0be;
}

/* === 主内容 === */
.intro-text {
  line-height: 1.5;
  padding-left: 1.2em;
  margin-bottom: 28px;
}
.content {
  flex:1; min-width:0;
  padding:40px 40px 80px;
}
.content h1 { font-size:30px; margin-bottom:8px; }
.content .subtitle { color:var(--c-muted); margin-bottom:36px; }
.content h2 { font-size:22px; margin:40px 0 16px; padding-bottom:8px; border-bottom:1px solid var(--c-border); }
.content h3 { font-size:18px; margin:28px 0 10px; }
.content p { margin-bottom:16px; }
.content ul, .content ol { margin:0 0 16px 24px; }
.content li { margin-bottom:6px; }
.content pre {
  background:var(--c-code-bg); color:#e2e8f0;
  padding:16px 20px; border-radius:8px;
  overflow-x:auto; font-size:14px; line-height:1.7;
  margin-bottom:20px;
}
.content code {
  font-family: "JetBrains Mono", "Fira Code", "Consolas", "Source Code Pro", monospace;
  font-size:13px;
}
.content :not(pre) > code {
  background:#f1f5f9; padding:2px 6px; border-radius:4px;
  color:#e11d48; font-size:13px;
}
.content table {
  width:100%; border-collapse:collapse; margin-bottom:20px;
}
.content th, .content td {
  text-align:left; padding:10px 14px;
  border-bottom:1px solid var(--c-border);
}
.content th { font-size:13px; color:var(--c-muted); font-weight:600; }
.content td { font-size:14px; }
.content .note {
  background:#fef3c7; border-left:4px solid #f59e0b;
  padding:14px 18px; border-radius:0 8px 8px 0; margin-bottom:20px;
}
.content .note strong { color:#92400e; }
.content .warning {
  background:#fee2e2; border-left:4px solid #ef4444;
  padding:14px 18px; border-radius:0 8px 8px 0; margin-bottom:20px;
}
.content .warning strong { color:#991b1b; }

/* 卡片 */
.cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px,1fr)); gap:20px; margin-bottom:40px; }
.card {
  background:var(--c-white); border:1px solid var(--c-border);
  border-radius:8px; padding:24px;
}
.card h3 { margin:0 0 8px; font-size:17px; }
.card p { color:var(--c-muted); font-size:14px; margin-bottom:12px; }
.card a { font-size:14px; font-weight:600; }

/* 更新表格 */
.update-table { margin-top:12px; }

/* === 右侧目录 === */
.toc {
  width:var(--toc-w); min-width:var(--toc-w);
  padding:24px 20px; position:sticky; top:var(--topbar-h);
  height:calc(100vh - var(--topbar-h)); overflow-y:auto;
  font-size:13px;
}
.toc-title { font-weight:700; font-size:12px; color:var(--c-muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:12px; }
.toc ul { list-style:none; }
.toc a { display:block; padding:3px 0; color:var(--c-muted); }
.toc a:hover, .toc a.active { color:var(--c-primary); text-decoration:none; }

/* === 下载页 === */
.download-table { margin-top:20px; }
.download-table .size { color:var(--c-muted); font-size:13px; white-space:nowrap; }
.download-table .btn-dl {
  display:inline-block; padding:4px 14px;
  background:var(--c-primary); color:#fff; border-radius:4px;
  font-size:13px; white-space:nowrap;
}
.download-table .btn-dl:hover { background:var(--c-primary-dark); text-decoration:none; }

/* === 页脚 === */
footer {
  margin:0 auto;
  padding:24px; border-top:1px solid var(--c-border);
  color:var(--c-muted); font-size:13px; text-align:center;
}

/* === 响应式 === */
@media (max-width:1100px) {
  .toc { display:none; }
}

@media (max-width:768px) {
  .sidebar {
    position:fixed; left:-280px; top:var(--topbar-h); z-index:90;
    transition:left .3s; height:calc(100vh - var(--topbar-h));
    box-shadow:4px 0 20px rgba(0,0,0,.1);
  }
  .sidebar.open { left:0; }
  .content { padding:24px 16px 60px; }
  .top-nav { display:none; }
  .cards { grid-template-columns:1fr; }

  /* 移动端菜单按钮 */
  .menu-btn {
    display:flex; align-items:center; justify-content:center;
    width:36px; height:36px; cursor:pointer;
    font-size:20px; color:var(--c-text);
  }
}

@media (min-width:769px) {
  .menu-btn { display:none; }
}
