﻿/* 全局变量 */
:root {
    --primary-color: #4e8cbb;
    --primary-dark: #3a7cb2;
    --text-color: #333;
    --text-light: #666;
    --text-lighter: #999;
    --bg-color: #f5f5f5;
    --border-color: #e6d8b6;
    --hover-color: #b89b5b;
    --section-bg: #f9f6ec;
    --card-shadow: 0 2px 12px rgba(180,160,100,0.10);
    --error-color: #e74c3c;
    --success-color: #27ae60;
    --accent-color: #d4af37;
    --transition: all 0.3s ease;
}

/* 主体内容区域样式 */
.g-bd {
    background: var(--bg-color);
}



/* 书籍内容区域样式 */
.book-content {
    background: var(--section-bg);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
}

    .book-content h1 {
        text-align: center;
        color: #5a4321;
        font-size: 28px;
        font-weight: 600;
        padding-bottom: 15px;
        border-bottom: 2px solid var(--hover-color);
        position: relative;
        display: block;
        width: 100%;
    }

/* 章节头部样式 */
.chapter-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chapter-title {
    flex: 1;
    margin: 0;
   
    font-size: 24px;
    color: #333;
}

.chapter-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    color: #666;
    font-size: 14px;
}

.read-btn {
    display: inline-flex;
    align-items: center;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.read-btn:hover {
    background: #357abd;
}

.read-btn.reading {
    background: #e74c3c;
}

.hits-count, .publish-time {
    display: inline-flex;
    align-items: center;
}

/* 章节内容样式 */
.book-content .chapter-content {
    line-height: 1.8;
    font-size: 16px;
    color: #333;
    margin: 5px 0;
    background: #fefefe;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
}

/* 章节内容中的段落样式 - 让文章更具可读性 */
.book-content .chapter-content p {
    margin: 0;
    padding: 0px 16px;
    line-height: 2.4;
    font-size: 17px;
    color: #2c3e50;
    text-align: justify;
    text-justify: inter-ideograph;
    word-spacing: 1px;
    letter-spacing: 0.3px;
    text-indent: 2em; /* 首行缩进 */
    position: relative;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.8);
}

/* 第一个段落特殊处理 */
.book-content .chapter-content p:first-of-type {
    margin-top: 0;
    font-weight: 500;
}

/* 最后一个段落 */
.book-content .chapter-content p:last-of-type {
    margin-bottom: 0;
}

/* 段落悬停效果 - 已禁用 */
/*
.book-content .chapter-content p:hover {
    background: rgba(74, 144, 226, 0.05);
    border-radius: 6px;
    padding: 16px 20px;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.08);
    transition: all 0.3s ease;
    cursor: text;
}
*/

/* 段落首字母/首字符特殊样式（可选） */
.book-content .chapter-content p:first-of-type::first-letter {
    font-size: 1.3em;
    font-weight: 600;
    color: #4a90e2;
    margin-right: 2px;
}

/* 空段落处理 */
.book-content .chapter-content p:empty {
    display: none;
}

/* 包含特殊标记的段落（如引用、对话等） */
.book-content .chapter-content p:has(> em),
.book-content .chapter-content p:has(> strong) {
    background: rgba(212, 175, 55, 0.03);
    border-left: 3px solid #d4af37;
    padding-left: 20px;
    margin-left: -20px;
    border-radius: 0 6px 6px 0;
}

/* 强调文本样式 */
.book-content .chapter-content p strong {
    color: #c0392b;
    font-weight: 600;
}

.book-content .chapter-content p em {
    color: #8e44ad;
    font-style: italic;
    font-weight: 500;
}

/* 导航按钮样式 */
.book-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    padding-bottom:15px;
    padding-left:100px;
    padding-right:100px;
    font-size:20px;
    border-top: 1px solid #eee;
}

.book-nav a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.3s ease;
}

.book-nav a:hover {
    color: #357abd;
}

.book-nav .disabled {
    color: #999;
    cursor: not-allowed;
}

.catalog {
    padding: 5px 15px;
    background: #f5f5f5;
    border-radius: 15px;
}

.catalog:hover {
    background: #e8e8e8;
}

/* 信息标签页样式 - 优化版 */
.info-tabs {
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(180, 160, 100, 0.15);
    border: 1px solid #e6d8b6;
    background: #fff;
    position: relative;
}

.info-tabs::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #d4af37 0%, #b89b5b 50%, #d4af37 100%);
    border-radius: 16px 16px 0 0;
}

