/* Base styles and reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background-color: #e6f7ff; /* Light blue background */
    color: #333;
    line-height: 1.6;
    background-image: linear-gradient(to bottom, #e6f7ff, #c1e3ff);
    min-height: 100vh;
}

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

/* Header styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: #ffcc66; /* Warm yellow */
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.game-title {
    font-family: 'Bubblegum Sans', cursive;
    color: #ff6600; /* Orange */
    font-size: 2.5rem;
    text-shadow: 2px 2px 0 #fff;
}

.score-container {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.score-label {
    font-weight: bold;
    margin-right: 5px;
    font-size: 1.2rem;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6600;
    margin-right: 5px;
}

.score-carrot {
    width: 30px;
    height: auto;
}

/* Progress bar styles */
.progress-container {
    margin-bottom: 20px;
    background-color: #fff;
    padding: 10px 15px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.progress-label {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.progress-bar-outer {
    width: 100%;
    height: 15px;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: #66cc66; /* Green */
    border-radius: 10px;
    transition: width 0.5s ease, background-color 0.5s ease;
}

/* Timer styles */
.timer-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-label {
    font-weight: bold;
    font-size: 1.1rem;
    background-color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#timer-value {
    color: #ff6600;
    font-size: 1.3rem;
}

/* Main game area */
.game-area {
    display: grid;
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto auto;
    gap: 20px;
    margin-bottom: 30px;
    flex-grow: 1;
}

.character-container {
    grid-row: span 2;
    display: flex;
    justify-content: center;
    align-items: center;
}

.rabbit {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    transition: transform 0.3s ease;
}

.rabbit:hover {
    transform: scale(1.05);
}

/* Problem container with thought bubble */
.problem-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.thought-bubble {
    background-color: white;
    border-radius: 50px;
    padding: 20px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.thought-bubble:before {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 30px;
    width: 30px;
    height: 30px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.thought-bubble:after {
    content: '';
    position: absolute;
    bottom: -35px;
    left: 15px;
    width: 15px;
    height: 15px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.math-problem {
    font-size: 2.5rem;
    font-weight: bold;
    color: #333;
}

#operator, #question-mark {
    color: #ff6600;
    margin: 0 10px;
}

/* Answer container */
.answer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.answer-input {
    padding: 15px;
    font-size: 1.5rem;
    border: 3px solid #66cc66; /* Green */
    border-radius: 10px;
    width: 150px;
    text-align: center;
    font-family: 'Comic Neue', cursive;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.answer-input:focus {
    outline: none;
    border-color: #ff6600;
    box-shadow: 0 0 10px rgba(255, 102, 0, 0.5);
}

.submit-btn {
    padding: 12px 25px;
    font-size: 1.2rem;
    background-color: #66cc66; /* Green */
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background-color: #55bb55;
    transform: scale(1.05);
}

.submit-btn:active {
    transform: scale(0.98);
}

/* Feedback container */
.feedback-container {
    grid-column: 2;
    background-color: #fff;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

#feedback-text {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #333;
    transition: color 0.3s ease;
}

/* Feedback message styles */
.correct-feedback {
    color: #66cc66 !important; /* Green */
    font-weight: bold;
}

.incorrect-feedback {
    color: #ff6666 !important; /* Red */
    font-weight: bold;
}

.carrots-reward {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.carrot-reward {
    width: 40px;
    height: auto;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.carrot-reward.earned {
    opacity: 1;
}

.big-carrot-reward {
    position: absolute;
    width: 100px;
    height: auto;
    top: -50px;
    right: -30px;
    transform: rotate(15deg);
    animation: float 3s ease-in-out infinite;
    z-index: 10;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(15deg); }
    50% { transform: translateY(-20px) rotate(25deg); }
}

/* Game controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.game-btn {
    padding: 10px 20px;
    font-size: 1.1rem;
    background-color: #ff9933; /* Orange */
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.game-btn:hover {
    background-color: #ff8822;
    transform: scale(1.05);
}

.game-btn:active {
    transform: scale(0.98);
}

.game-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Level selector */
.level-selector {
    text-align: center;
    margin-top: 20px;
}

.level-selector p {
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.level-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.level-btn {
    padding: 8px 15px;
    font-size: 1rem;
    background-color: #99ccff; /* Light blue */
    color: #333;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    transition: all 0.3s ease;
}

.level-btn:hover {
    background-color: #77aaff;
}

.level-btn.active {
    background-color: #3366cc; /* Darker blue */
    color: white;
}

.level-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-btn:hover {
    color: #333;
}

.instructions-content {
    margin-top: 20px;
}

.instructions-content p {
    margin-bottom: 15px;
}

.instructions-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.instructions-content li {
    margin-bottom: 5px;
}

/* Achievement notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: -300px;
    width: 280px;
    background-color: #ffcc66;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 15px;
    z-index: 1000;
    transition: right 0.5s ease;
}

.achievement-notification.show {
    right: 20px;
}

.achievement-content h3 {
    color: #ff6600;
    margin-bottom: 5px;
}

.achievement-content p {
    color: #333;
}

/* Animation classes */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.bounce {
    animation: bounce 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.5s ease;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }
    
    .character-container {
        grid-row: 1;
    }
    
    .problem-container {
        grid-row: 2;
    }
    
    .answer-container {
        grid-row: 3;
        grid-column: 1;
    }
    
    .feedback-container {
        grid-row: 4;
        grid-column: 1;
        margin-top: 20px;
    }
    
    .math-problem {
        font-size: 2rem;
    }
    
    .timer-container {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    header {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }
    
    .math-problem {
        font-size: 1.8rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .level-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 15px;
    }
}