/* Layout: Apple Weather pattern. Full-screen pages swiped sideways, each with
   its own sky tinted by the DOE API band (blue, green, yellow, orange, red),
   darker at night. Translucent cards, floating bottom bar, locations list,
   full-screen map. Performance: blur only on floating chrome; views move with
   transform/opacity so the GPU composites them. */
:root {
  color-scheme: dark;
  --ink: #ffffff;
  --ink-2: rgba(255, 255, 255, 0.8);
  --ink-3: rgba(255, 255, 255, 0.55);
  --glass: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(40, 46, 58, 0.55);
  --glass-line: rgba(255, 255, 255, 0.14);
  --sep: rgba(255, 255, 255, 0.15);
  --list-bg: #0d1118;
  --sheet: rgba(28, 31, 38, 0.92);

  /* Official Malaysian API band colours */
  --good: #3a8bea;
  --moderate: #3fb560;
  --unhealthy: #f2c230;
  --very: #f08a24;
  --hazard: #e5443a;

  --run-go: #4cd07a;
  --run-care: #f5c542;
  --run-stop: #ff6b5e;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
  --radius: 22px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
/* Text sizes are in rem; app.js sets this from the iPhone's Text Size setting */
html { font-size: 17px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html { background: var(--list-bg); }
/* iOS 26 Home Screen apps (WebKit bug 301108): with the see-through status
   bar, the screen area comes up short by the status bar's height unless the
   page is at least as tall as the screen. Make the root one status bar
   taller (capped at the large viewport) so iOS gives the app the full screen.
   body's overflow: hidden stops this from scrolling. */
@media (display-mode: standalone) {
  html { min-height: min(100lvh, calc(100% + env(safe-area-inset-top, 0px))); }
}
/* One container for the whole app. */
.app { position: fixed; inset: 0; overflow: hidden; }
body {
  font: 0.8824rem/1.4 var(--font);
  color: var(--ink);
  background: var(--list-bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Sky per band ---------- */
.sky-good      { --sky-a: #4d8fdc; --sky-b: #1e4c8c; }
.sky-moderate  { --sky-a: #5b9a86; --sky-b: #22544b; }
.sky-unhealthy { --sky-a: #8a7a4c; --sky-b: #46402a; }
.sky-very      { --sky-a: #9a6a44; --sky-b: #4a2f22; }
.sky-hazard    { --sky-a: #8c4640; --sky-b: #3a1b1a; }
.sky-none      { --sky-a: #4f5c6e; --sky-b: #222a36; }
.sky-purple    { --sky-a: #74508a; --sky-b: #331f3f; }
.sky-maroon    { --sky-a: #7a3a46; --sky-b: #2e141a; }
.sky {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255,255,255,.16), transparent 62%),
    linear-gradient(180deg, var(--sky-a), var(--sky-b));
}
.sky.night {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255,255,255,.08), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, var(--sky-a) 55%, #0b1220), color-mix(in srgb, var(--sky-b) 60%, #070b14));
}

/* ---------- Pager ---------- */
.pager {
  position: absolute; inset: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  transition: transform .42s cubic-bezier(.2,.8,.2,1), opacity .3s ease, filter .3s ease;
  will-change: transform;
}
.pager::-webkit-scrollbar { display: none; }
/* A slide is one location: a fixed sky (with weather effects) and the
   page content scrolling over it. */
.slide {
  flex: 0 0 100%; height: 100%; position: relative; overflow: hidden;
  scroll-snap-align: start; scroll-snap-stop: always;
  contain: layout paint;
}
.page {
  position: absolute; inset: 0; z-index: 1;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.page-inner {
  max-width: 600px; margin: 0 auto;
  padding-block: calc(env(safe-area-inset-top, 0px) + 36px) calc(env(safe-area-inset-bottom, 0px) + 110px);
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  display: flex; flex-direction: column; gap: 12px;
}

/* Hero */
.hero { text-align: center; padding-block: 18px 30px; }
.hero p { margin: 0; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.7647rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.hero-tag svg { width: 11px; height: 11px; fill: var(--ink); }
.hero-name { font-size: 2rem; font-weight: 400; line-height: 1.15; margin-top: 2px !important; text-wrap: balance; }
.hero-api {
  font-size: clamp(96px, 30vw, 124px); font-weight: 200; line-height: 1;
  letter-spacing: -0.045em; font-variant-numeric: tabular-nums;
  margin-top: 4px !important;
}
.hero-api small { font-size: 0.17em; font-weight: 500; letter-spacing: 0.08em; vertical-align: top; margin-left: 4px; position: relative; top: 1.2em; color: var(--ink-2); }
.hero-cat { font-size: 1.1765rem; font-weight: 500; }
.hero-cat .alt { color: var(--ink-2); font-weight: 400; }
.hero-wx { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9412rem; font-weight: 500; color: var(--ink-2); margin-top: 4px !important; }
.hero-wx .wx-ic svg { width: 20px; height: 20px; display: block; }
.hero-hl { font-size: 1.0588rem; font-weight: 500; margin-top: 2px !important; font-variant-numeric: tabular-nums; }
.hero-meta { font-size: 0.7647rem; color: var(--ink-3); margin-top: 6px !important; }

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 0 0 0.5px var(--glass-line);
  border-radius: var(--radius);
  padding: 14px 18px 16px;
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 10px; padding-bottom: 9px;
  border-bottom: 0.5px solid var(--sep);
  font-size: 0.7059rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
}
.card-head svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.small { margin: 6px 0 0; font-size: 0.7647rem; color: var(--ink-2); }

/* Health advice (top card) */
.advice-row { display: flex; gap: 12px; align-items: flex-start; }
.advice-sign { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #10131a; font-weight: 800; font-size: 1.0588rem; }
.advice-text { margin: 0; font-size: 0.9412rem; line-height: 1.45; min-width: 0; }
.advice-text b { display: block; font-size: 1rem; margin-bottom: 2px; }
.scale { display: grid; grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: 4px; margin-top: 14px; }
.scale-note { margin-top: 10px; }
.scale div { font-size: 0.5882rem; line-height: 1.3; color: var(--ink-3); text-align: center; }
.scale i { display: block; height: 5px; border-radius: 3px; margin-bottom: 5px; opacity: 0.4; }
.scale div.on { color: var(--ink); font-weight: 600; }
.scale div.on i { opacity: 1; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }

/* Running */
.run-top { display: flex; align-items: center; gap: 12px; }
.run-badge { flex: none; font-size: 0.7647rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; color: #10131a; background: var(--ink-3); }
.run[data-level="go"] .run-badge   { background: var(--run-go); }
.run[data-level="care"] .run-badge { background: var(--run-care); }
.run[data-level="stop"] .run-badge { background: var(--run-stop); }
.run-verdict { margin: 0; font-size: 1rem; font-weight: 600; text-wrap: balance; min-width: 0; }
.run-factors { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.run-factors li { display: flex; gap: 10px; align-items: baseline; font-size: 0.8235rem; color: var(--ink-2); }
.run-factors .k { flex: none; width: 3.7647rem; font-size: 0.7059rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.run-factors .v { min-width: 0; }
.run-factors i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.run-best { margin: 12px 0 0; padding-top: 10px; border-top: 0.5px solid var(--sep); font-size: 0.8235rem; }
.run-best:empty { display: none; }

/* Hourly strip */
.hours {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -18px; padding: 2px 18px 2px;
  scroll-snap-type: x proximity;
}
.hours::-webkit-scrollbar { display: none; }
.hr { flex: 0 0 3.0588rem; display: flex; flex-direction: column; align-items: center; gap: 8px; scroll-snap-align: end; }
.hr .t { font-size: 0.8824rem; font-weight: 500; }
.hr .bar { width: 6px; height: 46px; border-radius: 3px; background: rgba(255,255,255,.12); position: relative; overflow: hidden; }
.hr .bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px; }
.hr .v { font-size: 1rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.hr.now .t { font-weight: 700; }

/* 7-day forecast */
.fc { list-style: none; margin: 0; padding: 0; }
.fc li {
  display: grid; grid-template-columns: 3.8824rem 2rem 1.7647rem minmax(2.3529rem, 1fr) 1.7647rem;
  align-items: center; gap: 8px; padding: 10px 0;
}
.fc li + li { border-top: 0.5px solid var(--sep); }
.fc .day { font-size: 1rem; font-weight: 500; white-space: nowrap; }
.fc .ic { display: flex; flex-direction: column; align-items: center; }
.fc .ic svg { width: 26px; height: 26px; display: block; }
.fc .ic span { font-size: 0.5882rem; font-weight: 600; color: #8fd0ff; margin-top: 1px; }
.fc .lo { font-size: 1rem; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.fc .hi { font-size: 1rem; text-align: right; font-variant-numeric: tabular-nums; }
.fc .range { height: 5px; border-radius: 3px; background: rgba(0,0,0,.25); position: relative; }
.fc .range i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, #7fd3c1, #f5c542, #f08a24); }
.fc .note { grid-column: 2 / -1; font-size: 0.7059rem; color: var(--ink-3); margin-top: -6px; }
.fc-src { margin-top: 8px; }

/* Two small tiles */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big { margin: 0; font-size: 1.7647rem; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Page footer */
.foot { text-align: center; font-size: 0.7059rem; color: var(--ink-3); padding-top: 14px; }
.foot p { margin: 4px 0 0; }
.foot a { color: var(--ink-2); }
.credit { margin-top: 12px !important; color: var(--ink-2); }
.credit b { color: var(--ink); }

/* Empty / location-off page */
.empty { text-align: center; padding: 18px 8px; }
.empty p { margin: 0 0 14px; color: var(--ink-2); }
.pill {
  background: var(--glass); border: 0.5px solid var(--glass-line);
  font-weight: 600; font-size: 0.8824rem; padding: 10px 18px; border-radius: 999px; cursor: pointer;
}

/* ---------- Bottom toolbar ---------- */
.toolbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 var(--gutter-r) calc(env(safe-area-inset-bottom, 0px) + 14px) var(--gutter-l);
  pointer-events: none;
  transition: transform .38s cubic-bezier(.2,.8,.2,1), opacity .25s ease;
}
.toolbar > * { pointer-events: auto; }
body.list-open .pager, body.map-open .pager { transform: scale(.94); opacity: .4; }
body.list-open .alerts-btn, body.map-open .alerts-btn,
body.list-open .install-btn, body.map-open .install-btn { opacity: 0; transform: scale(.8); pointer-events: none; }
body.list-open .toolbar, body.map-open .toolbar { transform: translateY(24px); opacity: 0; pointer-events: none; }
body.list-open .toolbar > *, body.map-open .toolbar > * { pointer-events: none; }
.tb-btn:active, .dot-btn:active, .loc-open:active, .row:active, .pill:active, .more-btn:active { transform: scale(.96); }
.tb-btn, .loc-open, .pill, .more-btn { transition: transform .15s ease; }
.tb-btn {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: var(--glass-strong); border: 0.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.tb-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.tb-btn .fill { fill: var(--ink); stroke: none; }
.dots {
  display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden;
  padding: 12px 18px; border-radius: 999px;
  background: var(--glass-strong); border: 0.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.dot-btn { width: 14px; height: 14px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; flex: none; }
.dot-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); transition: background .2s; }
.dot-btn svg { width: 13px; height: 13px; fill: var(--ink-3); }
.dot-btn[aria-selected="true"] i { background: var(--ink); }
.dot-btn[aria-selected="true"] svg { fill: var(--ink); }

/* ---------- Locations list ---------- */
.listview { position: absolute; inset: 0; z-index: 10; background: var(--list-bg); overflow: hidden; }
.list-scroll { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.list-inner {
  max-width: 600px; margin: 0 auto;
  padding-block: calc(env(safe-area-inset-top, 0px) + 20px) calc(env(safe-area-inset-bottom, 0px) + 100px);
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.list-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.list-top .more-btn { flex: none; }
.list-top h1 { margin: 0; min-width: 0; font-size: min(2rem, 9.6vw); font-weight: 700; letter-spacing: -0.01em; }
.list-top h1 b { font-weight: 800; color: var(--ink); }
.more-btn {
  border: 0.5px solid var(--glass-line); background: rgba(255,255,255,.08);
  font-weight: 600; font-size: 0.8824rem; padding: 8px 16px; border-radius: 999px; cursor: pointer;
}
.loc-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.loc-card { position: relative; display: flex; align-items: center; gap: 10px; }
.loc-open {
  flex: 1; min-width: 0; text-align: left; cursor: pointer;
  border: 0; border-radius: var(--radius); padding: 16px 18px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr auto;
  column-gap: 12px; min-height: 124px;
  box-shadow: inset 0 0 0 0.5px var(--glass-line);
}
.loc-open .nm { font-size: 1.4118rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-open .sub { font-size: 0.8824rem; color: var(--ink-2); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-open .sub svg { width: 11px; height: 11px; fill: var(--ink-2); flex: none; }
.loc-open .val { grid-column: 2; grid-row: 1 / 3; font-size: 2.8235rem; font-weight: 300; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; text-align: right; }
.loc-open .cat { grid-column: 1; grid-row: 4; font-size: 0.8824rem; color: var(--ink-2); align-self: end; padding-top: 18px; }
.loc-open .hl { grid-column: 2; grid-row: 4; font-size: 0.8235rem; font-weight: 600; align-self: end; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.remove-btn {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--hazard); display: grid; place-items: center;
}
.remove-btn svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.searchbar {
  position: absolute; left: 50%; z-index: 2; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; gap: 10px;
  padding: 15px 20px; border-radius: 999px; cursor: pointer;
  background: rgba(60, 66, 80, 0.7); border: 0.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  color: var(--ink-3); font-size: 1rem; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.searchbar svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; flex: none; }

/* ---------- Sheet ---------- */
.sheet-wrap { position: absolute; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .3s ease; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet {
  position: relative; width: 100%; max-width: 600px; height: 88%;
  display: flex; flex-direction: column;
  background: var(--sheet);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
  border-radius: 16px 16px 0 0;
  padding: 8px var(--gutter-r) calc(env(safe-area-inset-bottom, 0px) + 12px) var(--gutter-l);
  transform: translateY(102%);
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
  will-change: transform;
}
.sheet-wrap.open .sheet { transform: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--ink-3); margin: 0 auto 8px; }
.sheet-top { display: flex; justify-content: space-between; align-items: center; }
.sheet-top h2 { margin: 0; font-size: 1.1765rem; font-weight: 600; }
.link-btn { background: none; border: 0; padding: 6px 0; font-weight: 600; font-size: 0.9412rem; cursor: pointer; }
.search {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 6px;
  background: rgba(118,118,128,.24); border-radius: 10px; padding: 9px 10px;
}
.search svg { width: 15px; height: 15px; fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-linecap: round; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; color: var(--ink); font: 0.9412rem var(--font); outline: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list-sheet { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.list li + li { border-top: 0.5px solid var(--sep); }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 0; background: none; border: 0; text-align: left; cursor: pointer; }
.row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.row .txt { flex: 1; min-width: 0; }
.row .nm { display: block; font-size: 0.9412rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .st { display: block; font-size: 0.7647rem; color: var(--ink-3); }
.row .val { font-size: 1.1765rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.row .added { font-size: 0.7059rem; color: var(--ink-3); margin-left: 6px; }


@media (max-width: 370px) {
  .grid2 { grid-template-columns: 1fr; }
  .fc li { grid-template-columns: 3.5294rem 1.7647rem 1.6471rem minmax(1.7647rem, 1fr) 1.6471rem; gap: 6px; }
}


/* ---------- Views: list, map, sheet ---------- */
.view { visibility: hidden; pointer-events: none; }
.view.open { visibility: visible; pointer-events: auto; }
.listview, .mapview {
  opacity: 0; transform: scale(1.04);
  transition: opacity .3s ease, transform .42s cubic-bezier(.2,.8,.2,1), visibility 0s linear .42s;
  will-change: transform, opacity;
}
.listview.open, .mapview.open {
  opacity: 1; transform: none;
  transition: opacity .3s ease, transform .42s cubic-bezier(.2,.8,.2,1), visibility 0s;
}
.sheet-wrap { transition: visibility 0s linear .4s; }
.sheet-wrap.open { transition: visibility 0s; }

/* Language switch */
.seg {
  display: inline-flex; padding: 2px; margin-bottom: 10px;
  border-radius: 9px; background: rgba(118,118,128,.24);
}
.seg button {
  border: 0; background: none; cursor: pointer;
  font-size: 0.7647rem; font-weight: 600; padding: 5px 14px; border-radius: 7px; color: var(--ink-2);
}
.seg button[aria-pressed="true"] { background: rgba(255,255,255,.22); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.list-inner .foot { padding-top: 22px; }

/* ---------- Map ---------- */
.mapview { position: absolute; inset: 0; z-index: 15; background: #1b1e24; overflow: hidden; }
.map-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--ink-2); font-size: 0.8824rem; padding: 24px; text-align: center; pointer-events: none; }
.mapview .map-canvas { position: absolute; inset: 0; }
.map-canvas .maplibregl-canvas { outline: none; }
.map-float {
  position: absolute; z-index: 2;
  background: rgba(38, 42, 52, 0.72); border: 0.5px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.map-close {
  top: calc(env(safe-area-inset-top, 0px) + 12px); left: max(16px, env(safe-area-inset-left, 0px));
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.map-close svg, .map-loc svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-loc {
  top: calc(env(safe-area-inset-top, 0px) + 12px); right: max(16px, env(safe-area-inset-right, 0px));
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}
.map-legend {
  top: calc(env(safe-area-inset-top, 0px) + 76px); left: max(16px, env(safe-area-inset-left, 0px));
  border-radius: 16px; padding: 12px 14px 12px 12px; pointer-events: none;
}
.map-legend h3 { margin: 0 0 8px; font-size: 0.8824rem; font-weight: 600; padding-bottom: 8px; border-bottom: 0.5px solid var(--sep); }
.map-legend .lg { display: flex; gap: 10px; }
.map-legend .lg i { width: 4px; border-radius: 2px; background: linear-gradient(0deg, #3a8bea 0%, #3fb560 22%, #f2c230 48%, #f08a24 72%, #e5443a 100%); }
.map-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; font-size: 0.7647rem; color: var(--ink-2); }
.timeline {
  left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: min(560px, calc(100% - 32px));
  border-radius: 26px; padding: 14px 18px 12px;
}
.tl-top { display: flex; align-items: center; gap: 12px; }
.tl-play {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); display: grid; place-items: center;
}
.tl-play svg { width: 18px; height: 18px; fill: var(--ink); }
.tl-title { flex: 1; min-width: 0; }
.tl-title b { display: block; font-size: 1rem; font-weight: 600; }
.tl-title span { display: block; font-size: 0.7647rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-now { flex: none; font-size: 1.2941rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-range { width: 100%; margin: 14px 0 4px; accent-color: #fff; height: 28px; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: pan-y; }
.tl-range::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(255,255,255,.9) var(--p, 100%), rgba(255,255,255,.22) var(--p, 100%)); }
.tl-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-top: -8.5px; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.tl-range::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(255,255,255,.22); }
.tl-range::-moz-range-progress { height: 5px; border-radius: 3px; background: rgba(255,255,255,.9); }
.tl-range::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }
.tl-ticks { display: flex; justify-content: space-between; font-size: 0.7059rem; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-ticks .on { color: var(--ink); }
.tl-note { margin: 6px 0 0; font-size: 0.7059rem; color: var(--ink-3); }

/* Station bubbles */
.mk { position: relative; cursor: pointer; transform: translateY(-50%); }
.mk b {
  display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 7px;
  border-radius: 20px; background: rgba(24, 27, 34, .9); color: #fff;
  font: 600 16px/1 var(--font); font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2.5px var(--c), 0 3px 10px rgba(0,0,0,.45);
}
.mk::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px;
  transform: translateX(-50%) rotate(45deg); background: rgba(24,27,34,.9);
  box-shadow: 2.5px 2.5px 0 0 var(--c); z-index: -1;
}
.mk.dot { transform: none; z-index: 0; }
.mk.dot b { min-width: 0; width: 14px; height: 14px; padding: 0; font-size: 0; background: var(--c); box-shadow: 0 0 0 2px rgba(20,22,28,.85), 0 1px 4px rgba(0,0,0,.5); }
.mk.dot::after { display: none; }
.mk:not(.dot) { z-index: 1; }
.mk.sel { z-index: 2; }
.mk.sel b { background: #fff; color: #111; }
.maplibregl-marker:has(.me-dot) { z-index: 3; }
.me-dot { width: 20px; height: 20px; border-radius: 50%; background: #2f88ff; box-shadow: 0 0 0 3px #fff, 0 2px 8px rgba(0,0,0,.5); position: relative; }
.me-dot::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: rgba(47,136,255,.25); animation: pulse 2.4s ease-out infinite; }
.me-label { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 0.7647rem; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
@keyframes pulse { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* Selected station card */
.map-card {
  left: 50%; transform: translateX(-50%) translateY(12px); opacity: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 160px);
  width: min(560px, calc(100% - 32px));
  border-radius: 22px; padding: 14px 16px; display: flex; align-items: center; gap: 14px;
  transition: opacity .2s ease, transform .3s cubic-bezier(.2,.8,.2,1); pointer-events: none;
}
.map-card.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.map-card .mc-api { flex: none; width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; font-size: 1.4118rem; font-weight: 600; color: #10131a; font-variant-numeric: tabular-nums; }
.map-card .mc-txt { flex: 1; min-width: 0; }
.map-card .mc-txt b { display: block; font-size: 1.0588rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-card .mc-txt span { display: block; font-size: 0.8235rem; color: var(--ink-2); }
.map-card .pill { flex: none; }
.maplibregl-ctrl-attrib { font-size: 0.5882rem; }
.maplibregl-ctrl-bottom-right { bottom: calc(env(safe-area-inset-bottom, 0px) + 150px) !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Add to Home Screen ---------- */
.install-btn {
  position: absolute; z-index: 6;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: max(16px, env(safe-area-inset-right, 0px));
  width: 44px; height: 44px;
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.2,1);
}
.install-btn svg { width: 22px; height: 22px; }
.sheet.sheet-short { height: auto; max-height: calc(100% - env(safe-area-inset-top, 0px) - 12px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-top: 8px; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); }
.install-head { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.install-head img { width: 64px; height: 64px; border-radius: 15px; flex: none; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.install-head h2 { margin: 0; font-size: 1.1176rem; font-weight: 600; text-wrap: balance; }
.install-head p { margin: 4px 0 0; font-size: 0.8235rem; color: var(--ink-2); }
.install-steps { margin: 0; padding: 0; list-style: none; counter-reset: st; display: grid; gap: 10px; }
.install-steps li { counter-increment: st; display: flex; gap: 12px; align-items: center; font-size: 0.9412rem; line-height: 1.4; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.07); }
.install-steps li::before { content: counter(st); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 0.8235rem; font-weight: 700; background: #2f88ff; color: #fff; }
.install-steps li.note { background: none; padding: 2px 4px; font-size: 0.7647rem; color: var(--ink-3); counter-increment: none; }
.install-steps li.note::before { display: none; }
.install-steps li > span { min-width: 0; }
.ico-share { width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: #2f88ff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.install-done { width: 100%; margin-top: 16px; padding: 13px; background: #2f88ff; border: 0; }

/* ---------- Swipe to delete (locations list) ---------- */
.loc-card.swipeable { border-radius: var(--radius); overflow: hidden; isolation: isolate; }
.swipe-del {
  position: absolute; top: 0; bottom: 0; right: 0; left: 0; z-index: 0;
  display: flex; justify-content: flex-end; align-items: stretch;
  border: 0; border-radius: var(--radius); padding: 0; cursor: pointer;
  background: var(--hazard); color: #fff;
  visibility: hidden;
}
.swipe-del span { width: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 0.8235rem; font-weight: 600; }
.swipe-del svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.loc-card.swiping .swipe-del, .loc-card.open .swipe-del { visibility: visible; }
.loc-card.swipeable .loc-open { position: relative; z-index: 1; touch-action: pan-y; transition: transform .32s cubic-bezier(.2,.8,.2,1); will-change: transform; }
.loc-card.dragging .loc-open { transition: none; }
.loc-card.removing { overflow: hidden; transition: height .28s ease, opacity .22s ease, margin .28s ease; opacity: 0; margin-bottom: -12px; }

/* ---------- Weather effects (fx.js) ---------- */
.fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.slide:not(.active) .fx, .slide:not(.active) .fx * { animation-play-state: paused !important; }

/* Sun */
.fx-sun { position: absolute; top: -6%; right: -18%; width: min(88vw, 520px); aspect-ratio: 1; }
.fx-sun i { position: absolute; border-radius: 50%; }
.fx-sun .glow { inset: 0; background: radial-gradient(circle, rgba(255,236,170,.45) 0%, rgba(255,220,140,.18) 32%, rgba(255,210,120,0) 62%); animation: sunpulse 9s ease-in-out infinite; }
.fx-sun .rays {
  inset: 4%;
  background: repeating-conic-gradient(from 0deg, rgba(255,244,205,.16) 0deg 5deg, rgba(255,244,205,0) 5deg 15deg);
  -webkit-mask: radial-gradient(circle, transparent 18%, #000 26%, transparent 66%);
          mask: radial-gradient(circle, transparent 18%, #000 26%, transparent 66%);
  animation: spin 120s linear infinite;
}
.fx-sun .disc { inset: 38%; background: radial-gradient(circle, #fffbea 0%, #ffeaa6 45%, rgba(255,226,140,.9) 60%, rgba(255,226,140,0) 72%); box-shadow: 0 0 60px 20px rgba(255,230,160,.25); }
.fx-sun.peek { top: -14%; right: -24%; opacity: .75; }
.fx-sun.dim { opacity: .7; }
.fx-sun.dim .disc { background: radial-gradient(circle, #ffe9c2 0%, #f7c77a 50%, rgba(240,170,90,0) 72%); box-shadow: 0 0 70px 30px rgba(240,180,100,.18); }
/* Under unhealthy air the sun turns a dull orange, the way it looks in real haze */
.fx:has(.fx-smog.l2) .fx-sun { opacity: .62; filter: sepia(.55) saturate(1.3); }

/* Moon + stars */
.fx-moon { position: absolute; top: 9%; right: 14%; width: 62px; height: 62px; }
.fx-moon .body { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset -15px 7px 0 0 #f2eedf; transform: rotate(-18deg); }
.fx-moon .halo { position: absolute; inset: -46px; border-radius: 50%; background: radial-gradient(circle, rgba(242,238,223,.22) 0%, rgba(242,238,223,.08) 40%, rgba(242,238,223,0) 70%); animation: moonglow 7s ease-in-out infinite; }
.fx-stars i { position: absolute; border-radius: 50%; background: #fff; animation: twinkle 4s ease-in-out infinite; }

/* Clouds: soft gradient blobs, no blur filter (cheap to animate) */
.fx-cloud {
  position: absolute; width: 120vw; max-width: 820px; aspect-ratio: 2.2;
  transform: scale(var(--s, 1));
  /* each blob stays well inside its box, so no edge is ever cut off */
  background:
    radial-gradient(30% 34% at 32% 55%, rgba(255,255,255,.30), rgba(255,255,255,0)),
    radial-gradient(28% 40% at 55% 48%, rgba(255,255,255,.34), rgba(255,255,255,0)),
    radial-gradient(24% 32% at 76% 56%, rgba(255,255,255,.26), rgba(255,255,255,0));
  animation: drift 100s ease-in-out infinite alternate;
}
.fx-cloud.dark {
  background:
    radial-gradient(30% 34% at 32% 55%, rgba(40,46,60,.55), rgba(40,46,60,0)),
    radial-gradient(28% 40% at 55% 48%, rgba(52,58,72,.55), rgba(52,58,72,0)),
    radial-gradient(24% 32% at 76% 56%, rgba(40,46,60,.5), rgba(40,46,60,0));
}
.fx-cloud.night { opacity: .55; }

/* Haze fog bands */
.fx-fog {
  position: absolute; left: -50%; width: 200%; height: 26%;
  background: linear-gradient(180deg, rgba(232,214,176,0), rgba(232,214,176,.16) 50%, rgba(232,214,176,0));
  animation: fog 46s ease-in-out infinite alternate;
}

/* Smog tint: keeps the haze colours on top of any weather */
.fx-smog { position: absolute; inset: 0; }
.fx-smog.l1 { background: linear-gradient(180deg, rgba(220,200,150,.04), rgba(200,175,120,.10)); }
.fx-smog.l2 { background: linear-gradient(180deg, rgba(214,182,120,.10), rgba(176,140,80,.20) 70%, rgba(140,110,60,.26)); }

/* Rain + lightning */
.fx-drops { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-flash { position: absolute; inset: 0; background: rgba(235,240,255,.7); opacity: 0; animation: flash 9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sunpulse { 50% { transform: scale(1.06); opacity: .85; } }
@keyframes twinkle { 50% { opacity: .15; } }
@keyframes drift { from { translate: -18vw 0; } to { translate: 18vw 0; } }
@keyframes fog { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
@keyframes flash { 0%, 88% { opacity: 0; } 89% { opacity: .85; } 90% { opacity: .1; } 91.5% { opacity: .6; } 94%, 100% { opacity: 0; } }

/* ---------- Search sections (DOE + IQAir) ---------- */
.list-sheet .list li.sec {
  border: 0; padding: 16px 0 6px; font-size: 0.7059rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
}
.list-sheet .list li.sec + li { border-top: 0; }
.small.pad { padding: 12px 0; margin: 0; }
.row .dot.globe { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.row .val.src { font-size: 0.7059rem; font-weight: 600; color: var(--ink-3); letter-spacing: .04em; }

/* Rain, storms and snow fall behind the cards: on those pages the cards
   become frosted glass (only on the visible page, to keep swiping smooth). */
.slide.active:has(.fx:not(.wx-none)) .card,
.slide.active:has(.fx:not(.wx-none)) .gl,
.slide.active:has(.fx:not(.wx-none)) .share-btn {
  background: rgba(34, 40, 52, 0.38);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
          backdrop-filter: blur(18px) saturate(140%);
}
.slide:not(.active):has(.fx:not(.wx-none)) .card { background: rgba(34, 40, 52, 0.42); }

/* ---------- Map: names, IQAir rings, legend key ---------- */
.mk em {
  display: none; position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-style: normal; font-size: 12px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 0 8px rgba(0,0,0,.5); pointer-events: none;
}
.names .mk:not(.dot) em { display: block; }
.mk.iq b { background: rgba(24,27,34,.78); box-shadow: 0 0 0 2.5px var(--c), 0 0 0 5px rgba(24,27,34,.55), 0 3px 10px rgba(0,0,0,.45); }
.mk.iq::after { display: none; }
.mk.iq { transform: translateY(-30%); }
.mk.iq.dot b { box-shadow: 0 0 0 2px var(--c), 0 0 0 4px rgba(20,22,28,.85); background: rgba(20,22,28,.85); }
.map-legend .lg-src { margin: 10px 0 0; padding-top: 8px; border-top: 0.5px solid var(--sep); display: grid; gap: 6px; font-size: 0.7059rem; color: var(--ink-2); }
.map-legend .lg-src span { display: flex; align-items: center; gap: 8px; }
.map-legend .lg-src i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.map-legend .k-doe { background: rgba(24,27,34,.9); box-shadow: 0 0 0 2px #f2c230; }
.map-legend .k-iq { background: rgba(24,27,34,.9); box-shadow: 0 0 0 2px #f08a24, 0 0 0 4px rgba(255,255,255,.25); }
.map-card .mc-txt span + span { font-size: 0.7647rem; color: var(--ink-3); }
.mk.iq.sel b { background: #fff; color: #111; }
.mk.iq:not(.dot) em { display: block; }    /* the few IQAir cities are always named */

/* ---------- Screen-reader only ---------- */
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Share button (hero) ---------- */
.share-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 7px 14px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); font-size: 0.8235rem; font-weight: 600;
}
.share-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.share-btn:active { transform: scale(.96); }

/* ---------- Your places at a glance ---------- */
.glance { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: -4px -2px 0; padding: 2px; }
.glance::-webkit-scrollbar { display: none; }
.gl {
  flex: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 8px 12px; border-radius: 999px; border: 0;
  background: rgba(255,255,255,.13); box-shadow: inset 0 0 0 .5px var(--glass-line); font-size: 0.8235rem;
}
.gl i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.gl b { font-variant-numeric: tabular-nums; }

/* ---------- What to do ---------- */
.todo { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.todo li { position: relative; padding-left: 20px; font-size: 0.8824rem; line-height: 1.45; }
.todo li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); }
.school { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: rgba(0,0,0,.16); }
.school p { margin: 0; font-size: 0.8235rem; }
.school .small { margin-top: 6px; }
.school.met { background: rgba(229,68,58,.22); box-shadow: inset 0 0 0 1px rgba(229,68,58,.5); }
.school.met p:first-child { font-weight: 600; }

/* ---------- Best time to run ---------- */
.bw { margin-top: 12px; padding-top: 12px; border-top: 0.5px solid var(--sep); }
.bw p { margin: 0; }
.bw-head { font-size: 0.7059rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.bw-pick { font-size: 1.0588rem; font-weight: 600; margin-top: 4px !important; }
.bw-none { font-size: 0.8824rem; margin-top: 4px !important; }
.bw-why { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px !important; }
.bw-why span { font-size: 0.7059rem; padding: 4px 9px; border-radius: 999px; background: rgba(255,255,255,.12); }
.bw-sun { font-size: 0.7647rem; color: var(--ink-2); margin-top: 8px !important; }
.bw-note { font-size: 0.7059rem; color: var(--ink-3); margin-top: 6px !important; }

/* ---------- Week chart ---------- */
.week { display: flex; justify-content: space-between; gap: 4px; }
.wk { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.wk .v { font-size: min(0.8235rem, 3.9vw); font-weight: 600; font-variant-numeric: tabular-nums; }
.wk .bar { width: 10px; height: 80px; border-radius: 5px; background: rgba(255,255,255,.12); position: relative; overflow: hidden; }
.wk .bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 5px; }
.wk .t { font-size: min(0.7647rem, 3.6vw); color: var(--ink-2); white-space: nowrap; }
.wk.today .t { color: var(--ink); font-weight: 700; }

/* ---------- Footer privacy ---------- */
.foot .privacy { max-width: 46ch; margin: 10px auto 0 !important; line-height: 1.45; }

/* ---------- Pull to refresh ---------- */
.ptr {
  position: absolute; z-index: 2; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%;
  width: 34px; height: 34px; margin-left: -17px; border-radius: 50%;
  display: grid; place-items: center; pointer-events: none;
  background: rgba(20,24,32,.45);
  opacity: var(--pull, 0); transform: translateY(calc(var(--pull, 0) * 26px)) rotate(calc(var(--pull, 0) * 270deg));
}
.ptr i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); border-right-color: transparent; }
.ptr.ready i { border-color: #fff; border-right-color: transparent; }
.ptr.spin { opacity: 1; transform: translateY(26px); }
.ptr.spin i { animation: spin .8s linear infinite; }

/* ---------- Toast ---------- */
.toast {
  position: absolute; z-index: 40; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px);
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  padding: 10px 18px; border-radius: 999px; font-size: 0.8235rem; font-weight: 600;
  background: rgba(30,34,44,.92); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.3);
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.2,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Light mode for the list, sheets and map chrome ----------
   Location pages keep their sky colours in both modes, like Apple Weather. */
@media (prefers-color-scheme: light) {
  /* The locations list stays dark (as in Apple Weather) so the white status
     bar text stays readable; sheets below the status bar go light. */
  :root { --sheet: rgba(246,246,250,.96); }
  .sheet-wrap {
    color-scheme: light;
    --ink: #111318; --ink-2: rgba(17,19,24,.72); --ink-3: rgba(17,19,24,.5);
    --sep: rgba(17,19,24,.12); --glass-line: rgba(17,19,24,.1);
    color: var(--ink);
  }
  .sheet .search { background: rgba(118,118,128,.14); }
  .install-steps li { background: rgba(17,19,24,.05); }
  .sheet-backdrop { background: rgba(0,0,0,.25); }
}
.map-legend .lg-src i.k-fire { width: 12px; height: 15px; border-radius: 0; background: none; box-shadow: none; display: grid; }
.map-legend .k-fire svg { width: 12px; height: 15px; display: block; }

/* ---------- Haze alerts ---------- */
.alerts-btn {
  position: absolute; z-index: 6;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: max(16px, env(safe-area-inset-left, 0px));
  width: 44px; height: 44px;
  transition: opacity .25s ease, transform .3s cubic-bezier(.2,.8,.2,1);
}
.alerts-btn svg { width: 21px; height: 21px; }
.alerts-btn .on-dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--run-go); box-shadow: 0 0 0 2px rgba(40,46,58,.9); }
.alerts-sub { margin: 6px 0 4px; font-size: 0.8235rem; color: var(--ink-2); }
.alerts-form fieldset { border: 0; margin: 14px 0 0; padding: 0; min-width: 0; }
.alerts-form legend { padding: 0; margin-bottom: 8px; font-size: 0.7059rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.opts { display: grid; gap: 1px; border-radius: 14px; overflow: hidden; background: var(--sep); }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: rgba(255,255,255,.06); cursor: pointer; font-size: 0.8824rem; }
.opt input { width: 20px; height: 20px; margin: 0; accent-color: #2f88ff; flex: none; }
.opt span { min-width: 0; }
.alerts-msg { min-height: 1.4em; margin: 12px 0 0; font-size: 0.8235rem; color: var(--ink-2); }
.alerts-go { width: 100%; margin-top: 10px; padding: 13px; background: #2f88ff; border: 0; color: #fff; }
.alerts-go:disabled { opacity: .5; }
.alerts-off { display: block; margin: 10px auto 0; color: var(--hazard); }
.alerts-quiet { text-align: center; margin-top: 10px; }
@media (prefers-color-scheme: light) {
  .opt { background: rgba(255,255,255,.9); }
}

/* Week sentence, last checked */
.week-line { margin: 0 0 12px; font-size: 0.8824rem; font-weight: 500; }
.foot .checked { margin-top: 0 !important; color: var(--ink-2); }
.foot .checked:empty { display: none; }
.school .small + .small { margin-top: 8px; }

/* Add to Home Screen: iPhone / Android switch */
.install-tabs { display: flex; width: 100%; margin: 4px 0 14px; }
.install-tabs button { flex: 1; padding: 8px 10px; font-size: 0.8824rem; }
.install-now { width: 100%; padding: 13px; background: #2f88ff; border: 0; color: #fff; margin-bottom: 4px; }
.install-or { margin: 10px 0 8px; font-size: 0.8235rem; color: var(--ink-3); }
@media (prefers-color-scheme: light) {
  .sheet-wrap .seg { background: rgba(118,118,128,.14); }
  .sheet-wrap .seg button[aria-pressed="true"] { background: #fff; color: #111318; }
}

/* ---------- More weather motion (all behind the frosted cards) ---------- */
/* Light beams from the sun (clear and cloudy days) */
.fx-beams { position: absolute; top: -10%; right: -10%; width: 120%; height: 90%; transform-origin: 85% 8%; animation: beams 16s ease-in-out infinite; }
.fx-beams i {
  position: absolute; top: 8%; right: 15%; width: 26%; height: 100%;
  transform-origin: 50% 0;
  background: linear-gradient(180deg, rgba(255,240,200,.16), rgba(255,240,200,0) 75%);
  -webkit-mask: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent);
          mask: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent);
}
.fx-beams i:nth-child(1) { transform: rotate(18deg); }
.fx-beams i:nth-child(2) { transform: rotate(38deg); opacity: .8; }
.fx-beams i:nth-child(3) { transform: rotate(58deg); opacity: .6; }
.fx-beams.faint { opacity: .5; }
/* Under unhealthy air the beams fade, like the dulled sun */
.fx:has(.fx-smog.l2) .fx-beams { opacity: .35; }

/* Drifting specks */
.fx-motes i {
  position: absolute; width: var(--sz); height: var(--sz); border-radius: 50%;
  opacity: var(--o); animation: mote 22s linear infinite;
}
.fx-motes.light i { background: rgba(255,246,214,.95); box-shadow: 0 0 6px rgba(255,236,170,.6); }
.fx-motes.haze i { background: rgba(232,214,176,.9); }

/* Shooting star */
.fx-shoot {
  position: absolute; width: 110px; height: 2px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, #fff, rgba(255,255,255,0));
  animation: shoot 11s linear infinite;
}

/* Cloud layers */
.fx-cloud.far { opacity: .55; }
.fx-cloud.wisp { opacity: .45; height: auto; aspect-ratio: 3.6; }

/* Thicker, faster-moving haze bands */
.fx-fog.thick { background: linear-gradient(180deg, rgba(232,214,176,0), rgba(232,214,176,.22) 50%, rgba(232,214,176,0)); animation-name: fogthick; }
@keyframes fogthick { from { transform: translateX(-18%); } to { transform: translateX(18%); } }
.fx-motes.haze i { box-shadow: 0 0 5px rgba(232,214,176,.5); }

/* Low mist under rain */
.fx-fog.mist { height: 30%; background: linear-gradient(180deg, rgba(190,205,225,0), rgba(190,205,225,.14) 55%, rgba(190,205,225,0)); }

/* Lightning bolt, in step with the flash */
.fx-bolt { position: absolute; top: 4%; width: 54px; height: 240px; opacity: 0; animation: flash 9s linear infinite; }
.fx-bolt path { fill: #fdfdf2; filter: drop-shadow(0 0 10px rgba(220,230,255,.9)); }

@keyframes beams { 0%, 100% { transform: rotate(-3deg); opacity: .7; } 50% { transform: rotate(3deg); opacity: 1; } }
@keyframes mote {
  0% { transform: translate(0, 0); opacity: 0; }
  12% { opacity: var(--o); }
  88% { opacity: var(--o); }
  100% { transform: translate(var(--dx), -160px); opacity: 0; }
}
@keyframes shoot {
  0%, 90% { opacity: 0; transform: rotate(-32deg) translateX(0); }
  91% { opacity: 1; }
  97% { opacity: .9; }
  100% { opacity: 0; transform: rotate(-32deg) translateX(-340px); }
}
@keyframes moonglow { 0%, 100% { opacity: .75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }

/* Reduced motion: keep a calm still picture */
@media (prefers-reduced-motion: reduce) {
  .fx-motes i { opacity: var(--o); transform: none; }
  .fx-shoot, .fx-bolt { opacity: 0; }
}

/* Live and total visitors */
.foot .visitors { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px !important; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.foot .visitors[hidden] { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4cd07a; box-shadow: 0 0 0 0 rgba(76,208,122,.6); animation: livepulse 2s ease-out infinite; flex: none; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(76,208,122,.55); } 100% { box-shadow: 0 0 0 7px rgba(76,208,122,0); } }

/* Shown only when JavaScript is off */
.noscript { max-width: 640px; margin: 0 auto; padding: 72px 20px; color: #fff; font: 17px/1.5 -apple-system, system-ui, sans-serif; }
.noscript h1 { font-size: 1.6rem; margin-bottom: .6em; }
.noscript p { margin-bottom: 1em; color: rgba(255,255,255,.8); }
