/* Map-first layout for /app (opt-in, see app.mapfirst.boot.js). Every rule is
   scoped to html.mf, so the classic layout is untouched when it is off.
   The map takes the whole window; three floating pieces sit on it: the
   search card (top left), the trip card (bottom left, once there is a walk)
   and the control stack (top right). */

html.mf .app {
  display: block;
  position: relative;
  height: 100%;
}
html.mf .app > .topbar,
html.mf .panel,
html.mf .mapTopRightControl,
html.mf #settingsSheet,
html.mf #zonePicker {
  display: none !important;
}
html.mf .mapWrap {
  position: absolute;
  inset: 0;
}
/* The map key is replaced by the trip card's breakdown and the labels on
   the route. */
html.mf .routeLegend {
  display: none !important;
}

/* ---------- shared pieces ---------- */
html.mf .mfCard {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  color: var(--ink);
}
html.mf .mfIconBtn {
  width: 44px;
  height: 44px;
  flex: none;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
html.mf .mfIconBtn:hover {
  background: var(--line-soft);
}
html.mf .mfIconBtn svg {
  width: 22px;
  height: 22px;
}
html.mf .mfEyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* ---------- search card ---------- */
html.mf .mfSearch {
  position: absolute;
  /* above the trip card, so the school and address lists drop over it */
  z-index: 1150;
  left: 16px;
  top: 16px;
  width: 392px;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
html.mf .mfSearch__top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 0 6px;
}
html.mf .mfSearch__top .wordmark {
  flex: 1 1 auto;
}
html.mf .mfSearch__body {
  display: flex;
  gap: 12px;
  padding: 6px 16px 10px 18px;
}
html.mf .mfRail {
  width: 22px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding-top: 14px;
}
html.mf .mfRail__dots {
  width: 2px;
  height: 26px;
  background: repeating-linear-gradient(180deg, var(--ink-quiet) 0 3px, transparent 3px 7px);
}
html.mf .mfFields {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
html.mf .mfField {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 0 4px 0 14px;
  box-sizing: border-box;
}
html.mf .mfField:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--ring);
}
html.mf .mfField input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  font: 500 1rem var(--font-text);
  color: var(--ink);
  padding: 0;
  outline: none;
  box-shadow: none;
}
html.mf .mfField input:focus-visible {
  outline: none;
}
html.mf .mfField--school input {
  font-weight: 600;
}
html.mf .mfField .mfIconBtn {
  width: 38px;
  height: 38px;
  color: var(--accent);
}
html.mf .mfField .mfIconBtn svg {
  width: 20px;
  height: 20px;
}
html.mf .mfField .mfPrivacyBtn {
  width: 32px;
  color: var(--ink-quiet);
}
html.mf .mfField .mfPrivacyBtn svg {
  width: 17px;
  height: 17px;
}
html.mf .mfField .mfPrivacyBtn:hover {
  color: var(--accent);
}
html.mf .srLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* the school list and the address results drop over the map */
html.mf .mfList,
html.mf .mfFields #addressResults {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  max-height: min(340px, 55vh);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
html.mf .mfList {
  top: 46px;
  padding: 6px 0;
  list-style: none;
}
html.mf .mfFields #addressResults {
  top: 100px;
}
html.mf .mfList__group {
  padding: 10px 14px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}
html.mf .mfList__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.95rem;
}
html.mf .mfList__opt[aria-selected="true"],
html.mf .mfList__opt:hover {
  background: var(--accent-wash);
}
html.mf .mfList__opt[aria-disabled="true"] {
  cursor: default;
  color: var(--ink-soft);
}
html.mf .mfList__opt[aria-disabled="true"]:hover,
html.mf .mfList__opt[aria-disabled="true"][aria-selected="true"] {
  background: var(--line-soft);
}
html.mf .mfList__name {
  flex: 1 1 auto;
  min-width: 0;
}
html.mf .mfList__name mark {
  background: none;
  color: inherit;
  font-weight: 700;
}
html.mf .mfList__tag {
  flex: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-quiet);
}
html.mf .mfList__tag--zone {
  color: var(--accent);
}
html.mf .mfList__dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: var(--pill);
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--ink) inset;
}
html.mf .mfList__opt[aria-disabled="true"] .mfList__dot {
  background: var(--line);
  box-shadow: 0 0 0 2px var(--ink-quiet) inset;
}
html.mf .mfList__hint {
  padding: 8px 14px 4px;
  font-size: 0.82rem;
  color: var(--ink-quiet);
}

