:root {
  --bg: #f7f7f4; --surface: #ffffff; --text: #1d2321; --muted: #5d6763; --line: #dde1dc;
  --accent: #1f6f5c; --accent-ink: #ffffff;
  --a: #2563c9; --hi: #0e6e50; --mid: #c08a00; --lo: #d4462f; --night: #9aa3a0; --weak: #5b8fc4;
  --chip: #eef1ec; --shadow: rgba(30, 40, 60, .38);
  --chg-fast: #d9480f; --chg-slow: #1971c2;  /* charger kinds: the same orange and blue in both themes */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121615; --surface: #1b201f; --text: #e8ece9; --muted: #9aa5a0; --line: #2d3432;
    --accent: #5cc3a6; --accent-ink: #0d1412;
    --a: #6ea2ff; --hi: #6fdba6; --mid: #d9a520; --lo: #e25a3f; --night: #5e6764; --weak: #7fa6d6;
    --chip: #232a28; --shadow: rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121615; --surface: #1b201f; --text: #e8ece9; --muted: #9aa5a0; --line: #2d3432;
  --accent: #5cc3a6; --accent-ink: #0d1412;
  --a: #6ea2ff; --hi: #6fdba6; --mid: #d9a520; --lo: #e25a3f; --night: #5e6764; --weak: #7fa6d6;
  --chip: #232a28; --shadow: rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: from-font; }
/* Browser surfaces in the palette, not the browser's blue. */
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); color: inherit; }
:root { accent-color: var(--accent); caret-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Distances and times line up when stacked. */
.pp-tile b, .pstat b, .plist, .facts, .tl-axis, .timebar output, .badge, .pp-pill, .pp-best { font-variant-numeric: tabular-nums; }

/* Icons: one family (Tabler, static/icons.svg), sized to the text they sit in. */
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; stroke-width: 2; }
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .35em; }
.brand-mark { color: var(--accent); width: 1.3em; height: 1.3em; }
header.top { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
header.top h1 { font-size: 1.15rem; margin: 0; }
header.top nav { margin-left: auto; display: flex; gap: 14px; font-size: .9rem; }
.nav-about .i { display: none; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.controls { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.timebar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.date-pick { display: contents; }
.timebar input[type=range] { flex: 1 1 220px; accent-color: var(--accent); }
.timebar output { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4.5em; }
.timebar input[type=date] { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--chip); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: .9rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35em; transition: background-color .15s ease-out, border-color .15s ease-out, color .15s ease-out; }
.chip .i { color: var(--muted); }
/* Both playback states size the same grid cell, even when one is hidden. */
#playBtn { display: inline-grid; }
#playBtn > span { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; gap: .35em; }
#playBtn[aria-pressed="false"] .play-active, #playBtn[aria-pressed="true"] .play-idle { visibility: hidden; }
.chip:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.chip[aria-pressed="true"] .i { color: inherit; }
a.chip { text-decoration: none; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.banner { border-radius: 10px; padding: 8px 12px; background: var(--chip); font-size: .92rem; }
.banner .i { color: var(--accent); margin-right: .3em; }
.banner .link { margin-left: .4em; }
.chips[hidden] { display: none; }
/* Touch screens: every chip is a full 44px target. */
@media (pointer: coarse) { .chip { min-height: 44px; } }
.banner:empty { display: none; }

#map { height: 58vh; min-height: 340px; border-radius: 12px; border: 1px solid var(--line); margin: 12px 0; }
/* The vector map's own paper colour while it loads, so it fades in instead of popping out of grey. */
#map.leaflet-container { background: #f8f4f0; }
/* Tap-and-drag zoom and double taps must not start iOS text selection or its magnifier on the
   map's labels, markers or attribution. Popups keep selectable text (addresses, names).
   The whole map page, not just the map: iOS otherwise extends the selection over every text on the page. */
.page-map { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.page-map input, .page-map textarea, .page-map .leaflet-popup { -webkit-user-select: text; user-select: text; }
.legend { display: flex; gap: 8px 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.legend-box { margin: 0 0 4px; }
.legend-box summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: 4px 0; }
.legend-box[open] summary { margin-bottom: 6px; }
.legend-box .prov { margin: 8px 0 0; }
/* The colour key inside the map (bottom left), so colours are never decoded from below the fold. */
.map-key { background: var(--surface); color: var(--text); border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); padding: 5px 9px; display: flex; gap: 4px 10px; flex-wrap: wrap; font-size: .78rem; max-width: 220px; }
.map-key span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.map-key .dot { margin: 0; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }
.dot.a { background: transparent; border: 3px solid var(--a); } .dot.hi { background: var(--hi); } .dot.mid { background: var(--mid); } .dot.lo { background: var(--lo); } .dot.night { background: var(--night); }
/* Early morning, evening and night: no shade to compare, so no colour key (the answer says why). */
.low-sun .sheet-key, .low-sun .map-key { display: none; }
/* Map keys draw the dots the way the map draws markers: a larger white-ringed disc for 適合, a quiet ring for 太曬. */
:is(.map-key, .sheet-key, .legend-box) .dot.hi { width: 14px; height: 14px; vertical-align: -3px; background: var(--hi);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
:is(.map-key, .sheet-key, .legend-box) .dot.lo { width: 9px; height: 9px; background: var(--surface); border: 1.5px solid var(--lo); }
/* Park markers that suit the selected time: a larger green disc ringed in white, on top of everything else.
   Size and the ring (not colour alone) set it apart from the smaller amber 部分遮陰 dot. */
.mk-hi { display: block; background: var(--hi); border: 2.5px solid #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.mk-hi.rain { box-shadow: 0 0 0 3px var(--a), 0 2px 6px rgba(0,0,0,.35); }
/* The tapped park: its own marker, grown and lifted while its card or popup is open. */
.leaflet-marker-icon.mk-sel { display: flex; align-items: center; justify-content: center; pointer-events: none; }
.mk-sel-in { display: flex; transform: scale(var(--s)); filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.mk-sel .mk-hi { opacity: 1; box-shadow: none; }
.mk-sel .mk-hi.rain { box-shadow: 0 0 0 3px var(--a); }
.sel-dot { display: block; box-sizing: border-box; border-radius: 50%; }
.mk-sel.pop .mk-sel-in { animation: sel-pop .34s cubic-bezier(.2, .9, .3, 1.25) both; }
@keyframes sel-pop { 0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(0,0,0,0)); }
  55% { transform: scale(calc(var(--s) * 1.14)); } 100% { transform: scale(var(--s)); } }
@media (prefers-reduced-motion: reduce) { .mk-sel.pop .mk-sel-in { animation: none; } }
.listbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 18px 0 10px; }
.listbar h2 { margin: 0; }
.sort-note { margin: -4px 0 10px; font-size: .82rem; color: var(--muted); }
.badges .year { font-size: .8rem; color: var(--muted); align-self: center; }
.card h3 .h-district { margin-left: .4em; font-size: .8rem; font-weight: 400; color: var(--muted); }
.empty { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; grid-column: 1 / -1; }
.empty p { margin: 0 0 8px; } .empty p:last-child { margin: 0; }
.empty-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip.on { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border-color: var(--accent); }
.dot.shadow { background: var(--shadow); border-radius: 2px; }
.chg { display: flex; align-items: center; justify-content: center; line-height: 1; }
.chg svg { width: 100%; height: 100%; display: block; }
.chg.fast { background: var(--chg-fast); color: #fff; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.4); padding: 3px; }
.chg.slow { color: var(--chg-slow); filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.45)); }
.chg.unknown { background: #868e96; color: #fff; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  font-size: 11px; font-weight: 700; }
.chg.inline { display: inline-flex; width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.chg.inline.fast, .chg.inline.unknown { border-width: 1px; padding: 2px; font-size: 9px; }

.list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 6px; }
.card h3 { margin: 0; font-size: 1rem; }
.card[data-park] { cursor: pointer; }
.card[data-park]:hover { border-color: var(--accent); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--chip); }
.badge.A { background: var(--a); color: #fff; }
.badge.v-hi { background: color-mix(in srgb, var(--hi) 18%, var(--surface)); }
.badge.v-mid { background: color-mix(in srgb, var(--mid) 22%, var(--surface)); }
.badge.v-lo { background: color-mix(in srgb, var(--lo) 18%, var(--surface)); }
.badge .i { width: 1em; height: 1em; margin-right: .2em; }
.facts .i { color: var(--muted); margin-right: .25em; }
.facts { font-size: .88rem; color: var(--muted); display: grid; gap: 2px; }

.timeline { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; height: 14px; }
.timeline span { border-radius: 2px; }
.timeline span.cur { outline: 2px solid var(--text); outline-offset: -1px; }
.hi { background: var(--hi); } .mid { background: var(--mid); } .lo { background: var(--lo); } .night { background: var(--night); opacity: .4; }
.tl-axis { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); }

table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tablewrap { overflow-x: auto; }
table.heat td, table.heat th { padding: 0; border: 1px solid var(--bg); text-align: center; font-size: .7rem; }
table.heat td { width: 3.5%; height: 18px; }
table.heat th { padding: 2px 4px; color: var(--muted); font-weight: 500; }
section { margin: 22px 0; }
h2 { font-size: 1.1rem; }
.prov { font-size: .82rem; color: var(--muted); }
footer { padding: 20px 16px 28px; color: var(--muted); font-size: .78rem; line-height: 1.6; text-align: center; }
footer p { margin: 0 0 4px; }
/* Phones: the map comes first - compact header and controls, one swipeable row of filters, a taller map. */
@media (max-width: 600px) {
  header.top { padding: 8px 12px; gap: 8px; align-items: center; flex-wrap: nowrap; }
  header.top h1 { font-size: 1rem; white-space: nowrap; }
  header.top .subtitle { display: none; }
  header.top nav { margin-left: auto; gap: 10px; font-size: .82rem; white-space: nowrap; }
  main { padding: 10px 10px 16px; }
  .controls { padding: 8px; gap: 8px; border-radius: 10px; }
  .search input { padding: 7px 10px; font-size: .95rem; }
  .timebar { gap: 6px 8px; }
  .timebar .tlabel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .timebar input[type=date] { font-size: .85rem; padding: 3px 4px; }
  .timebar output { min-width: 0; order: 1; }
  .timebar .chip { order: 2; padding: 4px 10px; font-size: .85rem; }
  .timebar #playBtn .lbl { display: none; }
  .timebar input[type=range] { order: 3; flex: 1 1 100%; margin: 0; }
  /* All the filters in one row that scrolls sideways. */
  .chips.filters { gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 -8px; padding: 0 8px 2px; }
  .chips.filters::-webkit-scrollbar { display: none; }
  .chips.filters .chip { flex: none; white-space: nowrap; padding: 4px 10px; font-size: .85rem; }
  .banner { padding: 6px 10px; font-size: .82rem; }
  #map { height: 64vh; min-height: 380px; margin: 10px 0; border-radius: 10px; }
  /* Small but never cut: OpenStreetMap's licence requires the credit to stay readable. */
  .leaflet-control-attribution { font-size: 11px; line-height: 1.5; padding: 1px 6px; white-space: nowrap; }
  .legend { gap: 6px 12px; font-size: .78rem; }
  .pp-name { font-size: 15px; }
  .pp-pills { margin: 8px 0 6px; }
  .pp-pill { font-size: 11.5px; padding: 2px 8px; }
  .pp-best { font-size: 12px; margin-bottom: 6px; }
  .pp-grid { gap: 4px; margin-bottom: 8px; }
  .pp-tile { font-size: 12px; }
  .pp-btn { padding: 5px 8px; font-size: 12.5px; }
}

.fav { background: none; border: 0; padding: 0 2px; font-size: 1.15rem; line-height: 1; cursor: pointer; color: var(--muted); }
.fav[aria-pressed="true"] { color: #e8a317; }
@media (pointer: coarse) { .fav:not(.pbtn) { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; margin: -10px -8px; } }
/* Star toggles: outline when off, filled amber when on. */
[data-fav] .i.on, [data-fav][aria-pressed="true"] .i.off { display: none; }
[data-fav][aria-pressed="true"] .i.on { display: inline-block; color: #e8a317; }
.fav-label { margin-left: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.actions[hidden], .actions [hidden] { display: none; }

/* On-map controls */
.map-ctl button { font: inherit; cursor: pointer; }
.map-ctl .locate { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: #fff; color: #333; border: 0; border-radius: 4px; }
.map-ctl .locate.on { color: #2b7bff; }
.map-ctl .locate.busy svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.chg-ctl { display: flex; flex-direction: column; gap: 8px; }
.chg-btn { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.35); background: #fff; color: #868e96; padding: 0;
  display: flex; align-items: center; justify-content: center; }
.chg-btn[aria-pressed="true"] { background: var(--chg-fast); color: #fff; }
.chg-btn .n { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #fff; color: #222; font-size: 11px; font-weight: 700; line-height: 18px; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.chg-btn .n:empty { display: none; }
.map-toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; max-width: 90%;
  background: #1e1e1e; color: #fff; padding: 8px 14px; border-radius: 8px; font-size: .88rem; text-align: center; }
.map-toast[hidden] { display: none; }

/* TDX attribution: the logo has dark text, so give it a light backing in dark mode too. */
.tdx-logo img, .tdx-credit img { background: #fff; border-radius: 4px; padding: 2px 4px; vertical-align: middle; }
.tdx-logo { margin-left: 4px; }
.map-night .i { margin-right: .3em; }
/* Notes that float on the map, so they never push the page around. */
.map-note, .map-empty { position: absolute; left: 50%; transform: translateX(-50%); z-index: 1000; max-width: calc(100% - 120px);
  background: var(--surface); color: var(--text); padding: 6px 12px; border-radius: 8px; font-size: .85rem; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.map-note { top: 52px; pointer-events: none; }
.map-empty { top: 52px; }
.map-note[hidden], .map-empty[hidden], .popup-open .map-note, .popup-open .map-empty { display: none; }
.popup-open .map-night { display: none; }  /* the night note would sit on top of an open popup */
.map-empty .link { margin: 0 2px; }
/* First visit: where to start. Sits over the overview map, which stays visible as proof of coverage. */
.map-start { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1100;
  width: min(360px, calc(100% - 32px)); background: var(--surface); color: var(--text); border-radius: 16px;
  padding: 20px 20px 14px; text-align: center; box-shadow: 0 12px 32px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12);
  animation: start-in .32s cubic-bezier(.16,1,.3,1); }
.map-start[hidden] { display: none; }
.map-start h2 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.35; text-wrap: balance; }
.map-start p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.start-locate { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin: 16px 0 0;
  border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; }
.start-locate:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.start-locate.busy { opacity: .75; cursor: progress; }
.map-start .start-or { margin: 14px 0 8px; font-size: .82rem; }
.start-cities { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.map-start .start-note { margin-top: 14px; font-size: .78rem; }
.start-skip { margin-top: 6px; min-height: 36px; font-size: .85rem; color: var(--muted); }
.start-open .map-empty, .start-open .map-note, .start-open .map-night, .start-open .map-loading { display: none; }
@keyframes start-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); } }
@media (prefers-reduced-motion: reduce) { .map-start { animation: none; } }
/* The map takes keyboard focus; an inset ring instead of a frame around the whole map. */
.leaflet-container:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.leaflet-container:focus:not(:focus-visible) { outline: none; }
.map-night { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 1000; max-width: 70%;
  background: #0b1a33; color: #fff; padding: 6px 12px; border-radius: 8px; font-size: .88rem; text-align: center; pointer-events: none; }
.map-night[hidden] { display: none; }
.map-loading { position: absolute; left: 56px; top: 10px; z-index: 1000; background: var(--surface); color: var(--text);
  padding: 4px 10px; border-radius: 6px; font-size: .82rem; box-shadow: 0 1px 3px rgba(0,0,0,.25); pointer-events: none; }
.map-loading[hidden] { display: none; }

/* Park page: cards ordered by what parents need first */
.park { max-width: 640px; margin: 0 auto; display: grid; gap: 12px; }
.park > p.small { margin: 0; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0; }
.pname { font-size: 1.35rem; margin: 0 0 2px; }
.ptitle { font-size: 1rem; margin: 0 0 10px; }
.pbtns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.pbtn { font: inherit; font-size: .9rem; padding: 7px 4px; justify-content: center; white-space: nowrap; border-radius: 999px; border: 1px solid var(--line); background: var(--chip);
  color: var(--text); text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.pbtn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pbtn .i { width: 1.05em; height: 1.05em; }
.pbtn.fav[aria-pressed="true"] { border-color: #e8a317; }
.pbtn.fav .fav-label { margin-left: 2px; }
/* Spacing utilities for the park page (instead of inline styles). */
.m0 { margin: 0; } .mt-4 { margin: 4px 0 0; } .mt-6 { margin: 6px 0 0; } .mt-8 { margin: 8px 0 0; } .mt-10 { margin: 10px 0 0; }
.mb-10 { margin: 0 0 10px; } .tl-cap { margin: 10px 0 4px; } .block { display: block; } .full { width: 100%; }
.pbtns.two { grid-template-columns: 1fr 1fr; margin-top: 0; }
.pnote { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--chip); font-size: .88rem; }
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.pstat { background: var(--chip); border-radius: 10px; padding: 8px 4px; }
.pstat b { display: block; font-size: 1.3rem; line-height: 1.3; }
.pstat span { font-size: .78rem; color: var(--muted); }
.pstat.hi, .pp-pill.hi { background: color-mix(in srgb, var(--hi) 18%, var(--surface)); }
.pstat.mid, .pp-pill.mid { background: color-mix(in srgb, var(--mid) 22%, var(--surface)); }
.pstat.lo, .pp-pill.lo { background: color-mix(in srgb, var(--lo) 18%, var(--surface)); }
.pstat.night, .pp-pill.night { background: var(--chip); opacity: 1; }
.pstat.weak, .pp-pill.weak, .badge.v-weak { background: color-mix(in srgb, var(--weak) 22%, var(--surface)); }
.dot.weak, .timeline span.weak { background: var(--weak); }
.pp-alt { font-size: 13px; margin: -2px 0 8px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pp-alt .i { color: var(--accent); }  /* not the faded map "night" dot */
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plist li { display: flex; gap: 8px; align-items: flex-start; }
.plist li[hidden] { display: none; }
.pico { width: 1.4em; flex: none; display: inline-flex; justify-content: center; padding-top: .15em; color: var(--accent); }
.pico .i { width: 1.2em; height: 1.2em; }
.plist li.muted .pico { color: var(--muted); }
.tag { display: inline-block; font-size: .82rem; padding: 1px 8px; margin: 2px 4px 2px 0; border-radius: 999px; background: var(--chip); }
.pmore { margin-top: 10px; }
.pmore + .pmore { border-top: 1px solid var(--line); padding-top: 10px; }
.pcard > .pmore:first-child { margin-top: 0; }
.pmore summary { cursor: pointer; color: var(--muted); font-size: .92rem; }
.pmore[open] summary { margin-bottom: 8px; }

/* Map popup */
.pp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding-right: 18px; }
.pp-name { font-size: 16px; font-weight: 700; }
.pp-sub { font-size: 12px; color: var(--muted); }
.pp-pills { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; margin: 10px 0 8px; }
.pp-pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--chip); }
.pp-pill.a { background: color-mix(in srgb, var(--a) 18%, var(--surface)); }
.pp-best { font-size: 13px; color: var(--muted); }
.pp-best b { color: var(--text); font-weight: 600; }
.pp-grid { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; margin-bottom: 10px; }
.pp-tile { display: inline-flex; align-items: center; gap: 4px; background: var(--chip); border-radius: 999px; padding: 0 10px; min-height: 36px; color: var(--muted); }
a.pp-tile, button.pp-tile { text-decoration: none; border: 1px solid var(--line); font: inherit; cursor: pointer; }
a.pp-tile:focus-visible, button.pp-tile:focus-visible { border-color: var(--accent); }
@media (hover: hover) { a.pp-tile:hover, button.pp-tile:hover { border-color: var(--accent); } }  /* no sticky hover after a tap */
button.pp-tile[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
button.pp-tile.busy { opacity: .6; }
/* Nearby places for a park card's tile: a small labelled pin, centred on the spot. */
.near-mk { width: 0; height: 0; }
.near-in { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 7px 3px 5px; border-radius: 999px; background: var(--surface); color: var(--text); border: 1.5px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,.25); white-space: nowrap; font-size: 12px; line-height: 1; cursor: pointer; }
.near-in .i { width: 15px; height: 15px; color: var(--accent); }
.near-in b { font-weight: 600; font-variant-numeric: tabular-nums; }
.near-mk.charge .near-in { border-color: var(--chg-slow); } .near-mk.charge .near-in .i { color: var(--chg-slow); }
.near-mk.charge.fast .near-in { border-color: var(--chg-fast); } .near-mk.charge.fast .near-in .i { color: var(--chg-fast); }
/* A nearby place that's off screen: a pin at the edge of the open map, pointing its way. */
.near-edge { position: absolute; inset: 0; z-index: 700; pointer-events: none; }
.near-edge-btn { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: inline-flex; align-items: center; gap: 3px;
  min-height: 32px; padding: 0 9px 0 5px; border-radius: 999px; background: var(--surface); color: var(--text); border: 1.5px dashed var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,.25); white-space: nowrap; font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
.near-edge-btn::before { content: ""; position: absolute; inset: -6px; }  /* a 44px tap target */
.near-edge-btn .i { width: 15px; height: 15px; color: var(--accent); }
.near-edge-btn b { font-weight: 600; font-variant-numeric: tabular-nums; }
.near-edge-dir { display: inline-flex; width: 14px; height: 14px; color: var(--text); }
.near-edge-dir svg { width: 100%; height: 100%; }
.near-edge-btn.charge { border-color: var(--chg-slow); } .near-edge-btn.charge .i { color: var(--chg-slow); }
.near-edge-btn.charge.fast { border-color: var(--chg-fast); } .near-edge-btn.charge.fast .i { color: var(--chg-fast); }
.near-edge-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.near-pop { display: grid; gap: 6px; min-width: 180px; font-size: 14px; }
.near-btns { display: flex; gap: 6px; margin-top: 2px; }
.near-fact { font-size: 13px; color: var(--muted); line-height: 1.4; }
.near-pop strong { font-size: 16px; line-height: 1.3; }
.near-pop .pp-btn { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; font-size: 14px; }
/* The popup shell is Leaflet's white; theme it like the park popup so dark mode keeps its contrast. */
.near-popup .leaflet-popup-content-wrapper, .near-popup .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.near-popup .leaflet-popup-content-wrapper { border-radius: 14px; }
.near-popup .leaflet-popup-content { margin: 12px 14px; line-height: 1.45; }
.pp-tile span { line-height: 1; }
.pp-tile > .i { width: 16px; height: 16px; flex: none; color: var(--accent); }
.pp-tile b { color: var(--text); font-weight: 600; }
.pp-btns { display: flex; gap: 6px; }
.pp-btn { flex: none; font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text) !important; text-decoration: none; text-align: center; cursor: pointer; }
.pp-btn.primary { flex: 1; background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; }
/* 評論 and 分享 are rarely the reason to open a card: they sit behind ⋯. */
.pp-more { position: relative; flex: none; }
.pp-more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pp-more > summary::-webkit-details-marker { display: none; }
.pp-more > summary .i { width: 20px; height: 20px; }
.pp-more[open] > summary { border-color: var(--accent); }
.pp-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 9.5rem; padding: 4px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: 0 6px 20px rgba(0,0,0,.16); display: grid; }
.pp-menu a, .pp-menu button { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 14px; color: var(--text); text-decoration: none; text-align: left; cursor: pointer; }
.pp-menu a:hover, .pp-menu button:hover, .pp-menu a:focus-visible, .pp-menu button:focus-visible { background: var(--chip); }

/* Terms page: tighter list indent on phones */
.terms ol, .terms ul { padding-left: 1.3em; }
.terms li { margin-bottom: 6px; }

/* Search */
.search { position: relative; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.search-results { position: absolute; z-index: 1100; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.15); max-height: 60vh; overflow-y: auto; }
.search-results[hidden] { display: none; }
.search-results li { padding: 9px 12px; cursor: pointer; }
.search-results li .i { color: var(--accent); margin-right: .3em; }
.search-results li[tabindex]:hover, .search-results li:focus { background: var(--chip); outline: none; }

/* Playground reports */
.report-equip { border: 0; padding: 0; margin: 12px 0 0; }
.report-equip legend { padding: 0; margin-bottom: 6px; }
.report-equip .tag { cursor: pointer; padding: 4px 10px; }
.report-equip .tag input { margin: 0 2px 0 0; vertical-align: -1px; }
#reportTally .i { color: var(--accent); margin-right: .25em; }
.pbtn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.pbtn:disabled { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- phone app layout
   Wider screens: the sheet is just the page below the map, and the phone-only controls are hidden.
   Phones (<= 600px): a full-screen map, controls floating on top, and a bottom sheet with three
   heights (peek / half / full) holding the answer, the tapped park, the list and the filters. */
.date-btn, .search-ico, .sheet-head, .sheet-card-head, .sheet-park { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------- desktop park panel
   Wider screens: the map and a left panel share one frame. A tapped park opens in the panel, so the
   card never sits on top of the parking, toilet, shop and charger pins it asks the map to show.
   Phones keep the bottom sheet; there the stage and the panel step out of the way. */
.map-stage, .planning-rail, .planning-tools { display: contents; }
.park-panel { display: none; }
.timeline-toolbar { background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px; }
@media (min-width: 601px) {
  .page-map {
    height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  }
  .page-map main {
    flex: 1; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  }
  .map-stage { display: flex; flex: 1; min-height: 0; }
  .map-workspace { position: relative; flex: 1; min-width: 0; }
  .map-stage #map { position: relative; height: 100%; min-height: 0; margin: 0; border: 0; border-radius: 0; }
  .map-stage .leaflet-container:focus-visible { border-radius: 0; }
  .map-workspace .controls {
    position: absolute; z-index: 1100; inset: 12px 12px auto; padding: 0; gap: 6px;
    width: fit-content; max-width: calc(100% - 24px); grid-template-columns: minmax(0, 1fr);
    align-items: start; background: transparent; border: 0; pointer-events: none;
  }
  /* One row of filters; when the map is too narrow for all of them, the row scrolls sideways. */
  .map-workspace .chips.filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; pointer-events: auto;
    margin: -4px -6px; padding: 4px 6px 8px; }
  .map-workspace .chips.filters::-webkit-scrollbar { display: none; }
  .map-workspace .chips.filters .chip { flex: none; white-space: nowrap; }
  .map-workspace .chips.filters.cut { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .map-workspace .chip { pointer-events: auto; background: var(--surface); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
  .map-workspace .chip[aria-pressed="true"] { background: var(--accent); }
  #map .leaflet-top { top: calc(var(--ctl-h, 0px) + var(--filter-inset, 12px)); }
  #map .map-night, #map .map-loading { top: calc(var(--ctl-h, 0px) + var(--filter-inset, 12px) + 10px); }
  #map .map-note, #map .map-empty { top: calc(var(--ctl-h, 0px) + var(--filter-inset, 12px) + 52px); }
  #map .map-start {
    top: calc((100% + var(--ctl-h, 0px) + var(--filter-inset, 12px)) / 2);
    max-height: max(0px, calc(100% - var(--ctl-h, 0px) - 36px)); margin: 0; overflow-y: auto;
  }
  .timeline-toolbar .timebar input[type=range] { flex-basis: 120px; }
  .planning-rail {
    display: flex; flex-direction: column; flex: none; width: clamp(260px, 36%, 380px);
    min-height: 0; background: var(--surface); border-left: 1px solid var(--line);
  }
  .planning-tools {
    display: grid; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line);
    position: relative; z-index: 3;
  }
  .planning-tools .banner { font-size: .8rem; padding: 6px 8px; }
  .view-saved .planning-tools, .view-saved .map-workspace .controls { display: none; }
  .view-saved .map-workspace { --filter-inset: 0px; }
  .park-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; color: var(--text); }
  .park-panel[hidden] { display: none; }
  .panel-search .search-ico {
    display: block; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none;
  }
  .panel-search .search input { padding-left: 36px; }
  .panel-views { position: relative; flex: 1; min-height: 0; overflow: clip; }
  .panel-views .legend-box { margin: 8px 16px 0; }
  /* Two views in one panel: the parks in view, and the tapped park pushed in over them. */
  .pv { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--surface);
    transition: transform var(--push) var(--ease-out), opacity var(--push) var(--ease-out), visibility 0s linear var(--push); }
  .pv:focus { outline: none; }
  .pv:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .pv-detail { transform: translateX(100%); opacity: 0; visibility: hidden; scroll-padding-top: var(--panel-head, 0px); }
  .park-panel[data-view="detail"] .pv-list { transform: translateX(-22%); opacity: 0; visibility: hidden; }
  .park-panel[data-view="detail"] .pv-detail { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
  .plist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 14px 16px 2px; }
  .plist-head h2 { margin: 0; font-size: 1.05rem; text-wrap: balance; }
  .plist-head .chips { gap: 6px; }
  .plist-head .chip { font-size: .85rem; padding: 3px 11px; }
  .plist-note { margin: 4px 16px 6px; font-size: .78rem; color: var(--muted); }
  .plist { padding: 0 16px 12px; }
  .plist > .muted, .plist > p, .plist > div:not(.prow) { font-size: .9rem; }
  .prow { position: relative; display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
  .prow:last-child { border-bottom: 0; }
  .prow::before { content: ""; position: absolute; inset: 0 -16px; background: color-mix(in srgb, var(--accent) 14%, transparent);
    opacity: 0; pointer-events: none; }
  .prow.sel::before { opacity: 1; }
  .prow.flash::before { animation: row-flash 1.1s var(--ease-out) both; }
  @keyframes row-flash { from { opacity: 1; } to { opacity: 0; } }
  .prow-go { position: relative; flex: 1; min-width: 0; padding: 10px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
  .prow-l1 { display: flex; align-items: center; gap: 8px; }
  .prow-l1 .dot { flex: none; margin: 0; width: 10px; height: 10px; }
  .prow-l1 b { font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .prow-go small { display: block; margin: 1px 0 6px 18px; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
  .prow-go:hover b { color: var(--accent); }
  .pstrip { display: flex; gap: 1px; height: 6px; margin-left: 18px; }
  .pstrip i { flex: 1; border-radius: 1px; background: var(--chip); }
  .pstrip i.hi { background: var(--hi); } .pstrip i.mid { background: var(--mid); } .pstrip i.lo { background: var(--lo); }
  .pstrip i.weak { background: var(--weak); } .pstrip i.night { background: var(--night); opacity: .4; }
  .pstrip i.cur { outline: 1.5px solid var(--text); position: relative; }
  .prow .fav { position: relative; margin-right: -8px; }
  .page-map .sheet { display: none; }
  /* The park's name and ✕ stay on top while the panel scrolls; a hairline shows once content slides under. */
  .panel-head { position: sticky; top: 0; z-index: 2; padding: 16px 56px 8px 16px; background: var(--surface);
    border-bottom: 1px solid transparent; transition: border-color .15s ease-out; }
  .panel-head.stuck { border-bottom-color: var(--line); }
  .panel-head .pp-head { padding: 0; }
  .panel-head .pp-name { font-size: 20px; line-height: 1.3; text-wrap: balance; }
  .panel-head .pp-sub { font-size: 14px; margin-top: 2px; }
  .panel-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; display: grid; place-items: center; border: 0;
    border-radius: 12px; background: none; color: var(--muted); cursor: pointer; }
  .panel-close svg { width: 18px; height: 18px; }
  .panel-close:hover { background: var(--chip); color: var(--text); }
  .panel-body { padding: 4px 16px 4px; }
  .panel-body .pp-pill { font-size: 13px; padding: 3px 10px; }
  .panel-body .pp-best, .panel-body .pp-alt { font-size: 14px; }
  .panel-body .pp-tile { min-height: 40px; font-size: 14px; }
  .panel-body .pp-btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
  .panel-near { margin: 6px 16px 18px; padding-top: 12px; border-top: 1px solid var(--line); }
  .panel-near[hidden] { display: none; }
  .panel-near-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 6px; }
  .panel-near-head h2 { margin: 0; font-size: .95rem; }
  .panel-near-head .link { font-size: .85rem; }
  .near-list { margin: 0; padding: 0; list-style: none; }
  .near-row { display: flex; align-items: center; gap: 4px; border-radius: 10px; transition: background-color .12s ease-out; }
  .near-row.on, .near-row:focus-within { background: var(--chip); }
  .near-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 6px; border: 0; background: none;
    color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 10px; }
  .near-main:focus-visible, .near-go:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  .near-ico { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--chip); color: var(--accent); }
  .near-row.on .near-ico, .near-row:focus-within .near-ico { background: var(--surface); }
  .near-ico .i { width: 16px; height: 16px; }
  .near-row.charge .near-ico { color: var(--chg-slow); } .near-row.charge.fast .near-ico { color: var(--chg-fast); }
  .near-txt { min-width: 0; display: grid; line-height: 1.35; }
  .near-txt b { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
  .near-txt small { font-size: 12px; color: var(--muted); }
  .near-go { flex: none; padding: 8px 10px; font-size: 13px; color: var(--accent); text-decoration: none; border-radius: 10px; }
  .near-go:hover { text-decoration: underline; }
  /* The pin that belongs to the hovered or focused row (and the other way round). */
  .near-mk .near-in { transition: transform .12s ease-out, background-color .12s ease-out, box-shadow .12s ease-out; }
  .near-mk.near-hl .near-in { transform: translate(-50%, -50%) scale(1.18); background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), 0 3px 8px rgba(0,0,0,.3); }
  .near-mk.near-hl .near-in .i { color: currentColor; }
}
@media (min-width: 601px) and (max-height: 520px) {
  .planning-tools { max-height: 65%; overflow-y: auto; overscroll-behavior: contain; }
  .panel-search .search-results { position: static; max-height: 140px; }
}
@media (min-width: 601px) and (max-width: 760px) {
  .timeline-toolbar .timebar input[type=range] { flex-basis: 100%; order: 1; }
}
/* Touch screens wider than a phone (tablets, touch laptops): every control in the panel is a 44px target. */
@media (min-width: 601px) and (pointer: coarse) {
  .near-go, .panel-body .pp-btn, .panel-near-head .link { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .near-main { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  .park-panel.opening .panel-in { animation: none; }
  .panel-head { transition: none; }
  .near-mk .near-in, .near-row { transition: none; }
}
@media (max-width: 600px) {
  /* Only the map page is an app screen; park, about and terms pages scroll normally. */
  body.page-map { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body.page-map header.top { position: fixed; top: 0; left: 0; right: 0; z-index: 1200; }
  body.page-map main { padding: 0; }
  /* Map page on phones: the header is just the name and an ⓘ to 資料與方法 (also in the sheet's footer). */
  body.page-map .nav-about .lbl { display: none; }
  body.page-map .nav-about { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -10px -10px -10px 0; color: var(--muted); }
  body.page-map .nav-about .i { display: inline-block; width: 22px; height: 22px; }
  #map { position: fixed; top: var(--head-h, 44px); left: 0; right: 0; bottom: 0;
    height: auto; min-height: 0; margin: 0; border: 0; border-radius: 0; }
  .leaflet-container:focus-visible { border-radius: 0; }

  body.page-map header.top { display: none; }
  body.page-map .leaflet-control-zoom { display: none; }
  .timeline-toolbar { position: fixed; z-index: 1100; inset: 0 0 auto; padding: calc(6px + env(safe-area-inset-top)) 12px 4px; }
  .controls { position: fixed; z-index: 1100; top: calc(var(--head-h, 0px) + 8px); left: 0; right: 0;
    padding: 0; gap: 0 6px; grid-template-columns: minmax(0, 1fr); align-items: start;
    border: 0; border-radius: 0; background: none; box-shadow: none; pointer-events: none; }
  .controls .chips { flex-wrap: nowrap; overflow-x: auto; padding: 2px 10px 8px; margin: 0; gap: 8px; scrollbar-width: none; }
  .controls .chips::-webkit-scrollbar { display: none; }
  /* The chips scroll sideways: fade the edge so a cut-off chip reads as "more this way", not broken. */
  .controls #chipsMain { padding-right: 28px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .controls .chip { pointer-events: auto; flex: none; min-height: 44px; padding: 0 12px; border-radius: 999px;
    background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.16); }
  .controls .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
  .controls .chips { pointer-events: auto; }

  /* Search field inside the sheet; while searching it stays put at the top of the full sheet. */
  .sheet-search .search { display: flex; align-items: center; gap: 4px; margin: 0 0 10px; }
  .search-ico { display: inline-flex; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
  .search-ico .i { width: 19px; height: 19px; }
  .sheet-search .search input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px 0 38px; border: 0; border-radius: 12px;
    background: color-mix(in srgb, var(--text) 9%, transparent); font-size: 16px; }
  .sheet-search .search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
  .search-cancel { flex: none; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
  .search-cancel[hidden] { display: none; }
  .search-results { top: calc(100% + 6px); max-height: calc(var(--vvh, 100dvh) - 120px); }
  .sheet.searching { top: calc(env(safe-area-inset-top) + 8px); }
  body.searching .controls, body.searching .timeline-toolbar { visibility: hidden; }  /* the full sheet covers the chips while searching */
  .sheet.searching .sheet-summary, .sheet.searching .sheet-key, .sheet.searching #weather { display: none; }

  /* Map buttons: bottom right, clear of the floating sheet. */
  #map .leaflet-bottom { bottom: calc(var(--tabbar-h) + var(--peek, 72px) + 16px + env(safe-area-inset-bottom)); }
  #map .leaflet-bottom.leaflet-right .map-ctl { margin-right: 12px; margin-bottom: 10px; }
  #map .map-ctl.leaflet-bar, #map .chg-btn { border: 1px solid var(--line); background: var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
  #map .chg-btn[aria-pressed="true"] { background: var(--chg-fast); border-color: var(--chg-fast); color: #fff; }  /* on: keep the orange, or the white bolt vanishes */
  #map .map-ctl .locate { width: 44px; height: 44px; background: none; color: var(--text); border-radius: 12px; }
  #map .map-ctl.leaflet-bar { border-radius: 14px; overflow: hidden; }
  .timeline-toolbar .timebar { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 0 8px; }
  .timebar .date-pick { display: inline-flex; position: relative; }
  .timebar .date-btn { display: inline-flex; align-items: center; }
  .timebar .date-pick input[type=date] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
    opacity: 0; font-size: 16px; cursor: pointer; -webkit-appearance: none; appearance: none; }
  .timebar .date-pick:focus-within .date-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
  .timeline-toolbar .timebar output { grid-area: 1 / 2; justify-self: start; text-align: left; font-size: 1.0625rem; min-width: 3em; }
  .timeline-toolbar .timebar #nowBtn { grid-area: 1 / 4; }
  .timeline-toolbar .timebar #playBtn { grid-area: 1 / 5; width: 44px; padding: 0; justify-content: center; }
  .timeline-toolbar .timebar input[type=range] { grid-area: 1 / 3; width: 100%; min-height: 44px; margin: 0; }
  .timeline-toolbar .timebar .chip { min-height: 44px; padding: 0 10px; white-space: nowrap; }

  /* Map controls clear the floating panel; the on-map key and empty note move into the sheet head. */
  #map .leaflet-top { top: calc(var(--ctl-h, 110px) + 8px); }  /* leaflet.css loads after this file */
  /* Below the floating controls, clear of the sheet's peek. */
  .map-start { top: calc(var(--ctl-h, 110px) + 16px); transform: translateX(-50%); }
  @keyframes start-in { from { opacity: 0; transform: translate(-50%, 8px); } }
  .start-skip { min-height: 44px; }
  .start-open #map .leaflet-control-container { visibility: hidden; }  /* the card spans the map's width */
  .map-key, .map-empty, .map-note { display: none; }  /* the sheet head says these */
  .map-night, .map-loading { top: calc(var(--ctl-h, 100px) + 6px); }  /* below the search pill and chips */

  /* The sheet */
  .sheet { position: fixed; z-index: 1050; left: 8px; right: 8px; bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom));
    top: calc(var(--head-h, 44px) + var(--ctl-h, 110px) + 14px);
    margin: 0; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: 0 8px 30px rgba(0,0,0,.22);
    overflow: hidden;
    display: flex; flex-direction: column; transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .2, 1);
    padding-bottom: 0; }
  .sheet.dragging { transition: none; }
  .sheet-head { display: block; padding: 0 14px 10px; touch-action: none; cursor: grab; flex: none; }
  /* A full-width strip, tall enough to hit without looking; the bar is only the visual cue. */
  .sheet-handle { display: block; width: calc(100% + 28px); height: 30px; margin: 0 -14px; padding: 0; border: 0; background: none; cursor: grab; position: relative; }
  .sheet-handle::before { content: ""; position: absolute; left: 50%; top: 11px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: color-mix(in srgb, var(--muted) 55%, transparent); }
  .sheet-summary { font-size: .95rem; line-height: 1.45; }
  .sheet-summary .link { font-size: inherit; }
  .sum-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .sum-acts .chip { min-height: 36px; padding: 0 12px; font-size: .875rem; }
  .sheet-key { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-top: 4px; font-size: .75rem; color: var(--muted); }
  .sheet-key .dot { margin: 0 2px 0 8px; } .sheet-key .dot:first-child { margin-left: 0; }
  .sheet-head .banner { margin-top: 6px; }
  .sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 16px; -webkit-overflow-scrolling: touch; }
  .sheet[data-state="peek"] .sheet-body { visibility: hidden; }
  .sheet.has-park .sheet-summary, .sheet.has-park .sheet-key, .sheet.has-park #weather, .sheet.has-park .sheet-search { display: none; }
  .sheet.has-park .sheet-head { padding-bottom: 0; }
  .sheet-park:not([hidden]) { display: block; position: relative; padding: 0 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
  /* The card's title row sits in the sheet head (where the search was), so it drags the sheet too. */
  .sheet-card-head:not([hidden]) { display: block; position: relative; margin: -4px 0 10px; }
  .sheet-card-head .pp-head { display: flex; align-items: flex-start; gap: 6px; padding-right: 44px; margin: 0; }
  .sheet-card-head .pp-name { font-size: 20px; font-weight: 700; line-height: 1.3; }
  .sheet-card-head .pp-sub { font-size: 14px; }
  .sheet-close { position: absolute; top: -6px; right: -10px; width: 44px; height: 44px; border: 0; color: var(--muted); font-size: 15px; cursor: pointer;
    background: radial-gradient(circle, color-mix(in srgb, var(--text) 10%, transparent) 15px, transparent 15.5px); }
  .chg-pill { display: inline-flex; align-items: center; gap: 4px; }
  .chg-pill svg { width: 15px; height: 15px; }
  .chg-pill.fast svg { color: var(--chg-fast); } .chg-pill.slow svg { color: var(--chg-slow); }
  .chg-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; font-size: 14px; }
  .chg-dl dt { color: var(--muted); } .chg-dl dd { margin: 0; overflow-wrap: anywhere; }
  .chg-none { font-size: 14px; margin: 12px 0; }
  .pp-src { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
  .sheet-park .pp-pill { font-size: 13px; padding: 3px 10px; }
  .sheet-park .pp-best, .sheet-park .pp-alt { font-size: 14px; }
  .sheet-park .pp-tile { min-height: 40px; font-size: 14px; }
  .sheet-park .pp-grid { margin-bottom: 12px; }
  .sheet-park .pp-btn { min-width: 44px; }
  .sheet-park:not([hidden]) { border-bottom: 0; }
  .sheet-park .pp-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
  .sheet-body .listbar { margin-top: 4px; }
  .sheet-body footer { padding: 16px 4px 8px; }
  .legend-box { margin-top: 0; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) { .sheet { transition: none; } }

/* ------------------------------------------------------------------ 已儲存
   Two tabs: 探索 and 已儲存. Phones: a tab bar under the bottom sheet, 已儲存 a page over the map.
   Wider screens: the tabs in the header, 已儲存 a panel beside the map (which then shows only the saved parks). */
.tabbar { display: none; }
:root { --push: .28s; --ease-out: cubic-bezier(.2, .8, .2, 1); }
@media (prefers-reduced-motion: reduce) { :root { --push: .01s; } .prow.flash::before { animation: none; } }
.nav-tabs { display: inline-flex; gap: 6px; align-self: stretch; margin-right: 8px; }
.nav-tab { border: 0; border-bottom: 2px solid transparent; background: none; padding: 0 10px; font: inherit; font-weight: 600; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px; margin-bottom: -13px; padding-bottom: 11px; }
.nav-tab:hover { color: var(--text); }
.nav-tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.nav-tab .on, .tab .on { display: none; }
.nav-tab[aria-current="page"] .on, .tab[aria-current="page"] .on { display: inline-block; }
.nav-tab[aria-current="page"] .off, .tab[aria-current="page"] .off { display: none; }

.saved { margin: 0; }
.saved-head { padding: 16px 16px 4px; }
.saved-head h2 { margin: 0; font-size: 1.15rem; }
.saved-sub { margin: 2px 0 0; font-size: .8125rem; color: var(--muted); }
.saved-sub:empty { display: none; }
.saved-list { list-style: none; margin: 8px 0 0; padding: 0 16px; }
.saved-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.saved-row:last-child { border-bottom: 0; }
.saved-row .mk-star { flex: none; }
.saved-grp { margin: 18px 16px 0; font-size: .8125rem; font-weight: 700; letter-spacing: .02em; color: var(--muted); }
.saved-grp span { font-weight: 400; font-variant-numeric: tabular-nums; }
.saved-grp.g-hi { color: var(--hi); }
.saved-grp + .saved-list { margin-top: 2px; }
.mk-star.v-lo, .mk-star.v-weak { opacity: .55; }
.saved-go .pstrip { display: flex; gap: 1px; height: 6px; margin: 7px 0 0; max-width: 260px; }
.saved-go .pstrip i { flex: 1; border-radius: 1px; background: var(--chip); }
.saved-go .pstrip i.hi { background: var(--hi); } .saved-go .pstrip i.mid { background: var(--mid); } .saved-go .pstrip i.lo { background: var(--lo); }
.saved-go .pstrip i.weak { background: var(--weak); } .saved-go .pstrip i.night { background: var(--night); opacity: .4; }
.saved-go .pstrip i.cur { outline: 1.5px solid var(--text); position: relative; }
.saved-go { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.saved-go b { display: block; font-weight: 600; line-height: 1.35; }
.saved-go small { display: block; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.saved-go:hover b { color: var(--accent); }
.saved-wait { padding: 0 16px; font-size: .85rem; }
.saved-empty { padding: 20px 16px; }
.saved-empty p { margin: 0 0 12px; max-width: 34ch; color: var(--muted); }
.saved-empty p b { display: block; color: var(--text); margin-bottom: 2px; }
.btn-primary { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.saved-body { padding-bottom: 16px; }
.saved:focus { outline: none; }
.saved:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* A saved park is a star on the map, in the colour of its verdict. */
.mk-star-wrap { background: none; border: 0; }
.mk-star { display: block; --c: var(--muted); color: var(--c); }
.mk-star.v-hi { --c: var(--hi); } .mk-star.v-mid { --c: var(--mid); } .mk-star.v-lo { --c: var(--lo); } .mk-star.v-weak { --c: var(--weak); }
.mk-star .i { width: 100%; height: 100%; vertical-align: top; stroke: #fff; stroke-width: 1.6px; paint-order: stroke; stroke-linejoin: round;
  filter: drop-shadow(0 1px 1.5px rgba(30, 40, 60, .4)); }

/* The note after a star is tapped. */
.fav-toast { position: fixed; left: 50%; bottom: 16px; z-index: 1400; width: min(420px, calc(100% - 24px)); display: flex; align-items: center; gap: 8px;
  padding: 8px 6px 8px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .18s ease-out, transform .18s cubic-bezier(.2, .8, .2, 1); }
.fav-toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.fav-toast span { flex: 1; font-size: .9rem; line-height: 1.4; }
.fav-toast button { min-height: 44px; padding: 0 12px; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .fav-toast { transition: none; } }

@media (min-width: 601px) {
  .saved { display: block; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .saved[hidden] { display: none; }
}
@media (max-width: 600px) {
  :root { --tabbar-h: 58px; }
  .nav-tabs { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1250; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  body.searching.typing .tabbar { display: none; }
  .tab { flex: 1; min-height: 44px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font: inherit; font-size: .75rem; font-weight: 600; color: var(--muted); cursor: pointer; }
  .tab .i { width: 1.5rem; height: 1.5rem; }
  .tab[aria-current="page"] { color: var(--accent); }
  .saved { position: fixed; z-index: 1200; top: 0; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); overflow-y: auto;
    overscroll-behavior: contain; background: var(--surface); padding-top: env(safe-area-inset-top); }
  .saved[hidden] { display: none; }
  .saved:focus-visible { outline: none; }
  body.page-map .fav-toast { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
  /* Tapping a park: its card eases up into the sheet; ✕ eases it out and the list comes back. */
  .sheet-park:not([hidden]), .sheet-card-head:not([hidden]), .sheet.list-in :is(.sheet-summary, .sheet-key, #list) {
    animation: park-in var(--push) var(--ease-out) both; }
  @keyframes park-in { from { opacity: 0; transform: translateY(14px); } }
  .sheet.park-out :is(.sheet-park, .sheet-card-head) { animation: park-out .17s ease-in both; }
  @keyframes park-out { to { opacity: 0; transform: translateY(10px); } }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .sheet-park:not([hidden]), .sheet-card-head:not([hidden]), .sheet.list-in :is(.sheet-summary, .sheet-key, #list), .sheet.park-out :is(.sheet-park, .sheet-card-head) { animation: none; }
}

/* Nothing in view matches: the sort controls have nothing to sort. */
body.list-empty :is(.listbar, #sortNote, .plist-head, #pnote, .sheet-key, #weather) { display: none; }
.empty .sum-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
