/* Badmintonové turnaje – vzhled (Kurt + Peříčko). Barvy jsou nahoře jako proměnné, dají se snadno změnit. */
/* Písmo Nunito se z internetu nestahuje (kvůli ochraně soukromí – žádné spojení s cizími servery). Použije se, je-li v počítači
   nainstalované, nebo soubor fonts/Nunito.woff2 (volitelný, licence OFL); jinak systémové písmo. */
@font-face { font-family: 'Nunito'; font-weight: 400 900; font-display: swap; src: local('Nunito'), url('fonts/Nunito.woff2') format('woff2'); }

:root {
  color-scheme: light;
  --bg: #f2f6f3;
  --surface: #ffffff;
  --surface-2: #e3ebe6;
  --text: #16251d;
  --muted: #566a5f;
  --line: #d3ddd6;
  --avatar-a: #cfeadc;
  --avatar-b: #ffd7a8;
  --live-bar: #ff8a5b;
  --accent: #0b6e4f;        /* zelená kurtu */
  --accent-ink: #ffffff;
  --accent-soft: #dff1e9;
  --warn: #b3261e;
  --warn-soft: #fbe9e7;
  --live: #7a2f0c;
  --live-soft: #ffe3d5;
  --radius: 20px;
  --shadow: 0 2px 12px rgba(22, 60, 40, .08);
}

