/* 基础样式 */
* {
    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;
    overflow-x: hidden;
}

.storybook-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    padding: 20px;
}

/* 页面通用样式 */
.page {
    display: none;
    min-height: calc(100vh - 120px);
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 80px;
    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);
    }
}

/* 标题页样式 */
.title-page {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-content {
    max-width: 600px;
}

.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-image {
    margin: 30px 0;
}

.preview-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.story-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 40px;
    line-height: 1.6;
}

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

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* 故事页面样式 */
.scene-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    min-height: 500px;
}

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

.scene-image img {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

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

.scene-text {
    padding: 20px;
}

.scene-text h2 {
    color: #2E8B57;
    font-size: 2rem;
    margin-bottom: 20px;
    border-bottom: 3px solid #4ECDC4;
    padding-bottom: 10px;
}

.scene-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
    margin-bottom: 15px;
    text-align: justify;
}

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

.audio-btn {
    background: linear-gradient(45deg, #9B59B6, #3498DB);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.audio-btn.playing {
    background: linear-gradient(45deg, #E74C3C, #F39C12);
    animation: pulse 1.5s infinite;
}

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

/* 结束页样式 */
.end-page {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.end-content {
    max-width: 600px;
}

.end-content h2 {
    font-size: 2.5rem;
    color: #2E8B57;
    margin-bottom: 30px;
}

.end-image {
    margin: 30px 0;
}

.story-message {
    font-size: 1.2rem;
    color: #666;
    line-height: 1.8;
    margin-bottom: 40px;
    text-align: center;
}

.restart-button {
    background: linear-gradient(45deg, #27AE60, #2ECC71);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-weight: bold;
}

.restart-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* 导航样式 */
.navigation {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(10px);
}

.navigation.show {
    display: flex;
}

.nav-btn {
    background: linear-gradient(45deg, #3498DB, #2980B9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: bold;
}

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

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

.page-indicator {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2C3E50;
    min-width: 80px;
}

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

@media (max-width: 480px) {
    .story-title {
        font-size: 1.5rem;
    }
    
    .start-button, .restart-button {
        padding: 12px 30px;
        font-size: 1.1rem;
    }
    
    .scene-text {
        padding: 10px;
    }
    
    .navigation {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .page-indicator {
        order: -1;
    }
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .navigation {
        display: none !important;
    }
    
    .audio-controls {
        display: none !important;
    }
    
    .page {
        page-break-after: always;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 0;
    }
    
    .scene-content {
        grid-template-columns: 1fr;
    }
    
    .scene-image img {
        max-width: 400px;
    }
}