/* Dedicated onboard displays share the existing Now view and data sources. */
[data-view="now"] {
  display: flex;
  flex-direction: column;
}
#now-hero {
  order: 0;
}
#ride-actions {
  order: 1;
}
#vehicle-panel {
  order: 2;
}
#network-panel {
  order: 2;
}
#arrivals-root {
  order: 3;
}
#nearby-panel {
  order: 4;
}
[data-context="nearby"] #vehicle-panel {
  order: 0;
}
.armed-journey {
  scroll-margin-top: calc(4.8rem + 26px);
}
[data-context="nearby"] #nearby-panel {
  order: 2;
}
.journey-table-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--separator);
  color: var(--muted);
  font-size: var(--type-caption);
}
.journey-stop-list li {
  grid-template-columns: 44px minmax(0, 1fr) minmax(76px, auto);
  gap: 8px;
  min-height: 62px;
}
.journey-stop-list li:not(:last-child)::before {
  bottom: -35px;
}
.journey-stop-list b {
  overflow-wrap: anywhere;
}
.journey-stop-list .stop-times {
  text-align: right;
}
.journey-stop-list .stop-times small {
  color: var(--muted);
  font-size: var(--type-caption);
  margin-top: 4px;
}
.journey-stop-list .current .rail-dot {
  background: var(--green);
  border-color: var(--green);
  box-shadow: var(--shadow-live-ring);
}
.journey-stops .plain-action {
  flex-shrink: 0;
  font-size: 0.8125rem;
  padding: 0 4px;
}
.nearby-guide {
  box-shadow: none;
  padding: 14px;
}
.nearby-guide .section-heading :is(h2, h3) {
  font-size: 0.9375rem;
}
.nearby-row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  min-height: 60px;
  background: transparent;
  border: 0;
  text-align: left;
  border-top: 1px solid var(--separator);
}
.nearby-row .mode-symbol {
  width: 36px;
  height: 36px;
  font-weight: 750;
  font-size: 0.875rem;
}
.nearby-row b {
  display: block;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.nearby-row small {
  display: block;
  color: var(--muted);
  font-size: var(--type-caption);
  line-height: 1.4;
  margin-top: 3px;
  overflow-wrap: anywhere;
}
.live-track-detail summary {
  font-size: 0.8125rem;
  color: var(--blue);
  display: flex;
  align-items: center;
  cursor: pointer;
}
.foldback-plan {
  border-color: color-mix(in srgb, var(--blue) 28%, var(--separator));
}
.foldback-plan .native-row {
  padding: 6px 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.foldback-plan.missed,
.foldback-plan.tight {
  border-color: var(--orange);
}
.foldback-plan.missed .native-row small {
  color: var(--red);
}
.foldback-plan b,
.foldback-plan small {
  overflow-wrap: anywhere;
}
.sheet {
  max-height: min(82dvh, 760px);
}
.sheet-close,
.sheet-back {
  min-height: 44px;
}
.sheet-close {
  min-width: 44px;
}
.choice-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.choice-row b,
.choice-row small {
  overflow-wrap: anywhere;
}
.fold-step {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 17px 0 12px;
}
.fold-step > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: var(--radius-round);
  font-size: 0.75rem;
  font-weight: 750;
}
.fold-step > b {
  font-size: 1rem;
}
.fold-direction {
  font-size: 0.75rem;
  color: var(--muted);
}
#foldback-body .primary-action {
  width: 100%;
  min-height: 48px;
}
#foldback-body .secondary-action {
  min-height: 44px;
}
.sheet-field select {
  width: 100%;
  min-height: 46px;
}
.target-train {
  grid-template-columns: 63px minmax(0, 1fr) 68px;
  gap: 9px;
  padding: 15px 3px;
  min-height: 76px;
  border-radius: var(--radius-small);
  transition: background 0.15s;
}
.target-train:hover,
.target-train:active {
  background: var(--panel-2);
}
.target-train > b {
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.target-train b > small {
  color: var(--muted);
  font-size: var(--type-caption);
  display: block;
  margin-top: 4px;
}
.target-train strong {
  display: block;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.target-train span > small {
  display: block;
  font-size: var(--type-caption);
  margin-top: 5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.target-train .fold-margin {
  color: var(--blue);
  font-size: var(--type-caption);
  text-align: right;
  line-height: 1.5;
}
.fold-margin.tight {
  color: var(--color-warning);
}
.fold-margin.missed {
  color: var(--red);
}
.target-result > span {
  font-size: 0.8125rem;
  font-weight: 750;
}
.target-result.possible > span {
  color: var(--color-success);
}
.target-result.tight > span {
  color: var(--color-warning);
}
.target-result.missed > span {
  color: var(--red);
}
.target-result.unknown > span {
  color: var(--muted);
}
.fold-timing {
  margin: 16px 0 0;
}
.fold-timing > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--separator);
}
.fold-timing dt {
  font-size: 0.75rem;
  color: var(--muted);
}
.fold-timing dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 370px) {
  .target-train {
    grid-template-columns: 59px minmax(0, 1fr) 58px;
    gap: 5px;
  }
}
@media (prefers-color-scheme: dark) {
  .target-result.possible > span {
    color: var(--green);
  }
  .target-result.tight > span,
  .fold-margin.tight {
    color: var(--orange);
  }
}
@media (prefers-reduced-motion: reduce) {
  .target-train {
    transition: none;
  }
}