/* Only errors get words; progress is the bar below. */
html.mf .mfSearch__status:not(:has(.status--error)):not(:has(.statusRetry:not([hidden]))) {
  display: none;
}
html.mf .mfSearch__body {
  padding-bottom: 16px;
}
html.mf .mfBusy {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 3px;
  border-radius: var(--pill);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
html.mf .mfBusy span {
  display: block;
  width: 30%;
  height: 100%;
  border-radius: var(--pill);
  background: var(--accent);
}
html.mf .mfSearch.isBusy .mfBusy,
html.mf .mfSearch.isLoading .mfBusy {
  opacity: 1;
}
html.mf .mfSearch.isBusy .mfBusy span,
html.mf .mfSearch.isLoading .mfBusy span {
  animation: mfBusy 1.1s var(--ease-out) infinite;
}
@keyframes mfBusy {
  from { transform: translateX(-100%); }
  to { transform: translateX(340%); }
}
@media (prefers-reduced-motion: reduce) {
  html.mf .mfSearch.isBusy .mfBusy span,
  html.mf .mfSearch.isLoading .mfBusy span {
    animation: none;
    width: 100%;
    opacity: 0.5;
  }
}
html.mf .mfSearch__status {
  border-top: 1px solid var(--line-soft);
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
html.mf .mfSearch__status .status {
  padding: 0;
  min-height: 0;
  font-size: 0.88rem;
}
html.mf .mfSearch__status .statusRetry {
  align-self: flex-start;
  margin: 0;
}

/* ---------- control stack (top right) ---------- */
html.mf .mfStack {
  position: absolute;
  z-index: 1100;
  right: 16px;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
html.mf .mfRound {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: var(--shadow-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
html.mf .mfRound:hover {
  color: var(--ink);
}
html.mf .mfRound[aria-expanded="true"] {
  background: var(--accent-fill);
  color: var(--on-accent);
}
html.mf .mfRound svg {
  width: 22px;
  height: 22px;
}
html.mf .mfZoom {
  width: 48px;
  border-radius: var(--pill);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
html.mf .mfZoom button {
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 400 1.4rem/1 var(--font-text);
  cursor: pointer;
}
html.mf .mfZoom button + button {
  border-top: 1px solid var(--line-soft);
}
html.mf .mfZoom button:hover {
  background: var(--line-soft);
  color: var(--ink);
}

/* ---------- popovers (layers, menu) ---------- */
html.mf .mfPop {
  position: absolute;
  z-index: 1250;
  width: 290px;
  box-sizing: border-box;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
}
html.mf .mfPop[hidden] {
  display: none;
}
html.mf .mfPop--layers {
  right: 76px;
  top: 16px;
}
html.mf .mfPop--menu {
  left: 16px;
  top: 68px;
}
html.mf .mfBaseGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
html.mf .mfBaseBtn {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font: 600 0.82rem var(--font-text);
  color: var(--ink-soft);
}
html.mf .mfBaseBtn span:first-child {
  display: block;
  height: 40px;
}
html.mf .mfBaseBtn span:last-child {
  padding: 6px;
}
html.mf .mfBaseBtn--street span:first-child {
  background:
    linear-gradient(28deg, transparent 46%, #ffffff 46% 54%, transparent 54%),
    linear-gradient(-62deg, transparent 47%, #ffffff 47% 52%, transparent 52%),
    #e4e7e3;
}
html.mf .mfBaseBtn--satellite span:first-child {
  background:
    linear-gradient(28deg, transparent 46%, #8d8a7c 46% 53%, transparent 53%),
    radial-gradient(circle at 30% 30%, #6b7d4f 0 22%, transparent 23%),
    #4b5a3e;
}
html.mf .mfBaseBtn[aria-pressed="true"] {
  border: 2px solid var(--accent);
  color: var(--accent);
}
html.mf .mfSwitchRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.92rem;
  cursor: pointer;
}
html.mf .mfSwitchRow:last-child {
  border-bottom: 0;
}
html.mf .mfSwitch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 40px;
  height: 24px;
  margin: 0;
  border-radius: var(--pill);
  background: #d4dad7;
  position: relative;
  cursor: pointer;
  transition: background 0.18s;
}
html.mf .mfSwitch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: var(--pill);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 28, 26, 0.25);
  transition: transform 0.18s var(--ease-out);
}
html.mf .mfSwitch:checked {
  background: var(--accent-fill);
}
html.mf .mfSwitch:checked::after {
  transform: translateX(16px);
}
html.mf .mfSeg {
  display: inline-flex;
  background: var(--line-soft);
  border-radius: var(--pill);
  padding: 2px;
}
html.mf .mfSeg button {
  border: 0;
  background: transparent;
  border-radius: var(--pill);
  padding: 5px 12px;
  font: 600 0.8rem var(--font-text);
  color: var(--ink-soft);
  cursor: pointer;
}
html.mf .mfSeg button[aria-pressed="true"] {
  background: var(--accent-fill);
  color: var(--on-accent);
}
html.mf .mfMenuLinks {
  display: flex;
  flex-direction: column;
}
html.mf .mfMenuLinks a {
  padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
html.mf .mfMenuLinks a:hover {
  color: var(--accent);
}
html.mf .mfMenuFoot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.88rem;
}
html.mf .mfMenuFoot a {
  font-weight: 600;
}

/* ---------- trip card (bottom left) ---------- */
html.mf .mfTrip {
  position: absolute;
  z-index: 1100;
  left: 16px;
  bottom: 24px;
  width: 392px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - var(--mf-search-h, 200px) - 56px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
}
html.mf .mfTrip[hidden] {
  display: none;
}
/* the header is the fold toggle */
html.mf .mfTrip__toggle {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: calc(100% + 12px);
  margin: -6px -6px 0;
  padding: 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
html.mf .mfTrip__toggle:hover {
  background: var(--line-soft);
}
html.mf .mfTrip__toggle[hidden] {
  display: none;
}
html.mf .mfTrip__chev {
  align-self: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  color: var(--ink-quiet);
  transition: transform 0.3s var(--ease-out);
}
html.mf .mfTrip.isCollapsed .mfTrip__chev {
  transform: rotate(180deg);
}
html.mf .mfTrip__body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.32s var(--ease-out);
}
html.mf .mfTrip.isCollapsed .mfTrip__body {
  grid-template-rows: 0fr;
}
html.mf .mfTrip__inner {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
  transition: opacity 0.2s ease, padding-top 0.32s var(--ease-out);
}
html.mf .mfTrip.isCollapsed .mfTrip__inner {
  opacity: 0;
  padding-top: 0;
}
@media (prefers-reduced-motion: reduce) {
  html.mf .mfTrip__body,
  html.mf .mfTrip__inner,
  html.mf .mfTrip__chev {
    transition: none;
  }
}
html.mf .mfTrip__time {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.03em;
}
html.mf .mfTrip__dist {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-quiet);
  font-variant-numeric: tabular-nums;
}
html.mf .mfBar {
  display: flex;
  gap: 3px;
  height: 8px;
}
html.mf .mfBar span {
  display: block;
  min-width: 6px;
  border-radius: var(--pill);
}
/* the bar under the header stays in view while the card is folded */
html.mf .mfTrip__peek {
  margin-top: 12px;
}
html.mf .mfTrip__peek[hidden],
html.mf .mfTrip__grab,
html.mf .mfSummary {
  display: none;
}
html.mf .mfMix {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.8rem;
  color: var(--ink-quiet);
  font-variant-numeric: tabular-nums;
}
html.mf .mfMix li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
html.mf .mfMix i {
  width: 8px;
  height: 8px;
  border-radius: var(--pill);
  flex: none;
}
html.mf .mfMix b {
  font-weight: 700;
  color: var(--ink);
}
html.mf .mfTrip__summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* the classic result section, re-housed: its distance/time tiles are the
   header above, so they are not repeated */
html.mf .mfTrip #result {
  margin: 0;
  padding: 0;
}
html.mf .mfTrip #result .metricTiles {
  display: none;
}
html.mf .mfTrip #result > * + * {
  margin-top: 10px;
}
html.mf .mfTrip__foot {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--line-soft);
  padding-top: 6px;
  margin: 0 -6px;
}
html.mf .mfTrip__foot button {
  border: 0;
  background: transparent;
  border-radius: var(--pill);
  padding: 8px 10px;
  min-height: 40px;
  font: 600 0.88rem var(--font-text);
  color: var(--accent);
  cursor: pointer;
}
html.mf .mfTrip__foot button:hover {
  background: var(--accent-wash);
}
html.mf .mfTrip__foot .mfGrow {
  flex: 1 1 auto;
}
html.mf .mfOptions {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 12px;
}
html.mf .mfOptions[hidden] {
  display: none;
}

/* ---------- labels drawn on the route ---------- */
html.mf .mfLabel {
  pointer-events: none;
}
html.mf .mfTag {
  position: absolute;
  left: 16px;
  top: 0;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  padding: 5px 11px 5px 9px;
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
  font: 600 12.5px/1.2 var(--font-text);
  box-shadow: 0 1px 2px rgba(20, 28, 26, 0.12), 0 6px 16px rgba(20, 28, 26, 0.16);
}
html.mf .mfTag::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 13px;
  height: 2px;
  background: var(--ink);
  opacity: 0.55;
}
html.mf .mfTag__sw {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  flex: none;
}
html.mf .mfTag__ring {
  width: 10px;
  height: 10px;
  flex: none;
  box-sizing: border-box;
  border: 2.5px solid var(--crossing-alert);
  border-radius: var(--pill);
}
html.mf .mfTag--school {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-radius: var(--radius-s);
  padding: 7px 11px;
  left: 22px;
}
html.mf .mfTag--school::before {
  left: -20px;
  width: 19px;
}
html.mf .mfTag--school small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--crossing-guarded);
}

