:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --text: #14202b;
  --muted: #5d6b78;
  --line: #dde4ea;
  --accent: #1f6fb2;
  --temp: #c2512f;
  --wet: #1f6fb2;
  --on: #0f8a6c;
  --on-bg: #e2f4ee;
  --off-bg: #eef1f4;
  --good: #0f8a6c;
  --mid: #b7791f;
  --bad: #b23a3a;
  --shade: rgba(15, 138, 108, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e151c;
    --surface: #16202a;
    --text: #e6edf3;
    --muted: #93a2b1;
    --line: #26333f;
    --accent: #6cb2ee;
    --temp: #f08a66;
    --wet: #6cb2ee;
    --on: #4fd1a9;
    --on-bg: #133a30;
    --off-bg: #1f2a35;
    --good: #4fd1a9;
    --mid: #e6b35c;
    --bad: #f07a7a;
    --shade: rgba(79, 209, 169, .12);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

.top {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  justify-content: space-between; align-items: end;
  padding: 24px 16px 12px; max-width: 1280px; margin: 0 auto;
}
.sub, .meta, .hint { color: var(--muted); margin: 4px 0 0; }
.meta { font-size: .9rem; }
main { max-width: 1280px; margin: 0 auto; padding: 0 16px 48px; }

.resorts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--off-bg); color: var(--muted);
}
.badge.on { background: var(--on-bg); color: var(--on); }

.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.cam { margin: 0; position: relative; cursor: zoom-in; }
.cam img, .cam video { width: 100%; display: block; border-radius: 8px; background: #000; aspect-ratio: 16/9; object-fit: cover; }
.cam figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; gap: 6px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.tile .k { font-size: .78rem; color: var(--muted); }
.tile .v { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.tile.good .v { color: var(--good); }
.tile.mid .v { color: var(--mid); }
.tile.bad .v { color: var(--bad); }
.station { font-size: .8rem; color: var(--muted); margin: -6px 0 0; }

.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 10px; }
.chart .grid line { stroke: var(--line); }
.chart .ref { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .ref-label { fill: var(--muted); font-size: 10px; }
.chart .l-temp { stroke: var(--temp); fill: none; stroke-width: 2; }
.chart .l-wet { stroke: var(--wet); fill: none; stroke-width: 2; }
.chart .on-band { fill: var(--shade); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
.legend .i-temp { background: var(--temp); }
.legend .i-wet { background: var(--wet); }
.legend .sw { width: 14px; height: 10px; background: var(--shade); }

.archive { margin-top: 28px; }
.archive-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; }
.filters label { font-size: .85rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 12px; }
.shot { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.shot img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; background: #000; }
.shot .c { padding: 5px 8px; font-size: .78rem; display: flex; justify-content: space-between; gap: 4px; flex-wrap: wrap; }
.shot .c .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.shot .c .w { color: var(--muted); font-variant-numeric: tabular-nums; }
.shot.on { border-color: var(--on); }
.empty { color: var(--muted); padding: 24px 0; }

dialog {
  border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh;
}
dialog::backdrop { background: rgba(0, 0, 0, .85); }
dialog img, dialog video { max-width: 96vw; max-height: 86vh; display: block; margin: 0 auto; border-radius: 6px; }
dialog p { color: #fff; text-align: center; margin: 8px 0 0; font-size: .9rem; }
dialog .close {
  position: fixed; top: 10px; right: 14px; font-size: 2rem; line-height: 1;
  background: none; border: 0; color: #fff; cursor: pointer;
}