.info-tab-header {
    display: flex;
    background: linear-gradient(135deg, #faf8f2 0%, #f5f1e8 100%);
    border-bottom: 2px solid #e6d8b6;
    padding: 0;
    margin: 0;
    overflow-x: visible; /* 去掉滚动 */
    white-space: normal; /* 允许换行 */
    position: relative;
    margin-top: 4px;
    flex-wrap: wrap; /* 允许标签页换行 */
}

.info-tab-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #d4af37 50%, transparent 100%);
}

.info-tab-header .tab-btn {
    flex: 0 0 auto; /* 不自动伸缩，保持内容宽度 */
    min-width: 100px; /* 减小最小宽度 */
    max-width: 200px; /* 设置最大宽度 */
    padding: 15px 20px; /* 减小内边距 */
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 14px; /* 减小字体 */
    font-weight: 500;
    text-align: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid rgba(230, 216, 182, 0.5);
    display: inline-block;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    white-space: nowrap; /* 标签文字不换行 */
    overflow: hidden;
    text-overflow: ellipsis; /* 超长文字显示省略号 */
}

.info-tab-header .tab-btn:last-child {
    border-right: none;
}

.info-tab-header .tab-btn:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(184, 155, 91, 0.12) 100%);
    color: #5a4321;
    transform: translateY(-1px);
}

.info-tab-header .tab-btn.active {
    background: linear-gradient(135deg, #fff 0%, #fdfcf8 100%);
    color: #b89b5b;
    font-weight: 600;
    border-bottom: 3px solid #d4af37;
    margin-bottom: -2px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

.info-tab-header .tab-btn.active::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 8px;
    width: 4px;
    height: 4px;
    background: #d4af37;
    border-radius: 50%;
    transform: translateY(-50%);
}

.info-tab-header .tab-btn.active::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    width: 4px;
    height: 4px;
    background: #d4af37;
    border-radius: 50%;
    transform: translateY(-50%);
}

.info-tab-content {
    position: relative;
    min-height: 200px;
    background: #fff;
}

.info-item {
    padding: 35px 40px;
    background: #fff;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    border: none;
    position: relative;
}

.info-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 40px;
    right: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(212, 175, 55, 0.3) 20%, rgba(212, 175, 55, 0.6) 50%, rgba(212, 175, 55, 0.3) 80%, transparent 100%);
}

.tab-panel {
    display: none;
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-panel.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-content {
    line-height: 1.9;
    font-size: 16px;
    color: #333;
    text-align: justify;
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    position: relative;
}

.info-content::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: -15px;
    font-size: 48px;
    color: rgba(212, 175, 55, 0.2);
    font-family: Georgia, serif;
    line-height: 1;
}

.info-content p {
    margin-bottom: 18px;
    text-indent: 2em;
    position: relative;
}

.info-content p:first-child {
    margin-top: 20px;
}

.info-content p:last-child {
    margin-bottom: 0;
}

.info-content p::first-line {
    font-weight: 500;
    color: #5a4321;
}

/* 标签页内容特殊样式 */
.info-content h3 {
    color: #b89b5b;
    font-size: 18px;
    margin: 25px 0 15px 0;
    font-weight: 600;
    position: relative;
    padding-left: 20px;
}

.info-content h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 12px;
    height: 2px;
    background: #d4af37;
    transform: translateY(-50%);
}

.info-content blockquote {
    margin: 20px 0;
    padding: 20px 25px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(212, 175, 55, 0.12) 100%);
    border-left: 4px solid #d4af37;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    position: relative;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.1);
}

.info-content blockquote::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 15px;
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23d4af37"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>') no-repeat center;
    background-size: contain;
    opacity: 0.3;
}

.info-content ul, .info-content ol {
    margin: 20px 0;
    padding-left: 35px;
}

.info-content li {
    margin-bottom: 10px;
    line-height: 1.7;
    position: relative;
}

.info-content ul li::before {
    content: '◦';
    color: #d4af37;
    font-weight: bold;
    position: absolute;
    left: -20px;
}

