
:root {
    --primary-color: #3a6ea5;
    --secondary-color: #f8f9fa;
    --accent-color: #ff6b6b;
    --text-color: #333;
    --text-light: #666;
    --border-color: #dee2e6;
    --bg-light: #f8f9fa;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 深色模式调色板（系统偏好） */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #2b6cb0;
            --secondary-color: #14202d;
        --text-color: #e6eef8;
        --text-light: #9aa6b2;
        --border-color: #2a3945;
        --bg-light: #14202d; /* 用作浅层块背景 */
    }
    body { background-color: #0b0f12; color: var(--text-color); }
    .site-header, .site-footer,
    .featured-novel, .stat-item,
    .novel-card, .novel-detail,
    .reading-area, .chapter-dropdown { background-color: #0f1720; }
    /* 首页大横幅在深色下使用暗色渐变，避免“半黑半白” */
    .hero { background: linear-gradient(135deg, #0f2233 0%, #0b1724 100%); color: var(--text-color); }
    .hero .btn-primary { background-color: var(--primary-color); }
    .site-footer { color: var(--text-light); }
    .novel-meta span, .tag, .novel-description { background-color: var(--bg-light); }
    .chapter-item a:hover, .btn-secondary:hover { background-color: var(--bg-light); }
    .btn-secondary { background-color: #0f1720; color: var(--text-color); border-color: var(--border-color); }
}

/* 显式强制深色（覆盖系统偏好） */
:root[data-theme="dark"] {
    --primary-color: #2b6cb0;
    --secondary-color: #14202d;
    --text-color: #e6eef8;
    --text-light: #9aa6b2;
    --border-color: #2a3945;
    --bg-light: #14202d;
}
:root[data-theme="dark"] body { background-color: #0b0f12; color: var(--text-color); }
:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .site-footer,
:root[data-theme="dark"] .featured-novel,
:root[data-theme="dark"] .stat-item,
:root[data-theme="dark"] .novel-card,
:root[data-theme="dark"] .novel-detail,
:root[data-theme="dark"] .reading-area,
:root[data-theme="dark"] .chapter-dropdown { background-color: #0f1720; }
/* 显式深色时：首页横幅暗色渐变 */
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #0f2233 0%, #0b1724 100%); color: var(--text-color); }
:root[data-theme="dark"] .site-footer { color: var(--text-light); }
:root[data-theme="dark"] .novel-meta span,
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .novel-description { background-color: var(--bg-light); }
:root[data-theme="dark"] .chapter-item a:hover,
:root[data-theme="dark"] .btn-secondary:hover { background-color: var(--bg-light); }
:root[data-theme="dark"] .btn-secondary { background-color: #0f1720; color: var(--text-color); border-color: var(--border-color); }

/* 显式强制浅色（覆盖系统偏好） */
:root[data-theme="light"] {
    --primary-color: #3a6ea5;
    --text-color: #333;
    --text-light: #666;
    --border-color: #dee2e6;
    --bg-light: #f8f9fa;
}
:root[data-theme="light"] body { background-color: #f5f5f5; color: #333; }

/* 显式浅色：覆盖系统深色下的组件底色等（避免叠加导致混色） */
:root[data-theme="light"] .site-header,
:root[data-theme="light"] .site-footer,
:root[data-theme="light"] .featured-novel,
:root[data-theme="light"] .stat-item,
:root[data-theme="light"] .novel-card,
:root[data-theme="light"] .novel-detail,
:root[data-theme="light"] .reading-area,
:root[data-theme="light"] .chapter-dropdown { background-color: white; }
:root[data-theme="light"] .site-footer { color: var(--text-light); }
:root[data-theme="light"] .novel-meta span,
:root[data-theme="light"] .tag,
:root[data-theme="light"] .novel-description { background-color: var(--bg-light); }
:root[data-theme="light"] .chapter-item a:hover,
:root[data-theme="light"] .btn-secondary:hover { background-color: var(--bg-light); }
:root[data-theme="light"] .btn-secondary { background-color: var(--secondary-color); color: var(--text-color); border-color: var(--border-color); }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif SC', serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.site-header {
    background-color: white;
    box-shadow: var(--shadow);
    padding: 15px 0;
    margin-bottom: 30px;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-header h1 a {
    color: var(--primary-color);
    text-decoration: none;
}

.site-header nav a {
    margin-left: 20px;
    text-decoration: none;
    color: var(--text-color);
}

.site-header nav a:hover {
    color: var(--primary-color);
}

/* 底部样式 */
.site-footer {
    margin-top: 50px;
    padding: 20px 0;
    background-color: white;
    text-align: center;
    color: var(--text-light);
}

/* 按钮样式 */
.btn-primary, .btn-secondary, .btn-icon {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2c5282;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e9ecef;
}

.btn-icon {
    background: none;
    font-size: 1.5rem;
    padding: 5px 10px;
}

/* 首页样式 */
.hero {
    text-align: center;
    padding: 50px 0;
    background: linear-gradient(135deg, #3a6ea5 0%, #2c5282 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 40px;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

.featured-novels {
    margin-bottom: 40px;
}

.featured-novels h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.featured-novel {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.featured-novel:hover {
    transform: translateY(-5px);
}

.featured-cover {
    height: 200px;
    overflow: hidden;
}

.featured-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-info {
    padding: 15px;
}

.featured-info h3 {
    margin-bottom: 10px;
}

.featured-info h3 a {
    color: var(--text-color);
    text-decoration: none;
}

.featured-info h3 a:hover {
    color: var(--primary-color);
}

.featured-info .author {
    color: var(--text-light);
    margin-bottom: 10px;
}

.featured-info .description {
    font-size: 0.9rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-item {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-item h3 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* 小说列表样式 */
.novels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.novel-card {
    display: flex;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.novel-cover {
    width: 120px;
    flex-shrink: 0;
}

.novel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.novel-info {
    padding: 15px;
    flex-grow: 1;
}

.novel-info h2 {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.novel-info h2 a {
    color: var(--text-color);
    text-decoration: none;
}

.novel-info h2 a:hover {
    color: var(--primary-color);
}

.novel-author {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.novel-description {
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3; /* 标准属性 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.novel-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.8rem;
}

.novel-meta span {
    padding: 3px 8px;
    border-radius: 12px;
    background-color: var(--bg-light);
}

.novel-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 12px;
    background-color: #e9ecef;
    color: var(--text-light);
}

/* 小说详情页样式 */
.novel-detail {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.novel-header {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.novel-cover-large {
    width: 200px;
    flex-shrink: 0;
}

.novel-cover-large img {
    width: 100%;
    border-radius: 8px;
}

.novel-info h1 {
    margin-bottom: 10px;
}

.novel-info .author {
    color: var(--text-light);
    margin-bottom: 15px;
}

.novel-info .meta {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.novel-info .meta span {
    padding: 5px 10px;
    border-radius: 15px;
    background-color: var(--bg-light);
    font-size: 0.9rem;
}

.novel-info .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
}

.novel-info .actions {
    display: flex;
    gap: 10px;
}

.novel-description {
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--bg-light);
    border-radius: 8px;
}

.novel-description h3 {
    margin-bottom: 10px;
}

.chapters-list h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.chapters-container {
    max-height: 500px;
    overflow-y: auto;
}

.chapter-item {
    border-bottom: 1px solid var(--border-color);
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-item a {
    display: flex;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.chapter-item a:hover {
    background-color: var(--bg-light);
}

.chapter-number {
    width: 80px;
    flex-shrink: 0;
    color: var(--text-light);
}

.chapter-title {
    flex-grow: 1;
}

.chapter-word-count {
    width: 60px;
    flex-shrink: 0;
    text-align: right;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 阅读区域样式 */
.reading-area {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: white;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.reading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.reading-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.chapter-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.chapter-content p {
    margin-bottom: 1.5em;
    text-indent: 2em;
}

.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .novel-header {
        flex-direction: column;
    }
    
    .novel-cover-large {
        align-self: center;
    }
    
    .featured-grid {
        grid-template-columns: 1fr;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .novels-grid {
        grid-template-columns: 1fr;
    }
    
    .chapter-item a {
        flex-direction: column;
    }
    
    .chapter-number, .chapter-word-count {
        width: auto;
    }
}

/* 深色模式收口覆盖：放在文件末尾，保证覆盖掉上方的浅色基准样式 */
@media (prefers-color-scheme: dark) {
    body { background-color: #0b0f12; color: var(--text-color); }
    .site-header, .site-footer,
    .featured-novel, .stat-item,
    .novel-card, .novel-detail,
    .reading-area, .chapter-dropdown { background-color: #0f1720; }
    .hero { background: linear-gradient(135deg, #0f2233 0%, #0b1724 100%); color: var(--text-color); }
    .site-footer { color: var(--text-light); }
    .novel-meta span, .tag, .novel-description { background-color: var(--bg-light); }
    .chapter-item a:hover, .btn-secondary:hover { background-color: var(--bg-light); }
    .btn-secondary { background-color: #0f1720; color: var(--text-color); border-color: var(--border-color); }
}

/* 显式深色（data-theme="dark"）收口覆盖：同理放在末尾，确保以此为准 */
:root[data-theme="dark"] body { background-color: #0b0f12; color: var(--text-color); }
:root[data-theme="dark"] .site-header,
:root[data-theme="dark"] .site-footer,
:root[data-theme="dark"] .featured-novel,
:root[data-theme="dark"] .stat-item,
:root[data-theme="dark"] .novel-card,
:root[data-theme="dark"] .novel-detail,
:root[data-theme="dark"] .reading-area,
:root[data-theme="dark"] .chapter-dropdown { background-color: #0f1720; }
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #0f2233 0%, #0b1724 100%); color: var(--text-color); }
:root[data-theme="dark"] .site-footer { color: var(--text-light); }
:root[data-theme="dark"] .novel-meta span,
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .novel-description { background-color: var(--bg-light); }
:root[data-theme="dark"] .chapter-item a:hover,
:root[data-theme="dark"] .btn-secondary:hover { background-color: var(--bg-light); }
:root[data-theme="dark"] .btn-secondary { background-color: #0f1720; color: var(--text-color); border-color: var(--border-color); }
