:root {
  color-scheme: light;
  --bg: #f3f4f1;
  --surface: #fcfcfb;
  --surface-2: #eeeeea;
  --line: #deded8;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7c7b76;
  --accent: #2a78d6;
  --temp: #eb6834;
  --temp-band: rgba(235, 104, 52, .16);
  --rain: #2a78d6;
  --dry: #1e8e3e; --dry-bg: #e3f3e7;
  --maybe: #a86200; --maybe-bg: #fdefd3;
  --rainc: #1f63b8; --rain-bg: #dbe8fa; --rain-solid: #2a78d6;
  --ok: #1e8e3e;   --ok-bg: #e3f3e7;
  --warn: #b26b00; --warn-bg: #fdf0d6;
  --bad: #c62828;  --bad-bg: #fbe3e2;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110; --surface: #1a1a19; --surface-2: #242422; --line: #2f2f2c;
    --text: #fff; --text-2: #c3c2b7; --text-3: #8d8c84;
    --accent: #3987e5; --temp: #f07a45; --temp-band: rgba(240,122,69,.2); --rain: #3987e5;
    --dry: #4cc26a; --dry-bg: #173622; --maybe: #f0b04a; --maybe-bg: #3a2c12;
    --rainc: #8fbaf3; --rain-bg: #1b2d47; --rain-solid: #3987e5;
    --dry: #4cc26a; --dry-bg: #173622; --maybe: #f0b04a; --maybe-bg: #3a2c12;
  --rainc: #8fbaf3; --rain-bg: #1b2d47; --rain-solid: #3987e5;
  --ok: #4cc26a; --ok-bg: #173622; --warn: #f0b04a; --warn-bg: #3a2c12;
    --bad: #f07070; --bad-bg: #3d1a1a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110; --surface: #1a1a19; --surface-2: #242422; --line: #2f2f2c;
  --text: #fff; --text-2: #c3c2b7; --text-3: #8d8c84;
  --accent: #3987e5; --temp: #f07a45; --temp-band: rgba(240,122,69,.2); --rain: #3987e5;
  --dry: #4cc26a; --dry-bg: #173622; --maybe: #f0b04a; --maybe-bg: #3a2c12;
  --rainc: #8fbaf3; --rain-bg: #1b2d47; --rain-solid: #3987e5;
  --ok: #4cc26a; --ok-bg: #173622; --warn: #f0b04a; --warn-bg: #3a2c12;
  --bad: #f07070; --bad-bg: #3d1a1a; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: 13px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
}
header.top .wrap { display: flex; align-items: center; gap: 10px; }
header.top h1 { font-size: 18px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .sub { font-size: 12px; color: var(--text-3); font-weight: 400; display: block; }
.iconbtn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; font-size: 17px;
}
.iconbtn.spin span { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 14px; margin: 12px 0;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 0 0 10px; font-weight: 600; }

/* now */
.now { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; }
.now .big { font-size: 54px; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.now .ico { font-size: 44px; }
.now .desc { grid-column: 1 / -1; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--text-2); }
.nowcast { display: flex; align-items: flex-end; gap: 2px; height: 44px; margin-top: 12px; }
.nowcast i { flex: 1; background: var(--rain); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }
.nowcast i.zero { background: var(--line); }
.nowcast-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 3px; }
.nowtext { margin-top: 8px; font-weight: 500; }

