/* ============================================
   FlashCreator — 文档/教程模板
   参考：Docusaurus · Vite Docs · Tailwind Docs
   色调：白 · 蓝 · 黄 | 深色/浅色双主题
   ============================================ */

/* --- CSS Variables (Light) --- */
:root {
    --white: #ffffff;
    --bg: #f8f9fc;
    --sidebar-bg: #fafbfd;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --blue-500: #3b82f6;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-400: #facc15;
    --yellow-500: #eab308;
    --yellow-600: #ca8a04;
    --gray-50: #f9fafb;
    --gray-75: #f5f6f8;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --green-100: #dcfce7;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-bg: #f0fdf4;
    --red-bg: #fef2f2;
    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --sidebar-width: 260px;
    --topbar-height: 56px;
    --content-max: 800px;
    --code-bg: #1e1e2e;
    --code-header-bg: #2d2d3d;
    --code-border: #3d3d4d;
    --code-lang-color: #a0a0b0;
    --code-text: #c9d1d9;
    --brand-gradient-from: #2563eb;
    --brand-gradient-to: #eab308;
}

/* --- CSS Variables (Dark) --- */
[data-theme="dark"] {
    --white: #1a1a2e;
    --bg: #0f0f1a;
    --sidebar-bg: #131320;
    --blue-50: #1a2744;
    --blue-100: #1e3050;
    --blue-200: #2a4a7f;
    --blue-500: #60a5fa;
    --blue-600: #93bbfc;
    --blue-700: #b4cdfc;
    --yellow-50: #2a2410;
    --yellow-100: #3d3515;
    --yellow-400: #facc15;
    --yellow-500: #fcd34d;
    --yellow-600: #fde68a;
    --gray-50: #1a1a2e;
    --gray-75: #1e1e35;
    --gray-100: #232340;
    --gray-200: #2d2d4a;
    --gray-300: #3d3d5c;
    --gray-400: #6b6b8a;
    --gray-500: #8b8baa;
    --gray-600: #a0a0bb;
    --gray-700: #c0c0d5;
    --gray-800: #d8d8e8;
    --gray-900: #e8e8f4;
    --green-100: #1a3a24;
    --green-600: #4ade80;
    --green-700: #86efac;
    --green-bg: #1a2e20;
    --red-bg: #2e1a1a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --code-bg: #0d1117;
    --code-header-bg: #161b22;
    --code-border: #30363d;
    --code-lang-color: #8b949e;
    --code-text: #c9d1d9;
    --brand-gradient-from: #60a5fa;
    --brand-gradient-to: #fcd34d;
}

/* --- Global Transition for theme switching --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--gray-800);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    color-scheme: light dark;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-200);
    z-index: 50;
}
[data-theme="dark"] .topbar {
    background: rgba(15,15,26,0.88);
}
.topbar-inner {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.sidebar-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--gray-50); border-color: var(--gray-300); }
@media (min-width: 1025px) { .sidebar-toggle { display: none; } }

.brand {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--gray-800);
    flex-shrink: 0;
}
.brand-text {
    font-family: var(--font-display);
    font-size: 1.1rem; font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--brand-gradient-from), var(--brand-gradient-to));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search */
.topbar-center { flex: 1; display: flex; justify-content: center; }
.search-box {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 14px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    width: 100%; max-width: 360px;
    color: var(--gray-400);
}
.search-box:focus-within {
    border-color: var(--blue-500);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.search-input {
    flex: 1; border: none; background: transparent;
    font-size: 0.85rem; font-family: var(--font-sans);
    color: var(--gray-700); outline: none;
}
.search-input::placeholder { color: var(--gray-400); }
.search-kbd {
    font-size: 0.7rem; font-family: var(--font-sans);
    padding: 2px 6px; border-radius: 4px;
    background: var(--white); border: 1px solid var(--gray-200);
    color: var(--gray-400); white-space: nowrap;
}

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-link {
    text-decoration: none;
    font-size: 0.85rem; font-weight: 500;
    color: var(--gray-600);
    padding: 6px 12px; border-radius: var(--radius-sm);
}
.topbar-link:hover { color: var(--blue-600); background: var(--blue-50); }

/* --- Theme Toggle Button --- */
.theme-toggle {
    position: relative;
    width: 36px; height: 36px;
    display: flex;
    align-items: center; justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-600);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}
.theme-toggle svg {
    position: absolute;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
.theme-icon-moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}
[data-theme="dark"] .theme-icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}
[data-theme="dark"] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ============================================
   LAYOUT
   ============================================ */
