:root {
  color-scheme: light;
  --bg: #eef3ef;
  --surface: #ffffff;
  --ink: #18211d;
  --muted: #617069;
  --line: #d7e1dc;
  --green: #0a7a4b;
  --green-soft: #dff2e9;
  --red: #c73b2f;
  --yellow: #f0b429;
  --shadow: 0 18px 50px rgba(21, 44, 33, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 16px 24px 24px;
}

.summary {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 118px;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line);
}

.route-strip {
  display: grid;
  grid-template-columns: 18px minmax(32px, 1fr) 70px minmax(32px, 1fr) 18px;
  align-items: center;
  min-height: 62px;
}

.route-line {
  height: 9px;
  background: linear-gradient(90deg, var(--green), #2a8e85);
}

.stop-dot {
  width: 18px;
  height: 18px;
  border: 4px solid var(--green);
  border-radius: 50%;
  background: var(--surface);
}

.stop-dot.is-active {
  border-color: var(--red);
  box-shadow: 0 0 0 6px rgba(199, 59, 47, 0.12);
}

.bus-shape {
  display: grid;
  place-items: center;
  width: 70px;
  height: 44px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 -10px rgba(255, 255, 255, 0.28);
}

.summary-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2,
p {
  margin-block-start: 0;
}

.route-meta {
  margin-block-end: 0;
  color: var(--muted);
  font-size: 18px;
}

.source-link {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.source-link {
  padding: 0 18px;
  font-weight: 800;
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 16px 0;
}

.direction-control {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.direction-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  box-shadow: 0 10px 28px rgba(21, 44, 33, 0.08);
}

.direction-option {
  display: grid;
  gap: 3px;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  text-transform: none;
}

.direction-option strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.1;
}

.direction-option span {
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.2;
}

.direction-option.is-active {
  border-color: rgba(10, 122, 75, 0.22);
  background: var(--green-soft);
  color: var(--green);
}

.status-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.status-band > div,
#updated-refresh {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(21, 44, 33, 0.07);
}

#updated-refresh {
  cursor: pointer;
}

#updated-refresh:disabled {
  cursor: wait;
  opacity: 0.68;
}

#updated-refresh:hover {
  border-color: rgba(10, 122, 75, 0.36);
  background: var(--green-soft);
}

.status-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-band strong {
  font-size: 16px;
  line-height: 1.1;
}

.departures {
  padding-top: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-block-end: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.section-heading span {
  color: var(--muted);
  font-weight: 800;
}

.show-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.show-option {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.show-option.is-active {
  border-color: rgba(10, 122, 75, 0.22);
  background: var(--green-soft);
  color: var(--green);
}

.departure-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.departure-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(21, 44, 33, 0.08);
}

.departure-time {
  color: var(--green);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0;
}

.departure-main {
  min-width: 0;
}

.departure-main span {
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.delay-pill {
  min-width: 74px;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
  text-align: center;
}

.delay-pill.is-late {
  background: #f9e2df;
  color: var(--red);
}

.message {
  margin: 18px 0 0;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 720px) {
  .app {
    padding: 12px 16px 16px;
  }

  .summary {
    grid-template-columns: 1fr auto;
    min-height: 0;
    padding: 8px 0 14px;
  }

  .route-strip {
    grid-column: 1 / -1;
  }

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

  .status-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .direction-toggle {
    grid-template-columns: 1fr;
  }

  .status-band > div,
  #updated-refresh {
    gap: 4px;
    min-height: 38px;
    padding: 8px 6px;
  }

  .departure-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .delay-pill {
    justify-self: start;
  }
}
