/* Mobile / touch only — do not set height:100% on desktop (kills mouse wheel on window) */
@media (max-width: 768px), (pointer: coarse) {
html,
body {
    position: relative !important;
    overflow: visible !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: none !important;
    overscroll-behavior-x: none !important;
    pointer-events: auto !important;
    height: auto !important;
    min-height: 100dvh !important;
    touch-action: pan-y manipulation !important;
    -webkit-overflow-scrolling: touch !important;
}

#root,
.app-container,
main,
#crmApp,
#mainApp,
#nbAppBody,
#mainApp .nb-app-body,
#mainApp .main-body-container,
#nbAppMain,
.main-content,
.nb-app-main {
    position: relative !important;
    display: block !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain !important;
    height: auto !important;
    min-width: 0 !important;
    pointer-events: auto !important;
    z-index: 1;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
}
}

/* Trainer wrapper: simple native scroll container */
.trainer-page-container {
    min-height: 100dvh !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: visible !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Hidden overlays should never eat taps/clicks */
.modal-overlay[style*="display: none"],
#globalLoader[style*="display:none"],
#globalLoader[style*="display: none"],
#nanbanPagePreloader[style*="pointer-events: none"] {
    pointer-events: none !important;
}

/* NUCLEAR: beat nanban-pro-shell viewport trap on phones */
@media (max-width: 768px), (pointer: coarse) {
    html.nanban-authed,
    html.nanban-pro-app.nanban-authed,
    body.nanban-pro-app.nanban-authed,
    html.nanban-authed body.nanban-pro-app,
    body.nanban-pro-app {
        overflow: visible !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        min-height: 100dvh !important;
        max-height: none !important;
        touch-action: pan-y !important;
        -webkit-overflow-scrolling: touch !important;
    }

    html.nanban-authed body.nanban-pro-app #mainApp,
    html.nanban-authed body.nanban-pro-app #mainApp.nanban-glass-app,
    html.nanban-authed body.nanban-pro-app #mainApp.nanban-glass-app.is-active,
    body.nanban-pro-app #mainApp,
    body.nanban-pro-app #mainApp.nanban-glass-app.is-active {
        overflow: visible !important;
        height: auto !important;
        min-height: 100dvh !important;
        max-height: none !important;
        touch-action: pan-y !important;
    }

    html.nanban-authed body.nanban-pro-app #mainApp #nbAppBody,
    body.nanban-pro-app #mainApp #nbAppBody,
    body.nanban-pro-app #mainApp .nb-app-body {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        touch-action: pan-y !important;
    }

    html.nanban-authed body.nanban-pro-app #mainApp #nbAppMain,
    html.nanban-authed body.nanban-pro-app #mainApp .nb-app-main.main-content,
    body.nanban-pro-app #mainApp #nbAppMain,
    body.nanban-pro-app #mainApp .nb-app-main {
        display: block !important;
        height: auto !important;
        min-height: calc(100dvh - 60px) !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
        pointer-events: auto !important;
    }

    body.nanban-pro-app.nb-mobile-nav-open,
    body.nanban-pro-app.nb-mobile-nav-open #mainApp #nbAppMain {
        overflow-y: auto !important;
        touch-action: pan-y !important;
    }
}
