.arrival-card {
  container-type: inline-size;
  overflow: hidden;
}
.arrival-update-status {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.arrival-stop {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--separator);
  background: var(--panel-2);
  border-radius: var(--radius-group);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  margin: 6px 0 14px;
}
.arrival-stop span:first-child {
  min-width: 0;
}
.arrival-stop small {
  display: block;
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 650;
  margin-bottom: 4px;
}
.arrival-stop b {
  display: block;
  font-size: 1rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.arrival-columns,
.arrival-line {
  display: grid;
  grid-template-columns: 3.4rem minmax(0, 1fr) minmax(4.8rem, auto);
  gap: 8px 10px;
  align-items: center;
}
.arrival-columns {
  padding: 4px 12px 8px;
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 650;
}
.arrival-columns span:last-child {
  text-align: right;
}
.arrival-lines {
  border-radius: var(--radius-inset);
  background: var(--panel);
  overflow: hidden;
  min-height: 60px;
}
.arrival-line {
  position: relative;
  padding: 16px 12px;
  border-bottom: 1px solid var(--separator);
}
.arrival-toggle {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  border-radius: 0;
  min-height: 44px;
}
.arrival-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -3px;
}
.arrival-line:not(.expanded) .arrival-second {
  display: none;
}
.arrival-second {
  grid-column: 2/-1;
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: var(--muted);
  font-size: var(--type-caption);
}
.arrival-line.expanded {
  background: var(--surface-secondary);
}
.arrival-line.imminent .arrival-dest > small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--type-caption);
}
.station-service {
  display: grid;
  justify-items: center;
  gap: 4px;
}
.station-service > small {
  font-size: var(--type-caption);
  color: var(--muted);
}
.arrival-minutes {
  color: var(--blue);
}
.arrival-line.imminent .arrival-minutes span:first-child {
  animation: arrival-imminent 1.4s ease-in-out infinite;
}
@keyframes arrival-imminent {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
html[data-app-hidden="true"] .arrival-line.imminent .arrival-minutes span {
  animation-play-state: paused;
}
.arrival-line:last-child {
  border-bottom: 0;
}
.arrival-service {
  min-width: 0;
  align-self: start;
  display: flex;
  justify-content: flex-start;
}
.arrival-route-badge,
.arrival-rail-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  min-height: 34px;
  padding: 6px 7px;
  border-radius: var(--radius-small);
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--color-on-line);
  background: var(--line-color, var(--line-citybus));
}
.arrival-rail-badge {
  color: var(--color-kintetsu);
  background: color-mix(in srgb, var(--color-kintetsu) 12%, var(--panel));
  font-size: 0.75rem;
  white-space: normal;
}
.arrival-dest {
  min-width: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}
