:root {
    /* 蓝灰系 - 浅色（默认） */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-accent: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --accent-bg: #dbeafe;
    --quote-bg: #eff6ff;
    --quote-border: #60a5fa;
    --quote-text: #1d4ed8;
    --code-bg: #f1f5f9;
    --code-text: #374151;
    --pre-bg: #1e293b;
    --pre-text: #e2e8f0;
    --pre-border: #374151;
    --header-bg: #ffffff;
    --header-border: #e2e8f0;
    --toc-bg: #ffffff;
    --toc-shadow: rgba(0, 0, 0, 0.1);
}

/* 蓝灰系 - 深色 */
[data-theme="blue-dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-accent: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-bg: #1e40af;
    --quote-bg: #1e3a8a;
    --quote-border: #3b82f6;
    --quote-text: #bfdbfe;
    --code-bg: #334155;
    --code-text: #cbd5e1;
    --pre-bg: #020617;
    --pre-text: #f1f5f9;
    --pre-border: #374151;
    --header-bg: #1e293b;
    --header-border: #475569;
    --toc-bg: #1e293b;
    --toc-shadow: rgba(0, 0, 0, 0.3);
}



/* 暖米系 - 浅色 */
[data-theme="warm-light"] {
    --bg-primary: #fef7ed;
    --bg-secondary: #ffffff;
    --bg-accent: #fed7aa;
    --text-primary: #431407;
    --text-secondary: #9a3412;
    --text-muted: #c2410c;
    --border-color: #fdba74;
    --accent-color: #ea580c;
    --accent-hover: #dc2626;
    --accent-bg: #fed7aa;
    --quote-bg: #fff7ed;
    --quote-border: #fb923c;
    --quote-text: #c2410c;
    --code-bg: #fed7aa;
    --code-text: #9a3412;
    --pre-bg: #431407;
    --pre-text: #fed7aa;
    --pre-border: #9a3412;
    --header-bg: #ffffff;
    --header-border: #fdba74;
    --toc-bg: #ffffff;
    --toc-shadow: rgba(234, 88, 12, 0.1);
}

/* 暖米系 - 深色 */
[data-theme="warm-dark"] {
    --bg-primary: #431407;
    --bg-secondary: #7c2d12;
    --bg-accent: #9a3412;
    --text-primary: #fed7aa;
    --text-secondary: #fdba74;
    --text-muted: #fb923c;
    --border-color: #9a3412;
    --accent-color: #fb923c;
    --accent-hover: #f97316;
    --accent-bg: #c2410c;
    --quote-bg: #9a3412;
    --quote-border: #f97316;
    --quote-text: #fed7aa;
    --code-bg: #9a3412;
    --code-text: #fdba74;
    --pre-bg: #431407;
    --pre-text: #fed7aa;
    --pre-border: #7c2d12;
    --header-bg: #7c2d12;
    --header-border: #9a3412;
    --toc-bg: #7c2d12;
    --toc-shadow: rgba(0, 0, 0, 0.3);
}



/* 绿色系 - 浅色 */
[data-theme="green-light"] {
    --bg-primary: #f0fdf4;
    --bg-secondary: #ffffff;
    --bg-accent: #dcfce7;
    --text-primary: #14532d;
    --text-secondary: #166534;
    --text-muted: #16a34a;
    --border-color: #bbf7d0;
    --accent-color: #22c55e;
    --accent-hover: #16a34a;
    --accent-bg: #dcfce7;
    --quote-bg: #ecfdf5;
    --quote-border: #4ade80;
    --quote-text: #15803d;
    --code-bg: #dcfce7;
    --code-text: #166534;
    --pre-bg: #14532d;
    --pre-text: #dcfce7;
    --pre-border: #166534;
    --header-bg: #ffffff;
    --header-border: #bbf7d0;
    --toc-bg: #ffffff;
    --toc-shadow: rgba(34, 197, 94, 0.1);
}

