@font-face {
    font-family: "Milky Coffee";
    src: url("https://static.igem.wiki/teams/5938/fonts/milkycoffee-gx1yr-2.ttf");
}

:root {
    --bg: #0b1220;
    --panel: #1e90ff;
    --panel-2: #0e1728;
    --accent: #66e3ff;
    --accent-2: #19d3ae;
    --text: #e6f0ff;
    --danger: #ff5d5d;
    --good: #76ff9b;
}

.app {
    max-width: 500px;
    margin: 0 auto;
}

.playfield {
    position: relative;
    margin-top: 16px;
    cursor: none;
    background: url("https://static.igem.wiki/teams/5938/home/whack/playground.webp") no-repeat center center;
    background-size: cover;
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid #1d2a46;
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(3, 10, 30, .35), inset 0 0 0 1px rgba(255, 255, 255, .03)
}

.hud {
    font-family: "Milky Coffee", "Comic Sans MS", sans-serif;
    font-size: 80px;
}

.hud .small {
    font-size: 50px;
    opacity: .75;
}

#scoreboard {
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: white;
}

.grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cell {
    position: absolute;
    background: transparent;
    border: none;
    box-shadow: none;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    user-select: none;
    /* prevent text/image selection */
    -webkit-user-drag: none;
    /* prevent dragging in Safari/Chrome */
    outline: none;
    /* remove focus outline */
    cursor: none;
}

.cell:focus {
    outline: none;
}

.cell img {
    pointer-events: none;
    /* prevent dragging the mosquito image */
    user-select: none;
    -webkit-user-drag: none;
}

.hole {
    position: absolute;
    inset: auto 10% 8% 10%;
    height: 16%;
    border-radius: 50%;
    filter: blur(4px);
    background: radial-gradient(closest-side, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0) 70%)
}

.mosquito {
    position: absolute;
    inset: auto;
    left: 50%;
    bottom: 14%;
    transform: translate(-50%, 40%) scale(.95);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s, transform .12s
}

.cell.up .mosquito {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
    pointer-events: auto
}

/* Hit burst */
.burst {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--good), transparent 60%);
    opacity: 0;
    pointer-events: none
}

.cell.hit .burst {
    animation: pop .28s ease-out
}

@keyframes pop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(.2)
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(3)
    }
}

.bat {
    position: fixed;
    left: 0;
    top: 0;
    width: 70px;
    height: auto;
    z-index: 999;
    pointer-events: none;
    transform-origin: 70% 20%;
    transform: translate(-1000px, -1000px) rotate(-12deg);
    display: none;
}

.bat.swing {
    animation: slap .18s ease-out
}

@keyframes swing {
    0% {
        transform: translate(var(--bx, 0), var(--by, 0)) rotate(12deg)
    }

    50% {
        transform: translate(calc(var(--bx, 0) + 8px), calc(var(--by, 0) + 8px)) rotate(8deg)
    }

    100% {
        transform: translate(var(--bx, 0), var(--by, 0)) rotate(12deg)
    }
}

.bat.slap {
    animation: slap .2s cubic-bezier(.4, 0, .7, 1.6);
}

@keyframes slap {
    0% {
        transform: translate(var(--bx, 0), var(--by, 0)) rotate(-12deg) scale(1);
    }

    40% {
        transform: translate(var(--bx, 0), var(--by, 0)) rotate(20deg) scale(1.05);
    }

    /* fast forward swing */
    70% {
        transform: translate(var(--bx, 0), var(--by, 0)) rotate(10deg) scale(0.98);
    }

    /* slight recoil */
    100% {
        transform: translate(var(--bx, 0), var(--by, 0)) rotate(-12deg) scale(1);
    }

    /* back to rest */
}

@media (max-width: 700px) {
    .bat {
        width: 88px
    }
}