/* ================================================================
   ATMOS — style.css
   ================================================================ */
:root {
  --bg: #0d1117;
  --sf: rgba(18, 26, 38, 0.82);
  --sf-hi: rgba(24, 34, 50, 0.92);
  --border: rgba(255, 255, 255, 0.07);
  --border-hi: rgba(255, 255, 255, 0.14);
  --hl-1: rgba(255, 255, 255, 0.03);
  --hl-2: rgba(255, 255, 255, 0.05);
  --hl-3: rgba(255, 255, 255, 0.1);
  --ink: #d8e8f4;
  --ink-2: #7a9ab8;
  --ink-3: #3d5468;
  --r-warn: #f0945a;
  --r-feel: #f5c842;
  --r-sky: #5ab4f0;
  --r-health: #42e09a;
  --ok: #3dd68c;
  --caution: #f0c060;
  --danger: #f06050;
  --radius: 20px;
  --pad: 16px;
  --gap: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --ah: 215;
  --as: 45%;
  --al: 18%;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --sf: rgba(255, 255, 255, 0.88);
    --sf-hi: rgba(255, 255, 255, 0.98);
    --border: rgba(0, 0, 0, 0.12);
    --border-hi: rgba(0, 0, 0, 0.22);
    --hl-1: rgba(0, 0, 0, 0.04);
    --hl-2: rgba(0, 0, 0, 0.08);
    --hl-3: rgba(0, 0, 0, 0.14);
    --ink: #111827;
    --ink-2: #4b5563;
    --ink-3: #6b7280;
    --r-warn: #e87b38;
    --r-feel: #e0ac1a;
    --r-sky: #2b9ced;
    --r-health: #15c87a;
    --ok: #15c87a;
    --caution: #e0ac1a;
    --danger: #e84c3d;
    --al: 92%;
    --as: 65%;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { height: 100%; max-width: 100vw; overflow-x: hidden; }

body {
  max-width: 100vw;
  overflow-x: hidden;
  font-family: 'Roboto', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  /* Prevent text selection highlight on tap */
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(120% 80% at 10% 0%, hsl(var(--ah) var(--as) var(--al)/0.88), transparent 55%),
    radial-gradient(100% 65% at 90% 100%, hsl(calc(var(--ah)+22) var(--as) 14%/0.72), transparent 52%),
    var(--bg);
  background-attachment: fixed;
  transition: background 2s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: -30%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(36% 26% at 26% 32%, hsl(var(--ah) 80% 70%/0.20), transparent 72%),
    radial-gradient(28% 20% at 72% 58%, hsl(calc(var(--ah)+32) 80% 66%/0.16), transparent 72%);
  filter: blur(80px);
  animation: haze 40s linear infinite;
}

@keyframes haze {
  0%   { transform: translate3d(-3%, -2%, 0) scale(1.05); }
  50%  { transform: translate3d(3%,  2%, 0) scale(1.09); }
  100% { transform: translate3d(-3%, -2%, 0) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Layout ──────────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  overflow-x: hidden;
}

/* Shared wheel pattern — used for date (top) and location (bottom).
   Selection model: a fixed "glass window" sits at the horizontal center.
   Whichever .wheel-item's center currently overlaps the window IS the
   selection — read live from JS on every scroll frame, not detected
   after the scroll settles. This is why there's no scrollLeft-forcing
   logic anywhere near this: native scroll-snap handles the physical
   settle, JS never writes scroll position, so nothing fights the user's
   swipe mid-gesture. */
.wheel-zone { position:relative; width:100%; max-width:100%; display:flex; justify-content:center; overflow:hidden; }
.wheel { position:relative; display:flex; align-items:center; padding:0 6px; width:100%; max-width:393px; min-width:0; height:44px; }
.wheel-arrow { flex-shrink:0; width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:var(--ink-3); opacity:.55; cursor:pointer; z-index:3; }

.wheel-window {
  position:absolute; left:50%; top:0; transform:translateX(-50%);
  width:172px; height:100%;
  border-radius:16px;
  background:rgba(255,255,255,0.75); border:1px solid var(--border);
  box-shadow:0 1px 2px rgba(0,0,0,0.04), 0 6px 16px rgba(0,0,0,0.05);
  pointer-events:none; z-index:1;
}
@media (prefers-color-scheme: dark) {
  .wheel-window { background:rgba(255,255,255,0.1); }
}
/* Location wheel items are shorter than "Wednesday 28", so its window can be narrower */
#dockLocations .wheel-window { width:140px; }

.wheel-track {
  position:relative; z-index:2;
  flex:1; min-width:0; display:flex; align-items:center; gap:12px;
  overflow-x:auto; scroll-snap-type:x mandatory; scrollbar-width:none;
  /* Padding centers the first/last item under the window. Capped with min()
     so it can never exceed the wheel's own box and push content off-screen
     (this — 30vw with no cap — was the original horizontal-overflow bug). */
  padding:0 min(calc(50% - 86px), 140px);
}
#dockLocations .wheel-track { padding:0 min(calc(50% - 70px), 100px); }
.wheel-track::-webkit-scrollbar { display:none; }
.wheel-item {
  scroll-snap-align:center; scroll-snap-stop:always;
  font-size:13.5px; font-weight:500; color:rgba(28,33,38,0.28);
  white-space:nowrap; flex-shrink:0; cursor:pointer;
  padding:8px 14px; border-radius:16px;
  transition:color .12s linear;
}
.wheel-item .dom { opacity:.65; font-weight:500; margin-left:3px; }
.wheel-item.in-window {
  font-size:14.5px; font-weight:700; color:var(--ink);
}
.wheel-item.in-window .dom { opacity:.8; }

/* Date wheel zone */
.date-zone { flex-shrink:0; padding:6px 8px 12px; }

/* ── Top bar (icon-only, no title) ─────────────────────── */
.topbar {
  flex-shrink:0; display:flex; align-items:center; justify-content:flex-end;
  padding:4px 14px 0;
}
.ico-btn {
  width:40px; height:40px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:none; border:none; color:var(--ink-2);
  cursor:pointer; -webkit-tap-highlight-color:transparent;
  transition:background-color .15s ease, color .15s ease;
}
.ico-btn:hover, .ico-btn:focus-visible { background:rgba(0,0,0,0.05); color:var(--ink); }
@media (prefers-color-scheme: dark) {
  .ico-btn:hover, .ico-btn:focus-visible { background:rgba(255,255,255,0.08); }
}

/* ── Heads Up (Reports) ──────────────────────────────────── */
main#reports {
  overflow-y: auto;
  padding: 4px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.hu-eyebrow {
  width: 100%;
  max-width: 353px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-3);
  margin-bottom: 14px;
}

/* ── Timeline ────────────────────────────────────────────── */
.timeline {
  width: 100%;
  max-width: 353px;
  display: flex;
  gap: 3px;
  height: 26px;
  align-items: flex-end;
  position: relative;
  z-index: 25;
  /* Faint base track so empty hours aren't invisible — without this,
     when only the first 2-3 hours of the 12-hour window have something
     to flag, the rest of the timeline looks like content is missing. */
  background: var(--hl-1);
  border-radius: 6px;
  padding: 4px 2px;
  box-sizing: border-box;
}
.t-col {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.seg { width: 100%; border-radius: 2px; height: 4px; background: transparent; }
.seg.feel { background: var(--r-feel); }
.seg.sky { background: var(--r-sky); }
.seg.health { background: var(--r-health); }
.seg.empty { background: transparent; }
.timeline-labels {
  width: 100%;
  max-width: 353px;
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--ink-3);
  margin-top: 6px;
  font-family: 'Roboto Mono', monospace;
  position: relative;
  z-index: 25;
}
.timeline-labels span { flex: 1; text-align: center; }
.timeline-labels span:first-child { text-align: left; }
.timeline-labels span:last-child { text-align: right; }

/* ── Plain Report Blocks ─────────────────────────────────── */
.reports-list {
  width: 100%;
  max-width: 353px;
  display: flex;
  flex-direction: column;
  margin-top: 14px;
}
.report { padding: 11px 0; }
.report + .report { border-top: 1px solid rgba(0,0,0,0.07); }
@media (prefers-color-scheme: dark) {
  .report + .report { border-top: 1px solid rgba(255,255,255,0.07); }
}

.report-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.report.feel .report-tag { color: var(--r-feel); }
.report.sky .report-tag { color: var(--r-sky); }
.report.health .report-tag { color: var(--r-health); }
.report.alerts .report-tag { color: var(--r-warn); }

.report-advice {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-top: 6px;
}
.report-summary {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  margin-top: 4px;
}

.view-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.view-more svg { flex-shrink: 0; }
.report.feel .view-more { color: var(--r-feel); }
.report.sky .view-more { color: var(--r-sky); }
.report.health .view-more { color: var(--r-health); }
.report.alerts .view-more { color: var(--r-warn); }

/* ── Popups (Heads Up detail) ────────────────────────────── */
.popup-scrim {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(20,24,28,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.popup-scrim.open { opacity: 1; pointer-events: auto; }

.popup-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg);
  border-radius: 24px;
  padding: 22px 22px 24px;
  transform: scale(0.94);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  position: relative;
}
.popup-scrim.open .popup-card { transform: scale(1); opacity: 1; }
.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--hl-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  font-size: 14px;
  cursor: pointer;
}
.popup-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }

