/* EnterHome map fullscreen controls and viewport-safe mobile chat. */
@media (min-width: 801px) {
  body.eh-map-page .eh9-discovery:has(.eh9-split.is-map-only) .eh9-searchbar {
    position: fixed !important;
    top: var(--eh-map-header-bottom, 64px) !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1100 !important;
    display: block !important;
    width: 100% !important;
    max-height: calc(100dvh - var(--eh-map-header-bottom, 64px) - 12px) !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    background: rgb(255 255 255 / 96%) !important;
    border-bottom: 1px solid #dce2e8 !important;
    box-shadow: 0 3px 12px rgb(48 32 39 / 14%) !important;
    backdrop-filter: blur(8px);
  }

  body.eh-map-page .eh9-discovery:has(.eh9-split.is-map-only) .eh9-filter-row {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  body.eh-map-page .eh9-split.is-map-only .eh9-restore-results {
    position: fixed !important;
    top: calc(var(--eh-map-header-bottom, 64px) + var(--eh-map-full-controls-height, 100px) + 8px) !important;
    right: 16px !important;
    z-index: 1110 !important;
  }
}

/* Portaling the chat root to body removes transformed map ancestors. */
@media (max-width: 600px) {
  body.eh-map-page .ehqc.ehqc-mobile-portal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1400 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: visible !important;
    transform: none !important;
    filter: none !important;
    perspective: none !important;
    contain: none !important;
    pointer-events: none !important;
  }

  body.eh-map-page .ehqc.ehqc-mobile-portal .ehqc-panel:not([hidden]) {
    position: fixed !important;
    inset: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)) !important;
    z-index: 1410 !important;
    display: flex !important;
    flex-direction: column !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    border: 1px solid #d8dee7 !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: 0 12px 40px rgb(23 34 52 / 38%) !important;
    pointer-events: auto !important;
  }

  body.eh-map-page .ehqc.ehqc-mobile-portal .ehqc-panel[hidden] { display: none !important; }
  body.eh-map-page .ehqc.ehqc-mobile-portal .ehqc-panel > header {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    flex: 0 0 auto !important;
    min-height: 54px !important;
    margin: 0 !important;
    padding: 6px 8px 6px 14px !important;
    background: #fff !important;
    border-bottom: 1px solid #e5e8ed !important;
  }
  body.eh-map-page .ehqc.ehqc-mobile-portal .ehqc-window-actions button,
  body.eh-map-page .ehqc.ehqc-mobile-portal .ehqc-close { min-width: 44px !important; min-height: 44px !important; }
  body.eh-map-page .ehqc.ehqc-mobile-portal .ehqc-form { flex: 0 0 auto !important; width: 100% !important; }
  body.eh-map-page .ehqc.ehqc-mobile-portal .ehcl-transcript {
    flex: 1 1 auto !important;
    min-height: 120px !important;
    max-height: 42dvh !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
