/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #FFB6C1 100%);
    min-height: 100vh;
    color: #2C3E50;
    line-height: 1.6;
}

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

/* Header */
.storybook-header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

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

/* Main Story Area */
.story-main {
    flex: 1;
    margin-bottom: 30px;
}

/* Story Segments */
.story-segment {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 3px solid #FFD700;
    animation: fadeIn 0.6s ease-in-out;
}

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

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

/* Story Content Layout */
.story-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

/* Illustration Container */
.illustration-container {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: #fff;
    padding: 10px;
}

.story-illustration {
    width: 100%;
    height: auto;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

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

/* Text Content */
.text-content {
    padding: 20px;
}

.text-content h2 {
    font-size: 1.8rem;
    color: #2C3E50;
    margin-bottom: 20px;
    text-align: center;
    background: linear-gradient(45deg, #FF6B6B, #4ECDC4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-content p {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #34495E;
    text-align: justify;
    line-height: 1.7;
}

/* Navigation Controls */
.navigation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

/* Navigation Buttons */
.nav-btn, .play-btn, .stop-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    color: white;
}

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

.nav-btn:disabled {
    background: #BDC3C7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Audio Controls */
.audio-controls {
    display: flex;
    gap: 15px;
}

.play-btn {
    background: linear-gradient(45deg, #4ECDC4, #44A08D);
    color: white;
}

.stop-btn {
    background: linear-gradient(45deg, #FC466B, #3F5EFB);
    color: white;
}

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

/* Button Icons and Text */
.btn-icon {
    font-size: 1.2rem;
}

.btn-text {
    font-weight: 700;
}

/* Progress Container */
.progress-container {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 12px;
    background: #E0E0E0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #FF6B6B, #4ECDC4, #45B7D1, #96CEB4, #FFEAA7);
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 20%;
}

/* Page Indicator */
.page-indicator {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #2C3E50;
}

/* Footer */
.storybook-footer {
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.storybook-footer p {
    margin: 5px 0;
    color: #7B68EE;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .storybook-container {
        padding: 15px;
    }
    
    .storybook-header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .story-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .text-content h2 {
        font-size: 1.5rem;
    }
    
    .text-content p {
        font-size: 1rem;
    }
    
    .navigation-controls {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .audio-controls {
        order: -1;
    }
    
    .nav-btn, .play-btn, .stop-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .storybook-header h1 {
        font-size: 1.7rem;
    }
    
    .story-segment {
        padding: 20px;
    }
    
    .text-content {
        padding: 10px;
    }
    
    .navigation-controls {
        padding: 15px;
    }
    
    .nav-btn, .play-btn, .stop-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .btn-text {
        display: none;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Audio Playing Indicator */
.playing {
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(1.05);
    }
}