/* Explore mobile safe lane: previews stay beside the gadget and inside their cards. */
@media (max-width: 720px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  html body .app-shell section.map-stage.map-focus {
    --mymappi-map-side-gap: max(14px, env(safe-area-inset-right));
    --mymappi-map-gadget-lane: 102px;
    --mymappi-map-bottom-lane: calc(78px + env(safe-area-inset-bottom) + 20px);
  }

  html body .app-shell section.map-stage.map-focus .map-navigation-gadget,
  html body main.app-shell section.map-stage.map-focus .map-navigation-gadget {
    right: var(--mymappi-map-side-gap) !important;
    bottom: var(--mymappi-map-bottom-lane) !important;
    z-index: 62 !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.living-nearby,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-count,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.living-nearby,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-count,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview {
    position: absolute !important;
    right: calc(var(--mymappi-map-side-gap) + var(--mymappi-map-gadget-lane)) !important;
    bottom: var(--mymappi-map-bottom-lane) !important;
    left: max(14px, env(safe-area-inset-left)) !important;
    z-index: 58 !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 92px !important;
    min-height: 92px !important;
    max-height: 92px !important;
    margin: 0 !important;
    padding: 9px 10px !important;
    gap: 9px !important;
    align-items: center !important;
    overflow: hidden !important;
    border-radius: 22px !important;
    text-align: left !important;
    transform: translateY(12px) scale(0.985) !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.living-nearby.show,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery.show,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-count.show,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview.show,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.living-nearby.show,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery.show,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-count.show,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview.show {
    transform: translateY(0) scale(1) !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-count,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-count {
    grid-template-columns: 54px minmax(0, 1fr) !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview {
    grid-template-columns: 48px minmax(0, 1fr) 24px !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card .peek-pin.nearby-mappi-badge,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .peek-pin.nearby-mappi-badge {
    box-sizing: border-box !important;
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    padding: 4px !important;
    border-radius: 18px !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .center-memory-preview-media,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .center-memory-preview-media {
    box-sizing: border-box !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    border-radius: 14px !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card .peek-copy,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .peek-copy {
    display: grid !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    align-content: center !important;
    gap: 2px !important;
    overflow: hidden !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card .peek-copy > *,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .peek-copy > * {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card .peek-copy strong,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .peek-copy strong,
  html body .app-shell section.map-stage.map-focus .memory-peek-card .peek-copy small,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .peek-copy small,
  html body .app-shell section.map-stage.map-focus .memory-peek-card .center-memory-preview-kicker,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .center-memory-preview-kicker {
    display: block !important;
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy strong,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy strong {
    display: -webkit-box !important;
    overflow: hidden !important;
    line-height: 1.12 !important;
    white-space: normal !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card .peek-copy em,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .peek-copy em {
    box-sizing: border-box !important;
    width: fit-content !important;
    max-width: 100% !important;
    margin: 2px 0 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* The map preview stays compact; the full note is available after opening it. */
  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .peek-copy em,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .peek-copy em {
    display: none !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card .center-memory-preview-open,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card .center-memory-preview-open {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    justify-self: end !important;
  }
}

@media (max-width: 350px) {
  html body .app-shell section.map-stage.map-focus {
    --mymappi-map-side-gap: max(12px, env(safe-area-inset-right));
    --mymappi-map-gadget-lane: 98px;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.living-nearby,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-count,
  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview {
    left: max(12px, env(safe-area-inset-left)) !important;
    padding: 8px !important;
    gap: 7px !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview {
    grid-template-columns: 42px minmax(0, 1fr) 22px !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .center-memory-preview-media {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
  }
}
