/* povodne.Dataviz – světlý vzhled */
:root {
  /* dvoutónová paleta podle obálky Floodscapes: tyrkysová souš, ultramarínová voda, limetkové akcenty */
  --bg: #5cb8c0;
  --panel: rgba(243, 250, 247, 0.93);
  --panel-solid: #f6fbf9;
  --line: #cde2e0;
  --fg: #0d1b55;
  --fg2: #27366f;
  --muted: #5b6b8b;
  --accent: #1d2c93;
  --accent-soft: #dff0ed;
  --lime: #eef39a;
  --line-ui: rgba(255,255,255,.3);
  --chip-on-ink: #101c63;
  --accent-ui: #101c63;
  --deep: #101c63;
  --ink: #ffffff;
  --ink2: rgba(255, 255, 255, .78);
  /* záplavová území – jeden odstín, v mapě se překryvy sčítají */
  --zone: #1d2c93;
  --q5: rgba(29, 44, 147, .78);
  --q20: rgba(29, 44, 147, .56);
  --q100: rgba(29, 44, 147, .38);
  --q500: rgba(29, 44, 147, .2);
  --azz: #eef39a;
  /* rozlivy */
  --rozliv: #0e1766;
  --rozliv-edge: #8ea6ff;
  /* stupně povodňové aktivity (pořadová škála + velikost kroužku) */
  --spa0: #d6efec;
  --spa1: #f0c419;
  --spa2: #ec7014;
  --spa3: #cf2327;
  --spa4: #ff7ad1;
  --st-ring: #0d1b55;
  --shadow: 0 1px 2px rgba(10, 30, 70, .12), 0 8px 26px rgba(10, 30, 70, .16);
  --r: 12px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
#map { position: fixed; inset: 0; background: var(--bg); }
canvas.proudy, canvas.tok { position: absolute; left: 0; top: 0; pointer-events: none; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }

.panel { position: fixed; z-index: 5; color: var(--ink); }

/* značka – bez boxu, přímo na mapě */
.brand-box { top: 16px; left: 18px; pointer-events: none; }

.brand-box a { pointer-events: auto; }
.brand img { display: block; height: 26px; width: auto;  }
.brand { display: inline-flex; text-decoration: none; }
.tagline { margin: 5px 0 0 2px; font-size: 12.5px; color: var(--ink2); }

/* vrstvy – přechod z mapy do modré zprava */
.layers {
  top: 0; right: 0; width: 320px; max-height: calc(100vh - var(--tl-h, 200px) + 10px); overflow: auto;
  padding: 18px 20px 30px 58px;
  background: linear-gradient(to left, var(--deep) calc(100% - 60px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 40px), transparent);
  scrollbar-width: thin;
}
.layers h3 { margin: 12px 0 5px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--lime); }
.layers h3:first-child { margin-top: 0; }
.lyr { display: flex; align-items: center; gap: 9px; padding: 3px 0; cursor: pointer; user-select: none; color: var(--ink); }
.lyr input { margin: 0; accent-color: var(--lime); }
.lyr .sw { width: 18px; height: 12px; border-radius: 3px; flex: none; background: var(--bg); box-shadow: inset 0 0 0 20px var(--c, transparent), 0 0 0 1px rgba(255,255,255,.35); }
.lyr .sw.line { background: var(--bg) !important; border: 2px solid var(--azz); box-shadow: none; }
.lyr .sw.flow { background: linear-gradient(90deg, #e2faf5 0 20%, transparent 20% 28%, #f3ec7a 28% 48%, transparent 48% 56%, #f8a43c 56% 76%, transparent 76% 84%, #ff7ad1 84% 100%); box-shadow: none; }
.flow-legend { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink2); margin: 2px 0 4px 27px; }
.flow-legend .ramp { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #e2faf5, #f3ec7a 30%, #f8a43c 55%, #ee4c3c 78%, #ff7ad1); }
.lyr small { color: var(--ink2); margin-left: auto; font-size: 11.5px; }
.spa-legend { list-style: none; margin: 4px 0 0; padding: 0 0 0 2px; }
.spa-legend li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink); padding: 1.5px 0; }
.spa-legend .dot { border-radius: 50%; flex: none; border: 1.5px solid var(--deep); box-shadow: 0 0 0 1px rgba(255,255,255,.4); }
.layers details { margin-top: 12px; border-top: 1px solid var(--line-ui); padding-top: 9px; }
.layers summary { cursor: pointer; color: var(--lime); font-size: 13px; }
.layers details p { font-size: 12.5px; color: var(--ink2); margin: 7px 0; }
.layers details p b { color: var(--ink); }
.layers details p.src { color: var(--ink2); font-size: 11.5px; }
.layers a { color: var(--lime); }
.layers-toggle { display: none; }

