
:root {
  --bg: #ffffff;
  --bg-sidebar: #f8fafc;
  --bg-header: #0f172a;
  --bg-card: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.1);
  --tip-bg: #eff6ff;
  --tip-border: #3b82f6;
  --header-text: #f8fafc;
}
[data-theme="dark"] {
  --bg: #0b1120;
  --bg-sidebar: #111827;
  --bg-header: #020617;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #1f2937;
  --primary: #60a5fa;
  --primary-soft: rgba(96, 165, 250, 0.14);
  --tip-bg: rgba(59, 130, 246, 0.12);
  --tip-border: #60a5fa;
  --header-text: #f8fafc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 58px;
  background: var(--bg-header);
  color: var(--header-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand-badge {
  background: #2563eb;
  color: #fff;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-icon {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.88rem;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }
.menu-btn { display: none; }
.layout {
  display: flex;
  min-height: calc(100vh - 58px);
}
.sidebar {
  width: 310px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 58px);
  position: sticky;
  top: 58px;
}
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.sidebar-tab {
  flex: 1;
  padding: 10px 6px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.sidebar-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.search-box {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
  margin-bottom: 10px;
}
.toc-list { list-style: none; padding-left: 0; margin: 0; }
.toc-list .toc-list { padding-left: 14px; border-left: 1px solid var(--border); margin-left: 8px; }
.toc-item { margin: 2px 0; }
.toc-row { display: flex; align-items: center; gap: 4px; }
.toc-toggle {
  width: 22px; height: 22px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 0.75rem; border-radius: 4px;
}
.toc-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.toc-spacer { width: 22px; flex-shrink: 0; }
.toc-link {
  display: block; flex: 1; padding: 5px 8px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.toc-link:hover { background: var(--primary-soft); color: var(--primary); }
.toc-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.toc-children.collapsed { display: none; }
.main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 56px;
}
.content-wrap { max-width: 920px; margin: 0 auto; }
.breadcrumbs { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs a { color: var(--primary); text-decoration: none; }
article h1 { font-size: clamp(1.55rem, 2.5vw, 2.1rem); margin: 0 0 16px; line-height: 1.25; }
article h2 { font-size: 1.25rem; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
article p { margin: 0 0 14px; }
article ul { margin: 0 0 16px; padding-left: 22px; }
article li { margin-bottom: 7px; }
.callout-tip {
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 8px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 520px; }
.help-table th, .help-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.help-table th { background: var(--bg-card); font-weight: 600; }
.help-table tr:last-child td { border-bottom: none; }
.dl-link { color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap; }
.dl-link:hover { text-decoration: underline; }
.screenshot {
  margin: 18px 0;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}
.screenshot img { max-width: 100%; height: auto; border-radius: 6px; }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.pager a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); color: var(--text);
  text-decoration: none; font-size: 0.9rem; font-weight: 500;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.search-result {
  display: block; padding: 9px 10px; border-radius: 8px;
  text-decoration: none; color: var(--text); margin-bottom: 6px;
  border: 1px solid var(--border);
}
.search-result:hover { border-color: var(--primary); background: var(--primary-soft); }
.search-result small { display: block; color: var(--text-muted); font-size: 0.8rem; }
.kw-item { display: block; padding: 5px 8px; color: var(--primary); text-decoration: none; font-size: 0.88rem; }
.kw-item:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; left: -320px; top: 58px; z-index: 40;
    transition: left 0.2s ease; box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  .sidebar.open { left: 0; }
  .main { padding: 20px 16px 44px; }
}
