/* Reset and base styles for consistent display across devices */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    overflow: hidden;
    user-select: none;
}

/* Main container with responsive height for iframe/fullscreen */
.game-container {
    width: 100%;
    height: 450px; /* Default iframe height */
    max-height: 450px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(135deg, #E6F3FF 0%, #F0FFF0 100%);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Responsive height for fullscreen mode */
@media (min-height: 500px) {
    .game-container {
        height: 90vh;
        max-height: 90vh;
    }
}

/* Header bar with score and progress tracking */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-height: 45px;
}

.score-display, .level-display {
    font-size: 16px;
    font-weight: bold;
    color: #2C3E50;
    background: rgba(255,255,255,0.8);
    padding: 5px 12px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: help;
}

/* Progress bar for level advancement */
.progress-bar {
    flex: 1;
    height: 12px;
    background: rgba(255,255,255,0.6);
    border-radius: 10px;
    margin: 0 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #32CD32 0%, #228B22 100%);
    width: 0%;
    transition: width 0.5s ease-in-out;
    border-radius: 10px;
}

/* Speaker button styling for text-to-speech functionality */
.speaker-btn {
    background: rgba(255,255,255,0.9);
    border: 2px solid #4A90E2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.speaker-btn:hover {
    background: #4A90E2;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.speaker-btn:active {
    transform: scale(0.95);
}

.speaker-btn.speaking {
    background: #32CD32;
    border-color: #228B22;
    animation: speakerPulse 1s infinite;
}

/* Main game scene area */
.game-scene {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(135deg, #E6F3FF 0%, #F0FFF0 100%);
    overflow: hidden;
}

/* Character display area */
.character-area {
    position: absolute;
    top: 10px;
    left: 15px;
    z-index: 10;
}

.character {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #FFB6C1 0%, #FFA0B4 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
    border: 3px solid #FF69B4;
}

.character:hover {
    transform: scale(1.1);
}

.character-face {
    font-size: 24px;
    animation: bounce 2s infinite;
}

/* Scene background and content */
.scene-background {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at center, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.4) 100%);
}

.scene-content {
    text-align: center;
    max-width: 80%;
}

.situation-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.scene-description {
    font-size: 18px;
    color: #2C3E50;
    line-height: 1.4;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

/* Dialogue box for story narration */
.dialogue-box {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border: 3px solid #4A90E2;
    border-radius: 15px;
    padding: 15px;
    margin: 10px 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
    min-height: 60px;
}

.dialogue-box::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #4A90E2;
}

.dialogue-text {
    font-size: 16px;
    color: #2C3E50;
    line-height: 1.5;
    font-weight: 600;
}

/* Decision buttons area */
.decision-area {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255,255,255,0.3);
    border-top: 2px solid rgba(255,255,255,0.5);
}

.decision-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    font-family: inherit;
    min-height: 45px;
    width: 100%;
}

.decision-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #5CBF60 0%, #4CAF50 100%);
}

.decision-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.decision-btn.wrong {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
}

.decision-btn.correct {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
}

/* Celebration overlay for positive feedback */
.celebration-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,215,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: celebrationFade 0.5s ease-in-out;
}

.celebration-content {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 3px solid #FFD700;
}

.celebration-emoji {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounce 1s infinite;
}

.celebration-text {
    font-size: 20px;
    font-weight: bold;
    color: #2C3E50;
    margin-bottom: 20px;
}

.continue-btn {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #2C3E50;
    border: none;
    border-radius: 20px;
    padding: 10px 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

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

/* Tooltip for additional information */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 200px;
    text-align: center;
}

.tooltip.show {
    opacity: 1;
}

/* Animations for enhanced visual feedback */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

@keyframes celebrationFade {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation for speaker button when speaking */
@keyframes speakerPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Mobile-first responsive design */
@media (max-width: 480px) {
    .header-bar {
        padding: 5px 10px;
        min-height: 40px;
    }
    
    .score-display, .level-display {
        font-size: 14px;
        padding: 4px 8px;
    }
    
    .speaker-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .scene-description {
        font-size: 16px;
    }
    
    .dialogue-text {
        font-size: 15px;
    }
    
    .decision-btn {
        font-size: 15px;
        padding: 10px 15px;
        min-height: 40px;
    }
    
    .character {
        width: 50px;
        height: 50px;
    }
    
    .character-face {
        font-size: 20px;
    }
    
    .situation-icon {
        font-size: 40px;
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    .decision-btn:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    }
    
    .decision-btn:active {
        transform: scale(0.95);
        background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    }
    
    .speaker-btn:hover {
        transform: none;
    }
    
    .speaker-btn:active {
        transform: scale(0.9);
    }
}