:root {
  --spine-color: #222;
  --bg: #fff;
  --text: #222;
  --muted: #666;
  --error-bg: #fdecea;
  --error-text: #c0392b;

  --spine-width: 4px;

  /* Dot geometry */
  --dot-size: 14px;
  --dot-border: 3px;
  --dot-centre: calc(var(--dot-border) + (var(--dot-size) / 2));

  /* Gutters from spine to text blocks */
  --gutter-left: 1.25rem;   /* OUTBOUND (left) */
  --gutter-right: 1.75rem;  /* INBOUND  (right) */

  /* Arrow free-space block height */
  --arrow-block-h: 64px;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* ===== Outer container ===== */
.route {
  max-width: 960px;
  margin: 1.25rem auto 2rem;
  padding: 0 1rem;
}

/* ===== Timeline wrapper ===== */
.stops {
  position: relative;

  min-height: 100dvh;
  min-height: -webkit-fill-available;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  padding-top: calc(var(--dot-centre) + 3px);
  padding-bottom: calc(var(--dot-centre) + 3px);

  overflow: hidden;
}

/* The vertical spine */
.spine {
  position: absolute;
  z-index: 1;
  left: 50%;
  transform: translateX(-50%);
  width: var(--spine-width);
  top: 0;
  bottom: 0;
  background: var(--spine-color);
  border-radius: 999px;
}

/* Hard masks to ensure no tails */
.stops::before,
.stops::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0; right: 0;
  height: 6px;
  background: var(--bg);
}
.stops::before { top: 0; }
.stops::after  { bottom: 0; }

/* Direction groups */
.group { width: 100%; }

.inbound-rows {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.outbound-rows {
  display: flex;
  flex-direction: column-reverse; /* bottom-up visually */
  gap: 1rem;
}

/* A single row */
.row {
  position: relative;
  width: 100%;
  min-height: 46px;
  line-height: 1.15;
}

/* The ring dot on the spine */
.stop-dot {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  width: var(--dot-size);
  height: var(--dot-size);
  background: #fff;
  border: var(--dot-border) solid var(--spine-color);
  border-radius: 50%;
}

/* Text blocks */
.content {
  max-width: 44%;
  margin-top: 2px;
}
.content.right {
  margin-left: auto;
  text-align: left;
  padding-left: var(--gutter-right);
}
.content.left {
  margin-right: auto;
  text-align: left;
  padding-right: var(--gutter-left);
}

/* Typography */
.stop-name {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0 0 0.2rem 0;
  color: #333;
}

.lead { margin: .05rem 0 .05rem; }
.lead .time { font-size: 1.15rem; font-weight: 750; }
.lead .eta  {
  font-size: 0.8rem;
  font-weight: 450;
  color: var(--muted);
  margin-left: 0.25rem;
  white-space: nowrap;
}

.others { margin-top: .1rem; color: var(--text); }
.others .t { display: inline-block; margin-right: 0.4rem; font-size: 0.9rem; }

.muted { color: var(--muted); }
.error {
  color: var(--error-text);
  background: var(--error-bg);
  padding: .5rem .75rem;
  border-radius: .5rem;
  max-width: 520px;
}

/* ===== Free-space arrows (image versions, dynamic placement) ===== */
.free-half {
  width: 50%;
  height: var(--arrow-block-h);
  display: flex;
  align-items: center;
  justify-content: center;
}
.free-half.right { margin-left: 50%; }  /* right half of page */
.free-half.left  { margin-right: 50%; } /* left half of page */

.free-arrow {
  display: block;
  width: 44px;
  height: auto;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
}

/* =========================
   RESPONSIVE TUNING
   ========================= */
@media (max-width: 560px) {
  :root {
    --gutter-left: 1.35rem;
    --gutter-right: 2rem;
    --arrow-block-h: 60px;
  }

  .content { max-width: 58%; }
  .stop-name   { font-size: 0.9rem; }
  .lead .time  { font-size: 1.05rem; }
  .lead .eta   { font-size: 0.75rem; margin-left: 0.2rem; }
  .others .t   { font-size: 0.83rem; margin-right: 0.35rem; }
}

@media (min-width: 900px) {
  .free-arrow { width: 52px; }
}
