/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #2f6bff;
  --accent-light: #eef3ff;
  --text: #1a1f2e;
  --text-secondary: #5a6478;
  --border: #e4e8f0;
  --bg: #ffffff;
  --bg-soft: #f7f9fc;
  --code-bg: #0f1420;
  --code-text: #e6ebf5;
  --warning-bg: #fff8e6;
  --warning-border: #f0c36d;
  --note-bg: #eef3ff;
  --note-border: #2f6bff;
}

html { scroll-behavior: smooth; }

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

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

code {
  font-family: "SF Mono", "JetBrains Mono", Consolas, Menlo, monospace;
  font-size: 0.88em;
  background: var(--accent-light);
  color: #2453c7;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* ===== 顶栏 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f6bff, #6a3df5);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.brand-name { font-weight: 600; font-size: 16px; }

.header-nav { display: flex; gap: 22px; font-size: 14px; }
.header-nav a { color: var(--text-secondary); }
.header-nav a:hover { color: var(--accent); text-decoration: none; }

/* ===== 布局 ===== */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* ===== 侧边栏 ===== */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 24px 0 40px;
  border-right: 1px solid var(--border);
}

.sidebar-search { margin-bottom: 18px; }

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: var(--bg-soft);
  transition: border-color 0.15s;
}

.sidebar-search input:focus { border-color: var(--accent); background: #fff; }

.nav-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 18px 0 8px;
}

.nav-group-title:first-child { margin-top: 0; }

.nav-link {
  display: block;
  padding: 6px 12px;
  margin-left: -12px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.15s;
}

.nav-link:hover { color: var(--accent); background: var(--bg-soft); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-light); font-weight: 500; }

/* ===== 内容区 ===== */
.content {
  flex: 1;
  min-width: 0;
  padding: 40px 0 80px;
  max-width: 780px;
}

.doc-section { margin-bottom: 64px; scroll-margin-top: 72px; }
.doc-section:last-of-type { margin-bottom: 0; }

h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 14px;
}

h3 { font-size: 16px; font-weight: 600; margin: 20px 0 10px; }

p { margin-bottom: 14px; }

.lead { font-size: 16px; color: var(--text-secondary); margin-bottom: 20px; }

.doc-section > p:last-child { margin-bottom: 0; }

/* ===== 表格 ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
}

th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
td code { white-space: nowrap; }

/* ===== 代码块 ===== */
.code-block {
  position: relative;
  margin: 14px 0 20px;
  border-radius: 10px;
  background: var(--code-bg);
  overflow: hidden;
}

.code-block pre {
  padding: 16px 18px;
  overflow-x: auto;
}

.code-block code {
  background: none;
  color: var(--code-text);
  padding: 0;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 12px;
  font-size: 12px;
  color: #9aa7bd;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  font-family: inherit;
}

.code-block:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.16); }
.copy-btn.copied { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }

/* ===== 提示框 ===== */
.callout {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  background: var(--bg-soft);
}

.callout p:last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.callout-note { background: var(--note-bg); border-left-color: var(--note-border); }
.callout-note .callout-title { color: var(--accent); }
.callout-warning { background: var(--warning-bg); border-left-color: var(--warning-border); }
.callout-warning .callout-title { color: #b45309; }

/* ===== 工具卡片 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0 8px;
}

.tool-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: all 0.15s;
  background: #fff;
}

.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(47, 107, 255, 0.08);
  text-decoration: none;
  transform: translateY(-1px);
}

.tool-card h3 { margin: 0 0 6px; font-size: 15px; }
.tool-card p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* ===== 页脚 ===== */
.site-footer {
  margin-top: 72px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===== 响应式 ===== */
@media (max-width: 960px) {
  .layout { flex-direction: column; gap: 0; }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
  }
  .content { max-width: 100%; padding-top: 24px; }
}
