#mapsApp, #mapsFilterDlg, #mapsSettingsDlg {
  --blue: #007AFF; --fill: #F2F2F7; --fill2: #E5E5EA; --label: #000; --label2: rgba(60,60,67,.6); --sep: rgba(60,60,67,.18);
  --green: #248A3D; --orange: #C93400; --sheet: rgba(250,250,252,.78); --grp: #fff; --sh: 0 2px 10px rgba(0,0,0,.18);
  --gfill: rgba(118,118,128,.14);
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Helvetica Neue", Arial, sans-serif;
  color: var(--label); -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  #mapsApp { --fill: #2C2C2E; --fill2: #3A3A3C; --label: #fff; --label2: rgba(235,235,245,.6); --sep: rgba(84,84,88,.5); --sheet: rgba(28,28,30,.78); --grp: #2C2C2E; --blue: #0A84FF; --green: #32D74B; --orange: #FF9F0A; --gfill: rgba(118,118,128,.24); }
}
#mapsApp { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: #dfe3e6; }
@media (prefers-color-scheme: dark) { #mapsApp { background: #1c1c1e; } }
#mapsApp[hidden] { display: none; }
#mapsApp *, #mapsFilterDlg *, #mapsSettingsDlg * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
#mapsApp button, #mapsFilterDlg button, #mapsSettingsDlg button { font: inherit; cursor: pointer; }
#mapsApp :focus-visible, #mapsFilterDlg :focus-visible, #mapsSettingsDlg :focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#mapsApp .mp-i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.14em; }
#mapsApp .wx { width: 1em; height: 1em; flex: none; }
#mapsApp .mp-app { position: relative; height: 100%; max-width: 430px; margin: 0 auto; overflow: hidden; }
#mapsApp .mp-map { position: absolute; inset: 0; background: #e8eaed; }
#mapsApp #map { height: 100%; width: 100%; }
#mapsApp .leaflet-tile-pane { filter: saturate(.35) contrast(.92) brightness(1.04); }
#mapsApp .leaflet-container { font: inherit; }
#mapsApp .leaflet-control-zoom { display: none; }
#mapsApp .leaflet-control-attribution { font-size: 9px; background: rgba(255,255,255,.6) !important; }

/* chip and floating buttons */
#mapsApp .mp-chip { position: absolute; z-index: 500; top: 12px; left: 12px; display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px 0 10px; border-radius: 19px; background: var(--sheet); backdrop-filter: blur(20px) saturate(1.8); -webkit-backdrop-filter: blur(20px) saturate(1.8); box-shadow: var(--sh); font-weight: 600; font-size: 15px; }
#mapsApp .mp-chip[hidden] { display: none; }
#mapsApp .mp-chip .wx { font-size: 20px; color: #FF9500; }
#mapsApp .mp-chip small { font-weight: 400; color: var(--label2); font-size: 12px; }
#mapsApp .mp-fab { position: absolute; z-index: 500; top: 12px; right: 12px; display: flex; flex-direction: column; width: 44px; border-radius: 12px; background: var(--sheet); backdrop-filter: blur(20px) saturate(1.8); -webkit-backdrop-filter: blur(20px) saturate(1.8); box-shadow: var(--sh); overflow: hidden; }
#mapsApp .mp-fab button { height: 44px; display: grid; place-items: center; font-size: 21px; color: var(--label); border: 0; background: none; padding: 0; }
#mapsApp .mp-fab button + button { border-top: .5px solid var(--sep); }
#mapsApp .mp-fab button[aria-pressed=true] { color: #FF9500; }
#mapsApp .mp-fab button[aria-pressed=true] .mp-i { fill: currentColor; }

/* sheet */
#mapsApp .mp-sheet { position: absolute; left: 0; right: 0; top: 0; height: 100%; z-index: 600; display: flex; flex-direction: column; border-radius: 12px 12px 0 0; background: var(--sheet); backdrop-filter: blur(28px) saturate(1.8); -webkit-backdrop-filter: blur(28px) saturate(1.8); box-shadow: 0 -1px 0 var(--sep), 0 -6px 30px rgba(0,0,0,.16); will-change: transform; transition: transform .5s cubic-bezier(.32,.72,0,1); touch-action: none; transform: translateY(60%); }
#mapsApp .mp-sheet.drag { transition: none; }
@media (prefers-reduced-motion: reduce) { #mapsApp .mp-sheet { transition: none; } #mapsApp .mp-pin { transition: none; } }
#mapsApp .mp-grab { flex: none; height: 22px; width: 100%; display: grid; place-items: center; cursor: grab; border: 0; background: none; padding: 0; }
#mapsApp .mp-grab i { width: 36px; height: 5px; border-radius: 3px; background: rgba(60,60,67,.3); }
#mapsApp .mp-head { flex: none; padding: 0 16px 8px; }
#mapsApp .mp-srow { display: flex; gap: 10px; align-items: center; }
#mapsApp .mp-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 12px; background: var(--gfill); color: var(--label2); }
#mapsApp .mp-sic { font-size: 17px; display: grid; }
#mapsApp .mp-search .search-wrap { flex: 1; min-width: 0; max-width: none; width: auto; margin: 0; padding: 0; background: none; border: 0; }
#mapsApp .mp-search input { width: 100%; height: 38px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; outline: 0; font: 17px -apple-system, BlinkMacSystemFont, system-ui, sans-serif; color: var(--label); touch-action: auto; }
#mapsApp .mp-search input::placeholder { color: var(--label2); }
#mapsApp .mp-search:focus-within { outline: 2px solid var(--blue); }
#mapsApp .mp-round { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--gfill); border: 0; padding: 0; display: grid; place-items: center; font-size: 21px; color: var(--label2); }
#mapsApp .mp-round svg { width: 1em; height: 1em; }
#mapsApp .mp-body { flex: 1; min-height: 0; overflow: hidden; padding: 0 16px 70px; touch-action: pan-y; }
#mapsApp .mp-sheet.full .mp-head { box-shadow: 0 .5px 0 var(--sep); }
#mapsApp .mp-sheet.full .mp-body { overflow-y: auto; overscroll-behavior: contain; }
#mapsApp .mp-sec { font-size: 20px; font-weight: 700; margin: 14px 0 8px; letter-spacing: -.2px; display: flex; justify-content: space-between; align-items: baseline; }
#mapsApp .mp-sec small { font-size: 13px; font-weight: 400; color: var(--label2); }
#mapsApp .mp-note { margin: 8px 0 0; font-size: 13px; color: var(--label2); display: flex; gap: 6px; align-items: flex-start; }
#mapsApp .mp-note.warn { color: var(--orange); }
#mapsApp .mp-sug, #mapsApp .mp-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 0; color: inherit; }
#mapsApp .mp-sug { border-radius: 12px; background: var(--grp); }
#mapsApp .mp-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--blue); font-size: 18px; }
#mapsApp .mp-ico.g { background: #8E8E93; }
#mapsApp .mp-tx { flex: 1; min-width: 0; }
#mapsApp .mp-tx b { display: block; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mapsApp .mp-tx span { display: block; font-size: 13px; color: var(--label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mapsApp .mp-more { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; color: var(--label2); font-size: 16px; }
/* day cells: same content as the other themes (weekday and number, sky and temperature, best score), full width */
#mapsApp .mp-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin: 6px 0 2px; }
#mapsApp .mp-day { min-width: 0; display: grid; justify-items: center; gap: 2px; padding: 6px 2px 5px; border: 0; border-radius: 12px; background: var(--grp); color: var(--label); line-height: 1.15; }
#mapsApp .mp-day .d { font-size: 12px; font-weight: 600; color: var(--label2); white-space: nowrap; }
#mapsApp .mp-day b { display: inline-flex; align-items: center; gap: 3px; font-size: 16px; font-weight: 700; }
#mapsApp .mp-day .wx { width: 16px; height: 16px; flex: none; color: #FF9500; }
#mapsApp .mp-day i { font-style: normal; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
#mapsApp .mp-day[aria-pressed=true] { background: var(--blue); color: #fff; }
#mapsApp .mp-day[aria-pressed=true] .d { color: #ffffffcc; }
#mapsApp .mp-day[aria-pressed=true] .wx { color: #fff; }
#mapsApp .mp-day[aria-pressed=true] i { color: #fff !important; }
#mapsApp .mp-grp { background: var(--grp); border-radius: 12px; overflow: hidden; }
#mapsApp .mp-row { background: none; padding: 9px 14px 9px 12px; position: relative; }
#mapsApp .mp-row + .mp-row::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; border-top: .5px solid var(--sep); }
#mapsApp .mp-row .mp-ico { width: 32px; height: 32px; font-size: 16px; }
#mapsApp .mp-row > .mp-i { color: rgba(60,60,67,.3); font-size: 13px; }
#mapsApp .mp-sc { flex: none; font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--label2); }
#mapsApp .mp-empty { padding: 18px; text-align: center; color: var(--label2); margin: 0; }

/* place card */
#mapsApp .mp-card { display: none; }
#mapsApp .mp-sheet.place .mp-card { display: block; }
#mapsApp .mp-sheet.place .mp-head, #mapsApp .mp-sheet.place #mpList { display: none; }
#mapsApp .mp-backb { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; padding: 0; color: var(--blue); font-size: 15px; margin-bottom: 4px; }

/* crag page, Topo style on the iOS palette */
#mapsApp .mp-card { --sun: #FF9500; padding-bottom: 8px; }
#mapsApp .mp-ph { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 2px; }
#mapsApp .mp-ph h1 { margin: 0; flex: 1; min-width: 0; font-size: 26px; line-height: 1.1; font-weight: 700; letter-spacing: -.4px; overflow-wrap: break-word; }
#mapsApp .mp-hr { display: flex; align-items: center; gap: 10px; flex: none; }
#mapsApp .mp-sc2 { font-weight: 700; font-size: 20px; line-height: 1; color: var(--label2); }
#mapsApp .mp-sc2 small { font-weight: 500; font-size: 11px; }
#mapsApp .mp-star { width: 40px; height: 40px; display: grid; place-items: center; font-size: 19px; background: var(--grp); color: var(--label); border: 0; border-radius: 12px; padding: 0; }
#mapsApp .mp-star[aria-pressed=true] { color: var(--sun); }
#mapsApp .mp-star[aria-pressed=true] .mp-i { fill: currentColor; }
#mapsApp .mp-lede { margin: 8px 0 0; font-weight: 600; font-size: 16px; }
#mapsApp .mp-factline { margin: 2px 0 0; color: var(--label2); font-size: 14.5px; }
#mapsApp .mp-h3 { margin: 22px 0 6px; padding-top: 12px; border-top: .5px solid var(--sep); font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
#mapsApp .mp-h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--label2); }
#mapsApp .mp-blk + .mp-blk { margin-top: 18px; padding-top: 12px; border-top: .5px solid var(--sep); }
#mapsApp .mp-wall { overflow-x: auto; max-width: 560px; }
#mapsApp .mp-wall svg { width: 100%; height: auto; display: block; }
#mapsApp .wl-sun { fill: var(--sun); } #mapsApp .wl-route { stroke: var(--blue); } #mapsApp .wl-ink { fill: var(--label); }
#mapsApp .wl-mute { fill: var(--label2); } #mapsApp .wl-rain { fill: var(--blue); }
#mapsApp .wl-on { fill: var(--sun); stroke: var(--label); } #mapsApp .wl-off { fill: var(--grp); stroke: var(--label2); }
#mapsApp .mp-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--label2); margin: 2px 0 0; }
#mapsApp .mp-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -2px; margin-right: 6px; border: 2px solid var(--label); }
#mapsApp .mp-legend .s { background: var(--sun); } #mapsApp .mp-legend .h { background: var(--grp); border-color: var(--label2); }
#mapsApp .mp-rows { display: grid; grid-template-columns: minmax(96px, auto) 1fr; margin: 0; font-size: 15px; }
#mapsApp .mp-rows dt, #mapsApp .mp-rows dd { margin: 0; padding: 8px 0; border-bottom: .5px solid var(--sep); }
#mapsApp .mp-rows dt { color: var(--label2); padding-right: 14px; }
#mapsApp .mp-rows dd { font-weight: 600; overflow-wrap: anywhere; }
#mapsApp .mp-rows a, #mapsApp .mp-card a:not(.p) { color: var(--blue); text-underline-offset: 3px; }
#mapsApp :is(.mp-blk, .mp-fold) > .mp-rows:last-child dt:nth-last-child(2), #mapsApp :is(.mp-blk, .mp-fold) > .mp-rows:last-child dd:last-child, #mapsApp .mp-notes li:last-child { border-bottom: 0; }
#mapsApp .mp-notes { list-style: none; margin: 0; padding: 0; font-size: 15px; }
#mapsApp .mp-notes li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: .5px solid var(--sep); color: var(--orange); font-weight: 600; }
#mapsApp .mp-notes .mp-i { font-size: 18px; }
#mapsApp .mp-cap { margin: 8px 0 0; font-size: 13.5px; color: var(--label2); }
#mapsApp .mp-mod { display: grid; grid-template-columns: 104px 1fr 56px; gap: 10px; align-items: center; font-size: 14px; padding: 5px 0; }
#mapsApp .mp-mod em { font-style: normal; color: var(--label2); text-align: right; font-size: 13px; }
#mapsApp .mp-trk { position: relative; display: block; height: 10px; border-bottom: .5px solid var(--sep); }
#mapsApp .mp-trk .rg { position: absolute; top: 1px; height: 8px; border-radius: 4px; background: var(--label2); opacity: .4; }
#mapsApp .mp-trk .av { position: absolute; top: -2px; width: 3px; height: 14px; border-radius: 2px; background: var(--label); }
#mapsApp .mp-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--label2); margin: 0 66px 0 114px; }
#mapsApp .mp-fold { margin-top: 22px; border-top: .5px solid var(--sep); padding-top: 2px; }
#mapsApp .mp-fold summary { cursor: pointer; padding: 12px 0; font-size: 20px; font-weight: 700; letter-spacing: -.2px; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#mapsApp .mp-fold summary::-webkit-details-marker { display: none; }
#mapsApp .mp-fold summary::after { content: "+"; font-size: 24px; font-weight: 400; color: var(--label2); }
#mapsApp .mp-fold[open] summary::after { content: "\2212"; }
#mapsApp .mp-sbar { display: flex; height: 16px; border-radius: 4px; background: var(--fill2); margin: 4px 0 12px; overflow: hidden; }
#mapsApp .mp-sbar i { display: block; height: 100%; }
#mapsApp .mp-sbar i + i { border-left: 2px solid var(--sheet); }
#mapsApp .mp-key { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; font-size: 15px; }
#mapsApp .mp-key li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
#mapsApp .mp-key em { width: 12px; height: 12px; border-radius: 3px; display: block; }
#mapsApp .mp-key b { font-weight: 600; } #mapsApp .mp-key small { font-weight: 400; color: var(--label2); font-size: 13px; }
#mapsApp .mp-nav { display: flex; flex-wrap: wrap; gap: 8px; }
#mapsApp .mp-nav a, #mapsApp .mp-nav button { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--grp); color: var(--blue); font-weight: 600; font-size: 15px; text-decoration: none; }
#mapsApp .mp-nav a.p { background: var(--blue); color: #fff; }

/* pins */
#mapsApp .mp-pin { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; font: 600 13px -apple-system, BlinkMacSystemFont, system-ui, sans-serif; box-shadow: 0 1px 5px rgba(0,0,0,.35); border: 1.5px solid #fff; transition: transform .2s; }
#mapsApp .mp-pin.sel { background: var(--blue); color: #fff; transform: scale(1.25); }

/* ===== dialogs: iOS Settings / Apple Maps sheet (inset grouped lists) ===== */
#mapsFilterDlg, #mapsSettingsDlg {
  --bg: #F2F2F7; --g: #fff; --ink: #000; --l2: rgba(60,60,67,.62); --hair: rgba(60,60,67,.29); --fl: rgba(118,118,128,.14); --blue: #007AFF;
  --hl: linear-gradient(var(--hair), var(--hair)) 16px 0 / calc(100% - 16px) .5px no-repeat, var(--g);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14' fill='none' stroke='%23b0b0b6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 1.5l5 5.5-5 5.5'/%3E%3C/svg%3E");
  --ud: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='16' viewBox='0 0 10 16' fill='none' stroke='%23a0a0a8' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6l3-3 3 3M2 10l3 3 3-3'/%3E%3C/svg%3E");
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: min(430px, 100vw); max-width: 100vw; height: auto; max-height: 92dvh;
  padding: 0; border: 0; border-radius: 12px 12px 0 0; background: var(--bg); color: var(--ink); overflow: hidden;
  font: 17px/1.25 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Helvetica Neue", Arial, sans-serif;
  box-shadow: 0 -8px 40px rgba(0,0,0,.25);
}
#mapsFilterDlg[open], #mapsSettingsDlg[open] { display: flex; flex-direction: column; animation: mp-up .4s cubic-bezier(.32,.72,0,1); }
#mapsFilterDlg::backdrop, #mapsSettingsDlg::backdrop { background: rgba(0,0,0,.3); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: mp-fade .3s; }
@keyframes mp-up { from { transform: translateY(100%); } }
@keyframes mp-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #mapsFilterDlg[open], #mapsSettingsDlg[open], #mapsFilterDlg::backdrop, #mapsSettingsDlg::backdrop { animation: none; } #mapsFilterDlg .chip input, #mapsFilterDlg .chip input::after { transition: none; } }
#mapsApp .st-moved, #mapsFilterDlg .st-moved { display: none; }
#mapsFilterDlg :focus-visible, #mapsSettingsDlg :focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

/* nav bar: grabber, centred bold title, blue bold Done */
#mapsFilterDlg .mp-dhead, #mapsSettingsDlg .mp-dhead { flex: none; position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 58px; padding: 16px 6px 4px 16px; background: rgba(242,242,247,.92); border-bottom: .5px solid var(--hair); }
#mapsFilterDlg .mp-dhead::before, #mapsSettingsDlg .mp-dhead::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: rgba(60,60,67,.3); }
#mapsFilterDlg .mp-dhead h2, #mapsSettingsDlg .mp-dhead h2 { grid-column: 2; margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
#mpFClose, #mpSClose { grid-column: 3; justify-self: end; min-height: 44px; padding: 0 12px; background: none; border: 0; border-radius: 8px; color: var(--blue); font-size: 17px; font-weight: 700; }
#mapsFilterDlg .mp-dbody, #mapsSettingsDlg .mp-dbody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(28px + env(safe-area-inset-bottom)); }
#mapsFilterDlg .mp-dbody { display: flex; flex-direction: column; }
#mapsFilterDlg .mp-dbody::before { content: var(--t-trip); margin: 12px 16px 6px; font-size: 13px; color: var(--l2); }

/* group headers */
#mapsFilterDlg .fgroup__title, #mapsSettingsDlg .st-h { margin: 0 16px 6px; font-size: 13px; font-weight: 400; color: var(--l2); text-transform: none; letter-spacing: 0; }

/* Filters: date and drive rows (inline expanding popovers) */
#mapsFilterDlg .filter-grid { display: contents; }
#mapsFilterDlg .fgroup { display: block; margin-top: 24px; }
#mapsFilterDlg .popover-anchor { position: relative; overflow: hidden; background: var(--g); }
#mapsFilterDlg .popover-anchor:nth-child(1) { border-radius: 12px 12px 0 0; }
#mapsFilterDlg .popover-anchor:nth-child(2) { border-radius: 0 0 12px 12px; }
#mapsFilterDlg .popover-anchor > .ctrl-pill { width: 100%; min-height: 48px; padding: 0 16px; gap: 12px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 17px; font-weight: 400; text-align: left; }
#mapsFilterDlg #driveTrigger { background: linear-gradient(var(--hair), var(--hair)) 57px 0 / calc(100% - 57px) .5px no-repeat; }
#mapsFilterDlg .ctrl-pill .ic { order: 0; flex: none; box-sizing: content-box; width: 17px; height: 17px; padding: 6px; border-radius: 7px; color: #fff; background: #FF3B30; }
#mapsFilterDlg #driveTrigger .ic { background: #FF9500; }
#mapsFilterDlg .ctrl-pill::before { order: 1; }
#mapsFilterDlg #dateTrigger::before { content: var(--t-date); }
#mapsFilterDlg #driveTrigger::before { content: var(--t-drive); }
#mapsFilterDlg .ctrl-pill > span { order: 2; margin-left: auto; color: var(--l2); font-size: 17px; display: inline-block; white-space: nowrap; }
#mapsFilterDlg #dateTriggerLabel::first-letter { text-transform: uppercase; }
#mapsFilterDlg .popover-anchor > .ctrl-pill::after { content: ""; order: 3; flex: none; width: 8px; height: 14px; background: var(--chev) center / contain no-repeat; transition: transform .2s; }
#mapsFilterDlg .popover-anchor > .ctrl-pill:has(+ .popover:not(.hidden))::after { transform: rotate(90deg); }
#mapsFilterDlg .popover { position: static; width: auto; top: auto; right: auto; background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 4px 16px 16px; color: var(--ink); }
#mapsFilterDlg .popover.hidden { display: none; }
#mapsFilterDlg .popover--drive { display: flex; flex-direction: column; gap: 12px; }
#mapsFilterDlg .pop-title-row { display: flex; justify-content: space-between; align-items: center; font-size: 17px; color: var(--ink); }
#mapsFilterDlg .pop-title-row strong { color: var(--l2); font-weight: 400; }
#mapsFilterDlg :is(.preset-btn, .cal-quick-btn) { min-height: 38px; border: 0; border-radius: 10px; background: var(--fl); color: var(--blue); font-size: 15px; font-weight: 600; }
#mapsFilterDlg :is(.preset-btn, .cal-quick-btn):hover { background: rgba(118,118,128,.22); color: var(--blue); }
#mapsFilterDlg .preset-btn.active { background: var(--blue); color: #fff; }
#mapsFilterDlg .preset-row { gap: 6px; }
#mapsFilterDlg .cal-quick { gap: 6px; margin-bottom: 10px; }
#mapsFilterDlg .cal-month { font-size: 17px; font-weight: 600; text-transform: capitalize; color: var(--ink); }
#mapsFilterDlg .cal-nav { width: 40px; height: 40px; border: 0; background: none; color: var(--blue); font-size: 28px; line-height: 1; padding: 0; }
#mapsFilterDlg .cal-weekdays span { font-size: 12px; color: var(--l2); }
#mapsFilterDlg .cal-day { width: 38px; height: 38px; margin: 0 auto; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 17px; }
#mapsFilterDlg .cal-day:hover:not(:disabled) { background: var(--fl); border-color: transparent; }
#mapsFilterDlg .cal-day.today { color: var(--blue); font-weight: 600; }
#mapsFilterDlg .cal-day.selected, #mapsFilterDlg .cal-day.selected:hover:not(:disabled) { background: var(--blue); color: #fff; }

/* sliders */
#mapsFilterDlg input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; padding: 0; background: transparent; border: 0; }
#mapsFilterDlg input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--blue) var(--p, 50%), rgba(120,120,128,.28) var(--p, 50%)); }
#mapsFilterDlg input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 5px rgba(0,0,0,.35), 0 0 0 .5px rgba(0,0,0,.08); }
#mapsFilterDlg input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(120,120,128,.28); }
#mapsFilterDlg input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--blue); }
#mapsFilterDlg input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 5px rgba(0,0,0,.35); }

/* select rows: label left, blue value right with a chevron; the whole row is the tap target */
#mapsFilterDlg .field-row { display: flex; flex-direction: column; gap: 0; background: var(--g); border-radius: 12px; overflow: hidden; }
#mapsFilterDlg .field-row > .field { position: relative; flex-direction: row; align-items: center; gap: 0; min-height: 46px; padding: 0 16px; }
#mapsFilterDlg .field-row > .field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--hair); }
#mapsFilterDlg .field label { font-size: 17px; font-weight: 400; color: var(--ink); }
#mapsFilterDlg .field-row select, #mapsSettingsDlg .st-pick select, #mapsSettingsDlg .st-lang {
  -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0 38px 0 16px; border: 0; border-radius: 0;
  background: transparent var(--ud) right 14px center / 10px 16px no-repeat; color: var(--blue); font-size: 17px; font-family: inherit; text-align: right; text-align-last: right; cursor: pointer;
}
#mapsFilterDlg .field-row select option { text-align: left; color: #000; }

