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

:root {
    --primary-color: #8b4513;
    --primary-light: #a0522d;
    --bg-color: #faf9f7;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 夜间模式 */
body.dark-mode {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

/* 字体大小 */
body.font-small {
    font-size: 14px;
}

body.font-medium {
    font-size: 16px;
}

body.font-large {
    font-size: 18px;
}

body.font-xlarge {
    font-size: 20px;
}

/* 容器 */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* 关于师父区域 */
.about-section {
    padding: 16px;
}

.about-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
    color: white;
    position: relative;
    overflow: hidden;
}

/* 背景虚化图层 */
.about-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/banner5.jpeg');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    filter: blur(4px);
    z-index: 1;
}

/* 图标 */
.about-card::after {
    content: '🙏';
    position: absolute;
    left: 16px;
    font-size: 2.5em;
    opacity: 0.9;
    z-index: 2;
}

.about-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3);
}

.about-icon {
    font-size: 3em;
    flex-shrink: 0;
    opacity: 0.9;
}

.about-content {
    flex: 1;
    padding-left: 50px;
    position: relative;
    z-index: 2;
}

.about-content h3,
.about-content p {
    position: relative;
    z-index: 2;
}

.about-content h3 {
    margin: 0 0 4px;
    font-size: 1.3em;
    font-weight: 600;
}

.about-content p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.about-arrow {
    font-size: 2em;
    opacity: 0.6;
    transition: all 0.2s;
    position: relative;
    z-index: 2;
}

