:root {
    --color-bg: #F7F7F7;
    --color-bg-secondary: #F0F0F0;
    
    /* 金色主色系 */
    --color-gold: #C9A227;
    --color-gold-light: #E8C547;
    --color-gold-dark: #A68B1F;
    --color-gold-50: #FDF8E8;
    --color-gold-100: #F9F0C8;
    --color-gold-200: #F3E4A0;
    
    --color-text-primary: #1A1A1A;
    --color-text-secondary: #666666;
    --color-text-muted: #999999;
    --color-white: #FFFFFF;
    --color-accent: #FF6B6B;
    --color-accent-dark: #E53E3E;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--color-white);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* 顶部导航栏 */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 1000;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

.nav-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    text-decoration: none;
}

.nav-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
    text-align: center;
}

.nav-actions {
    display: flex;
    gap: 4px;
}

.nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
}

/* 书籍详情导航栏 */
.book-tabs {
    display: flex;
    background: var(--color-white);
    border-bottom: 1px solid #F0F0F0;
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    z-index: 99;
}

.tab-item {
    flex: 1;
    padding: 14px 0;
    text-align: center;
    font-size: 15px;
    color: var(--color-text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-item.active {
    color: var(--color-text-primary);
    font-weight: 600;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--color-text-primary);
    border-radius: 2px;
}

/* 目录容器 */
.toc-container {
    padding: 108px 16px 16px;
    background: var(--color-white);
}

/* 目录列表 */
.toc-list {
    background: var(--color-white);
    overflow: hidden;
}

/* 前言/结语/附录 样式 */
.toc-preface {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #F0F0F0;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.toc-preface:last-child {
    border-bottom: none;
}

/* 篇级折叠容器 */
.toc-part {
    border-bottom: 1px solid #F0F0F0;
}

.toc-part:last-child {
    border-bottom: none;
}

.toc-part-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    background: var(--color-white);
    transition: background 0.2s ease;
}

.toc-part-header:active {
    background: #F9F9F9;
}

.toc-part-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.toc-toggle-icon {
    font-size: 12px;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
}

.toc-part.expanded .toc-toggle-icon {
    transform: rotate(180deg);
}

/* 篇级内容区域 */
.toc-part-content {
    display: none;
    background: #FAFAFA;
    padding: 8px 0;
}

.toc-part.expanded .toc-part-content {
    display: block;
}

/* 章节项 */
.toc-chapter-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 16px 10px 20px;
    gap: 8px;
}

.toc-chapter-num {
    color: var(--color-gold);
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 52px;
}

.toc-chapter-title {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.5;
    flex: 1;
}

/* 三级目录（小节）样式 */
.toc-section-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 16px 8px 80px;
    gap: 8px;
}

.toc-section-title {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
    flex: 1;
}

/* 底部占位 */
.bottom-spacer {
    height: 80px;
}

/* 底部固定购买栏 */
.bottom-buy-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 100;
}

.buy-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.buy-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.price-symbol {
    font-size: 14px;
    color: #FF6B6B;
    font-weight: 500;
}

.price-num {
    font-size: 28px;
    font-weight: 700;
    color: #FF6B6B;
    line-height: 1;
}

.price-original {
    font-size: 14px;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.btn-buy {
    background: #1A1A1A;
    color: var(--color-white);
    border: none;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-buy:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    max-width: 360px;
    width: 100%;
    padding: 28px 24px;
    text-align: center;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #F5F5F5;
    border-radius: 50%;
    font-size: 16px;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}

.modal-desc {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-qr {
    width: 160px;
    height: 160px;
    background: #F5F5F5;
    border-radius: var(--radius-md);
    margin: 0 auto 16px;
    overflow: hidden;
}

.modal-qr-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-wechat {
    text-align: center;
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.modal-wechat-id {
    font-weight: 600;
    color: var(--color-text-primary);
}

.btn-copy {
    width: 100%;
    background: #1A1A1A;
    color: var(--color-white);
    border: none;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.btn-copy:active {
    opacity: 0.9;
}

.modal-tip {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

/* 响应式 - 电脑端 */
@media (min-width: 768px) {
    body {
        max-width: 480px;
        margin: 0 auto;
        background: #E5E5E5;
    }

    .top-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }

    .book-tabs {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }

    .bottom-buy-bar {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
    }
}
