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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #46c1f5;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.app {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) 8px calc(10px + env(safe-area-inset-left, 0px));
    pointer-events: none;
}

.scores {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.score,
.best {
    font-family: "Consolas", "SF Mono", "Roboto Mono", monospace;
    font-weight: 700;
    letter-spacing: 1px;
    color: #16303f;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    font-size: clamp(14px, 4.2vw, 22px);
    line-height: 1.15;
}

.best {
    font-size: clamp(11px, 3.2vw, 16px);
    color: #27566e;
    opacity: 0.9;
}

.actions {
    display: flex;
    gap: 6px;
    pointer-events: auto;
    flex-shrink: 0;
}

.btn {
    width: clamp(34px, 9vw, 42px);
    height: clamp(34px, 9vw, 42px);
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 2px 6px rgba(16, 60, 86, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.08s ease, background 0.15s ease;
}

.btn:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.95);
}

.btn .ic {
    width: 58%;
    height: 58%;
    fill: #16303f;
}

.btn .ic-play,
.btn .ic-sound-on {
    display: none;
}

.btn.is-paused .ic-pause {
    display: none;
}

.btn.is-paused .ic-play {
    display: block;
}

.btn:not(.is-muted) .ic-sound-off {
    display: none;
}

.btn:not(.is-muted) .ic-sound-on {
    display: block;
}

.stage {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

#game {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    touch-action: none;
}

@media (orientation: landscape) {
    .hud {
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
    }
}