/* temperature row + segmented control */
#mapsFilterDlg .fgroup > .field { gap: 6px; padding: 12px 16px 8px; background: var(--g); border-radius: 12px; }
#mapsFilterDlg #sunPrefGroup { position: relative; margin-top: 38px; padding: 2px; gap: 0; border: 0; border-radius: 9px; background: rgba(118,118,128,.2); }
#mapsFilterDlg #sunPrefGroup::before { content: var(--t-sunpref); position: absolute; top: -24px; left: 16px; font-size: 13px; color: var(--l2); }
#mapsFilterDlg .seg-btn { min-height: 34px; padding: 0 6px; border-radius: 7px; background: transparent; color: var(--ink); font-size: 15px; font-weight: 500; }
#mapsFilterDlg .seg-btn.active { background: #fff; color: #000; font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }

/* style chips as toggle rows */
#mapsFilterDlg .chips { display: flex; flex-direction: column; gap: 0; background: var(--g); border-radius: 12px; overflow: hidden; }
#mapsFilterDlg .chip { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-size: 17px; }
#mapsFilterDlg .chip + .chip::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--hair); }
#mapsFilterDlg .chip span { order: 1; }
#mapsFilterDlg .chip input { order: 2; -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 51px; height: 31px; margin: 0; border-radius: 16px; background: rgba(120,120,128,.32); cursor: pointer; transition: background .2s; }
#mapsFilterDlg .chip input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.25); transition: transform .2s; }
#mapsFilterDlg .chip input:checked { background: #34C759; }
#mapsFilterDlg .chip input:checked::after { transform: translateX(20px); }
#mapsFilterDlg .chip input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#mapsFilterDlg .chips + .field-row { margin-top: 16px; }

