:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #666666;
    --accent-primary: #000000;
    --accent-secondary: #333333;
    --border-color: #000000;
    --code-bg: #f0f0f0;
    --success: #000000;
    --warning: #333333;
    --error: #000000;
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --sidebar-width: 280px;
    --header-height: 64px;
    --radius-sm: 0px;
    --radius-md: 0px;
    --radius-lg: 0px;
    --transition-fast: 100ms ease;
    --transition-normal: 150ms ease;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1f1f1f;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #888888;
    --accent-primary: #ffffff;
    --accent-secondary: #cccccc;
    --border-color: #ffffff;
    --code-bg: #1a1a1a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Noto Sans SC",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    transition:
        background var(--transition-normal),
        color var(--transition-normal);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

[data-theme="dark"] .header {
    background: var(--bg-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 36px;
    height: 36px;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: 2px solid var(--text-primary);
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.theme-toggle:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .sun {
    display: none;
}
.theme-toggle .moon {
    display: block;
}
[data-theme="dark"] .theme-toggle .sun {
    display: block;
}
[data-theme="dark"] .theme-toggle .moon {
    display: none;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--bg-secondary);
    border-right: 2px solid var(--border-color);
    overflow-y: auto;
    padding: 20px 0;
    z-index: 50;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--text-muted);
}

.nav-section {
    margin-bottom: 8px;
}

.nav-phase {
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--bg-tertiary);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.nav-item-number {
    width: 22px;
    height: 22px;
    border: 1px solid var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-item.active .nav-item-number {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: none;
}

.nav-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content */
.main {
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    min-height: 100vh;
}

.content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 48px;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 80px 0 100px;
    border-bottom: 2px solid var(--border-color);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 16px;
    letter-spacing: -2px;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.8;
}

.hero-meta {
    display: flex;
    justify-content: center;
    gap: 48px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 1px;
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Phase Header */
.phase-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 32px 0;
    margin-bottom: 32px;
}

.phase-badge {
    padding: 6px 12px;
    border: 2px solid var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
}

.phase-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

/* Section */
.section {
    margin-bottom: 48px;
    scroll-margin-top: calc(var(--header-height) + 20px);
    border-bottom: 1px solid var(--bg-tertiary);
    padding-bottom: 48px;
}

.section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.section-header:hover {
    opacity: 0.7;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.section-number {
    width: 36px;
    height: 36px;
    background: var(--text-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-normal);
}

.section.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.section-content {
    padding: 24px 0;
    display: grid;
    gap: 32px;
}

.section.collapsed .section-content {
    display: none;
}

/* Subsection */
.subsection {
    padding: 20px 0;
    border-bottom: 1px solid var(--bg-tertiary);
}

.subsection:last-child {
    border-bottom: none;
}

.subsection-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.subsection p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.8;
}

/* Code Block */
.code-block {
    position: relative;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.code-lang {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.code-copy {
    padding: 4px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.code-copy:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.code-copy.copied {
    background: var(--text-primary);
    color: var(--bg-primary);
}

.code-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-run {
    padding: 4px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.code-run:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

pre {
    margin: 0 !important;
    padding: 16px !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
    font-family: "JetBrains Mono", monospace !important;
    background: transparent !important;
}

pre[class*="language-"] {
    font-family: "JetBrains Mono", monospace !important;
}

/* 去掉行号插件的左侧边框线 */
pre.line-numbers {
    position: relative;
    padding-left: 3.8em !important;
    counter-reset: linenumber;
}

pre.line-numbers > code {
    position: relative;
    white-space: inherit;
}

.line-numbers-rows {
    border-left: none !important;
    border-right: none !important;
}

/* Note/Callout */
.callout {
    display: flex;
    gap: 16px;
    padding: 16px;
    margin: 16px 0;
    border: 1px solid var(--text-primary);
}

.callout.info {
    background: transparent;
}

.callout.warning {
    background: transparent;
}

.callout.success {
    background: transparent;
}

.callout-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.callout.info .callout-icon {
    color: var(--text-primary);
}
.callout.warning .callout-icon {
    color: var(--text-primary);
}
.callout.success .callout-icon {
    color: var(--text-primary);
}

/* Table */
.table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--bg-tertiary);
}

th {
    background: var(--bg-tertiary);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

tr:hover td {
    background: var(--bg-secondary);
}

/* Divider */
.divider {
    height: 2px;
    background: var(--border-color);
    margin: 48px 0;
}

/* Summary Box */
.summary-box {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 24px;
    margin: 24px 0;
}

.summary-box h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.summary-box ul {
    list-style: none;
    display: grid;
    gap: 8px;
}

.summary-box li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
}

.summary-box li::before {
    content: "—";
    font-weight: bold;
    margin-top: 0;
}

.summary-box code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    font-family: "JetBrains Mono", monospace;
}

/* Progress Bar */
.progress-container {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    height: 3px;
    background: var(--bg-tertiary);
    z-index: 99;
}

.progress-bar {
    height: 100%;
    background: var(--text-primary);
    width: 0%;
    transition: width 100ms ease;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: 2px solid var(--text-primary);
    background: var(--bg-primary);
    cursor: pointer;
    color: var(--text-primary);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content-wrapper {
        padding: 32px 24px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .progress-container {
        left: 0;
    }
}

@media (max-width: 640px) {
    .header-title {
        font-size: 14px;
    }

    .hero {
        padding: 40px 0 60px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .hero-meta {
        flex-direction: column;
        gap: 12px;
    }

    .section-header {
        padding: 12px 16px;
    }

    .section-title {
        font-size: 16px;
    }

    pre {
        font-size: 12px !important;
    }
}

/* Animation */
.section {
    animation: fadeIn 0.3s ease forwards;
}

.section:nth-child(1) {
    animation-delay: 0.05s;
}
.section:nth-child(2) {
    animation-delay: 0.1s;
}
.section:nth-child(3) {
    animation-delay: 0.15s;
}
.section:nth-child(4) {
    animation-delay: 0.2s;
}
.section:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.overlay.active {
    display: block;
}
