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

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #FFE4B5 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.storybook-container {
    max-width: 1000px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    min-height: 600px;
}

/* 页面样式 */
.page {
    display: none;
    padding: 40px;
    min-height: 600px;
    animation: fadeIn 0.5s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 标题页样式 */
.title-page {
    text-align: center;
    background: linear-gradient(45deg, #FFE4E1, #F0F8FF);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.story-title {
    font-size: 3rem;
    color: #2E8B57;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

.title-illustration {
    margin: 30px 0;
}

.title-image {
    max-width: 400px;
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.story-subtitle {
    font-size: 1.5rem;
    color: #4682B4;
    margin-bottom: 40px;
    font-style: italic;
}

.start-button {
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.3rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* 故事页面样式 */
.story-page {
    background: linear-gradient(135deg, #FFF8DC, #F5F5DC);
}

.page-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    height: 100%;
}

.illustration-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.story-illustration {
    max-width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.story-illustration:hover {
    transform: scale(1.02);
}

.text-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.story-text {
    flex-grow: 1;
}

.story-text p {
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: 1.2rem;
}

/* 文本样式 */
.narration {
    color: #2F4F4F;
    font-style: italic;
    background: rgba(173, 216, 230, 0.2);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #4682B4;
}

.dialogue {
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    position: relative;
}

.dialogue.rabbit {
    background: rgba(255, 182, 193, 0.3);
    border-left: 4px solid #FF69B4;
    color: #8B0000;
}

.dialogue.wolf {
    background: rgba(169, 169, 169, 0.3);
    border-left: 4px solid #696969;
    color: #2F4F4F;
}

.dialogue.rabbit.fear {
    background: rgba(255, 160, 122, 0.4);
    border-left: 4px solid #FF4500;
}

.dialogue.wolf.gentle {
    background: rgba(144, 238, 144, 0.3);
    border-left: 4px solid #32CD32;
}

.dialogue.rabbit.curious {
    background: rgba(255, 218, 185, 0.4);
    border-left: 4px solid #DDA0DD;
}

.dialogue.wolf.kind, .dialogue.wolf.sincere {
    background: rgba(176, 224, 230, 0.4);
    border-left: 4px solid #4169E1;
}

.dialogue.rabbit.understanding {
    background: rgba(255, 239, 213, 0.4);
    border-left: 4px solid #FFD700;
}

.dialogue.wolf.happy {
    background: rgba(152, 251, 152, 0.4);
    border-left: 4px solid #00FF00;
}

.dialogue.rabbit.excited {
    background: rgba(255, 192, 203, 0.5);
    border-left: 4px solid #FF1493;
}

.dialogue.wolf.joyful {
    background: rgba(173, 255, 47, 0.4);
    border-left: 4px solid #ADFF2F;
}

.moral {
    background: linear-gradient(45deg, #FFE4B5, #F0E68C);
    padding: 20px;
    border-radius: 15px;
    font-weight: bold;
    color: #8B4513;
    text-align: center;
    font-size: 1.3rem;
    border: 2px solid #DAA520;
}

.ending {
    text-align: center;
    font-size: 1.4rem;
    color: #4682B4;
    font-weight: bold;
    margin-top: 20px;
}

/* 音频控件样式 */
.audio-controls {
    margin-top: 20px;
    text-align: center;
}

.audio-btn {
    background: linear-gradient(45deg, #32CD32, #98FB98);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

/* 导航样式 */
.navigation {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.nav-btn {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

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

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.page-indicator {
    font-weight: bold;
    color: #2F4F4F;
    font-size: 1.1rem;
    min-width: 60px;
    text-align: center;
}

/* 音频播放器样式 */
.audio-player {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 300px;
}

.audio-status {
    text-align: center;
    color: #4682B4;
    font-weight: bold;
    margin-bottom: 10px;
}

#audioElement {
    width: 100%;
    margin-top: 10px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .page {
        padding: 20px;
        min-height: 500px;
    }
    
    .page-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .story-subtitle {
        font-size: 1.2rem;
    }
    
    .story-text p {
        font-size: 1.1rem;
    }
    
    .navigation {
        bottom: 10px;
        padding: 10px 15px;
        gap: 15px;
    }
    
    .nav-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .audio-player {
        position: relative;
        top: auto;
        right: auto;
        margin: 20px auto;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .story-title {
        font-size: 1.5rem;
    }
    
    .story-text p {
        font-size: 1rem;
    }
    
    .page {
        padding: 15px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-btn {
        width: 120px;
    }
}

/* 动画效果 */
.story-illustration {
    animation: slideInLeft 0.6s ease-out;
}

.text-container {
    animation: slideInRight 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 音频播放状态 */
.audio-btn.playing {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}