.app-update {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius-inset);
  background: var(--panel);
  box-shadow: var(--shadow-next-stop);
  font-size: 0.875rem;
}
.app-update[hidden] {
  display: none;
}
.app-update > span {
  min-width: 0;
}
.app-update .secondary-action {
  flex-shrink: 0;
  min-height: 44px;
}
.nearby-summary {
  margin: 0 0 8px;
  padding-left: 46px;
  line-height: 1.5;
}
.compact-departures > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}
.compact-departures > div > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.compact-departures > div > b {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
  text-align: right;
}
.compact-departures > div > b small {
  display: block;
  font-size: var(--type-caption);
  color: var(--muted);
  font-weight: 400;
}
.nearby-departures {
  padding: 0 0 10px 46px;
  display: grid;
  gap: 4px;
}
.nearby-departures > div > span {
  color: var(--muted);
  font-size: 0.75rem;
}
.nearby-departures p {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 6px 0;
  min-width: 0;
}
.nearby-departures time {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.nearby-departures p > span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
}
.nearby-departures .source-note {
  display: block;
}
.foldback-plan > .secondary-action {
  margin: 8px 0;
  width: 100%;
  white-space: normal;
}
@media (max-width: 370px) {
  .app-update {
    flex-wrap: wrap;
  }
  .app-update .secondary-action {
    width: 100%;
  }
}

/* Shared Now components: the next stop stays at a fixed position between states. */
[data-context="rail"] #network-panel {
  order: 1;
}
[data-context="rail"] #vehicle-panel {
  order: 2;
}
#now-search {
  order: -1;
}
.itinerary-guide {
  margin: 12px 0;
}
.itinerary-summary {
  min-height: 72px;
}
.itinerary-summary .itinerary-warning {
  color: var(--orange);
}
.journey-display {
  --journey-accent: var(--transport-color);
  --route-tint: color-mix(
    in srgb,
    var(--journey-accent) 8%,
    var(--surface-primary)
  );
  padding: 14px;
  border-radius: var(--radius-sheet);
}
.journey-display.rail {
  --journey-accent: var(--transport-color);
  --route-tint: color-mix(
    in srgb,
    var(--journey-accent) 8%,
    var(--surface-primary)
  );
}
.journey-display.bus {
  --journey-accent: var(--transport-color);
  --route-tint: color-mix(
    in srgb,
    var(--journey-accent) 8%,
    var(--surface-primary)
  );
}
.journey-display::after {
  display: none;
}
.route-header {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  margin-bottom: 14px;
}
.route-header > div {
  flex: 1;
  min-width: 0;
}
.route-header h2 {
  font-size: 0.875rem;
  line-height: 1.4;
  margin: 0;
  letter-spacing: 0;
}
.route-header h2 span {
  display: inline;
  overflow-wrap: anywhere;
}
.route-header p {
  font-size: 0.75rem;
  line-height: 1.5;
}
.route-tokens {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}
.route-token {
  min-width: 36px;
  min-height: 36px;
  padding: 5px;
  border-radius: var(--radius-small);
  display: inline-grid;
  place-items: center;
  color: var(--color-on-transport);
  font-size: 1.1rem;
  font-weight: 800;
}
.route-token.small {
  min-width: 30px;
  min-height: 30px;
}
.route-token.line-k {
  background: var(--line-subway);
  color: var(--color-on-line);
}
.route-token.line-b {
  background: var(--line-kintetsu);
  color: var(--color-on-line);
}
.route-token.line-bus {
  background: var(--line-color, var(--transport-color));
  color: var(--color-on-line);
}
.route-tokens.boundary .route-token {
  font-size: 0.8rem;
}
.status-pill {
  display: inline-block;
  border-radius: var(--radius-capsule);
  padding: 4px 7px;
  font-size: var(--type-caption);
  line-height: 1.4;
  background: var(--panel-2);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.status-pill.confirmed {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 10%, var(--panel));
}
.status-pill.stale {
  color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 10%, var(--panel));
}
.next-station-hero {
  padding: 16px 10px 12px;
  text-align: center;
  border-radius: var(--radius-inset);
  background: var(--route-tint);
  transition: background-color 280ms ease;
}
/* Rail: an onboard LCD (dark in both appearances, like the real display). */
.next-station-hero.lcd {
  padding: 0 0 16px;
  overflow: hidden;
  background: var(--lcd-background);
  color: var(--lcd-text);
}
.lcd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--lcd-panel);
  border-bottom: 3px solid var(--journey-accent);
  font-weight: 700;
  text-align: left;
}
.lcd-type {
  padding: 2px 10px;
  border-radius: var(--radius-tiny);
  background: var(--journey-accent);
  color: var(--color-on-transport);
  font-size: var(--type-caption);
}
.lcd-dest {
  font-size: var(--type-secondary);
  overflow-wrap: anywhere;
}
.next-station-hero.lcd .next-state-label {
  margin-top: 14px;
  color: var(--lcd-next);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}
