/*
 * Mobile only. Desktop receives no kh-tlf-mobile class and no rule below applies.
 * Keep this layer outside tool internals: no forced scroll, no resize loop,
 * no fullscreen and no orientation lock.
 */
@media (pointer: coarse) and (max-width: 899px) {
    html.kh-tlf-mobile,
    body.kh-tlf-mobile {
        max-width: 100%;
        overflow-x: clip !important;
    }

    body.kh-tlf-mobile [data-kh-tlf-root="1"] {
        box-sizing: border-box !important;
        width: calc(100vw - 12px) !important;
        max-width: calc(100vw - 12px) !important;
        margin-left: calc(50% - 50vw + 6px) !important;
        margin-right: calc(50% - 50vw + 6px) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
    }

    body.kh-tlf-mobile [data-kh-tlf-root="1"] img,
    body.kh-tlf-mobile [data-kh-tlf-root="1"] video,
    body.kh-tlf-mobile [data-kh-tlf-root="1"] canvas,
    body.kh-tlf-mobile [data-kh-tlf-root="1"] svg {
        max-width: 100%;
    }

    body.kh-tlf-mobile [data-kh-tlf-frame="1"] {
        min-width: 0 !important;
        overflow: hidden !important;
    }

    body.kh-tlf-mobile [data-kh-tlf-frame="1"] > iframe,
    body.kh-tlf-mobile [data-kh-tlf-frame="1"] iframe {
        display: block !important;
        box-sizing: border-box !important;
        width: 100% !important;
        max-width: 100% !important;
        height: max(520px, calc(100svh - 12px)) !important;
        min-height: max(520px, calc(100svh - 12px)) !important;
        border: 0 !important;
    }
}

@media (pointer: coarse) and (max-width: 899px) and (orientation: landscape) {
    body.kh-tlf-mobile [data-kh-tlf-frame="1"] > iframe,
    body.kh-tlf-mobile [data-kh-tlf-frame="1"] iframe {
        height: calc(100svh - 8px) !important;
        min-height: calc(100svh - 8px) !important;
    }
}
