/* VIS Sędzia — telefon w dłoni, w słońcu na strzelnicy: wysoki kontrast, duże pola, kciuk na dole. */
:root {
  --bg: #f4f3ec; --card: #ffffff; --ink: #1b1f16; --muted: #5d6354; --line: #d9d8cc;
  --bar: #2b3420; --bar-ink: #f4f3ec; --moss: #4f6a1f; --moss-ink: #ffffff; --gold: #b77a2b;
  --red: #b3261e; --amber: #9a6400; --ok: #2f7a3b;
  --r: 14px; --pad: 16px; --tap: 52px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14170f; --card: #1f241a; --ink: #eef0e6; --muted: #a9b09b; --line: #353c2c;
    --bar: #0d0f0a; --moss: #7d9a3c; --gold: #d9a35a; --red: #ef6b5f; --amber: #e0a43b; --ok: #6cc07a; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bar); color: var(--bar-ink);
  padding: calc(env(safe-area-inset-top) + 10px) var(--pad) 10px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top button { background: none; border: 0; color: var(--bar-ink); min-height: 40px; padding: 0 6px; font-size: 15px; }
.sync { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; background: rgba(255,255,255,.12); }
.sync--live::before { content: "● "; color: #8fd16a; }
.sync--queue { background: var(--amber); color: #fff; }
.sync--off { background: var(--red); color: #fff; }

main { padding: var(--pad); padding-bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: var(--pad); margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }

.btn { min-height: var(--tap); border-radius: 12px; border: 2px solid var(--moss); background: var(--card); color: var(--moss);
  font-weight: 700; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn--primary { background: var(--moss); color: var(--moss-ink); }
.btn--big { width: 100%; min-height: 64px; font-size: 20px; }
.btn--danger { border-color: var(--red); color: var(--red); }
.btn--ghost { border-color: var(--line); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }

.field label { display: block; font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select { width: 100%; min-height: var(--tap); border: 2px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--card); }
.field input:focus, .num:focus { outline: none; border-color: var(--moss); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moss) 25%, transparent); }
.num { width: 100%; min-height: 72px; font-size: 34px; font-weight: 800; text-align: center; border: 2px solid var(--line);
  border-radius: 14px; background: var(--card); font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: flex; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; overflow-x: auto; }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: none; font-weight: 700; white-space: nowrap; padding: 0 12px; }
.seg button[aria-pressed="true"] { background: var(--bar); color: var(--bar-ink); }

.active { border: 3px solid var(--moss); }
.active__nr { font-size: 15px; font-weight: 800; color: var(--gold); letter-spacing: .04em; }
.active__name { font-size: 26px; font-weight: 800; margin: 2px 0; }
.total { text-align: center; font-size: 15px; color: var(--muted); }
.total b { display: block; font-size: 40px; color: var(--ink); font-variant-numeric: tabular-nums; }

.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); vertical-align: middle; }
.tag--red { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.tag--muted { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.list li:last-child { border-bottom: 0; }
.list li.is-current { background: color-mix(in srgb, var(--moss) 10%, transparent); margin: 0 -8px; padding: 10px 8px; border-radius: 10px; }
.nr { width: 46px; min-height: 44px; text-align: center; font-weight: 800; border: 2px solid var(--line); border-radius: 10px; background: var(--card); font-variant-numeric: tabular-nums; }
.nrbadge { min-width: 38px; text-align: center; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.res { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); font-weight: 700; font-size: 14px; }
.chip[aria-pressed="true"] { border-color: var(--moss); background: var(--moss); color: var(--moss-ink); }

table.rank { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rank { font-size: 15px; }
.rank th, .rank td { padding: 9px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.rank td:nth-child(3) { overflow-wrap: anywhere; }
.rank td.n, .rank th.n { white-space: nowrap; }
.rank th { font-size: 13px; color: var(--muted); }
.rank td.n, .rank th.n { text-align: right; }
.rank tr.top1 td:first-child { color: var(--gold); font-weight: 800; }
.tablewrap { overflow-x: auto; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--bar); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { min-height: 64px; border: 0; background: none; color: var(--bar-ink); opacity: .7; font-weight: 700; font-size: 15px; }
.tabs button[aria-current="page"] { opacity: 1; box-shadow: inset 0 4px 0 var(--gold); }

.login { max-width: 420px; margin: 8vh auto 0; }
.login img { display: block; width: 96px; height: 96px; margin: 0 auto 14px; border-radius: 22px; }
.error { color: var(--red); font-weight: 700; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 700; max-width: 90vw; text-align: center; }

/* Pomoc, podpisy i pogrupowane wiersze startów */
.syncbtn { background: none; border: 0; padding: 0; min-height: 40px; }
.helpbtn { width: 34px; min-height: 34px !important; border-radius: 999px !important; border: 2px solid rgba(255,255,255,.5) !important; font-weight: 800; padding: 0 !important; }
.help { border: 2px solid var(--gold); }
.steps { margin: 0; padding-left: 22px; }
.steps li { margin-bottom: 10px; line-height: 1.45; }
.note { background: color-mix(in srgb, var(--gold) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: 15px; }
.seglabel { margin: 0 0 6px 2px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.startrow { align-items: flex-start !important; }
.nrbox { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chiplabel { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 64px; }
