/* Friendly theme: warm teal with coral for reporting, soft rounded cards. */
:root {
  --bg: #ffffff;
  --fg: #2c2c2a;
  --muted: #6b6a64;
  --line: #e6e3da;
  --soft: #f1efe8;
  --accent: #1e3a5f;
  --accent-fg: #ffffff;
  --accent-soft: #fff1e6;
  --accent-soft-fg: #0f2440;
  --coral: #c2410c;
  --danger: #b4351f;
  --banner-bg: #0f2440;
  --banner-fg: #ffffff;
  /* Soft tints for colorful buttons and tiles (text in the same color family). */
  --coral-soft: #ffedd5; --coral-soft-fg: #7c2d12;
  --amber-soft: #faeeda; --amber-soft-fg: #633806;
  --blue-soft: #e6f1fb; --blue-soft-fg: #0c447c;
  --violet-soft: #eeedfe; --violet-soft-fg: #3c3489;
  --red-soft: #fcebeb; --red-soft-fg: #791f1f;
  --green-soft: #eaf3de; --green-soft-fg: #27500a;
  --shadow: 0 4px 16px rgba(44, 44, 42, 0.16);
  --radius: 18px;
  --dock-h: 64px;
}

/* Night: set by map-theme.js at sunset (or by the Map look choice in Me → Settings),
   so the panels match the dark map. */
html[data-theme="night"] {
  --bg: #23231f;
  --fg: #f1efe8;
  --muted: #b4b2a9;
  --line: #3c3c38;
  --soft: #2f2f2b;
  --accent: #fdba74;
  --accent-fg: #0f2440;
  --accent-soft: #1c2b44;
  --accent-soft-fg: #c7d7ee;
  --banner-bg: #1c2b44;
  --coral-soft: #4a1b0c; --coral-soft-fg: #f5c4b3;
  --amber-soft: #412402; --amber-soft-fg: #fac775;
  --blue-soft: #042c53; --blue-soft-fg: #b5d4f4;
  --violet-soft: #26215c; --violet-soft-fg: #cecbf6;
  --red-soft: #501313; --red-soft-fg: #f7c1c1;
  --green-soft: #173404; --green-soft-fg: #c0dd97;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font: 16px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  overflow: hidden;
}

#map { position: absolute; inset: 0; }

.panel {
  position: absolute;
  left: 12px;
  right: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 2;
  max-width: 560px;
  margin: 0 auto;
}

#top { top: calc(10px + env(safe-area-inset-top)); }
#banner { top: calc(10px + env(safe-area-inset-top)); background: var(--banner-bg); color: var(--banner-fg); }
#bottom { bottom: calc(var(--dock-h) + 20px + env(safe-area-inset-bottom)); max-height: 55vh; overflow-y: auto; }
body.navigating #bottom { bottom: calc(10px + env(safe-area-inset-bottom)); }

#dock {
  position: absolute; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; height: var(--dock-h); z-index: 3;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--bg); border-radius: 22px; box-shadow: var(--shadow); padding: 4px;
}
#dock button {
  position: relative; flex: 1; border: none; background: none; min-height: 56px; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; font-weight: 600; color: var(--tab, var(--muted)); border-radius: 16px;
}
#dock button .ico { font-size: 22px; line-height: 1; }
/* Each tab has its own color; the open one gets a soft pill in that color. */
#nearby-btn { --tab: var(--coral); --tab-soft: var(--coral-soft); --tab-soft-fg: var(--coral-soft-fg); }
#report-btn { --tab: var(--danger); --tab-soft: var(--red-soft); --tab-soft-fg: var(--red-soft-fg); }
#caravan-btn { --tab: #185fa5; --tab-soft: var(--blue-soft); --tab-soft-fg: var(--blue-soft-fg); }
#me-btn { --tab: var(--accent); --tab-soft: var(--accent-soft); --tab-soft-fg: var(--accent-soft-fg); }
#dock button.on, body:has(#report-sheet:not([hidden])) #report-btn,
body:has(#caravan[open]) #caravan-btn, body:has(#me[open]) #me-btn { background: var(--tab-soft); color: var(--tab-soft-fg); }
html[data-theme="night"] #dock button { color: var(--tab-soft-fg); }
#dock .badge {
  position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #16a34a; color: #fff; font-size: 11px; line-height: 18px; font-weight: 700;
}
#dock .badge.paused { background: #888780; }
body.navigating #dock { display: none; }

