:root {
  --bg: #f3efe5;
  --ink: #17222b;
  --muted: #5a6a71;
  --panel: rgba(255, 252, 246, 0.84);
  --line: rgba(23, 34, 43, 0.12);
  --late: #e03131;
  --early: #1f9d55;
  --ontime: #868e96;
  --actual: #0057b8;
  --accent: #0f766e;
  --shadow: 0 24px 70px rgba(23, 34, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Instrument Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(0, 87, 184, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(224, 49, 49, 0.12), transparent 26%),
    linear-gradient(180deg, #f7f2e8 0%, #f1ecdf 100%);
}

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

.hero,
.layout {
  display: grid;
  gap: 18px;
}

.hero {
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 400px);
}

.layout {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 390px);
  margin-top: 18px;
}

.hero-copy,
.method-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  padding: 24px;
}

.eyebrow,
.panel-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-size: 0.73rem;
}

h1,
h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.05em;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: 0.92;
  max-width: 14ch;
}

h2 {
  font-size: 1.4rem;
}

.lede,
.method-card p,
.status-card p {
  color: var(--muted);
  line-height: 1.58;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-meta span {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(23, 34, 43, 0.08);
}

.method-card ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

#map {
  min-height: 70vh;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(23, 34, 43, 0.08);
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
}

.status-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(23, 34, 43, 0.08);
}

.status-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.02rem;
}

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

.vehicle-list li {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(23, 34, 43, 0.08);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.vehicle-list li:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 34, 43, 0.16);
}

.vehicle-list li.is-selected {
  background: rgba(239, 246, 255, 0.92);
  border-color: rgba(0, 87, 184, 0.42);
  box-shadow: 0 16px 32px rgba(0, 87, 184, 0.12);
}

.vehicle-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}

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

.dot,
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  margin-right: 8px;
}

.late-dot {
  background: var(--late);
  box-shadow: 0 0 18px rgba(224, 49, 49, 0.35);
}

.early-dot {
  background: var(--early);
  box-shadow: 0 0 18px rgba(31, 157, 85, 0.35);
}

.ontime-dot {
  background: var(--ontime);
  box-shadow: 0 0 18px rgba(134, 142, 150, 0.25);
}

.actual-dot {
  background: var(--actual);
  box-shadow: 0 0 16px rgba(0, 87, 184, 0.28);
}

.expected-dot {
  background: #ffffff;
  border: 2px solid var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
}

.pill.late {
  background: rgba(224, 49, 49, 0.12);
  color: var(--late);
}

.pill.early {
  background: rgba(31, 157, 85, 0.12);
  color: var(--early);
}

.pill.on_time {
  background: rgba(134, 142, 150, 0.12);
  color: var(--ontime);
}

.pill.unknown {
  background: rgba(23, 34, 43, 0.06);
  color: var(--muted);
}

.vehicle-stops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  font-size: 0.84rem;
}

.vehicle-stops span {
  color: var(--ink);
}

.vehicle-stops em {
  font-style: normal;
  color: var(--muted);
  margin-left: 4px;
}

.vehicle-trip {
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--ink);
}

.vehicle-trip em {
  font-style: normal;
  color: var(--muted);
  margin: 0 6px 0 4px;
}

.map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.line-toggles {
  display: flex;
  gap: 6px;
}

.line-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  border: 2px solid transparent;
}

.line-toggle:has(input:checked) {
  opacity: 1;
  transform: scale(1.05);
}

.line-toggle:has(input:not(:checked)) {
  opacity: 0.3;
}

.line-toggle input {
  display: none;
}

.line-toggle span {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.line-1-bg { background: #0057b8; }
.line-2-bg { background: #d9480f; }
.line-3-bg { background: #2b8a3e; }
.line-4-bg { background: #6f42c1; }
.line-5-bg { background: #a61e4d; }
.line-6-bg { background: #0b7285; }
.line-7-bg { background: #c77d0a; }

.delay-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(23, 34, 43, 0.08);
  transition: background 0.15s, color 0.15s;
}

.delay-filter:has(input:checked) {
  background: rgba(224, 49, 49, 0.12);
  color: var(--late);
  border-color: rgba(224, 49, 49, 0.25);
}

.delay-filter input {
  display: none;
}

.source-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent);
  vertical-align: middle;
}

.vehicle-explanation {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.degraded-banner {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 159, 28, 0.14);
  border: 1px solid rgba(255, 159, 28, 0.3);
  color: #b35900;
  font-size: 0.9rem;
  margin-top: 10px;
}

.leaflet-container {
  font: inherit;
}

.map-popup h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.map-popup p {
  margin: 0 0 6px;
}

.map-popup p:last-child {
  margin-bottom: 0;
}

@media (max-width: 1080px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  #map {
    min-height: 62vh;
  }
}
