:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #0b1220;
  --card: #111a2e;
  --accent: #5fd0ff;
  --text: #e6eef7;
  --muted: #8ea2c2;
  --danger: #ffb3b3;
  --warn: #ffd48a;
  --ok: #7ee08a;
  --skeleton: rgba(255, 255, 255, 0.07);
  --skeleton-highlight: rgba(255, 255, 255, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: 1.4rem;
}

.app__controls {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.time-mode {
  display: inline-flex;
  padding: 2px;
  border: 1px solid rgba(142, 162, 194, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
}

.time-mode__button {
  min-width: 38px;
  min-height: 28px;
  padding: 3px 7px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

.time-mode__button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--accent);
}

.time-mode__button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stops {
  display: grid;
  gap: 12px;
}

.stop {
  background: var(--card);
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.stop__title {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.stop__title--static {
  cursor: default;
}

.stop__title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.stop__title-main {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
}

.stop__lines {
  flex: none;
  font-size: 0.85rem;
  color: var(--muted);
}

.stop__toggle {
  color: var(--muted);
  font-size: 1rem;
  transition: transform 160ms ease;
}

.stop--collapsed .stop__toggle {
  transform: rotate(-90deg);
}

.departures {
  display: grid;
  gap: 6px;
}

.departures[hidden] {
  display: none;
}

.departure {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 8px 10px;
}

.departure--loading {
  min-height: 35px;
  overflow: hidden;
  position: relative;
  background: var(--skeleton);
}

.departure--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--skeleton-highlight), transparent);
  animation: loading-shimmer 1.4s infinite;
}

@keyframes loading-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .departure--loading::after {
    animation: none;
  }
}

.departure--delay {
  background: rgba(255, 212, 138, 0.08);
}

.delay {
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
}

.delay--warn {
  color: #231b09;
  background: var(--warn);
}

.departure__line {
  flex: none;
  font-weight: 700;
  color: var(--accent);
}

.departure__dest {
  min-width: 0;
  flex: 1;
  margin-left: 10px;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.departure__eta {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-weight: 600;
}

.departure__value {
  min-width: 40px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.punctual {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(126, 224, 138, 0.12);
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.empty {
  color: var(--danger);
  font-size: 0.9rem;
}

@media (max-width: 380px) {
  .app__controls {
    gap: 7px;
  }

  .muted {
    font-size: 0.75rem;
  }
}
