/* ========= 阅读器正文样式（用于 yuedu.html 内部） ========= */
/* 兼容性：Android 9.0+ / iOS 12+ / Chrome 70+ / Safari 12+ */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ===== iOS 滚动兼容（新增） ===== */
html, body {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #fafafa;
    color: #2c3e50;
    margin: 0;
    padding: 0;
    line-height: 1.8;
    font-size: 20px;
}

/* 阅读容器 */
.yuedu-wrapper {
    max-width: 820px;
    margin: 0 auto;
    padding: 20px 0 40px 0;
    background: #ffffff;
    min-height: 100vh;
}

/* ===== 顶部导航（章节平铺） ===== */
.yuedu-nav-top,
.yuedu-nav-bottom {
    background: #f0f7e6;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0 20px 0;
    border: 1px solid #c8e6b5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.yuedu-nav-bottom {
    margin-top: 30px;
}

.nav-label {
    font-size: 20px;
    font-weight: bold;
    color: #4a7c1a;
    margin-right: 8px;
    flex-shrink: 0;
}

.chapter-link {
    font-size: 20px;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: underline;
    color: #5a9c20;
    transition: background 0.15s;
    white-space: nowrap;
    cursor: pointer;
}

.chapter-link:hover {
    background: #dcedc8;
}

.chapter-link.current {
    text-decoration: none;
    font-weight: bold;
    background: #e8f5e9;
    color: #2a4a0f;
    border-radius: 6px;
    pointer-events: none;
}

/* ===== 正文区域 ===== */
.yuedu-content {
    padding: 10px 0;
}

.yuedu-content h2 {
    font-size: 30px;
    color: #5a9c20;
    text-align: center;
    margin: 20px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 3px solid #e8f5e9;
}

.yuedu-content .subtitle {
    text-align: center;
    color: #666;
    font-size: 18px;
    margin-bottom: 25px;
}

.yuedu-content p {
    text-indent: 2em;
    margin: 0 0 12px 0;
}

/* 图片样式（响应式，无左右边距） */
.yuedu-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

/* 图片说明 */
.yuedu-content .figcaption {
    text-align: center;
    font-size: 16px;
    color: #888;
    margin: -15px auto 20px auto;
    font-style: italic;
}

/* ===== 独立访问时的顶部提示 ===== */
.standalone-banner {
    display: none;
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    text-align: center;
    padding: 10px;
    font-size: 18px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.standalone-banner a {
    color: #5a9c20;
    font-weight: bold;
    text-decoration: underline;
}

body.standalone-mode .standalone-banner {
    display: block;
}

/* ===== 通用：多章节导航（地藏经/药师经/无量寿经等复用） ===== */
.chapter-nav-top,
.chapter-nav-bottom {
    background: #f0f7e6;
    border-radius: 12px;
    padding: 12px 16px;
    margin: 10px 0 20px 0;
    border: 1px solid #c8e6b5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
}

.chapter-nav-bottom {
    margin-top: 30px;
}

.chapter-nav-label {
    font-size: 20px;
    font-weight: bold;
    color: #4a7c1a;
    margin-right: 8px;
    flex-shrink: 0;
}

/* 章节容器（用于锚点定位） */
.chapter-section {
    scroll-margin-top: 20px;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    body {
        font-size: 18px;
    }
    .yuedu-wrapper {
        padding: 15px 0 30px 0;
    }
    .chapter-link {
        font-size: 18px;
        padding: 4px 10px;
    }
    .nav-label,
    .chapter-nav-label {
        font-size: 18px;
    }
    .yuedu-content h2 {
        font-size: 26px;
    }
    .yuedu-content p {
        margin-bottom: 10px;
    }
    .chapter-nav-top,
    .chapter-nav-bottom {
        padding: 10px 12px;
        gap: 4px 8px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 17px;
    }
    .yuedu-wrapper {
        padding: 10px 0 20px 0;
    }
    .chapter-link {
        font-size: 16px;
        padding: 4px 8px;
    }
    .nav-label,
    .chapter-nav-label {
        font-size: 16px;
        margin-right: 4px;
    }
    .yuedu-content h2 {
        font-size: 22px;
    }
    .yuedu-content img {
        border-radius: 0;
    }
    .standalone-banner {
        font-size: 16px;
        padding: 8px;
    }
    .chapter-nav-top,
    .chapter-nav-bottom {
        padding: 8px 10px;
        gap: 3px 6px;
    }
}

@media (max-width: 360px) {
    .chapter-link {
        font-size: 14px;
        padding: 3px 6px;
    }
    .chapter-nav-label {
        font-size: 14px;
    }
}

/* 高对比度 */
@media (prefers-contrast: high) {
    .chapter-link {
        color: #003300;
        text-decoration: underline;
    }
    .chapter-link.current {
        background: #ffff00;
        color: black;
        border: 2px solid black;
    }
    .chapter-nav-top,
    .chapter-nav-bottom {
        border: 2px solid black;
    }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
    .chapter-link {
        transition: none;
    }
}

/* ===== 修正：当前章节无下划线（提高优先级） ===== */
.chapter-nav-top .chapter-link.current,
.chapter-nav-bottom .chapter-link.current {
    text-decoration: none !important;
}

/* ===== 翻页导航（上一页/下一页） ===== */
.page-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 15px 0 10px 0;
    padding: 10px 0;
}

.page-nav-btn {
    background: #5a9c20;
    color: white;
    border: none;
    border-radius: 40px;
    padding: 10px 28px;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 120px;
    text-align: center;
}

.page-nav-btn:hover {
    background: #4a7c1a;
}

.page-nav-btn:active {
    transform: scale(0.97);
}

.page-nav-btn.hidden {
    visibility: hidden;
    pointer-events: none;
}

.page-nav-info {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
    min-width: 100px;
    text-align: center;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .page-nav-btn {
        font-size: 20px;
        padding: 8px 20px;
        min-width: 100px;
    }
    .page-nav-info {
        font-size: 18px;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .page-nav-btn {
        font-size: 18px;
        padding: 6px 16px;
        min-width: 80px;
    }
    .page-nav-info {
        font-size: 16px;
        min-width: 70px;
    }
    .page-nav {
        gap: 12px;
    }
}