/* Where is it sunny today? — "weather chart" styling: cool chart paper, navy ink, one sun-yellow accent. */
/* Fonts, self-hosted (SIL Open Font License): Bricolage Grotesque and Instrument Sans, variable. */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 500 800; font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #edf1f5;
  --surface: #ffffff;
  --sunk: #f4f7fa;
  --ink: #14213d;
  --ink-2: #33415c;
  --muted: #5b6b82;
  --line: #d5dde6;
  --line-strong: #b4c0cf;
  --sun: #ffc21a;
  --sun-soft: #fff4cc;
  --sun-ink: #14213d;
  --rain: #4a6fa5;
  --good: #2f7d4f;
  --iso: #14213d;
  --float-shadow: 0 1px 2px rgba(20, 33, 61, 0.08), 0 6px 20px rgba(20, 33, 61, 0.10);
  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1726; --surface: #152035; --sunk: #1b2841; --ink: #e8eef6; --ink-2: #c3cedd;
    --muted: #93a3ba; --line: #26354f; --line-strong: #3a4c6b; --sun: #ffc94a; --sun-soft: #3a3214;
    --sun-ink: #14213d; --rain: #7fa3d6; --good: #6cc48f; --iso: #e8eef6;
    --float-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1726; --surface: #152035; --sunk: #1b2841; --ink: #e8eef6; --ink-2: #c3cedd;
  --muted: #93a3ba; --line: #26354f; --line-strong: #3a4c6b; --sun: #ffc94a; --sun-soft: #3a3214;
  --sun-ink: #14213d; --rain: #7fa3d6; --good: #6cc48f; --iso: #e8eef6;
  --float-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
.panel svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--rain); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.layout { height: 100%; display: grid; grid-template-columns: minmax(380px, 430px) 1fr; }
.panel {
  overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 24px 0;
}
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--paper); }

/* ---------- masthead ---------- */
.masthead { display: flow-root; }
/* Buttons float top-right so only the headline's first line runs beside them; the rest of the
   headline gets the full width ("sunny tomorrow?" fits on one line). */
.masthead .masthead-tools { float: right; margin: 0 0 4px 12px; }
.brand {
  margin: 0; font: 800 2.6rem/0.98 var(--display); letter-spacing: -0.024em;
  font-variation-settings: "opsz" 96;
}
.brand a { color: inherit; text-decoration: none; }
.masthead-tools { display: flex; gap: 6px; }
a.tool { display: inline-flex; align-items: center; text-decoration: none; }
.tool {
  border: 1px solid var(--line); background: transparent; border-radius: 8px; height: 34px; padding: 0 10px;
  font-size: 0.82rem; font-weight: 500; color: var(--ink-2);
}
.tool.icon { width: 34px; padding: 0; display: grid; place-items: center; }
.tool svg { width: 18px; height: 18px; }
.tool:hover { border-color: var(--line-strong); color: var(--ink); }
.lede { margin: 14px 0 20px; color: var(--muted); font-size: 0.95rem; max-width: 34em; }
/* The answer at home, right under the question: what the sky is doing where you are. */
.conditions {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start;
  margin: 16px 0 22px; padding-top: 14px; border-top: 1px solid var(--line);
}
.conditions .e { font-size: 1.9rem; line-height: 1; }
.conditions p { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.45; max-width: 32em; }
.conditions b { display: block; color: var(--ink); font: 650 1.12rem/1.3 var(--display); letter-spacing: -0.01em; margin-bottom: 2px; }
.conditions:not([hidden]) + .lede { display: none; }
a.tool.help { font: 650 0.95rem var(--display); color: var(--ink-2); }

/* ---------- form: a chart key, labels on the left ---------- */
.form { display: flex; flex-direction: column; gap: 12px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.row:first-child { align-items: start; }
.row:first-child .key { padding-top: 10px; }
.key { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.field { min-width: 0; }
.search-row { display: flex; gap: 6px; }
.search-wrap { position: relative; flex: 1; min-width: 0; }
input[type="text"] {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: inherit; outline: none;
}
input[type="text"]::placeholder { color: var(--muted); }
input[type="text"]:focus { border-color: var(--rain); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rain) 22%, transparent); }
.square {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2);
}
.square:hover { color: var(--ink); border-color: var(--ink-2); }
.suggestions {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--float-shadow);
}
.suggestions li { padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.suggestions li:hover, .suggestions li.active { background: var(--sunk); }
.suggestions small { color: var(--muted); margin-left: 4px; }
.hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }


