/* Search and Capture reliability: exact places, iPad-safe travel, and a calmer Place step. */
html body .app-shell .memory-editor .memory-place-finder,
html body main.app-shell .memory-editor .memory-place-finder {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 7px;
}

html body .app-shell .memory-editor .memory-place-finder > label,
html body main.app-shell .memory-editor .memory-place-finder > label {
  margin: 0;
  color: rgba(14, 64, 81, 0.78) !important;
  font-size: 0.77rem !important;
  font-weight: 760;
}

html body .app-shell .memory-editor .memory-place-search-row,
html body main.app-shell .memory-editor .memory-place-search-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 50px;
  padding: 5px 6px 5px 13px;
  border: 1px solid rgba(14, 64, 81, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 12px 28px rgba(7, 70, 78, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

html body .app-shell .memory-editor .memory-place-search-row:focus-within,
html body main.app-shell .memory-editor .memory-place-search-row:focus-within {
  border-color: color-mix(in srgb, var(--editor-accent, #18a978) 50%, rgba(14, 64, 81, 0.12));
  box-shadow:
    0 14px 32px color-mix(in srgb, var(--editor-accent, #18a978) 12%, transparent),
    0 0 0 3px color-mix(in srgb, var(--editor-accent, #18a978) 10%, transparent);
}

html body .app-shell .memory-editor .memory-place-search-row > svg,
html body .app-shell .memory-editor .memory-place-search-row > [data-icon],
html body main.app-shell .memory-editor .memory-place-search-row > svg,
html body main.app-shell .memory-editor .memory-place-search-row > [data-icon] {
  width: 18px;
  height: 18px;
  color: #118f9b;
}

html body .app-shell .memory-editor input#memoryLocation,
html body main.app-shell .memory-editor input#memoryLocation {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 4px !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #092f3f !important;
  font-size: 0.9rem !important;
}

html body .app-shell .memory-editor .memory-place-search-button,
html body main.app-shell .memory-editor .memory-place-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 13px;
  color: #ffffff;
  background: linear-gradient(135deg, #118f9b, #18a978);
  box-shadow:
    0 9px 20px rgba(17, 143, 155, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}

html body .app-shell .memory-editor .memory-place-search-button svg,
html body main.app-shell .memory-editor .memory-place-search-button svg {
  width: 15px;
  height: 15px;
}

html body .app-shell .memory-editor .memory-place-search-button[aria-busy="true"],
html body main.app-shell .memory-editor .memory-place-search-button[aria-busy="true"] {
  cursor: progress;
  opacity: 0.78;
}

html body .app-shell .memory-editor .memory-location-hint,
html body main.app-shell .memory-editor .memory-location-hint {
  margin: 0 3px !important;
  color: rgba(14, 64, 81, 0.58) !important;
  font-size: 0.68rem !important;
  line-height: 1.35 !important;
}

html body .app-shell .memory-editor .memory-place-suggestions,
html body main.app-shell .memory-editor .memory-place-suggestions {
  position: relative;
  z-index: 8;
  display: grid;
  gap: 6px;
  width: 100%;
  max-height: 250px;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(14, 64, 81, 0.11);
  border-radius: 18px;
  background: rgba(250, 255, 252, 0.98);
  box-shadow: 0 18px 42px rgba(3, 45, 58, 0.14);
  overscroll-behavior: contain;
}

html body .app-shell .memory-editor .memory-place-suggestions[hidden],
html body main.app-shell .memory-editor .memory-place-suggestions[hidden] {
  display: none !important;
}

.memory-place-suggestions-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 6px 5px;
  color: #0e4051;
}

.memory-place-suggestions-heading span {
  font-size: 0.7rem;
  font-weight: 850;
}

.memory-place-suggestions-heading small {
  max-width: 58%;
  overflow: hidden;
  color: rgba(14, 64, 81, 0.5);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body .app-shell .memory-editor .memory-place-suggestion,
html body main.app-shell .memory-editor .memory-place-suggestion {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid rgba(14, 64, 81, 0.08);
  border-radius: 14px;
  color: #0a3848;
  background: rgba(255, 255, 255, 0.8);
  text-align: left;
  cursor: pointer;
}

html body .app-shell .memory-editor .memory-place-suggestion:hover,
html body .app-shell .memory-editor .memory-place-suggestion:focus-visible,
html body main.app-shell .memory-editor .memory-place-suggestion:hover,
html body main.app-shell .memory-editor .memory-place-suggestion:focus-visible {
  border-color: rgba(24, 169, 120, 0.24);
  background: rgba(237, 251, 246, 0.98);
}

.memory-place-suggestion-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(17, 143, 155, 0.12), rgba(24, 169, 120, 0.14));
  font-size: 1rem;
}

.memory-place-suggestion > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.memory-place-suggestion strong,
.memory-place-suggestion small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-place-suggestion strong {
  font-size: 0.78rem;
}

.memory-place-suggestion small {
  color: rgba(14, 64, 81, 0.58);
  font-size: 0.65rem;
}

.memory-place-suggestion em,
.pin-search-best-match {
  justify-self: end;
  padding: 4px 7px;
  border-radius: 999px;
  color: #087767;
  background: rgba(55, 209, 157, 0.13);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.memory-place-searching,
.memory-place-no-results {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 16px 12px;
  color: #0e4051;
  text-align: center;
}

.memory-place-searching > span {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(17, 143, 155, 0.16);
  border-top-color: #118f9b;
  border-radius: 999px;
  animation: mymappiPlaceSearchSpin 700ms linear infinite;
}

.memory-place-searching strong,
.memory-place-no-results strong {
  font-size: 0.76rem;
}

.memory-place-no-results small {
  max-width: 300px;
  color: rgba(14, 64, 81, 0.58);
  font-size: 0.67rem;
  line-height: 1.4;
}

@keyframes mymappiPlaceSearchSpin {
  to { transform: rotate(360deg); }
}

html body .app-shell .map-stage.map-focus .pin-search-result > span:nth-child(2),
html body main.app-shell section.map-stage.map-focus .pin-search-result > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 3px;
}

html body .app-shell .map-stage.map-focus .pin-search-best-match,
html body main.app-shell section.map-stage.map-focus .pin-search-best-match {
  justify-self: start;
  color: #9af3d3;
  background: rgba(84, 221, 177, 0.13);
}

/* Make the destination popup's close action unmistakable on touch screens. */
html body .app-shell .map-stage.map-focus .maplibregl-popup-content:has(.search-destination-popup),
html body main.app-shell section.map-stage.map-focus .maplibregl-popup-content:has(.search-destination-popup) {
  padding-top: 18px !important;
}

html body .app-shell .map-stage.map-focus .maplibregl-popup-content:has(.search-destination-popup) .maplibregl-popup-close-button,
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;
  display: grid !important;
  width: 34px !important;
  height: 34px !important;
  place-items: center !important;
  padding: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  border-radius: 999px !important;
  color: #ffffff !important;
  background: rgba(2, 28, 40, 0.86) !important;
  box-shadow: 0 8px 18px rgba(0, 17, 26, 0.24) !important;
  font-size: 1.35rem !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  opacity: 1 !important;
}

html body .app-shell .map-stage.map-focus .maplibregl-popup-content:has(.search-destination-popup) .maplibregl-popup-close-button:hover,
html body .app-shell .map-stage.map-focus .maplibregl-popup-content:has(.search-destination-popup) .maplibregl-popup-close-button:focus-visible {
  color: #073b45 !important;
  background: #ffffff !important;
}

/* Keep the secure-link notice clear of the 2D/3D switch on iPad and phones. */
@media (max-width: 1024px), (hover: none) and (pointer: coarse) {
  html body main.app-shell section.map-stage.map-focus .map-depth-switch {
    top: calc(env(safe-area-inset-top) + 72px) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
  }

  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner:not([hidden]),
  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner:not([hidden]) {
    top: calc(env(safe-area-inset-top) + 120px) !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    box-sizing: border-box !important;
    width: min(520px, calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right))) !important;
    max-width: none !important;
    transform: translateX(-50%) !important;
    z-index: 715 !important;
  }
}

/* Safari can report wider iPad viewports in landscape or split-screen. */
@media (min-width: 721px) and (max-width: 1366px),
       (min-width: 721px) and (max-width: 1600px) and (hover: none) and (pointer: coarse) {
  html body main.app-shell .memory-editor,
  html body main.app-shell .memory-editor.open,
  html body .app-shell .memory-editor,
  html body .app-shell .memory-editor.open {
    position: fixed !important;
    top: max(18px, env(safe-area-inset-top)) !important;
    right: auto !important;
    bottom: calc(96px + env(safe-area-inset-bottom)) !important;
    left: 50% !important;
    box-sizing: border-box !important;
    width: min(680px, calc(100vw - 48px - env(safe-area-inset-left) - env(safe-area-inset-right))) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 48px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
    max-height: calc(100dvh - 114px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    transform: translate3d(-50%, 0, 0) !important;
    transform-origin: 50% 50% !important;
  }
}

@media (max-width: 560px) {
  html body .app-shell .memory-editor .memory-place-search-row,
  html body main.app-shell .memory-editor .memory-place-search-row {
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 6px;
    padding-left: 10px;
  }

  html body .app-shell .memory-editor .memory-place-search-button,
  html body main.app-shell .memory-editor .memory-place-search-button {
    min-width: 42px;
    width: 42px;
    padding: 0;
  }

  html body .app-shell .memory-editor .memory-place-search-button span:last-child,
  html body main.app-shell .memory-editor .memory-place-search-button span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  html body .app-shell .memory-editor .memory-place-suggestion,
  html body main.app-shell .memory-editor .memory-place-suggestion {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .memory-place-suggestion em {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .memory-place-searching > span {
    animation: none;
  }
}
