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

.body {
    width: auto;
    height: 100vh;
    overflow: hidden;
    background: #050816;
    font-family: Arial, sans-serif;
    touch-action: none;
}

#game {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 20%,
            #172554 0%,
            #0f172a 40%,
            #020617 100%);
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* ---------------------------
   BACKGROUND GRID
---------------------------- */

.grid {
    position: absolute;
    inset: 0;

    background-image:
        linear-gradient(
            rgba(59,130,246,.08) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(59,130,246,.08) 1px,
            transparent 1px
        );

    background-size: 45px 45px;

    transform: perspective(400px)
               rotateX(45deg)
               scale(1.5);

    transform-origin: center bottom;

    animation: gridMove 2s linear infinite;
}

@keyframes gridMove {

    from {
        background-position: 0 0;
    }

    to {
        background-position: 0 45px;
    }

}

/* ---------------------------
   HUD
---------------------------- */

#hud {
    position: absolute;
    top: env(safe-area-inset-top, 10px);
    left: 0;
    width: 100%;

    display: flex;
    justify-content: space-around;

    padding: 14px 10px;

    color: white;
    z-index: 50;

    pointer-events: none;
}

.stat {
    min-width: 80px;
    padding: 7px 12px;

    text-align: center;

    background: rgba(0,0,0,.35);

    border: 1px solid rgba(255,255,255,.12);

    border-radius: 12px;

    backdrop-filter: blur(5px);
}

.stat small {
    display: block;
    font-size: 10px;
    color: #94a3b8;
}

.stat strong {
    font-size: 18px;
}

/* ---------------------------
   PLAYER
---------------------------- */

#player {
    position: absolute;

    width: 40px;
    height: 40px;

    left: 50%;
    top: 70%;

    transform: translate(-50%, -50%);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 30px;

    z-index: 20;

    filter:
        drop-shadow(0 0 8px #38bdf8)
        drop-shadow(0 0 20px #38bdf8);

    user-select: none;
}

/* ---------------------------
   OBSTACLES
---------------------------- */

.obstacle {
    position: absolute;

    border-radius: 9px;

    background:
        linear-gradient(
            135deg,
            #fb7185,
            #e11d48
        );

    box-shadow:
        0 0 8px #fb7185,
        0 0 20px rgba(244,63,94,.5);

    z-index: 10;
}

.obstacle::after {
    content: "";

    position: absolute;

    inset: 5px;

    border: 1px solid
            rgba(255,255,255,.35);

    border-radius: 5px;
}

/* ---------------------------
   COIN
---------------------------- */

.coin {
    position: absolute;

    width: 28px;
    height: 28px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            #fff7ae 0%,
            #facc15 40%,
            #eab308 100%
        );

    box-shadow:
        0 0 8px #fde047,
        0 0 20px #facc15;

    z-index: 8;

    animation: coinSpin .7s linear infinite;
}

@keyframes coinSpin {

    0% {
        transform: scaleX(1);
    }

    50% {
        transform: scaleX(.25);
    }

    100% {
        transform: scaleX(1);
    }

}

/* ---------------------------
   PARTICLE
---------------------------- */

.particle {
    position: absolute;

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #38bdf8;

    pointer-events: none;

    z-index: 30;
}

/* ---------------------------
   START / GAME OVER
---------------------------- */

.screen {
    position: absolute;

    inset: 0;

    z-index: 100;

    display: flex;

    flex-direction: column;

    justify-content: center;
    align-items: center;

    text-align: center;

    padding: 30px;

    color: white;

    background:
        rgba(2,6,23,.88);

    backdrop-filter: blur(7px);
}

.screen h1 {
    font-size: 42px;

    margin-bottom: 12px;

    text-shadow:
        0 0 10px #38bdf8,
        0 0 30px #38bdf8;
}

.screen p {
    color: #cbd5e1;

    line-height: 1.6;

    max-width: 320px;
}

.button {
    margin-top: 25px;

    padding: 15px 42px;

    border: 0;

    border-radius: 14px;

    font-size: 18px;
    font-weight: bold;

    color: white;

    background:
        linear-gradient(
            135deg,
            #0284c7,
            #2563eb
        );

    box-shadow:
        0 5px 20px
        rgba(37,99,235,.4);

    cursor: pointer;
}

.button:active {
    transform: scale(.95);
}

/* ---------------------------
   SWIPE HINT
---------------------------- */

#hint {
    position: absolute;

    bottom: 25px;

    left: 50%;

    transform: translateX(-50%);

    color: #64748b;

    font-size: 13px;

    z-index: 40;

    pointer-events: none;
}

#gameOver {
    display: none;
}

#newRecord {
    display: none;

    margin-top: 8px;

    color: #facc15;

    font-weight: bold;
}

/* Desktop */

@media (min-width: 700px) {

    #game {
        max-width: 500px;
        margin: auto;

        box-shadow:
            0 0 60px
            rgba(0,0,0,.7);
    }

}