.about-card:hover .about-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* 头部 */
.header-main {
    background-color: var(--card-bg);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-center h1 {
    font-size: 1.4em;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* 关于师父头部 */
.about-master-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.3s;
}

.about-master-header:hover {
    background-color: rgba(139, 69, 19, 0.08);
}

.master-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.master-text {
    display: flex;
    align-items: center;
}

.master-label {
    font-size: 0.9em;
    font-weight: 500;
    color: var(--text-color);
}

/* 设置按钮组 */
.settings-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.settings-toggle {
    min-width: 36px;
    font-size: 1.2em;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    min-width: 220px;
    z-index: 1000;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    visibility: hidden;
    display: block !important;
}

.settings-dropdown.show {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.settings-section {
    margin-bottom: 12px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: block;
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.font-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.font-buttons .btn-icon {
    flex: 1;
    min-width: auto;
    padding: 8px 12px;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.85em;
    transition: all 0.3s;
    min-width: 36px;
}

.btn-icon:hover, .btn-icon.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 夜间模式下的按钮 */
body.dark-mode .btn-icon {
    border-color: #555;
    color: #ccc;
}

body.dark-mode .btn-icon:hover,
body.dark-mode .btn-icon.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 阶段导航 */
.stages-nav {
    padding: 0;
    margin-top: 0;
    border-radius: 0;
    position: relative;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.stages-nav h2 {
    display: none;
}

.stage-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
}

.stage-tabs::-webkit-scrollbar {
    display: none;
}

.stage-tab {
    flex: 1;
    min-width: 0;
    padding: 18px 24px;
    background: transparent;
    border-radius: 0;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    text-align: center;
    position: relative;
    letter-spacing: 0.5px;
}

.stage-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: white;
    transition: width 0.3s ease;
    border-radius: 3px 3px 0 0;
}

.stage-tab.active {
    color: white;
    font-weight: 600;
}

.stage-tab.active::after {
    width: 60%;
}

.stage-tab:hover:not(.active) {
    color: white;
}

/* 著述容器 */
.writings-container {
    padding: 24px 0;
}

/* 分类区域标题 */
.category-section h3 {
    position: relative;
    padding-left: 0;
    color: var(--text-color);
    margin: 28px 0 16px;
    font-size: 1.1em;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.category-section h3::before {
    display: none;
}

/* 著述列表 */
.writings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 著述卡片（旧版兼容） */
.writings-grid {
    display: grid;
    gap: 16px;
}

.writing-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.writing-card:hover {
    transform: translateX(6px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
}

.writing-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.writing-info {
    flex: 1;
    min-width: 0;
}

.writing-card h3 {
    color: var(--text-color);
    margin: 0 0 6px;
    font-size: 1.1em;
    font-weight: 600;
}

.writing-card .description {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: 0;
    line-height: 1.5;
}

.writing-status {
    display: none;
}

.writing-meta {
    display: none;
}

.meta-left,
.meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-info {
    color: var(--primary-color);
    font-size: 0.85em;
    font-weight: 500;
}

.ebook-link {
    color: var(--primary-color);
    font-size: 0.9em;
    cursor: pointer;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s;
}

.ebook-link:hover {
    background-color: rgba(139, 69, 19, 0.1);
    color: var(--primary-light);
}

.writing-card .status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
    white-space: nowrap;
}

.status.completed {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: white;
}

.status.updating {
    background: linear-gradient(135deg, #ff9800, #ffa726);
    color: white;
}

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 3px;
    background-color: var(--border-color);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s;
}

/* 章节列表 */
.chapters-list {
    padding: 8px 0;
}

/* 模式标签 */
.mode-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 99;
}

.mode-tab {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mode-tab.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.mode-tab:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(139, 69, 19, 0.05);
}

/* 播放器容器 */
.player-container {
    padding: 12px;
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    border: 2px solid var(--border-color);
}

.current-playing {
    margin-bottom: 12px;
}

.playing-title {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.05em;
}

.player-container audio,
.player-container video {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 播放列表 */
.chapters-playlist {
    padding: 0 0 16px;
}

.chapter-text,
.chapter-playlist {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.chapter-text:hover,
.chapter-playlist:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(139, 69, 19, 0.1);
}

.chapter-text.active,
.chapter-playlist.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
}

.chapter-number {
    background: linear-gradient(135deg, var(--border-color), #d0d0d0);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.95em;
}

.chapter-text.active .chapter-number,
.chapter-playlist.active .chapter-number {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chapter-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.95em;
}

.chapter-arrow {
    font-size: 1.5em;
    opacity: 0.4;
    transition: all 0.2s;
}

.chapter-text:hover .chapter-arrow {
    opacity: 0.8;
    transform: translateX(4px);
}

.play-icon {
    background: linear-gradient(135deg, var(--border-color), #d0d0d0);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chapter-playlist:hover .play-icon {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.chapter-playlist.active .play-icon {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(255,255,255,0.3);
}

/* 章节内容区域 */
.chapter-content-area {
    padding: 20px;
    margin-top: 12px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* 文章内容 */
.article-content {
    padding: 16px;
    line-height: 1.8;
}

.article-content h2 {
    color: var(--primary-color);
    margin: 24px 0 16px;
}

.article-content p {
    margin-bottom: 16px;
    text-align: justify;
}

.article-content .author {
    text-align: right;
    color: var(--text-secondary);
    margin: 20px 0;
    font-style: italic;
}

/* 音频播放器 */
.audio-player {
    margin: 16px 0;
}

.audio-player audio {
    width: 100%;
}

/* 视频播放器 */
.video-player {
    margin: 16px 0;
}

.video-player video {
    width: 100%;
    border-radius: 8px;
}

/* 章节页头部 */
.chapter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* 章节页内容包装器 */
.chapters-wrapper {
    background-color: var(--card-bg);
    min-height: calc(100vh - 120px);
}

/* 在有chapter-header时隐藏学修次第 - 使用body类控制 */
body.has-chapter-header .stages-nav {
    display: none !important;
}

.header-title {
    flex: 1;
    color: var(--primary-color);
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.header-actions .ebook-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(139, 69, 19, 0.25);
    transition: all 0.3s;
}

.header-actions .ebook-link:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(139, 69, 19, 0.3);
}

.header-actions .ebook-link:active {
    transform: translateY(0);
}

/* 返回按钮 */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: var(--primary-light);
    transform: translateX(-2px);
}

/* 页脚 */
footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

footer p {
    margin-bottom: 8px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .header-main {
        padding: 8px 12px;
    }

    .header-center h1 {
        font-size: 1.1em;
    }

    .master-avatar {
        width: 40px;
        height: 40px;
    }

    .master-label {
        font-size: 0.85em;
    }

    .settings-bar {
        gap: 6px;
    }

    .btn-icon {
        padding: 6px 8px;
        font-size: 0.8em;
        min-width: 32px;
    }

    .container {
        padding: 0 12px;
    }

    header h1 {
        font-size: 1.2em;
    }

    .stage-tabs {
        gap: 8px;
    }

    .stage-tab {
        padding: 10px 18px;
        font-size: 0.95em;
    }

    .writing-card h3 {
        font-size: 1em;
    }

    .writing-header {
        flex-direction: column;
        gap: 8px;
    }

    .writing-status {
        align-self: flex-start;
    }

    .writing-meta {
        flex-direction: column;
        gap: 8px;
    }

    .meta-left,
    .meta-right {
        width: 100%;
        justify-content: space-between;
    }

    .reading-title {
        font-size: 1em;
        padding-right: 0;
    }

    .chapter-header {
        padding: 10px 12px;
    }

    .header-title {
        font-size: 1em;
    }

    .mode-tabs {
        padding: 8px 0;
    }

    .reading-nav {
        flex-direction: column;
        gap: 8px;
    }

    .reading-nav > div {
        order: -1;
    }

    .nav-btn {
        width: 100%;
    }

    .reading-content {
        padding: 12px;
        font-size: 0.95em;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 电子书下载按钮 */
.ebook-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 40px;
}

.ebook-btn:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.3);
}

.chapter-header .ebook-btn {
    padding: 8px 12px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.chapter-header .ebook-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 全屏阅读模式 */
.fullscreen-reading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* 阅读页面（非全屏） */
.reading-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: 1000;
    overflow-y: auto;
}

/* 关于师父页面 - 隐藏主页内容 */
.fullscreen-reading ~ *,
.reading-page ~ * {
    display: none;
}

/* 关于师父页面 */
.about-page .reading-content {
    padding-bottom: 40px;
    padding-top: 20px;
}

/* 师父照片 */
.master-photo {
    text-align: center;
    margin: 60px auto 20px;
    position: relative;
    max-width: 200px;
}

.about-page .master-photo {
    margin-top: 20px;
}

/* 略传章节详情页的chapter-text样式 */
.chapter-fulltext .chapter-text {
    background: transparent;
    box-shadow: none;
    padding: 16px 20px;
    line-height: 1.8;
    cursor: default;
    border: none;
    display: block;
    text-align: justify;
}

.chapter-fulltext .chapter-text p {
    margin-bottom: 16px;
    text-indent: 2em;
}

.chapter-fulltext .chapter-text br {
    display: block;
    margin: 8px 0;
}

/* 头部横幅 */
.about-banner {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

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

/* 师父照片 */
.master-photo {
    text-align: center;
    margin: -80px auto 20px;
    position: relative;
    z-index: 20;
    max-width: 200px;
}

.master-photo-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 4px solid var(--bg-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    object-fit: cover;
}

.gatha-box {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.2);
}

.gatha-title {
    margin: 0 0 16px;
    font-size: 1.2em;
    font-weight: 600;
}

.gatha-text {
    font-size: 1.1em;
    line-height: 2;
    font-family: 'KaiTi', '楷体', serif;
    font-weight: 500;
}

.intro-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.section-title {
    color: var(--primary-color);
    font-size: 1.3em;
    margin: 0 0 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.intro-text p {
    margin-bottom: 16px;
    text-indent: 2em;
    line-height: 1.8;
}

.biography-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.biography-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.biography-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.biography-item:hover {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.05), rgba(160, 82, 45, 0.05));
    transform: translateX(4px);
}

.biography-item:active {
    transform: translateX(2px);
}

.biography-number {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95em;
    flex-shrink: 0;
}

.biography-title {
    flex: 1;
    font-size: 1em;
    font-weight: 500;
    color: var(--text-color);
}

.reading-header {
    background: linear-gradient(180deg, var(--card-bg), rgba(255,255,255,0.95));
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

/* 固定的阅读头部 */
.reading-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 100;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    height: 44px;
    transition: transform 0.3s ease;
}

.reading-header-fixed.hidden {
    transform: translateY(-100%);
}

.reading-title {
    color: var(--primary-color);
    font-size: 1.1em;
    margin: 0;
    flex: 1;
    text-align: center;
    padding-right: 60px;
    font-weight: 600;
}

.reading-title-fixed {
    flex: 1;
    color: var(--primary-color);
    font-size: 0.9em;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

.reading-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    line-height: 1.9;
}

.reading-page .reading-content {
    padding: 64px 16px 100px;
    min-height: 100vh;
}

.reading-content .content-text {
    font-size: 1.05em;
    text-align: justify;
}

.reading-content p {
    margin-bottom: 18px;
    text-indent: 2em;
}

.reading-nav {
    background: linear-gradient(0deg, var(--card-bg), rgba(255,255,255,0.95));
    padding: 14px 16px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
}

/* 固定的阅读底部导航 */
.reading-nav-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
    z-index: 100;
    border-top: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.reading-nav-fixed.hidden {
    transform: translateY(100%);
}

.nav-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3);
}

.nav-btn:active {
    transform: translateY(0);
}

.back-to-toc {
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    box-shadow: none;
}

.back-to-toc:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.reading-header-fixed .back-to-toc {
    padding: 6px 12px;
    font-size: 0.85em;
    min-width: auto;
}

.reading-nav-fixed .nav-btn {
    padding: 8px 16px;
    font-size: 0.85em;
}

.chapter-info {
    color: var(--text-secondary);
    font-size: 0.9em;
    text-align: center;
    font-weight: 500;
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 20px;
}

.reading-nav-fixed .chapter-info {
    font-size: 0.85em;
    padding: 6px 12px;
}

/* 阅读控制按钮 */
.reading-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.font-toggle,
.mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--text-color);
    transition: all 0.2s;
}

.font-toggle:hover,
.mode-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

@media (max-width: 600px) {
    .reading-title {
        font-size: 1em;
        padding-right: 0;
    }

    .reading-nav {
        flex-direction: column;
        gap: 8px;
    }

    .reading-nav > div {
        order: -1;
    }

    .nav-btn {
        width: 100%;
    }

    .reading-content {
        padding: 12px;
        font-size: 0.95em;
    }
}
