/* ========================================
   文档页样式（docs.html）
   与主应用保持一致的深色主题与配色
   ======================================== */

:root {
    --bg-primary: #1a1c23;
    --bg-secondary: #262933;
    --bg-tertiary: #2d303a;
    --bg-card: #2d303a;
    --bg-code: #1a1c23;
    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: #888;
    --accent-gold: #e6c78a;
    --accent-gold-rgb: 230, 199, 138;
    --accent-blue: #6fa8ff;
    --accent-green: #7cd5a4;
    --accent-orange: #f0a878;
    --accent-purple: #b89ce8;
    --border-color: #333;
    --border-light: rgba(255, 255, 255, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition-fast: 0.2s;
    --sidebar-width: 260px;
    --content-max-width: 880px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: auto; min-height: 100%; scroll-behavior: smooth; }
html.docs-html, body.docs-page { overflow: visible !important; }

body.docs-page {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    min-height: 100dvh;
    /* 重置主应用 body 的居中布局 & 隐藏溢出 */
    display: block !important;
    justify-content: initial;
    align-items: initial;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 !important;
}

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

/* 顶部导航栏 */
.docs-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(26, 28, 35, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.docs-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.docs-brand i { color: var(--accent-gold); font-size: 1.4rem; }

.docs-topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.docs-topbar-nav a {
    color: var(--text-secondary);
    font-size: 0.92rem;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.docs-topbar-nav a:hover {
    background: rgba(var(--accent-gold-rgb), 0.12);
    color: var(--accent-gold);
    text-decoration: none;
}

.docs-topbar-nav .nav-primary {
    background: rgba(var(--accent-gold-rgb), 0.15);
    color: var(--accent-gold);
}

/* 主体布局 */
.docs-shell {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

/* 左侧目录 */
.docs-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 24px 16px;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    scrollbar-width: thin;
}

.docs-sidebar::-webkit-scrollbar { width: 6px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.docs-sidebar-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 10px;
}

.docs-toc { list-style: none; }
.docs-toc li { margin-bottom: 2px; }
.docs-toc a {
    display: block;
    padding: 7px 10px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    transition: all var(--transition-fast);
}

.docs-toc a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    text-decoration: none;
}

.docs-toc a.active {
    background: rgba(var(--accent-gold-rgb), 0.1);
    color: var(--accent-gold);
    border-left-color: var(--accent-gold);
}

.docs-toc .toc-sub a {
    padding-left: 24px;
    font-size: 0.86rem;
}

/* 主内容区 */
.docs-main {
    flex: 1;
    padding: 40px 48px 80px;
    min-width: 0;
    max-width: 100%;
}

.docs-article {
    max-width: var(--content-max-width);
    margin: 0 auto;
}

/* 文档内容排版 */
.docs-article h1 {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 16px;
    scroll-margin-top: 80px;
}

.docs-article h2 {
    font-size: 1.7rem;
    margin: 48px 0 16px;
    padding-top: 12px;
    color: var(--accent-gold);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    scroll-margin-top: 80px;
}

.docs-article h3 {
    font-size: 1.3rem;
    margin: 32px 0 12px;
    color: var(--text-primary);
    padding-left: 12px;
    border-left: 3px solid var(--accent-gold);
    scroll-margin-top: 80px;
}

.docs-article h4 {
    font-size: 1.1rem;
    margin: 24px 0 10px;
    color: var(--accent-blue);
    scroll-margin-top: 80px;
}

.docs-article p {
    margin-bottom: 14px;
    color: #d4d4d4;
}

.docs-article ul, .docs-article ol {
    margin: 14px 0 14px 24px;
    color: #d4d4d4;
}

.docs-article li { margin-bottom: 6px; }

.docs-article strong { color: var(--accent-gold); font-weight: 600; }
.docs-article em { color: var(--accent-orange); font-style: normal; }

.docs-article code {
    background: var(--bg-code);
    color: var(--accent-green);
    padding: 2px 7px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 0.88em;
    border: 1px solid var(--border-color);
}

.docs-article pre {
    background: var(--bg-code);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 0.9em;
    line-height: 1.55;
}

.docs-article pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #d4d4d4;
}

.docs-article hr {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 32px 0;
}

/* 信息卡片 */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 20px 0;
    border-left: 4px solid var(--accent-gold);
}

.info-card.tip { border-left-color: var(--accent-blue); }
.info-card.warn { border-left-color: var(--accent-orange); }
.info-card.danger { border-left-color: #ff6b6b; }
.info-card.success { border-left-color: var(--accent-green); }

.info-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--accent-gold);
}

