:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel2: #f0f3f7;
  --line: #e2e8f0;
  --text: #1a2332;
  --muted: #64748b;
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --ok: #16a34a;
  --warn: #ca8a04;
  --err: #dc2626;
  --get: #16a34a;
  --post: #2563eb;
  --patch: #ca8a04;
  --delete: #dc2626;
  --radius: 10px;
  /* 仅系统中文字体，不加载 Google Fonts / 任何外链字体 */
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: Consolas, "Courier New", "Microsoft YaHei UI", monospace;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

code, pre { font-family: var(--mono); font-size: 0.9em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
  overflow: visible;
}
.top-nav { overflow: visible; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff; font-weight: 700;
  flex-shrink: 0;
}
/* 像素 B logo：最近邻放大，保持锯齿像素感 */
img.logo.logo-img {
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  object-fit: contain;
}
.brand strong { display: block; font-size: 1.05rem; color: var(--text); }
.brand small { color: var(--muted); font-size: 0.78rem; }

.top-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.top-nav a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.top-nav a:hover { background: var(--panel2); color: var(--text); }
.top-nav a.active { background: #eff6ff; color: var(--accent); font-weight: 600; }
.top-nav a.btn {
  background: var(--accent2);
  color: #fff;
  font-weight: 600;
}
.top-nav a.btn:hover { background: var(--accent); text-decoration: none; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 22px; }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  border: 1px solid var(--line);
}
.alert.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.layout-2 {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .layout-2 { grid-template-columns: 1fr; }
}