/* 移动端标签页样式 - 优化版 */
@media screen and (max-width: 768px) {
    .info-tabs {
        margin: 20px -10px;
        border-radius: 12px;
        box-shadow: 0 2px 15px rgba(180, 160, 100, 0.12);
    }
    
    .info-tabs::before {
        height: 3px;
        border-radius: 12px 12px 0 0;
    }
    
    .info-tab-header {
        flex-wrap: wrap; /* 允许换行 */
        overflow-x: visible; /* 去掉滚动 */
        padding-bottom: 2px;
    }
    
    .info-tab-header::-webkit-scrollbar {
        display: none;
    }
    
    .info-tab-header .tab-btn {
        min-width: 100px; /* 减小最小宽度 */
        max-width: 150px; /* 设置最大宽度 */
        padding: 12px 15px; /* 减小内边距 */
        font-size: 13px; /* 减小字体 */
        flex: 0 0 auto; /* 不自动伸缩 */
        white-space: nowrap;
        border-right: 1px solid rgba(230, 216, 182, 0.5);
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .info-tab-header .tab-btn.active {
        border-bottom: 2px solid #d4af37;
        margin-bottom: -1px;
    }
    
    .info-tab-header .tab-btn.active::before,
    .info-tab-header .tab-btn.active::after {
        width: 3px;
        height: 3px;
    }
    
    .info-item {
        padding: 25px 20px;
    }
    
    .info-item::before {
        left: 20px;
        right: 20px;
    }
    
    .info-content {
        font-size: 15px;
        line-height: 1.8;
    }
    
    .info-content::before {
        font-size: 36px;
        top: -5px;
        left: -10px;
    }
    
    .info-content p {
        margin-bottom: 15px;
        text-indent: 1.5em;
    }
    
    .info-content p:first-child {
        margin-top: 15px;
    }
    
    .info-content h3 {
        font-size: 16px;
        margin: 20px 0 12px 0;
        padding-left: 15px;
    }
    
    .info-content h3::before {
        width: 10px;
    }
    
    .info-content blockquote {
        margin: 15px 0;
        padding: 15px 18px;
        border-radius: 0 8px 8px 0;
    }
    
    .info-content blockquote::before {
        width: 16px;
        height: 16px;
        top: 8px;
        right: 12px;
    }
    
    .info-content ul, .info-content ol {
        margin: 15px 0;
        padding-left: 25px;
    }
    
    .info-content li {
        margin-bottom: 8px;
        line-height: 1.6;
    }
    
    .info-content ul li::before {
        left: -15px;
    }
}

@media screen and (max-width: 480px) {
    .info-tabs {
        margin: 15px -5px;
        border-radius: 10px;
    }
    
    .info-tab-header .tab-btn {
        min-width: 90px;
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .info-item {
        padding: 20px 15px;
    }
    
    .info-content {
        font-size: 14px;
        line-height: 1.75;
    }
    
    .info-content::before {
        font-size: 28px;
        top: -2px;
        left: -8px;
    }
    
    .info-content p {
        text-indent: 1em;
        margin-bottom: 12px;
    }
    
    .info-content h3 {
        font-size: 15px;
        margin: 15px 0 10px 0;
        padding-left: 12px;
    }
    
    .info-content blockquote {
        padding: 12px 15px;
        margin: 12px 0;
    }
}

/* 错误消息样式 */
.error-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

    .error-message h1 {
        font-size: 24px;
        color: var(--error-color);
        margin-bottom: 20px;
    }

    .error-message p {
        font-size: 16px;
        margin-bottom: 30px;
    }

    .error-message .back-home {
        display: inline-block;
        padding: 12px 24px;
        background: var(--primary-color);
        color: #fff;
        text-decoration: none;
        border-radius: 8px;
        transition: var(--transition);
    }

        .error-message .back-home:hover {
            background: var(--primary-dark);
            transform: translateY(-2px);
        }

/* 移动端导航样式 */
.mobile-nav {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* 朗读控制按钮样式 */
.read-aloud-controls {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
}

.read-aloud-btn {
    padding: 5px 15px;
    border: 1px solid #b89b5b;
    background: #fff;
    color: #b89b5b;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.read-aloud-btn:hover {
    background: #b89b5b;
    color: #fff;
}

/* 阅读进度条样式 */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(to right, var(--hover-color), var(--accent-color));
    z-index: 9999;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* 拼音和米字格功能样式 */
.feature-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(184, 155, 91, 0.05);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.feature-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-color);
}

.feature-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--hover-color);
    cursor: pointer;
}

.feature-toggle label {
    cursor: pointer;
    user-select: none;
}

/* 键盘快捷键提示 */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
    max-width: 200px;
}

.keyboard-shortcuts.show {
    opacity: 1;
    visibility: visible;
}

.keyboard-shortcuts h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--accent-color);
}