.info-card.tip .info-card-title { color: var(--accent-blue); }
.info-card.warn .info-card-title { color: var(--accent-orange); }
.info-card.danger .info-card-title { color: #ff6b6b; }
.info-card.success .info-card-title { color: var(--accent-green); }

.info-card p:last-child { margin-bottom: 0; }
.info-card i { font-size: 1.1em; }

/* 步骤列表 */
.step-list {
    counter-reset: step;
    list-style: none;
    margin: 20px 0;
    padding-left: 0;
}

.step-list > li {
    counter-increment: step;
    position: relative;
    padding: 14px 14px 14px 56px;
    margin-bottom: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 56px;
}

.step-list > li::before {
    content: counter(step);
    position: absolute;
    left: 14px;
    top: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.step-list > li strong { display: block; margin-bottom: 4px; color: var(--text-primary); }

/* 平台卡片网格 */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.platform-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: all var(--transition-fast);
}

.platform-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.platform-card .pc-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.platform-card .pc-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(var(--accent-gold-rgb), 0.15);
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.platform-card h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.platform-card .pc-tag {
    display: inline-block;
    background: rgba(var(--accent-gold-rgb), 0.12);
    color: var(--accent-gold);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.platform-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* 表格 */
.docs-table-wrap { overflow-x: auto; margin: 16px 0; }

.docs-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    font-size: 0.92rem;
}

.docs-table th, .docs-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.docs-table th {
    background: var(--bg-tertiary);
    color: var(--accent-gold);
    font-weight: 600;
}

.docs-table tr:last-child td { border-bottom: none; }
.docs-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* 功能介绍卡片 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.feature-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.feature-item .fi-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.feature-item .fi-head i {
    color: var(--accent-gold);
    font-size: 1.2rem;
}

.feature-item h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.feature-item p {
    font-size: 0.86rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.55;
}

/* 计费方式对比 */
.bill-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 20px 0;
}

.bill-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
}

.bill-card h4 {
    margin: 0 0 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bill-card.token-bill h4 i { color: var(--accent-blue); }
.bill-card.count-bill h4 i { color: var(--accent-orange); }

.bill-card .bill-price {
    font-size: 1.4rem;
    color: var(--accent-gold);
    margin: 8px 0;
    font-weight: 600;
}

.bill-card ul {
    list-style: none;
    margin: 12px 0;
    padding: 0;
}

.bill-card ul li {
    padding: 4px 0 4px 22px;
    position: relative;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.bill-card ul li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--accent-gold);
    font-weight: bold;
}

/* 关键路径标记 */
.kbd {
    display: inline-block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-bottom-width: 2px;
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.85em;
}

/* 文档底部导航 */
.docs-pager {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.docs-pager a {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.docs-pager a:hover {
    border-color: var(--accent-gold);
    text-decoration: none;
}

.docs-pager a strong {
    display: block;
    color: var(--accent-gold);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

/* 角色字段说明 */
.field-list {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 16px 0;
}

.field-list .field-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: start;
}

.field-list .field-row:last-child { border-bottom: none; }

.field-list .field-name {
    color: var(--accent-gold);
    font-weight: 600;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.field-list .field-desc {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* 移动端目录按钮 */
.docs-toc-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-primary);
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    align-items: center;
    justify-content: center;
}

/* 响应式 */
@media (max-width: 960px) {
    .docs-sidebar {
        position: fixed;
        left: 0;
        top: 60px;
        height: calc(100vh - 60px);
        z-index: 150;
        transform: translateX(-100%);
        transition: transform 0.3s;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.4);
    }

    .docs-sidebar.open { transform: translateX(0); }

    .docs-toc-toggle { display: flex; }

    .docs-main { padding: 24px 20px 60px; }

    .docs-article h1 { font-size: 1.7rem; }
    .docs-article h2 { font-size: 1.4rem; }
    .docs-article h3 { font-size: 1.15rem; }

    .bill-compare { grid-template-columns: 1fr; }
    .field-list .field-row { grid-template-columns: 1fr; gap: 4px; }
    .field-list .field-name { font-size: 0.85rem; }

    .docs-topbar { padding: 10px 16px; }
    .docs-topbar-nav { display: none; }
}

@media (max-width: 480px) {
    .docs-main { padding: 16px 14px 60px; }
    .platform-grid { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: 1fr; }
    .docs-pager { flex-direction: column; }
}

/* 移动端遮罩 */
.docs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 140;
}

.docs-sidebar-overlay.show { display: block; }

/* 目录打开时禁止背景滚动（移动端） */
body.toc-open { overflow: hidden; }

