* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f4f6f9;
    color: #1e293b;
    line-height: 1.7;
    min-height: 100vh;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #e9eef2;
    width: 100%;
}
.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #0f172a;
    font-weight: 700;
    font-size: 17px;
}
.header-logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}
.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.header-nav a {
    padding: 8px 16px;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.header-nav a:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.header-nav a.active {
    background: #2563eb;
    color: #fff;
}

/* ===== Page Layout ===== */
.page-body {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 32px;
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
    align-items: start;
}

/* ===== Sidebar TOC ===== */
.sidebar {
    position: sticky;
    top: 88px;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e9eef2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.toc-list li {
    margin-bottom: 2px;
}
/* 一级目录项 */
.toc-h1-item {
    display: flex;
    align-items: center;
    cursor: pointer;
}
.toc-h1-item .toc-h1 {
    flex: 1;
}
/* 展开/折叠箭头 - 右侧 */
.toc-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: #c0c8d4;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 3px;
    transition: transform 0.25s;
    user-select: none;
    margin-left: auto;
    order: 2;
}
.toc-toggle.rotated {
    transform: rotate(90deg);
}
.toc-toggle:hover {
    color: #475569;
}
/* 二级子列表 */
.toc-sub-list {
    list-style: none;
    padding: 0 0 0 16px;
    margin: 0;
}
.toc-sub-list li {
    margin-bottom: 2px;
}
.toc-list a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: #64748b;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.toc-list a:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.toc-list a.active {
    background: #eff6ff;
    color: #2563eb;
    border-left-color: #2563eb;
    font-weight: 500;
}
.toc-h2 {
    font-size: 13px !important;
}

/* ===== Main Content ===== */
.main-content {
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e9eef2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}
.page-hero {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
    padding: 40px 40px;
    text-align: center;
    border-bottom: 1px solid #e9eef2;
}
.page-hero h1 {
    font-size: 36px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}
.page-hero p {
    font-size: 17px;
    color: #64748b;
}
.content-body {
    padding: 20px;
}

/* ===== Dynamic Content Styles ===== */
.content-body h1,
.content-body h2 {
    scroll-margin-top: 100px;
}
.content-body h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    margin: 48px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    line-height: 1.3;
}
.content-body h1:first-child {
    margin-top: 0;
}
.content-body h2 {
    font-size: 22px;
    font-weight: 600;
    color: #1e293b;
    margin: 40px 0 16px;
    padding-left: 12px;
    border-left: 4px solid #2563eb;
    line-height: 1.4;
}
.content-body p {
    margin: 16px 0;
    color: #475569;
    font-size: 15px;
    line-height: 1.85;
}
.content-body strong {
    color: #0f172a;
    font-weight: 600;
}
.content-body a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid #bfdbfe;
    transition: all 0.2s;
}
.content-body a:hover {
    border-bottom-color: #2563eb;
}
.content-body ul, .content-body ol {
    margin: 16px 0;
    padding-left: 24px;
    color: #475569;
}
.content-body li {
    margin: 8px 0;
    line-height: 1.75;
}
.content-body ul ul, .content-body ul ol,
.content-body ol ul, .content-body ol ol {
    margin: 8px 0;
}
.content-body blockquote {
    margin: 24px 0;
    padding: 14px 18px;
    background: #f8fafc;
    border-left: 4px solid #2563eb;
    border-radius: 0 10px 10px 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.8;
}
.content-body pre {
    margin: 24px 0;
    padding: 16px 20px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 14px;
    line-height: 1.6;
}
.content-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}
.content-body code {
    background: #f1f5f9;
    color: #be185d;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 14px;
}
.content-body hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 40px 0;
}
.content-body img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 10px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}
.content-body table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}
.content-body table td {
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    color: #475569;
}
.content-body table tr:nth-child(even) td {
    background: #f8fafc;
}

/* ===== Video Wrapper ===== */
.content-body .video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    margin: 20px 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.content-body .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}
.content-body video {
    max-width: 100%;
    border-radius: 10px;
    margin: 16px 0;
}

/* ===== Footer ===== */
.site-footer {
    background: #fff;
    border-top: 1px solid #e9eef2;
    padding: 28px 0;
    margin-top: 40px;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}
.footer-inner p {
    margin: 0;
    color: #94a3b8;
}
.footer-inner a {
    color: #64748b;
    text-decoration: none;
}
.footer-inner a:hover {
    color: #2563eb;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .page-body {
        grid-template-columns: 1fr;
        padding: 24px 16px;
        gap: 24px;
    }
    .sidebar {
        position: static;
    }
    .page-hero {
        padding: 40px 24px;
    }
    .page-hero h1 {
        font-size: 28px;
    }
    .content-body {
        padding: 32px 24px;
    }
    .header-nav {
        gap: 2px;
    }
    .header-nav a {
        padding: 6px 10px;
        font-size: 13px;
    }
    .header-inner {
        padding: 0 16px;
    }
    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
@media (max-width: 640px) {
    .content-body {
        padding: 24px 16px;
    }
    .page-hero {
        padding: 32px 20px;
    }
    .page-hero h1 {
        font-size: 24px;
    }
    .page-hero p {
        font-size: 15px;
    }
    .header-logo span {
        display: none;
    }
}
