* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Comic Sans MS', 'Marker Felt', cursive, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Beach Canvas Background */
#beach-canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
    z-index: 10;
    padding-top: 60px; /* Increased to provide more space for sun */
    padding-left: 20px;
    padding-right: 20px; /* Ensure right padding for target display */
}

/* New top section layout */
#game-top-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 20px; /* Reduced margin since no content */
    gap: 30px;
}

/* Game Area - Updated for boat concept */
#game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 600px;
    position: relative;
    z-index: 15;
    padding: 20px 0;
}

/* Boat Container - New boat gameplay area */
#boat-area {
    position: relative;
    width: 100%;
    height: 300px;
    margin: 80px 0 30px 0; /* Increased top margin from 30px to 80px */
    background: transparent; /* Make transparent */
    border-radius: 20px;
    border: none; /* Remove border */
    z-index: 25;
}



/* Boat styling - UPDATED for better movement feedback */
.boat {
    position: absolute;
    bottom: 40px; /* Reduced from 80px to 40px to lower the boat */
    left: 50px; /* Start closer to left */
    width: 190px;
    z-index: 30;
    transition: left 2s ease-in-out; /* Smooth movement animation */
}

.boat-body {
    width: 100%;
    height: 70px; 
    background: linear-gradient(180deg, #8B4513 0%, #654321 50%, #4A2C17 100%);
    border-radius: 20px 20px 60px 60px; /* More realistic hull shape */
    position: relative;
    border: 3px solid #5D4037;
    box-shadow: 
        inset 0 -10px 10px rgba(0, 0, 0, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.4);
    /* Drop zone properties */
    display: flex;
    flex-wrap: wrap;
    padding: 8px;
    gap: 4px;
    align-items: flex-start;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Boat body as drop zone highlight */
.boat-body.highlight {
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
    transform: scale(1.05);
    box-shadow: 
        inset 0 -10px 10px rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(255, 165, 0, 0.5);
    border-color: #FF6B35;
}

/* Add boat deck */
.boat-body::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 10%;
    width: 80%;
    height: 20px;
    background: linear-gradient(180deg, #D2B48C 0%, #CD853F 100%);
    border-radius: 10px;
    border: 2px solid #8B7355;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Add boat cabin */
.boat-body::after {
    content: '';
    position: absolute;
    top: -35px;
    left: 25%;
    width: 50%;
    height: 25px;
    background: linear-gradient(180deg, #F4A460 0%, #D2B48C 100%);
    border-radius: 8px 8px 3px 3px;
    border: 2px solid #8B7355;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.boat-sail {
    position: absolute;
    top: -65px; /* Adjusted for taller mast */
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-bottom: 45px solid #FF6B6B;
    z-index: 1;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

/* Add sail details */
.boat-sail::before {
    content: '';
    position: absolute;
    top: 35px;
    left: -20px;
    width: 40px;
    height: 2px;
    background: #FF4444;
    border-radius: 1px;
}

.boat-sail::after {
    content: '';
    position: absolute;
    top: 25px;
    left: -15px;
    width: 30px;
    height: 1px;
    background: #FF4444;
    border-radius: 1px;
}

.boat-mast {
    position: absolute;
    top: -70px; /* Taller mast */
    left: 50%;
    transform: translateX(-50%);
    width: 5px; /* Slightly thicker */
    height: 75px; /* Taller */
    background: linear-gradient(180deg, #8B4513 0%, #654321 100%);
    border-radius: 3px;
    z-index: 4;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Add mast details */
.boat-mast::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -8px;
    width: 20px;
    height: 2px;
    background: #654321;
    border-radius: 1px;
}

.boat-mast::after {
    content: '';
    position: absolute;
    top: 40px;
    left: -6px;
    width: 16px;
    height: 1px;
    background: #654321;
    border-radius: 1px;
}

/* Additional boat details */
.boat-flag {
    position: absolute;
    top: -75px;
    left: 55%;
    font-size: 20px;
    z-index: 6;
    animation: flag-wave 2s ease-in-out infinite;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

@keyframes flag-wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(5deg);
    }
}

.boat-anchor {
    position: absolute;
    bottom: -5px;
    right: 10px;
    font-size: 16px;
    color: #666;
    z-index: 2;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

.boat-wheel {
    position: absolute;
    top: -25px;
    right: 15px;
    font-size: 14px;
    color: #8B4513;
    z-index: 3;
    animation: wheel-spin 4s linear infinite;
    filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
}

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

/* Add water ripples around boat */
.boat::before {
    content: '';
    position: absolute;
    bottom: -15px;
    left: -20px;
    width: 180px;
    height: 30px;
    background: radial-gradient(ellipse, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: water-ripple 3s ease-in-out infinite;
    z-index: -1;
}

@keyframes water-ripple {
    0%, 100% {
        transform: scale(1);
        opacity: 0.3;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.6;
    }
}

/* Target Island */
.target-island {
    position: absolute;
    bottom: 20px; /* Reduced from 90px to 50px to match boat level */
    right: 50px; /* Target position */
    width: 100px;
    height: 60px;
    z-index: 25;
}

.island-base {
    width: 100%;
    height: 40px;
    background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
    border-radius: 50px 50px 20px 20px;
    position: relative;
}

.palm-tree {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 40px;
    z-index: 5;
}

.treasure-chest {
    position: absolute;
    top: -15px;
    right: 10px;
    font-size: 25px;
    z-index: 5;
}

/* Progress bar */
.progress-bar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 2px solid #4FC3F7;
    overflow: hidden;
    z-index: 35;
}

.progress-fill {
    height: 100%;
    width: 0%; /* Will be updated via JavaScript */
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 8px;
    transition: width 2s ease-in-out;
}

/* Boat Control Panel - Redesigned bucket sum container */
#buckets-container {
    position: absolute;
    top: 15px; /* Position inside the boat body */
    left: -5px; /* Position in the right corner of boat body */
    z-index: 45; /* Above boat body content */
    background: linear-gradient(135deg, #8B4513 0%, #654321 50%, #4A2C17 100%); /* Match boat hull colors */
    border-radius: 50%; /* Make it circular */
    padding: 2px;
    border: 2px solid #5D4037; /* Match boat border */
    box-shadow: 
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.4); /* Match boat shadow */
    width: 35px; /* Circular dimensions */
    height: 35px; /* Circular dimensions */
}

/* Boat Dashboard Display - Updated bucket-sum */
.bucket-sum {
    position: relative;
    background: linear-gradient(135deg, #D2B48C 0%, #CD853F 100%); /* Match deck wood colors */
    border: 1px solid #8B7355; /* Match deck border */
    border-radius: 50%; /* Make it circular */
    padding: 0;
    font-size: 15px;
    font-weight: bold;
    color: #4A2C17; /* Dark wood color for text */
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3); /* Light shadow for wood carving effect */
    font-family: 'Comic Sans MS', cursive; /* Match game font */
    text-align: center;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.2),
        inset 0 -1px 2px rgba(0, 0, 0, 0.2); /* Subtle interior shadow */
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Add wood grain pattern */
.bucket-sum::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(139, 115, 85, 0.1) 25%, transparent 50%, rgba(139, 115, 85, 0.1) 75%, transparent 100%);
    background-size: 8px 100%;
    border-radius: 3px;
    pointer-events: none;
}

/* Add control panel indicators */
.bucket-sum::after {
    content: ''; /* Remove icon to save space */
    display: none;
}

/* Remove old bucket and drop-zone styles */
.bucket {
    display: none; /* Hide old bucket */
}

/* FIXED: Remove the display: none for new drop zones */
/* .drop-zone {
    display: none; 
} */

/* Fish Options - UPDATED with smooth transitions for hiding/showing */
#beach-balls-container {
    position: absolute;
    bottom: -60px;
    left: calc(50px + 90px + var(--container-offset, 0px));
    transform: translateX(-50%);
    width: 320px;
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-end;
    padding: 10px;
    background: rgba(135, 206, 235, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(5px);
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 150, 200, 0.2);
    border: 2px solid rgba(135, 206, 235, 0.3);
    max-width: 320px;
    opacity: 1;
    pointer-events: auto;
    /* UPDATED: Add smooth transition for opacity changes */
    transition: left 2.5s ease-in-out, opacity 0.5s ease, pointer-events 0.5s ease;
}

/* UPDATED: Ensure hidden state is smooth */
#beach-balls-container.hidden,
#beach-balls-container[style*="opacity: 0"] {
    opacity: 0 !important;
    pointer-events: none !important;
}

.beach-ball {
    width: 60px; /* Clean size */
    height: 35px; /* Simple oval proportions */
    border-radius: 50px; /* Simple oval shape */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px; /* Clear readable font size */
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8); /* Simple shadow for contrast */
    cursor: grab;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    z-index: 25;
    animation: fish-swim 4s ease-in-out infinite;
}

