:root {
  --free: #16a34a;
  --paid: #7c3aed;
  --tow: #dc2626;
  --caution: #ea580c;
  --unknown: #9ca3af;
  --freelot: #0284c7;
  --ink: #111827;
  --muted: #6b7280;
  --surface: #ffffff;
  --line: #e5e7eb;
  --shadow: 0 2px 10px rgba(0, 0, 0, .18);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--surface); }
/* Google Maps sets position: relative inline on this div, so it also needs an explicit size to fill the screen. */
#map { position: fixed; inset: 0; width: 100%; height: 100%; }
/* Press and hold drops a pin: keep iOS from selecting text or showing its callout instead */
#map { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

/* Search + filter chips */
#top {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10;
  padding: calc(var(--top) + 10px) 12px 0;
  pointer-events: none;
}
#top > * { pointer-events: auto; }
#search gmp-place-autocomplete {
  width: 100%;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color-scheme: light;
}
#chips { display: flex; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 0; border-radius: 17px;
  background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1; box-shadow: var(--shadow); cursor: pointer;
}
.chip.on { background: var(--ink); color: #fff; }
#feedback-btn { margin-left: auto; }
.chip.icon { width: 34px; padding: 0; justify-content: center; font: italic 700 16px/1 Georgia, serif; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.free { background: var(--free); }
.dot.paid { background: var(--paid); }
.dot.tow { background: var(--tow); }
.dot.caution { background: var(--caution); }
.dot.unknown { background: var(--unknown); }
.dot.freelot { background: var(--freelot); }

/* Locate button + legend */
#locate {
  position: fixed; right: 12px; bottom: calc(var(--bottom) + 82px); z-index: 10;
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: var(--surface); color: #2563eb; box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer;
}
/* The color key doubles as a filter: tap a color to show only that kind, tap more to add them.
   It sits above Google's logo and map attribution, which Google's terms require to stay visible. */
#legend {
  position: fixed; left: 12px; bottom: calc(var(--bottom) + 30px); z-index: 9;
  display: flex; gap: 2px; max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none;
  padding: 3px; border-radius: 20px;
  background: rgba(255, 255, 255, .94); box-shadow: var(--shadow);
}
#legend::-webkit-scrollbar { display: none; }
#legend button {
  flex: none; display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 8px;
  border: 0; border-radius: 17px; background: none; color: var(--ink); cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
#legend button.on { background: var(--ink); color: #fff; }
#legend button.on .dot { box-shadow: 0 0 0 2px #fff; }
#legend.filtering button:not(.on) { opacity: .45; }

/* Bottom sheet */
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-height: 52vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(var(--bottom) + 16px);
  background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .18);
}
#sheet[hidden] { display: none; }
#sheet-close {
  position: absolute; right: 10px; top: 8px;
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: #f3f4f6; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}
#sheet h2 { margin: 0 44px 4px 0; font-size: 18px; line-height: 1.3; display: flex; gap: 8px; align-items: baseline; }
#sheet h2 .dot { transform: translateY(-1px); }
#sheet .sub { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
#sheet .detail { margin: 0 0 14px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
#sheet .actions { display: flex; gap: 8px; }
#sheet .actions.dest { margin: 0 0 12px; }
#sheet .coords { margin: -2px 0 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
#sheet .handoff { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
#sheet .handoff a { color: #2563eb; font-weight: 600; text-decoration: none; }
#sheet .report { margin: 10px 0 0; }
#sheet .report button { padding: 0; border: 0; background: none; color: #2563eb; font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
/* After a drive: "Did you find parking?" */
#sheet .actions.ask .btn { flex: 1; gap: 8px; font-size: 16px; }
#sheet .reasons { display: grid; gap: 8px; }
#sheet .ask-err { margin: 10px 0 0; font-size: 14px; color: #b91c1c; }

/* Drive mode: Google Maps-style card at the bottom (time left, distance, arrival time).
   It sits above Google's logo, which has to stay visible. */
