/* 开篇页样式 */
.kaipian-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    display: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    touch-action: pan-y;
    
    /* 宣纸纹理背景 */
    background-image: 
        /* 微妙木纹 */
        repeating-linear-gradient(
            90deg,
            var(--color-paper-texture1),
            var(--color-paper-texture1) 1px,
            transparent 1px,
            transparent 30px
        ),
        /* 纸张噪点层 */
        repeating-linear-gradient(
            45deg,
            var(--color-paper-texture1),
            var(--color-paper-texture1) 1px,
            transparent 1px,
            transparent 8px
        ),
        repeating-linear-gradient(
            -45deg,
            var(--color-paper-texture2),
            var(--color-paper-texture2) 1px,
            transparent 1px,
            transparent 10px
        ),
        /* 更明显的宣纸纹理效果 */
        radial-gradient(
            ellipse at 30% 40%,
            rgba(227, 220, 207, 0.3) 0%,
            transparent 70%
        ),
        radial-gradient(
            ellipse at 70% 60%,
            rgba(218, 213, 198, 0.3) 0%,
            transparent 70%
        ),
        radial-gradient(
            ellipse at 50% 50%,
            var(--color-paper-base) 0%,
            var(--color-bg) 100%
        );
}

/* 页面基本样式 */
.kaipian-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.6s ease, opacity 0.6s ease;
    padding: 20px;
}

.kaipian-page.active-page {
    opacity: 1;
    transform: translateX(0);
    z-index: 1;
}

.kaipian-page.prev-page {
    opacity: 0;
    transform: translateX(-100%);
}

/* 页面内容样式 */
.page-content {
    max-width: 800px;
    width: 90%;
    height: 75%;
    margin-bottom: 60px;
    background-color: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 40px;
    position: relative;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.6s ease-out forwards;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

/* 书页效果 */
.page-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(
            to right,
            rgba(0, 0, 0, 0.03) 0px,
            transparent 30px
        );
    pointer-events: none;
    z-index: -1;
}

/* 页面标题 */
.page-title {
    font-family: var(--font-display);
    font-size: 32px;
    color: var(--color-primary);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(to right, 
        transparent, 
        var(--color-primary), 
        transparent);
}

/* 页面文本 */
.page-text {
    font-family: 'YouYuan', 'Microsoft YaHei', 'STXihei', 'STHeiti', sans-serif;
    line-height: 1.8;
    color: var(--color-text);
    text-align: justify;
}

.page-text p {
    margin-bottom: 15px;
    text-indent: 0;
}

/* 封面页样式 */
.cover-page {
    background-image: 
        /* 水墨装饰 */
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 500 500'%3E%3Cpath d='M50,200 Q150,100 250,180 Q350,260 450,150' stroke='%23b22222' stroke-width='2' fill='none' stroke-opacity='0.15'/%3E%3C/svg%3E"),
        /* 纸张纹理加强 */
        repeating-linear-gradient(
            45deg,
            rgba(0, 0, 0, 0.01),
            rgba(0, 0, 0, 0.01) 1px,
            transparent 1px,
            transparent 15px
        );
    background-size: cover, 30px 30px;
    background-position: center, center;
}

.cover-content {
    position: relative;
    max-width: 500px;
    text-align: center;
    padding: 40px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
}

/* 封面装饰 */
.cover-content::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10,50 Q30,20 50,40 Q70,60 90,30' stroke='%23b22222' stroke-width='1' fill='none' stroke-opacity='0.2'/%3E%3C/svg%3E");
    background-size: cover;
    opacity: 0.05;
    z-index: -1;
    border-radius: 15px;
}

.cover-decoration {
    position: absolute;
    width: 100px;
    height: 100px;
    opacity: 0.1;
}

.decoration-top-right {
    top: -30px;
    right: -30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M20,20 Q40,10 60,30 Q80,50 90,30' stroke='%23333' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-size: contain;
}

.decoration-bottom-left {
    bottom: -30px;
    left: -30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M10,60 Q30,80 50,60 Q70,40 90,60' stroke='%23b22222' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-size: contain;
}

/* 封面标题阴影效果 */
.cover-title::after {
    content: '触道开篇';
    position: absolute;
    top: 3px;
    left: 3px;
    color: rgba(178, 34, 34, 0.2);
    z-index: -1;
}

.cover-author {
    font-family: var(--font-serif);
    font-size: 24px;
    color: var(--color-secondary);
    margin-bottom: 60px;
}

.cover-subtitle {
    font-family: var(--font-serif);
    font-size: 28px;
    color: var(--color-secondary);
    letter-spacing: 3px;
    margin-bottom: 80px;
}

.scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.7;
    animation: pulse 2s infinite;
}

.scroll-hint .arrow {
    font-size: 24px;
    margin-top: 10px;
}

/* 导航按钮 */
.navigation-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    z-index: 10;
}

.nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.nav-btn .arrow {
    font-size: 24px;
    color: var(--color-primary);
}

/* 修改主页按钮样式 - 移除红色背景，添加光晕效果 */
.home-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: transparent; /* 移除红色背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* 为光晕效果添加相对定位 */
    transition: all 0.3s ease;
}

/* 添加光晕效果 */
.home-btn::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(178, 34, 34, 0.5) 0%,
        rgba(178, 34, 34, 0.3) 40%,
        rgba(178, 34, 34, 0) 70%
    );
    animation: glow-pulse 2s infinite alternate;
    z-index: -1;
}

