/* Safe-area iOS — PWA standalone + app Capacitor (WKWebView).
 * Colorie la zone encoche / barre de statut via --pwa-safe-area-bg (mis à jour par JS). */
@supports (padding-top: env(safe-area-inset-top)) {
    :root {
        --pwa-header-bg: #0f172a;
        --pwa-safe-area-bg: linear-gradient(
            to bottom right,
            var(--octopool-bg-from, #0f172a),
            var(--octopool-bg-via, #006373),
            var(--octopool-bg-to, #0f172a)
        );
    }

    html.ios-standalone,
    html.octopool-native-ios,
    html.octopool-native-capacitor {
        background: var(--pwa-safe-area-bg) !important;
        overscroll-behavior: none !important;
    }

    html.ios-standalone body,
    html.octopool-native-ios body,
    html.octopool-native-capacitor body {
        overscroll-behavior: none !important;
    }

    html.octopool-native-ios #app .sticky.top-0,
    html.octopool-native-ios #app .fixed.top-0,
    html.octopool-native-capacitor #app .sticky.top-0,
    html.octopool-native-capacitor #app .fixed.top-0 {
        padding-top: max(env(safe-area-inset-top), 20px);
    }

    html.ios-standalone #app .sticky.top-0,
    html.ios-standalone #app .fixed.top-0 {
        padding-top: max(env(safe-area-inset-top), 20px);
    }

    /* Login : pas de header sticky — pousser le contenu sous l'encoche */
    html.ios-standalone .login-page,
    html.octopool-native-ios .login-page,
    html.octopool-native-capacitor .login-page,
    html.octopool-ios-shell .login-page {
        padding-top: max(env(safe-area-inset-top), 12px);
        padding-bottom: max(env(safe-area-inset-bottom), 12px);
        box-sizing: border-box;
    }
}

/* Capacitor iOS : scroll root dans #app, anti-rebond WKWebView */
html.octopool-native-ios,
html.octopool-native-capacitor {
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

html.octopool-native-ios body,
html.octopool-native-capacitor body {
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

html.octopool-native-ios #app,
html.octopool-native-capacitor #app {
    height: 100dvh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: none !important;
    -webkit-overflow-scrolling: touch !important;
}