/* segmented controls */
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 10px; padding: 2px; gap: 2px; background: var(--surface); }
.seg button {
  flex: 1 1 0; min-width: 0; border: 0; background: transparent; height: 34px; padding: 0 4px; border-radius: 7px;
  font-size: 0.85rem; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg button:hover { background: var(--sunk); color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--surface); }
.seg.icons svg { width: 18px; height: 18px; }
#leaveSeg button { flex: 1 1 auto; padding: 0 6px; }

.range-field { display: flex; align-items: center; gap: 12px; }
input[type="range"] { flex: 1; accent-color: var(--ink); margin: 0; }
output { font: 650 1.05rem var(--display); min-width: 4.2em; text-align: right; }

.go {
  margin-top: 6px; height: 50px; border: 0; border-radius: 12px; background: var(--sun); color: var(--sun-ink);
  font: 800 1.15rem var(--display); letter-spacing: -0.01em;
  box-shadow: inset 0 -2px 0 rgba(20, 33, 61, 0.18);
}
.go:hover:not(:disabled) { filter: brightness(1.04); }
.go:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.go:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- status ---------- */
.status { padding: 18px 0 4px; }
.status p { margin: 8px 0 0; font-size: 0.88rem; color: var(--ink-2); }
.progress { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar { height: 100%; width: 0; background: var(--ink); transition: width 0.4s; }

/* ---------- verdict ---------- */
#verdict { padding-top: 22px; }
.verdict h2 {
  margin: 0 0 6px; font: 800 1.75rem/1.1 var(--display); letter-spacing: -0.02em; font-variation-settings: "opsz" 60;
  text-wrap: balance;
}
.verdict p { margin: 0; color: var(--ink-2); max-width: 34em; }
.verdict.win { background: var(--sun-soft); margin: 0 -24px; padding: 20px 24px; border-block: 1px solid color-mix(in srgb, var(--sun) 50%, transparent); }
.compare { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; margin-top: 14px; font-size: 0.85rem; }
.compare .who { color: var(--ink-2); max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare .e { margin-right: 4px; }
.compare .track { height: 10px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.compare .fill { height: 100%; border-radius: 99px; }
.compare .num { font: 650 0.95rem var(--display); min-width: 2ch; text-align: right; white-space: nowrap; }
.compare-key { margin: 8px 0 0 !important; font-size: 0.78rem; color: var(--muted) !important; }

.notice {
  margin-top: 14px; font-size: 0.84rem; padding: 10px 12px; border-radius: 10px; color: var(--ink-2);
  background: var(--sunk); border-left: 3px solid var(--rain);
}

/* ---------- results: a ranked list ---------- */
#results:not(:empty) { margin-top: 18px; border-top: 1px solid var(--line); }
.result {
  width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 26px 1fr 64px; gap: 2px 12px; align-items: baseline;
  padding: 12px 8px 12px 0; position: relative;
}
.result::before { content: ""; position: absolute; left: -24px; top: 0; bottom: 0; width: 4px; background: transparent; }
.result:hover { background: var(--sunk); }
.result.sel { background: var(--sunk); }
.result.sel::before { background: var(--sun); }
.rank { font: 800 1.2rem/1 var(--display); color: var(--muted); grid-row: span 3; padding-top: 2px; text-align: center; }
.result.sel .rank { color: var(--ink); }
.result .name { font-weight: 600; font-size: 1rem; min-width: 0; }
.result .name .e { margin-right: 6px; }
.result .name small { color: var(--muted); font-weight: 400; font-size: 0.8rem; margin-left: 4px; }
.result .meta, .result .wx { grid-column: 2 / 4; font-size: 0.83rem; color: var(--muted); display: flex; flex-wrap: wrap; column-gap: 12px; }
.result .wx b { color: var(--ink); font-weight: 600; }
.meter { align-self: center; display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.meter .num { font: 800 1.15rem var(--display); }
.meter .pip { width: 12px; height: 12px; border-radius: 50%; }
.gain { color: var(--good); font-weight: 600; }
.gain.neg { color: var(--muted); }

/* ---------- trip ---------- */
.trip { padding: 22px 0 8px; }
.trip h3 { margin: 0; font: 800 1.4rem/1.15 var(--display); letter-spacing: -0.015em; }
.journey { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 10px; margin: 14px 0 4px; }
.journey .end small { display: block; font-size: 0.75rem; color: var(--muted); }
.journey .end b { font: 650 1.2rem var(--display); }
.journey .end:last-child { text-align: right; }
.journey .leg { position: relative; text-align: center; font-size: 0.8rem; color: var(--muted); padding-bottom: 10px; }
.journey .leg::after { content: ""; position: absolute; left: 0; right: 0; bottom: 4px; border-top: 2px dotted var(--line-strong); }
.journey .leg svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.timeline-title { font-size: 0.85rem; font-weight: 600; margin: 18px 0 8px; display: flex; justify-content: space-between; gap: 8px; }
.timeline-title span { color: var(--muted); font-weight: 400; text-align: right; }
.strip { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 4px; }
.cell { flex: 1 0 42px; padding: 6px 0 0; text-align: center; font-size: 0.75rem; }
.cell .e { font-size: 1.25rem; display: block; line-height: 1.3; }
.cell .tmp { font-weight: 600; display: block; }
.cell .t { color: var(--muted); display: block; padding-bottom: 5px; }
.cell .band { display: block; height: 6px; }
.cell:first-child .band { border-radius: 99px 0 0 99px; }
.cell:last-child .band { border-radius: 0 99px 99px 0; }
.route-summary { margin: 10px 0 0; font-size: 0.9rem; }
.actions { display: flex; gap: 8px; margin-top: 18px; }
.btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; text-decoration: none;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 0.88rem;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.loading-dots::after { content: "…"; }

/* ---------- about ---------- */
.about { margin-top: 36px; max-width: 36em; scroll-margin-top: 16px; }
.about h2 { margin: 0 0 10px; font: 800 1.3rem/1.2 var(--display); letter-spacing: -0.015em; }
.about h2:not(:first-child) { margin-top: 28px; }
.about h3 { margin: 18px 0 4px; font-size: 0.98rem; font-weight: 600; }
.about p { margin: 0 0 10px; color: var(--ink-2); }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 12px 34px; color: var(--ink-2); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--sun); color: var(--sun-ink); font: 800 0.78rem/1 var(--display);
}
noscript .notice { margin: 0 0 14px; }

.credits { margin-top: auto; padding: 28px 0 20px; font-size: 0.75rem; color: var(--muted); }
.credits p { margin: 0 0 4px; }
.muted { color: var(--muted); }

/* ---------- map chrome ---------- */
.map-view {
  position: absolute; z-index: 800; top: 14px; right: 14px; display: flex; gap: 2px; padding: 3px;
  background: var(--surface); border-radius: 10px; box-shadow: var(--float-shadow);
}
.map-view button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 7px; font-size: 0.84rem; font-weight: 500; color: var(--ink-2); }
.map-view button:hover { background: var(--sunk); }
.map-view button.on { background: var(--ink); color: var(--surface); }

.legend {
  position: absolute; z-index: 800; left: 14px; bottom: 28px; display: flex; gap: 22px; padding: 12px 14px;
  background: var(--surface); border-radius: 10px; box-shadow: var(--float-shadow); font-size: 0.75rem; max-width: calc(100% - 28px);
}
.legend-title { display: block; font-weight: 600; font-size: 0.78rem; margin-bottom: 6px; }
.iso-scale { display: flex; align-items: flex-end; gap: 0; }
.iso-scale span { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink-2); min-width: 42px; padding: 0 2px; white-space: nowrap; }
.iso-scale i { display: block; width: 100%; height: 10px; border-right: 1.5px solid var(--iso); background: var(--iso); }
.ramp { width: 170px; height: 10px; border-radius: 99px; }
.ramp-ends { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); margin-top: 3px; }

