:root {
    --primary: #8B55FC; --primary-light: #F3EEFF; --primary-hover: #7441E8;
    --text: #1E293B; --text-secondary: #64748B; --text-muted: #94A3B8;
    --border: #E8E8EF; --bg: #FFFFFF; --bg-soft: #F8F8FB; --bg-hover: #F7F5FF;
    --code-bg: #15151C;
    --sidebar-width: 250px; --header-height: 64px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0; overflow: hidden;
    background: var(--bg); color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px; line-height: 1.7;
}
p { margin: 0 0 20px; color: var(--text-secondary); }
h1 { margin: 0 0 16px; font-size: 34px; line-height: 1.25; letter-spacing: -.02em; }
h2 { margin: 0 0 12px; font-size: 25px; line-height: 1.35; letter-spacing: -.015em; }

/* Topbar */
.topbar {
    position: fixed; inset: 0 0 auto 0; height: var(--header-height);
    display: flex; align-items: center;
    background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); z-index: 1000;
}
.topbar-logo { width: var(--sidebar-width); height: 100%; display: flex; align-items: center; padding: 0 24px; border-right: 1px solid var(--border); }
.logo-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--primary); color: #fff; font-size: 16px; font-weight: 700; }
.topbar-content { flex: 1; height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.version-badge { padding: 4px 10px; border-radius: 6px; background: var(--primary-light); color: var(--primary); font-size: 12px; font-weight: 600; }
.online-badge { display: flex; align-items: center; gap: 6px; color: #16A34A; font-size: 12px; font-weight: 500; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; }
.menu-btn { display: none; border: 0; background: transparent; font-size: 20px; color: var(--text-secondary); cursor: pointer; }

/* Sidebar */
.sidebar {
    position: fixed; top: var(--header-height); left: 0; bottom: 0; width: var(--sidebar-width);
    padding: 24px 14px; overflow-y: auto; background: #fff; border-right: 1px solid var(--border); z-index: 900;
}
.sidebar-title { padding: 0 12px; margin-bottom: 10px; color: var(--text-muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav-item {
    width: 100%; display: flex; align-items: center; min-height: 38px; padding: 8px 12px;
    border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary);
    font: inherit; font-size: 13px; text-align: left; cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-hover); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-group { margin-top: 4px; }
.nav-group-header { display: flex; align-items: center; }
.nav-group-header .nav-item { flex: 1; }
.nav-arrow { width: 28px; height: 28px; margin-right: 3px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; }
.nav-arrow:hover { background: var(--bg-hover); color: var(--primary); }
.nav-arrow span { display: inline-block; font-size: 12px; transition: transform .18s; }
.nav-group.open .nav-arrow span { transform: rotate(90deg); }
.nav-submenu { display: none; padding-left: 14px; }
.nav-group.open .nav-submenu { display: block; }
.nav-submenu .nav-item { min-height: 34px; padding-left: 20px; font-size: 12px; }

/* Main：每个菜单项一屏，滚动只发生在内容区内 */
.main { position: fixed; top: var(--header-height); left: var(--sidebar-width); right: 0; bottom: 0; overflow-y: auto; }
.content { max-width: 1000px; margin: 0 auto; padding: 48px 48px 80px; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.intro { max-width: 760px; }
.intro p { font-size: 15px; line-height: 1.9; }
.info-card { margin-top: 30px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); }
.info-card-title { margin-bottom: 8px; font-size: 13px; font-weight: 600; }
.info-card p { margin: 0; font-size: 13px; }

/* Endpoint */
.endpoint { margin-top: 30px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.endpoint-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.method { padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.method.get { background: #DCFCE7; color: #15803D; }
.method.post { background: #DBEAFE; color: #1D4ED8; }
.method.put { background: #FEF9C3; color: #A16207; }
.method.del { background: #FEE2E2; color: #DC2626; }
.endpoint-path { font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; font-weight: 600; }
.endpoint-body { padding: 22px; }
.endpoint-description { margin-bottom: 24px; color: var(--text-secondary); font-size: 13px; }
.block { margin-bottom: 28px; }
.block-title { margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 12px; border: 1px solid var(--border); text-align: left; }
.table th { background: var(--bg-soft); color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.table td { color: var(--text-secondary); }
.table code, .mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.param-name { font-family: "SFMono-Regular", Consolas, monospace; color: var(--text); }
.required { display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 4px; background: #FEF2F2; color: #DC2626; font-size: 10px; }

/* Code selector */
.code-selector { margin: 24px 0 12px; padding: 16px 18px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; }
.code-selector-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.code-selector-row + .code-selector-row { margin-top: 14px; }
.code-selector-title { width: 82px; flex-shrink: 0; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.code-selector-options { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.code-option {
    display: inline-flex; align-items: center; justify-content: center; min-width: 88px; height: 36px; padding: 0 16px;
    border: 1px solid #E2E2EA; border-radius: 8px; background: #fff; color: #475569;
    font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; user-select: none;
    transition: background .15s, border-color .15s, color .15s;
}
.code-option:hover { border-color: #CFC2FF; background: var(--bg-hover); color: var(--primary-hover); }
.code-option.active { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(139,85,252,.18); }
.code-option.active:hover { border-color: var(--primary-hover); background: var(--primary-hover); color: #fff; }
.code-option-icon { margin-right: 7px; font-size: 10px; font-weight: 700; }
.code-demo { margin-bottom: 28px; }

/* Code block（Prism tomorrow 主题 + 自定义底色） */
.code-wrapper { position: relative; margin-top: 12px; border-radius: 10px; overflow: hidden; background: var(--code-bg); }
.code-wrapper pre[class*="language-"] { margin: 0; padding: 22px; border-radius: 0; background: var(--code-bg); font-size: 13px; line-height: 1.7; }
.code-wrapper code[class*="language-"] { background: none; font-family: "SFMono-Regular", Consolas, Menlo, monospace; text-shadow: none; }
.copy-btn { position: absolute; top: 10px; right: 10px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; background: rgba(255,255,255,.08); color: #CBD5E1; font-size: 11px; cursor: pointer; z-index: 2; }
.copy-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

@media (max-width: 800px) {
    .topbar-logo { width: auto; border-right: 0; }
    .topbar-content { padding: 0 16px; }
    .topbar-title { display: none; }
    .menu-btn { display: block; }
    .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 8px 30px rgba(15,23,42,.12); }
    .sidebar.open { transform: none; }
    .main { left: 0; }
    .content { padding: 32px 20px 80px; }
    .endpoint-body { padding: 16px; }
    .table { display: block; overflow-x: auto; }
    .code-selector-title { width: 100%; }
}

/* 未选中的代码块隐藏 */
.code-wrapper pre[hidden] { display: none !important; }
.code-option[hidden] { display: none; }
.error-tip { padding: 20px; border: 1px solid #FECACA; border-radius: 10px; background: #FEF2F2; color: #B91C1C; font-size: 13px; }
