dialog:not([open]) {
    display: none;
}

:is(a, button, [role="button"]) {
    -webkit-tap-highlight-color: transparent;
}

:is(a, button, [role="button"]):focus:not(:focus-visible) {
    outline: none;
}

@media (pointer: coarse) {
    :is(a, button, [role="button"]):focus {
        outline: none !important;
    }

    body,
    .apk-contest-page code,
    .apk-game-sheet input[readonly] {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    :is(input, textarea):not([readonly]),
    [contenteditable]:not([contenteditable="false"]),
    .apk-contest-page .apk-manual-copy,
    .apk-game-sheet .apk-manual-copy[readonly] {
        -webkit-touch-callout: default;
        -webkit-user-select: text;
        user-select: text;
    }

    body > .apk-winter-effects {
        position: absolute;
        inset: 0 0 auto;
        height: min(38vh, 240px);
        contain: paint;
        --snow-fall: min(40vh, 252px);
        --fall: min(40vh, 252px);
    }

    .apk-winter-effects i { animation-name: apk-mobile-snow; }
    .apk-winter-effects.is-confetti i { animation-name: apk-mobile-confetti; }
    .apk-winter-garland { filter: none; }

    @keyframes apk-mobile-snow {
        from { transform: translate(0, 0); opacity: 0; }
        12%, 72% { opacity: .76; }
        to { transform: translate(var(--drift), var(--snow-fall)); opacity: 0; }
    }

    @keyframes apk-mobile-confetti {
        from { transform: translate(0, 0); opacity: 0; }
        8% { opacity: .92; }
        43%, to { transform: translate(var(--drift), var(--fall)) rotate(280deg); opacity: 0; }
    }
}

@media (display-mode: standalone) and (pointer: coarse) {
    html:has(meta[name="apple-mobile-web-app-status-bar-style"][content="black-translucent"]) body::before,
    html:has(meta[name="apple-mobile-web-app-status-bar-style"][content="black-translucent"]) body::after {
        content: "";
        position: fixed;
        z-index: 12001;
        pointer-events: none;
    }

    html:has(meta[name="apple-mobile-web-app-status-bar-style"][content="black-translucent"]) body::before {
        inset: 0 0 auto;
        height: env(safe-area-inset-top);
        background: #25415f;
    }

    html:has(meta[name="apple-mobile-web-app-status-bar-style"][content="black-translucent"]) body::after {
        inset: auto 0 0;
        height: env(safe-area-inset-bottom);
        background: var(--app-bottom-color, #f5f5f7);
    }

    .apk-winter-dialog {
        background: linear-gradient(#25415f env(safe-area-inset-top), #e9f5ed env(safe-area-inset-top), #f5f8f6 300px);
    }
}