.map-empty {
  position: absolute; z-index: 700; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none;
  background: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--float-shadow);
  max-width: min(320px, calc(100% - 32px)); text-align: center; font-size: 0.9rem; color: var(--ink-2);
}
.map-empty p { margin: 0; }

/* contour labels on the map */
.leaflet-tooltip.iso-label {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 6px;
  box-shadow: none; padding: 1px 6px; font: 650 0.74rem var(--display);
}
.leaflet-tooltip.iso-label::before { display: none; }
.iso-line { stroke: var(--iso); }
.iso-fill { fill: var(--iso); }
.station { fill: var(--ink); }
/* Progressive map while searching: the places being checked sweep out from the start and
   breathe until their travel times arrive; rings and weather bands fade in as they're drawn. */
.scan-dot { fill: var(--ink); transform-box: fill-box; transform-origin: center; animation: scan-in 0.45s ease-out both, scan-wait 1.2s ease-in-out infinite alternate; }
@keyframes scan-in { from { opacity: 0; transform: scale(3); } to { opacity: 1; transform: scale(1); } }
@keyframes scan-wait { from { fill-opacity: 0.45; } to { fill-opacity: 0.15; } }
.iso-line, .iso-fill, .wx-band { animation: fade-in 0.4s ease-out both; }
@keyframes fade-in { from { opacity: 0; } }
.iso-pane { opacity: 1; }
.wx-pane { opacity: 0.5; }
:root[data-theme="dark"] .wx-pane { opacity: 0.6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wx-pane { opacity: 0.6; } }

