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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    cursor: default;
}

/* Game container */
#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    background: url('background.png') center center / cover no-repeat;
    background-color: #87CEEB;
}

/* Background characters layer - sits behind game elements */
#background-characters {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.bg-character {
    position: absolute;
    bottom: 0;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Supa sitting - positioned on the left side (JS overrides for responsiveness) */
#bg-supa {
    left: 3%;
    height: 150px;
    bottom: 40px;
}

/* Person - positioned on the right side (JS overrides for responsiveness) */
#bg-person {
    right: 5%;
    height: 180px;
    bottom: 50px;
}

/* Dynamic grass canvas - rendered by JS for perfect alignment */
#grass-canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
}

/* Game area - full screen, floor from background image */
#game-area {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* Hit counter in top right */
#hit-counter {
    position: fixed;
    top: 20px;
    right: 30px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        3px 3px 0 #e91e63,
        0 0 20px rgba(233, 30, 99, 0.6);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#hit-counter .current {
    font-size: 2rem;
}

#hit-counter .current span {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ff6b9d 0%, #c44dff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.3));
}

#hit-counter .max-score {
    font-size: 1.2rem;
    opacity: 0.8;
}

#hit-counter .max-score span {
    font-size: 1.4rem;
    color: #ffd700;
    text-shadow: 2px 2px 0 #ff8c00;
}

/* Instructions overlay */
#instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    pointer-events: none;
    transition: opacity 1.5s ease-out;
}

#instructions.fade-out {
    opacity: 0;
}

#instructions h1 {
    font-size: 4rem;
    font-weight: 700;
    color: #fff;
    text-shadow:
        3px 3px 0 #e91e63,
        6px 6px 0 rgba(233, 30, 99, 0.5),
        0 0 30px rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

#instructions p {
    font-size: 1.5rem;
    font-weight: 400;
    color: #fff;
    text-shadow:
        2px 2px 0 #9c27b0,
        0 0 20px rgba(255, 255, 255, 0.6);
    animation: float 3s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Ezra head */
.head {
    position: absolute;
    width: 180px;
    height: 180px;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    z-index: 50;
}

.head img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    pointer-events: none;
    display: block;
}

.head.active:hover img {
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.5));
}

.head.fallen {
    cursor: default;
    pointer-events: none;
    z-index: 10;
}

.head.fallen img {
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.2));
}

/* Bounce animation when hit */
@keyframes bounce-hit {
    0% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }

    100% {
        filter: brightness(1);
    }
}

.head.hit img {
    animation: bounce-hit 0.15s ease-out;
}

/* Add head button */
#add-head-btn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    padding: 15px 25px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #e91e63 0%, #9c27b0 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow:
        0 4px 15px rgba(233, 30, 99, 0.4),
        0 0 30px rgba(156, 39, 176, 0.3);
    transition: all 0.3s ease;
    z-index: 200;
    opacity: 1;
    transform: translateY(0);
}

#add-head-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

#add-head-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 8px 25px rgba(233, 30, 99, 0.5),
        0 0 40px rgba(156, 39, 176, 0.4);
}

#add-head-btn span {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #instructions h1 {
        font-size: 2.5rem;
    }

    #instructions p {
        font-size: 1.1rem;
    }

    .head {
        width: 120px;
        height: 120px;
    }

    #add-head-btn {
        padding: 12px 20px;
        font-size: 0.95rem;
        right: 15px;
        bottom: 90px;
    }

    #hit-counter {
        font-size: 1.5rem;
        right: 15px;
    }

    #hit-counter span {
        font-size: 2rem;
    }

    /* Smaller background characters on mobile */
    #bg-supa {
        left: 2%;
        height: clamp(60px, 12vh, 100px);
        bottom: clamp(15px, 3vh, 40px);
    }

    #bg-person {
        right: 3%;
        height: clamp(70px, 15vh, 120px);
        bottom: clamp(20px, 4vh, 50px);
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    #instructions h1 {
        font-size: 2rem;
    }

    #instructions p {
        font-size: 0.95rem;
        padding: 0 20px;
    }

    .head {
        width: 100px;
        height: 100px;
    }

    #bg-supa {
        height: 60px;
        left: 2%;
        bottom: 10px;
    }

    #bg-person {
        height: 80px;
        right: 2%;
        bottom: 15px;
    }
}