:root {
  color-scheme: dark;
  --bg: #242624;          /* Asphalt */
  --surface: #2c2f2d;
  --surface-2: #343735;
  --line: #3f4340;        /* hairlines, decorative only */
  --text: #f3f0e8;       /* Warm ivory, 13.4:1 on Asphalt */
  --muted: #b7b1a4;      /* Limestone, 7.1:1 */
  --signal: #f2b07a;     /* small labels and progress, 8.2:1 */
  --ember: #b95332;      /* decorative only */
  --danger: #f28b82;
  --radius: 6px;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

/* Keep hidden elements hidden even when a class sets display. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Brand bar */
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.wordmark {
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
}
.brand .tagline { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); text-align: right; }

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 42px;
  line-height: 1.02;
  letter-spacing: -0.005em;
  margin: 6px 0 2px;
}

/* Section titles are small mono labels, like the boards */
h2 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#join h2, #my-name {
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  margin: 0;
  padding: 0;
  border: 0;
}

form, section { display: flex; flex-direction: column; gap: 10px; }

label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
}

input[type="text"], input[type="url"] {
  width: 100%;
  padding: 13px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
input::placeholder { color: #8f8a7f; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }

button {
  font: inherit;
  font-size: 15px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }

button.primary {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  font-weight: 600;
  margin-top: 4px;
}

.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.row button:not(.primary) { flex: none; }

.muted { color: var(--muted); font-size: 14px; margin: 0; }
.error { color: var(--danger); margin: 0; font-size: 14px; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0; }
.link { color: var(--signal); font-size: 14px; }

/* Progress: a hairline with a peach fill */
.progress { height: 2px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--signal); }

.next-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.next-name {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1.04;
  margin: 0;
  overflow-wrap: anywhere;
}

.banner {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  margin: 0;
}

/* Stops */
.stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stops li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.stops .num { font-family: var(--mono); font-size: 12px; color: var(--signal); min-width: 2.2em; }
.stops .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stops button { padding: 6px 10px; font-size: 13px; }
.stops button.remove { color: var(--danger); }
.stops .tick {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px;
}
.stops .done .tick { border-color: var(--signal); color: var(--signal); }
.stops .done .name { color: var(--muted); }
.stops .done .num { color: var(--muted); }
.stops .next .name { font-weight: 600; }
.stops .next .tick { border-color: var(--signal); }
.stops li .nav-row { flex: none; }
.stops li .icon-btn { padding: 6px 8px; }

/* Navigation buttons */
.nav-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.icon-btn svg { width: 18px; height: 18px; flex: none; }
.stops li .icon-btn span { display: none; }

/* Cars */
.choices, .cars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.choices button { width: 100%; text-align: left; }
.car {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.car-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.car-header .name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.car-header .muted { font-family: var(--mono); font-size: 12px; }
.car p { margin: 0; }

/* Just-created trip */
#new-trip { display: flex; flex-direction: column; gap: 10px; }

/* Sign-in */
.brand { flex-wrap: wrap; }
.account { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.account .muted { font-size: 12px; overflow-wrap: anywhere; }
.account button { padding: 8px 12px; min-height: 40px; font-size: 13px; }
.step { display: flex; flex-direction: column; gap: 10px; }

/* Profiles, avatars and the invitation card */
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; overflow: hidden; }
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar.initial { background: var(--surface-2); color: var(--text); font-weight: 600; border: 1px solid var(--line); }
.avatar-preview { display: flex; }
.avatar-preview .avatar { width: 56px; height: 56px; font-size: 22px; }
.profile-form { gap: 10px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; min-height: 40px; padding: 0; border-radius: 50%; border: 2px solid var(--line); }
.swatch[aria-pressed="true"], .shape-choice[aria-pressed="true"] { border-color: var(--signal); outline: 2px solid var(--signal); outline-offset: 1px; }
.shape-choice { width: 64px; min-height: 44px; padding: 6px 8px; color: var(--muted); }
.shape-choice[aria-pressed="true"] { color: var(--text); }
.shape-choice svg { width: 100%; height: 28px; display: block; }
.invite { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.invite h1 { overflow-wrap: anywhere; }
.invite button.primary { min-height: 44px; }
.car-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.car-titles { display: flex; flex-direction: column; min-width: 0; }
.car-titles .muted { font-family: var(--sans); font-size: 13px; overflow-wrap: anywhere; }
button, .icon-btn { min-height: 40px; }
.stops button { min-height: 40px; }