/* refresh */
#mapsFilterDlg #btnRefresh { display: block; width: 100%; min-height: 48px; margin-top: 24px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--g); color: var(--blue); font-size: 17px; font-weight: 400; }
#mapsFilterDlg #btnRefresh:active { background: #e5e5ea; }

/* Settings */
#mapsSettingsDlg .st { display: flex; flex-direction: column; }
#mapsSettingsDlg .st-sec { display: flex; flex-direction: column; position: relative; margin-top: 24px; padding: 0; }
#mapsSettingsDlg .st-sec:first-child { margin-top: 8px; }
#mapsSettingsDlg .st-h { order: 0; }
#mapsSettingsDlg .st-now { order: 1; margin: 0; padding: 12px 16px; background: var(--g); border-radius: 12px 12px 0 0; font-size: 17px; }
#mapsSettingsDlg .st-geo { order: 2; display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 12px; background: var(--hl); }
#mapsSettingsDlg .st-q { flex: 1; min-width: 0; height: 36px; padding: 0 10px 0 32px; border: 0; border-radius: 10px; background: var(--fl) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8a8e' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") 9px center / 16px no-repeat; color: var(--ink); font: inherit; font-size: 17px; -webkit-appearance: none; appearance: none; }
#mapsSettingsDlg .st-q::placeholder { color: var(--l2); }
#mapsSettingsDlg .st-geo .st-btn { flex: none; min-height: 44px; padding: 0 12px; background: none; border: 0; color: var(--blue); font-size: 17px; font-weight: 600; }
#mapsSettingsDlg .st-res { order: 3; list-style: none; margin: 0; padding: 0; }
#mapsSettingsDlg .st-res li { background: var(--hl); }
#mapsSettingsDlg .st-res button { display: block; width: 100%; padding: 11px 16px; border: 0; background: none; color: var(--ink); text-align: left; font-size: 15px; }
#mapsSettingsDlg .st-res button:active { background: #e5e5ea; }
#mapsSettingsDlg .st-sec > [data-st=gps] { order: 4; min-height: 48px; padding: 0 16px; border: 0; border-radius: 0 0 12px 12px; background: var(--hl); color: var(--blue); font-size: 17px; font-weight: 400; text-align: left; }
#mapsSettingsDlg .st-cap { order: 5; margin: 6px 16px 0; font-size: 13px; color: var(--l2); }
#mapsSettingsDlg .st-cap:empty { display: none; }
#mapsSettingsDlg .st-row { display: block; background: var(--g); border-radius: 12px; overflow: hidden; }
#mapsSettingsDlg .st-row .st-btn { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 16px; border: 0; border-radius: 0; background: none; color: var(--ink); font-size: 17px; font-weight: 400; text-align: left; }
#mapsSettingsDlg .st-row .st-btn::after { content: ""; flex: none; width: 8px; height: 14px; background: var(--chev) center / contain no-repeat; }
#mapsSettingsDlg .st-row .st-btn:active { background: #e5e5ea; }
#mapsSettingsDlg .st-sec:is([data-st-sec="theme"], [data-st-sec="lang"]) { background: var(--g); min-height: 46px; }
#mapsSettingsDlg .st-sec[data-st-sec="theme"] { border-radius: 12px 12px 0 0; }
#mapsSettingsDlg .st-sec[data-st-sec="lang"] { margin-top: 0; border-radius: 0 0 12px 12px; background: var(--hl); }
#mapsSettingsDlg .st-sec:is([data-st-sec="theme"], [data-st-sec="lang"]) .st-h { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#mapsSettingsDlg .st-sec:is([data-st-sec="theme"], [data-st-sec="lang"])::before { position: absolute; z-index: 1; left: 16px; top: 0; line-height: 46px; font-size: 17px; pointer-events: none; }
#mapsSettingsDlg .st-sec[data-st-sec="theme"]::before { content: var(--t-theme); }
#mapsSettingsDlg .st-sec[data-st-sec="lang"]::before { content: var(--t-lang); }
#mapsSettingsDlg .st-pick { height: 46px; }
#mapsFilterDlg .mp-dbody > * { flex: none; }
#mapsFilterDlg .fgroup.st-moved { display: none; }
#mapsSettingsDlg .st-q { font-size: 16px; padding-right: 6px; }
#mapsSettingsDlg .st-q::placeholder { font-size: 14.5px; }