/* ---------- Street View: a floating card, not a third column ---------- */
/* Title "Street view · <street>" (app.mapfirst.js); the caption block, the
   capture date, the left/right sidewalk sentence and the hint are not shown.
   The two scores ride on the photo where the "looking ahead" badge was. */
html.mf .svCaption,
html.mf .svPanelHint,
html.mf .svStripBadge {
  display: none !important;
}
html.mf .svPanelTitle {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html.mf .mfSvDot {
  margin: 0 0.4em;
  color: var(--ink-quiet);
}
html.mf .mfSvStreet {
  font-weight: 600;
  color: var(--ink-soft);
}
html.mf .svStripWrap .svCaptionScores {
  position: absolute;
  left: 10px;
  top: 10px;
  right: 10px;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}
html.mf .svStripWrap .svCaptionScores[hidden] {
  display: none;
}
html.mf .svStripWrap .svScore {
  padding: 4px 10px;
  background: rgba(23, 27, 28, 0.66);
  color: #e9edea;
  font-size: 0.74rem;
  font-weight: 600;
  backdrop-filter: blur(4px);
}
html.mf .svStripWrap .svScore[hidden] {
  display: none;
}
html.mf .svStripWrap .svScore strong {
  color: #ffffff;
}
html.mf .svStripWrap .svScore--good strong {
  color: #8fe0bd;
}
html.mf .svStripWrap .svScore--bad strong {
  color: #ffb39e;
}
@media (min-width: 901px) {
  html.mf .svPanel {
    position: absolute;
    z-index: 1200;
    top: 16px;
    right: 80px;
    width: min(400px, calc(100% - 520px));
    min-width: 300px;
    min-height: 240px;
    max-width: calc(100% - 32px);
    max-height: calc(100% - 32px);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2);
    background: var(--surface);
    /* drag by the header, resize from any edge (grips, app.mapfirst.js) */
    overflow: hidden;
  }
  html.mf .mfGrip {
    position: absolute;
    z-index: 5;
    touch-action: none;
  }
  html.mf .mfGrip--n,
  html.mf .mfGrip--s { left: 14px; right: 14px; height: 7px; cursor: ns-resize; }
  html.mf .mfGrip--e,
  html.mf .mfGrip--w { top: 14px; bottom: 14px; width: 7px; cursor: ew-resize; }
  html.mf .mfGrip--n { top: 0; }
  html.mf .mfGrip--s { bottom: 0; }
  html.mf .mfGrip--e { right: 0; }
  html.mf .mfGrip--w { left: 0; }
  html.mf .mfGrip--ne,
  html.mf .mfGrip--nw,
  html.mf .mfGrip--se,
  html.mf .mfGrip--sw { width: 16px; height: 16px; }
  html.mf .mfGrip--ne { top: 0; right: 0; cursor: nesw-resize; }
  html.mf .mfGrip--sw { bottom: 0; left: 0; cursor: nesw-resize; }
  html.mf .mfGrip--nw { top: 0; left: 0; cursor: nwse-resize; }
  html.mf .mfGrip--se { bottom: 0; right: 0; cursor: nwse-resize; }
  html.mf .svPanel.isResizing {
    user-select: none;
  }
  html.mf .svPanel.isDragging {
    box-shadow: 0 4px 10px rgba(20, 28, 26, 0.12), 0 28px 60px rgba(20, 28, 26, 0.22);
    user-select: none;
  }
  html.mf .svPanelHead {
    cursor: grab;
    touch-action: none;
  }
  html.mf .svPanel.isDragging .svPanelHead {
    cursor: grabbing;
  }
  /* a taller card gives the photo the extra room */
  html.mf .svStripWrap {
    flex: 1 1 auto;
    min-height: 120px;
  }
  html.mf .svPanel > :not(.svStripWrap):not(.mfGrip) {
    flex-shrink: 0;
  }
}

