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

body {
    font-family: 'Fredoka One', cursive, sans-serif;
    overflow: hidden; /* Prevent scrolling */
    background-color: #87CEEB; /* Sky blue */
    user-select: none; /* Prevent text selection on rapid clicking */
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#sky {
    height: 20%;
    position: relative;
    z-index: 1;
}

#title {
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-size: 3rem;
}

#scoreboard {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    z-index: 10;
    position: relative;
}

.score-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 10px 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.score-card h2 {
    font-size: 1.2rem;
    color: #333;
}

.score-card p {
    font-size: 2rem;
    color: #FF851B;
    font-weight: bold;
}

.cloud {
    background: white;
    border-radius: 50px;
    position: absolute;
    opacity: 0.8;
}

.cloud::before, .cloud::after {
    content: '';
    background: white;
    position: absolute;
    border-radius: 50%;
}

.cloud1 {
    width: 100px; height: 30px;
    top: 20px; left: 10%;
}
.cloud1::before { width: 50px; height: 50px; top: -20px; left: 10px; }
.cloud1::after { width: 40px; height: 40px; top: -15px; right: 15px; }

.cloud2 {
    width: 120px; height: 40px;
    top: 40px; right: 20%;
}
.cloud2::before { width: 60px; height: 60px; top: -30px; left: 15px; }
.cloud2::after { width: 50px; height: 50px; top: -20px; right: 20px; }

.cloud3 {
    width: 90px; height: 25px;
    top: 10px; left: 50%;
}
.cloud3::before { width: 40px; height: 40px; top: -15px; left: 10px; }
.cloud3::after { width: 30px; height: 30px; top: -10px; right: 10px; }


#rain-area {
    height: 60%;
    position: relative;
    z-index: 2;
}

#garden {
    height: 20%;
    background: #7CFC00; /* Lawn green */
    position: relative;
    z-index: 3;
    border-top: 5px solid #228B22;
}

/* Raindrop styling */
.raindrop {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 0 50% 50% 50%;
    transform: rotate(45deg);
    cursor: pointer;
    animation: fall linear forwards;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

.raindrop:active {
    transform: rotate(45deg) scale(0.9);
}

@keyframes fall {
    from {
        top: -50px;
    }
    to {
        top: 100%;
    }
}

/* Flower styling */
.flower {
    width: 60px;
    height: 60px;
    position: absolute;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: grow 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.flower-center {
    width: 20px;
    height: 20px;
    background: #FFD700;
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}

.petal {
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.petal:nth-child(2) { top: 0; left: 17.5px; }
.petal:nth-child(3) { bottom: 0; left: 17.5px; }
.petal:nth-child(4) { top: 17.5px; left: 0; }
.petal:nth-child(5) { top: 17.5px; right: 8px; }

@keyframes grow {
    from {
        transform: scale(0) translateX(-50%);
        opacity: 0;
    }
    to {
        transform: scale(1) translateX(-50%);
        opacity: 1;
    }
}

/* Specific colors */
.color-red { background-color: #FF4136; }
.color-blue { background-color: #0074D9; }
.color-yellow { background-color: #FFDC00; }
.color-green { background-color: #2ECC40; }
.color-purple { background-color: #B10DC9; }
.color-orange { background-color: #FF851B; }

/* Mushroom styling */
.mushroom {
    width: 60px;
    height: 60px;
    position: absolute;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    animation: grow 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.mushroom-cap {
    width: 50px;
    height: 30px;
    border-radius: 50px 50px 0 0;
    position: relative;
    z-index: 2;
    box-shadow: inset -5px -5px 10px rgba(0,0,0,0.2);
}

.mushroom-cap::before, .mushroom-cap::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}

.mushroom-cap::before { width: 10px; height: 10px; top: 10px; left: 10px; }
.mushroom-cap::after { width: 12px; height: 12px; top: 5px; right: 12px; }

.mushroom-stem {
    width: 20px;
    height: 25px;
    background-color: #fdf5e6;
    border-radius: 5px 5px 0 0;
    z-index: 1;
    margin-top: -5px;
    box-shadow: inset -2px -2px 5px rgba(0,0,0,0.1);
}

/* Worm styling */
#worm {
    position: absolute;
    bottom: 10px;
    left: 50%; /* center initially */
    width: 80px;
    height: 30px;
    display: flex;
    align-items: flex-end;
    /* transition removed to allow smoother JS frame updates */
    z-index: 4; /* above flowers */
    transform: translateX(-50%);
}

.worm-segment {
    width: 20px;
    height: 20px;
    background-color: #32CD32; /* Lime green */
    border-radius: 50%;
    margin-right: -5px; /* overlap */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: crawl 0.5s infinite alternate;
}

.segment1 { animation-delay: 0s; }
.segment2 { animation-delay: 0.1s; }
.segment3 { animation-delay: 0.2s; }

.worm-head {
    width: 30px;
    height: 30px;
    background-color: #32CD32;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    animation: crawl 0.5s infinite alternate;
    animation-delay: 0.3s;
}

.eye {
    width: 6px;
    height: 6px;
    background-color: black;
    border-radius: 50%;
    position: absolute;
    top: 8px;
}

.left-eye { left: 5px; }
.right-eye { right: 8px; }

@keyframes crawl {
    0% { transform: translateY(0); }
    100% { transform: translateY(-5px); }
}