#drive-report {
  margin-left: auto; width: 64px; height: 64px; border-radius: 50%; padding: 0;
  background: var(--coral); border-color: var(--coral); color: #fff; font-size: 28px;
}

.row { display: flex; gap: 8px; align-items: center; }
.buttons { flex-wrap: wrap; margin-top: 8px; }

input[type="search"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
}

button, select {
  font: inherit;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  min-height: 44px;
}

button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); font-weight: 600; }
button.link { background: none; border: none; padding: 0 4px; min-height: 0; text-decoration: underline; color: inherit; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.seg button { border: none; border-radius: 0; padding: 10px 12px; }
.seg button.on { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
/* Full-width switch: equal parts on a soft track (Drive/Walk/Bike, distances). */
.seg-full { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border: none; border-radius: 12px; background: var(--soft); }
.seg-full button { border-radius: 9px; min-height: 40px; padding: 6px 4px; background: none; white-space: nowrap; }
.seg-full button[hidden] { display: none; }

/* Search boxes: a colored dot for start (blue) and end (coral), with the
   locate and swap buttons inside the box. */
.field { position: relative; }
.field input[type="search"] { padding-left: 30px; padding-right: 46px; }
.pin-dot { position: absolute; left: 12px; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; z-index: 1; }
.pin-dot.start { background: #378add; }
.pin-dot.end { background: var(--coral); }
button.in-field { position: absolute; right: 4px; min-height: 36px; width: 38px; padding: 0; border: none; background: none; font-size: 18px; color: var(--accent); }

/* Three equal, softly colored buttons under the search boxes. */
.priority-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.priority-row button { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; border-color: transparent; }
.tint.teal { background: var(--accent-soft); color: var(--accent-soft-fg); }
.tint.amber { background: var(--amber-soft); color: var(--amber-soft-fg); }
.tint.violet { background: var(--violet-soft); color: var(--violet-soft-fg); }
.tint.coral { background: var(--coral-soft); color: var(--coral-soft-fg); }
.tint.blue { background: var(--blue-soft); color: var(--blue-soft-fg); }
.tint.red { background: var(--red-soft); color: var(--red-soft-fg); }
.tint.green { background: var(--green-soft); color: var(--green-soft-fg); }
.tint.gray { background: var(--soft); color: var(--fg); }

#results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
#results li { padding: 10px 6px; border-top: 1px solid var(--line); cursor: pointer; }
#results li:hover { background: rgba(127, 127, 127, 0.12); }
#results .sub { color: var(--muted); font-size: 14px; }

/* Route cards: one at a time, full width; swipe for the next. */
#routes {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
#routes::-webkit-scrollbar { display: none; }
.route-opt {
  flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; gap: 6px;
  align-items: stretch; text-align: left; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px;
}
.route-opt.on { border-color: var(--accent); }
.ro-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ro-time { font-size: 22px; }
.ro-meta { color: var(--muted); font-size: 14px; text-align: right; }
.ro-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.wx-pill { cursor: pointer; }
.wx-pill[hidden] { display: none; }
.ro-extra { color: var(--muted); font-size: 13px; }
.ro-extra:empty { display: none; }
#route-dots { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
#route-dots button { min-height: 24px; width: 24px; padding: 0; border: none; background: none; display: grid; place-items: center; }
#route-dots button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
#route-dots button.on::before { background: var(--accent); width: 18px; border-radius: 4px; }

/* Start fills the width; the rest of the trip buttons share one row evenly. */
#go { width: 100%; margin-top: 8px; min-height: 50px; font-size: 18px; }
.trip-buttons { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.trip-buttons > * { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* While moving: three across, and Report as one wide, easy target. */
body.navigating .trip-buttons { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.navigating .trip-buttons > :not(#drive-report) { padding: 4px; font-size: 14px; line-height: 1.15; white-space: normal; }
body.navigating #drive-report { grid-column: 1 / -1; width: 100%; height: 56px; border-radius: 14px; margin: 0; font-size: 20px; font-weight: 700; }

/* Fold handle: a short bar to tap. Folded, the top box is just "Where to?"
   and the bottom box is the three route choices and Start. */
.handle {
  display: flex; justify-content: center; align-items: center; width: 100%;
  min-height: 24px; padding: 0; margin: 4px 0 -6px; border: none; background: none;
}
#bottom .handle { margin: -6px 0 4px; }
.handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
body.navigating .handle { display: none; }
#top.folded > .row:first-child, #top.folded #stops, #top.folded .priority-row, #top.folded #priority,
#top.folded #priority-hint, #top.folded #saved { display: none; }
#top.folded .field-gap { margin-top: 0; }
#bottom.folded #trip-summary, #bottom.folded #tradeoff, #bottom.folded #offer,
#bottom.folded #weather, #bottom.folded #legend, #bottom.folded .note,
#bottom.folded #sim, #bottom.folded #status:empty { display: none; }
#bottom.folded .ro-extra { display: none; }

.field-gap { margin-top: 8px; }
#from-here.warn { background: #fef3c7; color: #92400e; border-radius: 8px; }
#from-here.ok { color: var(--accent); }
.gps-check { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.5; background: var(--accent-soft); color: var(--accent-soft-fg); padding: 8px 10px; border-radius: 10px; margin: 0; }
#priority-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
button.small { min-height: 36px; padding: 6px 10px; font-size: 14px; }

.stop-row { margin-top: 8px; }
.stop-row input { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }

#trip-summary { font-size: 14px; margin-top: 6px; }
#trip-summary:empty { display: none; }

#speedo {
  position: absolute;
  left: 12px;
  /* Just above the bottom panel; --float-bottom is set by app.js. */
  bottom: var(--float-bottom, 180px);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#speed-val { font-size: 28px; font-weight: 700; }
#speedo small { font-size: 12px; color: var(--muted); }
#speedo.over { background: #dc2626; color: #fff; }
#speedo.over small { color: #fee2e2; }

/* A US-style speed limit sign above the speedometer: always black on white. */
#speed-limit {
  position: absolute;
  left: 22px;
  bottom: calc(var(--float-bottom, 180px) + 82px);
  width: 52px;
  padding: 4px 0 3px;
  border: 3px solid #111;
  border-radius: 8px;
  background: #fff;
  color: #111;
  box-shadow: var(--shadow);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
#speed-limit[hidden] { display: none; }
/* No posted limit on record: the state default, dashed and gray so it doesn't pass for a real sign. */
#speed-limit.likely { border-style: dashed; border-color: #6b7280; color: #4b5563; }
#speed-limit small { font-size: 8px; font-weight: 700; text-align: center; letter-spacing: 0.02em; }
#speed-limit b { font-size: 24px; margin-top: 2px; }

#nearby { bottom: calc(var(--dock-h) + 20px + env(safe-area-inset-bottom)); z-index: 4; max-height: 55vh; overflow-y: auto; }
body.navigating #nearby { bottom: calc(10px + env(safe-area-inset-bottom)); }
.nearby-head { justify-content: space-between; }
/* Category tabs: three across, so none is ever cut off. */
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.tabs button { min-height: 36px; padding: 4px 6px; font-size: 14px; border-radius: 18px; border-color: transparent; background: var(--soft); color: var(--fg); white-space: nowrap; }
.tabs button.on { background: var(--accent-soft); color: var(--accent-soft-fg); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button { min-height: 40px; padding: 6px 12px; border-radius: 20px; font-size: 14px; }
.chips button.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
#nearby-status { color: var(--muted); font-size: 13px; margin-top: 6px; }
#nearby-list { list-style: none; margin: 6px 0 0; padding: 0; }
#nearby-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
#nearby-list .info { flex: 1; min-width: 0; }
#nearby-list .sub { color: var(--muted); font-size: 13px; }
.place-pin { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); cursor: pointer; }

#sharing-pill {
  border-radius: 18px; min-height: 36px; padding: 6px 12px; font-size: 13px;
  background: #16a34a; color: #fff; border: none;
}
#sharing-pill.paused { background: #6b7280; }
#check-pill { border-radius: 18px; min-height: 36px; padding: 6px 12px; font-size: 13px; background: #1d4ed8; color: #fff; border: none; }
#check input { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-left: 6px; }
dialog.alarm { border: 4px solid #dc2626; text-align: center; }
#welcome section > button.big { display: block; width: 100%; margin-top: 10px; }
.welcome-list { padding-left: 0; list-style: none; }
#welcome .wordmark { display: block; height: 52px; width: auto; margin: 4px auto 6px; }
#welcome .night-only, html[data-theme="night"] #welcome .day-only { display: none; }
html[data-theme="night"] #welcome .night-only { display: block; }
.welcome-list li { margin: 8px 0; }
#legal ul { padding-left: 20px; }
#legal li { margin: 6px 0; }
dialog.alarm h2 { font-size: 30px; color: #dc2626; }
dialog.alarm button { display: block; width: 100%; margin-top: 10px; }
#toast {
  position: absolute; left: 50%; transform: translateX(-50%); top: 45%; z-index: 5;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px;
  max-width: 90vw; text-align: center;
}
#report-sheet { bottom: calc(var(--dock-h) + 20px + env(safe-area-inset-bottom)); z-index: 4; }
/* One box at a time above the dock: Report or Nearby replaces the route box. */
body:has(#report-sheet:not([hidden])) #bottom, body:has(#nearby:not([hidden])) #bottom,
body:has(#caravan[open]) #bottom, body:has(#me[open]) #bottom { display: none; }
/* Caravan and Me grow up from the bar in the same place and size as
   Nearby and Report (they're <dialog>s opened without a backdrop). */
dialog#caravan, dialog#me {
  position: absolute; top: auto; left: 12px; right: 12px; bottom: calc(var(--dock-h) + 20px + env(safe-area-inset-bottom));
  width: auto; max-width: 560px; margin: 0 auto; padding: 12px; z-index: 4; max-height: 55vh; overflow-y: auto;
}
body.navigating #report-sheet { bottom: calc(10px + env(safe-area-inset-bottom)); }
#report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
#report-grid button { min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px; padding: 6px; }
#report-grid .ico { font-size: 26px; line-height: 1; }
#prompt { top: calc(10px + env(safe-area-inset-top)); z-index: 5; border: 3px solid #f59e0b; }
#prompt-text { font-size: 20px; font-weight: 600; }
.prompt-buttons { margin-top: 10px; }
button.big { flex: 1; min-height: 64px; font-size: 18px; }
#dock #me-btn.has-news::after {
  content: ''; position: absolute; top: 6px; right: calc(50% - 18px);
  width: 10px; height: 10px; border-radius: 50%; background: var(--coral);
}
#fam-links, #fam-trips { list-style: none; padding: 0; margin: 8px 0; }
#fam-links li, #fam-trips li { padding: 8px 0; border-top: 1px solid var(--line); }
#fam-links .row { margin-top: 6px; }
#family details { margin: 10px 0; }
#family summary { cursor: pointer; padding: 6px 0; }
.fam-code { font-size: 22px; letter-spacing: 2px; }
.fam-shared { margin: 4px 0 8px; padding-left: 20px; }
.fam-trip .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0; font-size: 14px; }
.fam-trip .facts .warn { color: #b45309; font-weight: 600; }
.fam-trip button { margin-top: 4px; }
#recap-facts { padding-left: 4px; list-style: none; font-size: 17px; }
#recap-facts li { margin: 6px 0; }
.recap-new { font-weight: 700; color: var(--accent); }
#recap-badges { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#recap-badges li { display: flex; gap: 8px; align-items: center; opacity: 0.45; font-size: 14px; }
#recap-badges li.earned { opacity: 1; }
#recap-badges .ico { font-size: 26px; }
.get-app {
  display: block; margin-top: 10px; padding: 12px; border-radius: 12px; text-align: center;
  background: var(--accent); color: #fff; font-weight: 700; text-decoration: none;
}
/* Truck size in Route options. */
.truck-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.truck-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.truck-grid .row { gap: 4px; font-weight: 400; }
.truck-grid .row .text-in { width: 4.2em; }

/* Caravan: same look as Me and Settings. */
#caravan { width: min(520px, calc(100vw - 24px)); }
.field-label { display: block; font-weight: 600; font-size: 14px; margin: 10px 0 4px; }
.text-in { width: 100%; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }
#caravan .tile-grid { margin-top: 10px; }
.join-tile { gap: 6px; }
.code-in { text-align: center; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; padding: 8px; }
.join-tile .primary { width: 100%; min-height: 40px; }
.code-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border-radius: 16px; background: var(--blue-soft); color: var(--blue-soft-fg); }
.code-card strong { font-size: 30px; letter-spacing: 6px; }
.code-card .note { color: inherit; }
.even-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.status-chip:empty { display: none; }
.status-chip { margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: var(--soft); font-size: 14px; }
#cv-members { list-style: none; padding: 0; margin: 10px 0; }
#cv-members li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--line); }
#cv-members li .who { font-weight: 600; }
#cv-members li .note { margin-left: auto; }
/* Regroup point and stop vote cards, and the caravan's three tools. */
.cv-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; margin: 8px 0; border-radius: 14px; }
.cv-card .even-row { margin-top: 2px; }
.vote-choice { text-align: left; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--fg); }
.vote-choice.on { border-color: var(--accent); font-weight: 700; }
.vote-choice:disabled { opacity: 1; }
.cv-tools { margin-top: 8px; }
/* Dispatcher view (dispatch.html): a list beside the map on a computer,
   under it on a phone. */
#dispatch { top: calc(10px + env(safe-area-inset-top)); left: 12px; right: auto; width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 20px); overflow-y: auto; z-index: 3; margin: 0; }
#dp-list { list-style: none; padding: 0; margin: 8px 0; }
#dp-list li { padding: 10px 4px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
#dp-list .dp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#dp-list .dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
#dp-list .pill { margin-left: auto; }
#dp-list button { align-self: flex-start; }
@media (max-width: 600px) { #dispatch { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); right: 12px; width: auto; max-height: 55vh; } }
.member-pin { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.member-pin .dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,0.25); }
.member-pin.stale { opacity: 0.5; }
.member-pin .dot.has-icon { width: 34px; height: 34px; border-width: 3px; border-style: solid; display: grid; place-items: center; font-size: 20px; line-height: 1; }
.member-ico { display: inline-block; width: 20px; text-align: center; font-size: 16px; line-height: 1; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; margin: 4px 0 10px; }
.avatar-pick { font-size: 22px; line-height: 1; padding: 8px 0; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.avatar-pick[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); }
.member-pin .label { margin-top: 2px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,0.9); color: #111; padding: 1px 5px; border-radius: 6px; white-space: nowrap; }
.report-pin { font-size: 24px; line-height: 1; cursor: pointer; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5)); }

.check { display: block; margin: 10px 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; }
.note { font-size: 13px; color: var(--muted); }
input[type="datetime-local"] { font: inherit; padding: 4px 6px; }

.risk-bar { display: flex; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); }
.risk-bar span { height: 100%; }

#tradeoff { font-size: 14px; margin-top: 6px; }
#tradeoff:empty { display: none; }
#offer { margin-top: 8px; padding: 8px; border-radius: 10px; background: rgba(234, 179, 8, 0.15); }
#offer .row { margin-top: 6px; }

#weather { margin-top: 8px; font-size: 14px; }
#weather-list { list-style: none; margin: 0; padding: 0; max-height: 120px; overflow-y: auto; }
#weather-list li { display: flex; gap: 8px; padding: 2px 0; }
#weather-list .when { color: var(--muted); min-width: 52px; }
#weather-list .where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#weather-list li.hazard { color: #b45309; font-weight: 600; }
#banner-weather { font-size: 14px; margin-top: 4px; }
#banner-weather:empty { display: none; }
#banner-weather.hazard { background: rgba(250, 204, 21, 0.25); border-radius: 6px; padding: 2px 6px; }

#legend { margin-top: 8px; font-size: 12px; color: var(--muted); }
#source-note.warn { color: #b45309; }

#update-bar {
  top: calc(10px + env(safe-area-inset-top)); z-index: 6;
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 2px solid var(--accent);
}
#update-bar[hidden] { display: none; }
#update-text { flex: 1; font-weight: 600; }
#problem-words { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--fg); }
.legend-keys { display: flex; gap: 12px; flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.b0 { background: #9ca3af; }
.b1 { background: #16a34a; }
.b2 { background: #eab308; }
.b3 { background: #dc2626; }
/* Traffic glow under the route: purple, darker = slower. */
.t1 { background: #c4b5fd; }
.t2 { background: #8b5cf6; }
.t3 { background: #5b21b6; }
.legend-how { margin-top: 2px; }
/* Bike map lines (Bike mode). */
.legend-keys[hidden] { display: none; }
.line { display: inline-block; width: 16px; height: 0; margin-right: 4px; vertical-align: 3px; border-top: 4px solid; }
.bike-trail { border-color: #4ade80; }
.bike-lane { border-color: #15803d; }
.bike-quiet { border-top-style: dotted; border-color: #22c55e; }

.setting { display: block; margin: 12px 0; }
.setting select { min-height: 36px; padding: 4px 8px; }

#status { color: var(--muted); font-size: 14px; margin-top: 6px; min-height: 1em; }

.banner-row { display: flex; align-items: center; gap: 12px; }
#banner-arrow { font-size: 52px; line-height: 1; font-weight: 700; min-width: 52px; text-align: center; }
#banner-arrow:empty { display: none; }
#banner-then { font-size: 15px; font-weight: 600; margin-top: 2px; opacity: 0.9; }
#banner-then:empty { display: none; }
#banner.estimating #banner-eta { color: #fde68a; }
#banner-dist { font-size: 30px; font-weight: 700; }
#banner-text { font-size: 20px; font-weight: 600; }
#banner-eta { font-size: 14px; opacity: 0.85; margin-top: 4px; }

dialog { max-width: 520px; border: none; border-radius: var(--radius); background: var(--bg); color: var(--fg); box-shadow: var(--shadow); }
dialog h2 { margin-top: 0; }
/* Title with a ✕ in the corner. */
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dialog-head h2 { margin: 0; }
.dialog-head form { margin: 0; }
button.close-x { min-height: 40px; width: 40px; padding: 0; border-radius: 50%; border: none; background: var(--soft); font-size: 16px; }
button.wide { width: 100%; margin-top: 12px; }
.center { text-align: center; }
/* Me: equal colored tiles, two across. */
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile-grid .tile {
  min-height: 84px; border: none; border-radius: 16px; padding: 10px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: 15px; text-align: center;
}
.tile-ico { font-size: 26px; line-height: 1; }
.tile-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 8px; }
.tile-grid.three .tile { min-height: 68px; font-size: 13px; gap: 4px; }
.tile-grid.three .tile-ico { font-size: 22px; }
.tile-grid .tile.on { box-shadow: inset 0 0 0 3px var(--accent); }
#me .note { margin: 10px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#me .me-brand { margin: 0; line-height: 0; }
#me .me-brand .wordmark { height: 34px; width: auto; }
#me .night-only, html[data-theme="night"] #me .day-only { display: none; }
html[data-theme="night"] #me .night-only { display: inline-block; }
#me, #settings { width: min(520px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(44, 44, 42, 0.45); }

/* Weather and the color key fold to one tappable line. */
details summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
details[open] summary { margin-bottom: 4px; }
details.hazard summary { color: #b45309; font-weight: 600; }

/* Phones: tighter controls so the map stays visible. */
@media (max-width: 420px) {
  .seg button { padding: 8px 9px; font-size: 15px; }
  button.small { padding: 6px 9px; }
  #bottom, #nearby, #report-sheet, dialog#caravan, dialog#me { max-height: 44vh; overflow-y: auto; }
  #priority-hint { display: none; }
}

#saved { margin-top: 6px; }
#saved:empty { display: none; }
#saved button { min-height: 34px; background: var(--accent-soft); color: var(--accent-soft-fg); border-color: transparent; }
#saved button.save { background: none; border: 1px dashed var(--line); color: var(--muted); }
#saved-list { list-style: none; padding: 0; margin: 6px 0; }
#saved-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
#saved-list li span { flex: 1; min-width: 0; }

/* "You are here" breathes gently, but holds still while driving. The cone
   points the way you're facing (the marker is turned to match). */
.me { position: relative; width: 22px; height: 22px; }
.me-dot {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: #185fa5;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(24, 95, 165, 0.4);
  animation: me-pulse 2.4s ease-out infinite;
}
.me-cone {
  display: none; position: absolute; left: -19px; top: -38px; width: 60px; height: 50px;
  background: linear-gradient(to top, rgba(24, 95, 165, 0.85), rgba(24, 95, 165, 0.05));
  clip-path: polygon(50% 100%, 8% 0, 92% 0);
}
.me.has-heading .me-cone { display: block; }
@keyframes me-pulse {
  0% { box-shadow: 0 0 0 0 rgba(24, 95, 165, 0.45); }
  100% { box-shadow: 0 0 0 16px rgba(24, 95, 165, 0); }
}
body.navigating .me-dot { animation: none; }

/* Emergency: a red ring fills while the button is held. */
/* Bottom-left corner, just above the panels, always fully on screen. */
#sos-btn {
  position: absolute; left: 12px; bottom: var(--float-bottom, 180px); z-index: 3;
  width: 60px; height: 60px; border-radius: 50%; padding: 0;
  background: #fff; border: 3px solid #dc2626; color: #dc2626; font-weight: 800; font-size: 15px;
  box-shadow: var(--shadow); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#sos-btn[hidden] { display: none; }
#sos-ring {
  --held: 0;
  position: absolute; inset: -3px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(#dc2626 calc(var(--held) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px));
}
#sos-btn .sos-label { position: relative; }
#sos-btn.holding { background: #fee2e2; }
#sos .sos-where-label { margin-bottom: 0; }
#sos .sos-where { font-size: 20px; font-weight: 700; margin: 4px 0; }
#sos .sos-coords { font-size: 18px; font-variant-numeric: tabular-nums; margin-top: 0; }
/* Round map button on the right, above the map credits (i). */
#recenter {
  position: absolute; right: 12px; bottom: calc(var(--float-bottom, 180px) + 34px); z-index: 3;
  width: 48px; height: 48px; padding: 0; border-radius: 50%; border: none;
  box-shadow: var(--shadow); font-size: 22px; color: var(--accent);
}
/* With SOS on the left, the speedometer and limit sign stack above it. */
body:has(#sos-btn:not([hidden])) #speedo { bottom: calc(var(--float-bottom, 180px) + 72px); }
body:has(#sos-btn:not([hidden])) #speed-limit { bottom: calc(var(--float-bottom, 180px) + 154px); }
/* Map credits fold into an (i) just above the panels. */
.maplibregl-ctrl-bottom-right { bottom: var(--float-bottom, 0px); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 12px 0 0; }

/* Arrival celebration. */
#confetti { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }
#confetti span { position: absolute; top: -40px; font-size: 26px; animation: confetti-fall 2.6s ease-in forwards; }
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
  .me-dot { animation: none; }
  #confetti { display: none; }
}

/* Places open now along a walking route. */
/* Map pop-ups follow the day/night colors, so their text is always readable. */
.maplibregl-popup-content { background: var(--bg); color: var(--fg); font-size: 15px; border-radius: 12px; box-shadow: var(--shadow); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--bg); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--bg); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--bg); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--bg); }
.maplibregl-popup-close-button { color: var(--fg); font-size: 18px; }
/* Blue-light emergency phones near walking and biking routes. */
.bluelight-pin {
  width: 16px; height: 16px; border-radius: 50%; background: #2563eb; border: 2px solid #fff; cursor: pointer;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35), 0 0 10px 2px rgba(37, 99, 235, 0.6);
}
/* Campus police and escort, under walking and biking routes on campus. */
#campus-info { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
#campus-info .campus-call {
  display: block; padding: 10px 12px; border-radius: 12px; text-align: center; font-weight: 700;
  background: #1d4ed8; color: #fff; text-decoration: none;
}
#campus-info .campus-escort { color: var(--fg); font-size: 14px; }
#campus-info a.note { color: var(--muted); }
#campus-info .campus-phones { background: var(--blue-soft); color: var(--blue-soft-fg); border: none; border-radius: 12px; padding: 8px 12px; font-weight: 600; text-align: left; }
#campus-info .campus-phones:disabled { opacity: 1; cursor: default; }
.open-pin { width: 14px; height: 14px; border-radius: 50%; background: #16a34a; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25); cursor: pointer; }

/* Follow-my-trip page (trip.html). */
#follow { top: calc(10px + env(safe-area-inset-top)); }
#follow-head { font-size: 18px; font-weight: 700; }
#follow-eta { font-size: 16px; margin-top: 4px; }
#follow-eta:empty { display: none; }
body[data-status="arrived"] #follow { background: var(--accent-soft); color: var(--accent-soft-fg); }
body[data-status="overdue"] #follow, body[data-status="alert"] #follow { background: #fee2e2; color: #7f1d1d; border: 3px solid #dc2626; }
#follow-note { bottom: calc(10px + env(safe-area-inset-bottom)); padding: 8px 12px; }

.start-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f59e0b;
  border: 3px solid #fff;
}