/* Simple fish tail */
.beach-ball::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    z-index: -1;
}

/* Remove complex pseudo-elements */
.beach-ball::after {
    display: none;
}

/* Remove all extra fish elements */
.beach-ball .pectoral-fin-left,
.beach-ball .pectoral-fin-right,
.beach-ball .fish-eye,
.beach-ball .fish-scales,
.beach-ball .fish-fin {
    display: none;
}

/* Simple swimming animation */
@keyframes fish-swim {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Boat moving animation - ENHANCED for better feedback */
.boat.moving {
    animation: boat-sail-forward 2s ease-in-out;
}

@keyframes boat-sail-forward {
    0% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-8px) rotate(2deg) scale(1.05);
    }
    50% {
        transform: translateY(-4px) rotate(0deg) scale(1.1);
    }
    75% {
        transform: translateY(-6px) rotate(-1deg) scale(1.05);
    }
    100% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
}

/* Success Message - ENHANCED timing - UPDATED for top positioning */
#success-message {
    position: fixed;
    top: 20px; /* Changed from center positioning */
    left: 50%;
    transform: translateX(-50%); /* Only horizontal centering */
    background: linear-gradient(45deg, #4CAF50, #43A047);
    color: white;
    padding: 15px 25px; /* Reduced from 30px 40px */
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    z-index: 3000;
    border: 5px solid #FFE135;
    backdrop-filter: blur(15px);
    animation: success-bounce-in-top 0.6s ease-out; /* Updated animation name */
    max-width: 500px;
}