.journey-display[data-rail-phase] .next-station-hero.lcd .next-state-label {
  color: var(--lcd-next);
}
.journey-display[data-rail-phase="estimated"] .next-station-hero.lcd .next-state-label,
.journey-display[data-rail-phase="unavailable"] .next-station-hero.lcd .next-state-label {
  color: var(--lcd-dim);
}
.next-station-hero.lcd .journey-next-name {
  color: var(--lcd-text);
  font-size: 2.5rem;
  letter-spacing: 0.02em;
}
.next-station-hero.lcd .station-code {
  background: transparent;
  color: var(--lcd-text);
}
.next-station-hero.lcd .next-countdown {
  color: var(--lcd-text);
}
.next-station-hero.lcd .destination-progress,
.next-station-hero.lcd .terminal-arrival {
  color: var(--lcd-dim);
}
/* Rail line: the next stations with a gliding train marker. */
.ride-line[data-kind="rail"] {
  position: relative;
  height: 74px;
  margin: 18px 34px 0;
}
.ride-line[data-kind="rail"] ol {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ride-line[data-kind="rail"] ol::before {
  content: "";
  position: absolute;
  inset: 9px 0 auto;
  height: 4px;
  border-radius: var(--radius-capsule);
  background: linear-gradient(
    to right,
    var(--journey-accent) var(--progress, 0%),
    var(--lcd-rule) var(--progress, 0%)
  );
  transition: background 1.2s ease;
}
.ride-line[data-kind="rail"] li {
  position: absolute;
  left: var(--at);
  top: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 76px;
  transform: translateX(-50%);
  color: var(--lcd-dim);
  font-size: 0.72rem;
}
.ride-line[data-kind="rail"] li i {
  width: 22px;
  height: 22px;
  border: 3px solid var(--lcd-rule);
  border-radius: var(--radius-round);
  background: var(--lcd-background);
}
.ride-line[data-kind="rail"] li.passed i {
  border-color: var(--journey-accent);
  background: var(--journey-accent);
}
.ride-line[data-kind="rail"] li.next {
  color: var(--lcd-text);
  font-weight: 700;
}
.ride-line[data-kind="rail"] li.next i {
  border-color: var(--lcd-next);
  animation: ride-next-ring 1.8s ease-in-out infinite;
}
.ride-line[data-kind="rail"] li.destination span::after {
  content: " ●";
  color: var(--lcd-next);
}
.ride-line li span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ride-marker {
  position: absolute;
  top: 3px;
  left: var(--progress, 0%);
  width: 34px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: var(--radius-capsule);
  background: var(--lcd-text);
  box-shadow: var(--shadow-vehicle);
  transition: left 1.2s cubic-bezier(0.3, 0.7, 0.2, 1);
}
.ride-marker::after {
  content: "";
  position: absolute;
  inset: 4px 6px;
  border-radius: var(--radius-capsule);
  background: var(--journey-accent);
}
/* Bus: next stop and a vertical timeline of the stops ahead. */
.ride-line[data-kind="bus"] {
  margin: 18px 4px 0;
  text-align: left;
}
.ride-line[data-kind="bus"] ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.ride-line[data-kind="bus"] li {
  position: relative;
  display: grid;
  grid-template-columns: 52px 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--muted);
  font-size: var(--type-secondary);
}
.ride-line[data-kind="bus"] li::before {
  content: "";
  position: absolute;
  left: 69px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: color-mix(in srgb, var(--journey-accent) 35%, transparent);
}
.ride-line[data-kind="bus"] li:first-child::before {
  top: 50%;
}
.ride-line[data-kind="bus"] li:last-child::before {
  bottom: 50%;
}
.ride-line[data-kind="bus"] li time {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ride-line[data-kind="bus"] li i {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  justify-self: center;
  border: 3px solid var(--journey-accent);
  border-radius: var(--radius-round);
  background: var(--surface-primary);
}
.ride-line[data-kind="bus"] li.next {
  min-height: 52px;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 700;
}
.ride-line[data-kind="bus"] li.next i {
  width: 20px;
  height: 20px;
  background: var(--journey-accent);
  animation: ride-next-ring 1.8s ease-in-out infinite;
}
.ride-line[data-kind="bus"] li small {
  padding: 2px 8px;
  border-radius: var(--radius-capsule);
  background: var(--fill-tertiary);
  color: var(--text);
  font-size: var(--type-caption);
  font-weight: 700;
}
.ride-line[data-kind="bus"] li.destination small {
  background: var(--journey-accent);
  color: var(--color-on-transport);
}
.ride-line-more {
  margin: 6px 0 0 82px;
  color: var(--muted);
  font-size: var(--type-caption);
}
@keyframes ride-next-ring {
  50% {
    box-shadow: var(--shadow-station-ring);
  }
}
html[data-reduce-motion="true"] :is(.ride-marker, .ride-line ol::before, .ride-line li i) {
  animation: none;
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  :is(.ride-marker, .ride-line li i) {
    animation: none;
    transition: none;
  }
}
[data-phase="APPROACHING"] .next-station-hero {
  background: color-mix(in srgb, var(--route-tint) 75%, var(--panel));
}
[data-train-state="LINE_BOUNDARY"] .next-station-hero {
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--color-subway) 9%, var(--panel)) 0 50%,
    color-mix(in srgb, var(--color-kintetsu) 9%, var(--panel)) 50% 100%
  );
}
.journey-display {
  transition:
    --journey-accent 750ms ease,
    background-color 750ms ease;
}
.next-state-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  min-height: 1.4em;
}
.journey-display[data-rail-phase="stopped"] .next-state-label {
  color: var(--journey-accent);
}
.journey-display[data-rail-phase="estimated"] .next-state-label,
.journey-display[data-rail-phase="unavailable"] .next-state-label {
  color: var(--muted);
}
.journey-display[data-rail-phase]:not([data-rail-phase=""]) .next-countdown {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  min-height: 1.5em;
}
.next-station-title {
  flex-wrap: wrap;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 0;
  min-width: 0;
}
.next-station-title .journey-next-name {
  font-size: var(--type-hero);
  margin: 0;
  line-height: 1.18;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.station-code {
  flex-shrink: 0;
  border: 3px solid var(--journey-accent);
  color: var(--journey-accent);
  background: var(--panel);
  border-radius: var(--radius-row);
  padding: 8px 5px;
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
}
.station-en {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}
.next-station-hero .next-countdown {
  font-size: 1rem;
  font-weight: 750;
  color: var(--text);
  margin-top: 18px;
  line-height: 1.5;
}
.next-station-hero .destination-progress {
  font-size: 0.75rem;
  margin-top: 5px;
}
.next-station-hero .terminal-arrival {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: var(--type-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.station-strip {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: 20px;
  gap: 4px;
}
.station-strip::before {
  content: "";
  position: absolute;
  top: 5px;
  height: 3px;
  left: 8%;
  right: 8%;
  background: color-mix(in srgb, var(--journey-accent) 24%, var(--separator));
}
.station-strip > span {
  position: relative;
  flex: 1;
  min-width: 0;
}
.station-strip i {
  display: block;
  position: relative;
  margin: 0 auto 8px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--separator);
  background: var(--panel);
  border-radius: var(--radius-round);
}
.station-strip .selected i {
  border-color: var(--journey-accent);
}
.station-strip b {
  display: block;
  font-size: var(--type-caption);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.personal-destination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--surface-destination);
  color: var(--color-destination);
  padding: 10px 12px;
  border-radius: var(--radius-control);
}
.personal-destination > span {
  min-width: 0;
}
.personal-destination b {
  display: block;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}
.personal-destination small {
  display: block;
  color: var(--muted);
  font-size: var(--type-caption);
}
.personal-destination strong {
  font-size: 1.1rem;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.through-notice {
  margin-top: 10px !important;
  font-size: 0.75rem !important;
}
.journey-display .ride-meta {
  padding-top: 12px;
  margin-top: 8px;
  font-size: 0.7rem;
}
.journey-stop-list li:not(:last-child)::before {
  left: 21px;
}
.station-dot-button,
.station-name-button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 6px 0;
  min-height: 44px;
  color: inherit;
}
.station-dot-button {
  width: 44px;
  display: grid;
  place-items: center;
}
.station-dot-button .rail-dot {
  width: 10px;
  height: 10px;
  margin: 0;
}
.station-name-button {
  min-width: 0;
  overflow-wrap: anywhere;
}
.station-name-button b {
  font-size: 0.88rem;
}
.station-name-button small {
  display: block;
  font-size: var(--type-caption);
  color: var(--muted);
}
.journey-stop-list .destination {
  background: var(--blue-soft);
  border-radius: var(--radius-row);
}
.journey-stop-list .boarding {
  background: var(--panel-2);
  border-radius: var(--radius-row);
}
.stop-times {
  font-size: 0.85rem;
}
.stop-times > span {
  display: block;
  color: var(--muted);
  font-size: var(--type-caption);
}
.analysis-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.analysis-actions .secondary-action {
  margin-top: 10px;
  font-size: 0.8rem;
}
.journey-analysis h3 {
  margin: 6px 0 0;
  font-size: 1rem;
  line-height: 1.5;
}
.route-map {
  --journey-accent: var(--color-subway);
  background: var(--panel-2);
  border-radius: var(--radius-inset);
  overflow: hidden;
}
.route-map[data-line="B"] {
  --journey-accent: var(--color-kintetsu);
}
.route-map[data-line="bus"] {
  --journey-accent: var(--color-citybus);
}
.map-canvas {
  overflow: hidden;
  position: relative;
  background: var(--map-neutral);
}
.map-tiles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.map-tile {
  position: absolute;
  max-width: none;
}
.route-map .map-canvas > svg {
  position: relative;
}
.route-map.map-interactive .map-canvas {
  touch-action: none;
}
.route-map svg {
  display: block;
  width: 100%;
  height: 200px;
}
.map-grid {
  stroke: var(--separator);
  stroke-width: 1;
  fill: none;
}
.map-path {
  stroke: var(--journey-accent);
  stroke-width: 4;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 750ms;
}
.map-stop {
  fill: var(--panel);
  stroke: var(--journey-accent);
  stroke-width: 2;
}
.map-accuracy {
  fill: color-mix(in srgb, var(--blue) 16%, transparent);
  stroke: color-mix(in srgb, var(--blue) 35%, transparent);
}
.route-map[data-line="nearby"] .map-stop {
  --journey-accent: var(--transport-color);
}
.map-path[data-operator] {
  stroke: var(--transport-color);
}
.map-position {
  fill: var(--blue);
  stroke: var(--panel);
  stroke-width: 3;
  transition:
    cx 900ms ease,
    cy 900ms ease;
}
.route-map p {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
  margin: 0;
}
.route-map.expanded svg {
  height: min(58vh, 480px);
}
.route-map svg text {
  font:
    600 12px -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  fill: var(--map-label);
  stroke: white;
  stroke-width: 3px;
  paint-order: stroke;
}
.map-controls {
  position: absolute;
  right: 8px;
  top: 8px;
  display: grid;
  gap: 8px;
}
.map-controls button {
  border: 0;
  border-radius: var(--radius-small);
  background: var(--panel);
  box-shadow: var(--shadow-vehicle);
  font-size: 1rem;
  width: 44px;
  height: 44px;
}
.map-attribution {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 10px;
  padding: 3px 5px;
  background: var(--map-control);
  color: var(--map-label);
}
.map-load-note {
  position: absolute;
  bottom: 22px;
  left: 8px;
  right: 8px;
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--panel);
  padding: 6px;
  border-radius: var(--radius-compact);
}
.bus-mini-map {
  margin-top: 10px;
}
.mini-map-overview > summary {
  display: none;
}
.compact .mini-map-overview > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--blue);
  font-size: 0.75rem;
}
.bus-mini-map .plain-action {
  margin: 0;
  font-size: 0.75rem;
  width: 100%;
  text-align: right;
  min-height: 44px;
}
.bus-mini-map .route-map svg {
  height: 140px;
}
.bus-mini-map .map-controls {
  display: none;
}
.bus-mini-map .route-map p {
  padding: 5px 10px;
  font-size: var(--type-caption);
}
.context-facts {
  margin: 0;
}
.context-facts > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--separator);
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
.context-facts dt {
  color: var(--muted);
}
.context-facts dd {
  margin: 0;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.delay-chart {
  width: 100%;
  color: var(--orange);
  margin-top: 16px;
}
.sheet-drag-handle {
  display: grid;
  place-items: center;
  width: 100%;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  touch-action: none;
}
.sheet-drag-handle span {
  width: 36px;
  height: 5px;
  background: var(--separator);
  border-radius: var(--radius-tiny);
}
.sheet-close {
  min-width: 44px;
  min-height: 44px;
}
button {
  min-height: 44px;
  min-width: 44px;
}
.sheet-body .primary-action,
.sheet-body .secondary-action {
  width: 100%;
  white-space: normal;
}
.sheet-field {
  display: grid;
  gap: 8px;
}
.sheet-field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
.pulse-dot,
.hero-card.detecting::after {
  animation: none;
}
@media (max-width: 370px) {
  .route-header {
    flex-wrap: wrap;
  }
  .route-header > div {
    flex-basis: 65%;
  }
  .next-station-title {
    flex-wrap: wrap;
  }
  .next-station-title .journey-next-name {
    font-size: 2.125rem;
  }
}
@media (prefers-color-scheme: dark) {
  .map-tile {
    filter: brightness(0.7) saturate(0.65);
  }
}
@media (prefers-reduced-motion: reduce) {
  .next-station-hero,
  .journey-display,
  .map-path,
  .map-position {
    transition: none;
  }
}
.live-track {
  position: relative;
  height: 94px;
  margin: 6px 16px 0;
  --journey-accent: var(--color-subway);
}
.live-track[data-line="B"] {
  --journey-accent: var(--color-kintetsu);
}
.live-track-axis {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  height: 4px;
  background: color-mix(in srgb, var(--journey-accent) 25%, var(--separator));
  border-radius: var(--radius-detail);
  transition: background-color 750ms;
}
.live-track-opposite {
  position: absolute;
  top: 77px;
  left: 0;
  right: 0;
  border-bottom: 2px dashed var(--separator);
}
.live-track-self,
.track-vehicle {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: var(--radius-marker);
  padding: 5px;
  font-size: var(--type-caption);
  white-space: nowrap;
  transition: left 900ms cubic-bezier(0.22, 0.8, 0.25, 1);
}
.live-track-self {
  color: var(--panel);
  background: var(--text);
  z-index: 2;
}
.track-vehicle {
  background: var(--panel);
  border: 1px solid var(--separator);
  color: var(--muted);
  font-size: var(--type-caption);
}
.track-vehicle.opposite {
  top: 60px;
}
.track-vehicle:not(.ahead):not(.opposite) {
  width: 10px;
  height: 10px;
  top: 37px;
  padding: 0;
  font-size: 0;
}
.live-track-source {
  margin-top: 0;
}
@media (prefers-reduced-motion: reduce) {
  .live-track-axis,
  .live-track-self,
  .track-vehicle {
    transition: none;
  }
}
@media (max-width: 430px) {
  main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .hero-card:not(.journey-display) {
    border-radius: var(--radius-map);
  }
}
a.plain,
a.plain-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}
.station-overview > summary {
  display: none;
}
.bus .station-overview > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}
.journey-display.compact .route-header h2 {
  font-size: 0.75rem;
}
.journey-display.compact .route-header p {
  font-size: var(--type-caption);
}
.journey-display.compact .route-header .status-pill {
  font-size: var(--type-caption);
}
.journey-display.compact .next-station-hero {
  padding: 12px 8px;
}
/* Large text / short screens: keep the next stop and the alighting stop on
   one screen; the line of stations ahead stays in the stop list. */
