/**
 * Shell host para Flutter Web em iOS (Safari / Chrome = WebKit).
 * - Substitui dependência exclusiva de 100vh por cadeia com dvh + fill-available.
 * - Variáveis --vv-* atualizadas por ios_viewport_host.js (visualViewport).
 * - Corpo com fluxo vertical natural (sem centralizar com flex no host).
 */

:root {
  /* Sobrescritos em runtime por ios_viewport_host.js (visualViewport) */
  --vv-height: 100dvh;
  --vv-offset-top: 0px;
  --vv-offset-left: 0px;
  --vv-scale: 1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  /* Altura mínima: cadeia de compatibilidade (iOS antigo → moderno) */
  min-height: 100%;
  min-height: -webkit-fill-available;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

body {
  margin: 0;
  padding: 0;
  width: 100%;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;

  /* Safe areas (notch / home indicator) — fallback 0px se não suportado */
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);

  /* Altura visível: prioriza valor vindo do visualViewport quando aplicável */
  min-height: 100%;
  min-height: -webkit-fill-available;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  min-height: var(--vv-height, 100dvh);

  /* Evita “coluna centralizada” no host (causa metade do conteúdo atrás do teclado) */
  display: block;
  align-items: unset;
  justify-content: unset;
}

/* Quando JS marcar teclado / viewport dinâmico, reforça altura útil */
html.vv-active body {
  min-height: var(--vv-height, 100dvh);
}

/* Host típico do Flutter 3.x (nome pode variar; não quebra se ausente) */
flutter-view,
flt-glass-pane {
  display: block;
  width: 100%;
  min-height: var(--vv-height, 100dvh);
}