/* ---------- phones (D6.4) ----------
   The search card is two 44 px rows (school, home) with the menu beside
   the first; with a walk on screen it folds into a one-line pill. The
   control column (layers, locate, feedback) runs down the right edge
   under it. The trip card is a bottom sheet whose peek is the grabber,
   time and distance and the bar; a tap or a drag opens the rest. */
@media (max-width: 900px) {
  html.mf .mfSearch {
    left: 8px;
    right: 8px;
    top: 8px;
    width: auto;
    max-width: none;
    border-radius: 18px;
  }
  html.mf .mfSearch__top {
    position: absolute;
    left: 2px;
    top: 4px;
    z-index: 1;
    padding: 0;
  }
  html.mf .mfSearch__top .wordmark,
  html.mf .mfRail {
    display: none;
  }
  html.mf .mfSearch__body {
    padding: 4px 4px 4px 46px;
  }
  html.mf .mfFields {
    gap: 0;
  }
  html.mf .mfField {
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    padding: 0 0 0 8px;
  }
  html.mf .mfField + .mfField {
    margin-top: 1px;
  }
  html.mf .mfField + .mfField::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 4px;
    top: -1px;
    border-top: 1px solid var(--line-soft);
  }
  html.mf .mfField:focus-within {
    background: var(--paper);
    box-shadow: none;
  }
  html.mf .mfField--school input {
    font-weight: 650;
  }
  html.mf .mfField .mfIconBtn {
    width: 44px;
    height: 44px;
  }
  html.mf .mfField .mfPrivacyBtn {
    width: 36px;
  }
  html.mf .mfList {
    top: 44px;
  }
  html.mf .mfFields #addressResults {
    top: 89px;
  }
  html.mf .mfBusy {
    left: 14px;
    right: 14px;
    bottom: 2px;
  }
  html.mf .mfSearch__status {
    padding: 8px 14px 10px;
  }
  /* folded: [menu] school / from where, one 44 px line */
  html.mf .mfSearch.isCompact .mfFields {
    display: none;
  }
  html.mf .mfSearch.isCompact .mfSummary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 0 12px 0 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    font: inherit;
  }
  html.mf .mfSearch.isCompact .mfSummary:hover {
    background: var(--line-soft);
  }
  html.mf .mfSummary__school,
  html.mf .mfSummary__from {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  html.mf .mfSummary__school {
    font: 650 0.95rem/1.25 var(--font-text);
  }
  html.mf .mfSummary__from {
    font: 500 0.78rem/1.25 var(--font-text);
    color: var(--ink-quiet);
  }
  html.mf .mfStack {
    right: 8px;
    top: calc(var(--mf-search-h, 96px) + 16px);
    gap: 8px;
    transition: top 0.25s var(--ease-out);
  }
  html.mf .mfRound {
    width: 44px;
    height: 44px;
  }
  html.mf .mfRound svg {
    width: 20px;
    height: 20px;
  }
  html.mf .mfStack .mfZoom {
    display: none;
  }
  html.mf .mfPop--layers {
    right: 60px;
    top: calc(var(--mf-search-h, 96px) + 16px);
  }
  html.mf .mfPop--menu {
    left: 8px;
    top: calc(var(--mf-search-h, 96px) + 16px);
    max-height: calc(100% - var(--mf-search-h, 96px) - 32px);
  }
  html.mf .mfTrip {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    /* open, it stops below the control column (search card + 8 + 148 + 20) */
    max-height: min(70dvh, calc(100% - var(--mf-search-h, 96px) - 176px));
    border-radius: 20px 20px 0 0;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
  }
  /* the grabber: a 36 x 5 pill in an 18 px strip, part of the drag area */
  html.mf .mfTrip__grab {
    display: block;
    flex: none;
    height: 16px;
    margin: 0 -16px;
    touch-action: none;
    cursor: grab;
  }
  html.mf .mfTrip__grab::before {
    content: "";
    display: block;
    width: 36px;
    height: 5px;
    margin: 6px auto 0;
    border-radius: var(--pill);
    background: var(--line);
  }
  html.mf .mfTrip__toggle {
    align-items: center;
    min-height: 44px;
    margin: 0 -6px;
    padding: 0 6px;
    touch-action: none;
  }
  html.mf .mfTrip__time {
    font-size: 1.55rem;
  }
  html.mf .mfTrip__dist {
    font-size: 0.95rem;
  }
  html.mf .mfTrip__peek {
    margin-top: 6px;
    padding-bottom: 2px;
    touch-action: none;
  }
  html.mf .mfTrip__peek .mfBar {
    height: 6px;
  }
  html.mf .mfTrip__inner {
    gap: 10px;
  }
}

