/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 蓝金配色方案 */
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --secondary-color: #d4af37;
    --secondary-dark: #a67c00;
    --accent-color: #f59e0b;

    /* 背景和文本 */
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-card: #1a1a1a;
    --text-primary: #e5e5e5;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --border-color: #333333;

    /* 阅读器设置 - 默认值 */
    --reader-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --reader-font-size: 18px;
    --reader-line-height: 2.2;
    --reader-bg: #0a0a0a;
    --reader-text: #e5e5e5;

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);

    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    --gradient-secondary: linear-gradient(135deg, #d4af37 0%, #f59e0b 100%);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--reader-font);
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

/* ===== 容器 ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 链接 ===== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

/* ===== 导航栏 ===== */
.navbar {
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.nav-logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

/* ===== Banner（精简版） ===== */
.banner {
    position: relative;
    min-height: 25vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 20px;
    overflow: hidden;
    border-bottom: 2px solid var(--secondary-color);
}

.banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0.08;
    z-index: -1;
}

.banner-content {
    text-align: center;
    padding: 0.5rem;
    z-index: 2;
    animation: fadeInUp 0.5s ease-out;
}

.banner-title {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.banner-subtitle {
    font-size: 0.9rem;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ===== 章节标题 ===== */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin: 2rem 0 1.25rem;
    color: var(--text-primary);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--gradient-secondary);
    margin: 0.625rem auto 0;
    border-radius: 2px;
}

/* ===== 小说介绍区域 ===== */
.novel-intro {
    padding: 2rem 0;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.novel-intro h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.novel-intro p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.novel-intro-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* ===== 章节目录（紧凑版） ===== */
.chapters-section {
    padding: 1.5rem 0;
    background: var(--bg-primary);
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

/* ===== 小说卡片 ===== */
.chapter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chapter-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.chapter-card:hover::before {
    opacity: 1;
}

.chapter-cover {
    width: 100%;
    height: 120px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    overflow: hidden;
}

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

.chapter-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.chapter-info {
    padding: 0.875rem;
}

.chapter-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapter-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== 阅读区域（简洁版） ===== */
.reading-section {
    padding: 0;
    background: var(--reader-bg);
    min-height: 100vh;
}

/* 阅读器工具栏 */
.reader-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.625rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.toolbar-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.625rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}

.toolbar-select:focus {
    border-color: var(--primary-color);
}

.reading-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

/* 章节信息行 */
.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.chapter-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chapter-info-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* 章节内容 */
.chapter-body {
    color: var(--reader-text);
    line-height: var(--reader-line-height);
    font-size: var(--reader-font-size);
    font-family: var(--reader-font);
    margin-bottom: 2rem;
}

.chapter-body p {
    margin-bottom: 1.25rem;
    text-indent: 2em;
    line-height: var(--reader-line-height);
}

.reading-footer {
    margin-top: 2rem;
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

/* 悬浮导航条 */
.floating-nav {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 999;
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
}

.floating-nav .btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 自动滚动按钮 */
.auto-scroll-btn {
    background: var(--gradient-primary);
    color: white;
}

.auto-scroll-btn.active {
    background: var(--danger-color);
}

/* ===== 设置面板 ===== */
.settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
}

.settings-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.settings-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 80px;
}

.settings-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-controls span {
    min-width: 40px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-btn:hover {
    transform: scale(1.1);
    border-color: var(--secondary-color);
}

.color-btn.active {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 2px var(--secondary-color);
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn-primary {
    background: var(--gradient-secondary);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: rgba(212, 175, 55, 0.1);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 页脚 ===== */
.footer {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 1.5rem 0 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-links {
    margin-top: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
    margin: 0 0.75rem;
    transition: all 0.3s ease;
}

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

/* ===== 加载状态 ===== */
.loading-page {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 24px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 175, 55, 0.1);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.error {
    color: #ef4444;
}

/* ===== 模态框 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.modal-body {
    padding: 1.25rem;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== 动画 ===== */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ===== 响应式设计 ===== */
@media (max-width: 1400px) {
    .chapters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .chapters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .banner {
        min-height: 20vh;
        padding: 1rem 16px;
    }

    .banner-title {
        font-size: 1.25rem;
    }

    .banner-subtitle {
        font-size: 0.85rem;
    }

    .chapters-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    .chapter-cover {
        height: 100px;
    }

    .reading-content {
        padding: 1.5rem 1rem 2rem;
    }

    .chapter-name {
        font-size: 1.1rem;
    }

    .reader-toolbar {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }

    .floating-nav {
        bottom: 1rem;
    }

    .nav-container {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 16px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 0.75rem;
    }

    .section-title {
        font-size: 1.25rem;
        margin: 1.5rem 0 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 0.5rem;
    }

    .settings-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-group label {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .banner-title {
        font-size: 1.1rem;
    }

    .chapter-cover {
        height: 80px;
    }

    .chapter-title {
        font-size: 0.875rem;
    }

    .reading-content {
        padding: 1rem 0.75rem 1.5rem;
    }

    .chapters-section,
    .novel-intro {
        padding: 1.25rem 0;
    }

    .floating-nav .btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* ===== 滚动条样式 ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ===== 选择文本样式 ===== */
::selection {
    background: rgba(30, 64, 175, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(30, 64, 175, 0.3);
    color: var(--text-primary);
}

/* ===== 版权声明 ===== */
.copyright-section {
    padding: 2rem 0;
    background: var(--bg-secondary);
}

.copyright-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.copyright-content p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.copyright-content strong {
    color: var(--secondary-color);
}

.copyright-content hr {
    margin: 1.25rem 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ===== 小说介绍 ===== */
.novel-intro {
    padding: 2rem 0;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.novel-intro h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.novel-intro p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.novel-intro-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1.25rem 0;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== 章节信息行 ===== */
.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.chapter-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chapter-info-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== 阅读器工具栏 - 固定在顶部 ===== */
.reader-toolbar-fixed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.625rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 隐藏原来的工具栏（只使用固定工具栏）*/
.reading-section .reader-toolbar {
    display: none;
}

/* ===== 章节列表（紧凑版 - 一行三列） ===== */
.chapters-section {
    padding: 1.5rem 0;
}

.chapters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.chapter-item-compact {
    flex: 0 0 calc(33.333% - 0.34rem);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chapter-item-compact:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.chapter-item-compact:hover .chapter-title,
.chapter-item-compact:hover .chapter-number,
.chapter-item-compact:hover .chapter-words {
    color: #fff;
}

.chapter-number {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.875rem;
    white-space: nowrap;
}

.chapter-title {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-words {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== 紧凑章节的响应式 ===== */
@media (max-width: 1024px) {
    .chapter-item-compact {
        flex: 0 0 calc(50% - 0.26rem);
    }
}

@media (max-width: 768px) {
    .chapter-item-compact {
        flex: 0 0 100%;
    }
    
    .chapters-section {
        padding: 1rem 0;
    }
}

@media (max-width: 480px) {
    .chapter-item-compact {
        padding: 0.625rem 0.75rem;
        gap: 0.5rem;
    }
    
    .chapter-title {
        font-size: 0.875rem;
    }
}
