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

body {
    font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 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 20px 40px rgba(0, 0, 0, 0.1);
    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: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 标题页样式 */
.title-page {
    text-align: center;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #2d3436;
}

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

.story-subtitle {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #636e72;
}

.title-illustration {
    margin: 30px 0;
}

.title-image {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 50%;
    border: 8px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.start-button {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    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, 184, 148, 0.3);
}

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

/* 故事页面样式 */
.story-page {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.page-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
}

.illustration-container {
    position: relative;
    text-align: center;
    flex: 1;
}

.story-illustration {
    width: 100%;
    max-width: 500px;
    height: 300px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

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

.image-text-overlay {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
}

.story-text {
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.story-text p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #2d3436;
    text-align: justify;
}

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

.audio-button {
    background: linear-gradient(135deg, #fd79a8 0%, #fdcb6e 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(253, 121, 168, 0.3);
}

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

.audio-button.playing {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    animation: pulse 1.5s infinite;
}

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

/* 结束页样式 */
.end-page {
    text-align: center;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #2d3436;
}

.end-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #2d3436;
}

.end-message {
    background: rgba(255, 255, 255, 0.9);
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.end-message p {
    font-size: 1.3rem;
    line-height: 1.6;
    margin-bottom: 10px;
}

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

.end-image {
    width: 250px;
    height: 250px;
    object-fit: cover;
    border-radius: 50%;
    border: 6px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.restart-button {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    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(108, 92, 231, 0.3);
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

/* 导航控制样式 */
.navigation-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.nav-button {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

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

.nav-button:disabled {
    background: #ddd;
    cursor: not-allowed;
    opacity: 0.5;
}

.page-indicator {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2d3436;
    min-width: 60px;
    text-align: center;
}

/* 设置面板样式 */
.settings-panel {
    position: absolute;
    top: 20px;
    right: 20px;
}

.settings-button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.settings-button:hover {
    transform: rotate(90deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.settings-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    display: none;
}

.settings-menu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    font-size: 1rem;
    color: #2d3436;
}

.setting-item input, .setting-item select {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .storybook-container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .page {
        padding: 20px;
        min-height: 500px;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .story-subtitle {
        font-size: 1.2rem;
    }
    
    .title-image {
        width: 200px;
        height: 200px;
    }
    
    .story-illustration {
        height: 200px;
    }
    
    .story-text p {
        font-size: 1.1rem;
    }
    
    .navigation-controls {
        bottom: 10px;
        padding: 10px 15px;
        gap: 15px;
    }
    
    .nav-button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .settings-panel {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 15px;
    }
    
    .story-title {
        font-size: 1.5rem;
    }
    
    .title-image {
        width: 150px;
        height: 150px;
    }
    
    .story-illustration {
        height: 150px;
    }
    
    .story-text {
        padding: 15px;
    }
    
    .story-text p {
        font-size: 1rem;
    }
    
    .navigation-controls {
        flex-direction: column;
        gap: 10px;
    }
}

/* 字体大小设置 */
.font-large .story-text p {
    font-size: 1.4rem;
}

.font-extra-large .story-text p {
    font-size: 1.6rem;
}

/* 打印样式 */
@media print {
    body {
        background: white;
    }
    
    .storybook-container {
        box-shadow: none;
        border-radius: 0;
    }
    
    .navigation-controls,
    .settings-panel,
    .audio-controls {
        display: none;
    }
    
    .page {
        page-break-after: always;
        display: block !important;
        padding: 20px;
    }
    
    .page:last-child {
        page-break-after: avoid;
    }
}