:root {
  color-scheme: light;
  --bg: #e9eef2;
  --surface: #ffffff;
  --surface-2: #f3f6f8;
  --ink: #13202b;
  --ink-2: #455665;
  --muted: #7a8a97;
  --line: #d6dee5;
  --accent: #1f6fb2;
  --gust: #d4462c;
  --night: rgba(19, 32, 43, 0.06);
  --band: rgba(19, 32, 43, 0.08);
  --warn-bg: #fdecea;
  --warn-ink: #8f1d20;
  --cloud: #aab6c1;
  --moon: #8fa3b8;
  --radius: 10px;
  --font: "Barlow", system-ui, sans-serif;
  --font-num: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a141d;
    --surface: #111f2b;
    --surface-2: #162835;
    --ink: #e4ecf2;
    --ink-2: #a5b5c2;
    --muted: #6c8293;
    --line: #213546;
    --accent: #5aa7e6;
    --gust: #ff7a5c;
    --night: rgba(0, 0, 0, 0.28);
    --band: rgba(228, 236, 242, 0.10);
    --warn-bg: #3a1618;
    --warn-ink: #ffb4b0;
    --cloud: #8696a3;
    --moon: #c9d4de;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a141d; --surface: #111f2b; --surface-2: #162835; --ink: #e4ecf2; --ink-2: #a5b5c2;
  --muted: #6c8293; --line: #213546; --accent: #5aa7e6; --gust: #ff7a5c; --night: rgba(0,0,0,.28);
  --band: rgba(228,236,242,.10); --warn-bg: #3a1618; --warn-ink: #ffb4b0; --cloud: #8696a3; --moon: #c9d4de;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; }
h1, h2 { font-family: var(--font-num); font-weight: 600; margin: 0; letter-spacing: .01em; }
h2 { font-size: 1.35rem; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- hlavička */
.top {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.brand h1 { font-size: 2rem; line-height: 1; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.clock { text-align: right; }
.clock-time { font-family: var(--font-num); font-size: 2rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-temp { color: var(--muted); font-weight: 500; margin-right: .6em; }
.clock-water { margin-left: .5em; color: var(--accent); }
.clock-sub { color: var(--muted); font-size: .8rem; }
.clock-sub.bad { color: var(--gust); }

.scale { display: flex; justify-self: center; width: min(100%, 720px); position: relative; margin-bottom: 16px; }
.scale .z { flex: 1; text-align: center; font-size: .72rem; line-height: 1.15; padding: 4px 2px; }
.scale .z b { display: block; font-family: var(--font-num); font-size: 1rem; font-weight: 600; }
.scale .z:first-child { border-radius: 6px 0 0 6px; }
.scale .z:last-child { border-radius: 0 6px 6px 0; }
.scale .z.active { outline: 3px solid var(--ink); outline-offset: -3px; position: relative; z-index: 1; font-weight: 600; }
.scale .mark { position: absolute; top: -4px; bottom: -4px; width: 0; z-index: 3; transition: left .6s ease; }
.scale .mark::before { content: ""; position: absolute; bottom: 0; height: 9px; left: -2px; width: 4px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 1.5px var(--surface); }
.scale .mark span { position: absolute; top: 100%; left: 0; transform: translateX(-50%); margin-top: 2px; font-family: var(--font-num); font-weight: 700; font-size: .85rem; white-space: nowrap; color: var(--ink); line-height: 1; }
.scale .mark-gust::before { width: 0; left: -1px; height: 9px; background: none; border-left: 2px dashed var(--ink-2); box-shadow: none; }
.scale .mark-gust span { font-weight: 500; color: var(--ink-2); font-size: .75rem; }

main { padding: 18px 24px 40px; display: grid; gap: 18px; max-width: 2200px; margin: 0 auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 10px; }
.hint { margin: 0; color: var(--muted); font-size: .82rem; }
.empty { color: var(--muted); }

.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: none; }
.seg button { border: 0; background: transparent; padding: 5px 11px; cursor: pointer; font-size: .85rem; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.seg button:focus-visible, .strip .d:focus-visible, .cams a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle { font-size: .85rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.legend-inline { display: flex; gap: 14px; font-size: .8rem; color: var(--ink-2); margin-left: auto; }
.sw { display: inline-block; width: 16px; height: 3px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.sw-avg { background: var(--ink); }
.sw-gust { background: var(--gust); height: 2px; }
.sw-max { height: 0; border-top: 1px dashed var(--gust); opacity: .8; border-radius: 0; }
.sw-band { background: var(--band); height: 10px; }

/* ---------- verdikt */
.verdict {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; border-left: 10px solid var(--zone, var(--line));
}
.v-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.v-big { font-family: var(--font-num); font-size: 3.1rem; font-weight: 700; line-height: 1; }
.v-big small { font-size: .5em; font-weight: 600; color: var(--ink-2); }
.v-where { color: var(--muted); font-size: .85rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.v-items { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--ink-2); }
.v-items li::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin-right: 8px; vertical-align: middle; }
.alerts { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.alert { background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; padding: 3px 9px; font-weight: 600; font-size: .85rem; }
.verdict-days { display: grid; gap: 10px; align-content: start; }
.vday { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.vday-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; align-items: baseline; }
.vday-head b { font-family: var(--font-num); font-size: 1.15rem; font-weight: 600; }
.vday-range { font-family: var(--font-num); font-size: 1.15rem; }
.vday ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: .9rem; }
.vday li { display: flex; gap: 8px; align-items: center; }
.vday li.adv { font-weight: 600; }
.vday li i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.vday .none { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
/* okno plachtění 12:00–západ na 7 dní (místo samostatného řádku Helmsman) */
.sailwin { background: var(--surface-2); border-radius: 8px; padding: 8px 12px 10px; }
.sw-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; align-items: baseline; }
.sw-head b { font-family: var(--font-num); font-size: 1rem; font-weight: 600; }
.sw-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-top: 6px; }
.sw-day { display: grid; gap: 2px; justify-items: center; min-width: 0; }
.sw-day.far { opacity: .7; }
.sw-lbl { font-size: .7rem; color: var(--ink-2); cursor: help; }
.sw-cells { display: flex; gap: 1px; width: 100%; height: 20px; }
.sw-cells i { flex: 1; min-width: 0; border-radius: 2px; background: var(--line); }
.sw-cells i.past { opacity: .35; }
/* den s pravděpodobností Helmsman > 25 %: červený rámeček (barva zóny 18–20 kn z app.js) */
.sw-cells.hm { outline: 2px solid; outline-offset: 2px; border-radius: 3px; }

/* ---------- stanice */
/* tři karty a Windy vedle sebe od ~1280 px (16:9 i 16:10, i se škálováním 150 %) */
.live-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 1fr); gap: 18px; }
.stations { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; align-content: start; }
.st { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 10px; display: grid; gap: 6px; border-top: 6px solid var(--zone, var(--line)); }
.st.stale { opacity: .55; }
.st-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.st-name { font-family: var(--font-num); font-weight: 600; font-size: 1.2rem; color: var(--ink); text-decoration: none; }
.st-name:hover { text-decoration: underline; }
.st-age { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.st-body { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: center; }
.st-num { font-family: var(--font-num); font-weight: 700; font-size: 2.7rem; line-height: .95; font-variant-numeric: tabular-nums; }
.st-num small { font-size: .45em; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.trend { font-family: var(--font); font-size: .78rem; font-weight: 600; margin-left: 6px; white-space: nowrap; vertical-align: .6em; }
.trend.up, .trend.down { color: var(--ink); }
.trend.flat { color: var(--muted); font-weight: 500; }
.st-ms { color: var(--ink-2); font-size: .85rem; }
.st-facts { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; font-size: .85rem; margin-top: 4px; }
.st-facts dt { color: var(--muted); }
.st-facts dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-dir { text-align: center; font-size: .8rem; color: var(--ink-2); }
.st-note { color: var(--muted); font-size: .75rem; }
.spark-wrap { position: relative; padding-right: 36px; }
.spark { height: 60px; width: 100%; display: block; border-block: 1px dashed var(--line); }
.spark-wrap span { position: absolute; right: 0; font-size: .7rem; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark-hi { top: 0; }
.spark-lo { bottom: 0; }

.map-panel { padding: 0; overflow: hidden; min-height: 330px; }
.map-panel iframe { width: 100%; height: 100%; min-height: 330px; border: 0; display: block; }

/* ---------- grafy */
.chart { position: relative; min-height: 120px; }
.uplot { font-family: var(--font); }
.u-legend { font-size: .82rem; color: var(--ink-2); }
.u-legend .u-marker { border-radius: 2px; }
/* legenda grafu modelů na jeden řádek: menší mezery mezi položkami */
.u-legend .u-series > * { padding: 2px 3px; }
.u-legend .u-series { margin: 0 2px; }
.tt {
  position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: .82rem; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.tt b { font-family: var(--font-num); font-size: 1rem; }
.tt .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tt .row span:first-child { color: var(--muted); }

/* ---------- předpověď */
.fc-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.fc { border-collapse: separate; border-spacing: 0; font-size: .8rem; font-variant-numeric: tabular-nums; }
.fc th, .fc td { text-align: center; padding: 3px 0; min-width: 31px; border-right: 1px solid transparent; }
.fc th.rowh { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding: 3px 10px; min-width: 96px; color: var(--ink-2); font-weight: 500; border-right: 1px solid var(--line); }
.fc .day th { font-family: var(--font-num); font-size: .95rem; font-weight: 600; text-align: left; padding: 5px 8px; border-left: 2px solid var(--ink-2); background: var(--surface-2); }
.fc .day th.rowh { border-left: 0; }
.fc td.dstart { border-left: 2px solid var(--ink-2); }
.fc .hour td { color: var(--ink-2); }
.fc td.night { background: var(--night); }
.fc td.now { box-shadow: inset 2px 0 0 var(--accent); }
.fc .wind td, .fc .gust td { font-family: var(--font-num); font-size: 1rem; font-weight: 600; }
/* nárazy méně výrazné než průměr: nižší řádek, drobnější písmo */
.fc .gust td { font-size: .76rem; font-weight: 500; padding: 0; line-height: 1.35; }
.fc .gust th.rowh { font-size: .72rem; padding-block: 0; }
.fc .past { opacity: .5; }
.fc svg { display: block; margin: 0 auto; }
.fc .wx td { padding: 2px 0; }
.fc tr.temp td { position: relative; height: 44px; vertical-align: bottom; padding-bottom: 2px; }
.fc td.tc svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fc td.tc span { position: relative; font-family: var(--font-num); font-size: .95rem; font-weight: 600; }
.fc tr.precip td { position: relative; height: 26px; vertical-align: bottom; padding-bottom: 1px; }
.fc td.pc i { position: absolute; left: 4px; right: 4px; bottom: 0; background: #3987e5; opacity: .45; border-radius: 2px 2px 0 0; }
.fc td.pc span { position: relative; font-size: .75rem; }
.fc td.rp { color: var(--muted); font-size: .72rem; }

.strip-wrap { margin-top: 12px; }
.strip-title { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.strip { display: flex; gap: 2px; }
.strip .d { flex: 1; min-width: 0; cursor: pointer; border: 0; padding: 0; background: none; text-align: left; }
.strip .bars { display: flex; height: 22px; border-radius: 3px; overflow: hidden; }
.strip .bars span { flex: 1; }
.strip .lbl { font-size: .72rem; color: var(--ink-2); display: flex; justify-content: space-between; padding: 2px 2px 0; white-space: nowrap; overflow: hidden; }
.strip .lbl b { font-family: var(--font-num); font-weight: 600; }

/* ---------- ostatní */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; }
.nws-period { margin: 0 0 8px; font-size: .9rem; line-height: 1.4; }
.nws-period b { font-family: var(--font-num); font-size: 1rem; display: block; }
.nws-alerts { display: grid; gap: 6px; margin-bottom: 12px; }
.cams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.cams figure { margin: 0; }
.cams img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; display: block; background: var(--surface-2); }
.cams figure.off a { display: grid; place-items: center; aspect-ratio: 16/9; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .85rem; text-decoration: none; }
.cams figure.off a::after { content: attr(data-off); }
.cams figure.off img { display: none; }
.cams figcaption { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.status { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--muted); padding: 0 4px; }
.status .bad { color: var(--gust); }
.status .lang { margin-left: auto; display: inline-flex; gap: 2px; }
.status .lang button { font: inherit; color: var(--muted); background: none; border: 0; padding: 0 4px; cursor: pointer; }
.status .lang button[aria-pressed="true"] { color: var(--ink); font-weight: 600; cursor: default; }

@media (max-width: 1100px) {
  .top { grid-template-columns: 1fr auto; }
  .scale { grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .verdict, .live-row, .split { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .top { padding: 10px 16px; position: static; gap: 8px 12px; }
  .brand h1 { font-size: 1.5rem; white-space: nowrap; }
  .sub { display: none; }
  .clock-time { font-size: 1.35rem; white-space: nowrap; }
  .clock-temp { margin-right: .35em; }
  /* pruh 16 dní: 16 popisků se nevejde, posouvá se vodorovně */
  .strip { overflow-x: auto; scrollbar-width: none; }
  .strip .d { flex: none; width: 62px; }
  main { padding: 12px 16px 30px; }
  .scale .z { font-size: .6rem; }
  .v-big { font-size: 2.3rem; }
}
/* telefon na šířku: nízké okno, přilepená hlavička by zakrývala grafy */
@media (max-height: 500px) {
  .top { position: static; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } .scale .mark { transition: none; } }
.js-errors { margin: 0 24px 24px; padding: 10px 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; font-size: .8rem; white-space: pre-wrap; }