/* pins */
.pin {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--ink); border: 2px solid var(--ink);
  font: 800 0.9rem/1 var(--display); box-shadow: var(--float-shadow);
  transition: transform 0.15s;
}
.pin.sel { background: var(--sun); color: var(--sun-ink); border-color: var(--sun-ink); transform: scale(1.25); }
.home-pin { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 4px solid var(--surface); box-shadow: 0 0 0 2px var(--ink), var(--float-shadow); }

.leaflet-container { font-family: var(--body); background: var(--paper); }
.leaflet-tooltip { font-family: var(--body); }
.leaflet-bar { border: 0 !important; box-shadow: var(--float-shadow) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-bottom-color: var(--line) !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2000; width: 100%; height: 100%; }

/* ---------- loading checklist ---------- */
.steps-live { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; font-size: 0.9rem; }
.steps-live li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps-live li::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid var(--line-strong);
}
.steps-live li.now { color: var(--ink); font-weight: 600; }
.steps-live li.now::before { border-color: var(--line); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
.steps-live li.done { color: var(--ink-2); }
.steps-live li.done::before {
  border-color: var(--sun);
  background: var(--sun) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='%2314213d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sheet-handle { display: none; }

/* ---------- phones: full-screen map with the panel as a bottom sheet ---------- */
@media (max-width: 860px) {
  :root {
    --body: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif; /* the phone's own font */
    --fill: rgba(118, 118, 128, 0.12); /* iOS-style grey fill for fields and segmented controls */
    --seg-on: #ffffff;
  }
  :root[data-theme="dark"] { --fill: rgba(118, 118, 128, 0.24); --seg-on: #3a4c6b; }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --fill: rgba(118, 118, 128, 0.24); --seg-on: #3a4c6b; } }

  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { font-size: 16px; }
  .layout { display: block; height: 100%; }
  .map-wrap { position: fixed; inset: 0; }

  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: 46%; z-index: 1100;
    padding: 0 16px calc(20px + env(safe-area-inset-bottom));
    border: 0; border-radius: 16px 16px 0 0;
    box-shadow: 0 -1px 0 rgba(20, 33, 61, 0.06), 0 -10px 30px rgba(20, 33, 61, 0.16);
    overflow-y: auto; overscroll-behavior: contain;
  }
  .panel.sheet-animate { transition: top 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .sheet-handle {
    display: block; position: sticky; top: 0; z-index: 3; height: 32px; margin: 0 -16px;
    background: var(--surface); touch-action: none; cursor: grab;
  }
  .sheet-handle span { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 10px auto 0; }

  /* phones get the tool, not the reading material */
  .about, a.tool.help { display: none; }

  .brand { font-size: 2rem; }
  .lede { font-size: 0.95rem; margin: 8px 0 18px; }
  .tool, .tool.icon { height: 36px; min-width: 36px; border: 0; border-radius: 18px; background: var(--fill); color: var(--ink); }
  .masthead .masthead-tools { margin-bottom: -6px; }

  /* form: labels above full-width controls, like a native settings list */
  .form { gap: 16px; border-bottom: 0; padding-bottom: 8px; }
  .row, .row:first-child { grid-template-columns: 1fr; gap: 6px; align-items: stretch; }
  .row:first-child .key { padding-top: 0; }
  .key { font-size: 0.82rem; }
  input[type="text"] { height: 46px; font-size: 16px; border: 0; border-radius: 12px; background: var(--fill); }
  input[type="text"]:focus { box-shadow: 0 0 0 2px var(--rain); }
  .square { width: 46px; height: 46px; border: 0; border-radius: 12px; background: var(--fill); }
  .hint { margin-top: 6px; }
  .seg { border: 0; border-radius: 10px; padding: 3px; gap: 2px; background: var(--fill); }
  .seg button { height: 36px; border-radius: 8px; font-size: 0.92rem; color: var(--ink); }
  .seg button.on {
    background: var(--seg-on); color: var(--ink); font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  }
  input[type="range"] { height: 32px; }
  /* the main button stays in reach while you scroll the form */
  .go {
    position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 2;
    height: 52px; border-radius: 14px; box-shadow: 0 8px 20px rgba(20, 33, 61, 0.18);
  }

  .verdict.win { margin: 0 -16px; padding: 18px 16px; }
  .result::before { left: -16px; }
  .result { padding-top: 14px; padding-bottom: 14px; }
  .btn { height: 46px; border-radius: 12px; }
  #status, #verdict, #trip { scroll-margin-top: 32px; } /* exactly under the sticky handle */

  /* map chrome floats above the sheet */
  .map-view { top: calc(10px + env(safe-area-inset-top)); right: 10px; padding: 2px; }
  .map-view button { height: 30px; padding: 0 9px; font-size: 0.8rem; }
  .legend {
    bottom: calc(var(--sheet-cover, 54vh) + 26px); left: 8px; gap: 10px; padding: 5px 8px;
    font-size: 0.64rem; border-radius: 8px; transition: opacity 0.2s;
  }
  .panel[data-sheet="full"] ~ .map-wrap :is(.legend, .map-view, .leaflet-bottom) { opacity: 0; pointer-events: none; }
  .map-view, .leaflet-bottom { transition: opacity 0.2s; }
  .legend-title { display: none !important; }
  .iso-scale span { min-width: 26px; gap: 2px; }
  .iso-scale i { height: 6px; }
  .ramp { width: 76px; height: 6px; margin-top: 2px; }
  .ramp-ends { margin-top: 4px; }
  .leaflet-bottom { bottom: var(--sheet-cover, 54vh); }
  .leaflet-control-zoom { display: none; }
  .leaflet-control-attribution { font-size: 9px; max-width: 100vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.route-casing { stroke: var(--surface); }

/* Touch screens: no sticky hover highlights after a tap, and no double-tap-zoom delay. */
button, a, input, .result { touch-action: manipulation; }
@media (hover: none) {
  .seg button:hover:not(.on), .map-view button:hover:not(.on) { background: transparent; color: var(--ink-2); }
  .result:hover:not(.sel) { background: transparent; }
  .square:hover, .tool:hover, .btn:hover { border-color: var(--line-strong); }
}

/* Still searching: a banner over the early results, rings over the areas being looked at
   more closely, and a loading bar along the top of the map for the whole search. */
.refining {
  display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--ink); color: var(--surface); font-size: 0.88rem; font-weight: 600;
}
.refining .spin {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--surface) 30%, transparent); border-top-color: var(--sun);
  animation: spin 0.8s linear infinite;
}
.ping { position: relative; width: 96px; height: 96px; pointer-events: none; }
.ping i {
  position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--sun);
  background: color-mix(in srgb, var(--sun) 18%, transparent);
  animation: ping 1.8s ease-out infinite;
}
.ping i + i { animation-delay: 0.9s; }
@keyframes ping { from { transform: scale(0.25); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.map-busy {
  position: absolute; z-index: 900; top: 0; left: 0; right: 0; height: 4px; overflow: hidden;
  background: color-mix(in srgb, var(--sun) 25%, transparent);
}
.map-busy::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: var(--sun);
  animation: busy 1.2s ease-in-out infinite;
}
@keyframes busy { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .ping i { opacity: 0.6; transform: scale(0.7); }
  .ping i + i { display: none; }
  .map-busy::after { left: 0; width: 100%; opacity: 0.6; }
}

/* ---------- rain radar ---------- */
.map-chip {
  position: absolute; z-index: 800; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px 0 11px; border: 0; border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: var(--float-shadow); font-size: 0.86rem; font-weight: 600;
}
.map-chip svg, .rb-play svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-chip.on { background: var(--ink); color: var(--surface); }
.radar-pane { opacity: 0.78; }
.radar-pane .radar-frame { transition: opacity 0.3s ease; } /* frames cross-fade instead of flicking */

.radar-bar {
  position: absolute; z-index: 800; left: 14px; right: 64px; bottom: 28px; max-width: 680px;
  padding: 12px 16px 10px; border-radius: 12px; background: var(--surface); box-shadow: var(--float-shadow);
  --now: 30%;
}
.rb-top { display: flex; align-items: center; gap: 12px; }
.rb-play {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--surface);
}
.rb-play svg { width: 18px; height: 18px; }
.rb-play { position: relative; }
.radar-bar.loading .rb-play::after { /* a ring round the button while the shown frame loads */
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--sun); border-right-color: var(--sun);
  animation: spin 0.8s linear infinite;
}
.rb-play .i-pause, .rb-play.playing .i-play { display: none; }
.rb-play.playing .i-pause { display: block; }
.rb-label { margin: 0; flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rb-kind {
  font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  background: var(--ink); color: var(--surface);
}
.rb-kind.future { background: var(--sun); color: var(--sun-ink); }
.rb-time { font: 800 1.25rem/1 var(--display); }
.rb-rel { font-size: 0.85rem; color: var(--muted); }
.rb-key { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); max-width: 210px; }
.rb-key b { color: var(--ink); font-weight: 600; }
.rb-ramp {
  flex: none; width: 54px; height: 8px; border-radius: 99px;
  background: linear-gradient(90deg, #3ed65a, #11a81a, #0b7d0e, #f2e33a, #f28c28, #d7263d, #b5179e);
}

/* timeline: the past (real radar) grey, the forecast striped yellow */
.rb-track { position: relative; height: 30px; margin: 10px 4px 0; }
.has-arrive .rb-track { margin-top: 30px; } /* room above for the "Arrive" marker */
.rb-rail {
  position: absolute; left: 0; right: 0; top: 12px; height: 6px; border-radius: 99px;
  background:
    linear-gradient(90deg, var(--line-strong) 0 var(--now), transparent var(--now)),
    repeating-linear-gradient(135deg, color-mix(in srgb, var(--sun) 70%, transparent) 0 5px, color-mix(in srgb, var(--sun) 30%, transparent) 5px 10px);
}
.rb-track input[type="range"] {
  position: absolute; inset: 0; width: 100%; height: 30px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.rb-track input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 30px; }
.rb-track input[type="range"]::-moz-range-track { background: transparent; }
.rb-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: 5px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink); box-shadow: var(--float-shadow);
}
.rb-track input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--ink); }
.rb-arrive {
  position: absolute; bottom: 26px; transform: translateX(-50%); white-space: nowrap;
  border: 0; border-radius: 6px; padding: 3px 8px; background: var(--sun); color: var(--sun-ink);
  font-size: 0.72rem; font-weight: 700; box-shadow: var(--float-shadow);
}
.rb-arrive::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--sun);
}
.rb-scale { position: relative; height: 16px; margin: 0 4px; font-size: 0.72rem; color: var(--muted); }
.rb-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rb-scale span:first-child { transform: none; }
.rb-scale span:last-child:not(:nth-child(2)) { transform: translateX(-100%); }
.rb-note { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }

