/* Build 717: keep chapter journey cards centered and clear of mobile map controls. */

@media (max-width: 720px), (hover: none) and (pointer: coarse) and (max-width: 1024px) {
  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.memory-peek-card.story-mode-card:not(.story-mode-intro):not(.story-mode-outro),
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.memory-peek-card.story-mode-card:not(.story-mode-intro):not(.story-mode-outro) {
    position: fixed !important;
    top: auto !important;
    right: auto !important;
    bottom: calc(
      var(--bottom-nav-height, 78px) +
      env(safe-area-inset-bottom, 0px) +
      20px +
      var(--map-safe-gadget-size, 84px) +
      14px
    ) !important;
    left: calc(
      var(--mymappi-visual-offset-left, 0px) +
      (var(--mymappi-visible-width, 100vw) / 2)
    ) !important;
    z-index: 1682 !important;
    grid-template-columns: 58px minmax(0, 1fr) !important;
    box-sizing: border-box !important;
    width: min(
      430px,
      calc(
        var(--mymappi-visible-width, 100vw) -
        30px -
        env(safe-area-inset-left, 0px) -
        env(safe-area-inset-right, 0px)
      )
    ) !important;
    max-width: 430px !important;
    min-width: 0 !important;
    min-height: 108px !important;
    max-height: 122px !important;
    margin: 0 !important;
    padding: 12px 14px !important;
    gap: 10px !important;
    overflow: hidden !important;
    border-radius: 24px !important;
    transform: translateX(-50%) translateY(12px) scale(0.985) !important;
    transform-origin: 50% 100% !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.memory-peek-card.story-mode-card:not(.story-mode-intro):not(.story-mode-outro).show,
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.memory-peek-card.story-mode-card:not(.story-mode-intro):not(.story-mode-outro).show {
    transform: translateX(-50%) translateY(0) scale(1) !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy,
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy {
    display: grid !important;
    min-width: 0 !important;
    align-content: center !important;
    gap: 2px !important;
    overflow: hidden !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy :is(strong, small, em),
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy :is(strong, small, em) {
    display: -webkit-box !important;
    width: auto !important;
    max-width: 100% !important;
    overflow: hidden !important;
    line-height: 1.18 !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    -webkit-box-orient: vertical !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy strong,
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy strong {
    -webkit-line-clamp: 2 !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy :is(small, em),
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-copy :is(small, em) {
    -webkit-line-clamp: 1 !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .story-chapter-progress,
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .story-chapter-progress {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 390px) {
  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.memory-peek-card.story-mode-card:not(.story-mode-intro):not(.story-mode-outro),
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.memory-peek-card.story-mode-card:not(.story-mode-intro):not(.story-mode-outro) {
    grid-template-columns: 52px minmax(0, 1fr) !important;
    min-height: 104px !important;
    padding: 11px 12px !important;
  }

  html body .app-shell .map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-pin,
  html body main.app-shell section.map-stage.map-focus.chapter-journey-active #memoryPeekCard.story-mode-card .peek-pin {
    width: 52px !important;
    height: 52px !important;
  }
}
