:root {
  --bg: #0a0a0a;
  --surface: #111;
  --surface-2: #171717;
  --border: #242424;
  --border-2: #303030;
  --text: #ededed;
  --muted: #a1a1a1;
  --dim: #6b6b6b;
  --accent: #38bdf8;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, .8);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button { font-family: inherit; }
#map { position: fixed; inset: 0; background: #e8eaed; }
.ico { display: block; flex: none; }

/* ---------- Top bar ---------- */
.topbar { position: fixed; top: 14px; left: 14px; right: 14px; z-index: 1001; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand, .search, .chip-btn, .units { background: rgba(17,17,17,.92); border: 1px solid var(--border-2); box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px 0 8px; border-radius: 12px; color: var(--text); text-decoration: none; }
.brand:hover { border-color: #3a3a3a; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-weight: 600; font-size: 15px; letter-spacing: -.02em; }
.brand-text small { font-family: var(--mono); font-weight: 400; font-size: 10.5px; color: var(--dim); letter-spacing: 0; }

.search { position: relative; flex: 0 1 420px; min-width: 0; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: 12px; color: var(--dim); transition: border-color .15s; }
.search:focus-within { border-color: var(--accent); color: var(--accent); }
.search input { flex: 1; min-width: 0; width: 100%; height: 100%; border: none; outline: none; background: none; color: var(--text); font: inherit; font-size: 15px; }
.search input::placeholder { color: var(--dim); }
.search input::-webkit-search-cancel-button { display: none; }
.suggestions { position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; }
.suggestions li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.suggestions li .ico { color: var(--dim); }
.suggestions li b { font-weight: 500; font-size: 14.5px; }
.suggestions li small { display: block; color: var(--muted); font-size: 12.5px; }
.suggestions li:hover, .suggestions li.active { background: var(--surface-2); }
.suggestions li:hover .ico, .suggestions li.active .ico { color: var(--accent); }

.chip-btn { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s; }
.chip-btn:hover { color: var(--text); border-color: #3a3a3a; }
.units { display: flex; height: 46px; padding: 4px; border-radius: 12px; }
.units button { border: none; background: none; padding: 0 11px; border-radius: 8px; color: var(--dim); font-family: var(--mono); font-size: 13px; cursor: pointer; }
.units button:hover { color: var(--text); }
.units button.on { background: var(--text); color: #0a0a0a; }

/* ---------- Weather panel ---------- */
.panel { position: fixed; top: 72px; left: 14px; bottom: 96px; width: 372px; z-index: 1000; padding: 12px; overflow-y: auto; background: rgba(13,13,13,.96); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow); scrollbar-width: thin; scrollbar-color: #333 transparent; animation: fadeIn .2s ease; }
.panel-close { position: absolute; top: 20px; right: 20px; z-index: 2; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.panel-close:hover { color: var(--text); }

.hero-card { position: relative; padding: 18px 18px 16px; border: 1px solid var(--border); border-radius: 12px; background: radial-gradient(120% 100% at 100% 0%, var(--tint, transparent) 0%, transparent 65%), var(--surface); }
.place-name { font-size: 20px; font-weight: 600; letter-spacing: -.02em; margin-right: 40px; }
.place-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.now { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.now .temp { font-size: 60px; font-weight: 500; letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.now .temp sup { font-size: 20px; font-weight: 400; color: var(--muted); vertical-align: top; margin-left: 2px; letter-spacing: 0; }
.now-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-top: 10px; font-size: 13px; }
.now-meta .desc { font-size: 15px; font-weight: 500; }
.now-meta .feels { color: var(--muted); }
.now-meta .hilo { font-family: var(--mono); font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.stats { display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0 4px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stat { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.stat:nth-child(odd) { border-right: 1px solid var(--border); }
.stat:nth-last-child(-n+2) { border-bottom: none; }
.stat .ico-wrap { color: var(--dim); }
.stat span { display: block; font-size: 11.5px; color: var(--dim); }
.stat b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

.section-title { display: flex; align-items: center; gap: 8px; margin: 18px 4px 8px; font-family: var(--mono); font-size: 11.5px; font-weight: 400; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.section-title .ico { color: var(--dim); }

.hourly { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.hour { flex: 0 0 auto; min-width: 58px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 6px; border: 1px solid var(--border); border-radius: 10px; font-size: 11.5px; color: var(--muted); }
.hour > span:first-child { font-family: var(--mono); font-size: 11px; }
.hour b { font-size: 14px; font-weight: 500; color: var(--text); }
.hour.now-h { border-color: var(--accent); }
.hour.now-h > span:first-child { color: var(--accent); }
.pop { display: flex; align-items: center; gap: 2px; min-height: 14px; font-family: var(--mono); font-size: 10.5px; color: var(--accent); }

.daily { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.day { display: grid; grid-template-columns: 76px 30px 44px 1fr; align-items: center; gap: 6px; padding: 7px 4px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.day .dname { font-weight: 500; }
.day .dname small { color: var(--dim); font-family: var(--mono); font-size: 11px; font-weight: 400; }
.range { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12.5px; }
.range .lo { width: 30px; text-align: right; color: var(--dim); }
.range .hi { width: 30px; }
.bar { position: relative; flex: 1; height: 4px; border-radius: 99px; background: #242424; }
.bar i { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, #38bdf8, #facc15); }

.loading { padding: 2px; }
.skel { margin: 10px 0; border-radius: 12px; background: linear-gradient(90deg, #151515 25%, #1d1d1d 50%, #151515 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.error { padding: 12px 4px; color: #fca5a5; font-size: 14px; }

/* ---------- Radar controls ---------- */
.radar-controls { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 14px; width: min(600px, calc(100% - 28px)); padding: 8px 14px 8px 8px; background: rgba(17,17,17,.94); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow); font-size: 13px; }
.play { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: none; border-radius: 10px; background: var(--text); color: #0a0a0a; cursor: pointer; }
.play:hover { background: #fff; }
.timeline { flex: 1; min-width: 60px; display: flex; flex-direction: column; gap: 4px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; margin: 6px 0 2px; border-radius: 99px; background: #2a2a2a; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
.legend { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.legend-bar { flex: 1; height: 3px; border-radius: 99px; background: linear-gradient(90deg, #9be7ff, #39a0ff, #1fd65f, #ffe600, #ff8a00, #ff2a2a, #d600c4); }
.time-chip { white-space: nowrap; font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.switch { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; user-select: none; }
.switch input { display: none; }
.track { position: relative; width: 34px; height: 20px; border-radius: 99px; background: #2a2a2a; transition: background .15s; }
.knob { position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .knob { transform: translateX(14px); }

.toast { position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 1100; padding: 9px 14px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 14px; box-shadow: var(--shadow); }

/* ---------- Leaflet ---------- */
.leaflet-container { background: #e8eaed; font-family: inherit; }
.leaflet-control-zoom { border: 1px solid var(--border-2) !important; border-radius: 10px !important; overflow: hidden; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; background: var(--surface) !important; color: var(--muted) !important; border-color: var(--border) !important; }
.leaflet-control-zoom a:hover { color: var(--text) !important; }
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 14px 96px 0; }
.leaflet-control-attribution { background: rgba(10,10,10,.75) !important; color: var(--dim) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip { background: var(--surface); color: var(--text); border: 1px solid var(--border-2); border-radius: 8px; box-shadow: var(--shadow); font-family: inherit; font-weight: 500; padding: 5px 9px; }
.leaflet-tooltip-top::before { border-top-color: var(--border-2); }
.pulse-marker .dot, .pulse-marker .ring { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; }
.pulse-marker .dot { background: #fff; border: 3px solid var(--accent); }
.pulse-marker .ring { border: 1px solid var(--accent); animation: ring 2.2s ease-out infinite; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes ring { from { transform: scale(1); opacity: 1; } to { transform: scale(4); opacity: 0; } }

@media (max-width: 720px) {
  .topbar { top: 10px; left: 10px; right: 10px; gap: 6px; }
  .brand-text { display: none; }
  .brand { padding: 0 8px; }
  .search { flex: 1 1 0; }
  .units button { padding: 0 7px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 64vh; border-radius: 16px 16px 0 0; border-bottom: none; }
  .panel:not([hidden]) ~ .radar-controls { display: none; }
  .radar-controls { bottom: 10px; gap: 10px; }
  .legend, .switch-label { display: none; }
  .leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 10px 84px 0; }
}
@media (max-width: 400px) { .chip-btn { width: 42px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- US cities table (right side) ---------- */
.cities {
  position: fixed; top: 72px; right: 14px; bottom: 182px; width: 280px; z-index: 1000;
  display: flex; flex-direction: column; background: rgba(13,13,13,.96); border: 1px solid var(--border-2);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.cities-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; }
.cities-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.cities-head h2 small { margin-left: 6px; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--dim); }
.cities-close { display: none; width: 28px; height: 28px; place-items: center; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer; }
.city-filter { margin: 0 10px 8px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--dim); }
.city-filter:focus-within { border-color: var(--accent); color: var(--accent); }
.city-filter input { flex: 1; min-width: 0; border: none; outline: none; background: none; color: var(--text); font: inherit; font-size: 13.5px; }
.city-filter input::placeholder { color: var(--dim); }
.city-cols { display: grid; grid-template-columns: 1fr 30px 40px; gap: 8px; padding: 0 20px 6px; font-family: var(--mono); font-size: 10.5px; color: var(--dim); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.city-cols span:last-child { text-align: right; }
.city-list { list-style: none; margin: 0; padding: 4px 6px 8px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.city-list button {
  width: 100%; display: grid; grid-template-columns: 1fr 30px 40px; gap: 8px; align-items: center;
  padding: 7px 10px; border: none; border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer;
}
.city-list button:hover { background: var(--surface-2); }
.city-list button.active { background: #0c2330; box-shadow: inset 2px 0 0 var(--accent); }
.c-name { min-width: 0; }
.c-name b { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-name small { display: block; font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.city-list .wx, .c-wx { width: 26px; height: 26px; justify-self: center; }
.c-temp { text-align: right; font-family: var(--mono); font-size: 13px; }
.c-empty { padding: 14px 10px; color: var(--dim); font-size: 13px; }
.cities-btn { display: none; }
@media (max-width: 1100px) { .cities { width: 250px; } }
@media (max-width: 720px) {
  .cities-btn { display: grid; }
  .cities { display: none; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 70vh; border-radius: 16px 16px 0 0; z-index: 1002; background: #0d0d0d; }
  .cities.open { display: flex; }
  .cities-close { display: grid; }
}

/* Data source line (live station reading vs model estimate) */
.source { position: relative; display: flex; align-items: flex-start; gap: 7px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--dim); }
.source .dot { width: 6px; height: 6px; margin-top: 4px; border-radius: 50%; background: var(--dim); flex: none; }
.source.live { color: var(--muted); }
.source.live .dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 50% { box-shadow: 0 0 0 5px rgba(34,197,94,0); } }
.c-temp.live { color: #fff; }
.cities-note { margin: 0; padding: 8px 14px 10px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
