:root {
  --bg: #000000;
  --surface: #161617;
  --surface-2: #242426;
  --border: #2f2f31;
  --text: #f5f5f7;
  --text-dim: #8e8e93;

  --amber: #ffb000; /* MTA countdown-clock amber */
  --go: #6cbe45;
  --missed: #5a5a5e;

  /* official MTA line colors */
  --line-g: #6cbe45;
  --line-l: #a7a9ac;
  --line-jz: #996633;
  --line-m: #ff6319;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

/* ---- preset selector ---- */
.header {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 14px 16px 10px;
  z-index: 10;
}

.presets {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.presets::-webkit-scrollbar {
  display: none;
}

.preset-btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: none;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.preset-btn[aria-selected="true"] {
  background: var(--text);
  color: #000;
}

/* ---- arrivals board ---- */
.board {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 16px 24px;
}

.message {
  padding: 56px 16px;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-dim);
}

.arrival {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
}
.arrival--headline {
  background: var(--surface-2);
  padding: 20px 18px;
}
.arrival--missed {
  opacity: 0.45;
}

.bullet {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
}
.arrival--headline .bullet {
  width: 56px;
  height: 56px;
  font-size: 32px;
}
.bullet--g { background: var(--line-g); }
.bullet--l { background: var(--line-l); }
.bullet--j,
.bullet--z { background: var(--line-jz); }
.bullet--m { background: var(--line-m); }
.bullet--unknown { background: #444; }

.info {
  flex: 1;
  min-width: 0;
}
.stop {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leave {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.leave--go { color: var(--go); }
.leave--now { color: var(--go); font-weight: 800; }
.leave--missed { color: var(--missed); }

.minutes {
  flex: 0 0 auto;
  min-width: 70px;
  text-align: right;
  font-size: 30px;
  font-weight: 800;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.arrival--headline .minutes {
  font-size: 36px;
}
.minutes .unit {
  margin-left: 3px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ---- footer ---- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}
.link-btn {
  padding: 4px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- edit dialog ---- */
.edit-dialog {
  width: min(92vw, 460px);
  border: none;
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
}
.edit-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.edit-form {
  padding: 20px;
}
.edit-form h2 {
  margin-bottom: 14px;
  font-size: 19px;
}
.edit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-2);
}
.label-input,
.walk-input {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 15px;
}
.label-input {
  flex: 1;
  min-width: 0;
}
.walk-input {
  width: 54px;
  padding: 8px 4px;
  text-align: center;
}
.walk-unit {
  font-size: 12px;
  color: var(--text-dim);
}
.icon-btn {
  padding: 4px 6px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 17px;
  cursor: pointer;
}
.edit-hint {
  margin: 14px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}
.edit-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn-primary,
.btn-secondary {
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.btn-primary {
  padding: 10px 18px;
  background: var(--text);
  color: #000;
  font-size: 15px;
}
.btn-secondary {
  padding: 10px 16px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
