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

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f7ff;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* 书籍容器 */
.book-container {
    position: relative;
    width: 100%;
    max-width: 480px;
    height: 95vh;
    perspective: 2000px;
    margin: 0 auto;
}

/* 页面基础样式 */
.page {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1), 
                opacity 0.6s cubic-bezier(0.645, 0.045, 0.355, 1);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(100%) rotateY(40deg);
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

/* 页面状态类 */
.page.active {
    opacity: 1;
    transform: translateX(0) rotateY(0);
    pointer-events: all;
    z-index: 5;
}

.page.prev {
    opacity: 0;
    transform: translateX(-100%) rotateY(-40deg);
}

/* 页面内容 */
.page-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* 封面页特殊样式 */
.cover-page .page-content {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #4a558c 0%, #6683c8 100%);
}

/* 标题和副标题 */
.title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    color: #fff;
    text-shadow: 0 0 10px rgba(168, 209, 255, 0.5);
}

.subtitle {
    font-size: 1.2rem;
    margin-bottom: 30px;
    text-align: center;
    color: #d0e3ff;
}

/* 插图容器 */
.illustration {
    width: 100%;
    height: 45%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.illustration svg {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

/* 叙述文本 */
.narration {
    font-size: 1rem;
    line-height: 1.5;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 8px 0;
    color: #f0f7ff;
}

/* 对话框 */
.dialog {
    background-color: rgba(168, 209, 255, 0.2);
    border-radius: 10px;
    padding: 10px 15px;
    margin: 10px 0;
    position: relative;
    display: inline-block;
    max-width: 85%;
    border-left: 3px solid #d0e3ff;
}

/* 导航按钮 */
.nav-buttons {
    position: absolute;
    bottom: 15px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 10;
}

.nav-btn {
    background-color: rgba(168, 209, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(168, 209, 255, 0.2);
}

.nav-btn:hover {
    background-color: rgba(168, 209, 255, 0.3);
    transform: scale(1.1);
}

.nav-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* 页面指示器 */
.page-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.page-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-dot.active {
    background-color: #d0e3ff;
    transform: scale(1.2);
}

/* 特殊背景和效果 */
[data-bg="lab"] {
    background: linear-gradient(135deg, #324974 0%, #4873b0 100%);
}

[data-bg="encounter"] {
    background: linear-gradient(135deg, #3e5f9e 0%, #5682c4 100%);
}

[data-bg="connection"] {
    background: linear-gradient(135deg, #4467a9 0%, #6d90d1 100%);
}

[data-bg="harmony"] {
    background: linear-gradient(135deg, #4a558c 0%, #6d7bc4 100%);
}

[data-bg="finale"] {
    background: linear-gradient(135deg, #5d518c 0%, #8979c1 100%);
}

[data-bg="epilogue"] {
    background: linear-gradient(135deg, #348996 0%, #4fb9ca 100%);
}

/* 粒子效果 */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(168, 209, 255, 0.6);
    box-shadow: 0 0 8px rgba(168, 209, 255, 0.5);
}

/* 响应式调整 */
@media (max-width: 480px) {
    .title {
        font-size: 1.7rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .narration {
        font-size: 0.95rem;
    }
    
    .nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .illustration {
        height: 40%;
    }
}

@media (max-height: 600px) {
    .illustration {
        height: 35%;
    }
}

/* 滚动条样式 */
.page-content::-webkit-scrollbar {
    width: 5px;
}

.page-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.page-content::-webkit-scrollbar-thumb {
    background: rgba(168, 209, 255, 0.3);
    border-radius: 5px;
}

/* 避免iOS中的橡皮筋效果 */
html, body {
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
}

.page-content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}