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

html {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #87CEEB;
    touch-action: none;
    position: fixed;
}

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #87CEEB;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    display: block;
    z-index: 2;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    object-fit: cover;
}

/* Prevent scrolling on mobile */
@media (max-width: 768px) {
    body {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
}

/* Game UI Layer */
#hud {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Ensure canvas is properly sized on mobile */
@media (max-width: 768px) {
    #game-container {
        width: 100%;
        height: 100%;
    }
    
    #gameCanvas {
        width: 100%;
        height: 100%;
    }
}

#hud {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#health {
    display: flex;
    gap: 5px;
}

.heart {
    width: 25px;
    height: 25px;
    background: red;
    clip-path: path('M12.5 21.25L10.75 19.625C4.25 13.625 0 9.75 0 5.75C0 2.5 2.5 0 5.75 0C7.5 0 9.25 0.875 10.5 2.25C11.75 0.875 13.5 0 15.25 0C18.5 0 21 2.5 21 5.75C21 9.75 16.75 13.625 10.25 19.625L12.5 21.25Z');
}

#score {
    font-family: Arial, sans-serif;
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
}

/* Title Screen */
#title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.title-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    margin: 20px;
}

#title-screen h1 {
    font-size: 32px;
    color: #333;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#title-screen p {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.4;
}

#title-screen.hidden {
    display: none;
}

/* Game Over Screen */
#game-over {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.game-over-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    margin: 20px;
}

#game-over h2 {
    margin-bottom: 15px;
    font-size: 28px;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#game-over p {
    margin-bottom: 20px;
    font-size: 20px;
    color: #666;
}

#game-over.visible {
    display: flex;
}

/* Buttons */
#restart-button,
#start-button {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#restart-button:hover,
#start-button:hover {
    background: #45a049;
}

.bee {
    position: absolute;
    width: 30px;
    height: 20px;
    background: linear-gradient(
        45deg,
        #FFD700 25%,
        #000000 25%,
        #000000 50%,
        #FFD700 50%,
        #FFD700 75%,
        #000000 75%
    );
    background-size: 10px 10px;
    border-radius: 30px;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Bee body */
.bee::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: black;
    border-radius: 50%;
}

/* Bee wings */
.bee::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px 10px 0 0;
    animation: wingFlap 0.2s linear infinite;
}

@keyframes wingFlap {
    0%, 100% { transform: translateX(-50%) scaleX(1); }
    50% { transform: translateX(-50%) scaleX(0.8); }
}

@keyframes beeSwarm {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(20px, -20px) rotate(90deg);
    }
    50% {
        transform: translate(0, -30px) rotate(180deg);
    }
    75% {
        transform: translate(-20px, -20px) rotate(270deg);
    }
}

@keyframes beeAttack {
    0% {
        transform: scale(1) translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) translate(50vw, -25vh) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(2) translate(100vw, -50vh) rotate(360deg);
        opacity: 0;
    }
}

.bee.swarming {
    animation: beeSwarm 1s linear infinite;
}

.bee.attacking {
    animation: beeAttack 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
