:root {
  color-scheme: light;
  --ink: #172126;
  --muted: #5d6a70;
  --line: #d9e1df;
  --surface: #f7faf9;
  --panel: #ffffff;
  --teal: #007c89;
  --teal-dark: #005e68;
  --coral: #d84f35;
  --gold: #b98210;
  --green: #1f8a4c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar,
.actions,
.panel-heading,
.meta {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1.04;
}

.actions {
  gap: 12px;
}

.updated,
footer {
  color: var(--muted);
  font-size: 0.92rem;
}

.control-button,
.mode-button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 850;
  cursor: pointer;
}

.mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 82px;
  padding: 0 16px;
  text-decoration: none;
}

.control-button {
  min-width: 98px;
  padding: 0 16px;
}

.control-button:hover,
.control-button:focus-visible,
.mode-button:hover,
.mode-button:focus-visible {
  border-color: var(--teal);
  outline: 3px solid rgba(0, 124, 137, 0.18);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.panel-heading {
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
}

.panel-toggle {
  cursor: pointer;
}

.panel-toggle:hover,
.panel-toggle:focus-visible {
  outline: 3px solid rgba(0, 124, 137, 0.14);
  outline-offset: -3px;
}

.panel-toggle span::after {
  content: " hide";
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.panel-toggle[aria-expanded="false"] {
  border-bottom: 0;
}

.panel-toggle[aria-expanded="false"] span::after {
  content: " show";
}

h2 {
  font-size: 1rem;
}

.direction {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.86rem;
}

.departures {
  min-height: 360px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.departure {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.departure:last-child {
  border-bottom: 0;
}

.departure.ontime {
  background: rgba(31, 138, 76, 0.07);
}

.departure.early {
  background: rgba(185, 130, 16, 0.1);
}

.departure.late {
  background: rgba(216, 79, 53, 0.09);
}

.departure-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  height: auto;
  min-height: 76px;
  padding: 14px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

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

.departure-toggle:hover,
.departure-toggle:focus-visible {
  outline: 3px solid rgba(0, 124, 137, 0.18);
  outline-offset: -3px;
}

.departure-toggle[aria-expanded="true"] {
  border-bottom: 1px solid rgba(23, 33, 38, 0.12);
}

.static-row {
  cursor: default;
}

.static-row:hover,
.static-row:focus-visible {
  outline: 0;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.route-badge {
  display: inline-flex;
  align-items: center;
  min-width: 46px;
  min-height: 34px;
  justify-content: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
}

.stop-line {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.time {
  font-size: 1.42rem;
  font-weight: 850;
  line-height: 1;
}

.meta {
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.pill.live {
  background: rgba(31, 138, 76, 0.12);
  color: var(--green);
}

.pill.map-live {
  background: rgba(0, 124, 137, 0.13);
  color: var(--teal-dark);
}

.pill.late {
  background: rgba(216, 79, 53, 0.12);
  color: var(--coral);
}

.pill.early {
  background: rgba(185, 130, 16, 0.14);
  color: var(--gold);
}

.minutes {
  min-width: 72px;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 850;
  white-space: nowrap;
}

.map-drawer {
  padding: 0 18px 16px;
  animation: slideOpen 180ms ease-out;
}

.map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.map-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 14px;
}

.map-tab {
  min-height: 38px;
  border: 1px solid rgba(23, 33, 38, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 850;
}

.map-tab.active {
  border-color: var(--teal);
  background: rgba(0, 124, 137, 0.12);
  color: var(--teal-dark);
}

.map-tab:disabled {
  opacity: 0.45;
}

.map-frame {
  display: block;
  width: 100%;
  height: 230px;
  border: 1px solid rgba(23, 33, 38, 0.14);
  border-radius: 8px;
  background: #dce6e3;
}

.map-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--teal-dark);
  font-size: 0.86rem;
  font-weight: 750;
  text-decoration: none;
}

.map-link:hover,
.map-link:focus-visible {
  text-decoration: underline;
}

.map-empty {
  padding: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.empty,
.error {
  padding: 22px 18px;
  color: var(--muted);
}

.error {
  color: var(--coral);
}

footer {
  padding: 20px 0 0;
}

@keyframes slideOpen {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 680px);
    padding-top: 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .updated {
    flex-basis: 100%;
    line-height: 1.3;
  }

  .mode-button,
  .control-button {
    flex: 1;
    min-width: 0;
    height: 48px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

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

  .panel-heading {
    padding: 16px;
  }

  .departures {
    min-height: 0;
  }

  h1 {
    font-size: 2.35rem;
  }

  .updated {
    line-height: 44px;
  }

  .departure-toggle {
    align-items: flex-start;
    min-height: 0;
    padding: 16px;
  }

  .departure-main {
    max-width: calc(100% - 82px);
  }

  .time {
    font-size: 1.72rem;
    line-height: 1.05;
  }

  .time-row {
    gap: 10px;
  }

  .route-badge {
    min-width: 42px;
    min-height: 32px;
  }

  .minutes {
    min-width: 68px;
    padding-top: 4px;
    font-size: 1.28rem;
  }

  .meta {
    gap: 8px;
    margin-top: 10px;
  }

  .pill {
    min-height: 26px;
    padding: 4px 9px;
    font-size: 0.84rem;
  }

  .map-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