/* 绿色系 - 深色 */
[data-theme="green-dark"] {
    --bg-primary: #14532d;
    --bg-secondary: #166534;
    --bg-accent: #15803d;
    --text-primary: #dcfce7;
    --text-secondary: #bbf7d0;
    --text-muted: #86efac;
    --border-color: #15803d;
    --accent-color: #4ade80;
    --accent-hover: #22c55e;
    --accent-bg: #16a34a;
    --quote-bg: #15803d;
    --quote-border: #22c55e;
    --quote-text: #dcfce7;
    --code-bg: #15803d;
    --code-text: #bbf7d0;
    --pre-bg: #14532d;
    --pre-text: #dcfce7;
    --pre-border: #166534;
    --header-bg: #166534;
    --header-border: #15803d;
    --toc-bg: #166534;
    --toc-shadow: rgba(0, 0, 0, 0.3);
}



/* 紫色系 - 浅色 */
[data-theme="purple-light"] {
    --bg-primary: #faf5ff;
    --bg-secondary: #ffffff;
    --bg-accent: #e9d5ff;
    --text-primary: #581c87;
    --text-secondary: #7c3aed;
    --text-muted: #8b5cf6;
    --border-color: #d8b4fe;
    --accent-color: #a855f7;
    --accent-hover: #9333ea;
    --accent-bg: #e9d5ff;
    --quote-bg: #f3e8ff;
    --quote-border: #c084fc;
    --quote-text: #7c3aed;
    --code-bg: #e9d5ff;
    --code-text: #7c3aed;
    --pre-bg: #581c87;
    --pre-text: #e9d5ff;
    --pre-border: #7c3aed;
    --header-bg: #ffffff;
    --header-border: #d8b4fe;
    --toc-bg: #ffffff;
    --toc-shadow: rgba(168, 85, 247, 0.1);
}

/* 紫色系 - 深色 */
[data-theme="purple-dark"] {
    --bg-primary: #581c87;
    --bg-secondary: #6b21a8;
    --bg-accent: #7c3aed;
    --text-primary: #e9d5ff;
    --text-secondary: #d8b4fe;
    --text-muted: #c084fc;
    --border-color: #7c3aed;
    --accent-color: #c084fc;
    --accent-hover: #a855f7;
    --accent-bg: #8b5cf6;
    --quote-bg: #7c3aed;
    --quote-border: #a855f7;
    --quote-text: #e9d5ff;
    --code-bg: #7c3aed;
    --code-text: #d8b4fe;
    --pre-bg: #581c87;
    --pre-text: #e9d5ff;
    --pre-border: #6b21a8;
    --header-bg: #6b21a8;
    --header-border: #7c3aed;
    --toc-bg: #6b21a8;
    --toc-shadow: rgba(0, 0, 0, 0.3);
}



/* 棕色系 - 浅色 */
[data-theme="brown-light"] {
    --bg-primary: #fefcfb;
    --bg-secondary: #ffffff;
    --bg-accent: #fed7aa;
    --text-primary: #78350f;
    --text-secondary: #92400e;
    --text-muted: #d97706;
    --border-color: #fde68a;
    --accent-color: #f59e0b;
    --accent-hover: #d97706;
    --accent-bg: #fed7aa;
    --quote-bg: #fffbeb;
    --quote-border: #fbbf24;
    --quote-text: #92400e;
    --code-bg: #fed7aa;
    --code-text: #92400e;
    --pre-bg: #78350f;
    --pre-text: #fed7aa;
    --pre-border: #92400e;
    --header-bg: #ffffff;
    --header-border: #fde68a;
    --toc-bg: #ffffff;
    --toc-shadow: rgba(245, 158, 11, 0.1);
}

/* 棕色系 - 深色 */
[data-theme="brown-dark"] {
    --bg-primary: #78350f;
    --bg-secondary: #92400e;
    --bg-accent: #d97706;
    --text-primary: #fed7aa;
    --text-secondary: #fde68a;
    --text-muted: #fbbf24;
    --border-color: #d97706;
    --accent-color: #fbbf24;
    --accent-hover: #f59e0b;
    --accent-bg: #b45309;
    --quote-bg: #d97706;
    --quote-border: #f59e0b;
    --quote-text: #fed7aa;
    --code-bg: #d97706;
    --code-text: #fde68a;
    --pre-bg: #78350f;
    --pre-text: #fed7aa;
    --pre-border: #92400e;
    --header-bg: #92400e;
    --header-border: #d97706;
    --toc-bg: #92400e;
    --toc-shadow: rgba(0, 0, 0, 0.3);
}



