:root {
  --bg: #f3efe5;
  --ink: #17222b;
  --muted: #5a6a71;
  --panel: rgba(255, 252, 246, 0.84);
  --line: rgba(23, 34, 43, 0.12);
  --ok: #1f9d55;
  --warn: #ff9f1c;
  --bad: #e03131;
  --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(58, 167, 109, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(240, 180, 41, 0.18), 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);
}

.history-panel {
  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);
}

.hero-copy,
.method-card,
.panel {
  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: 10ch;
}

h2 {
  font-size: 1.4rem;
}

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

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

.hero-meta span,
.stats article,
.status-card,
.hotspots li {
  border: 1px solid rgba(23, 34, 43, 0.08);
}

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

.method-card ul,
.hotspots {
  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: 760px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(23, 34, 43, 0.08);
}

#history-map {
  min-height: 620px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(23, 34, 43, 0.08);
  margin-top: 18px;
}

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

.status-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.66);
}

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

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

.stats article {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.stats strong {
  display: block;
  font-size: 1.58rem;
  font-family: "Sora", sans-serif;
}

.hotspots li {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.cell-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  color: var(--ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(23, 34, 43, 0.05);
  font-size: 0.84rem;
}

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

.ok {
  background: var(--ok);
  box-shadow: 0 0 18px rgba(58, 167, 109, 0.35);
}

.warn {
  background: var(--warn);
  box-shadow: 0 0 18px rgba(240, 180, 41, 0.35);
}

.bad {
  background: var(--bad);
  box-shadow: 0 0 18px rgba(219, 76, 64, 0.32);
}

.line-1 {
  background: #0057b8;
  box-shadow: 0 0 16px rgba(0, 87, 184, 0.28);
}

.line-2 {
  background: #d9480f;
  box-shadow: 0 0 16px rgba(217, 72, 15, 0.28);
}

.line-3 {
  background: #2b8a3e;
  box-shadow: 0 0 16px rgba(43, 138, 62, 0.28);
}

.line-4 {
  background: #6f42c1;
  box-shadow: 0 0 16px rgba(111, 66, 193, 0.28);
}

.bus-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.bus-item {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(23, 34, 43, 0.08);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.bus-item:hover {
  background: rgba(255, 255, 255, 0.9);
}

.bus-item.selected {
  background: rgba(15, 118, 110, 0.08);
  border-color: var(--accent);
}

.history-copy {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
}

.history-choke {
  background: #7f1d1d;
  box-shadow: 0 0 18px rgba(127, 29, 29, 0.35);
}

.history-slow {
  background: #d9480f;
  box-shadow: 0 0 18px rgba(217, 72, 15, 0.32);
}

.history-steady {
  background: #f08c00;
  box-shadow: 0 0 18px rgba(240, 140, 0, 0.3);
}

.history-free {
  background: #74c69d;
  box-shadow: 0 0 18px rgba(116, 198, 157, 0.24);
}

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

  #map {
    min-height: 560px;
  }

  #history-map {
    min-height: 440px;
  }
}

.leaflet-container {
  font: inherit;
}

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

.map-popup p {
  margin: 0;
}

.bus-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(23, 34, 43, 0.22);
}

.bus-dot.line-1 {
  background: #0057b8;
}

.bus-dot.line-2 {
  background: #d9480f;
}

.bus-dot.line-3 {
  background: #2b8a3e;
}

.bus-dot.line-4 {
  background: #6f42c1;
}

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

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