.arrival-dest b {
  font-weight: 650;
}
.arrival-minutes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.1;
  white-space: nowrap;
}
.arrival-minutes > span {
  display: block;
}
.arrival-minutes b {
  font-size: var(--type-arrival);
  font-weight: 750;
  letter-spacing: -0.04em;
}
.arrival-minutes small {
  margin-left: 3px;
  font-size: var(--type-caption);
  font-weight: 600;
}
.arrival-minutes > span + span {
  color: var(--muted);
}
.arrival-minutes > span + span b {
  font-size: 0.9375rem;
}
.arrival-minutes .arrival-unconfirmed {
  max-width: 100px;
  white-space: normal;
  font-size: 0.75rem;
  line-height: 1.4;
}
.arrival-line.delayed .arrival-delay {
  color: var(--color-danger);
}
.arrival-delay {
  grid-column: 3;
  font-size: var(--type-caption);
  text-align: right;
  color: var(--muted);
  line-height: 1.4;
}
.arrival-details {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--muted);
  font-size: var(--type-caption);
  line-height: 1.5;
}
.arrival-service {
  grid-column: 1;
  grid-row: 1;
}
.arrival-dest {
  grid-column: 2;
  grid-row: 1;
}
.arrival-minutes {
  grid-column: 3;
  grid-row: 1;
}
.arrival-source {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--muted);
  font-size: var(--type-caption);
  line-height: 1.5;
}
.arrival-source-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.source-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-round);
  display: inline-block;
  flex: 0 0 auto;
  background: var(--muted);
}
.source-dot.live {
  background: var(--green);
}
.source-dot.prediction {
  background: var(--orange);
}
.source-dot.schedule {
  background: var(--muted);
}
.arrival-approach {
  grid-column: 1 / -1;
  padding: 4px 0 2px;
}
.arrival-track-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: var(--type-caption);
  margin-bottom: 8px;
}
.arrival-track {
  position: relative;
  height: 22px;
  margin: 0 13px;
}
.arrival-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 2px;
  background: var(--separator);
}
.arrival-track-stops {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.arrival-track-stops i {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-round);
  background: var(--muted);
}
.arrival-track-stops i:last-child {
  width: 8px;
  height: 8px;
  background: var(--blue);
  box-shadow: var(--shadow-focus);
}
.arrival-track-position {
  width: 100%;
  height: 100%;
  transform: translateX(var(--approach-position));
  transition: transform 0.65s cubic-bezier(0.22, 0.8, 0.25, 1);
}
.arrival-track-vehicle {
  display: grid;
  place-items: center;
  position: absolute;
  left: -13px;
  top: -2px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-compact);
  background: var(--transport-color, var(--color-citybus));
  color: var(--color-on-transport);
  box-shadow: var(--shadow-arrival-marker);
}
.arrival-track-vehicle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.arrival-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
}
.arrival-empty > span {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--blue);
}
.arrival-empty svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.arrival-empty p {
  max-width: 260px;
  margin: 12px auto 4px;
  font-size: 0.8125rem;
  line-height: 1.6;
}
.arrival-empty button {
  min-height: 44px;
  padding: 10px 16px;
}
.arrival-skeleton {
  display: grid;
  gap: 12px;
  padding: 20px 14px;
}
.arrival-skeleton i {
  display: block;
  height: 34px;
  border-radius: var(--radius-small);
  background: var(--separator);
  animation: arrival-loading 1.4s ease-in-out infinite alternate;
}
.arrival-skeleton i:nth-child(2) {
  width: 86%;
  animation-delay: 0.12s;
}
.arrival-skeleton i:nth-child(3) {
  width: 68%;
  animation-delay: 0.24s;
}
@keyframes arrival-loading {
  to {
    opacity: 0.35;
  }
}
.stale-warning {
  margin: 4px 2px 10px;
  padding: 9px 11px;
  border-radius: var(--radius-small);
  background: color-mix(in srgb, var(--orange) 11%, transparent);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.5;
}
.arrival-compact {
  container-type: inline-size;
  display: grid;
  gap: 8px;
}
.arrival-compact > div,
.arrival-compact > button {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  font-size: 0.8125rem;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  width: 100%;
  min-height: 52px;
  border-bottom: 1px solid var(--separator);
}
.arrival-compact > div:last-child,
.arrival-compact > button:last-child {
  border-bottom: 0;
}
.arrival-compact .arrival-route-badge {
  min-width: 0;
  width: 100%;
  font-size: 0.875rem;
}
.arrival-compact span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.arrival-compact span > b {
  display: block;
  font-size: 0.875rem;
}
.arrival-compact small {
  display: block;
  font-size: var(--type-caption);
  color: var(--muted);
  margin-top: 6px;
}
.arrival-compact strong {
  font-size: 1.125rem;
  white-space: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stop-route-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0;
  margin: 10px 0;
  -webkit-overflow-scrolling: touch;
}
/* Filter capsules as in iOS Maps: filled gray, selected filled with tint. */
.stop-route-chips button {
  flex: none;
  min-width: 52px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-capsule);
  background: var(--fill-tertiary);
  color: var(--text);
  padding: 8px 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stop-route-chips button:active {
  background: var(--fill-secondary);
}
.stop-route-chips button.active {
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.stop-section-heading {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 650;
}
.arrival-compact strong small {
  margin-top: 2px;
  font-weight: 500;
}
.bus-stop-preview {
  margin: 18px 0;
}
.bus-stop-preview h2 {
  font-size: 1.125rem;
  margin: 10px 0;
}
.bus-stop-preview .plain-action {
  min-height: 44px;
}
@container (max-width: 18rem) {
  .arrival-compact > div,
  .arrival-compact > button {
    grid-template-columns: 3rem minmax(0, 1fr);
  }
  .arrival-compact strong {
    grid-column: 2;
    font-size: 1rem;
  }
}
.ride-approach {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.debug-live {
  margin-top: 10px;
  border-radius: var(--radius-control);
  background: var(--panel-2);
  overflow: hidden;
}
.debug-live.hidden {
  display: none;
}
.debug-live > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--separator);
  font-size: var(--type-caption);
}
.debug-live > div:last-child {
  border-bottom: 0;
}
.debug-live span {
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}
#arrivals-root {
  padding: 4px 0 2px;
}
@media (max-width: 520px) {
  .arrival-columns {
    display: none;
  }
  .arrival-line {
    padding: 16px 12px;
  }
}
@media (max-width: 350px) {
  .arrival-line {
    gap: 8px;
    padding: 14px 10px;
  }
}
/* Large text keeps destinations complete and the arrival value prominent. */
@container (max-width: 18rem) {
  .arrival-line {
    grid-template-columns: 3.4rem minmax(0, 1fr);
  }
  .arrival-service {
    grid-column: 1;
    grid-row: 1;
  }
  .arrival-dest {
    grid-column: 2;
    grid-row: 1;
  }
  .arrival-minutes {
    grid-column: 2;
    grid-row: 2;
  }
  .arrival-details {
    grid-column: 2;
    grid-row: 3;
  }
  .arrival-delay {
    grid-column: 1;
    grid-row: 3;
  }
  .arrival-source {
    grid-column: 1 / -1;
  }
  .arrival-line.group-start .arrival-minutes {
    grid-row: 3;
  }
  .arrival-line.group-start .arrival-details,
  .arrival-line.group-start .arrival-delay {
    grid-row: 4;
  }
}
@media (prefers-color-scheme: dark) {
  .arrival-rail-badge {
    color: var(--color-kintetsu);
  }
}
@media (prefers-reduced-motion: reduce) {
  .arrival-line.imminent .arrival-minutes span:first-child {
    animation: none;
  }
  .arrival-track-position {
    transition: none;
  }
  .arrival-skeleton i {
    animation: none;
  }
}
.arrival-compact small > .source-dot {
  margin-right: 5px;
  vertical-align: 1px;
}

