/* Build 686: Active Trips and chapter-focused Explore.
   This layer intentionally reuses MyMappi's ivory, teal, green, and restrained
   coral system while reserving fixed safe lanes for the 2D/3D switch, map
   gadget, bottom navigation, and device insets. */

html body .app-shell section.map-stage.map-focus {
  --active-trip-ivory: #fffef8;
  --active-trip-ink: #073f4c;
  --active-trip-muted: #58787d;
  --active-trip-teal: #0b7f7c;
  --active-trip-green: #20ae7f;
  --active-trip-coral: #f15d6b;
  --active-trip-line: rgba(10, 111, 105, 0.16);
  --active-trip-side-left: max(18px, env(safe-area-inset-left, 0px));
  --active-trip-side-right: max(18px, env(safe-area-inset-right, 0px));
  --active-trip-top-lane: 82px;
  --active-trip-depth-reserve: 132px;
  --active-trip-bottom-lane: calc(var(--bottom-nav-height, 84px) + env(safe-area-inset-bottom, 0px) + 20px);
}

/* Chapter lens ----------------------------------------------------------- */

html body .app-shell section.map-stage.map-focus .map-chapter-selector,
html body main.app-shell section.map-stage.map-focus .map-chapter-selector {
  position: absolute !important;
  top: var(--active-trip-top-lane) !important;
  right: auto !important;
  bottom: auto !important;
  left: var(--active-trip-side-left) !important;
  z-index: 717 !important;
  box-sizing: border-box !important;
  width: min(340px, calc(100vw - var(--active-trip-side-left) - var(--active-trip-side-right) - var(--active-trip-depth-reserve))) !important;
  min-width: 0 !important;
  max-width: 340px !important;
  min-height: 44px !important;
  margin: 0 !important;
  pointer-events: auto !important;
}

/* The production selector uses a compact native select so it remains reliable
   with VoiceOver, browser zoom, and the iOS keyboard. */
html body .app-shell .active-trip-bar {
  position: absolute !important;
  top: var(--active-trip-top-lane) !important;
  right: calc(var(--active-trip-side-right) + var(--active-trip-depth-reserve)) !important;
  left: var(--active-trip-side-left) !important;
  z-index: 718 !important;
  display: flex !important;
  width: auto !important;
  min-width: 0 !important;
  align-items: center !important;
  gap: 8px !important;
  pointer-events: none !important;
}

html body .app-shell .active-trip-bar[hidden],
html body .app-shell section.map-stage:not(.map-focus) .active-trip-bar {
  display: none !important;
}

html body .app-shell .active-trip-bar .map-chapter-selector {
  position: relative !important;
  inset: auto !important;
  flex: 1 1 260px !important;
  width: min(340px, 100%) !important;
  pointer-events: auto !important;
}

html body .app-shell #mapChapterSelector {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 44px !important;
  padding: 8px 34px 8px 14px !important;
  overflow: hidden !important;
  border: 1px solid rgba(221, 255, 247, 0.28) !important;
  border-radius: 15px !important;
  color: #f6fffc !important;
  background-color: rgba(4, 48, 60, 0.96) !important;
  box-shadow: 0 11px 27px rgba(2, 29, 41, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  font: inherit !important;
  font-size: 0.74rem !important;
  font-weight: 800 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  color-scheme: dark !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.08) !important;
  backdrop-filter: blur(16px) saturate(1.08) !important;
}

html body .app-shell #mapChapterSelector:focus-visible {
  border-color: rgba(130, 239, 208, 0.58) !important;
  outline: 3px solid rgba(71, 212, 174, 0.18) !important;
  outline-offset: 2px !important;
}

html body .app-shell .active-trip-finish {
  box-sizing: border-box !important;
  display: inline-flex !important;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 8px 13px !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  border: 1px solid rgba(21, 134, 119, 0.18) !important;
  border-radius: 15px !important;
  color: #075c62 !important;
  background: linear-gradient(145deg, rgba(255, 254, 248, 0.97), rgba(227, 247, 238, 0.96)) !important;
  box-shadow: 0 10px 24px rgba(2, 43, 52, 0.16) !important;
  font: inherit !important;
  font-size: 0.68rem !important;
  font-weight: 820 !important;
  white-space: nowrap !important;
  pointer-events: auto !important;
  cursor: pointer !important;
}

html body .app-shell .active-trip-finish[hidden] {
  display: none !important;
}

html body .app-shell .active-trip-finish svg {
  width: 16px !important;
  height: 16px !important;
}

html body .app-shell section.map-stage:not(.map-focus) .map-chapter-selector,
html body main.app-shell section.map-stage:not(.map-focus) .map-chapter-selector {
  display: none !important;
}

html body .app-shell #mapChapterSelectorButton {
  box-sizing: border-box !important;
  display: grid !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  grid-template-columns: 10px minmax(0, 1fr) 18px !important;
  align-items: center !important;
  gap: 9px !important;
  margin: 0 !important;
  padding: 7px 11px !important;
  overflow: hidden !important;
  border: 1px solid rgba(221, 255, 247, 0.25) !important;
  border-radius: 15px !important;
  color: #f6fffc !important;
  background:
    radial-gradient(circle at 12% 0%, rgba(76, 222, 181, 0.2), transparent 42%),
    linear-gradient(145deg, rgba(5, 58, 69, 0.95), rgba(3, 35, 48, 0.94)) !important;
  box-shadow:
    0 11px 27px rgba(2, 29, 41, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  font: inherit !important;
  text-align: left !important;
  cursor: pointer !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.08) !important;
  backdrop-filter: blur(16px) saturate(1.08) !important;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease !important;
}

html body .app-shell #mapChapterSelectorButton::before {
  content: "" !important;
  display: block !important;
  width: 9px !important;
  height: 9px !important;
  border: 2px solid rgba(255, 255, 255, 0.78) !important;
  border-radius: 50% !important;
  background: #67dfbc !important;
  box-shadow: 0 0 0 4px rgba(81, 220, 181, 0.13) !important;
}

html body .app-shell #mapChapterSelectorButton[data-chapter-scope="all"]::before,
html body .app-shell #mapChapterSelectorButton.is-all-memories::before {
  background: #f2fff9 !important;
  box-shadow: 0 0 0 4px rgba(242, 255, 249, 0.1) !important;
}

html body .app-shell #mapChapterSelectorButton[data-chapter-status="finished"]::before,
html body .app-shell #mapChapterSelectorButton.is-finished::before {
  background: #8dc8d3 !important;
  box-shadow: 0 0 0 4px rgba(141, 200, 211, 0.13) !important;
}

