/* Dark card layout for a phone screen. All colours are set once here. */
:root {
  --bg: #1c1c1e;
  --card: #000;
  --raised: #2c2c30;
  --line: #2a2a2e;
  --text: #fff;
  --muted: #a1a1aa;
  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --x9: #14b8a6;
  --x21: #60a5fa;
  --x22: #f59e0b;
  --rail: #a78bfa;
  --radius: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 16px);
  max-width: 560px;
  margin: 0 auto;
}

button {
  font: inherit;
  color: inherit;
  background: var(--raised);
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
}

.title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
}
.pill:active { background: var(--accent-dark); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  margin: 12px 0;
}

.route { position: relative; }

.place {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  background: none;
  border-radius: 0;
  padding: 20px 64px 20px 22px;
  font-size: 22px;
  font-weight: 500;
  text-align: left;
}
.place + .place, .swap + .place { border-top: 1px solid var(--line); }

.place-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text); flex: none; margin: 0 5px; }
.dot-ring { width: 22px; height: 22px; background: none; border: 4px solid var(--text); margin: 0; }

.swap {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  padding: 10px;
}

.timerow {
  display: flex;
  align-items: center;
  background: var(--raised);
  border-radius: var(--radius);
}

.time-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  background: none;
  padding: 20px 22px;
  font-size: 20px;
  text-align: left;
}
.time-main svg { width: 28px; height: 28px; }

.icon-btn { background: none; padding: 16px 20px; }

.status { color: var(--muted); min-height: 1em; margin: 12px 4px 0; font-size: 15px; }
.status.bad { color: var(--warn); }

.best { padding: 22px; }
.best h2 { margin: 0 0 10px; font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.best .lines { color: var(--text); font-size: 18px; line-height: 1.45; }
.best .foot-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; gap: 12px; }
.best .big { font-size: 34px; font-weight: 800; white-space: nowrap; }

.badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  min-width: 52px;
  padding: 5px 10px;
  border-radius: 8px;
  color: #0b0b0c;
  font-weight: 700;
  font-size: 17px;
  text-align: center;
}
.badge-X9 { background: var(--x9); }
.badge-X21 { background: var(--x21); }
.badge-X22 { background: var(--x22); }
.badge-rail { background: var(--rail); }
.badge-other { background: var(--muted); }

.walk { display: inline-flex; align-items: center; gap: 2px; color: var(--text); font-size: 17px; }
.walk svg { width: 20px; height: 20px; }

.section-title { margin: 26px 4px 6px; font-size: 22px; font-weight: 800; }

.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 16px;
}
.row .mid { min-width: 0; }
.row .main { font-size: 18px; font-weight: 600; }
.row .sub { color: var(--muted); font-size: 14px; margin-top: 2px; line-height: 1.3; }
.row .end { text-align: right; }
.row .end .main { font-size: 20px; }
.row.past { opacity: 0.55; }
.late { color: var(--warn); }
.cancelled { color: var(--bad); }

.note { color: var(--muted); font-size: 13px; margin: 24px 4px 0; line-height: 1.4; }

.foot { margin-top: 16px; padding: 0 4px; }
.version { color: #6b7280; font-size: 11px; font-family: ui-monospace, Consolas, monospace; }

/* Bottom sheets for pickers and settings. */
.sheet {
  width: min(560px, 100%);
  max-width: 100%;
  margin: auto auto 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(env(safe-area-inset-bottom) + 18px);
  background: var(--bg);
  color: var(--text);
}
.sheet.tall { max-height: 90vh; }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet h2 { margin: 0 0 14px; font-size: 24px; font-weight: 800; }
.sheet h3 { margin: 22px 0 6px; font-size: 17px; }

.field, select {
  width: 100%;
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
select { width: auto; padding: 8px 12px; font-size: 16px; }

.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; background: var(--card); border-radius: 12px; padding: 12px; }
.seg label:has(input:checked) { background: var(--accent); }
.seg input { accent-color: var(--text); }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }

.hint { color: var(--muted); font-size: 14px; margin: 6px 2px 0; line-height: 1.4; }

.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.actions { display: flex; gap: 10px; margin-top: 22px; }
.actions .primary, .primary { background: var(--accent); font-weight: 600; }
.danger { background: #3f1d1d; color: var(--bad); }

.help p { color: #d4d4d8; font-size: 15px; line-height: 1.45; margin: 8px 0; }

.picklist { display: flex; flex-direction: column; margin-top: 10px; max-height: 50vh; overflow-y: auto; }
.picklist button { background: none; border-radius: 0; border-bottom: 1px solid var(--line); text-align: left; padding: 14px 6px; font-size: 17px; }
.picklist .sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