/* Approach timeline: preceding stops top to bottom, buses on their stop. */
.approach-stops-card {
  margin-top: 16px;
  padding: 4px 16px 8px;
  border-radius: var(--radius-inset);
  background: var(--panel);
}
.approach-stops {
  margin: 0;
  padding: 0;
  list-style: none;
}
.approach-stops li {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}
.approach-stops li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--line-color);
  opacity: 0.35;
}
.approach-stops li:first-child::before {
  top: 50%;
}
.approach-stops li.here::before {
  bottom: 50%;
}
.approach-stop-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  justify-self: center;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line-color);
  border-radius: var(--radius-round);
  background: var(--panel);
}
.approach-stops li.bus .approach-stop-dot {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-compact);
  background: var(--line-color);
  color: var(--color-on-line);
  box-shadow: var(--shadow-arrival-marker);
}
.approach-stop-dot svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.approach-stops li.here .approach-stop-dot {
  width: 16px;
  height: 16px;
  border-width: 4px;
}
.approach-stops b {
  font-size: var(--type-secondary);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.approach-stops li.here b {
  font-weight: 750;
}
.approach-stops small {
  color: var(--muted);
  font-size: var(--type-caption);
  text-align: right;
}
.approach-stops li.bus small {
  color: var(--color-link);
  font-weight: 650;
}
.arrival-line[data-line] .arrival-track-vehicle {
  background: var(--line-color);
  color: var(--color-on-line);
}

/* Direction of a bus service: 甲 or 乙 only. */
.bus-dir {
  display: inline-block;
  margin-inline-end: 6px;
  padding: 0 6px;
  border-radius: var(--radius-capsule);
  background: var(--fill-tertiary);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.bus-dir[data-side="kou"] {
  background: var(--color-ats-soft);
}
.stop-poles {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-radius: var(--radius-row);
  background: var(--separator);
}
.stop-pole {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 14px;
  background: var(--surface-primary);
}
.stop-pole-dir {
  display: grid;
  min-width: 6.5rem;
}
.stop-pole-dir small {
  color: var(--muted);
  font-size: var(--type-caption);
  overflow-wrap: anywhere;
}
.stop-pole-routes {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.stop-pole-board {
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 700;
}

/* Today's service has ended at this stop. */
.service-ended {
  display: grid;
  gap: 2px;
  margin: 6px 0;
  padding: 10px 12px;
  border-radius: var(--radius-row);
  background: var(--fill-tertiary);
  color: var(--text);
  font-size: var(--type-caption);
}
.service-ended small {
  color: var(--muted);
}