.chart-block-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-top: 18px; }
.chart-svg { width: 100%; height: 52px; display: block; margin-top: 10px; }
.chart-svg-sm { width: 100%; height: 34px; display: block; margin-top: 8px; }
.chart-range { display: flex; justify-content: space-between; font-family: 'Roboto Mono', monospace; font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }
.chart-hours { display: flex; justify-content: space-between; font-family: 'Roboto Mono', monospace; font-size: 9.5px; color: var(--ink-3); margin-top: 4px; opacity: .7; }
.chart-hours span { flex: 1; text-align: center; }
.chart-hours span:first-child { text-align: left; }
.chart-hours span:last-child { text-align: right; }

/* ── Dock ────────────────────────────────────────────────── */
.dock {
  flex-shrink: 0;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px calc(env(safe-area-inset-bottom, 0px));
  /* Solid-ish fill so the dock reads as a real surface on iOS, where
     backdrop-filter can be unreliable inside a dvh flex container and
     ends up looking like the page content is bleeding through. */
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--border-hi);
}
@media (prefers-color-scheme: dark) {
  .dock {
    background: rgba(18, 26, 38, 0.96);
    border-top: 1px solid var(--border-hi);
  }
}
.dock-menu {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .dock-menu { background: rgba(255,255,255,0.05); }
}
.dock .wheel-zone { flex: 1; }
.dock .wheel { max-width: none; }
/* padding for .dock .wheel-track now handled by #dockLocations .wheel-track above */

