/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2rem;
    color: #718096;
    font-weight: 500;
}

/* 故事书样式 */
.storybook {
    flex: 1;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.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: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    max-width: 1000px;
    margin: 0 auto;
}

.image-container {
    text-align: center;
}

.story-image {
    width: 100%;
    max-width: 450px;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

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

.text-container h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.story-text {
    font-size: 1.1rem;
    color: #4a5568;
    margin-bottom: 15px;
    text-align: justify;
    line-height: 1.8;
}

.fun-fact {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    border-left: 5px solid #f6ad55;
    font-size: 1rem;
    color: #744210;
}

/* 控制面板样式 */
.controls {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.navigation {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-btn, .audio-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.nav-btn:hover, .audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

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

.page-indicator {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    background: #f7fafc;
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #e2e8f0;
}

.audio-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.audio-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.audio-btn:hover {
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6);
}

.audio-btn.active {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .page-content {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }
    
    .page {
        padding: 25px;
        min-height: auto;
    }
    
    .text-container h2 {
        font-size: 1.5rem;
    }
    
    .story-text {
        font-size: 1rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .navigation {
        order: 2;
    }
    
    .audio-controls {
        order: 1;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-btn, .audio-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .page {
        padding: 20px;
    }
    
    .text-container h2 {
        font-size: 1.3rem;
    }
    
    .story-text {
        font-size: 0.95rem;
    }
    
    .fun-fact {
        padding: 15px;
        font-size: 0.9rem;
    }
    
    .nav-btn, .audio-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 音频播放指示器 */
.playing-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(72, 187, 120, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}