/* Stability layer: loaded last so it can safely constrain legacy/vNext component rules. */
html,
body,
.app-shell,
main,
.view {
  max-width: 100%;
  overflow-x: clip;
}
button,
input,
select {
  min-width: 0;
}
.topbar,
.section-heading,
.planner-result-head {
  min-width: 0;
}
.topbar-copy,
.section-heading > div,
.service-title > div {
  min-width: 0;
}
.section-block,
.planner-form,
.planner-result,
.native-list,
.operation-card,
.settings-card,
.hero-card {
  width: 100%;
  max-width: 100%;
}
.view > * {
  max-width: 100%;
}
.section-heading :is(h2, h3),
.service-title h2,
.board-place {
  overflow-wrap: anywhere;
}
.next-stop-grid strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.2;
}
.arrival-lines {
  contain: layout style;
}
.arrival-line {
  contain: layout;
  min-height: 64px;
}
.arrival-service,
.arrival-dest,
.arrival-minutes,
.arrival-delay {
  min-width: 0;
}
.bus-service b {
  font-size: 0.75rem;
}
.arrival-minutes {
  font-variant-numeric: tabular-nums lining-nums;
}
.planner-quality {
  min-width: 12px;
  justify-content: flex-end;
}
.planner-quality .source-dot {
  margin: 0;
}
.planner-result,
.section-block {
  overflow: hidden;
}
.planner-form input,
.planner-form select,
.board-controls select {
  max-width: 100%;
}
.stop-list time,
.train-row .delay {
  font-variant-numeric: tabular-nums;
}
.native-row > span:nth-child(2) {
  min-width: 0;
}
.native-row b,
.native-row small {
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabbar {
  max-width: calc(100% - 22px);
}
@media (max-width: 520px) {
  main {
    padding-left: 10px;
    padding-right: 10px;
  }
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }
  .topbar h1 {
    font-size: 1.9375rem;
  }
  .hero-card {
    border-radius: var(--radius-surface);
    padding: 20px 17px;
    margin-bottom: 12px;
  }
  .hero-card h2 {
    font-size: 1.6875rem;
  }
  .section-block {
    padding: 15px;
    border-radius: var(--radius-vehicle);
    margin-bottom: 11px;
  }
  .section-heading {
    gap: 9px;
  }
  .section-heading :is(h2, h3) {
    font-size: 1.25rem;
  }
  .service-title {
    gap: 10px;
  }
  .service-title h2 {
    font-size: 1.4375rem;
  }
  .next-stop-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(65px, 0.8fr) minmax(
        52px,
        0.62fr
      );
    gap: 6px;
  }
  .next-stop-grid strong {
    font-size: 1.125rem;
  }
  .planner-times {
    gap: 6px;
  }
  .planner-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .board-controls {
    grid-template-columns: 1fr;
  }
  .hour-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .hour-row > div {
    gap: 2px 6px;
  }
  .minute-cell {
    min-width: 44px;
    padding: 4px 2px;
  }
  .bus-service b {
    font-size: 0.6875rem;
  }
  .tabbar {
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    bottom: calc(var(--safe-bottom) + 7px);
  }
}
@media (max-width: 370px) {
  .planner-swap {
    width: 100%;
    height: 32px;
  }
  .next-stop-grid {
    grid-template-columns: 1fr 1fr;
  }
  .next-stop-grid > div:last-child {
    grid-column: 1/-1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .view,
  .hero-card.detecting::after,
  .pulse-dot,
  .thin-progress i {
    animation: none !important;
  }
}