/* inside the trip card the warning chips sit on the card itself */
html.mf .mfTrip .metrics:not(:empty) {
  padding: 0;
  border: 0;
  background: none;
}

/* ---------- trip card: one grouped list ----------
   Street View, road crossings and directions are 44 px rows in one rounded
   box (app.mapfirst.js moves the three elements into .mfGroup). Every row
   carries a hairline on top; the first one is pulled under the box edge. */
html.mf .mfGroup {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
html.mf .mfGroup:not(:has(> .svRouteBtn:not([hidden]), > .crossings:not(:empty), > .directionsBox.hasSteps)) {
  display: none;
}
html.mf #result .mfGroup > * {
  margin: -1px 0 0;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
html.mf .mfGroup .svRouteBtn,
html.mf .mfGroup .crossingsHead,
html.mf .mfGroup .directionsToggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 14px;
  font: 500 15px/1.2 var(--font-text);
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
html.mf .mfGroup .svRouteBtn:hover,
html.mf .mfGroup .crossingsToggle:hover,
html.mf .mfGroup .directionsToggle:hover {
  background: var(--paper);
  color: var(--ink);
}
html.mf .mfGroup .svRouteBtn .btnIcon {
  width: 19px;
  height: 19px;
}
html.mf .mfGroup .svRouteBtnLabel {
  display: none;
}
html.mf .mfGroup .mfSvName {
  flex: 1 1 auto;
}
/* the right-hand value: photo count, crossing count, step count */
html.mf .mfGroup .mfRowValue,
html.mf .mfGroup .crossingsHead strong,
html.mf .mfGroup .directionsCount {
  margin-left: auto;
  font: 600 15px/1.2 var(--font-text);
  letter-spacing: normal;
  color: var(--ink-soft);
}
html.mf .mfGroup .crossingsHead strong {
  margin-left: 0;
}
/* row icons for the two rows that come without one */
html.mf .mfGroup .crossingsHead::before,
html.mf .mfGroup .directionsToggle::before {
  content: "";
  flex: none;
  width: 19px;
  height: 19px;
  background: var(--accent);
  -webkit-mask: var(--mf-row-icon) center / contain no-repeat;
  mask: var(--mf-row-icon) center / contain no-repeat;
}
html.mf .mfGroup .crossingsHead {
  --mf-row-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='5.5'/%3E%3Cpath d='M3 12h3M18 12h3'/%3E%3C/svg%3E");
}
html.mf .mfGroup .directionsToggle {
  --mf-row-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M9 6h11M9 12h11M9 18h11'/%3E%3Ccircle cx='4.5' cy='6' r='1'/%3E%3Ccircle cx='4.5' cy='12' r='1'/%3E%3Ccircle cx='4.5' cy='18' r='1'/%3E%3C/svg%3E");
}
/* the opened parts: no padding while folded, so a closed row is 44 px */
html.mf .mfGroup .crossings:not(:empty) {
  padding: 0;
}
html.mf .mfGroup .crossingsRevealInner,
html.mf .mfGroup .directionsRevealInner {
  padding: 0 14px;
}
html.mf .mfGroup .crossingsRevealInner > :last-child,
html.mf .mfGroup .directionsRevealInner > :last-child {
  margin-bottom: 10px;
}
html.mf .mfGroup .guardRow {
  padding: 0 14px 10px;
}
/* the card's footer has Print; the copy inside the steps is not repeated */
html.mf .mfGroup .printInstructionsBtn {
  display: none !important;
}

/* footer: Route options as text, Print and Clear as icons */
html.mf .mfTrip__foot .mfFootIcon {
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-quiet);
}
html.mf .mfTrip__foot .mfFootIcon:hover {
  color: var(--ink);
  background: var(--line-soft);
}
html.mf .mfTrip__foot .mfFootIcon svg {
  width: 19px;
  height: 19px;
}
html.mf .mfTrip__foot {
  border-top: 0;
  padding-top: 0;
  margin: -4px -8px -6px -6px;
}

