:root {
  color-scheme: light;
  --background: #f6f4ee;
  --ink: #233c36;
  --muted: #69756d;
  --line: #dcded3;
  --soft: #e8ece1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid #58826e;
  outline-offset: 4px;
}
button:disabled { cursor: default; }
[hidden] { display: none !important; }

.board {
  width: min(100%, 660px);
  margin: 0 auto;
  padding: clamp(24px, 7vh, 64px) 24px 32px;
}

.stops {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px 10px;
  margin: -4px -4px 0;
  scrollbar-width: thin;
}

.stop-button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
.stop-button:hover { background: var(--soft); }
.stop-button[aria-pressed="true"] {
  color: var(--background);
  background: var(--ink);
  border-color: var(--ink);
}

.board-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  gap: 16px;
  margin: 4px 0 16px;
}
.freshness { margin: 0; color: var(--muted); font-size: .8rem; }
.freshness.stale { color: #906e32; }
.text-button {
  flex-shrink: 0;
  min-height: 40px;
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button:hover { color: var(--ink); }

.rename-form { margin: -8px 0 24px; }
.rename-form label { display: block; font-size: .8rem; margin-bottom: 6px; color: var(--muted); }
.rename-fields { display: flex; align-items: center; gap: 12px; }
.rename-fields input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink);
  background: #fffdf8;
}
.save-button {
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  background: var(--ink);
  color: var(--background);
}

.arrivals { min-height: 220px; }
.trip {
  display: grid;
  grid-template-columns: minmax(70px, .8fr) minmax(0, 2fr);
  gap: 20px;
  align-items: baseline;
  border-top: 1px solid var(--line);
  padding: 19px 0 21px;
}
.trip:last-child { border-bottom: 1px solid var(--line); }
.route { font-size: 1.5rem; font-weight: 650; letter-spacing: -.04em; }
.arrival { margin: 0; font-size: 2rem; line-height: 1.2; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.trip:first-child .arrival { font-size: 3.5rem; font-weight: 650; }
.arrival-unit { margin-left: .16em; font-size: .45em; font-weight: 450; letter-spacing: 0; }
.arrival-clock { margin: 6px 0 0; font-size: 1rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.trip-details { margin: 7px 0 0; color: var(--muted); font-size: .8rem; }
.trip-details span + span::before { content: " · "; }
.crowding { display: inline-flex; align-items: center; gap: 6px; }
.crowding svg { width: 45px; height: 20px; }
.crowding .person { fill: transparent; stroke: #a8b0a5; stroke-width: 1; }
.crowding .person-active { fill: currentColor; stroke: currentColor; }
.crowding-light { color: #26734e; }
.crowding-medium { color: #8b6b12; }
.crowding-medium .person-active { fill: #c9a026; stroke: #b28a15; }
.crowding-heavy { color: #b7393e; }
.is-stale .arrival, .is-stale .route { color: #647268; }

.empty { padding: 38px 0 54px; }
.empty-title { margin: 0 0 8px; font-size: 1.25rem; font-weight: 550; letter-spacing: -.025em; }
.empty-description { margin: 0; max-width: 380px; color: var(--muted); font-size: .9rem; }
.mybus-hint { margin: 0 0 10px; color: var(--muted); font-size: .8rem; }
.mybus-frame { display: block; width: 100%; height: 650px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }

.board-footer { display: flex; flex-wrap: wrap; gap: 7px 16px; align-items: baseline; margin-top: 24px; }
.board-footer a { color: var(--ink); font-size: .85rem; text-underline-offset: 3px; }
.footer-note { color: var(--muted); font-size: .75rem; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 420px) {
  .board { padding-left: 20px; padding-right: 20px; }
  .stop-button { padding-left: 13px; padding-right: 13px; font-size: .95rem; }
  .trip { grid-template-columns: 76px minmax(0, 1fr); gap: 14px; }
  .trip:first-child .arrival { font-size: 3rem; }
}
