/* Final responsive layout guard for Capture, Today's Memory, and Explore overlays. */

/* One calm Home status line: monthly progress and sync confidence belong together. */
html body .app-shell .map-stage.home-focus .home-calm-status,
html body main.app-shell section.map-stage.home-focus .home-calm-status {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: fit-content !important;
  max-width: calc(100% - 24px) !important;
  min-height: 28px !important;
  margin: 2px auto 0 !important;
  padding: 6px 12px !important;
  gap: 7px !important;
  border: 1px solid rgba(18, 111, 99, 0.08) !important;
  border-radius: 999px !important;
  color: rgba(29, 84, 88, 0.76) !important;
  background: rgba(249, 255, 252, 0.44) !important;
  box-shadow: 0 5px 16px rgba(7, 65, 71, 0.03) !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

html body .app-shell .map-stage.home-focus .home-calm-status .home-mappi-moment,
html body main.app-shell section.map-stage.home-focus .home-calm-status .home-mappi-moment,
html body .app-shell .map-stage.home-focus .home-calm-status .home-sync-confidence,
html body main.app-shell section.map-stage.home-focus .home-calm-status .home-sync-confidence {
  display: inline-flex !important;
  align-items: center !important;
  width: auto !important;
  max-width: none !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 6px !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: inherit !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 0.69rem !important;
  font-weight: 740 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
}

html body .app-shell .map-stage.home-focus .home-calm-status .home-mappi-moment[hidden],
html body main.app-shell section.map-stage.home-focus .home-calm-status .home-mappi-moment[hidden] {
  display: none !important;
}

html body .app-shell .map-stage.home-focus .home-calm-status .home-mappi-moment[hidden] + .home-calm-status-divider,
html body main.app-shell section.map-stage.home-focus .home-calm-status .home-mappi-moment[hidden] + .home-calm-status-divider {
  display: none !important;
}

html body .app-shell .map-stage.home-focus .home-calm-status-divider,
html body main.app-shell section.map-stage.home-focus .home-calm-status-divider {
  color: rgba(29, 84, 88, 0.38) !important;
  font-size: 0.78rem !important;
  line-height: 1 !important;
}

html body .app-shell .map-stage.home-focus .home-calm-status .home-sync-confidence > i,
html body main.app-shell section.map-stage.home-focus .home-calm-status .home-sync-confidence > i {
  width: 6px !important;
  height: 6px !important;
  flex: 0 0 6px !important;
  box-shadow: 0 0 0 2px rgba(32, 170, 125, 0.1) !important;
}

/* Life Chapters keep faces above the crop line and center detected groups. */
html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-cover > img,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-cover > img,
html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-preview img,
html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-preview img {
  object-position: var(--home-photo-position, center 32%) !important;
}

@media (max-width: 720px) {
  html body .app-shell .map-stage.home-focus .home-calm-status,
  html body main.app-shell section.map-stage.home-focus .home-calm-status {
    min-height: 26px !important;
    padding: 5px 10px !important;
    gap: 6px !important;
  }

  html body .app-shell .map-stage.home-focus .home-calm-status .home-mappi-moment,
  html body main.app-shell section.map-stage.home-focus .home-calm-status .home-mappi-moment,
  html body .app-shell .map-stage.home-focus .home-calm-status .home-sync-confidence,
  html body main.app-shell section.map-stage.home-focus .home-calm-status .home-sync-confidence {
    font-size: clamp(0.61rem, 2.8vw, 0.66rem) !important;
  }

  /* Wide photos and multi-person portraits keep the whole group in frame. */
  html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-photo-frame.is-wide-today-photo,
  html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-photo-frame.is-wide-today-photo,
  html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-photo-frame.keep-full-subject-group,
  html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-photo-frame.keep-full-subject-group {
    object-fit: contain !important;
    background: linear-gradient(145deg, #dceee9, #cfe5e1) !important;
    transform: none !important;
    animation: today-photo-arrive 620ms ease-out both !important;
    transition: opacity 360ms ease !important;
  }

  /* A wide multi-person chapter cover shows the full group on a phone. */
  html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-cover > img.keep-full-life-chapter-subject-group,
  html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-cover > img.keep-full-life-chapter-subject-group {
    object-fit: contain !important;
    background: linear-gradient(145deg, #dceee9, #cfe5e1) !important;
    transform: none !important;
    transition: opacity 360ms ease !important;
  }
}

/* Use one centered section label whether today is empty or already has memories. */
html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline {
  position: relative !important;
  inset: auto !important;
  z-index: 8 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 auto 10px !important;
  padding: 0 !important;
  transform: none !important;
  pointer-events: none !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .today-memory-name-pill,
html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .today-memory-date-pill,
html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .memory-day-slide-count,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .today-memory-name-pill,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .today-memory-date-pill,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .memory-day-slide-count,
html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-photo-label,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-photo-label {
  display: none !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .home-kicker,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .home-kicker {
  min-height: 34px !important;
  padding: 7px 12px !important;
  border: 1px solid rgba(14, 101, 96, 0.1) !important;
  border-radius: 999px !important;
  color: #073845 !important;
  background: rgba(255, 253, 248, 0.72) !important;
  box-shadow: 0 9px 22px rgba(7, 64, 68, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.76) !important;
  backdrop-filter: blur(12px) saturate(1.06) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.06) !important;
}

/* The photo progress dots stay clickable, but visually read as a tiny indicator. */
html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-photo-dots,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-photo-dots {
  position: absolute !important;
  top: 11px !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  z-index: 9 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-height: 14px !important;
  margin: 0 !important;
  padding: 1px 3px !important;
  gap: 0 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: 999px !important;
  background: rgba(3, 34, 45, 0.24) !important;
  box-shadow: none !important;
  transform: translateX(-50%) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-photo-dots button,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-photo-dots button {
  position: relative !important;
  width: 12px !important;
  min-width: 12px !important;
  height: 12px !important;
  min-height: 12px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-photo-dots button::after,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-photo-dots button::after {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 4px !important;
  height: 4px !important;
  content: "" !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.62) !important;
  transform: translate(-50%, -50%) !important;
  transition: width 180ms ease, background-color 180ms ease !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-photo-dots button.active,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-photo-dots button.active {
  width: 18px !important;
  min-width: 18px !important;
  background: transparent !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-photo-dots button.active::after,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-photo-dots button.active::after {
  width: 10px !important;
  background: #c8fff0 !important;
}

/* Multiple memories from today use a second, deliberately compact switcher. */
html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-footer,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-footer {
  position: absolute !important;
  top: 34px !important;
  right: auto !important;
  bottom: auto !important;
  left: 50% !important;
  z-index: 9 !important;
  display: flex !important;
  justify-content: center !important;
  width: auto !important;
  max-width: calc(100% - 104px) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translateX(-50%) !important;
  pointer-events: none !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-switcher-scroll,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-switcher-scroll {
  display: inline-flex !important;
  width: auto !important;
  max-width: 100% !important;
  padding: 3px !important;
  gap: 3px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 999px !important;
  background: rgba(3, 34, 45, 0.24) !important;
  box-shadow: none !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  pointer-events: auto !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-choice,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-choice {
  width: 22px !important;
  min-width: 22px !important;
  max-width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  padding: 0 !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  transform: none !important;
}

html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-choice.active,
html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory .today-memory-choice.active {
  width: 29px !important;
  min-width: 29px !important;
  max-width: 29px !important;
  border-radius: 9px !important;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.58) !important;
}

@media (max-width: 720px) {
  /* Capture opens in one stable viewport-sized sheet with no upward travel. */
  html body .app-shell .memory-editor,
  html body main.app-shell .memory-editor,
  html body .app-shell .memory-editor.open,
  html body main.app-shell .memory-editor.open {
    position: fixed !important;
    top: max(8px, env(safe-area-inset-top)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    box-sizing: border-box !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    translate: 0 0 !important;
    transform: none !important;
    transform-origin: center center !important;
  }

  html body .app-shell .memory-editor.open,
  html body main.app-shell .memory-editor.open {
    animation: mymappiCaptureFadeIn 210ms ease-out both !important;
  }

  html body.keyboard-open .app-shell .memory-editor.open,
  html body.keyboard-open main.app-shell .memory-editor.open {
    top: max(8px, env(safe-area-inset-top)) !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    max-height: calc(var(--mymappi-visible-height, 100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
    translate: 0 0 !important;
    transform: none !important;
  }

  /* Keep Save Memory attached to the editor instead of floating over its middle. */
  html body .app-shell .memory-editor.open .editor-actions,
  html body main.app-shell .memory-editor.open .editor-actions,
  html body.keyboard-open .app-shell .memory-editor.open .editor-actions,
  html body.keyboard-open main.app-shell .memory-editor.open .editor-actions {
    position: sticky !important;
    right: auto !important;
    bottom: 0 !important;
    left: auto !important;
    width: 100% !important;
    margin: 0 !important;
    transform: none !important;
  }

  /* The center capture control always stays in its original navigation slot. */
  html body .app-shell .add-memory-button,
  html body main.app-shell .add-memory-button,
  html body .app-shell .add-memory-button.first-memory-pulse,
  html body main.app-shell .add-memory-button.first-memory-pulse,
  html body .app-shell .map-stage.memory-editor-active .add-memory-button,
  html body main.app-shell section.map-stage.memory-editor-active .add-memory-button {
    position: relative !important;
    inset: auto !important;
    align-self: center !important;
    justify-self: center !important;
    margin: 0 !important;
    animation: none !important;
    translate: 0 0 !important;
    transform: none !important;
  }

  html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline,
  html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline {
    margin-bottom: 8px !important;
  }

  html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .home-kicker,
  html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-memory-card.has-today-memory > .memory-day-topline .home-kicker {
    min-height: 31px !important;
    padding: 6px 10px !important;
  }
}

@keyframes mymappiCaptureFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  /* Keep permission and map depth controls in one measured top row. */
  html body main.app-shell section.map-stage.map-focus .map-depth-switch,
  html body .app-shell section.map-stage.map-focus .map-depth-switch {
    position: absolute !important;
    top: calc(max(8px, env(safe-area-inset-top)) + 60px) !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 720 !important;
    display: grid !important;
    grid-template-columns: repeat(2, 39px) !important;
    grid-template-rows: 30px !important;
    box-sizing: border-box !important;
    width: 88px !important;
    min-width: 88px !important;
    max-width: 88px !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    padding: 3px !important;
    gap: 2px !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    transform: none !important;
    contain: layout paint style !important;
  }

  html body main.app-shell section.map-stage.map-focus .map-depth-switch button,
  html body .app-shell section.map-stage.map-focus .map-depth-switch button {
    position: static !important;
    inset: auto !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    place-items: center !important;
    border-radius: 8px !important;
    font-size: 0.68rem !important;
    line-height: 1 !important;
    transform: none !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner:not([hidden]),
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner:not([hidden]) {
    position: absolute !important;
    top: calc(max(8px, env(safe-area-inset-top)) + 60px) !important;
    right: calc(max(14px, env(safe-area-inset-right)) + 96px) !important;
    bottom: auto !important;
    left: max(14px, env(safe-area-inset-left)) !important;
    z-index: 719 !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) auto !important;
    align-items: center !important;
    box-sizing: border-box !important;
    width: auto !important;
    min-width: 0 !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;
    padding: 4px 5px !important;
    gap: 7px !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    transform: none !important;
    contain: layout paint style !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner img,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner img {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    object-fit: contain !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner > div,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner > div {
    min-width: 0 !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner strong,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner strong {
    display: block !important;
    overflow: hidden !important;
    font-size: 0.67rem !important;
    line-height: 1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner span,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner span {
    display: none !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner button,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner button {
    width: auto !important;
    min-width: 48px !important;
    height: 28px !important;
    min-height: 28px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    border-radius: 8px !important;
    font-size: 0.6rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  /* The first-memory invitation belongs above the central +, never on the gadget. */
  html body main.app-shell section.map-stage.map-focus .map-empty-state,
  html body .app-shell section.map-stage.map-focus .map-empty-state {
    position: absolute !important;
    right: auto !important;
    bottom: calc(var(--bottom-nav-height, 78px) + env(safe-area-inset-bottom) + 22px) !important;
    left: 50% !important;
    z-index: 716 !important;
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: center !important;
    box-sizing: border-box !important;
    width: min(290px, calc(100vw - 28px)) !important;
    min-width: 0 !important;
    min-height: 76px !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 10px 12px !important;
    gap: 2px 10px !important;
    overflow: hidden !important;
    border-radius: 21px !important;
    text-align: left !important;
    transform: translateX(-50%) !important;
  }

  html body main.app-shell section.map-stage.map-focus .map-empty-state::after,
  html body .app-shell section.map-stage.map-focus .map-empty-state::after {
    position: absolute !important;
    right: auto !important;
    bottom: -8px !important;
    left: 50% !important;
    width: 16px !important;
    height: 16px !important;
    content: "" !important;
    border: 0 !important;
    background: inherit !important;
    box-shadow: none !important;
    transform: translateX(-50%) rotate(45deg) !important;
  }

  html body main.app-shell section.map-stage.map-focus .map-empty-state[hidden],
  html body .app-shell section.map-stage.map-focus .map-empty-state[hidden] {
    display: none !important;
  }

  html body main.app-shell section.map-stage.map-focus .map-empty-state img,
  html body .app-shell section.map-stage.map-focus .map-empty-state img {
    grid-row: 1 / span 2 !important;
    width: 42px !important;
    height: 54px !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  html body main.app-shell section.map-stage.map-focus .map-empty-state strong,
  html body .app-shell section.map-stage.map-focus .map-empty-state strong {
    font-size: 0.8rem !important;
    line-height: 1.1 !important;
  }

  html body main.app-shell section.map-stage.map-focus .map-empty-state span,
  html body .app-shell section.map-stage.map-focus .map-empty-state span {
    font-size: 0.64rem !important;
    line-height: 1.24 !important;
  }
}

@media (max-width: 350px) {
  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner:not([hidden]),
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner:not([hidden]) {
    right: calc(max(8px, env(safe-area-inset-right)) + 94px) !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    grid-template-columns: 24px minmax(0, 1fr) auto !important;
    gap: 5px !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner img,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner img {
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
  }

  html body main.app-shell section.map-stage.map-focus #locationBanner.location-banner button,
  html body .app-shell section.map-stage.map-focus #locationBanner.location-banner button {
    min-width: 42px !important;
    padding-inline: 5px !important;
    font-size: 0.55rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .app-shell .memory-editor.open,
  html body main.app-shell .memory-editor.open,
  html body .app-shell .map-stage.home-focus #homeMemoryOfDay .today-photo-dots button::after,
  html body main.app-shell section.map-stage.home-focus #homeMemoryOfDay .today-photo-dots button::after {
    animation: none !important;
    transition: none !important;
  }
}