/* časová osa – bez boxu, mapa přechází do plné modré */
.timeline {
  left: 0; right: 0; bottom: 0; padding: 70px 22px 14px;
  background: linear-gradient(to bottom, transparent 0, var(--deep) 110px);
  pointer-events: none;
}
.timeline > * { pointer-events: auto; }
.tl-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tl-title { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; color: var(--ink); }
.tl-sub { color: var(--ink2); font-size: 13px; }
.tl-sub b { color: var(--ink); font-weight: 600; }
.chips { display: flex; gap: 5px; overflow-x: auto; padding: 8px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line-ui); background: transparent; border-radius: 999px;
  padding: 3px 10px; font-size: 12.5px; cursor: pointer; color: var(--ink2); white-space: nowrap;
}
.chip.minor { font-size: 11.5px; padding: 2px 8px; color: var(--ink2); }
.chip.major { font-weight: 600; color: var(--ink); }
.chip:hover { border-color: var(--ink2); }
.chip.on { background: var(--lime); border-color: var(--lime); color: var(--chip-on-ink); }
.chip .ico { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--spa3); margin-right: 6px; vertical-align: 1px; }
.chip.on .ico { background: var(--chip-on-ink); }

.chart-wrap { position: relative; }
canvas.chart { display: block; width: 100%; cursor: pointer; }
#overview { height: 74px; }

.detail { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-ui); }
.detail[hidden] { display: none; }
.play {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--lime); color: var(--chip-on-ink);
  cursor: pointer; font-size: 14px; display: grid; place-items: center; box-shadow: 0 0 0 4px rgba(238,243,154,.15);
}
.play:hover { filter: brightness(1.06); }
.ev-track { position: relative; }
#evchart { height: 46px; }
#t { position: absolute; left: 0; right: 0; bottom: -6px; width: 100%; margin: 0; opacity: 0; height: 58px; cursor: pointer; }
.ev-time { font-family: var(--mono); font-size: 13px; color: var(--ink); white-space: nowrap; text-align: right; }
.ev-time .cnt { display: block; font-family: Inter, system-ui, sans-serif; font-size: 11.5px; color: var(--ink2); }
.speed { display: inline-flex; border: 1px solid var(--line-ui); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.speed button { white-space: nowrap; border: 0; background: transparent; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--ink2); }
.speed button.on { background: rgba(238,243,154,.18); color: var(--lime); font-weight: 600; }
.ev-note { margin: 6px 0 0; font-size: 12px; color: var(--ink2); }

