/**
 * Auth compositor diagnostic variants plus the Android emergency fallback.
 * The diagnostic switch remains off by default; Android fallback is automatic.
 * Does not change field layout, sheet width, or auth logic. Android uses a
 * normal document-flow page so this fallback does not depend on auth IME
 * positioning.
 */

/* Emergency Android-only compositor fallback. The runtime attribute is set
 * only for a native Capacitor Android client; web and iOS keep the existing
 * auth presentation unchanged. */
html[data-grounded-native-platform='android'] .grounded-auth-sheet[hidden] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-sheet:not([hidden]),
html[data-grounded-native-platform='android'] .grounded-auth-sheet:not([hidden]).grounded-auth-sheet--open,
html[data-grounded-native-platform='android'] .grounded-auth-sheet__panel,
html[data-grounded-native-platform='android'] .grounded-auth-sheet__backdrop,
html[data-grounded-native-platform='android'] .grounded-auth-sheet__panel *,
html[data-grounded-native-platform='android'] .grounded-auth-sheet__backdrop * {
  animation: none !important;
  transition: none !important;
  filter: none !important;
  will-change: auto !important;
  isolation: auto !important;
  contain: none !important;
  box-shadow: none !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-sheet:not([hidden]),
html[data-grounded-native-platform='android'] .grounded-auth-sheet:not([hidden]).grounded-auth-sheet--open {
  opacity: 1 !important;
  transition: none !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-sheet__backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-sheet__panel,
html[data-grounded-native-platform='android'] .grounded-auth-sheet.grounded-auth-sheet--open .grounded-auth-sheet__panel {
  transform: none !important;
  transition: none !important;
  box-shadow: none !important;
}

/* Emergency Android document-flow model: auth is a normal page view. The
 * document/body owns scrolling; the auth panel is not a scroll container. */
html[data-grounded-native-platform='android'] .grounded-auth-sheet:not([hidden]),
html[data-grounded-native-platform='android'] .grounded-auth-sheet:not([hidden]).grounded-auth-sheet--open {
  position: relative !important;
  inset: auto !important;
  display: block !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  align-items: initial !important;
  justify-content: initial !important;
  background: #faf7f4 !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  padding: max(16px, env(safe-area-inset-top, 0px)) 0 env(safe-area-inset-bottom, 0px) !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  transition: none !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-sheet__panel,
html[data-grounded-native-platform='android'] .grounded-auth-sheet.grounded-auth-sheet--open .grounded-auth-sheet__panel {
  position: relative !important;
  inset: auto !important;
  margin: 0 auto !important;
  max-height: none !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  transform: none !important;
  transition: none !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-sheet__backdrop {
  display: none !important;
  position: static !important;
  pointer-events: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-grounded-native-platform='android'] body.grounded-auth-sheet-open {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  background-attachment: scroll !important;
}

html[data-grounded-native-platform='android'] .grounded-auth-primary-btn,
html[data-grounded-native-platform='android'] .grounded-auth-secondary-btn,
html[data-grounded-native-platform='android'] .grounded-auth-oauth-btn {
  transform: none !important;
  transition: none !important;
  box-shadow: none !important;
}

/* Targeted Android WebView rendering-safe mode for shared app chrome and
 * onboarding. Keep dimensions and navigation intact; remove only effects
 * that can invalidate large fixed/composited surfaces while typing. */
html[data-grounded-native-platform='android'],
html[data-grounded-native-platform='android'] body {
  background-attachment: scroll !important;
  scroll-behavior: auto !important;
}

html[data-grounded-native-platform='android'] .header.app-header,
html[data-grounded-native-platform='android'] .bottom-nav,
html[data-grounded-native-platform='android'] .home-core-readiness-layer,
html[data-grounded-native-platform='android'] .screen-decor,
html[data-grounded-native-platform='android'] .screen-decor * {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  will-change: auto !important;
  isolation: auto !important;
  box-shadow: none !important;
}

/* Full-screen modal / sheet / backdrop layers: drop GPU blur only.
 * Do not change pointer-events, visibility, or layout. Existing rgba /
 * gradient backgrounds keep visual separation without backdrop-filter. */
html[data-grounded-native-platform='android'] .verse-fs-overlay,
html[data-grounded-native-platform='android'] .guided-moment-screen .gm-modal-backdrop,
html[data-grounded-native-platform='android'] #momentOverlay .gm-modal-backdrop,
html[data-grounded-native-platform='android'] .prayer-overlay,
html[data-grounded-native-platform='android'] .qr-modal-overlay,
html[data-grounded-native-platform='android'] .dr-modal-overlay,
html[data-grounded-native-platform='android'] .bs-modal-overlay,
html[data-grounded-native-platform='android'] .prompt-modal-overlay,
html[data-grounded-native-platform='android'] .flow-modal-overlay,
html[data-grounded-native-platform='android'] .moment-flow,
html[data-grounded-native-platform='android'] .grounded-notif-prompt,
html[data-grounded-native-platform='android'] .grounded-review-prompt,
html[data-grounded-native-platform='android'] .grounded-premium-trial-nudge,
html[data-grounded-native-platform='android'] .theme-education-sheet__backdrop,
html[data-grounded-native-platform='android'] .weekly-journey-sheet__backdrop,
html[data-grounded-native-platform='android'] .theme-week-complete-overlay,
html[data-grounded-native-platform='android'] .gg-saved-modal__backdrop,
html[data-grounded-native-platform='android'] .gg-announcement__backdrop,
html[data-grounded-native-platform='android'] .grounded-guidance-flow__response-loading,
html[data-grounded-native-platform='android'] .sc-backdrop,
html[data-grounded-native-platform='android'] .vm-practice-overlay,
html[data-grounded-native-platform='android'] .vb-backdrop,
html[data-grounded-native-platform='android'] .ctm-modal-overlay,
html[data-grounded-native-platform='android'] .bp-modal-overlay,
html[data-grounded-native-platform='android'] .scripture-modal-overlay,
html[data-grounded-native-platform='android'] .progress-popup,
html[data-grounded-native-platform='android'] .grounded-premium-sheet__backdrop,
html[data-grounded-native-platform='android'] .grounded-save-account-prompt__backdrop,
html[data-grounded-native-platform='android'] .daily-arrival-popover {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Weak translucent scrims that relied on blur for coverage. */
html[data-grounded-native-platform='android'] .gg-saved-modal__backdrop {
  background: rgba(48, 36, 32, 0.38) !important;
}
html[data-grounded-native-platform='android'] .progress-popup {
  background: rgba(48, 36, 32, 0.42) !important;
}
html[data-grounded-native-platform='android'] .moment-flow {
  background: rgba(48, 36, 32, 0.42) !important;
}

html[data-grounded-native-platform='android'] .home-response {
  will-change: auto !important;
}

html[data-grounded-native-platform='android'] .onboarding-root,
html[data-grounded-native-platform='android'] .onboarding-root * {
  animation: none !important;
  transition: none !important;
}

html[data-grounded-native-platform='android'] .onboarding-root,
html[data-grounded-native-platform='android'] .onboarding-step,
html[data-grounded-native-platform='android'] .onboarding-step--active,
html[data-grounded-native-platform='android'] .onboarding-root button,
html[data-grounded-native-platform='android'] .onboarding-root input {
  transform: none !important;
}

html[data-grounded-native-platform='android'] .onboarding-root .onboarding-name-input,
html[data-grounded-native-platform='android'] .onboarding-root .onboarding-name-input:focus,
html[data-grounded-native-platform='android'] .onboarding-root button,
html[data-grounded-native-platform='android'] .onboarding-root [class*='glow'],
html[data-grounded-native-platform='android'] .onboarding-root [class*='decor'] {
  box-shadow: none !important;
  filter: none !important;
  will-change: auto !important;
  isolation: auto !important;
}

/* Keep one onboarding scroll surface on Android: the fixed root. The body
 * stays locked so keyboard resize cannot switch scroll ownership. */
html[data-grounded-native-platform='android'] body.onboarding-active {
  overflow: hidden !important;
}

html[data-grounded-native-platform='android'] .onboarding-root {
  height: 100dvh !important;
  max-height: 100dvh !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain !important;
}

html[data-grounded-native-platform='android'] .onboarding-step--final,
html[data-grounded-native-platform='android'] .onboarding-step--account,
html[data-grounded-native-platform='android'] .onboarding-step--welcome,
html[data-grounded-native-platform='android'] .onboarding-step--personalize,
html[data-grounded-native-platform='android'] .on-choice-list--goals {
  max-height: none !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto !important;
}

/* Final recap relies on onboardingRecapLineIn; global animation:none above leaves
 * the stack and personalized lines at opacity:0. Show visible recap without
 * re-enabling compositor animations. */
html[data-grounded-native-platform='android'] .onboarding-final-stack--visible {
  opacity: 1 !important;
  transform: none !important;
}

html[data-grounded-native-platform='android'] .onboarding-final-recap-host--visible .onboarding-final-recap-personalized-line {
  opacity: 1 !important;
  transform: none !important;
}

/* Hope + Rhythm: flex:1/min-height:0 on inner + viewport caps root scrollHeight
 * to one screen, so Continue (in the footer) stays below the scroll range. */
html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--personalize.onboarding-step--active) {
  justify-content: flex-start !important;
}

html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--personalize.onboarding-step--active) .onboarding-inner,
html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--personalize.onboarding-step--active) .onboarding-step-viewport,
html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--personalize.onboarding-step--active) .onboarding-step--personalize,
html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--personalize.onboarding-step--active) .onboarding-personalize-panel {
  flex: 0 0 auto !important;
  min-height: auto !important;
  max-height: none !important;
}

