/* --- Variables & Reset --- */
:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --code-bg: #1e293b; /* 深色代码背景 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --radius: 12px;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans SC', sans-serif; /* 正文使用无衬线字体 */
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.8; /* 增加行高提升阅读体验 */
    scroll-behavior: smooth;
}

a { text-decoration: none; color: inherit; transition: 0.2s; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- Header (Glassmorphism) --- */
.glass-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 0;
}

.header-inner { display: flex; justify-content: space-between; align-items: center; }

.back-btn {
    color: var(--text-light);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.back-btn:hover { color: var(--primary); transform: translateX(-4px); }

.header-title-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    opacity: 0; /* 初始隐藏，也可以做滚动显示的JS效果 */
    transform: translateY(-10px);
    transition: 0.3s;
}
/* 当屏幕足够宽时显示中间标题 */
@media (min-width: 768px) {
    .header-title-preview { opacity: 1; transform: translateY(0); }
}

.chapter-tag {
    background: #eff6ff;
    color: var(--primary);
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.action-btn.edit {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}
.action-btn.edit:hover { border-color: var(--primary); color: var(--primary); }

/* --- Article Layout --- */
.article-container {
    max-width: 800px; /* 最佳阅读宽度 */
    margin: 40px auto 80px;
    padding: 0 24px;
    background: transparent;
}

/* --- Article Header --- */
.article-header { text-align: center; margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }

.meta-info {
    display: flex;
    justify-content: center;
    gap: 16px;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.article-title {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--text-main);
}

/* --- Article Content (Rich Text Styling) --- */
.article-content {
    font-size: 1.1rem; /* 稍大字体方便阅读 */
    color: #334155;
}

/* Typographic Elements */
.article-content h2 {
    font-size: 1.8rem;
    margin-top: 2.5em;
    margin-bottom: 0.8em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.article-content h3 {
    font-size: 1.4rem;
    margin-top: 2em;
    margin-bottom: 0.6em;
    color: var(--text-main);
}

.article-content p { margin-bottom: 1.6em; text-align: justify; }

.article-content strong { color: var(--text-main); font-weight: 700; }

.article-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 2px;
    text-decoration-color: rgba(59,130,246,0.3);
}
.article-content a:hover { text-decoration-color: var(--primary); }

/* Lists */
.article-content ul, .article-content ol {
    margin-bottom: 1.6em;
    padding-left: 1.5em;
}
.article-content li { margin-bottom: 0.5em; }

/* Images */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 20px 0;
    display: block;
}

/* Blockquotes */
.article-content blockquote {
    margin: 2em 0;
    padding: 1em 1.5em;
    border-left: 4px solid var(--primary);
    background: #eff6ff;
    border-radius: 0 8px 8px 0;
    color: #1e40af;
    font-style: italic;
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.95rem;
}
.article-content th, .article-content td {
    padding: 12px;
    border: 1px solid var(--border);
}
.article-content th { background: #f1f5f9; font-weight: 600; }

/* --- Code Blocks (Mac Style) --- */
.article-content pre {
    background: var(--code-bg);
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Fira Code', monospace; /* 等宽字体 */
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 2em 0;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Mac Style Dots */
.article-content pre::before {
    content: "•••"; 
    color: #475569;
    font-size: 24px;
    position: absolute;
    top: -8px;
    left: 15px;
    letter-spacing: -2px;
}
.article-content pre { padding-top: 40px; /* 为圆点留出空间 */ }

.article-content code {
    font-family: 'Fira Code', monospace;
}
/* Inline Code */
.article-content p code, .article-content li code {
    background: #f1f5f9;
    color: #d946ef; /* 粉紫色高亮 */
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #e2e8f0;
}

/* Iframe (Video) */
.article-content iframe {
    width: 100%;
    aspect-ratio: 16/9; /* 保持视频比例 */
    border: none;
    border-radius: 8px;
    margin: 2em 0;
    box-shadow: var(--shadow-sm);
}

/* --- Footer & Nav --- */
.article-footer { margin-top: 60px; text-align: center; }
.divider { font-size: 1.5rem; color: var(--border); margin-bottom: 40px; }

.nav-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-item {
    display: inline-block;
    padding: 20px 40px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.nav-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59,130,246,0.15);
    transform: translateY(-2px);
}
.nav-item span { display: block; font-size: 0.9rem; color: var(--text-light); margin-bottom: 4px; }
.nav-item strong { color: var(--primary); font-size: 1.1rem; }

/* Floating Button */
.floating-btn {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: 0.3s;
    pointer-events: none;
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}
.floating-btn.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.floating-btn:hover { background: var(--primary-dark); transform: scale(1.1); }

footer { text-align: center; padding: 40px 0; color: var(--text-light); font-size: 0.9rem; }

/* Responsive */
@media (max-width: 768px) {
    .article-title { font-size: 1.8rem; }
    .article-container { margin-top: 20px; padding: 0 16px; }
    .article-content pre { border-radius: 4px; padding: 15px; padding-top: 35px; }
    .floating-btn { bottom: 20px; right: 20px; }
}