/* Phone-only selected-destination sheet.
   A selected place temporarily owns the bottom map lane, so its route and
   save actions stay completely above the persistent navigation. */
@media (max-width: 720px) {
  html body main.app-shell section.map-stage.map-focus.search-destination-active .map-navigation-gadget {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  html body main.app-shell section.map-stage.map-focus .maplibregl-popup:has(.search-destination-popup) {
    position: fixed !important;
    top: auto !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    bottom: calc(var(--bottom-nav-height, 84px) + env(safe-area-inset-bottom) + 18px) !important;
    left: max(14px, env(safe-area-inset-left)) !important;
    z-index: 740 !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    transform: none !important;
  }

  html body main.app-shell section.map-stage.map-focus .maplibregl-popup:has(.search-destination-popup) .maplibregl-popup-content {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    max-height: calc(
      100dvh - var(--bottom-nav-height, 84px) -
      env(safe-area-inset-top) - env(safe-area-inset-bottom) - 104px
    ) !important;
    padding: 18px 16px 16px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch;
  }

  html body main.app-shell section.map-stage.map-focus .maplibregl-popup:has(.search-destination-popup) .maplibregl-popup-tip {
    display: none !important;
  }

  html body main.app-shell section.map-stage.map-focus .search-destination-popup {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  html body main.app-shell section.map-stage.map-focus .search-destination-popup :is(h3, p, .popup-meta) {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  html body main.app-shell section.map-stage.map-focus .search-destination-popup .popup-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 8px !important;
  }

  html body main.app-shell section.map-stage.map-focus .search-destination-popup :is(.popup-route, .popup-edit) {
    display: inline-flex !important;
    align-items: center !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  html body main.app-shell section.map-stage.map-focus .maplibregl-popup-content:has(.search-destination-popup) .maplibregl-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }
}