/* Android onboarding: keep the active step in normal flow so the root is the
 * only scroll surface. The desktop/iOS absolute-step presentation remains. */
html[data-grounded-native-platform='android'] .onboarding-step-viewport {
  min-height: 0 !important;
  overflow: visible !important;
}

html[data-grounded-native-platform='android'] .onboarding-step {
  position: relative !important;
  inset: auto !important;
  display: none !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  opacity: 1 !important;
  pointer-events: none !important;
  transform: none !important;
}

html[data-grounded-native-platform='android'] .onboarding-step.onboarding-step--active {
  display: flex !important;
  pointer-events: auto !important;
}

/* Walk-active must beat the active-step pointer-events:auto above, or a stale
   onboarding welcome step remains the hit-test target under Today's Walk. */
html[data-grounded-native-platform='android'] body.todays-walk-active .onboarding-root,
html[data-grounded-native-platform='android'] body.todays-walk-active .onboarding-root * {
  pointer-events: none !important;
}

/* The :has() rules adjust the viewport for the animated presentation. They
 * must not change Android flow height between steps. */
html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--final.onboarding-step--active) .onboarding-step-viewport,
html[data-grounded-native-platform='android'] .onboarding-root:has(.onboarding-step--account.onboarding-step--active) .onboarding-step-viewport {
  min-height: 0 !important;
}