.journey-display.compact .ride-line {
  display: none;
}
.journey-display.compact .next-station-hero.lcd {
  padding-top: 0;
}
.journey-display.compact .lcd-head {
  padding: 6px 12px;
}
.journey-display.compact .next-countdown {
  margin-top: 10px;
}
.journey-display.compact .destination-progress {
  font-size: var(--type-caption);
}
.journey-display.compact .personal-destination {
  padding: 8px 10px;
}
.journey-display.compact .personal-destination b {
  font-size: 0.75rem;
}
.journey-display.compact .personal-destination small {
  font-size: var(--type-caption);
}
.journey-display.compact .station-overview > summary {
  display: block;
  min-height: 44px;
  font-size: 0.7rem;
  color: var(--muted);
  padding-top: 8px;
}
.nearby-row > strong > small {
  display: block;
  color: var(--muted);
  font-size: var(--type-caption);
}
.journey-warning {
  background: color-mix(in srgb, var(--orange) 13%, var(--panel));
  border-radius: var(--radius-row);
  padding: 10px;
  margin-bottom: 12px !important;
  font-size: 0.8rem !important;
  color: var(--text) !important;
}
summary {
  min-height: 44px;
}
.sheet {
  position: fixed;
  inset: auto 0 max(8px, var(--safe-bottom)) 0;
  margin: 0 auto;
}
.route-token {
  transition:
    background-color 750ms ease,
    color 750ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .route-token {
    transition: none;
  }
}
.sheet.map-full-screen {
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}
.map-full-screen .sheet-drag-handle {
  margin-top: env(safe-area-inset-top, 0px);
}
.map-full-screen .sheet-body {
  height: calc(100dvh - 108px - env(safe-area-inset-top, 0px));
}
.map-full-screen .route-map.expanded svg {
  height: max(
    240px,
    calc(100dvh - 240px - env(safe-area-inset-top, 0px) - var(--safe-bottom))
  );
}