/* ---------- feedback button: bottom left, riding on top of the trip card ---------- */
html.mf .mfFeedback {
  position: absolute;
  z-index: 1100;
  left: 16px;
  bottom: calc(24px + var(--mf-trip-lift, 0px));
  text-decoration: none;
  color: var(--accent);
  transition: bottom 0.32s var(--ease-out);
}
html.mf .mfFeedback:hover {
  color: var(--accent-strong);
  background: var(--accent-wash);
}
/* phone: the feedback button closes the control column on the right (D6.4) */
@media (max-width: 900px) {
  html.mf .mfFeedback {
    left: auto;
    right: 8px;
    bottom: auto;
    top: calc(var(--mf-search-h, 96px) + 16px + 104px);
    transition: top 0.25s var(--ease-out);
  }
}
@media (prefers-reduced-motion: reduce) {
  html.mf .mfFeedback,
  html.mf .mfStack {
    transition: none;
  }
}

/* ---------- avoid pins (app.own.avoid.js) ---------- */
/* The stack button: shown once there is a start; pressed while placing. */
html.mf .mfAvoidBtn {
  position: relative;
}
html.mf body:not(.hasStart) .mfAvoidBtn {
  display: none;
}
html.mf .mfRound[aria-pressed="true"] {
  background: var(--accent-fill);
  color: var(--on-accent);
}
html.mf .mfAvoidBtn__n {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: var(--pill);
  background: var(--crossing-alert);
  color: #fff;
  font: 700 11px/18px var(--font-text);
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
html.mf .mfAvoidBtn__n[hidden] {
  display: none;
}
/* Placing: the crosshair wins over the engine's grab and hover pointer. */
html.mf #map.avoidPlacing .swmap,
html.mf #map.avoidPlacing .swmap-marker {
  cursor: crosshair !important;
}
/* The pin: a no-entry sign in a 44 px tap target. */
.avoidPin {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--crossing-alert);
  transition: opacity 0.2s, transform 0.2s var(--ease-out);
}
.avoidPin svg {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 1px 2px rgba(20, 28, 26, 0.35));
}
.avoidPin.isOff {
  color: var(--ink-quiet);
  opacity: 0.7;
}
.avoidPin.isGhost {
  animation: avoidDrop 0.22s var(--ease-out);
}
.avoidPin.isPending svg {
  animation: avoidPulse 1s ease-in-out infinite;
}
@keyframes avoidDrop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes avoidPulse {
  50% { transform: scale(0.86); }
}
.avoidPopup .swmap-popup-content {
  margin: 6px 30px 6px 8px;
}
.avoidPop__btn {
  border: 0;
  border-radius: var(--radius-s);
  padding: 8px 12px;
  background: transparent;
  color: var(--crossing-alert);
  font: 600 0.95rem/1 var(--font-text);
  cursor: pointer;
}
.avoidPop__btn:hover,
.avoidPop__btn:focus-visible {
  background: var(--paper);
}
/* Placement hint: a pill at the top, clear of the search card and stack. */
html.mf .avoidHint {
  position: absolute;
  z-index: 1150;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 140px);
  padding: 4px 4px 4px 16px;
  border-radius: var(--pill);
  font: 600 0.92rem/1.2 var(--font-text);
  white-space: nowrap;
}
html.mf .avoidHint[hidden] {
  display: none;
}
html.mf .avoidHint span {
  overflow: hidden;
  text-overflow: ellipsis;
}
html.mf .avoidHint__x {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
html.mf .avoidHint__x svg,
html.mf .avoidNote__x svg {
  width: 18px;
  height: 18px;
}
/* No walk avoids the pins: where the trip card would be. */
html.mf .avoidCard {
  position: absolute;
  z-index: 1120;
  left: 16px;
  bottom: 24px;
  width: 392px;
  max-width: calc(100% - 32px);
  box-sizing: border-box;
  padding: 16px 18px;
}
html.mf .avoidCard[hidden] {
  display: none;
}
html.mf .avoidCard__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font: 650 1.02rem/1.3 var(--font-text);
}
html.mf .avoidCard__sign,
html.mf .avoidNote__sign {
  flex: none;
  display: flex;
  color: var(--crossing-alert);
}
html.mf .avoidCard__sign svg {
  width: 24px;
  height: 24px;
}
html.mf .avoidCard__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
html.mf .avoidCard__btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.95rem/1.2 var(--font-text);
  cursor: pointer;
}
html.mf .avoidCard__btn--main {
  border-color: var(--accent-fill);
  background: var(--accent-fill);
  color: var(--on-accent);
}
html.mf.avoidBlocked .mfFeedback {
  bottom: calc(24px + var(--avoid-lift, 0px));
}
/* The note with the crossings: "Avoiding 2 spots" and a remove-all x. */
html.mf .avoidNote {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 4px 0 14px;
  font: 500 15px/1.2 var(--font-text);
  color: var(--ink);
}
html.mf .avoidNote[hidden] {
  display: none;
}
html.mf .avoidNote__sign svg {
  width: 19px;
  height: 19px;
}
html.mf .avoidNote.isOff .avoidNote__sign {
  color: var(--ink-quiet);
}
html.mf .avoidNote__text {
  flex: 1 1 auto;
}
html.mf .avoidNote__x {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
html.mf .avoidNote__x:hover {
  background: var(--paper);
  color: var(--ink);
}
@media (max-width: 900px) {
  html.mf .avoidHint {
    top: calc(var(--mf-search-h, 96px) + 16px);
    max-width: calc(100% - 128px);
  }
  html.mf .avoidCard {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
  }
  /* the feedback button closes the column below the extra button */
  html.mf body.hasStart .mfFeedback {
    top: calc(var(--mf-search-h, 96px) + 16px + 156px);
  }
  html.mf.avoidBlocked .mfFeedback {
    bottom: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .avoidPin,
  .avoidPin.isGhost,
  .avoidPin.isPending svg {
    animation: none;
    transition: none;
  }
}
