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

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #F0E68C 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.storybook-container {
    max-width: 900px;
    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;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

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

.title-image {
    margin: 30px 0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.title-image img {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
}

.subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
    font-style: italic;
}

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

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

/* 故事内容样式 */
.story-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    height: 100%;
}

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

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

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

.text-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.text-content h2 {
    font-size: 1.8rem;
    color: #2E8B57;
    margin-bottom: 20px;
    text-align: center;
}

.text-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    margin-bottom: 20px;
    text-align: justify;
}

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

.play-btn {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.play-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.play-btn.playing {
    background: linear-gradient(45deg, #FF6B6B, #FF4757);
    animation: pulse 1.5s infinite;
}

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

/* 故事结尾样式 */
.story-end {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #E8F5E8, #F0FFF0);
    border-radius: 15px;
    border-left: 5px solid #2E8B57;
}

.moral {
    font-size: 1rem;
    color: #2E8B57;
    margin-bottom: 20px;
    font-weight: bold;
}

.restart-btn {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.restart-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 导航样式 */
.navigation {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    backdrop-filter: blur(10px);
}

.nav-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

.page-indicator {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2E8B57;
    background: rgba(46, 139, 87, 0.1);
    padding: 8px 16px;
    border-radius: 15px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .page {
        padding: 20px;
        min-height: 500px;
    }
    
    .story-content {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .text-content h2 {
        font-size: 1.5rem;
    }
    
    .text-content p {
        font-size: 1rem;
    }
    
    .navigation {
        padding: 10px 20px;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .story-title {
        font-size: 1.5rem;
    }
    
    .start-btn {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .page {
        padding: 15px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .page-indicator {
        order: -1;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .storybook-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .navigation {
        display: none;
    }
    
    .page {
        display: block !important;
        page-break-after: always;
    }
    
    .page:last-child {
        page-break-after: avoid;
    }
}