.side, .content, .card, .endpoint, .api-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.side { padding: 14px; position: sticky; top: 76px; }
.side h2 { margin: 0 0 12px; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.badge {
  background: var(--panel2);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
}

.table-list { list-style: none; margin: 0; padding: 0; }
.table-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 10px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  border: 1px solid transparent;
}
.table-list a span { grid-column: 1 / -1; font-size: 0.78rem; color: var(--muted); }
.table-list a em { font-style: normal; color: var(--muted); font-size: 0.78rem; }
.table-list a:hover { background: var(--panel2); }
.table-list a.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.content { padding: 18px 20px 24px; }
.panel-head h1 { margin: 0 0 6px; font-size: 1.35rem; color: var(--text); }
.panel-head p { margin: 0; color: var(--muted); }
.content h3, .api-group h2 { margin: 22px 0 10px; font-size: 1rem; color: var(--text); }
.hint, .muted { color: var(--muted); font-size: 0.9rem; }
.hint code { color: #334155; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data th {
  background: var(--panel2);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
table.data td code {
  color: #0f172a;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
}
table.data.compact th, table.data.compact td { padding: 6px 10px; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafbfc; }

.plain { margin: 0; padding-left: 18px; }
.plain li { margin: 4px 0; }
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel2);
  color: var(--muted);
  vertical-align: middle;
}
.tag.lock { background: #fef9c3; color: #a16207; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 16px 0 8px;
}
.card { padding: 14px 16px; }
.card h3 { margin: 0 0 10px; font-size: 0.95rem; }
.card pre {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  color: #1e293b;
}
.card pre.err {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.api-page .panel-head { margin-bottom: 8px; }
.api-group { padding: 16px 18px 8px; margin: 16px 0; }
.endpoint {
  padding: 12px 14px;
  margin: 0 0 12px;
  background: #fafbfc;
  border: 1px solid var(--line);
  box-shadow: none;
}
.endpoint header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.method {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  color: #fff;
  min-width: 58px;
  text-align: center;
  background: #64748b; /* 兜底，避免无匹配 class 时白字不可见 */
}
.m-get { background: var(--get); }
.m-post { background: var(--post); }
.m-patch, .m-put { background: var(--patch); color: #fff; }
.m-delete { background: var(--delete); }
/* 多方法 GET|POST 等 */
.m-multi { background: #6366f1; color: #fff; }
.path { font-size: 0.95rem; color: #0f172a; }
.summary { margin: 0 0 8px; color: #334155; }
.endpoint h4 { margin: 10px 0 4px; font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.notes {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  color: #1e40af;
  font-size: 0.88rem;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 22px 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  color: var(--muted);
  font-size: 0.82rem;
}
.foot code {
  color: #475569;
  background: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
  word-break: break-all;
}

/* ========== GitBook 式 API 文档 ========== */
body.page-api {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
body.page-api .top { flex-shrink: 0; }
body.page-api .wrap {
  flex: 1;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
  min-height: 0;
  overflow: hidden;
}

.gb {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  min-height: 0;
  background: #fff;
}
@media (max-width: 860px) {
  .gb { grid-template-columns: 1fr; }
  .gb-side {
    position: relative !important;
    height: auto !important;
    max-height: 40vh;
    border-right: 0 !important;
    border-bottom: 1px solid var(--line);
  }
}

.gb-side {
  border-right: 1px solid var(--line);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.gb-side-head {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.gb-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}
.gb-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 2px 0 10px;
}
.gb-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
.gb-search:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.gb-nav {
  overflow-y: auto;
  padding: 10px 8px 24px;
  flex: 1;
}
.gb-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.35;
  border: 1px solid transparent;
}
.gb-link:hover {
  background: #eef2f7;
  text-decoration: none;
  color: #0f172a;
}
.gb-link.active,
.gb-group-title.active {
  background: #eff6ff;
  color: var(--accent);
  border-color: #bfdbfe;
  font-weight: 600;
}
.gb-link.ep {
  padding-left: 12px;
  font-size: 0.84rem;
  color: #475569;
  min-width: 0; /* 允许子项 ellipsis */
  gap: 6px;
}
.gb-ep-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.gb-group { margin: 6px 0; }
.gb-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #0f172a;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 700;
  border: 1px solid transparent;
}
.gb-group-title:hover {
  background: #eef2f7;
  text-decoration: none;
}
.gb-caret {
  display: inline-flex;
  width: 16px;
  color: #94a3b8;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.gb-group.open > .gb-group-title .gb-caret {
  transform: rotate(90deg);
}
.gb-group > .gb-link.ep {
  display: none;
}
.gb-group.open > .gb-link.ep {
  display: flex;
}

.method.mini {
  font-size: 0.62rem;
  min-width: 38px;
  max-width: 52px;
  padding: 2px 5px;
  flex: 0 0 auto;
  letter-spacing: 0.02em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gb-doc {
  overflow-y: auto;
  height: 100%;
  background: #fff;
}
.gb-doc-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 36px 64px;
}
.gb-crumb {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}
.gb-crumb a { color: var(--muted); }
.gb-crumb a:hover { color: var(--accent); }

.gb-doc h1 {
  margin: 0 0 12px;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.25;
}
.gb-doc h2 {
  margin: 32px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 1.2rem;
  color: #0f172a;
}
.gb-doc h2:first-of-type { border-top: 0; padding-top: 0; }
.gb-doc h3 {
  margin: 20px 0 8px;
  font-size: 1rem;
  color: #1e293b;
}
.gb-lead {
  font-size: 1.02rem;
  color: #475569;
  margin: 0 0 20px;
  line-height: 1.7;
}
.gb-ol, .gb-ul {
  margin: 0 0 16px;
  padding-left: 1.35rem;
  color: #334155;
  line-height: 1.75;
}
.gb-doc code {
  background: #f1f5f9;
  color: #0f172a;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

.gb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.gb-table th, .gb-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.gb-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  width: 28%;
  white-space: nowrap;
}
.gb-table thead th { width: auto; }
.gb-table tr:last-child th,
.gb-table tr:last-child td { border-bottom: 0; }
.gb-table tbody tr:hover td { background: #fafbfc; }

.gb-code {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  color: #0f172a;
  font-size: 0.88rem;
  line-height: 1.55;
}
.gb-code.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.gb-endpoint-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.gb-endpoint-bar .path {
  font-size: 1rem;
  color: #0f172a;
  word-break: break-all;
}

.gb-callout {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: #1e3a8a;
  font-size: 0.92rem;
  line-height: 1.6;
}

.gb-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.gb-pager a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.gb-pager a:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
  text-decoration: none;
}
.gb-pager a span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.gb-pager a strong {
  font-size: 0.95rem;
  color: #0f172a;
  font-weight: 600;
}
.gb-pager-next { text-align: right; }

/* ========== 模拟请求面板 ========== */
.try-jump {
  display: inline-block;
  margin: 0 0 12px;
  padding: 8px 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.try-jump:hover { background: #dbeafe; text-decoration: none; }

.try-panel {
  margin: 8px 0 24px;
  padding: 16px 16px 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.try-head { margin-bottom: 12px; }
.try-title {
  margin: 0 0 6px !important;
  padding: 0 !important;
  border: 0 !important;
  font-size: 1.05rem !important;
  color: #0f172a;
}
.try-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}
.try-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.try-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}
.try-select,
.try-url,
.try-token,
.try-body {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-family: var(--mono);
  background: #fff;
  color: #0f172a;
  outline: none;
}
.try-select:focus,
.try-url:focus,
.try-token:focus,
.try-body:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.try-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.try-row .method { flex-shrink: 0; }
.try-url { flex: 1; }
.try-url[readonly] {
  background: #f1f5f9;
  color: #334155;
}
.try-auth-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.try-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: #334155;
  white-space: nowrap;
}
.try-token { flex: 1; min-width: 180px; }
.try-body {
  min-height: 180px;
  resize: vertical;
  line-height: 1.45;
}
.try-file-wrap { margin-top: 4px; }
.try-file-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 16px;
  border: 1px dashed #93c5fd;
  border-radius: 10px;
  background: #f8fbff;
}
/* 原生 input 仍可点，但用按钮样式盖在交互上更清晰 */
.try-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}
.try-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff !important;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none !important;
  user-select: none;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.try-file-btn:hover {
  background: var(--accent2);
}
.try-file-btn::before {
  content: "📁";
  font-size: 1.1rem;
}
.try-file-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.try-file-name {
  font-size: 0.9rem;
  color: #334155;
  word-break: break-all;
}
.try-file-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.try-hint { margin: 6px 0 0; font-size: 0.82rem; }
.try-meta { margin: 6px 0 0; font-size: 0.82rem; }
.try-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
}
.try-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: #334155;
}
.try-btn:hover { background: #f1f5f9; }
.try-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.try-btn.primary:hover { background: var(--accent2); }
.try-btn.primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.try-btn.ghost { background: #fff; }
.try-status {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
}
.try-status.is-ok { color: var(--ok); font-weight: 600; }
.try-status.is-err { color: var(--err); font-weight: 600; }
.try-response {
  margin: 0;
  padding: 12px 14px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.5;
  min-height: 80px;
  white-space: pre-wrap;
  word-break: break-word;
}
.try-response.is-err {
  background: #1c1917;
  color: #fecaca;
}
@media (max-width: 640px) {
  .try-auth-row { flex-direction: column; align-items: stretch; }
  .try-token { min-width: 0; }
}
