/* V22u37: full-bleed map; inset controls exactly once, never the page. */
html { background-color:#fafaf8; }
body.bg-gray-100 { background-color:#fafaf8; }
html.bb-launch-enabled, html.bb-launch-enabled body { background-color:#CB0304; }
#map-toolbar {
  top:calc(1rem + var(--safe-area-top,0px));
  left:calc(1rem + var(--safe-area-left,0px));
  right:calc(1rem + var(--safe-area-right,0px));
}
#map-toolbar .search-results {
  max-height:min(440px,max(0px,calc(100dvh - 155px - var(--safe-area-top,0px) - var(--safe-area-bottom,0px) - var(--bb-surface-keyboard,0px))));
  max-width:calc(100vw - 32px - var(--safe-area-left,0px) - var(--safe-area-right,0px));
}
#map-toolbar .popover-temporale {
  width:min(360px,calc(100vw - 32px - var(--safe-area-left,0px) - var(--safe-area-right,0px)));
  max-height:max(0px,calc(100dvh - 190px - var(--safe-area-top,0px) - var(--safe-area-bottom,0px) - var(--bb-surface-keyboard,0px)));
}
@media(max-width:767px) {
  #map-toolbar .search-results { width:calc(100vw - 32px - var(--safe-area-left,0px) - var(--safe-area-right,0px)); }
}
@media(max-width:900px) and (pointer:coarse) {
  .leaflet-control-posizione { right:calc(16px + var(--safe-area-right,0px))!important; }
}
.app-status-stack, .arrival-alert-snackbar { left:calc(12px + var(--safe-area-left,0px))!important; }

/* Anchor the sheet to the viewport, avoiding iOS standalone absolute-bottom offset. */
#ui-panel{position:fixed}

/* One explicit canvas for both absolute and fixed app surfaces. Layout containment
   establishes their containing block without paint clipping or GPU transforms. */
html,body{height:100vh}
@supports(height:100dvh){html,body{height:100dvh}}
@media (display-mode:standalone){html,body{height:100vh}}
body{contain:layout}
#map{height:100%}

/* iOS navigator.standalone fallback: use the full Home-screen canvas. */
html.bb-installed-app,html.bb-installed-app body{height:100vh}

/* Installed portrait: only include the top area that iOS actually exposes.
   Keep the already-approved landscape canvas unchanged. */
@supports(height:100dvh){
 @media (orientation:portrait){
  html.bb-installed-app,html.bb-installed-app body{
   height:min(100vh,calc(100dvh + env(safe-area-inset-top,0px)));
  }
 }
}