/* Updated animation for top positioning */
@keyframes success-bounce-in-top {
    0% {
        transform: translateX(-50%) scale(0.5) translateY(-30px);
        opacity: 0;
    }
    60% {
        transform: translateX(-50%) scale(1.1) translateY(5px);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scale(1) translateY(0);
        opacity: 1;
    }
}

/* New Encouragement Popup Styles - UPDATED for better top positioning */
#encouragement-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Keep flex-start for top alignment */
    padding-top: 20px; /* Reduced padding for closer to top */
    z-index: 4000;
    backdrop-filter: blur(5px);
}

.popup-content {
    background: linear-gradient(135deg, #4FC3F7, #29B6F6);
    border-radius: 30px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 5px solid #FFE135;
    position: relative;
    overflow: hidden;
    animation: popup-bounce-top 0.6s ease-out; /* Updated animation name */
    max-width: 400px;
    width: 90%;
    margin-top: 0;
}

/* Popup Animations - UPDATED for top positioning */
@keyframes popup-bounce-top {
    0% {
        transform: scale(0.3) translateY(-50px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(0);
        opacity: 1;
    }
    70% {
        transform: scale(0.95) translateY(0);
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.popup-content.popup-hide {
    animation: popup-hide-top 0.4s ease-in forwards; /* Updated animation name */
}

@keyframes popup-hide-top {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(0.8) translateY(-20px); /* Move up when hiding */
        opacity: 0;
    }
}

/* Happy face animation in success message */
.happy-face {
    font-size: 40px; /* Reduced from 60px */
    animation: happy-bounce 1s ease-in-out infinite alternate;
    margin-top: 20px;
}

@keyframes happy-bounce {
    0% {
        transform: scale(1) rotate(-5deg);
    }
    100% {
        transform: scale(1.2) rotate(5deg);
    }
}

/* Simple hover effects */
.beach-ball:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    animation-play-state: paused;
}

.beach-ball:active {
    cursor: grabbing;
    transform: scale(1.05) translateY(-2px);
}

.beach-ball.dragging {
    opacity: 0.9;
    transform: scale(1.2) translateY(-8px);
    z-index: 1000;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5);
    animation: none;
}

/* Simple Fish Colors - solid colors for clarity */
.beach-ball.red { 
    background: #FF5252;
    color: white;
}

.beach-ball.red::before {
    border-left-color: #FF5252;
}

.beach-ball.blue { 
    background: #2196F3;
    color: white;
}

.beach-ball.blue::before {
    border-left-color: #2196F3;
}

.beach-ball.yellow { 
    background: #FFD54F;
    color: #333; /* Dark text for yellow background */
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.beach-ball.yellow::before {
    border-left-color: #FFD54F;
}

.beach-ball.green { 
    background: #4CAF50;
    color: white;
}

.beach-ball.green::before {
    border-left-color: #4CAF50;
}

.beach-ball.orange { 
    background: #FF9800;
    color: white;
}

.beach-ball.orange::before {
    border-left-color: #FF9800;
}

/* Fish in Bucket - Updated styling for boat body */
.boat-body .beach-ball {
    width: 45px;
    height: 28px;
    font-size: 14px;
    position: static;
    transform: none !important;
    z-index: 35;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: none;
    margin: 2px;
}

/* Hide fish tail when in boat */
.boat-body .beach-ball::before {
    display: none;
}

/* Controls - Updated for both buttons */
#controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 100;
}

button {
    padding: 12px 25px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-family: 'Comic Sans MS', cursive;
    backdrop-filter: blur(5px);
}

#reset-btn {
    background: linear-gradient(45deg, #FF6B6B, #FF5252);
    color: white;
    border: 3px solid #FF1744;
}

#next-btn {
    background: linear-gradient(45deg, #4CAF50, #43A047);
    color: white;
    border: 3px solid #2E7D32;
}

/* New next question button styling */
#next-question-btn {
    background: linear-gradient(45deg, #FF9800, #F57C00);
    color: white;
    border: 3px solid #E65100;
    animation: button-pulse 2s ease-in-out infinite;
    font-size: 18px;
    padding: 15px 30px;
}

@keyframes button-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 152, 0, 0.4);
    }
}