/* works strip */
.wgrid { display: grid; gap: 2px; font-size: 12px; overflow-x: auto; }
.wgrid .h { color: var(--text-3); text-align: center; padding: 4px 0; white-space: nowrap; }
.wgrid .n { padding: 4px 6px 4px 0; color: var(--text-2); line-height: 1.2; align-self: center; }
.wgrid .c { border-radius: 6px; display: grid; place-items: center; min-height: 30px; cursor: pointer; font-size: 14px; }
.c.ok, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.c.warn, .badge.warn { background: var(--warn-bg); color: var(--warn); }
.c.bad, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.c.none { background: var(--surface-2); color: var(--text-3); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--text-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .ok::before { background: var(--ok); } .legend .warn::before { background: var(--warn); } .legend .bad::before { background: var(--bad); }

.detail { display: none; padding-bottom: 12px; }
.day.open .detail { display: block; }
.reasons { margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; }
.reasons li { padding: 3px 0; }
.hours { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hours table { border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.hours td { padding: 4px 7px; text-align: center; }
.hours tr td:first-child { text-align: left; color: var(--text-3); position: sticky; left: 0; background: var(--surface); }
.hours .work { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* charts */
.chart-box { position: relative; height: 180px; }
.chart-box.small { height: 110px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 8px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* radar */
#map { height: 62vh; min-height: 340px; border-radius: 10px; overflow: hidden; }
.radar-ctl { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.radar-ctl input[type=range] { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.links a { color: var(--accent); text-decoration: none; font-size: 14px; }
iframe.windy { width: 100%; height: 62vh; min-height: 340px; border: 0; border-radius: 10px; }

/* sources */
.src-table { overflow-x: auto; }
.src-table table { border-collapse: collapse; font-size: 13px; width: 100%; white-space: nowrap; }
.src-table th, .src-table td { padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.src-table th:first-child, .src-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
.src-table tr.cons td { font-weight: 600; background: var(--surface-2); }
.src-table tr.cons td:first-child { background: var(--surface-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.srclist div { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

/* settings */
label.f { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--text-2); }
input.in { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#pickmap { height: 280px; border-radius: 10px; margin-top: 10px; }
.results div { padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wedit { display: grid; grid-template-columns: 1fr repeat(3, 62px); gap: 6px; align-items: center; font-size: 13px; }
.wedit input { padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); width: 100%; }
.msg { margin-top: 10px; font-size: 14px; }

/* bottom nav */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; border: 0; background: none; padding: 8px 0 9px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--text-3);
}
nav.tabs button b { font-size: 20px; font-weight: 400; line-height: 1.1; }
nav.tabs button.on { color: var(--accent); }
section.page { display: none; }
section.page.on { display: block; }

.skeleton { color: var(--text-3); padding: 40px 0; text-align: center; }
.err { color: var(--bad); }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow); white-space: nowrap; z-index: 5; display: none; }



/* days dashboard */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head h2 { margin: 0; }
.card-head .seg { margin: 0; }
.plegend { display: flex; gap: 2px; font-size: 10px; color: var(--text-3); margin: 8px 0 -4px; padding-left: 72px; }
.plegend span { width: 36px; text-align: center; }
.day { border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day > button {
  width: 100%; background: none; border: 0; padding: 11px 0; cursor: pointer; text-align: left;
  display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: center;
}
.dname b { display: block; font-size: 15px; }
.dname span { font-size: 12px; color: var(--text-3); }
.dmain { min-width: 0; }
.verdict { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 15px; padding: 3px 10px 3px 8px; border-radius: 999px; }
.verdict em { font-style: normal; font-weight: 500; font-size: 12px; opacity: .8; }
.verdict.dry { background: var(--dry-bg); color: var(--dry); }
.verdict.maybe { background: var(--maybe-bg); color: var(--maybe); }
.verdict.rain { background: var(--rain-bg); color: var(--rainc); }
.dline { font-size: 12.5px; color: var(--text-2); margin: 4px 0 5px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pstrip { display: flex; gap: 2px; }
.pp { width: 36px; height: 7px; border-radius: 4px; background: var(--dry); opacity: .85; }
.pp.maybe { background: var(--maybe); }
.pp.rain { background: var(--rain-solid); }
.pp.none { background: var(--line); }
.pp.past { background: var(--line); opacity: .5; }
.dside { text-align: right; white-space: nowrap; }
.dt b { font-size: 19px; font-weight: 600; }
.dt span { color: var(--text-3); margin-left: 5px; }
.dw { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }
.dw.windy { color: var(--maybe); font-weight: 600; }
.day.far .dname, .day.far .dside, .day.far .dline { opacity: .75; }
.farsep { font-size: 12px; color: var(--text-3); text-align: center; padding: 10px 0 6px; border-top: 1px dashed var(--line); }
.farsep + .day { border-top: 0; }
.ptable { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ptable > div { background: var(--surface-2); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.ptable > div.past { opacity: .5; }
.ptable b { font-size: 16px; }
.pv { font-weight: 600; }
.pv.dry { color: var(--dry); } .pv.maybe { color: var(--maybe); } .pv.rain { color: var(--rainc); }
.legend .dry::before { background: var(--dry); } .legend .maybe::before { background: var(--maybe); } .legend .rain::before { background: var(--rain-solid); }
.legend .rain { color: var(--text-2); font-weight: 400; }
.wedit { grid-template-columns: 1fr 70px; }
@media (max-width: 380px) {
  .day > button { grid-template-columns: 52px 1fr auto; gap: 8px; }
  .pp { width: 30px; } .plegend span { width: 30px; } .plegend { padding-left: 60px; }
}

.ybadge { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: #fc3f1d; border-radius: 6px; padding: 1px 6px; margin-right: 4px; vertical-align: 1px; }
a.ymap { display: flex; flex-direction: column; gap: 2px; margin: 12px 0; padding: 14px 16px; border-radius: var(--r);
  background: #fc3f1d; color: #fff; text-decoration: none; box-shadow: var(--shadow); }
a.ymap b { font-size: 17px; }
a.ymap span { font-size: 13px; opacity: .9; }

.rlegend .r1::before { background: rgb(125,195,255); } .rlegend .r2::before { background: rgb(45,135,240); }
.rlegend .r3::before { background: rgb(25,75,205); } .rlegend .r4::before { background: rgb(150,60,210); }

.vrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rainhint { font-size: 11.5px; font-weight: 500; color: var(--text-3); background: var(--surface-2); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.wetlist { font-size: 13px; color: var(--text-2); margin-top: 8px; line-height: 1.5; }

.wetlist b { color: var(--text); font-weight: 600; }