#top[hidden], #drive[hidden], #recenter[hidden], #locate[hidden], #legend[hidden], .round[hidden] { display: none; }
#drive {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--bottom) + 30px); z-index: 15;
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 20px; background: var(--surface); box-shadow: var(--shadow);
}
#drive .info { flex: 1; min-width: 0; text-align: center; }
#drive strong { display: block; font-size: 18px; line-height: 1.25; }
#drive strong.eta { font-size: 26px; color: #188038; }
#drive .info span { display: block; margin-top: 2px; font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round {
  flex: none; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: #f1f3f4; color: var(--ink); cursor: pointer;
}
/* Start button on the route overview, like Google's blue Start */
.round.go { background: #1a73e8; color: #fff; }
.p-sign {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  background: #1a73e8; color: #fff; font-family: inherit; font-size: 16px; font-weight: 800; line-height: 1;
}
/* Shown after the user moves the map while driving; app.js keeps it above the card or the sheet */
#recenter {
  position: fixed; left: 12px; bottom: calc(var(--bottom) + 116px); z-index: 21;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px 0 14px;
  border: 0; border-radius: 22px; background: var(--surface); color: #1a73e8; box-shadow: var(--shadow);
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer;
}
.btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; flex: 1; }

/* Nearby list */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list button {
  width: 100%; display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 10px; align-items: baseline;
  padding: 11px 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.list .what { font-weight: 600; font-size: 15px; }
.list .where { grid-column: 2; color: var(--muted); font-size: 13px; }
.list .walk { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* About dialog + notices */
#about { max-width: min(92vw, 460px); border: 0; border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
#about::backdrop { background: rgba(0, 0, 0, .35); }
#about h2 { margin-top: 0; }
#about h3 { margin-bottom: 4px; font-size: 15px; }
#about p, #about li { font-size: 14px; line-height: 1.5; }
#about ul { padding-left: 18px; }
#about .legal { font-size: 13px; color: var(--muted); }
#about .legal a, #feedback .fine a { color: #1a73e8; }
#about .actions, #feedback .actions { display: flex; gap: 8px; }
#about .actions .btn, #feedback .actions .btn { flex: 1; }

/* Feedback form: near the top of the screen so the phone keyboard doesn't cover it */
#feedback {
  width: min(92vw, 460px); margin: calc(var(--top) + 12px) auto auto;
  border: 0; border-radius: 16px; padding: 20px; box-shadow: var(--shadow);
}
#feedback::backdrop { background: rgba(0, 0, 0, .35); }
#feedback h2 { margin: 0 0 4px; font-size: 20px; }
#feedback .hint, #feedback .about-what { margin: 0 0 10px; font-size: 14px; line-height: 1.4; color: var(--muted); }
#feedback .about-what { color: var(--ink); }
/* Quick picks in "Report wrong info" */
#feedback .picks { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
#feedback .picks[hidden] { display: none; }
#feedback .pick {
  height: 32px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 16px; background: #fff; color: var(--ink);
  font-family: inherit; font-size: 14px; cursor: pointer;
}
#feedback .pick.on { border-color: #1a73e8; background: #e8f0fe; color: #1a73e8; }
#feedback textarea, #feedback input[type=email] {
  display: block; width: 100%; margin: 0 0 10px; padding: 10px 12px;
  border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: var(--ink);
  font-family: inherit; font-size: 16px;  /* 16px keeps iPhones from zooming in when you tap the box */
}
#feedback textarea { min-height: 96px; resize: vertical; }
#feedback textarea:focus, #feedback input[type=email]:focus { outline: 2px solid #1a73e8; outline-offset: -1px; }
#feedback .err { margin: 0 0 10px; font-size: 14px; color: #b91c1c; }
#feedback .fine { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.hp { position: absolute; left: -9999px; }  /* spam trap: hidden from people, filled in by bots */
#notice {
  position: fixed; left: 12px; right: 12px; top: 40%; z-index: 30;
  padding: 16px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
  font-size: 15px; line-height: 1.5; text-align: center;
}

/* "You are here" dot. Map markers hang from their bottom edge, so shift it down to centre it on the spot. */
.me { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, .2); transform: translateY(50%); }
/* Driving arrow, centred on the car; app.js turns it and lays it flat on the road */
.nav-puck { transform: translateY(50%); pointer-events: none; }
.nav-puck svg { display: block; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
