/* Dark, high-contrast, phone-first. The three states carry the same colors
   as the original single-stop tracker: gray wait, amber heads-up, green go. */

:root {
  --bg: #14171c;
  --panel: #1e232b;
  --panel-2: #232935;
  --border: #2b323d;
  --text: #e7ebf0;
  --muted: #8b95a3;

  --wait-bg: #2a3038;
  --wait-fg: #aab3c0;
  --heads-bg: #b8860b;
  --heads-fg: #1a1204;
  --go-bg: #1f9d4d;
  --go-fg: #05130a;
  --miss-fg: #d98a8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 20px 16px 40px;
}

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.head h1 {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.head .sub {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- controls ---------- */
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 14px;
  align-items: start;
}

@media (max-width: 560px) {
  .controls { grid-template-columns: 1fr; }
}

.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  padding: 11px 12px;
  font-family: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: #4c6b96;
  box-shadow: 0 0 0 3px rgba(76, 107, 150, 0.25);
}

.walk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
}

.hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  min-height: 1em;
}

/* ---------- searchable dropdown ---------- */
.combo { position: relative; }

.results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  max-height: 340px;
  overflow-y: auto;
}

.results li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.results li[aria-selected="true"],
.results li:hover {
  background: #31394a;
}

.results li.note {
  cursor: default;
  color: var(--muted);
  font-size: 13px;
}

.results li.note:hover { background: transparent; }

.r-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.r-city {
  font-size: 12px;
  color: var(--muted);
  flex: none;
}

/* ---------- route circles ---------- */
.dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  flex-wrap: wrap;
}

.dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.dot.lg {
  min-width: 22px;
  height: 22px;
  font-size: 11px;
}

/* ---------- selected stop ---------- */
.selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.selected-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  min-width: 0;
}

#selected-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linkish {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px;
  text-decoration: underline;
  flex: none;
}

.linkish:hover { color: var(--text); }

/* ---------- status cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  background: var(--wait-bg);
  color: var(--wait-fg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 16px 18px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: background-color 240ms ease, color 240ms ease;
}

.card[data-state="heads_up"] {
  background: var(--heads-bg);
  color: var(--heads-fg);
  border-color: transparent;
}

.card[data-state="go"] {
  background: var(--go-bg);
  color: var(--go-fg);
  border-color: transparent;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-route {
  font-size: 14px;
  font-weight: 650;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-toward {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 2px;
}

.card-mid { text-align: center; }

.countdown {
  font-variant-numeric: tabular-nums;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  margin: 2px 0 4px;
}

.countdown.small { font-size: 30px; }

.countdown-label {
  font-size: 12px;
  opacity: 0.8;
}

.card-foot {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.5;
}

.card-foot .time { font-weight: 650; }
.card-foot .then { display: block; font-size: 12px; opacity: 0.72; }
.card-foot .missed { color: var(--miss-fg); }
.card[data-state="go"] .card-foot .missed,
.card[data-state="heads_up"] .card-foot .missed { color: inherit; opacity: 0.8; }

/* ---------- misc ---------- */
.empty, .foot {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
  text-align: center;
}

.notice {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid #b8860b;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

.stale { opacity: 0.55; }