html body .app-shell #mapChapterSelectorButton:hover,
html body .app-shell #mapChapterSelectorButton:focus-visible,
html body .app-shell #mapChapterSelectorButton[aria-expanded="true"] {
  border-color: rgba(130, 239, 208, 0.48) !important;
  background:
    radial-gradient(circle at 12% 0%, rgba(76, 222, 181, 0.26), transparent 44%),
    linear-gradient(145deg, rgba(6, 69, 78, 0.97), rgba(3, 40, 52, 0.96)) !important;
  box-shadow:
    0 13px 30px rgba(2, 29, 41, 0.22),
    0 0 0 3px rgba(71, 212, 174, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.14) !important;
}

html body .app-shell #mapChapterSelectorButton:active {
  transform: translateY(1px) !important;
}

html body .app-shell #mapChapterSelectorButton > span,
html body .app-shell #mapChapterSelectorButton .map-chapter-selector-copy {
  display: grid !important;
  min-width: 0 !important;
  gap: 1px !important;
}

html body .app-shell #mapChapterSelectorButton strong,
html body .app-shell #mapChapterSelectorButton .map-chapter-selector-title {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: #f7fffd !important;
  font-size: 0.76rem !important;
  font-weight: 820 !important;
  line-height: 1.15 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell #mapChapterSelectorButton small,
html body .app-shell #mapChapterSelectorButton .map-chapter-selector-eyebrow {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: rgba(233, 255, 249, 0.7) !important;
  font-size: 0.58rem !important;
  font-weight: 720 !important;
  line-height: 1.15 !important;
  letter-spacing: 0.045em !important;
  text-overflow: ellipsis !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

html body .app-shell #mapChapterSelectorButton > svg,
html body .app-shell #mapChapterSelectorButton .map-chapter-selector-chevron {
  width: 17px !important;
  height: 17px !important;
  color: rgba(236, 255, 250, 0.8) !important;
  transition: transform 160ms ease !important;
}

html body .app-shell #mapChapterSelectorButton[aria-expanded="true"] > svg,
html body .app-shell #mapChapterSelectorButton[aria-expanded="true"] .map-chapter-selector-chevron {
  transform: rotate(180deg) !important;
}