.layout {
    display: flex;
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    position: sticky;
    top: var(--topbar-height);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--gray-200);
    overflow: hidden;
    z-index: 40;
}
.sidebar-scroll {
    height: 100%; overflow-y: auto;
    padding: 24px 16px 48px;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

.sidebar-group { margin-bottom: 28px; }
.sidebar-group-title {
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--gray-400); margin-bottom: 8px;
    padding: 0 8px;
}
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-link {
    display: block;
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--gray-600);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    line-height: 1.5;
}
.sidebar-link:hover { color: var(--gray-800); background: var(--gray-100); }
.sidebar-link.active {
    color: var(--blue-600);
    background: var(--blue-50);
    border-left-color: var(--blue-500);
    font-weight: 500;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 39;
}
[data-theme="dark"] .sidebar-overlay {
    background: rgba(0,0,0,0.6);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content {
    flex: 1;
    min-width: 0;
    max-width: var(--content-max);
    padding: 48px 40px 80px;
    margin: 0 auto;
    width: 100%;
}

/* --- Doc Hero --- */
.doc-hero {
    padding: 20px 0 40px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 48px;
}
.doc-hero-title {
    font-family: var(--font-display);
    font-size: 2.75rem; font-weight: 700;
    letter-spacing: -0.03em; line-height: 1.2;
    color: var(--gray-900); margin-bottom: 12px;
}
.doc-hero-desc {
    font-size: 1.1rem; color: var(--gray-500);
    max-width: 540px; line-height: 1.6;
}
.doc-hero-meta {
    display: flex; gap: 20px;
    margin-top: 20px;
    font-size: 0.8125rem; color: var(--gray-400);
}

/* --- Doc Card --- */
.doc-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

/* --- Section --- */
.doc-section {
    margin-bottom: 72px;
}
.doc-section h2 {
    font-family: var(--font-display);
    font-size: 1.75rem; font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
    letter-spacing: -0.02em;
}
.doc-section h3 {
    font-family: var(--font-display);
    font-size: 1.2rem; font-weight: 600;
    color: var(--gray-800);
    margin: 28px 0 10px;
}
.doc-section h4 {
    font-size: 1.05rem; font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 6px;
}
.doc-section p {
    font-size: 0.95rem; color: var(--gray-600);
    line-height: 1.8; margin-bottom: 16px;
}
.doc-section ul, .doc-section ol {
    padding-left: 24px; margin-bottom: 16px;
}
.doc-section li {
    font-size: 0.95rem; color: var(--gray-600);
    line-height: 1.8; margin-bottom: 4px;
}
.doc-section strong { color: var(--gray-800); font-weight: 600; }
.doc-section a {
    color: var(--blue-600); text-decoration: none;
    border-bottom: 1px solid var(--blue-200);
}
.doc-section a:hover { border-bottom-color: var(--blue-500); }

/* Inline code */
code:not(pre code) {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--gray-200);
}

/* --- Feature Pills Grid --- */
.feature-grid-inline {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 16px;
}
.feature-pill {
    font-size: 0.8rem; font-weight: 500;
    color: var(--blue-600);
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    padding: 4px 12px;
    border-radius: 100px;
}

/* --- Step Block --- */
.step-block {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    overflow: hidden;
}
.step-header {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 24px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}
.step-num {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: var(--blue-600);
    color: white;
    font-size: 0.8rem; font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
    font-family: var(--font-display);
}
.step-header h3 {
    margin: 0; font-size: 1rem; font-weight: 600;
    font-family: var(--font-sans); color: var(--gray-800);
}
.step-body {
    padding: 24px;
}
.step-body p { margin-bottom: 12px; }
.step-body p:last-child { margin-bottom: 0; }

/* --- Code Block --- */
.code-block {
    background: var(--code-bg);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--code-border);
}
.code-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px;
    background: var(--code-header-bg);
    border-bottom: 1px solid var(--code-border);
}
.code-lang {
    font-size: 0.75rem; font-weight: 500;
    color: var(--code-lang-color);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.code-copy {
    font-size: 0.75rem; padding: 4px 10px;
    border: 1px solid var(--code-border);
    border-radius: 4px;
    background: transparent; color: var(--code-lang-color);
    cursor: pointer; font-family: var(--font-sans);
}
.code-copy:hover { background: var(--code-border); color: #d0d0e0; }
.code-block pre {
    padding: 16px 20px;
    overflow-x: auto;
    margin: 0;
}
.code-block code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--code-text);
    line-height: 1.7;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    white-space: pre-wrap;
    word-break: break-all;
}