button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

#next-question-btn:hover {
    animation: none; /* Stop pulsing on hover */
}

/* Additional animations and effects */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-30px);
    }
    60% {
        transform: translateY(-15px);
    }
}

.beach-ball.bounce {
    animation: bounce 0.8s ease;
}

/* Splash effect for bucket */
.splash-effect {
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(135, 206, 235, 0.8);
    border-radius: 50%;
    animation: splash 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes splash {
    0% {
        transform: scale(0) translateY(0);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) translateY(-20px);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.5) translateY(-40px);
        opacity: 0;
    }
}

/* Boat moving animation */
.boat.moving {
    animation: boat-sail 3s ease-in-out infinite;
}

.boat.victory {
    animation: boat-victory 2s ease-in-out infinite;
}

@keyframes boat-sail {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-4px) rotate(1deg);
    }
    50% {
        transform: translateY(-2px) rotate(0deg);
    }
    75% {
        transform: translateY(4px) rotate(-1deg);
    }
}

@keyframes boat-victory {
    0%, 100% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-8px) rotate(2deg) scale(1.05);
    }
    50% {
        transform: translateY(-4px) rotate(0deg) scale(1.1);
    }
    75% {
        transform: translateY(-8px) rotate(-2deg) scale(1.05);
    }
}

/* New Drop Zones inside boat-body - UPDATED for smaller size */
#boat-drop-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px; /* Reduced from 10px */
    padding: 5px; /* Add padding to contain elements */
}

.drop-zone {
    width: 35px; /* Reduced from 50px */
    height: 35px; /* Reduced from 50px */
    border-radius: 50%;
    border: 2px dashed #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    z-index: 40;
}

/* Add highlight effect for drop zones */
.drop-zone.highlight {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
    transform: scale(1.1);
}

.drop-separator,
.drop-equals {
    font-size: 16px; /* Reduced from 24px */
    color: white;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    margin: 0 2px; /* Add small margins */
}

.drop-target {
    font-size: 18px; /* Reduced from 28px */
    color: #FFE135;
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 6px; /* Reduced from 5px 10px */
    border-radius: 8px; /* Reduced from 10px */
    border: 2px solid white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    min-width: 30px; /* Reduced from 50px */
    text-align: center;
}

/* Fish in drop zones styling - UPDATED for smaller zones */
.drop-zone .beach-ball {
    width: 28px; /* Reduced from 40px */
    height: 18px; /* Reduced from 25px */
    font-size: 12px; /* Reduced from 14px */
    margin: 0;
    border-radius: 50%;
}

