/* Barvy vycházejí z webu plavanikralupy.cz: námořnická modř + zlatý akcent */
:root {
  --navy: #253f5b;
  --navy-deep: #1a2e44;
  --gold: #d2a35c;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #17212d;
  --muted: #64717f;
  --line: #e1e6ec;
  --soft: #eaeff5;
  --hit: #fbf1df;
  --hit-edge: #d2a35c;
  --accent-ink: #253f5b;
  --bad: #c0392b;
  --good: #1c8a52;
  --shadow: 0 1px 2px rgb(23 33 45 / .06), 0 4px 14px rgb(23 33 45 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1721;
    --surface: #17232f;
    --ink: #e9eef4;
    --muted: #93a1b0;
    --line: #26384a;
    --soft: #1f3042;
    --hit: #3a3120;
    --accent-ink: #e3bd82;
    --bad: #ef7d70;
    --good: #5fd39a;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1721;
  --surface: #17232f;
  --ink: #e9eef4;
  --muted: #93a1b0;
  --line: #26384a;
  --soft: #1f3042;
  --hit: #3a3120;
  --accent-ink: #e3bd82;
  --bad: #ef7d70;
  --good: #5fd39a;
  --shadow: none;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 130px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.4 Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 14px; }
[hidden] { display: none !important; }

/* ---------- záhlaví ---------- */
.top { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%); color: #fff;
  padding-top: env(safe-area-inset-top, 0); border-bottom: 3px solid var(--gold); }