/* --- Callout --- */
.callout {
    display: flex; gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius);
    margin: 20px 0;
    align-items: flex-start;
    font-size: 0.9rem;
    line-height: 1.7;
}
.callout-icon {
    font-size: 1.1rem; font-weight: 700;
    flex-shrink: 0; width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-style: normal;
}
.callout-info {
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
}
.callout-info .callout-icon { background: var(--blue-500); color: white; font-size: 0.75rem; }
.callout-info .callout-text { color: var(--gray-700); }
.callout-warning {
    background: var(--yellow-50);
    border: 1px solid var(--yellow-100);
}
.callout-warning .callout-icon { background: var(--yellow-500); color: white; font-size: 0.8rem; }
.callout-warning .callout-text { color: var(--gray-700); }
.callout a {
    color: var(--blue-600);
}
[data-theme="dark"] .callout a {
    color: var(--blue-500);
}
.callout-success {
    background: var(--green-bg);
    border: 1px solid var(--green-100);
}
.callout-success .callout-icon { background: var(--green-600); color: white; font-size: 0.8rem; }
.callout-success .callout-text { color: var(--gray-700); }
.callout code {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.1);
}
[data-theme="dark"] .callout code {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.1);
    color: var(--gray-700);
}

/* --- Timeline Steps --- */
.steps-timeline {
    position: relative;
    padding-left: 44px;
}
.steps-timeline::before {
    content: '';
    position: absolute; left: 17px; top: 8px; bottom: 8px;
    width: 2px; background: var(--gray-200);
    border-radius: 1px;
}
.tl-step {
    position: relative;
    margin-bottom: 40px;
}
.tl-step:last-child { margin-bottom: 0; }
.tl-marker {
    position: absolute; left: -44px; top: 0;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 0.9rem; font-weight: 700;
    color: var(--gray-600);
    z-index: 2;
}
.tl-step:hover .tl-marker {
    border-color: var(--blue-500);
    color: var(--blue-600);
    background: var(--blue-50);
}
.tl-content {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
}
.tl-step:hover .tl-content {
    box-shadow: var(--shadow);
    border-color: var(--gray-300);
}
.tl-content h4 {
    font-family: var(--font-display);
    font-size: 1.1rem; font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}
.tl-content p { font-size: 0.925rem; color: var(--gray-600); margin-bottom: 12px; }
.tl-content ul { margin: 12px 0; }

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
thead { background: var(--gray-50); }
th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600; font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 1px solid var(--gray-200);
}
td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-600);
}
tr:last-child td { border-bottom: none; }

/* FAQ */
.faq-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
    background: var(--white);
}
.faq-item summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    font-weight: 600; font-size: 0.95rem;
    color: var(--gray-800);
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.faq-item summary:hover { background: var(--gray-50); }
.faq-item summary::after {
    content: '+';
    font-size: 1.2rem; color: var(--gray-400);
}
.faq-item[open] summary::after {
    content: '−';
    color: var(--blue-500);
}
.faq-answer { padding: 0 20px 16px; }
.faq-answer p { font-size: 0.9rem; color: var(--gray-600); }

/* --- Doc Footer --- */
.doc-footer {
    margin-top: 80px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-200);
}
.doc-footer-bottom {
    text-align: center;
    font-size: 0.8rem; color: var(--gray-400);
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* --- Tablet & Small Desktop (≤1024px) --- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0; top: var(--topbar-height);
        transform: translateX(-100%);
        box-shadow: 0 0 0 9999px rgba(0,0,0,0.15);
        z-index: 60;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar.open + .sidebar-overlay { display: block; }
    .sidebar-overlay { z-index: 59; }
    .content {
        max-width: 100%;
        padding: 32px 28px 60px;
    }
    .doc-hero-title { font-size: 2.2rem; }
    .doc-hero-desc { font-size: 1rem; max-width: 100%; }
    .topbar-center { display: none; }
    .topbar-inner { padding: 0 14px; gap: 10px; }

    /* Sidebar toggle visible on tablet */
    .sidebar-toggle { display: flex; }

    /* 双栏表格转堆叠 */
    .doc-hero-meta {
        flex-direction: column; gap: 8px;
    }
}

