/* Main Game Styles */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #87CEEB;
    font-family: Arial, sans-serif;
    transition: background-color 3s;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Environment Elements */
#ground {
    position: absolute;
    bottom: 0;
    width: 200%;
    height: 100px;
    background-color: #8B4513;
    background-image: repeating-linear-gradient(90deg, transparent, transparent 100px, #7D3C03 100px, #7D3C03 200px);
    animation: moveGround 5s linear infinite;
}

#distant-mountains {
    position: absolute;
    bottom: 120px;
    width: 200%;
    height: 80px;
    background: linear-gradient(180deg, transparent 0%, #6B8E23 100%);
    opacity: 0.6;
    animation: moveSlowly 30s linear infinite;
}

#mid-mountains {
    position: absolute;
    bottom: 120px;
    width: 200%;
    height: 120px;
    background: linear-gradient(180deg, transparent 0%, #556B2F 100%);
    opacity: 0.7;
    animation: moveSlowly 20s linear infinite;
}

#grass {
    position: absolute;
    bottom: 100px;
    width: 200%;
    height: 20px;
    background-color: #7CFC00;
    background-image: linear-gradient(90deg, #7CFC00 0%, #32CD32 100%);
    animation: moveGround 5s linear infinite;
}

@keyframes moveGround {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes moveSlowly {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Rabbit Styles */
#rabbit {
    position: absolute;
    bottom: 120px;
    left: 100px;
    width: 50px;
    height: 70px;
    background-color: white;
    border-radius: 25px;
    z-index: 10;
    transition: transform 0.1s;
}

.ears {
    position: absolute;
    width: 15px;
    height: 40px;
    background-color: white;
    border-radius: 7.5px;
    top: -35px;
    transition: transform 0.2s;
}

#left-ear {
    left: 10px;
}

#right-ear {
    right: 10px;
}

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

#left-eye {
    left: 12px;
}

#right-eye {
    right: 12px;
}

#nose {
    position: absolute;
    width: 12px;
    height: 8px;
    background-color: pink;
    border-radius: 6px;
    top: 30px;
    left: 19px;
}

.leg {
    position: absolute;
    width: 10px;
    height: 20px;
    background-color: #F5F5DC;
    bottom: -15px;
    border-radius: 5px;
    transition: bottom 0.1s;
}

#left-leg {
    left: 10px;
}

#right-leg {
    right: 10px;
}

.tail {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: white;
    border-radius: 50%;
    bottom: 10px;
    left: -5px;
    transition: transform 0.2s;
}

/* Obstacle Styles */
.hurdle {
    position: absolute;
    bottom: 120px;
}

.tree {
    width: 30px;
    height: 80px;
    background-color: #8B4513;
}

.tree::before {
    content: "";
    position: absolute;
    top: -60px;
    left: -35px;
    width: 100px;
    height: 70px;
    background-color: #228B22;
    border-radius: 50%;
}

.parrot {
    width: 40px;
    height: 30px;
    background-color: #FF0000;
    border-radius: 20px;
    bottom: 200px;
}

.parrot::before {
    content: "";
    position: absolute;
    top: 5px;
    right: -10px;
    width: 20px;
    height: 10px;
    background-color: #FFFF00;
    border-radius: 10px 10px 0 0;
}

.parrot::after {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 5px;
    width: 10px;
    height: 15px;
    background-color: #FF6347;
    border-radius: 5px;
}

.rock {
    width: 50px;
    height: 40px;
    background-color: #808080;
    border-radius: 10px 15px 5px 8px;
}

.log {
    width: 80px;
    height: 25px;
    background-color: #8B4513;
    border-radius: 12px;
}

.log::before {
    content: "";
    position: absolute;
    top: 5px;
    left: 10px;
    width: 60px;
    height: 5px;
    background-color: #A0522D;
    border-radius: 2px;
}

/* Collectible Styles */
.carrot {
    position: absolute;
    width: 15px;
    height: 30px;
    background-color: #FFA500;
    border-radius: 0 0 7.5px 7.5px;
    bottom: 160px;
}

.carrot::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 0;
    width: 20px;
    height: 10px;
    background-color: #228B22;
    border-radius: 5px;
}

.coin {
    position: absolute;
    width: 25px;
    height: 25px;
    background-color: #FFD700;
    border-radius: 50%;
    bottom: 170px;
    border: 2px solid #DAA520;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    animation: spin 2s linear infinite, glow 1.5s ease-in-out infinite;
}

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

.coin::after {
    content: "C";
    color: #DAA520;
    font-weight: bold;
    font-size: 14px;
}

/* Powerup Styles */
.powerup {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    bottom: 170px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
    animation: pulse 1s ease-in-out infinite;
}

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

.shield {
    background-color: #4169E1;
}

.shield::after {
    content: "S";
}

.multiplier {
    background-color: #9932CC;
}

.multiplier::after {
    content: "2x";
}

.speedboost {
    background-color: #32CD32;
}

