/* ======================================================================
   OSANIME Auth Mobile Scroll Fix — v271
   Purpose: one root scrolling contract for every user-facing auth screen.
   Fixes portrait-mobile scroll lock caused by html/body both acting as
   independent vertical scroll containers after the v254 accessibility layer.
   No authentication/backend behavior is changed.
   ====================================================================== */

/* The document element is the only vertical page scroller. */
html {
  min-height: 100%;
  height: auto !important;
  overflow-y: auto !important;
  overscroll-behavior-y: auto;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Auth body must contribute its full content height to the root document.
   Using overflow-y:auto here can create a second root-like scroller on
   portrait mobile browsers and leave window.scrollY permanently at 0. */
body.auth-screen-page {
  height: auto !important;
  min-height: 100vh !important;
  min-height: 100svh !important;
  min-height: 100dvh !important;
  overflow: visible !important;
  overscroll-behavior-y: auto !important;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
}

/* Keep horizontal overflow isolated without turning body into a vertical
   scrolling box. */
@supports (overflow: clip) {
  html {
    overflow-x: clip !important;
  }
  body.auth-screen-page {
    overflow-x: visible !important;
  }
}
@supports not (overflow: clip) {
  html {
    overflow-x: hidden !important;
  }
  body.auth-screen-page {
    overflow-x: visible !important;
  }
}

/* Every stacked auth flow must grow with its content. This covers login,
   register, forgot/reset, OAuth completion/status, 2FA, recovery code and
   step-up verification. Cards may still clip decorative pseudo-elements. */
@media (max-width: 1050px) {
  body.auth-screen-page :where(
    .auth-screen.auth-ui-shell-v250,
    .auth-security-shell-v258,
    .auth-stepup-shell-v259,
    .auth-oauth-flow-shell-v261
  ) {
    height: auto !important;
    max-height: none !important;
    min-height: 100vh !important;
    min-height: 100svh !important;
    min-height: 100dvh !important;
    overflow: visible !important;
  }

  body.auth-screen-page .auth-left,
  body.auth-screen-page .auth-right {
    height: auto !important;
    max-height: none !important;
  }
}

/* Mobile virtual keyboards reduce the visual viewport dynamically. Keep
   focused fields away from the keyboard and preserve bottom safe area. */
@media (max-width: 760px) {
  body.auth-screen-page {
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
  }

  body.auth-screen-page :where(input, select, textarea, button, a):focus-visible {
    scroll-margin-top: max(18px, env(safe-area-inset-top, 0px));
    scroll-margin-bottom: max(120px, calc(env(safe-area-inset-bottom, 0px) + 96px));
  }
}

/* Short landscape windows are still scrollable even when their CSS pixel
   width crosses the tablet breakpoint. */
@media (max-height: 620px) {
  body.auth-screen-page :where(
    .auth-screen.auth-ui-shell-v250,
    .auth-security-shell-v258,
    .auth-stepup-shell-v259,
    .auth-oauth-flow-shell-v261
  ) {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* v254 declared overflow-y:auto with a higher-specificity selector. Override it
   explicitly so mobile browsers do not create a second vertical scroll box. */
body.auth-screen-page.auth-all-pages-final-v262.auth-ui-v254 {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
}
