/* MORAVIA TIMING — vlastní prohlížeč výsledků (náhrada G-Live) */

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --fg: #1c242c;
  --muted: #5b6570;
  --faint: #9aa3ad;
  --line: #e3e6ea;
  --even: #f8f9fb;
  --hover: #fff3ec;
  --accent: #ff5a1f;
  --accent-dark: #e0440b;
  --navy: #0f1720;
  --gold: #d9a400;
  --silver: #8d96a0;
  --bronze: #b3703a;
  --ok: #1e9e4a;
  --warn: #e0440b;
  --radius: 10px;
  --shadow: 0 2px 14px rgba(15, 23, 32, .07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171d; --card: #1a2129; --fg: #e8ecf0; --muted: #a3adb8; --faint: #6f7a86;
    --line: #2a333d; --even: #1e262f; --hover: #2b2118; --accent-dark: #ff7a4a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12171d; --card: #1a2129; --fg: #e8ecf0; --muted: #a3adb8; --faint: #6f7a86;
  --line: #2a333d; --even: #1e262f; --hover: #2b2118; --accent-dark: #ff7a4a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- záhlaví ---------- */
.hdr { background: var(--navy); color: #fff; border-bottom: 4px solid var(--accent); }
.hdr-in { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.ev-logo { height: 64px; width: auto; max-width: 140px; object-fit: contain; border-radius: 6px; background: #fff; padding: 3px; }
.ev-txt { flex: 1; min-width: 0; }
.ev-txt h1 { margin: 0; font-size: 1.55rem; line-height: 1.2; font-weight: 800; }
.ev-sub { margin: 4px 0 0; color: #c4ccd4; font-size: .9rem; }
.mt-logo { background: #fff; border-radius: 8px; padding: 5px 10px; }
.mt-logo img { height: 36px; width: auto; display: block; }

/* ---------- stavový řádek ---------- */
.statusbar { display: flex; align-items: center; gap: 10px; padding: 12px 0 4px; flex-wrap: wrap; }
.spacer { flex: 1; }
.saved { color: var(--muted); font-size: .82rem; }
.chip { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: .82rem; font-weight: 700;
  background: var(--line); color: var(--fg); font-variant-numeric: tabular-nums; }
.chip.live { background: #fde8df; color: var(--accent-dark); }
.chip.live::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%;
  background: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.chip.done { background: #e4f3ea; color: var(--ok); }
:root[data-theme="dark"] .chip.live { background: #3a2417; }
:root[data-theme="dark"] .chip.done { background: #173022; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.live { background: #3a2417; }
  :root:not([data-theme="light"]) .chip.done { background: #173022; }
}
.icon-btn { border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 8px;
  width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; line-height: 1; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.icon-btn.spin { animation: rot .7s linear; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- záložky ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-top: 6px; overflow-x: auto; }
.tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; padding: 10px 16px;
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }

/* ---------- filtry ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 0 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 7px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.filters select, .filters input {
  font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.filters input { flex: 1; min-width: 180px; max-width: 360px; }
.filters select { max-width: 100%; }
.filters select:focus, .filters input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.count { margin-left: auto; color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* ---------- tabulka výsledků ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.tscroll { overflow-x: auto; }
table.res { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.res th { position: sticky; top: 0; background: var(--card); text-align: left; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 10px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.res td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.res tbody tr:nth-child(even) td { background: var(--even); }
.res tbody tr[data-bib] { cursor: pointer; }
.res tbody tr[data-bib]:hover td, .res tbody tr[data-bib]:focus td { background: var(--hover); outline: none; }
.res .r { text-align: right; }
.res .c { text-align: center; }
.res td.pl { font-weight: 800; font-size: 1.05rem; width: 44px; color: var(--muted); }
.res tr.p1 td.pl { color: var(--gold); } .res tr.p2 td.pl { color: var(--silver); } .res tr.p3 td.pl { color: var(--bronze); }
.res td.bib { color: var(--muted); width: 52px; }
.res .nm { font-weight: 700; }
.res .sub { color: var(--muted); font-size: .82rem; }
.res .meta { display: none; color: var(--muted); font-size: .8rem; }
.res td.main { font-weight: 800; }
.res .half { color: var(--accent-dark); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.res td.dim { color: var(--muted); }
.res td.gap { color: var(--muted); white-space: nowrap; }
.nat { display: inline-block; margin-left: 6px; padding: 0 5px; font-size: .68rem; font-weight: 700; border-radius: 4px;
  background: var(--line); color: var(--muted); vertical-align: 1px; }
.st-np { color: var(--faint); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.err { background: #fde8e8; color: #9b1c1c; border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }

/* ---------- kategorie (stupně vítězů) ---------- */
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding-top: 14px; }
.catblock { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 12px; }
.catblock h3 { margin: 0 0 2px; font-size: 1.05rem; }
.catblock .cnt { color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.pod { display: grid; grid-template-columns: 30px 1fr auto; gap: 2px 10px; align-items: baseline; padding: 8px 6px; border-top: 1px solid var(--line);
  cursor: pointer; border-radius: 6px; }
.pod:hover { background: var(--hover); }
.pod .n { font-weight: 800; font-size: 1.2rem; }
.pod.g1 .n { color: var(--gold); } .pod.g2 .n { color: var(--silver); } .pod.g3 .n { color: var(--bronze); }
.pod .who b { display: block; }
.pod .who span { color: var(--muted); font-size: .82rem; }
.pod .res-v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pod .res-v span { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.more { display: inline-block; margin-top: 8px; font-weight: 700; font-size: .85rem; cursor: pointer; background: none; border: 0; padding: 0; color: var(--accent-dark); }
.more:hover { text-decoration: underline; }

/* ---------- detail ---------- */
dialog.detail { border: 0; padding: 0; border-radius: 14px; width: min(860px, 96vw); max-height: 92vh; background: var(--card); color: var(--fg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog.detail::backdrop { background: rgba(15, 23, 32, .6); }
.dt-head { display: flex; gap: 12px; align-items: flex-start; padding: 18px 20px 12px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--card); z-index: 2; }
.dt-head h2 { margin: 0; font-size: 1.35rem; line-height: 1.2; }
.dt-head p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.dt-head .x { margin-left: auto; font-size: 1.3rem; }
.dt-body { padding: 14px 20px 22px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.tile { background: var(--even); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.tile .l { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile .v { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: .75rem; font-weight: 600; color: var(--muted); }
.dt-body h3 { margin: 18px 0 8px; font-size: .95rem; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--faint); opacity: .55; }
.chart .bar.best { fill: var(--accent); opacity: 1; }
.chart .bar:hover { opacity: 1; }
.chart .avg { stroke: var(--accent-dark); stroke-dasharray: 4 3; stroke-width: 1; }
table.laps { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .9rem; }
.laps th { text-align: right; font-size: .7rem; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.laps th:first-child, .laps td:first-child { text-align: left; }
.laps td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.laps tr.best td { font-weight: 800; color: var(--accent-dark); }
.laps tr.partial td { color: var(--muted); font-style: italic; }
.note { color: var(--muted); font-size: .82rem; margin: 12px 0 0; }

/* ---------- patička ---------- */
.ftr { color: var(--muted); font-size: .8rem; text-align: center; padding: 8px 0 28px; }

/* ---------- úzké obrazovky ---------- */
@media (max-width: 900px) {
  .c-gap, .c-spd { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 10px; }
  .ev-logo { height: 48px; max-width: 90px; }
  .ev-txt h1 { font-size: 1.15rem; }
  .mt-logo { padding: 4px 7px; }
  .mt-logo img { height: 24px; }
  .c-cat, .c-bib, .c-crs, .c-lap, .c-yr { display: none; }
  .res .meta { display: block; }
  .res td { padding: 8px 6px; }
  .res th { padding: 8px 6px; white-space: normal; line-height: 1.15; }
  .res td.pl { width: 34px; }
  .res td.r { white-space: nowrap; }
  .filters input { max-width: none; min-width: 0; flex-basis: 100%; order: 9; }
  .count { margin-left: 0; flex-basis: 100%; }
  .dt-head, .dt-body { padding-left: 14px; padding-right: 14px; }
  .laps .c-hide { display: none; }
}

@media print {
  .statusbar, .tabs, .filters, .ftr, .mt-logo { display: none !important; }
  body { background: #fff; }
  .hdr { background: #fff; color: #000; border-bottom: 2px solid #000; }
  .ev-sub { color: #333; }
  .card { box-shadow: none; }
  .res th { position: static; }
}