.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #6bf0a8, var(--ok));
  box-shadow: 0 0 0 5px rgba(31,181,106,0.14);
}
.status-dot[data-s="err"] { background: radial-gradient(circle at 35% 30%, #ff8a80, var(--danger)); box-shadow: 0 0 0 5px rgba(240,96,80,0.14); }
.status-dot[data-s="busy"] { background: radial-gradient(circle at 35% 30%, #ffe57f, var(--caution)); animation: blink 1.1s ease-in-out infinite; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ── Skeletons ───────────────────────────────────────────── */
.skel {
  background: var(--sf);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  width: 100%;
  margin-top: 10px;
}
.skel-l {
  height: 11px;
  border-radius: 6px;
  background: var(--hl-2);
  animation: sh 1.4s ease-in-out infinite;
}
.skel-l + .skel-l { margin-top: 9px; }
.skel-l.m { width: 70%; }
.skel-l.s { width: 45%; }
@keyframes sh {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 1; }
}

/* ── Location sheet ──────────────────────────────────────── */


#locSheet {
  background: var(--sf-hi);
  color: var(--ink);
  border: 1px solid var(--border-hi);
  border-radius: 22px 22px 0 0;
  padding: 20px var(--pad) calc(20px + var(--safe-b));
  width: 100%;
  max-width: 560px;
  margin: auto 0 0;
  font-family: 'Roboto', sans-serif;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  max-height: calc(100dvh - var(--safe-t));
  flex-direction: column;
  overflow: hidden;
}
#locSheet[open] {
  display: flex;
}
#locSheet::backdrop { background: rgba(0,0,0,0.55); }
#locSheet h2 {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.loc-scroll {
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}
.loc-scroll::-webkit-scrollbar { width: 3px; }
.loc-scroll::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 9px; }

.loc-group-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 12px 0 6px;
}
.loc-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--hl-1);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: 'Roboto', sans-serif;
  font-size: 14.5px;
  padding: 10px 12px;
  border-radius: 13px;
  margin-bottom: 5px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s, background 0.14s;
  /* min tap height */
  min-height: 48px;
}
.loc-opt[aria-current="true"] { border-color: var(--r-warn); background: color-mix(in srgb, var(--r-warn) 8%, transparent); }
.loc-opt:hover { border-color: var(--border-hi); background: var(--hl-2); }
.loc-opt:focus-visible { outline: 2px solid var(--r-sky); outline-offset: 2px; }
.loc-opt .loc-label { flex: 1; min-width: 0; }
.loc-opt .loc-name  { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-opt .loc-sub   { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-opt .loc-nick  { font-size: 10.5px; color: var(--ink-3); background: var(--hl-2); padding: 0 6px; border-radius: 4px; margin-left: 4px; font-weight: 400; }

.loc-live-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ok);
  border: 1px solid var(--ok);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}
