/* iOS/WKWebView uses a visual viewport that can be shorter than its layout viewport.
   Lift persistent app chrome by that difference so it is visible before the first scroll. */
@media (max-width: 760px) {
  /* Passport hierarchy: identity, then the useful numbers, then actions. */
  body[data-view="passport"] .passport-hero {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
  }

  body[data-view="passport"] .passport-hero-copy {
    display: contents !important;
  }

  body[data-view="passport"] .passport-hero-copy > .eyebrow {
    order: 1;
    width: 100%;
    margin-bottom: 8px !important;
    text-align: center;
  }
  body[data-view="passport"] .passport-hero-copy > h1 {
    order: 2;
    width: 100%;
    margin: 0 !important;
    text-align: center;
  }
  body[data-view="passport"] .passport-hero-copy > .intro {
    order: 3;
    width: 100%;
    margin: 14px 0 0 !important;
    text-align: center;
  }
  body[data-view="passport"] .passport-stats {
    order: 4;
    width: 100% !important;
    margin: 22px 0 0 !important;
  }
  body[data-view="passport"] .passport-primary-actions {
    order: 5;
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    margin: 14px 0 0 !important;
  }
  body[data-view="passport"] .passport-primary-actions button {
    width: 100% !important;
    min-height: 48px;
  }

  .mobile-tabbar {
    position: fixed !important;
    inset: auto 0 var(--visual-viewport-bottom, 0px) 0 !important;
    width: 100% !important;
    min-height: var(--mobile-nav) !important;
    transform: translateZ(0);
    will-change: bottom;
  }

  .app-main {
    padding-bottom: calc(var(--mobile-nav) + env(safe-area-inset-bottom) + var(--visual-viewport-bottom, 0px)) !important;
  }

  .library-detail-pane {
    bottom: calc(var(--mobile-nav) + env(safe-area-inset-bottom) + var(--visual-viewport-bottom, 0px)) !important;
  }

  .global-save-status {
    bottom: calc(var(--mobile-nav) + env(safe-area-inset-bottom) + var(--visual-viewport-bottom, 0px) + 12px) !important;
  }

  /* The map is the visual anchor, but should not consume nearly the full first screen. */
  body[data-view="explore"] .map-stage,
  body[data-view="explore"] .map-stage #discovery-map {
    height: 36dvh !important;
    min-height: 235px !important;
    max-height: 330px !important;
  }

  body[data-view="explore"] .map-stage .map-shell {
    min-height: 235px !important;
  }

  body[data-view="explore"] .explore-panel {
    padding: 15px 14px 10px !important;
  }

  body[data-view="explore"] .explore-heading h1 {
    font-size: 30px !important;
    line-height: 1 !important;
  }

  body[data-view="explore"] .explore-heading > p:last-child {
    margin: 7px 0 13px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  body[data-view="explore"] .nearby-button,
  body[data-view="explore"] .explore-controls .search-form input,
  body[data-view="explore"] .explore-controls .search-form button {
    min-height: 48px !important;
  }

  body[data-view="explore"] .explore-controls .search-form {
    margin-bottom: 8px !important;
  }

  body[data-view="explore"] .hours-filter,
  body[data-view="explore"] .surprise-card {
    padding: 13px !important;
  }
}

@media (max-width: 390px) {
  body[data-view="explore"] .map-stage,
  body[data-view="explore"] .map-stage #discovery-map {
    height: 33dvh !important;
    min-height: 215px !important;
  }

  .mobile-tabbar button small {
    font-size: 10px !important;
  }
}
