.mobile-tabs {
  display: none;
}

/* Injected by mobile.js; only ever shown inside the mobile detail view. */
.mobile-detail-header {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --mobile-tabs-h: 64px;
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body {
    background: var(--panel);
  }

  .app-shell {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    height: 100dvh;
    min-height: 100svh;
    overflow: hidden;
    background: var(--paper);
  }

  .nav-panel,
  .map-stage,
  .detail-panel {
    position: absolute;
    inset: 0 0 var(--mobile-tabs-h);
    width: 100%;
    min-width: 0;
    height: auto;
    border: 0;
    display: none;
  }

  .app-shell[data-mobile-view="list"] .nav-panel,
  .app-shell[data-mobile-view="map"] .map-stage,
  .app-shell[data-mobile-view="detail"] .detail-panel {
    display: flex;
  }

  .app-shell[data-mobile-view="map"] .map-stage {
    display: block;
  }

  .brand {
    flex: 0 0 auto;
    padding: 10px 16px 6px;
  }

  .brand-line {
    gap: 8px;
  }

  .brand-mark {
    font-size: 1.45rem;
  }

  .brand-trip {
    font-size: 0.78rem;
  }

  .brand-stats {
    margin-top: 5px;
    font-size: 0.72rem;
  }

  .mode-switch {
    flex: 0 0 auto;
    margin: 10px 14px 0;
    padding: 3px;
  }

  .mode-switch button {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 0.76rem;
  }

  .day-rail {
    flex: 0 0 auto;
    gap: 6px;
    padding: 8px 14px 8px;
    scrollbar-width: none;
  }

  .day-rail::-webkit-scrollbar {
    display: none;
  }

  .day-chip {
    width: 66px;
    min-height: 46px;
    padding: 6px 9px;
  }

  .day-chip .date {
    font-size: 0.78rem;
    line-height: 1.1;
  }

  .day-chip .city {
    font-size: 0.63rem;
    line-height: 1.1;
  }

  .panel-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 22px;
  }

  .day-head {
    padding: 10px 16px 4px;
  }

  .day-head h2 {
    font-size: 1.22rem;
    line-height: 1.06;
  }

  /* Real element is .day-sub (the old .day-summary rule never matched). */
  .day-head .day-sub {
    font-size: 0.8rem;
    line-height: 1.35;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .day-head .route-chips {
    margin-top: 8px;
  }

  /* Sunset / weather — keep the info, drop the desktop-oriented print button,
     and keep it to one tight line instead of wrapping. */
  .day-toolkit {
    margin-top: 8px;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .day-toolkit::-webkit-scrollbar {
    display: none;
  }

  .day-toolkit .tool-print {
    display: none;
  }

  .search-row,
  .filter-row,
  .city-filter-row {
    padding-left: 14px;
    padding-right: 14px;
  }

  .filter-row,
  .city-filter-row {
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-row::-webkit-scrollbar,
  .city-filter-row::-webkit-scrollbar {
    display: none;
  }

  .timeline {
    padding: 10px 10px 18px;
  }

  .timeline-stop {
    grid-template-columns: 44px minmax(0, 1fr) 50px;
    gap: 8px;
    min-height: 64px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .stop-time {
    font-size: 0.68rem;
  }

  .stop-name {
    font-size: 0.92rem;
  }

  .stop-note {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }

  .stop-body .badges {
    margin-top: 5px;
  }

  .stop-thumb {
    width: 46px;
    height: 46px;
    border-radius: 8px;
  }

  .choice-rail {
    margin-left: 0;
  }

  .choice-card {
    min-width: 178px;
  }

  .mood-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .map-stage {
    background: #d8d0bf;
  }

  #map {
    inset: 0;
  }

  .map-topbar {
    top: calc(10px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    gap: 7px;
  }

  .map-btn {
    flex: 1 1 0;
    justify-content: center;
    min-height: 40px;
    padding: 8px 9px;
    font-size: 0.76rem;
    white-space: nowrap;
  }

  .map-legend {
    left: 10px;
    right: 10px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
  }

  .legend-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mapboxgl-ctrl-bottom-right {
    bottom: 82px;
  }

  .mapboxgl-ctrl-bottom-left {
    bottom: 10px;
  }

  .hover-card {
    display: none !important;
  }

  .play-hud {
    left: 10px;
    right: 10px;
    bottom: 16px;
    width: auto;
    transform: none;
  }

  .play-hud-row {
    gap: 9px;
  }

  .play-hud-title {
    font-size: 1rem;
  }

  .cinema-caption {
    left: 12px;
    right: 12px;
    bottom: 18px;
    width: auto;
    padding: 12px;
  }

  .cinema-photo {
    flex-basis: 78px;
    width: 78px;
    height: 78px;
  }

  .detail-panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--panel);
  }

  /* Sticky contextual back header — matches the tab bar's treatment. */
  .mobile-detail-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 12px;
    background: rgba(252, 250, 244, 0.92);
    border-bottom: 1px solid rgba(33, 30, 25, 0.12);
    backdrop-filter: blur(16px);
  }

  .mobile-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 8px 0 4px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font-family: "Hanken Grotesk", system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
  }

  .mobile-back svg {
    width: 18px;
    height: 18px;
  }

  .mobile-detail-title {
    flex: 1 1 auto;
    min-width: 0;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.1;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Slide the place in when it is pushed on top of Plan/Map. */
  @keyframes planfDetailIn {
    from { transform: translateX(100%); opacity: 0.4; }
    to { transform: none; opacity: 1; }
  }

  .app-shell[data-mobile-view="detail"] .detail-panel {
    animation: planfDetailIn 0.22s ease both;
    will-change: transform;
  }

  .detail-empty {
    min-height: 100%;
    padding: 34px 22px;
  }

  .detail-empty h2 {
    font-size: 1.5rem;
  }

  .place-detail {
    min-height: 100%;
  }

  .detail-hero {
    height: 220px;
  }

  .hero-overlay {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .hero-maps {
    bottom: 10px;
    right: 10px;
    min-height: 38px;
  }

  .hero-dots {
    bottom: 46px;
  }

  .detail-body {
    padding: 16px 16px 26px;
  }

  .detail-title-row {
    gap: 10px;
  }

  .detail-title-row h2 {
    font-size: 1.55rem;
    line-height: 1.08;
  }

  .glance {
    grid-template-columns: 1fr;
  }

  .personal-head,
  .personal-bar {
    flex-wrap: wrap;
  }

  .pbtn {
    min-height: 38px;
    flex: 1 1 auto;
    justify-content: center;
  }

  .media-actions {
    grid-template-columns: 1fr;
  }

  .sameday-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
  }

  .mobile-tabs {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    min-height: var(--mobile-tabs-h);
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(33, 30, 25, 0.12);
    background: rgba(252, 250, 244, 0.96);
    box-shadow: 0 -10px 26px rgba(33, 30, 25, 0.12);
    backdrop-filter: blur(16px);
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
  }

  .mobile-tab svg {
    width: 19px;
    height: 19px;
  }

  .mobile-tab[aria-selected="true"] {
    background: var(--accent);
    color: #fff;
  }
}

@media (max-width: 360px) {
  .timeline-stop {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .timeline-stop .stop-thumb {
    display: none;
  }

  .brand-line {
    display: block;
  }

  .brand-trip {
    margin-top: 3px;
  }
}

@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .app-shell[data-mobile-view="detail"] .detail-panel {
    animation: none;
  }
}