.speedboost::after {
    content: "→";
}

/* UI Elements */
#score-container {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

#ui-container {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

.ui-element {
    display: flex;
    align-items: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

.ui-icon {
    width: 25px;
    height: 25px;
    margin-right: 10px;
    background-size: contain;
    background-repeat: no-repeat;
}

.carrot-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFA500' d='M12,2C7.03,2,3,6.03,3,11c0,4.97,4.03,9,9,9s9-4.03,9-9C21,6.03,16.97,2,12,2z'/%3E%3C/svg%3E");
}

.coin-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle fill='%23FFD700' cx='12' cy='12' r='10'/%3E%3C/svg%3E");
}

.shield-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%234169E1' d='M12,1L3,5v6c0,5.55,3.84,10.74,9,12c5.16-1.26,9-6.45,9-12V5L12,1z'/%3E%3C/svg%3E");
    opacity: 0.5;
}

#boost-meter {
    width: 120px;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    overflow: hidden;
    margin-left: 35px;
}

#boost-fill {
    width: 0%;
    height: 100%;
    background-color: #32CD32;
    transition: width 0.3s;
}

#multiplier {
    font-size: 16px;
    color: #9932CC;
    animation: multiPulse 1s ease-in-out infinite;
    display: none;
}

@keyframes multiPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Game Over and Controls */
#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
    display: none;
    z-index: 100;
}

#restart-button {
    position: absolute;
    top: 65%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 30px;
    font-size: 24px;
    font-weight: bold;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: none;
    z-index: 100;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#restart-button:hover {
    background-color: #45a049;
    transform: translate(-50%, -50%) scale(1.05);
}

#restart-button:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Effects and Visual Elements */
.cloud {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    filter: blur(2px);
}

.particle {
    position: absolute;
    width: 5px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    pointer-events: none;
}

.achievement {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(50, 50, 50, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    z-index: 100;
    opacity: 0;
    transition: transform 0.5s, opacity 0.5s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-align: center;
    display: flex;
    align-items: center;
}

.achievement.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.achievement-icon {
    width: 30px;
    height: 30px;
    background-color: #FFD700;
    border-radius: 50%;
    margin-right: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.near-miss {
    position: absolute;
    color: yellow;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 50;
}

#tutorial {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 200;
}

.tutorial-step {
    margin: 10px 0;
    font-size: 24px;
    text-align: center;
    max-width: 80%;
}

.key {
    display: inline-block;
    background-color: #333;
    border: 2px solid #555;
    border-radius: 5px;
    padding: 5px 10px;
    margin: 0 5px;
    box-shadow: 0 2px 0 #222;
}

#tutorial-continue {
    margin-top: 40px;
    padding: 10px 20px;
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

#countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: none;
}

#day-night-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 50, 0);
    pointer-events: none;
    z-index: 40;
    transition: background-color 5s;
}

.moon {
    position: absolute;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 240, 0.9);
    border-radius: 50%;
    top: 40px;
    right: 80px;
    box-shadow: 0 0 20px rgba(255, 255, 240, 0.8);
    display: none;
}

.star-bg {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 3s;
}

#special-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0) 0%, rgba(255, 215, 0, 0.2) 50%, rgba(255, 215, 0, 0) 100%);
    pointer-events: none;
    z-index: 5;
    display: none;
}

#special-zone-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: gold;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    animation: pulseText 1s ease-in-out infinite;
}

@keyframes pulseText {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Rabbit Colors and Trails */
.rabbit-color-1 { background-color: white; }
.rabbit-color-2 { background-color: #FFD700; }
.rabbit-color-3 { background-color: #ADD8E6; }
.rabbit-color-4 { background-color: #FFC0CB; }

.trail {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0.7;
    pointer-events: none;
}

.trail-normal { background-color: rgba(255, 255, 255, 0.7); }
.trail-gold { background-color: rgba(255, 215, 0, 0.7); }
.trail-blue { background-color: rgba(0, 191, 255, 0.7); }
.trail-rainbow {
    background: linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet);
    animation: rainbow 2s linear infinite;
}

@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Leaderboard and Challenges */
#leaderboard {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    padding: 20px;
    width: 300px;
    color: white;
    z-index: 120;
    display: none;
}

#leaderboard h2 {
    text-align: center;
    margin-top: 0;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #444;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

#leaderboard-close {
    display: block;
    margin: 20px auto 0;
    padding: 8px 15px;
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
}

#daily-challenge {
    position: absolute;
    bottom: 90px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    z-index: 100;
}

.challenge-progress {
    width: 100%;
    height: 10px;
    background-color: #444;
    border-radius: 5px;
    margin-top: 5px;
    overflow: hidden;
}

.challenge-fill {
    height: 100%;
    background-color: #4CAF50;
    width: 0%;
    transition: width 0.3s;
}

#toggle-audio {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 15px;
    font-size: 16px;
    cursor: pointer;
    z-index: 100;
}