.loc-actions { display: flex; gap: 2px; flex-shrink: 0; }
.loc-act {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  background: var(--hl-2);
  /* ink-2 is brighter than ink-3 — without this, the icons are nearly
     invisible on iPhone (no hover to reveal them). */
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.14s, background 0.14s;
  -webkit-tap-highlight-color: transparent;
}
.loc-act:active        { background: var(--hl-3); color: var(--ink); }
.loc-act:hover         { color: var(--ink);   background: var(--hl-3); }
.loc-act.del:hover,
.loc-act.del:active    { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent);  }
.loc-act svg           { width: 14px; height: 14px; }
.loc-act.edit svg      { width: 15px; height: 15px; }

/* ── Location search ─────────────────────────────────────── */
.loc-search-wrap {
  position: relative;
  margin: 10px 0 6px;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.loc-search-wrap .loc-search-inner { position: relative; flex: 1; }
.loc-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
  width: 15px;
  height: 15px;
}
#locSheetSearch {
  width: 100%;
  background: var(--hl-1);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  padding: 11px 12px 11px 38px;
  border-radius: 13px;
  outline: none;
  transition: border-color 0.16s;
  /* min touch height */
  min-height: 46px;
}
#locSheetSearch:focus { border-color: var(--border-hi); }
#locSheetSearch::placeholder { color: var(--ink-3); }

.loc-country-filter {
  background: var(--hl-1);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  padding: 8px 6px;
  border-radius: 13px;
  outline: none;
  transition: border-color 0.16s;
  width: 80px;
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a9ab8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px;
  min-height: 46px;
}
.loc-country-filter:focus { border-color: var(--border-hi); }
.loc-country-filter option { background: var(--bg); color: var(--ink); }

.loc-sheet-results { margin-top: 4px; flex-shrink: 0; }
.loc-sheet-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.1s;
  min-height: 48px;
}
.loc-sheet-result:hover { background: var(--hl-2); }
.loc-sheet-result:focus-visible { outline: 2px solid var(--r-sky); outline-offset: -2px; }
.loc-sheet-result-name { font-size: 14px; font-weight: 500; }
.loc-sheet-result-meta { font-size: 11.5px; color: var(--ink-2); }

#locSheetClose {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-2);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  padding: 13px;
  border-radius: 13px;
  margin-top: 10px;
  cursor: pointer;
  transition: border-color 0.14s, color 0.14s;
  flex-shrink: 0;
  min-height: 48px;
}
#locSheetClose:hover { border-color: var(--border-hi); color: var(--ink); }

.loc-empty { padding: 14px 0; font-size: 13px; color: var(--ink-2); text-align: center; }

/* ── Settings, Rename & Delete dialogs ───────────────────────────── */
#settingsDlg, #renameDlg, #deleteConfirmDlg {
  background: var(--sf-hi);
  color: var(--ink);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  padding: calc(22px + var(--safe-t)) var(--pad) calc(22px + var(--safe-b));
  width: min(440px, 94vw);
  font-family: 'Roboto', sans-serif;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  max-height: calc(100dvh - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
}
#settingsDlg::backdrop, #renameDlg::backdrop, #deleteConfirmDlg::backdrop { background: rgba(0,0,0,0.55); }
@media (prefers-color-scheme: light) {
  #settingsDlg::backdrop, #renameDlg::backdrop, #deleteConfirmDlg::backdrop { background: rgba(0,0,0,0.25); }
  #locSheet::backdrop { background: rgba(0,0,0,0.25); }
}
#settingsDlg h2, #renameDlg h2, #deleteConfirmDlg h2 { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 4px; }
#settingsDlg h3, #renameDlg h3 { font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 16px 0 10px; }

#renameInput {
  width: 100%;
  background: var(--hl-1);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 13px;
  outline: none;
  transition: border-color 0.16s;
  min-height: 46px;
  margin-top: 10px;
}
#renameInput:focus { border-color: var(--border-hi); }
#renameInput::placeholder { color: var(--ink-3); }

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }

.setting-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.setting-row .s-label { font-size: 14.5px; font-weight: 500; color: var(--ink); }