/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    transition: all 0.3s ease;
}

/* 顶部导航栏 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.site-title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

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

.article-selector select,
.theme-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.article-selector select:hover,
.theme-selector select:hover {
    border-color: var(--accent-color);
}

.article-selector select:focus,
.theme-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

.toc-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1em;
}

.toc-toggle:hover {
    background: var(--bg-accent);
    border-color: var(--accent-color);
}

/* 主要内容区域 */
.main {
    margin-top: 64px;
    min-height: calc(100vh - 64px);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.article {
    background: transparent;
    padding: 48px 0;
    transition: all 0.3s ease;
}

/* 浮动目录 */
.toc-floating {
    position: fixed;
    top: 80px;
    right: -320px;
    width: 300px;
    max-height: calc(100vh - 120px);
    background: var(--toc-bg);
    border-radius: 12px;
    box-shadow: 0 4px 24px var(--toc-shadow);
    backdrop-filter: blur(20px);
    transition: right 0.3s ease;
    z-index: 999;
    overflow: hidden;
}

.toc-floating.show {
    right: 20px;
}

.toc-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toc-header h3 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.toc-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toc-close:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
}

.toc-content {
    padding: 16px 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.toc-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-content li {
    margin: 0;
}

.toc-content a {
    display: block;
    padding: 8px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-content a:hover {
    background: var(--bg-accent);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}

.toc-content a.active {
    background: var(--accent-bg);
    color: var(--accent-color);
    font-weight: 500;
    border-left-color: var(--accent-color);
}

.toc-content .toc-h2 { padding-left: 32px; }
.toc-content .toc-h3 { padding-left: 40px; font-size: 0.85em; }
.toc-content .toc-h4 { padding-left: 48px; font-size: 0.8em; }

/* 目录遮罩 */
.toc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.toc-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 4px 12px var(--toc-shadow);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--toc-shadow);
}

/* 加载和错误状态 */
.loading, .error {
    text-align: center;
    padding: 80px 20px;
    font-size: 1.1em;
}

.loading {
    color: var(--text-muted);
}

.error {
    color: #ef4444;
}

/* Markdown 样式 */
h1 {
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5em;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    color: var(--text-primary);
    margin: 40px 0 24px;
    font-size: 1.75em;
    font-weight: 600;
    line-height: 1.3;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

h3 {
    color: var(--text-primary);
    margin: 32px 0 20px;
    font-size: 1.4em;
    font-weight: 600;
}

h4 {
    color: var(--text-secondary);
    margin: 24px 0 16px;
    font-size: 1.2em;
    font-weight: 600;
}

p {
    margin: 20px 0;
    color: var(--text-secondary);
}

ul, ol {
    margin: 20px 0;
    padding-left: 28px;
}

li {
    margin: 10px 0;
    color: var(--text-secondary);
}

blockquote {
    background: var(--quote-bg);
    border-left: 4px solid var(--quote-border);
    padding: 20px 24px;
    margin: 24px 0;
    border-radius: 0 12px 12px 0;
    color: var(--quote-text);
    transition: all 0.3s ease;
}

code {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    padding: 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--pre-border);
    transition: all 0.3s ease;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    text-decoration: underline;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

th {
    background: var(--bg-accent);
    font-weight: 600;
    color: var(--text-primary);
    transition: background-color 0.3s ease;
}

strong {
    color: var(--text-primary);
    font-weight: 600;
}

em {
    color: var(--text-muted);
}

hr {
    border: none;
    height: 1px;
    background: var(--border-color);
    margin: 40px 0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .toc-floating {
        right: -100%;
        width: 100%;
        top: 64px;
        max-height: calc(100vh - 64px);
        border-radius: 0;
    }
    
    .toc-floating.show {
        right: 0;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 16px;
        height: 60px;
    }
    
    .header-left {
        gap: 12px;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .site-title {
        font-size: 1.2em;
    }
    
    .article-selector select,
    .theme-selector select {
        font-size: 0.8em;
        padding: 6px 8px;
    }
    
    .main {
        margin-top: 60px;
    }
    
    .container {
        padding: 20px 16px;
    }
    
    .article {
        padding: 24px 0;
    }
    
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
} 