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

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

/* 故事书容器 */
.storybook-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 20px;
}

/* 头部样式 */
.story-header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    border-radius: 15px;
    margin-bottom: 30px;
}

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

.story-subtitle {
    font-size: 1.2rem;
    color: #7f8c8d;
    font-weight: 400;
}

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

/* 故事页面 */
.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); }
}

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

/* 插图容器 */
.illustration-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

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

/* 文本内容 */
.text-content {
    padding: 20px;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 20px;
    border-bottom: 3px solid #3498db;
    padding-bottom: 10px;
}

.story-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #34495e;
    margin-bottom: 20px;
    text-align: justify;
}

.story-text strong {
    color: #e74c3c;
    font-weight: 600;
}

/* 对话部分 */
.dialogue-section {
    margin: 20px 0;
}

.dialogue {
    margin: 15px 0;
    padding: 15px;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.dialogue.rabbit {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-left: 4px solid #fdcb6e;
}

.dialogue.sheriff {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border-left: 4px solid #2d3436;
}

.dialogue.squirrel {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    border-left: 4px solid #2d3436;
}

.dialogue.wolf {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    color: white;
    border-left: 4px solid #2d3436;
}

.speaker {
    font-weight: 600;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

.dialogue p {
    flex: 1;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

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

.play-audio-btn {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 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 5px 15px rgba(0, 184, 148, 0.3);
}

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

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

.play-audio-btn.small {
    padding: 8px 12px;
    font-size: 0.9rem;
    min-width: 40px;
}

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

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

/* 导航 */
.story-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    margin-top: 30px;
    border-top: 2px solid #ecf0f1;
}

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

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.page-indicator {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    background: #ecf0f1;
    padding: 10px 20px;
    border-radius: 20px;
}

/* 自动播放控制 */
.auto-play-controls {
    text-align: center;
    margin: 20px 0;
}

.auto-play-btn {
    background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(253, 121, 168, 0.3);
    margin: 0 10px;
}

.auto-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(253, 121, 168, 0.4);
}

/* 故事结尾 */
.story-end {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-radius: 15px;
}

.story-end h3 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
}

.moral {
    font-size: 1.1rem;
    color: #7f8c8d;
    font-style: italic;
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        padding: 15px;
        border-radius: 15px;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .story-subtitle {
        font-size: 1rem;
    }
    
    .page-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .story-text {
        font-size: 1.1rem;
    }
    
    .dialogue {
        flex-direction: column;
        gap: 10px;
    }
    
    .play-audio-btn.small {
        align-self: flex-start;
    }
    
    .story-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .story-title {
        font-size: 1.8rem;
    }
    
    .page-title {
        font-size: 1.3rem;
    }
    
    .story-text {
        font-size: 1rem;
    }
    
    .dialogue p {
        font-size: 1rem;
    }
    
    .play-audio-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

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

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

/* 音频播放状态指示 */
.audio-playing {
    position: relative;
}

.audio-playing::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 10px;
    height: 10px;
    background: #e74c3c;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .storybook-container {
        box-shadow: none;
        margin: 0;
    }
    
    .story-navigation,
    .auto-play-controls,
    .audio-controls {
        display: none;
    }
    
    .story-page {
        display: block !important;
        page-break-after: always;
    }
    
    .story-page:last-child {
        page-break-after: avoid;
    }
}