/* Foldback suggestions: station → reverse train → back at the passed station. */
.fold-recommend {
  margin: 4px 0 18px;
}
.fold-recommend h3 {
  margin: 0 4px 8px;
  color: var(--muted);
  font-size: var(--type-caption);
  font-weight: 650;
}
.fold-recommend-list {
  display: grid;
  gap: 8px;
}
.fold-recommend-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.25fr);
  grid-template-areas:
    "station arrow train"
    "meta meta meta";
  align-items: center;
  gap: 6px 10px;
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--radius-group);
  background: var(--surface-secondary);
  color: var(--text);
  text-align: left;
  font: inherit;
}
.fold-recommend-row.best {
  background: color-mix(in srgb, var(--color-accent) 10%, var(--surface-primary));
  box-shadow: var(--shadow-selected-ring);
}
.fold-recommend-row:active {
  background: var(--fill-secondary);
}
.fold-best {
  position: absolute;
  top: -8px;
  left: 12px;
  padding: 1px 8px;
  border-radius: var(--radius-capsule);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: 0.6875rem;
  font-weight: 700;
}
.fold-recommend-station {
  grid-area: station;
  display: grid;
  min-width: 0;
}
.fold-recommend-station b {
  font-size: var(--type-body);
  overflow-wrap: anywhere;
}
.fold-recommend-station small,
.fold-recommend-train small,
.fold-recommend-meta small {
  color: var(--muted);
  font-size: var(--type-caption);
}
.fold-recommend-arrow {
  grid-area: arrow;
  color: var(--color-accent);
  font-size: 1.25rem;
}
.fold-recommend-train {
  grid-area: train;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  min-width: 0;
}
.fold-recommend-train > b {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.fold-recommend-train > b small {
  margin-left: 2px;
  font-weight: 600;
}
.fold-recommend-train > small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}
.fold-recommend-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding-top: 6px;
  border-top: 1px solid var(--separator);
}
.fold-recommend-meta b {
  color: var(--color-success);
  font-size: var(--type-secondary);
}
.fold-recommend-row[data-status="tight"] .fold-recommend-meta small {
  color: var(--color-warning);
  font-weight: 650;
}