.keyboard-shortcuts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.keyboard-shortcuts li {
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.keyboard-shortcuts kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 11px;
}

/* 移动端优化 */
@media screen and (max-width: 768px) {
 



        .book-content h1 {
            font-size: 24px;
            margin-bottom: 25px;
        }

        /* 768px以下设备的段落样式 */
     

        .book-content .chapter-content p {
            font-size: 16px;
            line-height: 2.3;
            margin: 0 0 24px 0;
            padding: 10px 14px;
            text-indent: 1.8em;
            letter-spacing: 0.2px;
            border-radius: 5px;
            background: rgba(255, 255, 255, 0.7);
        }

        /*
        .book-content .chapter-content p:hover {
            padding: 14px 18px;
            background: rgba(74, 144, 226, 0.06);
            transform: translateY(-1px);
            box-shadow: 0 3px 10px rgba(74, 144, 226, 0.1);
        }
        */

    .chapter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .chapter-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .chapter-header h1 {
        font-size: 20px;
    }

    .book-nav {
        display: none;
    }

    .mobile-nav {
        display: flex;
    }

    .mobile-nav a,
    .mobile-nav .disabled {
        display: block;
        padding: 15px 20px;
        color: #6d5b3b;
        text-decoration: none;
        background: #f3e9d7;
        border-radius: 8px;
        transition: var(--transition);
        box-shadow: 0 2px 8px rgba(180,160,100,0.05);
        border: 1px solid var(--border-color);
        text-align: center;
        position: relative;
        font-size: 16px;
    }

    .mobile-nav .disabled {
        color: var(--text-lighter);
        background: #f0f0f0;
        cursor: not-allowed;
        opacity: 0.6;
    }

    .mobile-nav a:hover {
        background: var(--hover-color);
        color: #fff;
        transform: translateY(-1px);
    }

    .mobile-nav .mobile-catalog {
        background: var(--hover-color);
        color: #fff;
    }

        .mobile-nav .mobile-catalog:hover {
            background: var(--primary-color);
        }

   

    .read-aloud-controls {
        gap: 8px;
    }

    .read-aloud-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .feature-controls {
        flex-direction: column;
        gap: 15px;
        margin: 15px 10px;
        padding: 12px;
    }

    .keyboard-shortcuts {
        display: none;
    }
}

@media screen and (max-width: 480px) {


        .book-content h1 {
            font-size: 20px;
        }

        .book-content .chapter-content {
            font-size: 15px;
            line-height: 1.7;
   
        }

        /* 移动端段落样式调整 */
        .book-content .chapter-content p {
            font-size: 16px;
            line-height: 2.2;
            margin: 0;
            padding: 0px 10px;
            text-indent: 1.5em; /* 移动端减少缩进 */
            letter-spacing: 0.2px;
            border-radius: 4px;
            background: rgba(255, 255, 255, 0.6);
        }

        /*
        .book-content .chapter-content p:hover {
            padding: 14px 16px;
            background: rgba(74, 144, 226, 0.08);
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
        }
        */

        .book-content .chapter-content p:first-of-type::first-letter {
            font-size: 1.2em;
        }

  

    .read-aloud-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .feature-controls {
        margin: 10px 5px;
        padding: 10px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-content {
    animation: fadeIn 0.6s ease-out;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #e0e0e0;
        --text-light: #b0b0b0;
        --text-lighter: #808080;
        --bg-color: #1a1a1a;
        --section-bg: #2d2d2d;
        --border-color: #404040;
    }

    .book-content .chapter-content {
        color: #d0d0d0;
        background: #2a2a2a;
        border-color: #404040;
    }

    .book-content .chapter-content p {
        color: #e0e0e0;
    }

    .book-content .chapter-content p:hover {
        background: rgba(74, 144, 226, 0.1);
    }

    .book-content .chapter-content p:first-of-type::first-letter {
        color: #6bb6ff;
    }

    .book-content .chapter-content p strong {
        color: #ff6b6b;
    }

    .book-content .chapter-content p em {
        color: #bd93f9;
    }

    .book-content h1 {
        color: #f0f0f0;
    }
}

/* 打印样式 */
@media print {
    .read-aloud-controls,
    .book-nav,
    .mobile-nav,
    .feature-controls,
    .keyboard-shortcuts,
    #reading-progress {
        display: none !important;
    }

    .book-content {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .book-content .chapter-content {
        color: #000;
        font-size: 14px;
        line-height: 1.6;
    }
}