/* Nearby memory preview: every word and action stays inside the card. */
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 {
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
  clip-path: inset(0 round 22px) !important;
  contain: layout paint !important;
}

html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .peek-copy,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .peek-copy {
  display: grid !important;
  box-sizing: border-box !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  contain: inline-size !important;
}

html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .peek-copy > *,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .peek-copy > * {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .center-memory-preview-open,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.center-memory-preview .center-memory-preview-open {
  position: static !important;
  inset: auto !important;
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  justify-self: end !important;
  margin: 0 !important;
  overflow: hidden !important;
  transform: none !important;
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  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;
    column-gap: 9px !important;
    clip-path: inset(0 round 22px) !important;
  }

  /* The full memory note belongs in the capsule, not this compact map preview. */
  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;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

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

@media (max-width: 350px) {
  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: 42px minmax(0, 1fr) 22px !important;
    column-gap: 7px !important;
  }
}

/* "You made a memory here" discovery: protect the entire card from the map gadget. */
html body .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-discovery {
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow: hidden !important;
  clip-path: inset(0 round 22px) !important;
  contain: layout paint !important;
}

html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy {
  display: grid !important;
  box-sizing: border-box !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  contain: inline-size !important;
}

html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy > *,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy > * {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-right: 0 !important;
  margin-left: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  html body .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-discovery {
    position: absolute !important;
    left: max(14px, env(safe-area-inset-left)) !important;
    right: calc(max(14px, env(safe-area-inset-right)) + 102px) !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 96px !important;
    min-height: 96px !important;
    max-height: 96px !important;
    grid-template-columns: 54px minmax(0, 1fr) !important;
    column-gap: 9px !important;
    padding: 9px 10px !important;
    overflow: hidden !important;
    transform: translateY(12px) scale(0.985) !important;
  }

  html body .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-discovery.show {
    transform: translateY(0) scale(1) !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy {
    grid-template-rows: auto auto auto !important;
    align-content: center !important;
    row-gap: 2px !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;
    width: 100% !important;
    line-height: 1.08 !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.nearby-discovery .peek-copy small,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy small {
    display: block !important;
    width: 100% !important;
    white-space: nowrap !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy em,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.nearby-discovery .peek-copy em {
    display: inline-flex !important;
    width: auto !important;
    max-width: 100% !important;
    justify-self: start !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 370px) {
  html body .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-discovery {
    left: max(10px, env(safe-area-inset-left)) !important;
    right: calc(max(10px, env(safe-area-inset-right)) + 94px) !important;
    grid-template-columns: 46px minmax(0, 1fr) !important;
    column-gap: 7px !important;
    padding-inline: 8px !important;
  }
}
