:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --line: #e4e8ee;
  --accent: #1f6feb;
  --accent-soft: #e8f0fe;
  --warm: #d9480f;
  --cold: #1971c2;
  --rain: #4c8ed9;
  --ok: #2b8a3e;
  --bad: #c92a2a;
  --best: #fff4d6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151b;
    --panel: #1a2029;
    --text: #e6eaf0;
    --muted: #8b96a7;
    --line: #2a323e;
    --accent: #6ea8fe;
    --accent-soft: #1d2a40;
    --warm: #ff8a5c;
    --cold: #74b4ff;
    --rain: #5fa0ea;
    --ok: #69db7c;
    --bad: #ff8787;
    --best: #3a3220;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.top {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: .3px; }
header.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
header.top nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); }
header.top nav a.active, header.top nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }

header.top .admin-link { margin-left: auto; color: var(--muted); opacity: .45; display: inline-flex; padding: 6px; border-radius: 6px; }
header.top .admin-link:hover { opacity: 1; background: var(--accent-soft); color: var(--accent); }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; margin: 4px 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 20px;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.now { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin: 4px 0 14px; }
.now .cond { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; font-size: 13px; color: var(--muted); text-align: center; }
.now .cond img { width: 64px; height: 64px; }
.now .temp { font-size: 44px; font-weight: 700; line-height: 1; }
.now dl { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; font-size: 14px; }
.now dt { color: var(--muted); }
.now dd { margin: 0; font-weight: 600; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #fff0f0; color: var(--bad); }
.badge.ok { background: transparent; color: var(--ok); border: 1px solid currentColor; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
th.left, td.left { text-align: left; }
td.src { text-align: left; font-weight: 600; }
td.src .sub { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
tr.best td { background: var(--best); }
.fc-table:not(.expanded) .more { display: none; }
.fc-table .arrow-col { width: 1%; padding: 4px; }
.fc-toggle { font: inherit; font-size: 18px; line-height: 1; min-width: 30px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--accent); cursor: pointer; }
.fc-toggle:hover { background: var(--accent-soft); }
.fc-toggle .cnt { display: block; font-size: 10px; color: var(--muted); }
tr.own td { background: var(--accent-soft); }
tr.own td.src { color: var(--accent); }
.hi { color: var(--warm); font-weight: 600; }
.lo { color: var(--cold); }
.mm { display: block; font-size: 12px; color: var(--muted); }
.mm.wet { color: var(--rain); font-weight: 600; }
.ico { font-size: 18px; display: block; height: 30px; line-height: 30px; }
.ico img { width: 28px; height: 28px; vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; }
.err-pos { color: var(--warm); }
.err-neg { color: var(--cold); }
.rank { display: inline-block; min-width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: var(--line); font-size: 12px; font-weight: 700; }
.rank.r1 { background: #f2c94c; color: #3d2e00; }
.rank.r2 { background: #cfd6de; color: #222; }
.rank.r3 { background: #e3a87a; color: #3a1d05; }

.filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .group { display: flex; gap: 4px; align-items: center; }
.filters a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); font-size: 13px; }
.filters a.on { background: var(--accent); border-color: var(--accent); color: #fff; }

input[type=date], .btn { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.btn { cursor: pointer; background: var(--accent); border-color: var(--accent); color: #fff; }
td.src-note { font-size: 11px; color: var(--muted); }
select { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
.controls .filters { margin-bottom: 10px; }
.controls .filters:last-child { margin-bottom: 0; }
.filters .group { flex-wrap: wrap; min-width: 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; user-select: none; max-width: 100%; }
.chk .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk.off { opacity: .45; cursor: default; }
.chk .sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex: none; background: var(--c); }
.chk .sw.dash { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 6px); border: 1px solid var(--c); }
#cmp-source { max-width: 220px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; align-items: center; }
.tabs button { font: inherit; background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; color: var(--muted); cursor: pointer; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .spacer { flex: 1; }
.tabs button.link { color: var(--accent); }
.chart-box { position: relative; height: 420px; }
.table-box { max-height: 560px; overflow: auto; }
.table-box thead th { position: sticky; top: 0; background: var(--panel); }
.player { display: flex; align-items: center; gap: 6px; margin: 4px 0 12px; flex-wrap: wrap; }
.player button { font: inherit; min-width: 36px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); cursor: pointer; }
.player input[type=range] { flex: 1; min-width: 160px; }
.player #stamp, .player #m-stamp { min-width: 110px; font-weight: 600; }
.frame-box { text-align: center; background: #0b0f14; border-radius: 8px; padding: 6px; min-height: 200px; }
.frame-box img { max-width: 100%; height: auto; display: inline-block; }
#map { height: 520px; border-radius: 8px; }
.hourly { position: relative; }
.hourly .hc-temp { position: relative; height: 300px; }
.hourly .hc-rain { position: relative; height: 150px; margin-top: 6px; }
.hourly .hc-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.hourly-details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.hourly-details summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; padding: 4px 0; }
.hourly-details[open] summary { margin-bottom: 8px; }
.chart { width: 100%; height: 220px; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.zero { stroke: var(--cold); stroke-dasharray: 3 3; }
.chart .grid.day { stroke: var(--muted); stroke-dasharray: 2 4; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .temp { fill: none; stroke: var(--warm); stroke-width: 2; }
.chart .rain { fill: var(--rain); opacity: .7; }

.note { font-size: 13px; color: var(--muted); }
.empty { padding: 16px; text-align: center; color: var(--muted); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
td.err { white-space: normal; text-align: left; font-size: 12px; color: var(--bad); max-width: 420px; }
footer { text-align: center; font-size: 12px; color: var(--muted); padding: 16px; }

@media (max-width: 640px) {
  header.top { padding: 10px 16px; gap: 10px; }
  .now .temp { font-size: 36px; }
  th, td { padding: 5px 6px; }
}
[hidden] { display: none !important; }
/* forecast tables: the source column stays visible while scrolling sideways */
.fc-table th:first-child, .fc-table td.src { position: sticky; left: 0; z-index: 1; background: var(--panel); box-shadow: 1px 0 0 var(--line); }
.fc-table tr.own td.src { background: var(--accent-soft); }
.fc-table tr.best td.src { background: var(--best); }
@media (max-width: 640px) { .fc-table td.src { white-space: normal; min-width: 96px; max-width: 120px; } }

.player .ends { display: flex; justify-content: space-between; font-size: 11px; line-height: 1.2; color: var(--muted); width: 100%; margin-top: 4px; padding: 0 2px; }
.player .track { flex: 1; min-width: 160px; display: flex; flex-direction: column; padding-top: 6px; }
.player button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px; border-radius: 50%; padding: 0; }
.player button.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 42px; height: 42px; font-size: 16px; }
.player #stamp, .player #m-stamp { min-width: 120px; font-weight: 600; text-align: right; }

/* clickable days in the forecast table */
.fc-table [data-date] { cursor: pointer; }
.fc-table thead th.day:hover, .fc-table td.day:hover { background: var(--accent-soft); }
.fc-table thead th.day { text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }

/* one day by the hour */
#day-dialog { width: min(1180px, 96vw); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
#day-dialog::backdrop { background: rgba(0,0,0,.5); }
#day-dialog .dd-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#day-dialog .dd-head h2 { margin: 0; font-size: 17px; }
#day-dialog .dd-head .spacer { flex: 1; }
#day-dialog .dd-head button { font: inherit; font-size: 18px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; }
#day-dialog .dd-head button:hover { background: var(--accent-soft); color: var(--accent); }
#day-dialog .dd-body { padding: 8px 16px 16px; }
#day-dialog .dd-scroll { max-height: calc(90vh - 150px); overflow: auto; }
.dd-table { font-size: 13px; }
.dd-table thead th { position: sticky; top: 0; z-index: 2; background: var(--panel); white-space: normal; min-width: 72px; vertical-align: bottom; }
.dd-table thead th .sub { font-weight: 400; font-size: 11px; color: var(--muted); }
.dd-table th.hour { position: sticky; left: 0; z-index: 1; background: var(--panel); text-align: left; min-width: 52px; }
.dd-table thead th.hour { z-index: 3; }
.dd-table td { padding: 3px 6px; }
.dd-table td .ico { height: 26px; line-height: 26px; }
.dd-table td .ico img { width: 26px; height: 26px; }
.dd-table td .t { display: block; font-weight: 600; }
.dd-table th.own, .dd-table td.own { background: var(--accent-soft); }
.dd-table th.obs, .dd-table td.obs { border-right: 2px solid var(--line); }
.dd-table tr.past td:not(.obs), .dd-table tr.past th.hour { opacity: .55; }

/* ---------- scrollbars: thin and in the page colours (no default white bars in dark mode) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
:root { --scroll-thumb: #c3cad4; --scroll-thumb-hover: #9aa4b2; }
@media (prefers-color-scheme: dark) { :root { --scroll-thumb: #3a4452; --scroll-thumb-hover: #566173; } }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- range sliders (time sliders), same look everywhere ---------- */
input[type=range] {
  -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
  height: 28px; margin: 0; --pct: 100%;
}
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0 var(--pct), var(--line) var(--pct) 100%);
}
input[type=range]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -6px; border-radius: 50%;
  background: var(--panel); border: 3px solid var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform .12s, box-shadow .12s;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 3px solid var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: transform .12s, box-shadow .12s;
}
input[type=range]:hover::-webkit-slider-thumb, input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type=range]:hover::-moz-range-thumb, input[type=range]:active::-moz-range-thumb { transform: scale(1.15); }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--accent-soft), 0 1px 4px rgba(0,0,0,.35); }
input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px var(--accent-soft), 0 1px 4px rgba(0,0,0,.35); }
input[type=range]:disabled { opacity: .45; cursor: default; }