/* Minimal equation number styling */
.equation-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #FFD700;
    color: #2C5F2D;
    font-size: 1.2em;
    font-weight: 600;
    font-family: 'Arial', sans-serif;
    padding: 0;
    border-radius: 50%;
    border: 2px solid #FF6B35;
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.2);
    transition: all 0.3s ease; /* Added smooth transitions */
    width: 35px;
    height: 35px;
    text-align: center;
}

.equation-number:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 8px rgba(255, 107, 53, 0.3);
}

/* Correct answer styling - green background */
.equation-number.correct-answer {
    background: #4CAF50 !important;
    border-color: #2E7D32 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4) !important;
    transform: scale(1.1);
}

/* Wrong answer styling - red background */
.equation-number.wrong-answer {
    background: #FF5252 !important;
    border-color: #D32F2F !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.4) !important;
    transform: scale(1.1);
    animation: shake 0.5s ease-in-out;
}

/* Shake animation for wrong answers */
@keyframes shake {
    0%, 100% { transform: scale(1.1) translateX(0); }
    25% { transform: scale(1.1) translateX(-5px); }
    75% { transform: scale(1.1) translateX(5px); }
}

/* Enhanced accessibility - add subtle border for colorblind users */
.equation-number.correct-answer::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: #4CAF50;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid #4CAF50;
}

.equation-number.wrong-answer::after {
    content: '✗';
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: #FF5252;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 1px solid #FF5252;
}