/* 调整图标样式 */
.home-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.8);
    animation: icon-breath 3s ease-in-out infinite;
}

/* 悬停效果优化 */
.home-btn:hover {
    transform: translateY(-3px);
}

.home-btn:hover::before {
    animation-duration: 1s;
    background: radial-gradient(
        circle,
        rgba(178, 34, 34, 0.7) 0%,
        rgba(178, 34, 34, 0.4) 40%,
        rgba(178, 34, 34, 0) 70%
    );
}

.home-btn:hover .home-icon {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(178, 34, 34, 0.4);
}

/* 添加动画关键帧 */
@keyframes glow-pulse {
    0% { opacity: 0.5; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1.05); }
}

@keyframes icon-breath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 优化页码指示器，使其更低调不干扰阅读 */
.page-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-serif);
    font-size: 14px; /* 减小字体 */
    color: rgba(102, 102, 102, 0.5); /* 降低字体透明度 */
    background-color: transparent; /* 移除背景 */
    padding: 5px 10px;
    border-radius: 0;
    z-index: 10;
    border: none; /* 移除边框 */
    box-shadow: none; /* 移除阴影 */
    transition: all 0.3s ease;
}

/* 页码悬停时稍微提高可见度，方便用户识别 */
.page-indicator:hover {
    color: rgba(102, 102, 102, 0.8);
    background-color: transparent;
    box-shadow: none;
}

/* 创建页码指示器的替代位置，显示在导航按钮旁边 */
@media (max-width: 768px) {
    .page-indicator {
        font-size: 12px; /* 移动端更小的字体 */
        bottom: 20px; /* 移动端位置放在底部 */
        right: 15px;
        left: auto;
        transform: none;
    }
}

/* 作者署名 */
.author-sign {
    text-align: right;
    font-style: italic;
    margin-top: 30px;
}

/* 动画 */
@keyframes pulse {
    0% { opacity: 0.5; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(5px); }
    100% { opacity: 0.5; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .page-content {
        padding: 25px;
        width: 95%;
        height: 85%;
    }
    
    .page-title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .cover-title {
        font-size: 46px;
    }
    
    .cover-author {
        font-size: 20px;
        margin-bottom: 40px;
    }
    
    .cover-subtitle {
        font-size: 22px;
        margin-bottom: 60px;
    }
    
    .navigation-controls {
        gap: 20px;
        bottom: 20px;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .home-btn {
        width: 50px;
        height: 50px;
    }
    
    .home-icon {
        width: 30px;
        height: 30px;
    }
    
    .page-text {
        -webkit-text-size-adjust: 100%;
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    .page-content {
        padding: 15px;
    }
    
    .page-text {
        font-size: 15px;
        line-height: 1.6;
    }
    
    .cover-title {
        font-size: 36px;
    }
    
    .cover-author {
        font-size: 18px;
    }
    
    .cover-subtitle {
        font-size: 18px;
        letter-spacing: 2px;
    }
}

/* 优化页面内容的滚动条样式，更符合古风设计 */
.page-content::-webkit-scrollbar {
    width: 8px;
}

.page-content::-webkit-scrollbar-track {
    background-color: rgba(227, 220, 207, 0.2);
    border-radius: 4px;
}

.page-content::-webkit-scrollbar-thumb {
    background-color: rgba(139, 69, 19, 0.3);
    border-radius: 4px;
}

.page-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(139, 69, 19, 0.5);
}

/* 增加页面内容边缘墨迹效果 */
.page-content::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 10px;
    background-image: 
        linear-gradient(
            to right,
            rgba(0, 0, 0, 0.05),
            transparent
        );
    pointer-events: none;
    opacity: 0.5;
}

/* 控制移动端触摸行为 */
body {
    overscroll-behavior: none; /* 防止页面反弹 */
    -webkit-overflow-scrolling: touch; /* 平滑滚动 */
}

/* 控制内容区域的滚动行为 */
.page-content {
    touch-action: pan-y; /* 只允许垂直滑动 */
}

/* 防止意外双击缩放 */
* {
    touch-action: manipulation;
}

/* 添加展开按钮样式 */
.expand-button {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: 14px;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    display: none; /* 默认隐藏 */
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    z-index: 5;
}

.expand-button:hover {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
    transform: translateX(-50%) translateY(-2px);
}

/* 添加展开按钮箭头动画 */
.expand-button .arrow {
    display: inline-block;
    margin-left: 5px;
    animation: arrow-bounce 1.5s ease infinite;
}

@keyframes arrow-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* 为按钮添加墨迹装饰 */
.expand-button::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3E%3Cpath d='M10,25 Q20,15 25,20 Q30,25 40,15' stroke='%23b22222' stroke-width='1' fill='none' stroke-opacity='0.3'/%3E%3C/svg%3E");
    background-size: cover;
    border-radius: 25px;
    z-index: -1;
    opacity: 0.05;
}

/* 移动端展开按钮样式优化 */
@media (max-width: 768px) {
    .expand-button {
        font-size: 12px;
        padding: 4px 12px;
        bottom: 10px;
    }
    
    /* 确保移动端内容区域底部有足够的内边距容纳按钮 */
    .page-content {
        padding-bottom: 40px;
    }
} 