* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #b0e0f0;
    color: #fffffe;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    touch-action: none;
    overscroll-behavior: none;
}

button {
    color: inherit;
    font: inherit;
}

.game-shell {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: #b0e0f0;
}

#game {
    display: block;
    width: 100vw;
    height: 100dvh;
    touch-action: none;
}

.hud {
    position: fixed;
    z-index: 3;
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: max(8px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    padding: 4px 6px 4px 10px;
    border: 2px solid #fffffe;
    border-bottom-color: #043b7a;
    border-radius: 12px;
    background: #0853aa;
    pointer-events: none;
    text-shadow: 2px 2px 0 #042b5d;
}

.hud strong {
    flex: 0 0 auto;
    font-size: clamp(13px, 3vw, 18px);
    letter-spacing: .03em;
    white-space: nowrap;
}

.hud span {
    font-size: clamp(11px, 2.6vw, 14px);
    opacity: 1;
    white-space: nowrap;
}

.hud__stats {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

#restart,
.message button {
    border: 3px solid rgba(255, 247, 207, .9);
    border-radius: 999px;
    background: linear-gradient(#f34b39, #b81220);
    box-shadow: 0 5px 0 #5a1017, 0 9px 0 rgba(255, 240, 96, .22), 0 12px 18px rgba(0, 0, 0, .35);
    cursor: pointer;
}

#restart {
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1.1;
    pointer-events: auto;
}

.message {
    position: fixed;
    z-index: 5;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 14px;
    padding: 24px;
    text-align: center;
    background: rgba(4, 16, 28, .72);
    backdrop-filter: blur(4px);
}

.message[hidden] {
    display: none;
}

.message h1 {
    margin: 0;
    color: #fff05f;
    font-size: clamp(52px, 16vw, 118px);
    line-height: .85;
    text-transform: uppercase;
    text-shadow: 0 5px 0 #b81220, 0 9px 0 #5a1017, 0 14px 25px rgba(0, 0, 0, .55);
}

.message p {
    max-width: 520px;
    margin: 0 auto;
    font-size: clamp(16px, 4vw, 22px);
    line-height: 1.45;
}

.message button {
    justify-self: center;
    padding: 13px 24px;
    font-weight: 800;
    text-transform: uppercase;
}

.touch-controls {
    position: fixed;
    z-index: 4;
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    display: flex;
    align-items: end;
    justify-content: space-between;
    pointer-events: none;
}

.touch-button {
    width: clamp(62px, 18vw, 92px);
    height: clamp(62px, 18vw, 92px);
    border: 3px solid rgba(255, 247, 207, .75);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .36), rgba(120, 201, 67, .42) 35%, rgba(13, 91, 45, .65));
    box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .24), 0 8px 0 rgba(11, 70, 35, .7), 0 12px 18px rgba(0, 0, 0, .35);
    font-size: clamp(28px, 8vw, 44px);
    font-weight: 900;
    line-height: 1;
    pointer-events: auto;
    user-select: none;
}

.touch-button:active,
.touch-button.is-down {
    transform: translateY(4px) scale(.98);
    background-color: rgba(255, 238, 117, .28);
}

.touch-button--left {
    margin-right: 8px;
}

.touch-button--right {
    margin-right: auto;
}

.touch-button--jump {
    background: radial-gradient(circle at 35% 28%, rgba(255, 247, 207, .58), rgba(243, 75, 57, .88) 45%, rgba(128, 15, 23, .95));
}

@media (min-width: 900px) {
    .touch-controls {
        opacity: .78;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .hud {
        min-height: 30px;
        padding-top: 3px;
        padding-bottom: 3px;
    }

    .touch-button {
        width: clamp(56px, 13vh, 76px);
        height: clamp(56px, 13vh, 76px);
    }
}