.top .wrap { padding-top: 16px; padding-bottom: 14px; position: relative; }
.top .eyebrow, .top h1 { padding-right: 46px; }
.theme { position: absolute; right: 14px; top: 12px; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid rgb(255 255 255 / .25); border-radius: 3px; background: rgb(255 255 255 / .08); color: #fff; padding: 0; }
.theme:hover { background: rgb(255 255 255 / .16); }
.theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme .moon, :root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.top h1 { margin: 4px 0 2px; font-size: clamp(21px, 5.4vw, 30px); line-height: 1.12; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
.top p { margin: 0; color: #c9d5e2; font-size: 14px; }

/* ---------- přilepená lišta ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgb(23 33 45 / .06); padding-top: env(safe-area-inset-top, 0); }
.tabs { display: flex; gap: 4px; padding-top: 6px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 6px 9px; font-weight: 700; color: var(--muted);
  border-bottom: 3px solid transparent; border-radius: 0; }
.tabs button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--gold); }
.tools { display: flex; gap: 8px; align-items: center; padding: 8px 0; }
.search { position: relative; flex: 1; min-width: 0; }
.search input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg);
  padding: 0 38px 0 38px; font-size: 16px; outline: none; }
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgb(210 163 92 / .25); }
.search::before { content: ""; position: absolute; left: 14px; top: 13px; width: 11px; height: 11px;
  border: 2px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search::after { content: ""; position: absolute; left: 25px; top: 26px; width: 6px; height: 2px; background: var(--muted);
  transform: rotate(45deg); pointer-events: none; }
.search .clear { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: none; color: var(--muted); font-size: 20px; line-height: 1; }
.suggest { position: absolute; left: 0; right: 0; top: 46px; margin: 0; padding: 4px; list-style: none; background: var(--surface);
  border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 12px 32px rgb(0 0 0 / .18); max-height: min(55vh, 380px); overflow: auto; z-index: 30; }
.suggest li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: 3px; cursor: pointer; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--soft); }
.suggest li small { color: var(--muted); white-space: nowrap; }
.suggest li.none { color: var(--muted); cursor: default; background: none; }
.seg { display: flex; background: var(--soft); border-radius: 4px; padding: 3px; flex: 0 0 auto; }
.seg button { border: 0; background: none; border-radius: 4px; padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow); }

.selrow { display: flex; align-items: center; gap: 8px; padding: 0 0 8px; font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 60%; background: var(--hit); border: 1px solid var(--hit-edge);
  color: var(--ink); border-radius: 4px; padding: 4px 4px 4px 12px; font-weight: 600; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; width: 24px; height: 24px; border-radius: 50%; font-size: 16px; line-height: 1; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; white-space: nowrap; cursor: pointer; }
.switch input { accent-color: var(--navy); width: 18px; height: 18px; margin: 0; }

.evnav { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.evnav::-webkit-scrollbar { display: none; }
.evnav a { flex: 0 0 auto; text-decoration: none; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
.evnav a b { color: var(--accent-ink); margin-right: 4px; }

/* ---------- obsah ---------- */
main { padding-top: 6px; padding-bottom: 70px; }
.event { margin-top: 22px; scroll-margin-top: 150px; }
.ev-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ev-no { flex: 0 0 auto; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 3px; background: var(--navy); color: #fff;
  font-weight: 800; display: grid; place-items: center; }
.ev-head h2 { margin: 0; font-size: 19px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.ev-head small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 1px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden; margin-top: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 12px; background: var(--soft);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.card-head span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }

.row { border-top: 1px solid var(--line); }
.card > .row:first-child, .card-head + .row { border-top: 0; }
.row > summary, .row > .line { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 12px; list-style: none; }
.row > summary { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.row > summary::-webkit-details-marker { display: none; }
.row.hit > summary, .row.hit > .line { background: var(--hit); box-shadow: inset 3px 0 0 var(--hit-edge); }
.pos { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--soft); color: var(--accent-ink); }
.pos.lane { border-radius: 3px; background: none; border: 1.5px solid var(--line); color: var(--muted); }
.pos.p1 { background: #e7b93c; color: #3b2c00; }
.pos.p2 { background: #c3ccd6; color: #232c36; }
.pos.p3 { background: #cf9463; color: #3a1f08; }
.pos.x { background: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.who { min-width: 0; }
.who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res { text-align: right; white-space: nowrap; }
.res b { display: block; font-weight: 700; font-size: 16px; }
.res b.entry { font-weight: 500; color: var(--muted); }
.res span { display: block; font-size: 12px; color: var(--muted); }
.res .tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--bad);
  border: 1px solid currentColor; border-radius: 2px; padding: 1px 6px; }
.res s { color: var(--muted); font-size: 12px; }
.up { color: var(--good); } .down { color: var(--bad); }

.detail { padding: 2px 12px 12px 56px; font-size: 13px; }
.row.hit > .detail { background: var(--hit); box-shadow: inset 3px 0 0 var(--hit-edge); }
.detail p { margin: 0 0 8px; color: var(--muted); }
.detail p.why { color: var(--bad); }
.splits { border-collapse: collapse; margin: 0 0 10px; }
.splits th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.splits th, .splits td { text-align: right; padding: 3px 0 3px 18px; border-bottom: 1px solid var(--line); }
.splits th:first-child, .splits td:first-child { padding-left: 0; text-align: left; color: var(--muted); }
.splits td:last-child { font-weight: 600; }
.follow { display: flex; flex-wrap: wrap; gap: 6px; }
.follow button { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }

/* ---------- program ---------- */
.prog a, .prog div.item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px;
  border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.prog .pos { border-radius: 3px; }
.prog small { color: var(--muted); font-size: 12px; }
.prog a::after { content: "›"; color: var(--muted); font-size: 20px; }

.empty { text-align: center; color: var(--muted); padding: 56px 16px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 14px 28px; }

@media (min-width: 640px) {
  body { font-size: 16px; }
  .row > summary, .row > .line { grid-template-columns: 38px minmax(0, 1fr) auto; padding: 10px 16px; }
  .detail { padding-left: 64px; }
  .who b { display: inline; } .who span { display: inline; margin-left: 10px; font-size: 13.5px; }
}
@media print {
  .bar { position: static; } .tools, .selrow, .evnav { display: none; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* ---------- import ---------- */
.drop { display: block; margin-top: 18px; border: 2px dashed var(--line); border-radius: 4px; background: var(--surface);
  padding: 34px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over, .drop:focus-within { border-color: var(--gold); background: var(--hit); }
.drop b { display: block; font-size: 18px; }
.drop span { color: var(--muted); font-size: 14px; }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.btn { display: inline-block; border: 0; border-radius: 3px; background: var(--navy); color: #fff; font-weight: 700; padding: 11px 18px; text-decoration: none; }
.btn.ghost { background: none; color: var(--accent-ink); border: 1px solid var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 3px; }
.btn.danger { background: none; border: 1px solid var(--line); color: var(--bad); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: 14px; margin-top: 16px; }
.panel h2 { margin: 0 0 10px; font-size: 16px; }
.log { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.log li { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--good); border-radius: 3px; padding: 10px 12px; font-size: 14px; }
.log li.err { border-left-color: var(--bad); }
.log li.busy { border-left-color: var(--gold); }
.log small { display: block; color: var(--muted); }
.log .warn { color: var(--bad); }
.slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.slot:first-of-type { border-top: 0; }
.slot small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.field { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: 3px; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 3px;
  background: var(--bg); font-size: 16px; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.note { color: var(--muted); font-size: 13px; }