/* the sunshine colours and the radar both use colour, so only one shows at a time */
.radar-on .map-view, .radar-on #legendWx { display: none !important; }
.radar-on .legend { bottom: 172px; }

@media (max-width: 860px) {
  .map-chip { top: calc(10px + env(safe-area-inset-top)); left: 10px; height: 34px; font-size: 0.8rem; }
  .radar-bar { left: 8px; right: 8px; bottom: calc(var(--sheet-cover, 54vh) + 24px); padding: 10px 12px 8px; transition: opacity 0.2s; }
  .rb-key { display: none; } /* the key moves into the bar's second line on phones */
  .rb-note { font-size: 0.72rem; }
  .radar-on .legend { display: none; } /* phones: the rings are labelled on the map, so the timeline gets the room */
  .rb-track { margin-top: 6px; height: 26px; }
  .has-arrive .rb-track { margin-top: 24px; }
  .rb-rail { top: 10px; }
  .rb-track input[type="range"] { height: 26px; }
  .rb-track input[type="range"]::-webkit-slider-runnable-track { height: 26px; }
  .rb-track input[type="range"]::-webkit-slider-thumb { margin-top: 3px; }
  .rb-arrive { bottom: 22px; }
  .rb-play { width: 34px; height: 34px; }
  .rb-play svg { width: 16px; height: 16px; }
  .rb-time { font-size: 1.1rem; }
  .rb-top { gap: 10px; }
  .panel[data-sheet="full"] ~ .map-wrap .radar-bar { opacity: 0; pointer-events: none; }
}
.rb-key-phone { display: none; }
@media (max-width: 860px) { .rb-key-phone { display: block; margin: 4px 0 0; font-size: 0.72rem; color: var(--muted); } .rb-key-phone b { color: var(--ink); } }
