/* FlamingoBusser
   One theme, follows the system. One accent (rose). One radius rule:
   cards 14px, controls 10px, pills and buttons fully rounded. */

:root {
  color-scheme: light dark;

  --bg: #fbfafa;
  --surface: #ffffff;
  --surface-2: #f3f1f1;
  --line: #e4e0e0;
  --line-strong: #cfc9c9;
  --text: #1c1a1a;
  --text-dim: #625c5c;
  --text-faint: #8a8383;
  --accent: #b3235a;
  --accent-ink: #ffffff;
  --accent-wash: #fbe9f0;
  --live: #0e7a5f;
  --live-wash: #e2f3ed;
  --warn-wash: #fdf1dd;
  --warn-line: #e6c88a;
  --warn-ink: #6b4a10;

  --r-card: 14px;
  --r-control: 10px;
  --r-pill: 999px;

  --shadow: 0 1px 2px rgb(28 26 26 / 0.05), 0 8px 24px rgb(28 26 26 / 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131111;
    --surface: #1c1a1a;
    --surface-2: #262323;
    --line: #322e2e;
    --line-strong: #453f3f;
    --text: #f4f1f1;
    --text-dim: #a8a0a0;
    --text-faint: #7d7575;
    --accent: #ff6b9d;
    --accent-ink: #2a0715;
    --accent-wash: #331621;
    --live: #4ade9f;
    --live-wash: #12291f;
    --warn-wash: #2e2313;
    --warn-line: #574320;
    --warn-ink: #e8c98a;

    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* ---------- header ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.head-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mark {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
}
.mark span { color: var(--accent); }

.clock {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---------- tabs ---------- */

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 4px;
  margin: 16px 0;
}

.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-weight: 550;
  font-size: 15px;
  padding: 9px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}
.tabs button:active { transform: scale(0.98); }

/* ---------- controls ---------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-dim);
  margin-bottom: 6px;
}

select {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  padding: 12px 40px 12px 14px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.swap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.swap .end { min-width: 0; }
.swap .end-label {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 2px;
}
.swap .end-name {
  font-size: 17px;
  font-weight: 620;
  letter-spacing: -0.01em;
}

.swap button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  width: 42px;
  height: 42px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: transform 0.15s ease;
}
.swap button:active { transform: scale(0.94); }
.swap button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.swap button svg { width: 19px; height: 19px; }

/* ---------- cards ---------- */

.list { display: grid; gap: 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px;
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  flex: none;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  text-shadow: 0 1px 1px rgb(0 0 0 / 0.25);
}

.card-title { min-width: 0; flex: 1; }

.card-title .name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title .dest {
  font-size: 13px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.when {
  flex: none;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.when .big {
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.when .sub {
  font-size: 12px;
  color: var(--text-faint);
}
.when.is-live .big { color: var(--live); }

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--live);
  background: var(--live-wash);
  border-radius: var(--r-pill);
  padding: 2px 8px;
  margin-top: 4px;
}
.live-tag i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.times {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.times span {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  background: var(--surface-2);
  border-radius: var(--r-pill);
  padding: 3px 10px;
}

.card.sleeping { opacity: 0.6; }
.card.sleeping .when .big { font-size: 14px; font-weight: 550; color: var(--text-faint); }

/* ---------- hop rows ---------- */

.hop-row { display: flex; align-items: center; gap: 10px; }

.hop-body { flex: 1; min-width: 0; }

.hop-when {
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.hop-when.is-live { color: var(--live); }

.hop-detail {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.hop-ride {
  flex: none;
  text-align: right;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.hop-ride b {
  display: block;
  font-size: 16px;
  font-weight: 620;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ---------- alerts ---------- */

.alert {
  background: var(--warn-wash);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-card);
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--warn-ink);
}

.alert summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert summary::-webkit-details-marker { display: none; }
.alert summary svg { width: 16px; height: 16px; flex: none; }

.alert-body {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.alert-body p { margin: 0 0 8px; }
.alert-body :last-child { margin-bottom: 0; }

.notice + .notice {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--warn-line);
}
.notice h2 {
  font-size: 14px;
  font-weight: 650;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

/* ---------- states ---------- */

.skeleton { display: grid; gap: 10px; }

.skeleton .card-top { align-items: center; }

.shim {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-control);
  animation: shim 1.4s linear infinite;
}
@keyframes shim { to { background-position: -200% 0; } }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty strong {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 620;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.retry {
  appearance: none;
  margin-top: 14px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 22px;
  border-radius: var(--r-pill);
  cursor: pointer;
}
.retry:active { transform: translateY(1px); }
.retry:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.foot {
  margin-top: 28px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.6;
}
.foot a { color: var(--text-dim); }

.stale {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--warn-ink);
  background: var(--warn-wash);
  border-radius: var(--r-pill);
  padding: 4px 10px;
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