/* Today’s Walk: Android compositor-safe styles apply ONLY while Walk is
 * logically open. Closed Walk ([hidden], aria-hidden, or not --visible)
 * must not paint: author `display:flex` on .todays-walk-root otherwise
 * defeats UA [hidden] and the old opacity:1/z-index:10080 rules drew a
 * full-screen ghost over onboarding. */
html[data-grounded-native-platform='android'] .todays-walk-root,
html[data-grounded-native-platform='android'] .todays-walk-root * {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

html[data-grounded-native-platform='android'] .todays-walk-root[hidden],
html[data-grounded-native-platform='android'] .todays-walk-root[aria-hidden='true'],
html[data-grounded-native-platform='android'] .todays-walk-root:not(.todays-walk-root--visible) {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: auto !important;
}

html[data-grounded-native-platform='android'] .todays-walk-root[hidden] *,
html[data-grounded-native-platform='android'] .todays-walk-root[aria-hidden='true'] *,
html[data-grounded-native-platform='android'] .todays-walk-root:not(.todays-walk-root--visible) * {
  pointer-events: none !important;
}

html[data-grounded-native-platform='android'] .todays-walk-root.todays-walk-root--visible:not([hidden]):not([aria-hidden='true']) {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  /* Keep the open Walk above the one-time announcement backdrop. */
  z-index: 10080 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

html[data-grounded-native-platform='android'] .todays-walk-root.todays-walk-root--visible:not([hidden]):not([aria-hidden='true']) .todays-walk-chrome,
html[data-grounded-native-platform='android'] .todays-walk-root.todays-walk-root--visible:not([hidden]):not([aria-hidden='true']) .todays-walk-viewport {
  position: relative !important;
  z-index: 2 !important;
  pointer-events: auto !important;
}

html[data-grounded-native-platform='android'] .todays-walk-viewport {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}

html[data-grounded-native-platform='android'] .todays-walk-step {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  overflow: visible !important;
  -webkit-overflow-scrolling: auto !important;
  overscroll-behavior: auto !important;
}

html[data-grounded-native-platform='android'] .todays-walk-step[hidden],
html[data-grounded-native-platform='android'] .todays-walk-step[aria-hidden='true'] {
  pointer-events: none !important;
}

html[data-grounded-native-platform='android'] .todays-walk-step--active {
  position: relative !important;
  z-index: 3 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* 1. Backdrop blur/filter off — first Motorola probe */
html[data-auth-comp='noblur'] .grounded-auth-sheet__backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

/* 2. Entrance transform off (panel stays at rest transform) */
html[data-auth-comp='notransform'] .grounded-auth-sheet__panel,
html[data-auth-comp='notransform'] .grounded-auth-sheet.grounded-auth-sheet--open .grounded-auth-sheet__panel {
  transform: none !important;
  transition: none !important;
}

/* 3. Overlay opacity transition off */
html[data-auth-comp='noopacity'] .grounded-auth-sheet,
html[data-auth-comp='noopacity'] .grounded-auth-sheet.grounded-auth-sheet--open {
  transition: none !important;
}

/* 4. Shadows / filter on panel and CTAs */
html[data-auth-comp='noshadow'] .grounded-auth-sheet__panel,
html[data-auth-comp='noshadow'] .grounded-auth-primary-btn,
html[data-auth-comp='noshadow'] .grounded-auth-input:focus {
  box-shadow: none !important;
  filter: none !important;
}

/* 5. will-change off (auth currently has none; still isolate the property) */
html[data-auth-comp='nowillchange'] .grounded-auth-sheet,
html[data-auth-comp='nowillchange'] .grounded-auth-sheet__backdrop,
html[data-auth-comp='nowillchange'] .grounded-auth-sheet__panel,
html[data-auth-comp='nowillchange'] .grounded-auth-primary-btn,
html[data-auth-comp='nowillchange'] .grounded-auth-secondary-btn,
html[data-auth-comp='nowillchange'] .grounded-auth-oauth-btn,
html[data-auth-comp='nowillchange'] .grounded-auth-password-toggle {
  will-change: auto !important;
}

/* 6. Neutralize ancestor compositor traps (html/body) */
html[data-auth-comp='noancestor'],
html[data-auth-comp='noancestor'] body {
  transform: none !important;
  filter: none !important;
  perspective: none !important;
  will-change: auto !important;
  background-attachment: scroll !important;
}

/* 7. All compositor-heavy auth effects off; dimensions unchanged */
html[data-auth-comp='all'] .grounded-auth-sheet,
html[data-auth-comp='all'] .grounded-auth-sheet.grounded-auth-sheet--open {
  transition: none !important;
  filter: none !important;
  will-change: auto !important;
}
html[data-auth-comp='all'] .grounded-auth-sheet__backdrop {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}
html[data-auth-comp='all'] .grounded-auth-sheet__panel,
html[data-auth-comp='all'] .grounded-auth-sheet.grounded-auth-sheet--open .grounded-auth-sheet__panel {
  transform: none !important;
  transition: none !important;
  box-shadow: none !important;
  filter: none !important;
  will-change: auto !important;
  -webkit-overflow-scrolling: auto !important;
}
html[data-auth-comp='all'] .grounded-auth-password-toggle,
html[data-auth-comp='all'] .grounded-auth-primary-btn,
html[data-auth-comp='all'] .grounded-auth-secondary-btn,
html[data-auth-comp='all'] .grounded-auth-oauth-btn {
  transform: none !important;
  transition: none !important;
  box-shadow: none !important;
}
html[data-auth-comp='all'],
html[data-auth-comp='all'] body {
  transform: none !important;
  filter: none !important;
  background-attachment: scroll !important;
}