html body .app-shell .map-chapter-menu {
  position: absolute !important;
  top: 52px !important;
  right: auto !important;
  bottom: auto !important;
  left: 0 !important;
  z-index: 930 !important;
  box-sizing: border-box !important;
  display: grid !important;
  width: min(360px, calc(100vw - var(--active-trip-side-left) - var(--active-trip-side-right))) !important;
  max-width: 360px !important;
  max-height: min(68vh, 520px) !important;
  padding: 10px !important;
  gap: 7px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  border: 1px solid rgba(10, 104, 101, 0.18) !important;
  border-radius: 21px !important;
  color: var(--active-trip-ink) !important;
  background:
    radial-gradient(circle at 96% 2%, rgba(66, 214, 169, 0.14), transparent 32%),
    linear-gradient(148deg, rgba(255, 254, 248, 0.98), rgba(238, 249, 244, 0.97)) !important;
  box-shadow:
    0 22px 55px rgba(2, 32, 42, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  -webkit-backdrop-filter: blur(20px) saturate(1.05) !important;
  backdrop-filter: blur(20px) saturate(1.05) !important;
}

html body .app-shell .map-chapter-menu[hidden] {
  display: none !important;
}

html body .app-shell .map-chapter-menu-header {
  display: grid !important;
  min-width: 0 !important;
  padding: 8px 9px 7px !important;
  gap: 3px !important;
}

html body .app-shell .map-chapter-menu-header > span {
  color: #0b8277 !important;
  font-size: 0.59rem !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
}

html body .app-shell .map-chapter-menu-header > strong {
  color: var(--active-trip-ink) !important;
  font-size: 0.9rem !important;
  font-weight: 820 !important;
  line-height: 1.2 !important;
}

html body .app-shell .map-chapter-menu-list {
  display: grid !important;
  gap: 5px !important;
}

html body .app-shell .map-chapter-menu button,
html body .app-shell .map-chapter-menu-option {
  box-sizing: border-box !important;
  display: grid !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 48px !important;
  grid-template-columns: 34px minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 7px 10px !important;
  border: 1px solid transparent !important;
  border-radius: 15px !important;
  color: #214f58 !important;
  background: transparent !important;
  font: inherit !important;
  text-align: left !important;
  cursor: pointer !important;
}

html body .app-shell .map-chapter-menu button:hover,
html body .app-shell .map-chapter-menu button:focus-visible,
html body .app-shell .map-chapter-menu-option:hover,
html body .app-shell .map-chapter-menu-option:focus-visible {
  border-color: rgba(13, 126, 116, 0.17) !important;
  background: rgba(230, 247, 239, 0.82) !important;
  box-shadow: 0 0 0 3px rgba(39, 187, 151, 0.08) !important;
}

html body .app-shell .map-chapter-menu button[aria-selected="true"],
html body .app-shell .map-chapter-menu button[aria-current="true"],
html body .app-shell .map-chapter-menu-option.is-selected {
  border-color: rgba(13, 135, 121, 0.2) !important;
  color: #075b61 !important;
  background: linear-gradient(145deg, rgba(226, 247, 237, 0.96), rgba(242, 251, 247, 0.92)) !important;
}

html body .app-shell .map-chapter-menu-icon {
  display: inline-grid !important;
  width: 34px !important;
  height: 34px !important;
  place-items: center !important;
  border: 1px solid rgba(10, 110, 105, 0.12) !important;
  border-radius: 11px !important;
  color: #0a8278 !important;
  background: rgba(231, 247, 240, 0.88) !important;
}

html body .app-shell .map-chapter-menu-icon svg {
  width: 16px !important;
  height: 16px !important;
}

html body .app-shell .map-chapter-menu-copy {
  display: grid !important;
  min-width: 0 !important;
  gap: 2px !important;
}

html body .app-shell .map-chapter-menu-copy strong,
html body .app-shell .map-chapter-menu-copy small {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell .map-chapter-menu-copy strong {
  color: inherit !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
}

html body .app-shell .map-chapter-menu-copy small {
  color: #678185 !important;
  font-size: 0.64rem !important;
  font-weight: 600 !important;
}

html body .app-shell .map-chapter-menu-badge {
  display: inline-flex !important;
  min-height: 24px !important;
  padding: 5px 8px !important;
  align-items: center !important;
  border: 1px solid rgba(16, 148, 119, 0.15) !important;
  border-radius: 999px !important;
  color: #087361 !important;
  background: rgba(214, 244, 229, 0.9) !important;
  font-size: 0.55rem !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
}

html body .app-shell .map-chapter-menu-actions {
  display: grid !important;
  margin-top: 3px !important;
  padding-top: 8px !important;
  gap: 5px !important;
  border-top: 1px solid var(--active-trip-line) !important;
}

html body .app-shell .map-chapter-menu-actions button {
  grid-template-columns: 26px minmax(0, 1fr) 16px !important;
}

/* Active-trip and trip-entry surfaces ------------------------------------ */

html body .active-trip-dialog,
html body .trip-entry-dialog {
  box-sizing: border-box !important;
  width: min(640px, calc(100vw - 32px)) !important;
  max-width: 640px !important;
  max-height: min(850px, calc(100dvh - 32px)) !important;
  margin: auto !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid rgba(111, 183, 173, 0.3) !important;
  border-radius: 29px !important;
  color: var(--active-trip-ink) !important;
  background:
    radial-gradient(circle at 94% 3%, rgba(67, 218, 171, 0.16), transparent 31%),
    linear-gradient(148deg, #fffef8 0%, #f3faf6 60%, #e9f6f2 100%) !important;
  box-shadow:
    0 30px 86px rgba(1, 28, 39, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
}

html body .active-trip-dialog[hidden],
html body .trip-entry-dialog[hidden] {
  display: none !important;
}

html body .active-trip-dialog::backdrop,
html body .trip-entry-dialog::backdrop {
  background:
    radial-gradient(circle at 76% 10%, rgba(56, 211, 168, 0.14), transparent 34%),
    rgba(2, 24, 34, 0.68) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.04) !important;
  backdrop-filter: blur(12px) saturate(1.04) !important;
}

html body .active-trip-panel,
html body .trip-entry-panel {
  box-sizing: border-box !important;
  display: grid !important;
  width: 100% !important;
  max-height: min(850px, calc(100dvh - 32px)) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

html body .active-trip-header,
html body .trip-entry-header {
  display: grid !important;
  padding: 24px 25px 15px !important;
  grid-template-columns: minmax(0, 1fr) 44px !important;
  align-items: start !important;
  gap: 16px !important;
}

html body .active-trip-header-copy,
html body .trip-entry-header-copy {
  display: grid !important;
  min-width: 0 !important;
  gap: 5px !important;
}

html body .active-trip-kicker,
html body .trip-entry-kicker {
  color: #128274 !important;
  font-size: 0.62rem !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  letter-spacing: 0.11em !important;
  text-transform: uppercase !important;
}

html body .active-trip-header h2,
html body .trip-entry-header h2 {
  margin: 0 !important;
  color: var(--active-trip-ink) !important;
  font-size: clamp(1.55rem, 4vw, 2.15rem) !important;
  font-weight: 850 !important;
  line-height: 1.04 !important;
  letter-spacing: -0.038em !important;
}

html body .active-trip-header p,
html body .trip-entry-header p {
  max-width: 52ch !important;
  margin: 0 !important;
  color: var(--active-trip-muted) !important;
  font-size: 0.78rem !important;
  font-weight: 590 !important;
  line-height: 1.45 !important;
}

html body .active-trip-close,
html body .trip-entry-close {
  box-sizing: border-box !important;
  display: inline-grid !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  place-items: center !important;
  border: 1px solid rgba(8, 80, 87, 0.15) !important;
  border-radius: 15px !important;
  color: #315f64 !important;
  background: rgba(255, 255, 251, 0.84) !important;
  cursor: pointer !important;
}

html body .active-trip-close:hover,
html body .active-trip-close:focus-visible,
html body .trip-entry-close:hover,
html body .trip-entry-close:focus-visible {
  border-color: rgba(9, 139, 124, 0.34) !important;
  color: #075a60 !important;
  box-shadow: 0 0 0 3px rgba(40, 198, 159, 0.1) !important;
}

html body .active-trip-close svg,
html body .trip-entry-close svg {
  width: 19px !important;
  height: 19px !important;
}

html body .active-trip-body,
html body .trip-entry-body {
  box-sizing: border-box !important;
  min-height: 0 !important;
  padding: 8px 25px 24px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch !important;
}

html body .active-trip-fields {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

html body .active-trip-fields > label,
html body .active-trip-field {
  display: grid !important;
  min-width: 0 !important;
  gap: 7px !important;
  color: #315d64 !important;
  font-size: 0.7rem !important;
  font-weight: 760 !important;
  line-height: 1.3 !important;
}

html body .active-trip-fields > label.is-wide,
html body .active-trip-field.is-wide {
  grid-column: 1 / -1 !important;
}

html body .active-trip-fields input,
html body .active-trip-fields select,
html body .active-trip-fields textarea {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 48px !important;
  padding: 12px 14px !important;
  border: 1px solid rgba(11, 91, 95, 0.17) !important;
  border-radius: 15px !important;
  outline: none !important;
  color: #123f49 !important;
  background: rgba(255, 255, 252, 0.91) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  font: inherit !important;
  font-size: 0.8rem !important;
  font-weight: 620 !important;
}

html body .active-trip-fields textarea {
  min-height: 92px !important;
  resize: vertical !important;
}

html body .active-trip-fields input:focus,
html body .active-trip-fields select:focus,
html body .active-trip-fields textarea:focus {
  border-color: rgba(12, 149, 127, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(50, 199, 163, 0.12) !important;
}

html body .active-trip-field-hint {
  color: #6a8386 !important;
  font-size: 0.64rem !important;
  font-weight: 560 !important;
  line-height: 1.4 !important;
}

html body .active-trip-trust {
  display: flex !important;
  margin: 16px 0 0 !important;
  padding: 12px 13px !important;
  align-items: flex-start !important;
  gap: 9px !important;
  border: 1px solid rgba(15, 142, 116, 0.13) !important;
  border-radius: 15px !important;
  color: #527478 !important;
  background: rgba(226, 246, 237, 0.72) !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
}

html body .active-trip-trust svg {
  width: 17px !important;
  height: 17px !important;
  flex: 0 0 17px !important;
  color: #0b8d7b !important;
}

html body .trip-entry-options {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 13px !important;
}

html body .trip-entry-option {
  box-sizing: border-box !important;
  display: grid !important;
  min-width: 0 !important;
  min-height: 164px !important;
  padding: 18px !important;
  align-content: start !important;
  gap: 8px !important;
  border: 1px solid rgba(9, 104, 102, 0.15) !important;
  border-radius: 21px !important;
  color: #164f58 !important;
  background:
    radial-gradient(circle at 92% 4%, rgba(68, 216, 172, 0.14), transparent 39%),
    rgba(255, 255, 252, 0.83) !important;
  box-shadow: 0 11px 26px rgba(4, 58, 65, 0.08) !important;
  font: inherit !important;
  text-align: left !important;
  cursor: pointer !important;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease !important;
}

html body .trip-entry-option:hover,
html body .trip-entry-option:focus-visible {
  border-color: rgba(14, 154, 130, 0.37) !important;
  box-shadow: 0 14px 31px rgba(4, 58, 65, 0.12), 0 0 0 3px rgba(52, 204, 165, 0.1) !important;
  transform: translateY(-2px) !important;
}

html body .trip-entry-option-icon {
  display: inline-grid !important;
  width: 42px !important;
  height: 42px !important;
  place-items: center !important;
  border: 1px solid rgba(255, 255, 255, 0.72) !important;
  border-radius: 14px !important;
  color: #fffef8 !important;
  background: linear-gradient(145deg, #43d5ad, #14968f 60%, #0a6b79) !important;
  box-shadow: 0 7px 16px rgba(8, 111, 106, 0.2) !important;
}

html body .trip-entry-option-icon svg {
  width: 19px !important;
  height: 19px !important;
}

html body .trip-entry-option strong {
  color: #0a4954 !important;
  font-size: 0.9rem !important;
  font-weight: 820 !important;
  line-height: 1.2 !important;
}

html body .trip-entry-option small {
  color: #628084 !important;
  font-size: 0.7rem !important;
  font-weight: 580 !important;
  line-height: 1.45 !important;
}

html body .active-trip-footer,
html body .trip-entry-footer {
  display: flex !important;
  min-height: 72px !important;
  padding: 13px 25px calc(15px + env(safe-area-inset-bottom, 0px)) !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 9px !important;
  border-top: 1px solid rgba(10, 97, 96, 0.11) !important;
  background: rgba(250, 253, 248, 0.9) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  backdrop-filter: blur(16px) !important;
}

html body .active-trip-footer button,
html body .trip-entry-footer button {
  box-sizing: border-box !important;
  min-height: 48px !important;
  padding: 11px 16px !important;
  border-radius: 15px !important;
  font: inherit !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  cursor: pointer !important;
}

html body .active-trip-primary,
html body .trip-entry-primary {
  border: 1px solid rgba(75, 222, 180, 0.26) !important;
  color: #fff !important;
  background: linear-gradient(135deg, #075566 0%, #0a847b 58%, #1bab79 100%) !important;
  box-shadow: 0 10px 23px rgba(7, 105, 97, 0.2) !important;
}

html body .active-trip-secondary,
html body .trip-entry-secondary {
  border: 1px solid rgba(9, 88, 91, 0.14) !important;
  color: #456d72 !important;
  background: rgba(255, 255, 252, 0.82) !important;
}

html body .active-trip-footer button:hover,
html body .active-trip-footer button:focus-visible,
html body .trip-entry-footer button:hover,
html body .trip-entry-footer button:focus-visible {
  box-shadow: 0 10px 24px rgba(5, 77, 77, 0.16), 0 0 0 3px rgba(49, 203, 163, 0.1) !important;
}

/* Active-trip association inside the existing memory editor. */
html body .app-shell .active-trip-editor-chip {
  box-sizing: border-box !important;
  display: inline-flex !important;
  width: fit-content !important;
  max-width: 100% !important;
  min-height: 44px !important;
  margin: 9px 0 0 !important;
  padding: 7px 11px !important;
  align-items: center !important;
  gap: 8px !important;
  overflow: hidden !important;
  border: 1px solid rgba(14, 135, 117, 0.2) !important;
  border-radius: 999px !important;
  color: #07635f !important;
  background: linear-gradient(145deg, rgba(233, 249, 241, 0.98), rgba(250, 253, 248, 0.95)) !important;
  box-shadow: 0 7px 18px rgba(7, 87, 83, 0.09) !important;
  font: inherit !important;
  font-size: 0.7rem !important;
  font-weight: 790 !important;
  line-height: 1.1 !important;
  cursor: pointer !important;
}

html body .app-shell .active-trip-editor-chip::before {
  content: "" !important;
  width: 8px !important;
  height: 8px !important;
  flex: 0 0 8px !important;
  border-radius: 50% !important;
  background: #22b985 !important;
  box-shadow: 0 0 0 4px rgba(34, 185, 133, 0.12) !important;
}

html body .app-shell .active-trip-editor-chip > span,
html body .app-shell .active-trip-editor-chip strong {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell .active-trip-editor-chip svg {
  width: 15px !important;
  height: 15px !important;
  flex: 0 0 15px !important;
  color: rgba(7, 99, 95, 0.72) !important;
}

html body .app-shell .active-trip-editor-chip:hover,
html body .app-shell .active-trip-editor-chip:focus-visible,
html body .app-shell .active-trip-editor-chip[aria-expanded="true"] {
  border-color: rgba(11, 149, 125, 0.4) !important;
  box-shadow: 0 8px 20px rgba(7, 87, 83, 0.11), 0 0 0 3px rgba(49, 199, 160, 0.1) !important;
}

/* Route stops ------------------------------------------------------------ */

html body .app-shell .active-trip-route-stop,
html body .app-shell .maplibregl-marker:has(.active-trip-route-stop) {
  box-sizing: border-box !important;
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
}

html body .app-shell .active-trip-route-stop {
  position: relative !important;
  display: grid !important;
  padding: 0 !important;
  place-items: center !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 50% !important;
  color: #fffef8 !important;
  background: transparent !important;
  filter: drop-shadow(0 6px 10px rgba(2, 38, 47, 0.2)) !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
}

html body .app-shell .active-trip-route-stop::before,
html body .app-shell .active-trip-route-stop .active-trip-stop-dot {
  content: attr(data-stop-number) !important;
  box-sizing: border-box !important;
  display: grid !important;
  width: 30px !important;
  height: 30px !important;
  place-items: center !important;
  border: 3px solid rgba(255, 254, 248, 0.96) !important;
  border-radius: 50% !important;
  color: #fffef8 !important;
  background: linear-gradient(145deg, #3ed2aa, #0d8d88 62%, #075f70) !important;
  box-shadow:
    0 0 0 4px rgba(31, 178, 139, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.32) !important;
  font-size: 0.65rem !important;
  font-weight: 880 !important;
  line-height: 1 !important;
}

html body .app-shell .active-trip-route-stop:has(.active-trip-stop-dot)::before {
  display: none !important;
}

html body .app-shell .active-trip-route-stop:hover::before,
html body .app-shell .active-trip-route-stop:focus-visible::before,
html body .app-shell .active-trip-route-stop.is-selected::before,
html body .app-shell .active-trip-route-stop:hover .active-trip-stop-dot,
html body .app-shell .active-trip-route-stop:focus-visible .active-trip-stop-dot,
html body .app-shell .active-trip-route-stop.is-selected .active-trip-stop-dot {
  box-shadow:
    0 0 0 6px rgba(255, 254, 248, 0.64),
    0 0 0 11px rgba(33, 186, 146, 0.22),
    0 9px 20px rgba(2, 42, 50, 0.2) !important;
  transform: scale(1.06) !important;
}

html body .app-shell .active-trip-route-stop:focus-visible {
  outline: 2px solid #ffffff !important;
  outline-offset: 1px !important;
}

html body .app-shell .active-trip-route-stop .active-trip-stop-day {
  position: absolute !important;
  top: 5px !important;
  left: 37px !important;
  display: inline-flex !important;
  width: max-content !important;
  min-height: 28px !important;
  padding: 6px 9px !important;
  align-items: center !important;
  border: 1px solid rgba(255, 255, 255, 0.7) !important;
  border-radius: 999px !important;
  color: #f8fffc !important;
  background: rgba(4, 54, 64, 0.91) !important;
  box-shadow: 0 7px 17px rgba(2, 35, 43, 0.18) !important;
  font-size: 0.59rem !important;
  font-weight: 820 !important;
  line-height: 1 !important;
  letter-spacing: 0.045em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  pointer-events: none !important;
  -webkit-backdrop-filter: blur(11px) !important;
  backdrop-filter: blur(11px) !important;
}

html body .app-shell .active-trip-route,
html body .app-shell .active-trip-route-glow,
html body .app-shell .active-trip-route-core {
  fill: none !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  pointer-events: none !important;
}

html body .app-shell .active-trip-route-glow {
  stroke: rgba(255, 254, 239, 0.78) !important;
  stroke-width: 9px !important;
  opacity: 0.88 !important;
}

html body .app-shell .active-trip-route-core,
html body .app-shell .active-trip-route:not(.active-trip-route-glow) {
  stroke: #0c9b88 !important;
  stroke-width: 3.4px !important;
  opacity: 0.86 !important;
  filter: drop-shadow(0 2px 4px rgba(4, 83, 82, 0.18)) !important;
}

/* Chapter-scoped selected-memory card ------------------------------------ */

html body .app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory {
  position: absolute !important;
  right: auto !important;
  bottom: clamp(104px, 12vh, 122px) !important;
  left: var(--active-trip-side-left) !important;
  z-index: 721 !important;
  box-sizing: border-box !important;
  display: grid !important;
  width: min(440px, calc(100vw - var(--active-trip-side-left) - var(--active-trip-side-right) - 112px)) !important;
  min-width: 0 !important;
  min-height: 92px !important;
  max-width: 440px !important;
  height: auto !important;
  max-height: 104px !important;
  margin: 0 !important;
  padding: 10px 11px !important;
  grid-template-columns: 58px minmax(0, 1fr) 44px !important;
  align-items: center !important;
  gap: 11px !important;
  overflow: hidden !important;
  border: 1px solid rgba(10, 104, 102, 0.17) !important;
  border-radius: 23px !important;
  color: var(--active-trip-ink) !important;
  background:
    radial-gradient(circle at 100% 0%, rgba(65, 213, 169, 0.14), transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 251, 0.97), rgba(238, 249, 245, 0.96)) !important;
  box-shadow:
    0 18px 43px rgba(3, 34, 44, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
  text-align: left !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.05) !important;
  backdrop-filter: blur(18px) saturate(1.05) !important;
  transform: translateY(12px) scale(0.985) !important;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease !important;
}

html body .app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory.show,
html body main.app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory.show {
  transform: translateY(0) scale(1) !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory:hover,
html body .app-shell .memory-peek-card.is-chapter-memory:focus-visible {
  box-shadow:
    0 20px 47px rgba(3, 34, 44, 0.2),
    0 0 0 3px rgba(51, 201, 163, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.98) !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-media,
html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-media {
  box-sizing: border-box !important;
  width: 58px !important;
  height: 58px !important;
  min-width: 58px !important;
  min-height: 58px !important;
  overflow: hidden !important;
  border: 1px solid rgba(9, 98, 99, 0.14) !important;
  border-radius: 17px !important;
  background: linear-gradient(145deg, #dff4eb, #cceae2) !important;
  box-shadow: 0 7px 16px rgba(5, 70, 76, 0.12) !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-media img,
html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy {
  display: grid !important;
  min-width: 0 !important;
  align-content: center !important;
  gap: 2px !important;
  overflow: hidden !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-kicker,
html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-kicker {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: #0a8a7d !important;
  font-size: 0.58rem !important;
  font-weight: 850 !important;
  line-height: 1.2 !important;
  letter-spacing: 0.08em !important;
  text-overflow: ellipsis !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy strong {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: var(--active-trip-ink) !important;
  font-size: 0.83rem !important;
  font-weight: 830 !important;
  line-height: 1.18 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy small {
  display: block !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: #607d81 !important;
  font-size: 0.65rem !important;
  font-weight: 640 !important;
  line-height: 1.25 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy em {
  display: none !important;
}

html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-open,
html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-open {
  display: inline-grid !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  place-items: center !important;
  border-radius: 12px !important;
  color: #fffef8 !important;
  background: linear-gradient(145deg, #3dcda5, #0c8f89) !important;
  box-shadow: 0 7px 16px rgba(7, 112, 105, 0.18) !important;
}

html body .app-shell .active-trip-selected-card {
  bottom: calc(var(--bottom-nav-height, 84px) + env(safe-area-inset-bottom) + 20px) !important;
  max-width: min(460px, calc(100% - 150px)) !important;
}

html body .app-shell .active-trip-selected-card-open {
  display: inline-flex !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  padding: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  color: #fffef8 !important;
  font-size: 1.15rem !important;
  font-style: normal !important;
  font-weight: 820 !important;
  line-height: 1 !important;
  text-align: center !important;
}

html body .app-shell .active-trip-pin-day {
  position: absolute !important;
  top: 36px !important;
  left: 50% !important;
  z-index: 4 !important;
  display: inline-flex !important;
  min-width: 34px !important;
  min-height: 18px !important;
  padding: 3px 6px !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(255, 255, 255, 0.86) !important;
  border-radius: 999px !important;
  color: #f7fffc !important;
  background: rgba(4, 62, 72, 0.9) !important;
  box-shadow: 0 5px 12px rgba(2, 31, 40, 0.2) !important;
  font-size: 0.48rem !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  transform: translateX(-50%) !important;
  pointer-events: none !important;
}

html body .app-shell .is-selected-memory-marker {
  filter: drop-shadow(0 0 8px rgba(255, 254, 240, 0.94)) drop-shadow(0 0 15px rgba(18, 177, 146, 0.66)) !important;
}

/* A modal or phone chapter menu owns the interaction lane. Map controls
   cannot remain underneath and accidentally receive taps. */
html body:has(.active-trip-dialog[open]) .app-shell .map-depth-switch,
html body:has(.active-trip-dialog[open]) .app-shell .map-navigation-gadget,
html body:has(.active-trip-dialog[open]) .app-shell .map-chapter-selector,
html body:has(.active-trip-dialog[open]) .app-shell .memory-peek-card,
html body:has(.trip-entry-dialog[open]) .app-shell .map-depth-switch,
html body:has(.trip-entry-dialog[open]) .app-shell .map-navigation-gadget,
html body:has(.trip-entry-dialog[open]) .app-shell .map-chapter-selector,
html body:has(.trip-entry-dialog[open]) .app-shell .memory-peek-card {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* iPad and other coarse tablets ------------------------------------------ */

@media (min-width: 721px) and (max-width: 1024px), (hover: none) and (pointer: coarse) and (min-width: 721px) and (max-width: 1180px) {
  html body .app-shell section.map-stage.map-focus {
    --active-trip-side-left: max(16px, env(safe-area-inset-left, 0px));
    --active-trip-side-right: max(16px, env(safe-area-inset-right, 0px));
    --active-trip-top-lane: calc(72px + env(safe-area-inset-top, 0px));
    --active-trip-depth-reserve: 112px;
  }

  html body .app-shell section.map-stage.map-focus .map-chapter-selector,
  html body main.app-shell section.map-stage.map-focus .map-chapter-selector {
    position: fixed !important;
    width: min(340px, calc(100vw - var(--active-trip-side-left) - var(--active-trip-side-right) - var(--active-trip-depth-reserve))) !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory {
    position: fixed !important;
    right: auto !important;
    bottom: var(--active-trip-bottom-lane) !important;
    left: var(--active-trip-side-left) !important;
    width: min(430px, calc(100vw - var(--active-trip-side-left) - var(--active-trip-side-right) - 102px)) !important;
    max-width: 430px !important;
  }
}

/* Phone ------------------------------------------------------------------ */

@media (max-width: 720px) {
  html body .app-shell section.map-stage.map-focus {
    --active-trip-side-left: max(14px, env(safe-area-inset-left, 0px));
    --active-trip-side-right: max(14px, env(safe-area-inset-right, 0px));
    --active-trip-top-lane: calc(72px + env(safe-area-inset-top, 0px));
    --active-trip-depth-reserve: 104px;
    --active-trip-bottom-lane: calc(var(--bottom-nav-height, 78px) + env(safe-area-inset-bottom, 0px) + 20px);
  }

  html body .app-shell section.map-stage.map-focus .map-chapter-selector,
  html body main.app-shell section.map-stage.map-focus .map-chapter-selector {
    position: fixed !important;
    width: calc(100vw - var(--active-trip-side-left) - var(--active-trip-side-right) - var(--active-trip-depth-reserve)) !important;
    max-width: 340px !important;
  }

  html body .app-shell #mapChapterSelectorButton {
    min-height: 44px !important;
    padding-inline: 10px !important;
    grid-template-columns: 9px minmax(0, 1fr) 16px !important;
    gap: 8px !important;
    border-radius: 14px !important;
  }

  html body .app-shell #mapChapterSelectorButton strong,
  html body .app-shell #mapChapterSelectorButton .map-chapter-selector-title {
    font-size: 0.7rem !important;
  }

  html body .app-shell #mapChapterSelectorButton small,
  html body .app-shell #mapChapterSelectorButton .map-chapter-selector-eyebrow {
    font-size: 0.53rem !important;
  }

  html body .app-shell .map-chapter-menu {
    position: fixed !important;
    top: auto !important;
    right: var(--active-trip-side-right) !important;
    bottom: calc(var(--bottom-nav-height, 78px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
    left: var(--active-trip-side-left) !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(60dvh, 490px) !important;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 24px !important;
  }

  html body:has(.map-chapter-menu:not([hidden])) .app-shell section.map-stage.map-focus .map-navigation-gadget,
  html body:has(.map-chapter-menu:not([hidden])) .app-shell section.map-stage.map-focus .memory-peek-card {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  html body .active-trip-dialog {
    width: 100% !important;
    max-width: 100% !important;
    height: var(--mymappi-visible-height, 100dvh) !important;
    max-height: var(--mymappi-visible-height, 100dvh) !important;
    border-width: 0 !important;
    border-radius: 0 !important;
  }

  html body .active-trip-panel {
    height: var(--mymappi-visible-height, 100dvh) !important;
    max-height: var(--mymappi-visible-height, 100dvh) !important;
  }

  html body .trip-entry-dialog {
    width: calc(100vw - 18px) !important;
    max-width: calc(100vw - 18px) !important;
    max-height: min(74dvh, 610px) !important;
    margin: auto 9px max(9px, env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 25px !important;
  }

  html body .trip-entry-panel {
    max-height: min(74dvh, 610px) !important;
  }

  html body .active-trip-header,
  html body .trip-entry-header {
    padding: max(18px, env(safe-area-inset-top, 0px)) 18px 13px !important;
    gap: 11px !important;
  }

  html body .trip-entry-header {
    padding-top: 19px !important;
  }

  html body .active-trip-header h2,
  html body .trip-entry-header h2 {
    font-size: clamp(1.45rem, 7.5vw, 1.95rem) !important;
  }

  html body .active-trip-body,
  html body .trip-entry-body {
    padding: 7px 18px 20px !important;
  }

  html body .active-trip-fields,
  html body .trip-entry-options {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  html body .trip-entry-option {
    min-height: 118px !important;
    padding: 15px !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    align-items: center !important;
  }

  html body .trip-entry-option-icon {
    grid-row: 1 / 3 !important;
  }

  html body .active-trip-footer,
  html body .trip-entry-footer {
    padding-inline: 18px !important;
  }

  html body .active-trip-footer button,
  html body .trip-entry-footer button {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    padding-inline: 12px !important;
  }

  html body .app-shell .active-trip-editor-chip {
    width: 100% !important;
    justify-content: center !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory {
    position: fixed !important;
    right: calc(var(--active-trip-side-right) + 102px) !important;
    bottom: var(--active-trip-bottom-lane) !important;
    left: var(--active-trip-side-left) !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 92px !important;
    min-height: 92px !important;
    max-height: 92px !important;
    padding: 9px !important;
    grid-template-columns: 48px minmax(0, 1fr) 44px !important;
    gap: 8px !important;
    border-radius: 22px !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-media,
  html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-media {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 14px !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-open,
  html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-open {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 10px !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy strong {
    font-size: 0.73rem !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy small {
    font-size: 0.58rem !important;
  }

  html body .app-shell .active-trip-route-stop .active-trip-stop-day {
    left: 36px !important;
    max-width: 92px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

@media (max-width: 380px) {
  html body .app-shell section.map-stage.map-focus {
    --active-trip-side-left: max(12px, env(safe-area-inset-left, 0px));
    --active-trip-side-right: max(12px, env(safe-area-inset-right, 0px));
    --active-trip-depth-reserve: 100px;
  }

  html body .app-shell #mapChapterSelectorButton small,
  html body .app-shell #mapChapterSelectorButton .map-chapter-selector-eyebrow {
    display: none !important;
  }

  html body .app-shell #mapChapterSelectorButton > span,
  html body .app-shell #mapChapterSelectorButton .map-chapter-selector-copy {
    gap: 0 !important;
  }

  html body .active-trip-footer,
  html body .trip-entry-footer {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html body .app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory {
    right: calc(var(--active-trip-side-right) + 98px) !important;
    padding: 8px !important;
    grid-template-columns: 42px minmax(0, 1fr) 44px !important;
    gap: 7px !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-media,
  html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-media {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-open,
  html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-open {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }

  html body .app-shell .memory-peek-card.is-chapter-memory .center-memory-preview-kicker,
  html body .app-shell .memory-peek-card.is-chapter-memory .chapter-memory-kicker {
    display: none !important;
  }

  html body .app-shell .active-trip-route-stop .active-trip-stop-day {
    display: none !important;
  }

  html body .app-shell .active-trip-route-stop.is-selected .active-trip-stop-day {
    display: inline-flex !important;
  }
}

/* Short landscape phones retain both bottom navigation and map controls. */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 960px) {
  html body .app-shell section.map-stage.map-focus {
    --active-trip-top-lane: calc(64px + env(safe-area-inset-top, 0px));
    --active-trip-bottom-lane: calc(var(--bottom-nav-height, 68px) + env(safe-area-inset-bottom, 0px) + 12px);
  }

  html body .app-shell section.map-stage.map-focus .map-chapter-selector,
  html body main.app-shell section.map-stage.map-focus .map-chapter-selector {
    max-width: min(55vw, 340px) !important;
  }

  html body .app-shell .map-chapter-menu {
    max-height: calc(100dvh - var(--active-trip-top-lane) - var(--active-trip-bottom-lane) - 12px) !important;
  }

  html body .active-trip-dialog {
    width: calc(100vw - 18px) !important;
    max-width: 720px !important;
    height: calc(100dvh - 18px) !important;
    max-height: calc(100dvh - 18px) !important;
    border-width: 1px !important;
    border-radius: 23px !important;
  }

  html body .active-trip-panel {
    height: calc(100dvh - 18px) !important;
    max-height: calc(100dvh - 18px) !important;
  }

  html body .active-trip-header {
    padding: 14px 18px 10px !important;
  }

  html body .active-trip-header p {
    display: none !important;
  }

  html body .active-trip-body {
    padding: 4px 18px 14px !important;
  }

  html body .active-trip-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html body .active-trip-footer {
    min-height: 62px !important;
    padding-block: 8px !important;
  }
}

/* Accessibility and motion ---------------------------------------------- */

@media (prefers-contrast: more) {
  html body .app-shell #mapChapterSelectorButton,
  html body .app-shell .map-chapter-menu,
  html body .active-trip-dialog,
  html body .trip-entry-dialog,
  html body .app-shell .memory-peek-card.is-chapter-memory {
    border-width: 2px !important;
  }

  html body .app-shell .map-chapter-menu-copy small,
  html body .active-trip-header p,
  html body .trip-entry-header p,
  html body .active-trip-field-hint,
  html body .app-shell .memory-peek-card.is-chapter-memory .peek-copy small {
    color: #315f65 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .app-shell #mapChapterSelectorButton,
  html body .app-shell #mapChapterSelectorButton > svg,
  html body .app-shell #mapChapterSelectorButton .map-chapter-selector-chevron,
  html body .app-shell .trip-entry-option,
  html body .app-shell .active-trip-route-stop::before,
  html body .app-shell .active-trip-route-stop .active-trip-stop-dot,
  html body .app-shell .memory-peek-card.is-chapter-memory,
  html body .active-trip-footer button,
  html body .trip-entry-footer button {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  html body .app-shell .active-trip-route,
  html body .app-shell .active-trip-route-glow,
  html body .app-shell .active-trip-route-core {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    animation: none !important;
  }
}

/* Native selector production lock: keep the selector inside the protected
   Active Trip row after the broader responsive rules above. */
@media (max-width: 1024px) {
  html body .app-shell section.map-stage.map-focus .active-trip-bar {
    position: fixed !important;
    top: var(--active-trip-top-lane) !important;
    right: calc(var(--active-trip-side-right) + var(--active-trip-depth-reserve)) !important;
    left: var(--active-trip-side-left) !important;
  }

  html body .app-shell section.map-stage.map-focus .active-trip-bar .map-chapter-selector {
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    max-width: none !important;
  }
}

@media (min-width: 721px) and (max-width: 1024px) {
  html body .app-shell .active-trip-bar {
    max-width: calc(100vw - 150px) !important;
  }
}

@media (max-width: 720px) {
  html body .app-shell .active-trip-finish {
    width: 44px !important;
    min-width: 44px !important;
    padding: 0 !important;
  }

  html body .app-shell .active-trip-finish > span:last-child {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }

}

/* Final interaction and layout locks ------------------------------------ */

html body .app-shell section.map-stage.map-focus:has(#activeTripBar:not([hidden])) .you-are-here-message,
html body main.app-shell section.map-stage.map-focus:has(#activeTripBar:not([hidden])) .you-are-here-message {
  top: calc(var(--active-trip-top-lane) + 52px) !important;
}

html body .active-trip-form-status {
  min-height: 1.35em !important;
}

html body .app-shell .active-trip-editor-chip {
  width: fit-content !important;
  cursor: default !important;
}

html body .app-shell .active-trip-editor-chip:hover,
html body .app-shell .active-trip-editor-chip:focus-visible,
html body .app-shell .active-trip-editor-chip[aria-expanded="true"] {
  border-color: rgba(14, 135, 117, 0.2) !important;
  outline: 0 !important;
  box-shadow: 0 7px 18px rgba(7, 87, 83, 0.09) !important;
}

html body .app-shell .active-trip-route-stop,
html body .app-shell .maplibregl-marker:has(.active-trip-route-stop) {
  pointer-events: none !important;
  cursor: default !important;
}

@media (min-width: 721px) and (max-width: 1024px) {
  html body .app-shell section.map-stage.map-focus .active-trip-bar,
  html body main.app-shell section.map-stage.map-focus .active-trip-bar {
    width: min(468px, calc(100vw - 150px)) !important;
    max-width: min(468px, calc(100vw - 150px)) !important;
  }

  html body .app-shell section.map-stage.map-focus .active-trip-bar .map-chapter-selector,
  html body main.app-shell section.map-stage.map-focus .active-trip-bar .map-chapter-selector {
    width: min(340px, 100%) !important;
    max-width: 340px !important;
  }
}

@media (max-width: 720px) {
  html body .trip-entry-option {
    grid-template-columns: 42px minmax(0, 1fr) 18px !important;
    grid-template-rows: 1fr !important;
    min-height: 96px !important;
  }

  html body .trip-entry-option-icon {
    grid-row: auto !important;
  }

  html body .trip-entry-option > [data-icon="arrow-right"] {
    justify-self: end !important;
  }

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

  html body .app-shell .memory-peek-card.is-chapter-memory .active-trip-selected-card-open,
  html body main.app-shell .memory-peek-card.is-chapter-memory .active-trip-selected-card-open {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 12px !important;
  }
}

@media (max-width: 380px) {
  html body .app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory,
  html body main.app-shell section.map-stage.map-focus .memory-peek-card.is-chapter-memory {
    grid-template-columns: 42px minmax(0, 1fr) 44px !important;
  }
}

/* Equal desktop chapter-card baselines. Titles and factual subtitles may
   wrap, but every Open chapter action finishes on the same visual line. */
@media (min-width: 721px) and (hover: hover) and (pointer: fine) {
  html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-card,
  html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-card {
    grid-template-rows: 194px minmax(0, 1fr) !important;
    align-content: stretch !important;
    height: 100% !important;
  }

  html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-copy,
  html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-copy {
    grid-template-rows: minmax(54px, auto) minmax(30px, auto) minmax(56px, 1fr) !important;
    align-content: stretch !important;
    height: 100% !important;
  }

  html body .app-shell .map-stage.home-focus #homeJourney .life-chapter-actions,
  html body main.app-shell section.map-stage.home-focus #homeJourney .life-chapter-actions {
    align-self: end !important;
    align-content: end !important;
    margin-top: auto !important;
  }
}

/* Give the primary trip entry enough presence to balance the Life Chapters
   section without turning it into an oversized promotional banner. */
html body .app-shell #homeJourney .life-chapter-trip-start {
  width: min(100%, 300px) !important;
  min-height: 54px !important;
  padding: 8px 14px 8px 9px !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  font-size: 0.76rem !important;
}

html body .app-shell #homeJourney .life-chapter-trip-start-icon {
  width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px !important;
  border-radius: 12px !important;
}

html body .app-shell #homeJourney .life-chapter-trip-start-icon svg {
  width: 17px !important;
  height: 17px !important;
}

html body .app-shell #homeJourney .life-chapter-trip-start-label {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
  text-align: center !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell #homeJourney .life-chapter-trip-start-arrow {
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 16px !important;
}

@media (min-width: 721px) {
  html body .app-shell #homeJourney .life-chapter-trip-start {
    width: min(100%, 340px) !important;
    min-height: 56px !important;
    padding-inline: 10px 16px !important;
    font-size: 0.8rem !important;
  }
}

/* The chapter lens belongs in Search, not as a persistent layer over the map. */
html body .app-shell .map-stage.map-focus .pin-search-panel.open,
html body main.app-shell section.map-stage.map-focus .pin-search-panel.open {
  grid-template-rows: auto auto auto minmax(0, 1fr) !important;
}

html body .app-shell .pin-search-chapter-filter,
html body main.app-shell .pin-search-chapter-filter {
  box-sizing: border-box !important;
  display: grid !important;
  min-width: 0 !important;
  min-height: 62px !important;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 220px) !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 9px 10px 9px 13px !important;
  border: 1px solid rgba(216, 255, 244, 0.16) !important;
  border-radius: 17px !important;
  background: rgba(255, 255, 255, 0.065) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

html body .app-shell .pin-search-chapter-filter[hidden],
html body main.app-shell .pin-search-chapter-filter[hidden] {
  display: none !important;
}

html body .app-shell .pin-search-chapter-copy {
  display: grid !important;
  min-width: 0 !important;
  gap: 2px !important;
}

html body .app-shell .pin-search-chapter-copy strong {
  color: #f4fffc !important;
  font-size: 0.7rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
}

html body .app-shell .pin-search-chapter-copy small {
  overflow: hidden !important;
  color: rgba(230, 251, 246, 0.68) !important;
  font-size: 0.58rem !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .app-shell section.map-stage.map-focus #pinSearchPanel .map-chapter-selector,
html body main.app-shell section.map-stage.map-focus #pinSearchPanel .map-chapter-selector {
  position: static !important;
  inset: auto !important;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  flex: none !important;
  pointer-events: auto !important;
}

html body .app-shell #pinSearchPanel #mapChapterSelector,
html body main.app-shell #pinSearchPanel #mapChapterSelector {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 8px 30px 8px 12px !important;
  border: 1px solid rgba(175, 240, 220, 0.2) !important;
  border-radius: 13px !important;
  color: #f6fffc !important;
  background: rgba(4, 46, 58, 0.76) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
  font: inherit !important;
  font-size: 0.66rem !important;
  font-weight: 760 !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis !important;
}

html body .app-shell #pinSearchPanel #mapChapterSelector:focus-visible,
html body main.app-shell #pinSearchPanel #mapChapterSelector:focus-visible {
  border-color: rgba(132, 242, 196, 0.62) !important;
  outline: 3px solid rgba(132, 242, 196, 0.15) !important;
  outline-offset: 2px !important;
}

@media (max-width: 520px) {
  html body .app-shell .pin-search-chapter-filter,
  html body main.app-shell .pin-search-chapter-filter {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 7px !important;
    padding: 10px !important;
  }

  html body .app-shell .pin-search-chapter-copy {
    padding-inline: 2px !important;
  }
}

/* Keep required map attribution visible above the desktop navigation rail. */
@media (min-width: 1025px) and (hover: hover) and (pointer: fine) {
  html body .app-shell .map-stage.map-focus .maplibregl-ctrl-bottom-left,
  html body main.app-shell section.map-stage.map-focus .maplibregl-ctrl-bottom-left {
    left: 12px !important;
    bottom: calc(122px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 120 !important;
  }
}