/* Setup Form Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #87CEEB, #4FC3F7);
    border-radius: 25px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 5px solid #FFE135;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.5s ease-out;
}

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

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    color: white;
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.step.active {
    background: #FFE135;
    color: #333;
    border-color: #FF6B35;
    transform: scale(1.1);
}

.step.completed {
    background: #4CAF50;
    color: white;
    border-color: #2E7D32;
}

.form-step {
    display: none;
    animation: stepFadeIn 0.3s ease-in;
}

.form-step.active {
    display: block;
}

@keyframes stepFadeIn {
    0% { opacity: 0; transform: translateX(20px); }
    100% { opacity: 1; transform: translateX(0); }
}

.form-step h3 {
    color: white;
    font-size: 24px;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.question-selector {
    text-align: center;
    margin-bottom: 30px;
}

.question-selector label {
    display: block;
    color: white;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: bold;
}

.question-selector input[type="range"] {
    width: 80%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    outline: none;
    margin-bottom: 10px;
}

.question-selector input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 25px;
    height: 25px;
    background: #FFE135;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid #FF6B35;
}

#question-count-display {
    background: #FFE135;
    color: #333;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 24px;
    font-weight: bold;
    border: 3px solid #FF6B35;
    margin-left: 15px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.checkbox-option:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.checkbox-option input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 25px;
    height: 25px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    margin-right: 15px;
    position: relative;
    border: 3px solid #FFE135;
    transition: all 0.3s ease;
}

.checkbox-option input[type="checkbox"]:checked + .checkmark {
    background: #4CAF50;
}

.checkbox-option input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.option-content {
    flex: 1;
}

.option-title {
    color: white;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.option-example {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-family: monospace;
}

.drop-example {
    background: #FFE135;
    color: #333;
    padding: 2px 8px;
    border-radius: 5px;
    font-weight: bold;
}

.range-selectors {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 20px;
}

.range-input {
    text-align: center;
}

.range-input label {
    display: block;
    color: white;
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: bold;
}

.range-input input[type="number"] {
    width: 80px;
    padding: 10px;
    border: 3px solid #FFE135;
    border-radius: 10px;
    font-size: 18px;
    text-align: center;
    background: white;
}

.range-preview {
    text-align: center;
    margin-bottom: 30px;
}

.range-preview p {
    color: white;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #FFE135;
}

.range-preview span {
    background: #FFE135;
    color: #333;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
}

.form-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.form-buttons button {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', cursive;
}

.back-btn {
    background: linear-gradient(45deg, #666, #555);
    color: white;
    border: 3px solid #333;
}

.back-btn:hover {
    background: linear-gradient(45deg, #777, #666);
    transform: translateY(-2px);
}

.next-btn {
    background: linear-gradient(45deg, #4FC3F7, #29B6F6);
    color: white;
    border: 3px solid #1976D2;
}

.next-btn:hover {
    background: linear-gradient(45deg, #29B6F6, #1976D2);
    transform: translateY(-2px);
}

.start-btn {
    background: linear-gradient(45deg, #4CAF50, #43A047);
    color: white;
    border: 3px solid #2E7D32;
    font-size: 20px;
    padding: 18px 40px;
}

.start-btn:hover {
    background: linear-gradient(45deg, #43A047, #2E7D32);
    transform: translateY(-2px);
}

.next-btn:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

/* Burger Menu Button */
.burger-menu-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    border: 3px solid #5D4037;
    border-radius: 10px;
    cursor: pointer;
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.burger-menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.burger-menu-btn span {
    display: block;
    width: 28px;
    height: 3px;
    background: #FFE135;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Burger menu animation when active */
.burger-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.burger-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Sidebar Menu */
.sidebar-menu {
    position: fixed;
    top: 0;
    right: -350px; /* Hidden by default */
    width: 350px;
    height: 100vh;
    background: linear-gradient(135deg, #87CEEB 0%, #4FC3F7 50%, #29B6F6 100%);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 150;
    transition: right 0.4s ease-in-out;
    overflow-y: auto;
    border-left: 5px solid #FFE135;
}

.sidebar-menu.open {
    right: 0;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 20px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
    border-bottom: 3px solid #FFE135;
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 24px;
    font-family: 'Comic Sans MS', cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 30px 0;
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li {
    margin-bottom: 15px;
    padding: 0 20px;
}

.menu-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', cursive;
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.menu-option:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: #FFE135;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.menu-option:active {
    transform: translateY(0);
}

.menu-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.menu-text {
    flex: 1;
    text-align: left;
}

/* Special styling for pause/resume button */
#pause-game-btn.paused .menu-icon {
    content: "▶️";
}

#pause-game-btn.paused .menu-text::after {
    content: " (Resume)";
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Game Paused Overlay */
.game-paused-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 250;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.game-paused-overlay.active {
    display: flex;
}

.paused-content {
    background: linear-gradient(135deg, #4FC3F7, #29B6F6);
    border-radius: 30px;
    padding: 50px;
    text-align: center;
    color: white;
    border: 5px solid #FFE135;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popup-bounce-top 0.6s ease-out;
    max-width: 400px;
    width: 90%;
}

.paused-content h2 {
    font-size: 36px;
    margin-bottom: 20px;
    font-family: 'Comic Sans MS', cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.paused-content p {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.9;
}

.resume-btn {
    padding: 15px 30px;
    font-size: 20px;
    font-weight: bold;
    background: linear-gradient(45deg, #4CAF50, #43A047);
    color: white;
    border: 3px solid #2E7D32;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', cursive;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.resume-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* Game paused state styling */
.game-paused #game-area {
    pointer-events: none;
    filter: grayscale(50%) blur(2px);
    opacity: 0.7;
}

.game-paused #beach-balls-container {
    pointer-events: none;
}

.game-paused .boat {
    animation-play-state: paused !important;
}

.game-paused .beach-ball {
    animation-play-state: paused !important;
}

/* Responsive Design for Sidebar */
@media (max-width: 768px) {
    .burger-menu-btn {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .burger-menu-btn span {
        width: 24px;
    }
    
    .sidebar-menu {
        width: 100%;
        right: -100%;
    }
    
    .sidebar-menu.open {
        right: 0;
    }
    
    .menu-option {
        padding: 18px;
        font-size: 16px;
    }
    
    .menu-icon {
        font-size: 20px;
        min-width: 28px;
    }
    
    .paused-content {
        padding: 30px;
        margin: 20px;
    }
    
    .paused-content h2 {
        font-size: 28px;
    }
    
    .paused-content p {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .sidebar-nav li {
        margin-bottom: 10px;
    }
    
    .menu-option {
        padding: 15px;
        font-size: 15px;
    }
}

/* Accessibility improvements */
.burger-menu-btn:focus,
.close-sidebar-btn:focus,
.menu-option:focus,
.resume-btn:focus {
    outline: 3px solid #FFE135;
    outline-offset: 2px;
}

/* Keyboard navigation styles */
.menu-option:focus {
    background: rgba(255, 255, 255, 0.4);
    border-color: #FFE135;
}