/* --- Phone (≤768px) --- */
@media (max-width: 768px) {
    :root {
        --topbar-height: 50px;
    }

    .topbar-inner { padding: 0 10px; gap: 6px; }
    .topbar-link {
        font-size: 0.78rem; padding: 5px 8px;
    }
    .brand-text { font-size: 1rem; }
    .sidebar-toggle { width: 32px; height: 32px; }
    .theme-toggle { width: 32px; height: 32px; }

    .content {
        padding: 24px 16px 48px;
    }

    .doc-hero {
        padding: 12px 0 28px;
        margin-bottom: 32px;
    }
    .doc-hero-title { font-size: 1.8rem; }
    .doc-hero-desc { font-size: 0.9rem; }
    .doc-hero-meta {
        flex-direction: column; gap: 6px; margin-top: 14px;
        font-size: 0.78rem;
    }

    .doc-section { margin-bottom: 48px; }
    .doc-section h2 {
        font-size: 1.4rem; margin-bottom: 12px;
        padding-bottom: 10px;
    }
    .doc-section h3 {
        font-size: 1.1rem; margin: 22px 0 8px;
    }
    .doc-section p { font-size: 0.9rem; line-height: 1.75; margin-bottom: 12px; }
    .doc-section li { font-size: 0.9rem; }

    /* Card */
    .doc-card { padding: 18px; }

    /* Step Block */
    .step-header {
        padding: 12px 14px; gap: 10px;
    }
    .step-num { width: 28px; height: 28px; font-size: 0.75rem; }
    .step-header h3 { font-size: 0.9rem; }
    .step-body { padding: 14px; }

    /* Timeline */
    .steps-timeline { padding-left: 34px; }
    .steps-timeline::before { left: 14px; }
    .tl-marker {
        width: 28px; height: 28px;
        left: -34px; font-size: 0.75rem;
    }
    .tl-step { margin-bottom: 28px; }
    .tl-content {
        padding: 14px;
        border-radius: var(--radius);
    }
    .tl-content h4 { font-size: 0.95rem; }
    .tl-content p { font-size: 0.85rem; }

    /* Code Block */
    .code-block pre { padding: 12px 14px; }
    .code-block code { font-size: 0.78rem; }
    .code-header { padding: 6px 12px; }

    /* Feature Pills */
    .feature-grid-inline { gap: 6px; }
    .feature-pill { font-size: 0.72rem; padding: 3px 10px; }

    /* Callout */
    .callout {
        padding: 12px 14px; gap: 10px;
        font-size: 0.85rem; margin: 16px 0;
    }
    .callout-icon { width: 20px; height: 20px; font-size: 0.7rem; }

    /* Table */
    .table-wrap { border-radius: var(--radius-sm); }
    th, td { padding: 8px 10px; font-size: 0.8rem; }
    th { font-size: 0.72rem; }

    /* FAQ */
    .faq-item summary {
        padding: 12px 14px; font-size: 0.88rem;
    }
    .faq-answer { padding: 0 14px 12px; }
    .faq-answer p { font-size: 0.85rem; }

    /* Footer */
    .doc-footer { margin-top: 48px; padding-top: 20px; }
    .doc-footer-bottom { font-size: 0.75rem; }

    /* Sidebar — 全宽滑入式 */
    .sidebar {
        width: 280px;
        min-width: 280px;
        border-right: 1px solid var(--gray-200);
        box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    }
    [data-theme="dark"] .sidebar {
        box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    }
    .sidebar-scroll { padding: 16px 12px 32px; }
    .sidebar-group-title { font-size: 0.7rem; margin-bottom: 6px; }
    .sidebar-link { font-size: 0.8rem; padding: 5px 6px; }
    .sidebar-group { margin-bottom: 20px; }

    /* Sidebar overlay darker on mobile */
    .sidebar-overlay { background: rgba(0,0,0,0.4); }
    [data-theme="dark"] .sidebar-overlay { background: rgba(0,0,0,0.7); }
}