/* Toggles use the sky color when on (matches dialog primary),
   so the Settings page lives in the same palette as the rest of Atmos
   rather than feeling like a separate (orange) tool. */
.setting-row .s-toggle {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--border);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.setting-row .s-toggle[data-on="true"] { background: var(--r-sky); }
.setting-row .s-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.setting-row .s-toggle[data-on="true"]::after { transform: translateX(16px); }

.setting-row .s-threshold {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  opacity: 1;
  transition: opacity .15s ease;
}
.setting-row .s-threshold.disabled { opacity: .38; pointer-events: none; }

/* Slider: track gets a visible fill from min..value via a CSS var
   (--p) set inline by JS). This is what was missing before — the
   track was a single flat color, so users couldn't tell where they
   were on the range. */
.setting-row .s-threshold input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    to right,
    var(--r-sky) 0%,
    var(--r-sky) var(--p, 0%),
    var(--border) var(--p, 0%),
    var(--border) 100%
  );
  border-radius: 9px;
  outline: none;
  touch-action: none;
}
.setting-row .s-threshold input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: 2px solid var(--r-sky);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 3px color-mix(in srgb, var(--r-sky) 18%, transparent);
}
.setting-row .s-threshold input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: 2px solid var(--r-sky);
}
.setting-row .s-threshold .s-val {
  font-family: 'Roboto Mono', monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  /* Widen min-width so the unit (e.g. "km/h") never overflows the row.
     Was 44px which clipped "100km/h" and "AQI" values on iPhone. */
  min-width: 64px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}
.setting-row .s-threshold .s-num-input {
  width: 48px;
  flex-shrink: 0;
  background: var(--hl-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: 'Roboto Mono', monospace;
  font-size: 12.5px;
  padding: 6px 4px;
  border-radius: 8px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}
.setting-row .s-threshold .s-num-input::-webkit-outer-spin-button,
.setting-row .s-threshold .s-num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.setting-row .s-threshold .s-num-input:focus { border-color: var(--border-hi); }

.settings-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.s-btn { font-family: 'Roboto', sans-serif; font-size: 13.5px; padding: 11px 18px; border-radius: 11px; cursor: pointer; transition: background 0.14s; min-height: 44px; }
.s-btn-ghost { background: none; border: 1px solid var(--border); color: var(--ink-2); }
.s-btn-ghost:hover { border-color: var(--border-hi); color: var(--ink); }
.s-btn-primary { background: color-mix(in srgb, var(--r-sky) 18%, transparent); border: 1px solid color-mix(in srgb, var(--r-sky) 30%, transparent); color: var(--ink); }
.s-btn-primary:hover { background: color-mix(in srgb, var(--r-sky) 28%, transparent); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(74px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--sf-hi);
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13px;
  color: var(--ink);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}
.toast[data-show] { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* ── Install banner ──────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: calc(74px + var(--safe-b) + 10px);
  left: var(--pad);
  right: var(--pad);
  max-width: 528px;
  margin: 0 auto;
  background: var(--sf-hi);
  border: 1px solid var(--border-hi);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 40;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: slideUp 0.3s ease;
}
.install-banner[hidden] { display: none; }
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.install-banner-icon { font-size: 28px; flex-shrink: 0; }
.install-banner-text { flex: 1; min-width: 0; }
.install-banner-text strong { display: block; font-size: 14px; font-weight: 500; color: var(--ink); }
.install-banner-text span   { font-size: 12px; color: var(--ink-2); }
.install-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.install-btn {
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border-hi);
  min-height: 38px;
}
.install-btn-primary { background: color-mix(in srgb, var(--r-sky) 20%, transparent); color: var(--ink); }
.install-btn-primary:hover { background: color-mix(in srgb, var(--r-sky) 30%, transparent); }
.install-btn-dismiss { background: none; color: var(--ink-2); }
.install-btn-dismiss:hover { color: var(--ink); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 420px) {
  .hdr-name { font-size: 22px; }
  .loc-opt { padding: 8px 10px; font-size: 13px; }
  .loc-country-filter { width: 66px; font-size: 12px; padding: 8px 4px 8px 8px; background-position: right 4px center; padding-right: 20px; }
}
@media (max-width: 360px) {
  .hdr-name { font-size: 19px; }
  .hdr-ctrl { gap: 4px; }
  .ico-btn { width: 36px; height: 36px; }
  .dot { width: 10px; height: 10px; }
}

