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

body {
    font-family: 'Arial', '微软雅黑', sans-serif;
    background: linear-gradient(135deg, #ffeaa7, #fab1a0, #fd79a8);
    min-height: 100vh;
    padding: 20px;
}

.storybook-container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* 头部样式 */
.story-header {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    text-align: center;
    padding: 30px 20px;
}

.story-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.story-main {
    position: relative;
    min-height: 600px;
    padding: 40px;
}

.story-page {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.story-page.active {
    display: block;
}

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

.story-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* 插图样式 */
.illustration-container {
    text-align: center;
}

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

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

/* 文本样式 */
.story-text {
    padding: 20px;
}

.story-text h2 {
    font-size: 2rem;
    color: #2d3436;
    margin-bottom: 20px;
    text-align: center;
    background: linear-gradient(135deg, #fd79a8, #fdcb6e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.story-text p {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #2d3436;
    text-align: justify;
    margin-bottom: 20px;
}

.story-end {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-radius: 15px;
    border-left: 5px solid #e17055;
}

.moral {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2d3436;
    text-align: center;
}

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

.play-audio-btn {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}

.play-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

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

.play-audio-btn.playing {
    background: linear-gradient(135deg, #e17055, #d63031);
    animation: pulse 1.5s infinite;
}

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

/* 导航样式 */
.story-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 40px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.nav-btn {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(116, 185, 255, 0.4);
}

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

.page-indicator {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2d3436;
    background: white;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 全局控制 */
.global-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: #2d3436;
}

.control-btn {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(162, 155, 254, 0.4);
}

.control-btn.active {
    background: linear-gradient(135deg, #00b894, #00cec9);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .story-header h1 {
        font-size: 2rem;
    }
    
    .story-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .story-main {
        padding: 20px;
    }
    
    .story-text h2 {
        font-size: 1.5rem;
    }
    
    .story-text p {
        font-size: 1.1rem;
    }
    
    .story-navigation {
        padding: 20px;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .nav-btn {
        min-width: 100px;
        font-size: 1rem;
    }
    
    .global-controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .story-header h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .story-text p {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .story-navigation {
        justify-content: center;
    }
    
    .page-indicator {
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 15px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 无障碍支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦点样式 */
button:focus,
.nav-btn:focus,
.control-btn:focus,
.play-audio-btn:focus {
    outline: 3px solid #fdcb6e;
    outline-offset: 2px;
}