/* --- Small Phone (≤480px) --- */
@media (max-width: 480px) {
    :root { --topbar-height: 46px; }

    .topbar-inner { padding: 0 8px; gap: 4px; }
    .topbar-link:nth-child(n+3) { display: none; }
    .brand-text { font-size: 0.95rem; }
    .sidebar-toggle { width: 30px; height: 30px; border-radius: var(--radius-sm); }
    .theme-toggle { width: 30px; height: 30px; border-radius: var(--radius-sm); }

    .content {
        padding: 20px 12px 40px;
    }

    .doc-hero-title { font-size: 1.5rem; }
    .doc-hero-desc { font-size: 0.85rem; }
    .doc-hero-meta { font-size: 0.72rem; gap: 4px; margin-top: 10px; }

    .doc-section { margin-bottom: 36px; }
    .doc-section h2 {
        font-size: 1.2rem; padding-bottom: 8px; margin-bottom: 10px;
    }
    .doc-section h3 { font-size: 1rem; margin: 16px 0 6px; }
    .doc-section p { font-size: 0.85rem; margin-bottom: 10px; }
    .doc-section li { font-size: 0.85rem; }
    .doc-section ul, .doc-section ol { padding-left: 18px; }

    .doc-card { padding: 14px; }

    /* Step Block */
    .step-header {
        padding: 10px 12px; gap: 8px;
    }
    .step-num { width: 24px; height: 24px; font-size: 0.7rem; }
    .step-header h3 { font-size: 0.85rem; }
    .step-body { padding: 12px; }

    /* Timeline */
    .steps-timeline { padding-left: 30px; }
    .steps-timeline::before { left: 12px; top: 4px; bottom: 4px; }
    .tl-marker {
        width: 24px; height: 24px;
        left: -30px; font-size: 0.7rem;
    }
    .tl-step { margin-bottom: 22px; }
    .tl-content { padding: 12px; }
    .tl-content h4 { font-size: 0.85rem; }
    .tl-content p { font-size: 0.8rem; }

    /* Code */
    .code-block pre { padding: 10px 12px; }
    .code-block code { font-size: 0.7rem; line-height: 1.6; }
    .code-header { padding: 5px 10px; }
    .code-lang { font-size: 0.65rem; }
    .code-copy { font-size: 0.65rem; padding: 3px 8px; }

    /* Feature Pills */
    .feature-pill { font-size: 0.68rem; padding: 2px 8px; }

    /* Callout */
    .callout {
        padding: 10px 12px; gap: 8px;
        font-size: 0.8rem; margin: 12px 0;
        border-radius: var(--radius-sm);
    }

    /* Table — 小屏让表格可横向滚动 */
    .table-wrap {
        margin: 12px 0;
        border-radius: var(--radius-sm);
    }
    th, td { padding: 7px 8px; font-size: 0.75rem; }
    th { font-size: 0.68rem; }

    /* FAQ */
    .faq-item summary { padding: 10px 12px; font-size: 0.82rem; }
    .faq-answer { padding: 0 12px 10px; }
    .faq-answer p { font-size: 0.8rem; }

    /* Sidebar */
    .sidebar { width: 260px; min-width: 260px; }
    .sidebar-scroll { padding: 14px 10px 24px; }
    .sidebar-link { font-size: 0.78rem; padding: 4px 6px; }

    .doc-footer { margin-top: 36px; padding-top: 16px; }
}

/* ============================================
   DARK MODE — System preference auto-detect
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --white: #1a1a2e;
        --bg: #0f0f1a;
        --sidebar-bg: #131320;
        --blue-50: #1a2744;
        --blue-100: #1e3050;
        --blue-200: #2a4a7f;
        --blue-500: #60a5fa;
        --blue-600: #93bbfc;
        --blue-700: #b4cdfc;
        --yellow-50: #2a2410;
        --yellow-100: #3d3515;
        --yellow-400: #facc15;
        --yellow-500: #fcd34d;
        --yellow-600: #fde68a;
        --gray-50: #1a1a2e;
        --gray-75: #1e1e35;
        --gray-100: #232340;
        --gray-200: #2d2d4a;
        --gray-300: #3d3d5c;
        --gray-400: #6b6b8a;
        --gray-500: #8b8baa;
        --gray-600: #a0a0bb;
        --gray-700: #c0c0d5;
        --gray-800: #d8d8e8;
        --gray-900: #e8e8f4;
        --green-100: #1a3a24;
        --green-600: #4ade80;
        --green-700: #86efac;
        --green-bg: #1a2e20;
        --red-bg: #2e1a1a;
        --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
        --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
        --code-bg: #0d1117;
        --code-header-bg: #161b22;
        --code-border: #30363d;
        --code-lang-color: #8b949e;
        --code-text: #c9d1d9;
        --brand-gradient-from: #60a5fa;
        --brand-gradient-to: #fcd34d;
    }
    :root:not([data-theme="light"]) .topbar {
        background: rgba(15,15,26,0.88);
    }
    :root:not([data-theme="light"]) .sidebar-overlay {
        background: rgba(0,0,0,0.6);
    }
    :root:not([data-theme="light"]) .callout code {
        background: rgba(255,255,255,0.08);
        border-color: rgba(255,255,255,0.1);
        color: var(--gray-700);
    }
    :root:not([data-theme="light"]) .theme-icon-sun {
        opacity: 0; transform: rotate(90deg) scale(0.6);
    }
    :root:not([data-theme="light"]) .theme-icon-moon {
        opacity: 1; transform: rotate(0deg) scale(1);
    }
}
