:root {
    /* 暖色调 - 纸张质感 (Warm Paper Style) */
    --bg-primary: #fdfcf8;
    --bg-secondary: #f7f5f0;
    --bg-tertiary: #ffffff;
    --bg-gradient-start: #fdfcf8;
    --bg-gradient-end: #f2efe9;
    
    /* 暖色调文字 */
    --text-primary: #2c2c2e;  /* 暖深灰 */
    --text-secondary: #666668; /* 暖中灰 */
    --text-tertiary: #8a8a8e;
    
    /* 强调色 - 保持苹果蓝，但微调以适配暖背景，或者使用暖橙色 */
    /* 这里保持经典的苹果蓝，它与米色背景搭配非常经典（如iBooks） */
    --accent: #0071e3;
    --accent-light: #409cff;
    --accent-hover: #0077ed;
    
    /* 柔和的暖色边框和阴影 */
    --border: rgba(60, 60, 67, 0.08);
    --border-light: rgba(60, 60, 67, 0.04);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.08);
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.02);
    
    /* 暖色渐变 */
    --gradient-hero: linear-gradient(180deg, #fdfcf8 0%, #f7f5f0 100%);
    --gradient-card: linear-gradient(135deg, #ffffff 0%, #fdfcf8 100%);
    --gradient-text: linear-gradient(135deg, #2c2c2e 0%, #48484a 100%);
    
    --blur-nav: 20px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 40px;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="dark"] {
    /* 暗色模式保持深邃，但微调为暖黑 */
    --bg-primary: #1c1c1e;
    --bg-secondary: #2c2c2e;
    --bg-tertiary: #3a3a3c;
    --bg-gradient-start: #1c1c1e;
    --bg-gradient-end: #000000;
    
    --text-primary: #f2f2f7;
    --text-secondary: #aeaeb2;
    --text-tertiary: #8e8e93;
    
    --accent: #0a84ff;
    --accent-light: #5ac8fa;
    --accent-hover: #0071e3;
    
    --border: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.05);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.3);
    
    --gradient-hero: linear-gradient(180deg, #1c1c1e 0%, #000000 100%);
    --gradient-card: linear-gradient(135deg, #2c2c2e 0%, #1c1c1e 100%);
    --gradient-text: linear-gradient(135deg, #f2f2f7 0%, #aeaeb2 100%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition-smooth), color var(--transition-smooth);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-hero);
    z-index: -1;
    pointer-events: none;
}

/* 纸张纹理效果 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(139, 115, 85, 0.015) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 115, 85, 0.01) 0%, transparent 40%),
        radial-gradient(circle at 40% 20%, rgba(139, 115, 85, 0.012) 0%, transparent 45%);
    z-index: -1;
    pointer-events: none;
}

.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    z-index: 1001;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 10px var(--accent-light);
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(var(--blur-nav)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-nav)) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all var(--transition-smooth);
}

[data-theme="dark"] .nav {
    background: rgba(30, 30, 32, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.nav-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 22px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-sm);
}

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

.theme-toggle svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.hero {
    background: transparent;
    padding: 160px 22px 100px;
    text-align: center;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 100%;
    background: radial-gradient(ellipse at center top, rgba(0, 102, 204, 0.03) 0%, transparent 60%);
    pointer-events: none;
}

/* 装饰性植物元素 */
.hero-decoration {
    position: absolute;
    bottom: 0;
    width: 120px;
    height: 200px;
    color: var(--text-tertiary);
    pointer-events: none;
    opacity: 0.6;
}

.hero-decoration-left {
    left: 5%;
    transform: translateX(-50%);
}

.hero-decoration-right {
    right: 5%;
    transform: translateX(50%) scaleX(-1);
}

.plant-decoration {
    width: 100%;
    height: 100%;
}

@media (max-width: 768px) {
    .hero-decoration {
        width: 80px;
        height: 150px;
        opacity: 0.4;
    }
    
    .hero-decoration-left {
        left: 2%;
    }
    
    .hero-decoration-right {
        right: 2%;
    }
}

@media (max-width: 480px) {
    .hero-decoration {
        display: none;
    }
}

.hero-title {
    font-size: clamp(44px, 7vw, 72px);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 20px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s ease-out;
}

.hero-subtitle {
    font-size: clamp(20px, 3.5vw, 26px);
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 16px;
    letter-spacing: -0.015em;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.hero-date {
    font-size: 15px;
    color: var(--text-tertiary);
    margin-bottom: 48px;
    letter-spacing: 0.02em;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-dedication {
    font-size: 16px;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 2;
    opacity: 0.9;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

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

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 22px;
}

.section {
    padding: 100px 0;
}

.section-title {
    font-size: clamp(32px, 5vw, 42px);
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 48px;
    text-align: center;
    color: var(--text-primary);
}

.preface {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    padding: 56px;
    margin-bottom: 100px;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 4px 12px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-light);
    transition: all var(--transition-smooth);
    position: relative;
}

.preface::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid rgba(139, 115, 85, 0.06);
    border-radius: calc(var(--radius-lg) - 8px);
    pointer-events: none;
}

.preface:hover {
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.05),
        0 16px 32px rgba(0, 0, 0, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.9);
    transform: translateY(-3px);
}

.preface-text {
    font-size: 16px;
    line-height: 2;
    color: var(--text-primary);
    text-align: justify;
    letter-spacing: 0.01em;
}

.preface-text p {
    margin-bottom: 28px;
}

.preface-signature {
    text-align: right;
    margin-top: 48px;
    color: var(--text-tertiary);
    font-size: 14px;
    letter-spacing: 0.02em;
}

.toc {
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    padding: 56px;
    margin-bottom: 100px;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.02),
        0 4px 12px rgba(0, 0, 0, 0.04),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-light);
    position: relative;
}