/* Through-service question near Takeda. */
.through-prompt {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--radius-group);
  background: var(--surface-secondary);
}
.through-prompt-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  font-size: var(--type-body);
}
.through-prompt-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.through-prompt-yes,
.through-prompt-no {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-row);
  font: inherit;
  text-align: left;
}
.through-prompt-yes {
  background: var(--color-accent);
  color: var(--color-on-accent);
}
.through-prompt-yes small {
  opacity: 0.85;
  font-size: var(--type-caption);
}
.through-prompt-no {
  background: var(--fill-tertiary);
  color: var(--text);
  font-weight: 600;
}

/* Bus front sign: route plate, amber LED destination, stop lamp. */
.bus-sign {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 8px;
  padding: 6px;
  border-radius: var(--radius-row);
  background: var(--lcd-background);
}
.bus-sign-route {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 2.8em;
  padding: 1px 8px;
  border-radius: var(--radius-tiny);
  background: var(--line-color);
  color: var(--color-on-line);
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.bus-sign-dest {
  display: flex;
  flex: 1;
  flex-wrap: nowrap;
  overflow: hidden;
  align-items: baseline;
  gap: 0 6px;
  min-width: 0;
  color: var(--led-amber);
  text-shadow: var(--led-glow);
  letter-spacing: 0.04em;
}
.bus-sign-dest b {
  min-width: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bus-sign-dest small {
  flex: none;
}
.bus-sign-dest small {
  font-size: var(--type-caption);
  font-weight: 700;
}
/* Stop-button lamp ("とまります"). */
.stop-lamp {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--lamp-red);
  font-size: var(--type-caption);
}
.stop-lamp i {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-round);
  background: var(--fill-secondary);
}
.stop-lamp.on b {
  text-shadow: var(--lamp-glow);
}
.stop-lamp.on i {
  background: var(--lamp-red);
  box-shadow: var(--lamp-glow);
  animation: stop-lamp-pulse 1.2s ease-in-out infinite;
}
@keyframes stop-lamp-pulse {
  50% {
    opacity: 0.55;
  }
}
html[data-reduce-motion="true"] .stop-lamp.on i {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .stop-lamp.on i {
    animation: none;
  }
}
/* The front sign carries the route plate on bus rides. */
.journey-display.bus .route-header .route-tokens {
  display: none;
}
/* Bus ride colours follow the route plate (loop orange, others blue). */
.journey-display.bus[data-bus-line="citybus"] {
  --transport-color: var(--line-citybus);
}
.journey-display.bus[data-bus-line="citybus-loop"] {
  --transport-color: var(--line-citybus-loop);
}
.journey-display.bus[data-bus-line^="kyotobus"] {
  --transport-color: var(--line-kyotobus);
}
.journey-display.bus .bus-sign-route[data-line] {
  background: var(--line-color);
}

