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

:root {
    --primary-color: #ff6b6b;
    --primary-dark: #ee5a5a;
    --secondary-color: #4ecdc4;
    --text-color: #333;
    --text-light: #666;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.app {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-color);
}

/* 顶部导航 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
    font-size: 1.2rem;
    font-weight: bold;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.nav a.active,
.nav a:hover {
    color: white;
}

/* 主内容区 */
.main {
    padding: 20px;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

/* 书籍封面区 */
.book-cover {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    gap: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.cover-image {
    width: 120px;
    height: 160px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cover-art {
    font-size: 60px;
}

.book-info {
    flex: 1;
}

.book-title {
    font-size: 1.4rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.book-author {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.book-status {
    margin-bottom: 10px;
}

.status-tag,
.update-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-right: 8px;
}

.status-tag {
    background: #e3f2fd;
    color: #1976d2;
}

.update-tag {
    background: #fff3e0;
    color: #f57c00;
}

.book-stats {
    display: flex;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.book-actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f0f0f0;
    color: var(--text-color);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* 简介区 */
.book-intro {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.book-intro h3 {
    margin-bottom: 15px;
    color: var(--text-color);
    font-size: 1.1rem;
}

.book-intro p {
    color: var(--text-light);
    margin-bottom: 10px;
    text-align: justify;
}

/* 最新章节 */
.latest-chapters {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.latest-chapters h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.chapter-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.chapter-item:hover {
    background: #e9ecef;
}

.chapter-item .chapter-num {
    color: var(--text-light);
    font-size: 0.85rem;
}

.chapter-item .chapter-title-text {
    flex: 1;
    margin-left: 10px;
    font-size: 0.95rem;
}

.chapter-item .chapter-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.chapter-item .chapter-status.free {
    background: #e8f5e9;
    color: #2e7d32;
}

.chapter-item .chapter-status.vip {
    background: #fff3e0;
    color: #f57c00;
}

.chapter-item .chapter-date {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-left: 10px;
}

/* 目录页 */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.catalog-header h2 {
    font-size: 1.2rem;
}

.catalog-sort {
    display: flex;
    gap: 10px;
}

.catalog-sort button {
    padding: 5px 15px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
}

.catalog-sort button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.catalog-list {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.catalog-list .chapter-item {
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
}

.catalog-list .chapter-item:last-child {
    border-bottom: none;
}

/* 阅读页 */
.reader-section {
    background: #faf7f0;
    min-height: 100vh;
}

.reader-header {
    position: sticky;
    top: 0;
    background: #faf7f0;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    z-index: 50;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
}

.chapter-title {
    font-weight: bold;
    font-size: 1rem;
}

.font-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.reader-content {
    padding: 30px 20px;
    max-width: 700px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
}

.reader-content h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

.reader-content p {
    margin-bottom: 20px;
    text-indent: 2em;
}

.reader-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px;
    display: flex;
    justify-content: space-around;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 0 auto;
}

.reader-nav button {
    padding: 10px 25px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.reader-nav button:hover {
    background: #f0f0f0;
}

/* 关于页 */
.about-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.about-content h2 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.about-section {
    margin-bottom: 25px;
}

.about-section h3 {
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--text-color);
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.info-table td:first-child {
    color: var(--text-light);
    width: 100px;
}

/* 字体设置弹窗 */
.font-settings {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
}

.font-settings.show {
    display: flex;
}

.settings-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    width: 300px;
}

.settings-panel h4 {
    margin-bottom: 20px;
    text-align: center;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.font-size-options {
    display: flex;
    gap: 10px;
}

.font-size-options button {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 5px;
    cursor: pointer;
}

.font-size-options button:hover {
    background: #f0f0f0;
}

.bg-options {
    display: flex;
    gap: 10px;
}

.bg-options button {
    width: 40px;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 5px;
    cursor: pointer;
}

.bg-options button:hover {
    border-color: var(--primary-color);
}

.bg-white {
    background: white;
    border: 1px solid #ddd;
}

.bg-beige {
    background: #faf7f0;
}

.bg-dark {
    background: #2c3e50;
}

/* 底部 */
.footer {
    background: white;
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.copyright {
    color: var(--text-light);
    font-size: 0.8rem;
}

/* 响应式 */
@media (max-width: 600px) {
    .book-cover {
        flex-direction: column;
        align-items: center;
    }
    
    .cover-image {
        width: 150px;
        height: 200px;
    }
    
    .book-info {
        text-align: center;
    }
    
    .book-stats {
        justify-content: center;
    }
    
    .book-actions {
        justify-content: center;
    }
    
    .nav {
        gap: 15px;
    }
    
    .nav a {
        font-size: 0.85rem;
    }
    
    .reader-content {
        padding: 20px 15px;
    }
    
    .reader-nav button {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}