/* desktop: Apple Maps for Mac style, a floating panel on the left and the map on the rest */
@media (min-width: 860px) {
  #mapsApp .mp-app { max-width: none; }
  #mapsApp .mp-sheet { left: 12px; right: auto; top: 12px; bottom: 12px; width: 396px; height: auto !important; transform: none !important; border-radius: 12px; box-shadow: 0 6px 28px rgba(0,0,0,.22); }
  #mapsApp .mp-grab { display: none; }
  #mapsApp .mp-head { padding-top: 14px; }
  #mapsApp .mp-body { overflow-y: auto; overscroll-behavior: contain; padding-bottom: 24px; touch-action: auto; }
  #mapsApp .mp-sheet .mp-head { box-shadow: 0 .5px 0 var(--sep); }
  #mapsApp .mp-sheet.place .mp-body { padding-top: 14px; }
  #mapsApp .mp-chip { left: 432px; }
  #mapsApp .leaflet-control-zoom { display: block; margin: 0 12px 28px 0; border: 0; border-radius: 12px; overflow: hidden; box-shadow: var(--sh); }
  #mapsApp .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; font-size: 22px; background: var(--sheet); color: var(--label); border: 0; backdrop-filter: blur(20px) saturate(1.8); }
  #mapsApp .leaflet-control-zoom a + a { border-top: .5px solid var(--sep); }
}

/* desktop: Filters and Settings are centred cards that fade in, not sheets rising from the bottom */
@media (min-width: 860px) {
  #mapsFilterDlg, #mapsSettingsDlg { inset: 0; margin: auto; width: min(480px, 92vw); max-height: min(760px, 88dvh); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
  #mapsFilterDlg[open], #mapsSettingsDlg[open] { animation: mp-pop .18s ease-out; }
  #mapsFilterDlg .mp-dhead::before, #mapsSettingsDlg .mp-dhead::before { display: none; }
}
@keyframes mp-pop { from { opacity: 0; transform: scale(.97); } }