/* Transfer guidance between two rides of a planned journey. */
.transfer-guide {
  background: var(--panel);
  border-radius: var(--radius-surface);
  padding: 18px 18px 14px;
  margin: 0 0 12px;
  animation: transfer-guide-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes transfer-guide-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .transfer-guide {
    animation: none;
  }
}
.transfer-step-label {
  margin: 0;
  color: var(--color-accent);
  font-size: var(--type-caption);
  font-weight: 650;
}
.transfer-guide h2 {
  margin: 2px 0 12px;
  font-size: var(--type-arrival);
  line-height: 1.2;
}
.transfer-next {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.transfer-clock {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.transfer-clock time {
  font-size: var(--type-secondary);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.transfer-clock b {
  font-size: var(--type-hero);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.transfer-clock b[data-soon="true"] {
  color: var(--orange);
}
.transfer-steps {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  border-top: 1px solid var(--separator);
}
.transfer-steps li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 0;
  border-bottom: 1px solid var(--separator);
}
.transfer-steps li > span:last-child {
  display: grid;
  min-width: 0;
}
.transfer-steps small {
  color: var(--muted);
  font-size: var(--type-caption);
  overflow-wrap: anywhere;
}
.transfer-step-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
}
.transfer-step-icon > svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}
.transfer-steps li[data-kind="ride"] b {
  color: var(--text);
}
.transfer-guide .screen-action-group {
  display: grid;
  gap: 6px;
}

/* RTM: live buses approaching the nearest stop. */
.map-bus-plate {
  fill: var(--line-color);
  stroke: var(--panel);
  stroke-width: 1.5;
}
.map-bus-route {
  fill: var(--color-on-accent);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.map-bus-away {
  fill: var(--text);
  font-size: 10px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 3px;
}
.map-bus-stem {
  stroke: var(--line-color);
  stroke-width: 2;
}
.map-bus-anchor {
  fill: var(--line-color);
  stroke: var(--panel);
  stroke-width: 2;
}
.map-bus {
  transition: transform 1s linear;
}
.map-bus.imminent .map-bus-plate {
  animation: map-bus-pulse 1.6s ease-in-out infinite;
}
@keyframes map-bus-pulse {
  50% {
    stroke: var(--line-color);
    stroke-width: 4;
  }
}
@media (prefers-reduced-motion: reduce) {
  .map-bus {
    transition: none;
  }
  .map-bus.imminent .map-bus-plate {
    animation: none;
  }
}
.map-radar-stop {
  fill: none;
  stroke: var(--line-citybus);
  stroke-width: 2;
  stroke-dasharray: 3 3;
}
.radar-caption {
  margin: 6px 4px 0;
  color: var(--muted);
  font-size: var(--type-caption);
}