.toc::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid rgba(139, 115, 85, 0.06);
    border-radius: calc(var(--radius-lg) - 8px);
    pointer-events: none;
}

.toc-volume {
    margin-bottom: 40px;
}

.toc-volume:last-child {
    margin-bottom: 0;
}

.toc-volume-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
    letter-spacing: -0.01em;
}

.toc-chapters {
    display: grid;
    gap: 10px;
}

.toc-chapter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.toc-chapter:hover {
    background: var(--accent);
    color: white;
    transform: translateX(6px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.toc-chapter-number {
    font-size: 14px;
    color: var(--text-secondary);
    min-width: 60px;
}

.toc-chapter:hover .toc-chapter-number {
    color: rgba(255, 255, 255, 0.8);
}

.toc-chapter-title {
    flex: 1;
    font-size: 16px;
}

.chapter {
    margin-bottom: 100px;
    padding: 0 20px;
}

.chapter-header {
    text-align: center;
    margin-bottom: 56px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
}

.chapter-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.chapter-header-inner {
    display: inline-flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.chapter-number {
    font-size: 14px;
    color: var(--accent);
    letter-spacing: 0.1em;
    font-weight: 500;
}

.chapter-title {
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.chapter-content {
    font-size: 17px;
    line-height: 2.1;
    color: var(--text-primary);
    text-align: justify;
    letter-spacing: 0.01em;
}

.chapter-content p {
    margin-bottom: 26px;
    text-indent: 2em;
}

.chapter-content p:first-of-type::first-letter {
    font-size: 3.8em;
    float: left;
    line-height: 0.8;
    margin-right: 0.12em;
    margin-top: 0.05em;
    font-weight: 700;
    color: var(--accent);
}

.chapter-content p:first-child {
    text-indent: 0;
}

.chapter-content p:first-child::first-letter {
    font-size: 1em;
    float: none;
    margin: 0;
}

.chapter-divider {
    text-align: center;
    margin: 60px 0;
    position: relative;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-divider::before {
    content: '';
    position: absolute;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.chapter-divider::after {
    content: '❦';
    font-size: 24px;
    color: var(--accent);
    opacity: 0.6;
    background: var(--bg-primary);
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

.back-to-top {
    position: fixed;
    bottom: 36px;
    right: 36px;
    width: 44px;
    height: 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow);
    color: var(--text-secondary);
}

.back-to-top:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

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

.back-to-top svg {
    width: 20px;
    height: 20px;
}

.footer {
    background: var(--bg-secondary);
    padding: 60px 22px;
    text-align: center;
    border-top: 1px solid var(--border-light);
    margin-top: 60px;
}

.footer-text {
    font-size: 14px;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

@media (max-width: 768px) {
    .hero {
        padding: 120px 20px 60px;
        min-height: 70vh;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .container {
        padding: 0 18px;
    }
    
    .preface, .toc {
        padding: 32px 24px;
        border-radius: var(--radius-md);
    }
    
    .section {
        padding: 60px 0;
    }
    
    .chapter {
        margin-bottom: 60px;
        padding: 0 10px;
    }
    
    .chapter-header {
        margin-bottom: 36px;
        padding-bottom: 24px;
    }
    
    .chapter-title {
        font-size: 24px;
    }
    
    .chapter-content {
        font-size: 16px;
    }
    
    .chapter-content p:first-of-type::first-letter {
        font-size: 3em;
    }
    
    .back-to-top {
        bottom: 24px;
        right: 24px;
        width: 40px;
        height: 40px;
    }
}

.footer {
    background: var(--bg-secondary);
    padding: 60px 22px;
    text-align: center;
    border-top: 1px solid var(--border-light);
    margin-top: 60px;
}

.footer-text {
    font-size: 14px;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

/* 移动端导航默认隐藏 - 强制隐藏 */
.mobile-nav {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* 移动端导航优化 */
@media (max-width: 480px) {
    .nav-container {
        padding: 0 16px;
    }
    
    .nav-links {
        gap: 16px;
    }
    
    .nav-link {
        font-size: 13px;
        padding: 8px 12px;
        background: var(--bg-secondary);
        border-radius: var(--radius-sm);
        white-space: nowrap;
    }
    
    .nav-link:hover {
        background: var(--accent);
        color: white;
    }

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

    .hero-subtitle {
        font-size: 18px;
    }

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

    .chapter-title {
        font-size: 22px;
    }
    
    /* 移动端底部固定导航 */
    .mobile-nav {
        display: flex !important;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(253, 252, 248, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--border-light);
        padding: 8px 0;
        z-index: 999;
        justify-content: space-around;
        max-height: 70px;
        overflow: hidden;
    }
    
    [data-theme="dark"] .mobile-nav {
        background: rgba(28, 28, 30, 0.95);
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 16px;
        color: var(--text-secondary);
        text-decoration: none;
        font-size: 11px;
        gap: 4px;
        transition: color 0.2s ease;
    }
    
    .mobile-nav-item.active,
    .mobile-nav-item:hover {
        color: var(--accent);
    }
    
    .mobile-nav-item svg {
        width: 24px !important;
        height: 24px !important;
        max-width: 24px !important;
        max-height: 24px !important;
        fill: currentColor;
        flex-shrink: 0;
    }
    
    /* 为底部导航留出空间 */
    body {
        padding-bottom: 70px;
    }
    
    .back-to-top {
        bottom: 80px;
    }
}
