/* Mobile long presses keep scrolling/tapping without selecting page text. */
:root {
    --mobile-safe-top:env(safe-area-inset-top, 0px);
    --mobile-safe-right:env(safe-area-inset-right, 0px);
    --mobile-safe-bottom:env(safe-area-inset-bottom, 0px);
    --mobile-safe-left:env(safe-area-inset-left, 0px);
}
@media (max-width:767px), (max-width:1024px) and (max-height:500px) and (pointer:coarse) {
    html { scroll-padding-top:calc(12px + var(--mobile-safe-top)); scroll-padding-bottom:calc(100px + var(--mobile-safe-bottom)); }
    html body:not(.mp-pos) > .wrapper {
        padding-top:var(--mobile-safe-top);
        padding-left:var(--mobile-safe-left);
        padding-right:var(--mobile-safe-right);
        box-sizing:border-box;
    }
    html body :is(.pg, .sx, .pg-tools, .im-filters, .scan-field-group) { min-width:0; }
    html body :is(.pg-head h1, .sx-top h1, .sx-hub-h h1) { overflow-wrap:anywhere; }
    html body :is(input, textarea, select):not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]) {
        font-size:max(16px, 1em) !important;
    }
    html body :is(.modal, .mp-modal, .spd, .fs) {
        top:var(--mobile-visible-top, 0px);
        height:var(--mobile-visible-height, 100dvh);
        bottom:auto;
        box-sizing:border-box;
    }
    html body :is(.mp-dlg, .spd-box, .modal-dialog) {
        max-width:100%;
        max-height:calc(var(--mobile-visible-height, 100dvh) - 24px - var(--mobile-safe-top) - var(--mobile-safe-bottom)) !important;
    }
    html body :is(.spd-box, .modal-dialog) { overflow-y:auto; overscroll-behavior:contain; }
    html body .fs-panel { max-width:100%; max-height:calc(var(--mobile-visible-height, 100dvh) * .82); }
}
@media (max-width:767px) {
    html body:not(.mp-pos) .pg { padding-bottom:calc(100px + var(--mobile-safe-bottom)); }
    html body:not(.mp-pos) .content-wrapper { padding-bottom:calc(16px + var(--mobile-safe-bottom)); }
    html body .mb-nav {
        left:max(12px, var(--mobile-safe-left));
        right:max(12px, var(--mobile-safe-right));
    }
    html body .mp-fly { bottom:calc(90px + var(--mobile-safe-bottom)); }
    html body .im-filters > .scan-field-group { flex-basis:0; }
    html body.mobile-keyboard-open .mb-nav { display:none !important; }
}
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
    body, body * {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
    body input, body textarea, body select,
    body [contenteditable]:not([contenteditable="false"]),
    body [contenteditable]:not([contenteditable="false"]) * {
        -webkit-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
    }
}