@media all {
  :root[data-theme="dark"] {
    --bg: #101512;
    --surface: #19201c;
    --surface-2: #222b26;
    --text: #e7eee9;
    --muted: #9aa9a0;
    --line: #2c3731;
    --accent: #43c394;
    --accent-ink: #06231a;
    --accent-soft: #173a2e;
    --warn: #ff8a80;
    --warn-soft: #3b1c1a;
    --live: #ffb08a;
    --live-soft: #3d2216;
    --avatar-a: #1f4a39;
    --avatar-b: #5a4020;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 'Nunito', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
p { margin: 0; }
a { color: var(--accent); }

.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- horní lišta ---------- */

.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 0 0 24px 24px;
}
.bar-in {
  max-width: 980px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { font-weight: 800; font-size: 1.2rem; color: inherit; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.brand .mark { width: 30px; height: 30px; flex: none; }
.brand .wm { font-size: 1.35rem; letter-spacing: -.04em; line-height: 1; }
.bar .brand .wm { color: #fff; }
.bar .brand .wm b { color: rgba(255,255,255,.78); font-weight: 800; }
.brand-h { display: flex; align-items: center; justify-content: center; gap: 12px; }
.brand-h .mark { width: 52px; height: 52px; flex: none; }
.brand-h .wm { font-size: 2.2rem; letter-spacing: -.04em; color: var(--accent); line-height: 1; }
.brand-h .wm b { color: var(--text); font-weight: 800; }
.crumbs { flex: 1; min-width: 0; font-size: .875rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: inherit; }
.bar button { background: rgba(255,255,255,.16); color: inherit; border: 0; border-radius: 999px; min-height: 36px; padding: 4px 16px; font-size: .875rem; }
.bar button:hover { background: rgba(255,255,255,.26); }

main { max-width: 980px; margin: 0 auto; padding: 20px 16px 64px; display: grid; gap: 20px; }

.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.head .meta { color: var(--muted); margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* úvodní stránka: velké tlačítko „Nový turnaj“ nahoře uprostřed */
.hero { display: flex; justify-content: center; padding: 12px 0 4px; }
.hero button { font-size: 1.15rem; min-height: 60px; padding: 14px 44px; border-radius: 999px; box-shadow: var(--shadow); }

/* ---------- tlačítka a formuláře ---------- */

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  min-height: 44px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 8px 24px; }
button.danger { color: var(--warn); }
button.link { border: 0; background: none; min-height: 0; padding: 4px; color: var(--accent); font-weight: 600; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

label { display: grid; align-content: start; gap: 4px; font-size: .875rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; min-height: 44px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--text); font-size: 1rem; }
label.check input { width: 20px; height: 20px; min-height: 0; }
.form { display: grid; gap: 14px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.hint { font-size: .8125rem; color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }

/* ---------- karty a seznamy ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.list { display: grid; gap: 10px; }
.item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
a.item:hover { border-color: var(--accent); }
.item { border: 0; }
.item .title { font-weight: 800; }
.item .sub { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }

.badge { display: inline-block; font-size: .75rem; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.running { background: var(--live-soft); color: var(--live); }
.badge.finished { background: var(--accent-soft); color: var(--accent); }
.badge.court { background: var(--live-soft); color: var(--live); }

/* ---------- záložky ---------- */

.tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 5px; overflow-x: auto; width: fit-content; max-width: 100%; }
.tabs button { border: 0; border-radius: 999px; background: none; color: var(--muted); padding: 8px 20px; min-height: 40px; white-space: nowrap; }
.tabs button:hover { border: 0; color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--accent); font-weight: 800; box-shadow: 0 1px 3px rgba(22,37,29,.15); }

.section { display: grid; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* ---------- zápasy ---------- */

.matches { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.match {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  width: 100%; text-align: left; font-weight: 400;
  padding: 12px 16px; min-height: 64px; border-radius: 16px;
  background: var(--surface); border: 0; box-shadow: var(--shadow);
}
.match:disabled { opacity: 1; cursor: default; background: transparent; box-shadow: none; border: 2px dashed var(--line); }
.match .side { display: contents; }
.match .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .side.win .name { font-weight: 700; }
.match .side.lose .name { color: var(--muted); }
.match .pts { display: flex; gap: 2px; font-variant-numeric: tabular-nums; }
.match .pts span { min-width: 1.7em; text-align: right; }
.match .side.win .pts { font-weight: 700; }
.match .side.lose .pts { color: var(--muted); }
.match .foot { grid-column: 1 / -1; display: flex; gap: 6px; }
.match .foot:empty { display: none; }
.match.live { box-shadow: inset 0 0 0 2px var(--live-bar), var(--shadow); }

/* ---------- tabulky ---------- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
th.l, td.l { text-align: left; }
td.name { white-space: normal; min-width: 150px; }
tr.adv td { background: var(--accent-soft); }
tr.adv td.name { font-weight: 800; }

/* ---------- pavouk ---------- */

.bracket { display: flex; gap: 20px; overflow-x: auto; padding: 4px 2px 12px; }
.br-col { display: flex; flex-direction: column; gap: 10px; min-width: 220px; flex: 1 0 220px; }
.br-col > h3 { text-align: center; }
.br-list { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 10px; }
.br-col .match { min-height: 62px; padding: 8px 12px; }

/* ---------- přihlášky ---------- */

.entry { display: grid; grid-template-columns: 3.8em 1fr auto; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry .no { color: var(--muted); font-variant-numeric: tabular-nums; }
.entry .who { min-width: 0; }
.entry .tools { display: flex; align-items: center; gap: 4px; }
.entries { padding: 0; overflow: hidden; }

.podium { display: grid; gap: 6px; }
.podium div { display: flex; gap: 10px; align-items: baseline; }
.podium .place { font-weight: 800; min-width: 1.6em; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- okno a hlášky ---------- */

dialog {
  border: 1px solid var(--line); border-radius: 24px; padding: 20px;
  background: var(--surface); color: var(--text);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto;
}
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog h2 { margin-bottom: 14px; font-size: 1.15rem; }

.sets { display: grid; gap: 8px; }
.set-row { display: grid; grid-template-columns: 4.5em 1fr auto 1fr; align-items: center; gap: 8px; }
.set-row input { text-align: center; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.set-names { display: grid; grid-template-columns: 4.5em 1fr auto 1fr; gap: 8px; font-size: .8125rem; font-weight: 600; text-align: center; color: var(--muted); }
.set-names span:nth-child(3) { visibility: hidden; }
.more { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-weight: 700; z-index: 100;
  opacity: 0; pointer-events: none; transition: opacity .2s;
  top: auto; right: auto; margin: 0; border: 0;       /* popover (vrstva nad okny nastavení) */
}
#toast:not(:popover-open):not(.show) { display: none; }
#toast.show { opacity: 1; }
#toast.err { background: var(--warn); color: #fff; }

.login { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; display: grid; gap: 16px; }

@media (max-width: 560px) {
  h1 { font-size: 1.3rem; }
  .matches { grid-template-columns: 1fr; }
  .head .actions { width: 100%; }
  .head .actions > button { flex: 1; }
  th, td { padding: 10px 7px; }
  td.name { min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Tisk: jen obsah, bez tlačítek */
@media print {
  .bar, .tabs, .actions, .tools, #toast, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .item, .match, .table-wrap { box-shadow: none; }
  .bracket { overflow: visible; }
}

/* ---------- uživatel v záhlaví, nebezpečné akce, kurty, uživatelé ---------- */

.bar .who { font-size: .875rem; font-weight: 600; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.danger { margin-top: 20px; border-top: 1px solid var(--line, #d8dee4); padding-top: 12px; }
details.danger summary { cursor: pointer; font-weight: 600; color: var(--danger, #b42318); }
details.danger .actions { margin-top: 8px; }
.courts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.courts .court { display: grid; justify-content: stretch; justify-items: start; gap: 8px; text-align: left; padding: 16px; border-radius: 20px; border: 2px dashed var(--line);
  background: transparent; color: var(--muted); font-weight: 700; min-height: 118px; align-content: start; width: 100%; }
.courts .court.live { border: 0; border-top: 5px solid var(--live-bar); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.courts .c-head { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.courts .c-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.courts .c-side span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.courts .free { font-size: 1.15rem; font-weight: 800; }
.ava { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 800; background: var(--avatar-a); color: var(--text); }
.ava.b { background: var(--avatar-b); }
.item .tools { display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--line, #d8dee4); text-decoration: none; color: inherit; }

/* ---------- konečné pořadí: stupně vítězů ---------- */

.podium-card .section-head { margin-bottom: 8px; }
.stage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; max-width: 640px; margin: 8px auto 0; }
.pcol { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.pname { display: grid; gap: 2px; font-weight: 800; padding: 0 4px 6px; overflow-wrap: anywhere; }
.trophy { margin-bottom: -6px; position: relative; z-index: 1; }
.block { width: 100%; display: flex; align-items: flex-start; justify-content: center; padding-top: 12px; border-radius: 16px 16px 0 0; color: #fff; font-size: 2rem; }
.p1 .block { height: 150px; background: linear-gradient(#f2b705, #b98600); color: #4a3500; }
.p2 .block { height: 108px; background: linear-gradient(#c3ccd6, #7d8a98); color: #2a323b; }
.p3 .block { height: 78px; background: linear-gradient(#d9915a, #9a5a2b); color: #3d1f08; }
.rest { max-width: 640px; margin: 14px auto 0; display: grid; gap: 4px; }
.rest-row { display: flex; align-items: baseline; gap: 12px; padding: 8px 14px; background: var(--surface-2); border-radius: 12px; }
.rest-row .place { font-weight: 800; min-width: 2em; color: var(--accent); }
.rest-row .rn { flex: 1; font-weight: 700; }

/* ---------- diplomy (tisk) ---------- */

#print-area { display: none; }
@media print {
  body.print-diploma #app, body.print-diploma #dlg, body.print-diploma #toast { display: none !important; }
  body.print-diploma { background: #fff; }
  body.print-diploma #print-area { display: block; }
  .diploma { width: 297mm; height: 209mm; box-sizing: border-box; padding: 12mm; page-break-after: always; break-after: page;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .diploma:last-child { page-break-after: auto; break-after: auto; }
  .dp-frame { position: relative; height: 100%; box-sizing: border-box; border: 3mm double #b98600; padding: 10mm 16mm; display: flex; flex-direction: column;
    align-items: center; text-align: center; font-family: Georgia, 'Times New Roman', serif; color: #1b1b1b; }
  .dp-frame > *:not(.dp-wm) { position: relative; z-index: 1; }
  .dp-wm { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 72%; max-height: 72%; width: auto; height: auto;
    opacity: .1; z-index: 0; object-fit: contain; }
  .dp-top { margin-top: 2mm; }
  .dp-title { font-size: 54pt; letter-spacing: .25em; color: #8a6400; margin-top: 4mm; line-height: 1; }
  .dp-for { font-size: 20pt; margin-top: 6mm; font-style: italic; }
  .dp-name { font-size: 40pt; font-weight: 700; margin-top: 8mm; padding: 0 10mm 2mm; border-bottom: .4mm solid #b98600; max-width: 100%; overflow-wrap: anywhere; line-height: 1.15; }
  .dp-event { font-size: 18pt; margin-top: 10mm; }
  .dp-meta { font-size: 13pt; margin-top: 4mm; color: #444; line-height: 1.5; }
  .dp-frame.has-sp { padding-top: 8mm; padding-bottom: 7mm; }
  .dp-frame.has-sp .dp-top { margin-top: 0; }
  .dp-frame.has-sp .dp-title { font-size: 50pt; margin-top: 3mm; }
  .dp-frame.has-sp .dp-for { font-size: 19pt; margin-top: 5mm; }
  .dp-frame.has-sp .dp-name { font-size: 38pt; margin-top: 6mm; }
  .dp-frame.has-sp .dp-event { font-size: 17pt; margin-top: 8mm; }
  .dp-frame.has-sp .dp-meta { font-size: 12.5pt; margin-top: 3mm; line-height: 1.45; }
  .dp-frame.has-sp .dp-sign { padding-top: 1mm; font-size: 12pt; }
  .dp-sp { margin-top: auto; padding-top: 4mm; width: 100%; text-align: center; }
  .dp-sp small { display: block; font-size: 10pt; color: #666; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 2mm; }
  .dp-sp div { display: flex; justify-content: center; align-items: center; gap: 8mm; flex-wrap: wrap; }
  .dp-sp img { height: 14mm; max-width: 40mm; object-fit: contain; }
  .dp-sign-sp { margin-top: 4mm !important; }
  .dp-frame > .dp-qr { position: absolute; left: 14mm; bottom: 12mm; width: 28mm; text-align: center; }
  .dp-qr svg { width: 26mm; height: 26mm; display: block; margin: 0 auto 1mm; }
  .dp-qr small { display: block; font-size: 6.5pt; line-height: 1.25; color: #555; }
  .dp-sign { margin-top: auto; width: 80mm; border-top: .3mm solid #333; padding-top: 2mm; font-size: 13pt; }
  .dp-sign small { display: block; font-size: 10pt; color: #666; }
}

/* ---- zápasy jednoho hráče (okno po klepnutí na jméno v tabulce) */
button.plink { text-align: left; padding: 2px 4px; font-weight: 700; color: var(--text); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
button.plink:hover { color: var(--accent); text-decoration-color: var(--accent); }
.badge.lose { background: var(--warn-soft); color: var(--warn); }
.player-dlg { min-width: 0; }
dialog:has(.player-dlg) { width: min(760px, calc(100vw - 24px)); }
.pl-list { display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.pl-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto 84px; gap: 4px 12px; align-items: center; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); }
.pl-where { font-size: .8rem; color: var(--muted); font-weight: 700; }
.pl-who { font-weight: 700; }
.pl-score { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; text-align: right; }
.pl-row .badge { justify-self: end; }
@media (max-width: 620px) { .pl-row { grid-template-columns: 1fr auto; } .pl-where { grid-column: 1 / -1; } .pl-score { grid-column: 1; } }

/* statistiky, výběr hráčů */
.stat-q { width: 100%; box-sizing: border-box; padding: 10px; margin: 8px 0; font-size: 1rem; }
.stat-card { padding: 4px 8px; overflow-x: auto; }
.stat-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.stat-table th, .stat-table td { padding: 7px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.stat-table th:first-child, .stat-table td:first-child { text-align: left; white-space: normal; }
.known-list { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin-bottom: 10px; }
.known-list input[type=search] { width: 100%; box-sizing: border-box; padding: 8px; margin-bottom: 6px; }
.known-items { max-height: 200px; overflow: auto; margin-bottom: 8px; }
.known-items label { display: block; padding: 3px 0; }
.multi-warn { position: sticky; top: 0; z-index: 60; background: var(--warn); color: #fff; padding: 10px 16px; font-weight: 700; text-align: center; }

.logo-prev { display: flex; align-items: center; justify-content: center; min-height: 140px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.logo-prev img { max-width: 100%; max-height: 220px; }
.wm-mini { height: 28px; width: auto; vertical-align: middle; margin-left: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }

.foot { text-align: left; padding: 18px 16px 28px; }
.foot a { color: inherit; }

/* Zápatí vždy úplně dole, i když je obsah krátký */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#app > main { flex: 1 0 auto; width: 100%; box-sizing: border-box; grid-template-columns: minmax(0, 1fr); align-content: start; }   /* každá stránka a záložka stejně široká (jinak se main v sloupci flexu smrštil na obsah) */
#app > .foot { margin-top: auto; }

.entry .lot-in { width: 3.6em; padding: 4px 6px; text-align: center; font-variant-numeric: tabular-nums; }
.entry .lot-in::placeholder { color: var(--muted); opacity: .8; }

.court.closed { opacity: .65; border-style: dashed; }
.court .c-tools { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: .85rem; }
.court .c-tools select { max-width: 100%; }
.court-wrap { display: flex; flex-direction: column; }

/* ---------- zápisní lístky a výsledky (tisk) ---------- */
@media print {
  .sheets { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; font-family: Arial, sans-serif; color: #000; }
  .sheet { border: .4mm solid #000; padding: 4mm; height: 62mm; box-sizing: border-box; break-inside: avoid; display: flex; flex-direction: column; gap: 2mm; font-size: 10pt; }
  .sh-h { display: flex; justify-content: space-between; gap: 4mm; font-size: 9pt; }
  .sh-n { display: flex; flex-direction: column; gap: 0; font-size: 12pt; font-weight: 700; line-height: 1.2; }
  .sh-n i { font-weight: 400; font-size: 8pt; }
  .sh-line { display: block; border-bottom: .3mm solid #000; height: 7mm; }
  .sh-t { width: 100%; border-collapse: collapse; }
  .sh-t td { border: .3mm solid #000; height: 7mm; text-align: center; }
  .sh-t td:first-child { width: 18mm; text-align: left; padding-left: 2mm; font-size: 9pt; }
  .sh-t td:nth-child(3) { width: 6mm; border-left: 0; border-right: 0; }
  .sh-f { display: flex; justify-content: space-between; font-size: 9pt; margin-top: auto; }
  .rs { font-family: Arial, sans-serif; color: #000; }
  .rs h1 { font-size: 20pt; margin: 0 0 2mm; } .rs h2 { font-size: 14pt; margin: 6mm 0 2mm; } .rs p { margin: 0; }
  .rs-t { width: 100%; border-collapse: collapse; font-size: 11pt; }
  .rs-t th, .rs-t td { border-bottom: .2mm solid #888; padding: 1.2mm 2mm; text-align: left; }
  .rs-t td.w { font-weight: 800; } .rs-t tr { break-inside: avoid; }
}

/* nastavení turnaje: oddíly */
.fs { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 14px 0 0; display: grid; gap: 10px; min-width: 0; }
.fs > legend { padding: 0 8px; font-weight: 800; font-size: .95rem; color: var(--accent); }
.fs .hint { margin: 0; }

/* platby a faktury */
.pay-box { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.pay-qr { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); line-height: 0; }
.pay-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.pay-info dt { color: var(--muted); } .pay-info dd { margin: 0; }
.bill-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.bill-table th, .bill-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.bill-table .num { text-align: right; white-space: nowrap; }
.st-pending { color: #a86a00; } .st-paid { color: #0a7a3c; font-weight: 700; } .st-cancelled { color: var(--muted); text-decoration: line-through; }
.inv { background: #fff; color: #111; padding: 22px 26px; max-width: 760px; margin: 0 auto; font-size: 14px; line-height: 1.45; }
.inv h1 { font-size: 1.5rem; margin: 0 0 4px; } .inv h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #555; margin: 0 0 4px; }
.inv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 14px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 14px; } .inv-parties p { margin: 0; }
.inv-meta, .inv-items { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.inv-meta th { text-align: left; font-weight: 600; color: #555; padding: 3px 8px 3px 0; width: 18%; } .inv-meta td { padding: 3px 12px 3px 0; }
.inv-items th, .inv-items td { border-bottom: 1px solid #bbb; padding: 7px 8px; text-align: left; } .inv-items th:last-child, .inv-items td:last-child { text-align: right; }
.inv-total { text-align: right; font-size: 1.05rem; margin: 12px 0; } .inv-note { color: #444; font-size: .85rem; }
#bill-print { display: none; }
@media print {
  body.print-bill > *:not(#bill-print) { display: none !important; }
  body.print-bill #bill-print { display: block !important; }
  body.print-bill { background: #fff !important; }
}
dialog:has(.inv) { width: min(860px, 96vw); max-width: none; }
.inv-items th:nth-child(2), .inv-items td:nth-child(2) { text-align: center; width: 90px; }
.inv-items th:last-child, .inv-items td:last-child { width: 130px; white-space: nowrap; }

/* sponzoři turnaje: správa log */
.sp-grid { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 14px; }
.sp-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.sp-item img { height: 56px; max-width: 120px; object-fit: contain; }

.fb-st { color: #f5a300; letter-spacing: 2px; }
.fb-c { margin: 6px 0; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); }

.card-note { background: var(--accent-soft, #e3f1ea); border-radius: 14px; padding: 12px 14px; margin: 8px 0 12px; }

.plan-opts { display: grid; gap: 8px; }
.plan-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-weight: 500; color: var(--text); font-size: 1rem; cursor: pointer; }
.plan-opt input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; }
.plan-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, #e3f1ea); }

/* kalendář nadcházejících turnajů pod přihlášením */
.cal { max-width: 640px; margin: 32px auto 48px; padding: 0 16px; }
.cal h2 { margin: 0 0 8px; font-size: 1.15rem; }
.cal-filter { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-size: .9rem; }
.cal-filter select { flex: 1; max-width: 260px; }
.cal-list { display: grid; gap: 10px; }
.cal-item { border: 1px solid var(--line, #d6ddd8); border-radius: 12px; padding: 12px 14px; background: var(--card, #fff); }
.cal-item h3 { margin: 2px 0 2px; font-size: 1.05rem; text-transform: none; letter-spacing: 0; color: inherit; }
.cal-item p { margin: 2px 0; }
.cal-date { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent, #0f6b4f); }
.cal-free { color: var(--accent, #0f6b4f); }
.cal-full { color: #b3261e; }
.cal-fs { margin-top: 10px; }
.cal-item.has-poster { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: start; }
.cal-poster img { width: 84px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line, #d3ddd6); display: block; }
.cal-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft, #dff1e9); font-size: .78rem; font-weight: 600; }
.plan-table-wrap { overflow-x: auto; margin-top: 6px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: .76rem; table-layout: fixed; }
.plan-table thead th:first-child, .plan-table tbody th { width: 31%; }
.plan-table th, .plan-table td { text-transform: none; letter-spacing: 0; white-space: normal; overflow-wrap: anywhere; }
.plan-table thead th { font-size: .74rem; line-height: 1.25; }
.plan-table th, .plan-table td { padding: 6px 4px; border-bottom: 1px solid var(--line, #d3ddd6); text-align: center; vertical-align: top; }
.plan-table tbody th { text-align: left; font-weight: 500; }
.plan-table thead th { vertical-align: bottom; }
.plan-table .sel { background: var(--accent-soft, #dff1e9); }
.pt-y { color: var(--accent, #0b6e4f); font-weight: 700; }
.pt-n { color: #9aa59f; }
.steps { font-weight: 700; color: var(--accent, #0b6e4f); margin: 0 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.inv-qr { display: flex; align-items: center; gap: 14px; margin: 12px 0; break-inside: avoid; } .inv-qr p { margin: 0; font-size: .85rem; color: #333; } .inv-qr-img { width: 150px; height: 150px; flex: none; background: #fff; } .inv-qr-img svg { width: 100%; height: 100%; display: block; }

/* online přihlášky: přehled pořadatele */
.reg-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .95rem; margin-bottom: 6px; }
.reg-row .who { flex: 1; min-width: 0; }
.reg-pay { margin-top: 2px; }
.reg-pay .link { margin-left: 6px; }
.reg-pay { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }
button.pay-ok { padding: 6px 18px; min-height: 0; font-size: 0.95rem; border-radius: 999px; }

/* přihláška hráče (prihlaska.html) */
.rg { max-width: 600px; }
.rg input:not([type=checkbox]):not([type=radio]), .rg select { width: 100%; box-sizing: border-box; font: inherit; padding: 10px; border-radius: 12px; border: 1px solid var(--line, #cfd8d2); background: var(--surface, #fff); color: inherit; }
.rg-set { border: 1px solid var(--line, #cfd8d2); border-radius: 12px; padding: 10px 14px; display: grid; gap: 10px; }
.rg-leave { border-top: 1px solid var(--line, #cfd8d2); padding-top: 10px; }
.rg-leave form, .rg-acc { display: grid; gap: 10px; margin-top: 8px; }

/* Příprava turnaje + štítek varianty */
.plan-badge{border:0;color:inherit;cursor:pointer;min-height:0;padding:6px 12px;border-radius:999px;background:#eceff1;font-size:13px;font-weight:600;align-self:center}
.plan-badge.free{background:#fdf3e1;color:#5f3b0c}
.prep{margin:0 0 16px}
.prep-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px}
.prep-head h2{margin:0;font-size:18px}
.prep-list{list-style:none;margin:8px 0 0;padding:0}
.prep-step{display:flex;align-items:center;gap:14px;padding:12px 0;border-top:1px solid var(--line,#e6ece8)}
.prep-step>div{flex:1;min-width:0}
.prep-step.hl{background:#fdf3e1;margin:0 -16px;padding-left:16px;padding-right:16px;border-radius:10px}
.prep-n{width:28px;height:28px;flex:none;border-radius:50%;border:2px solid #0b6e4f;color:#0b6e4f;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:14px}
.prep-step.done .prep-n{background:#0b6e4f;color:#fff}
.prep-step.hl .prep-n{border-color:#b45309;color:#b45309}
button.warn{background:#b45309;border-color:#b45309;color:#fff}
details.more{margin:12px 0}details.more>summary{cursor:pointer;font-weight:600;padding:8px 0}
@media (max-width:600px){.prep-step{flex-wrap:wrap}.prep-step>button{width:100%}}
.reg-steps{list-style:none;display:flex;gap:10px 18px;flex-wrap:wrap;padding:0;margin:0 0 14px;font-size:14px}
.reg-steps li{display:flex;align-items:center;gap:8px;color:#4d5f56}
.reg-steps b{width:26px;height:26px;border-radius:50%;border:2px solid #8a9a92;display:inline-flex;align-items:center;justify-content:center}
.reg-steps li.done b{background:#0b6e4f;border-color:#0b6e4f;color:#fff}
.reg-steps li.cur{font-weight:700;color:inherit}.reg-steps li.cur b{border-color:#b45309;color:#b45309}
.reg-tiles{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:14px}
.reg-tile{background:#fff;border:1px solid #d6dfda;border-radius:14px;padding:12px 14px}
.reg-tile b{display:block;font-size:26px}.reg-tile span{font-size:13px;color:#4d5f56}
.reg-tile.warn{background:#fdf3e1;border-color:#f0d9a8}.reg-tile.warn b{color:#8a4a0a}
@media (max-width:600px){.reg-tiles{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Nastavení existujícího turnaje: široké okno, bloky ve dvou sloupcích */
dialog:has(.form-wide) { width: min(1100px, calc(100vw - 24px)); max-width: none; }
.form-wide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; align-items: start; }
.form-wide > h2, .form-wide > .form-actions, .form-wide > .hint, .form-wide > .cal-fs { grid-column: 1 / -1; }
.form-wide > .fs { margin-top: 14px; }
@media (max-width: 800px) { .form-wide { display: block; } }
.plans{margin-top:4px}.plan-chip{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--line);border-radius:999px;padding:2px 6px 2px 10px;margin:2px 4px 2px 0}
.plan-chip button.link{padding:0 6px;font-size:1.1rem;line-height:1}
.fs.later{display:none}

/* Příprava turnaje – kompaktní */
.prep{padding:12px 16px}
.prep-head h2{font-size:1rem}
.prep-list{margin-top:4px}
.prep-step{padding:7px 0;gap:10px;font-size:.92rem}
.prep-step.hl{margin:0 -16px;padding-left:16px;padding-right:16px}
.prep-n{width:22px;height:22px;font-size:12px;border-width:2px}
.prep-step>button{padding:5px 10px;min-height:34px;font-size:.85rem;white-space:nowrap}
.prep-step>button+button{margin-left:-4px}
.check-list{list-style:none;padding:0;margin:0 0 10px}
.check-list li{display:flex;gap:10px;padding:8px 0;border-top:1px solid var(--line)}
.check-list b{width:22px;height:22px;flex:none;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:#fff;font-size:12px}
.chk-ok b{background:#0b6e4f}.chk-warn b{background:#b45309}.chk-bad b{background:#b3261e}
.more-links{display:flex;gap:16px;flex-wrap:wrap;margin:6px 0 0}.more-links .link{font-weight:600}

/* Chyba ve formuláři: červeně označené pole + hláška nahoře */
.form-err{background:#fdecea;color:#8c1d18;border:1px solid #f1b5b0;border-radius:10px;padding:10px 12px;margin:0 0 12px;font-weight:600;grid-column:1 / -1}
label.bad{color:#b3261e}
label.bad input,label.bad select,label.bad textarea{border-color:#b3261e;box-shadow:0 0 0 3px rgba(179,38,30,.18)}
form input:user-invalid,form select:user-invalid{border-color:#b3261e}

.cal-status{border-radius:10px;padding:10px 12px;font-weight:600;grid-column:1 / -1}
.cal-status.ok{background:#e3f1ea;color:#0b6e4f}.cal-status.wait{background:#fdf3e1;color:#5f3b0c}

/* Varianta, kalendář a online přihlášky: tři sloupce vedle sebe */
dialog:has(.form-cols3) { width: min(1280px, calc(100vw - 24px)); max-width: none; }
.form-cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; align-items: start; }
.form-cols3 > h2, .form-cols3 > .cal-status, .form-cols3 > .hint, .form-cols3 > .form-actions, .form-cols3 > .form-err { grid-column: 1 / -1; }
.form-cols3 > .fs { margin-top: 10px; align-self: stretch; box-sizing: border-box; }
.form-cols3 .row { grid-template-columns: 1fr; }
.form-cols3 > .form-actions { margin-top: 14px; }
@media (max-width: 1000px) { .form-cols3 { display: block; } }

/* nápovědy, odhad délky, stav kroků, náhledy */
.help{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;margin-left:6px;border-radius:50%;background:#e3ebe7;color:#0b6e4f;font-size:11px;font-weight:700;cursor:pointer;vertical-align:middle;user-select:none}
.help:hover,.help:focus-visible{background:#0b6e4f;color:#fff;outline:none}
.help-text{display:block;margin-top:4px;padding:6px 10px;border-left:3px solid #0b6e4f;background:#f3f7f5;color:#33413b;font-weight:400;font-size:.8125rem;line-height:1.4}
.est{margin:0 0 10px;padding:8px 12px;border-radius:8px;background:#eef6f2;color:#0b4d38;font-size:.875rem}
.prep-est{margin:10px 0 0}
.prep-step.warn .prep-n{background:#fdf3e1;border-color:#b45309;color:#b45309}
.reg-tools{display:flex;flex-wrap:wrap;gap:8px;margin:6px 0 10px}
.pubprev{margin-top:12px;padding:12px 14px;border:1px solid #d5e0db;border-radius:10px;background:#fafcfb}
.pubprev h3{margin:0 0 10px;font-size:1rem}
.pp-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.pp-card{padding:10px 12px;border:1px solid #d5e0db;border-radius:10px;background:#fff;display:flex;flex-direction:column;gap:3px;font-size:.9rem}
.pp-name{font-size:1.05rem}
.form-cols3 > .pubprev{grid-column:1 / -1}
.mail-prev{white-space:pre-wrap;word-break:break-word;font:inherit;font-size:.875rem;max-height:40vh;overflow:auto;margin:8px 0;padding:10px 12px;border:1px solid #d5e0db;border-radius:8px;background:#f7f9f8}
.qrp{text-align:center;font-family:system-ui,sans-serif;padding-top:20mm}
.qrp h1{font-size:34pt;margin:0 0 6mm}.qrp p{font-size:16pt;margin:0 0 10mm}.qrp h2{font-size:26pt;margin:0 0 8mm}
.qrp-code svg{width:110mm;height:110mm}.qrp-url{font-size:11pt!important;color:#444;word-break:break-all;margin-top:8mm!important}
label.has-help{position:relative}
.help.help-top{position:absolute;right:2px;top:0;margin:0}
.form-wide > .est,.form-cols3 > .est{grid-column:1 / -1}
.offline-badge{display:inline-block;padding:2px 8px;border-radius:6px;background:#b42318;color:#fff;font-weight:700;letter-spacing:.04em;margin-right:6px}
.offline-help summary{cursor:pointer;font-weight:600}
.offline-help ul{margin:6px 0 0;padding-left:20px}
.sale-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #c0392b; color: #fff; font-size: 0.75rem; font-weight: 800; vertical-align: middle; }
.plan-table s, .plan-opt s { opacity: .65; }
