/* The rider app's stylesheet. Plan R §1.3.
 *
 * Its own file rather than a section of app.css, because the rider pays for
 * every byte on a prepaid plan and needs none of the owner's screens. Same
 * colours as the owner's app, so it still looks like Roundly.
 *
 * For thumbs and sunlight: every button at least 48px tall, high contrast,
 * the next door in large type, one primary action per screen, nothing that
 * depends on hover, and no animation.
 */

:root {
  color-scheme: light dark;
  --ink: #16211c;
  --muted: #55655d;
  --bg: #fbfaf7;
  --card: #ffffff;
  --line: #d9d6cc;
  --accent: #1f6f4a;
  --accent-ink: #ffffff;
  --next: #fff4d6;
  --next-line: #c98a00;
  --done: #e6f2ea;
  --failed: #fbe7e3;
  --danger: #a3301f;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef2ef;
    --muted: #a3b0a8;
    --bg: #101512;
    --card: #18211d;
    --line: #2c3730;
    --accent: #6ec49a;
    --accent-ink: #06120c;
    --next: #3a2f12;
    --next-line: #e0a82e;
    --done: #16291f;
    --failed: #3a1c17;
    --danger: #ef9a8c;
  }
}

* { box-sizing: border-box; }

/* `hidden` must win over any display rule below. See app.css for the day it
 * did not. */
[hidden] { display: none !important; }

body.rider {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans Devanagari", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button,
.rider-button {
  font: inherit;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:disabled { opacity: 0.6; }

.rider-primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.rider-link {
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}

.rider-muted { color: var(--muted); font-size: 16px; }
.rider-error { color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- toggle */

.lang-toggle { display: inline-flex; gap: 6px; }
.lang-toggle button { min-width: 72px; padding: 0 12px; }
.lang-toggle button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
  font-weight: 700;
}

/* --------------------------------------------------------------- sign in */

.rider-signin {
  max-width: 420px;
  margin: 0 auto;
  padding: 16px;
}

.rider-signin .lang-toggle { margin-bottom: 8px; }

.rider-signin form {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.rider-signin input {
  font: inherit;
  font-size: 22px;
  min-height: 52px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  width: 100%;
}

.rider-signin .rider-primary { margin-top: 8px; }

/* --------------------------------------------------------------- the app */

.rider-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--card);
  border-bottom: 2px solid var(--line);
}

.rider-who { display: grid; line-height: 1.25; min-width: 0; }
.rider-who strong,
.rider-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rider-page { max-width: 640px; margin: 0 auto; padding: 12px 16px 32px; }

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

.rider-progress { margin: 0 auto 0 0; font-size: 20px; font-weight: 700; }

.rider-notice {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--next);
  border: 2px solid var(--next-line);
}

.rider-round { margin-top: 16px; }
.rider-round h2 { font-size: 20px; margin: 0 0 4px; }
.rider-round-status { margin: 0 0 8px; color: var(--muted); }

.rider-doors { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.rider-row {
  width: 100%;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 10px;
  align-items: start;
  text-align: left;
  padding: 12px;
  min-height: 64px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.rider-row.is-next { background: var(--next); border-color: var(--next-line); }
.rider-row.is-done { background: var(--done); }
.rider-row.is-failed { background: var(--failed); }
.rider-row.is-done,
.rider-row.is-failed { opacity: 0.8; }

/* Every line of a row sits in the right-hand column, however many there
 * are: a door can have a status, a reason, an area, the items, the money
 * and a warning. Left to auto-placement, the fifth line fell into the 44px
 * number column and wrapped a word to a line. */
.rider-row > :not(.rider-seq) { grid-column: 2; }

.rider-seq {
  grid-column: 1;
  grid-row: 1 / span 8;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--ink);
  color: var(--bg);
}

.rider-name { font-size: 20px; font-weight: 700; }
/* One line, cut off when long: the flat or house that starts an address is
 * what tells two same-named doors apart. `min-width: 0` lets the grid cell
 * shrink, or the ellipsis never appears and the row widens instead. */
.rider-address {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 16px;
}
.rider-row.is-next .rider-name { font-size: 22px; }
.rider-chip { font-weight: 700; }
.rider-row .rider-flag { color: var(--danger); font-weight: 600; }

/* --------------------------------------------------------------- one door */

.rider-back { margin-bottom: 12px; }

.rider-door h2 { font-size: 26px; margin: 0 0 12px; }
.rider-door h3 { font-size: 16px; margin: 16px 0 4px; color: var(--muted); }
.rider-door p { margin: 0; }
.rider-door ul { margin: 0; padding-left: 20px; }

.rider-actions { display: grid; gap: 8px; margin: 16px 0; }
.rider-actions .rider-button { width: 100%; font-weight: 700; }
.rider-actions .is-go {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.rider-collect { font-size: 22px; font-weight: 700; }

/* --------------------------------------------- marking a door (R.3) */

.rider-strip {
  margin: 0 0 8px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--done);
  font-weight: 600;
  font-size: 16px;
}
.rider-strip.is-waiting { background: var(--next); border: 2px solid var(--next-line); }

.rider-update {
  width: 100%;
  margin: 0 0 8px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.rider-waiting { color: var(--next-line); font-weight: 700; font-size: 16px; }

.rider-marks { display: grid; gap: 8px; margin: 16px 0; }
.rider-marks button { width: 100%; min-height: 64px; font-size: 22px; }

.rider-secondary {
  width: 100%;
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 700;
}

.rider-choices { display: grid; gap: 8px; margin: 8px 0 16px; }
.rider-choices button { width: 100%; min-height: 56px; font-weight: 600; }
.rider-choice[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.rider-door label { display: block; margin: 8px 0 4px; font-weight: 600; }
.rider-door textarea,
.rider-door input {
  font: inherit;
  font-size: 22px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}

.rider-undo { margin-top: 6px; width: 100%; font-weight: 700; }
.rider-done-title { font-size: 24px; font-weight: 700; }

/* --------------------------------------------------------------- the map */

.rider-map {
  height: 70vh;
  min-height: 320px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  z-index: 0;
}

.rider-attribution { font-size: 12px; color: var(--muted); }

.rider-pin {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 15px/1 system-ui, sans-serif;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid var(--bg);
}
.rider-pin.is-next { background: var(--next-line); color: #000; }

.rider-foot { margin-top: 32px; text-align: center; }
