:root {
  --bg: rgba(18, 26, 34, 0.9); --line: rgba(255, 255, 255, 0.12); --fg: #e9eef2; --dim: #9fb0bd;
  --acc: #4fb3ff; --warn: #f2d43c; --bad: #e02d28;
  font: 13px/1.4 system-ui, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #a9c8dc; color: var(--fg); }
#view { position: fixed; inset: 0; }
#view canvas { display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; color: #fff; font-weight: 600; font-size: 12px;
  text-shadow: 0 0 3px #000, 0 0 6px rgba(0, 0, 0, 0.8); pointer-events: none; will-change: transform; }
.lbl.town { font-size: 14px; } .lbl.hamlet { font-weight: 400; font-size: 11px; opacity: 0.9; }
.lbl.lake { color: #bfe6ff; font-style: italic; } .lbl.peak { font-weight: 400; font-size: 11px; color: #f0e6d0; }
.lbl.gauge { pointer-events: auto; cursor: pointer; background: rgba(18, 26, 34, 0.85); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px; font-weight: 400; text-shadow: none; }
.lbl.gauge b { color: var(--acc); }

.panel { position: fixed; background: var(--bg); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 8px; }
#left { left: 10px; top: 10px; bottom: 10px; width: 300px; overflow-y: auto; padding: 12px; }
#right { right: 10px; top: 10px; bottom: 64px; width: 330px; overflow-y: auto; padding: 12px; }
#timeline { left: 320px; right: 350px; bottom: 10px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
#timeline input { flex: 1; } #vTime { min-width: 150px; text-align: right; font-variant-numeric: tabular-nums; }
#info { left: 320px; top: 10px; max-width: 320px; padding: 10px 12px; }
#info h3 { margin: 0 0 4px; font-size: 13px; } #info .x { float: right; cursor: pointer; color: var(--dim); margin-left: 10px; }
#info table { border-collapse: collapse; } #info td { padding: 1px 8px 1px 0; } #info td:first-child { color: var(--dim); }
#busy { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); background: var(--bg); padding: 4px 12px; border-radius: 12px; font-size: 12px; }

header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
h1 { font-size: 17px; margin: 0; } h1 span { font-weight: 400; color: var(--dim); font-size: 13px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); margin: 14px 0 6px; }
section { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 10px; }
section:first-of-type { border-top: 0; }
.tabs, .seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tabs button, .seg button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 7px 4px; }
.tabs button.on, .seg button.on, #btnMax.on { background: var(--acc); color: #06202f; font-weight: 600; }
button { font: inherit; color: var(--fg); background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; cursor: pointer; }
button:hover { background: rgba(255, 255, 255, 0.16); }
button.link { background: none; border: 0; color: var(--acc); padding: 0; }
button.wide { width: 100%; margin-top: 4px; } button.armed { background: #ff3df0; color: #000; }
.row { display: block; margin-top: 10px; color: var(--dim); }
.row b { float: right; color: var(--fg); font-variant-numeric: tabular-nums; }
.row input[type=range], .row select { display: block; width: 100%; margin-top: 4px; }
select { font: inherit; color: var(--fg); background: #1c2832; border: 1px solid var(--line); border-radius: 5px; padding: 5px; }
input[type=range] { accent-color: var(--acc); }
.chk { display: inline-block; margin: 8px 12px 0 0; }
.note { color: var(--dim); font-size: 12px; margin-top: 6px; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
.presets button { text-align: left; font-size: 12px; line-height: 1.25; padding: 6px 8px; }
.presets button small { display: block; color: var(--dim); }
.presets button.on { border-color: var(--acc); background: rgba(79, 179, 255, 0.18); }
.places { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.places button { font-size: 12px; padding: 3px 7px; }
#rainChart { width: 100%; height: 75px; margin-top: 8px; background: rgba(0, 0, 0, 0.25); border-radius: 4px; }
#legend { margin-top: 8px; font-size: 12px; }
#legend .it { display: inline-flex; align-items: center; gap: 4px; margin: 0 8px 3px 0; }
#legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
#legend .bar { height: 10px; border-radius: 3px; margin-bottom: 2px; }
#legend .ticks { display: flex; justify-content: space-between; color: var(--dim); }

#headline { font-size: 15px; font-weight: 600; padding: 8px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); }
#headline small { display: block; font-weight: 400; font-size: 12px; color: var(--dim); margin-top: 2px; }
#headline.l1 { background: rgba(70, 190, 110, 0.22); } #headline.l2 { background: rgba(242, 212, 60, 0.25); }
#headline.l3 { background: rgba(240, 138, 30, 0.3); } #headline.l4 { background: rgba(224, 45, 40, 0.38); }
#kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.kpi { background: rgba(255, 255, 255, 0.06); border-radius: 6px; padding: 6px 8px; }
.kpi b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; } .kpi span { color: var(--dim); font-size: 11px; }
details { border-top: 1px solid var(--line); padding: 6px 0; }
summary { cursor: pointer; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--dim); }
.list { margin-top: 4px; }
.item { display: flex; justify-content: space-between; gap: 8px; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.item:hover { background: rgba(255, 255, 255, 0.08); }
.item .sub { color: var(--dim); font-size: 11px; } .item .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; border-radius: 3px; padding: 0 5px; font-size: 11px; font-weight: 600; color: #111; }
.dots i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 2px; }
.empty { color: var(--dim); padding: 4px 6px; }
.alert { padding: 6px 8px; border-left: 3px solid var(--warn); background: rgba(242, 212, 60, 0.1); margin-bottom: 4px; border-radius: 0 4px 4px 0; }
.alert.severe, .alert.extreme { border-color: var(--bad); background: rgba(224, 45, 40, 0.14); }

#loading { position: fixed; inset: 0; background: #16212b; display: grid; place-items: center; z-index: 10; }
#loading .box { text-align: center; } #loading h1 { font-size: 26px; margin-bottom: 10px; }
dialog { max-width: 620px; background: #16212b; color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; font-size: 14px; line-height: 1.5; }
dialog::backdrop { background: rgba(0, 0, 0, 0.55); } dialog h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--fg); margin-top: 0; }
dialog li { margin-bottom: 6px; } dialog form { text-align: right; }

@media (max-width: 900px) {
  #left { width: 250px; } #right { display: none; } #timeline { left: 270px; right: 10px; } #info { left: 270px; }
}