/* bublina grafu */
.tip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--panel-solid); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px 9px;
  font-size: 12.5px; line-height: 1.4; max-width: 280px; display: none;
}
.tip b { font-weight: 600; }
.tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* vyskakovací okno na mapě */
.maplibregl-popup-content { border-radius: 10px !important; padding: 11px 13px 10px !important; box-shadow: var(--shadow) !important; font: 13px/1.45 Inter, system-ui, sans-serif; color: var(--fg); }
.maplibregl-popup-close-button { font-size: 18px; padding: 0 6px; color: var(--muted); }
.pp h4 { margin: 0 18px 2px 0; font-size: 14px; }
.pp .sub { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.pp ul { margin: 4px 0 0; padding-left: 16px; }
.pp li { margin: 1px 0; }
.pp .no { color: var(--muted); }
.pp .warn { color: var(--muted); font-size: 11.5px; margin-top: 7px; }
.pp svg { display: block; margin-top: 4px; }
.pp .lv { display: inline-block; padding: 0 6px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; }

.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(var(--tl-h, 190px) - 40px); }
.maplibregl-ctrl-group { background: var(--accent-ui) !important; box-shadow: none !important; }
.maplibregl-ctrl-group button { filter: invert(1) brightness(1.2); }
.maplibregl-ctrl-group button + button { border-top-color: rgba(0,0,0,.25) !important; }
.maplibregl-ctrl-scale { background: transparent; border-color: var(--ink); color: var(--ink); }
.maplibregl-ctrl-attrib.maplibregl-compact { background: rgba(255,255,255,.85); }

.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; pointer-events: none; color: #fff; font-size: 13px; }
.loading[hidden] { display: none; }

@media (max-width: 760px) {
  .brand-box { top: 12px; left: 12px; }
  .brand img { height: 21px; }
  .tagline { display: none; }
  .layers-toggle {
    display: block; position: fixed; z-index: 6; top: 10px; right: 10px; border: 0;
    background: var(--deep); color: #fff; border-radius: 999px; padding: 7px 14px; cursor: pointer; box-shadow: 0 2px 10px rgba(8,18,70,.35);
  }
  .layers { top: 0; right: 0; left: 0; width: auto; max-height: 70vh; display: none; padding: 58px 18px 30px; background: linear-gradient(to bottom, var(--deep) 80%, transparent); }
  body.show-layers .layers { display: block; }
  .timeline { padding: 56px 12px 10px; }
  .tl-title { font-size: 16px; }
  .tl-sub { font-size: 12px; }
  #overview { height: 54px; }
  .tl-sub .reky { display: none; }
  .ev-note { font-size: 11px; }
  #evchart { height: 38px; }
  .chips { padding: 6px 0 4px; }
  .ev-time { font-size: 12px; }
  .detail { grid-template-columns: auto 1fr; }
  .ev-side { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; align-items: center; }
  .maplibregl-ctrl-scale { display: none; }
  .ev-time .cnt { display: inline; margin-left: 8px; }
  .speed { margin-top: 0; }
}

/* přepínač konceptů */
.koncepty { position: fixed; z-index: 7; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; align-items: center;
  font-size: 12px; color: var(--ink2); }
.koncepty span { margin-right: 4px; }
.koncepty a { text-decoration: none; color: var(--ink); border: 1px solid var(--line-ui); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.koncepty a.on { background: var(--lime); color: var(--chip-on-ink); border-color: var(--lime); font-weight: 600; }
body[data-theme="A"] .lyr .sw { box-shadow: inset 0 0 0 20px var(--c, transparent), 0 0 0 1px rgba(29,79,134,.35); }
body[data-theme="A"] .play { box-shadow: none; }
body[data-theme="A"] .lyr input, body[data-theme="A"] .layers details p b { accent-color: #1d4f86; color: #1d4f86; }
@media (max-width: 760px) { .koncepty { top: auto; bottom: calc(var(--tl-h, 190px) - 30px); } .koncepty span { display: none; } }

.lyr .sw.hatch { background: repeating-linear-gradient(135deg, rgba(47,106,168,.75) 0 1px, rgba(127,176,220,.25) 1px 4px) !important; box-shadow: 0 0 0 1px rgba(29,79,134,.45); }

.rada { margin-left: 6px; }
.rada[hidden] { display: none; }
@media (min-width: 761px) { .ev-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; } .ev-side .speed { margin-top: 0; } }

.lyr .sw.koryto { background: linear-gradient(90deg, transparent 0 10%, #6a9fd8 10% 90%, transparent 90%), var(--bg) !important; background-size: 100% 4px !important; background-repeat: no-repeat !important; background-position: center !important; box-shadow: none; }
