/* MatchGrid system — Eightsy-inspired: felt green, gold, dark club */
:root {
  --felt: #0a5c3a;
  --felt-deep: #063d27;
  --felt-dark: #042818;
  --ink: #0c0a08;
  --bg: #0a5c3a;
  --panel: #16110c;
  --panel2: #211a13;
  --line: #3d3223;
  --text: #f2ece1;
  --muted: #b8a989;
  --green: #2e7d4f;
  --green2: #3fa568;
  --accent: #c9a227;
  --gold: #c9a227;
  --gold-soft: #e0c35a;
  --red: #c0392b;
  --blue: #4a7dbd;
  --cream: #f7f1e4;
  --font: "Barlow", system-ui, sans-serif;
  --display: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(10, 92, 58, .45), transparent 60%),
    radial-gradient(ellipse 40% 30% at 90% 100%, rgba(201, 162, 39, .08), transparent 55%),
    linear-gradient(165deg, #041a10 0%, var(--ink) 45%, #120e0a 100%);
  background-attachment: fixed;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: .02;
  background-size: 180px 180px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hidden { display: none !important; }

.ac { position: relative; }
.ac-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: none;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
  border-radius: 0 0 10px 10px;
}
.ac-item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item:hover { background: var(--panel2); }
.ac-empty { padding: 8px 10px; color: var(--muted); }
.p-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
}
.p-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.p-item:last-child { border-bottom: none; }
.p-item:hover { background: var(--panel); }
.p-item .sub { font-size: 12px; }
.p-item input[type="checkbox"] { width: auto; margin: 0; }

.check-row { display: flex; align-items: center; gap: 8px; }
.check-row input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.check-row .sub { font-weight: 400; }

header#topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 24px;
  background: rgba(12, 10, 8, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 162, 39, .18);
  box-shadow: 0 1px 0 rgba(201, 162, 39, .12);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 3px 10px rgba(201, 162, 39, .35));
}
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cream);
}
.brand-name span { color: var(--gold); }

#topbar nav { display: flex; gap: 8px; flex: 1; }

.nav-btn, .ghost, .btn, button.primary, button.danger, button.ghost {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  transition: filter .15s, transform .05s, background .15s;
}
.nav-btn {
  background: transparent;
  color: var(--text);
  padding: 9px 16px;
  font-weight: 600;
}
.nav-btn:hover { background: rgba(255,255,255,.05); color: var(--cream); }
.nav-btn.active { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1405; font-weight: 700; }

.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.role-badge {
  font-size: 11px; padding: 2px 10px; border-radius: 999px;
  background: var(--green); color: #fff; font-weight: 700; letter-spacing: .04em;
}
.role-badge.admin { background: var(--accent); color: #1a1405; }

/* language switcher (topbar) */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: background .15s, transform .1s;
}
.lang-btn svg {
  display: block;
  width: 22px;
  height: 15px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 1px 3px rgba(0,0,0,.5);
}
.lang-btn:hover { transform: scale(1.1); }
.lang-btn.active { background: rgba(201, 162, 39, .35); box-shadow: 0 0 0 1px var(--gold); }

main#app { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* per-club instance branding */
.club-badge { text-align: center; margin: -8px 0 10px; }
.club-badge img {
  max-height: 130px;
  max-width: 240px;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .35));
}
.club-name {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 10px;
  color: var(--cream);
}
.auth-powered { margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.auth-lang {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 6px;
}
.auth-powered a { color: var(--gold); text-decoration: none; font-weight: 600; }
.auth-powered a:hover { text-decoration: underline; }
.site-footer {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid rgba(201, 162, 39, .15);
}
.site-footer a { color: var(--gold); text-decoration: none; font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }

h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 20px 0 10px; }
h3 {
  font-size: 16px;
  margin: 14px 0 8px;
  color: var(--green2);
  font-family: var(--display);
  font-size: 1.2rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.sub { color: var(--muted); font-size: 13px; }

.btn {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #1a1405;
  padding: 9px 18px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(201, 162, 39, .22);
  /* reliable taps on mobile: no double-tap zoom delay, no swallowed clicks */
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 12px; font-size: 12px; }
.icon-btn {
  background: transparent; border: none; cursor: pointer;
  padding: 4px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn svg { display: block; }
.icon-btn:hover { background: rgba(201, 162, 39, .15); color: var(--gold-soft); }
.icon-btn.danger { background: transparent; padding: 4px; border-radius: 6px; color: var(--red); }
.icon-btn.danger:hover { background: rgba(208, 52, 44, .18); color: var(--red); }
.icon-btn.demote-admin svg, .icon-btn.promote-admin svg { color: var(--gold-soft); }
.btn.outline { background: transparent; border: 1px solid rgba(201, 162, 39, .5); color: var(--gold-soft); box-shadow: none; }
.btn.outline:hover { background: rgba(201, 162, 39, .12); }
.btn.secondary { background: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(10, 92, 58, .3); }
.danger { background: var(--red); color: #fff; padding: 9px 16px; border-radius: 999px; border: none; font-weight: 700; }
.danger:hover { filter: brightness(1.1); }
.ghost { background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 999px; }
.ghost:hover { color: var(--cream); background: rgba(255,255,255,.05); }

.card {
  background: linear-gradient(165deg, #1e1710, #14100c);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 16px; }

.grid { display: grid; gap: 12px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.tournament-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(165deg, #1e1710, #14100c);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.tournament-row:hover { border-color: rgba(201, 162, 39, .5); transform: translateY(-2px); }
.tournament-row .name { font-weight: 700; font-size: 15px; }
.cycle-head {
  margin: 18px 0 8px;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold);
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(201, 162, 39, .25);
}
.cycle-head:first-child { margin-top: 0; }
.badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--panel2); color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.badge.draft { background: #4a3d10; color: #f0d060; }
.badge.active { background: #12382a; color: #7fe0ae; }
.badge.completed { background: var(--green); color: #fff; }
.badge.single { background: var(--blue); color: #fff; }
.badge.double { background: #6d4aa0; color: #fff; }
.badge.group { background: #a05a2a; color: #fff; }
.badge.admin-only { background: var(--accent); color: #1a1405; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }

input, select {
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201, 162, 39, .12); }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.seed-input { width: 70px; padding: 6px 8px; }
.cap-q { font-size: 18px; font-weight: 700; padding: 8px 0; white-space: nowrap; }

/* bracket */
.bracket {
  display: flex;
  gap: 32px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}
.bgroup { display: flex; flex-direction: column; gap: 10px; }
.col-title {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.round-heads { display: flex; padding-bottom: 4px; }
.round-heads .rh {
  width: 210px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: center;
  flex-shrink: 0;
}
.round-heads .rh-abs {
  position: absolute;
  top: 0;
  width: 210px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: center;
}
.bracket-body { position: relative; }
.bracket-body svg.connectors { position: absolute; inset: 0; pointer-events: none; }
.bracket-body svg.connectors path {
  fill: none;
  stroke: var(--green);
  stroke-width: 1.6;
  opacity: .55;
}
.bracket-body .match .slot { padding: 5px 10px; font-size: 12.5px; }
.bracket-body .match .actions { min-height: 28px; }
.finals { display: flex; flex-direction: column; gap: 14px; }

.bracket .col { display: flex; flex-direction: column; gap: 8px; min-width: 210px; flex-shrink: 0; }
.bracket .col-head { text-align: center; font-size: 12px; color: var(--muted); padding: 4px; border-bottom: 1px solid var(--line); }
.match {
  background: linear-gradient(160deg, #241c14, #15100c);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.match-wrap {
  position: absolute;
  width: 210px;
  transform: translateY(-50%);
}
.match-wrap .match { width: 100%; }
.match-letter {
  position: absolute;
  top: -16px;
  left: 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  opacity: .9;
  letter-spacing: .5px;
}
.loser-note {
  position: absolute;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  padding-left: 2px;
}
.match .slot { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; font-size: 13px; border-bottom: 1px solid rgba(0,0,0,.25); }
.match .slot:last-child { border-bottom: none; }
.match-game {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
  border-bottom: 1px solid rgba(0,0,0,.25);
  background: rgba(255,255,255,.04);
  letter-spacing: .5px;
}
.match-loser {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
  border-top: 1px solid rgba(0,0,0,.25);
  background: rgba(255,255,255,.04);
  letter-spacing: .5px;
}
/* top table/status label of a match card */
.match-top {
  font-size: 9px;
  font-weight: 600;
  color: #d9b94f;
  text-align: center;
  padding: 2px 6px;
  letter-spacing: .4px;
  white-space: nowrap;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid rgba(0,0,0,.25);
  background: rgba(201, 162, 39, .08);
}
.match-top.ongoing {
  color: #fff;
  background: rgba(46, 125, 79, .85);
  animation: mg-pulse 1.6s ease-in-out infinite;
}
@keyframes mg-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}
.match-wrap > .match-top {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 4px);
  border: 1px solid rgba(201, 162, 39, .35);
  border-radius: 4px;
}
.match-wrap > .match-top.ongoing { border-color: rgba(127, 224, 174, .6); }
.match-top.editable { cursor: pointer; }
.match-top.editable:hover { background: rgba(201, 162, 39, .22); }

/* —— H2H player comparison —— */
.cmp { display: grid; grid-template-columns: 1fr 180px 1fr; gap: 14px; align-items: start; }
.cmp-col {
  background: linear-gradient(160deg, #241c14, #15100c);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.cmp-name { font-family: var(--display); font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.cmp-rows { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cmp-rows span { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; min-width: 0; }
.cmp-rows b { text-align: right; overflow-wrap: anywhere; }
.cmp-rows em { color: var(--muted); font-style: normal; }
.cmp-h2h {
  text-align: center;
  background: linear-gradient(160deg, #0b3d27, #07301e);
  border: 1px solid rgba(201, 162, 39, .45);
  border-radius: 10px;
  padding: 12px 10px;
}
.cmp-h2h-title { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.cmp-h2h-scores { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 26px; font-weight: 800; font-family: var(--display); }
.cmp-h2h-scores span:first-child { color: #7fe0ae; }
.cmp-h2h-scores span:last-child { color: var(--red); }
.cmp-h2h-scores em { font-style: normal; color: var(--muted); font-size: 16px; }
.cmp-matches { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.cmp-m { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.cmp-m a { color: var(--accent); }
.cmp-m .win { color: #7fe0ae; }
@media (max-width: 720px) { .cmp { grid-template-columns: 1fr; } }

/* —— player achievements + form —— */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.ach {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: linear-gradient(160deg, #0b3d27, #07301e);
  border: 1px solid rgba(201, 162, 39, .45);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.ach .ach-icon { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 6px rgba(201, 162, 39, .35)); }
.ach .ach-name { font-size: 11px; font-weight: 600; color: #e9e2d4; line-height: 1.25; }
.ach.locked { background: var(--panel2); border-color: var(--line); opacity: .55; }
.ach.locked .ach-icon { filter: grayscale(1); }
.ach.locked .ach-name { color: var(--muted); }
.ach-lock { position: absolute; top: 4px; right: 6px; font-size: 11px; opacity: .8; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-chips { display: flex; gap: 5px; }
.form-chip {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-weight: 800; font-size: 13px;
}
.form-chip.w { background: rgba(62, 165, 104, .25); color: #7fe0ae; border: 1px solid rgba(127, 224, 174, .4); }
.form-chip.l { background: rgba(208, 52, 44, .22); color: var(--red); border: 1px solid rgba(208, 52, 44, .4); }
.form-chip.d { background: rgba(150, 150, 150, .18); color: var(--muted); border: 1px solid rgba(150, 150, 150, .35); }

/* —— club dashboard —— */
.dash-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi {
  background: linear-gradient(160deg, #0b3d27, #07301e);
  border: 1px solid rgba(201, 162, 39, .45);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.kpi-value { font-family: var(--display); font-weight: 800; font-size: 30px; color: #fff; line-height: 1.15; min-height: 40px; display: flex; align-items: center; justify-content: center; }
.kpi-value a { color: #fff; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* long tournament names stay on one small line instead of stretching the grid */
.kpi-value.kpi-tour { font-size: 15px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 6px; }
.kpi-sub { font-size: 11px; color: #c9a227; margin-top: 2px; }
.dash-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dash-grid2 > .card, .dash-grid3 > .card { min-width: 0; max-width: 100%; overflow-x: hidden; margin-top: 0; height: 100%; box-sizing: border-box; }
.hm-scroll, .bars-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 120px; min-width: 480px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; }
.bar { width: 100%; background: linear-gradient(180deg, #c9a227, #8a6d1c); border-radius: 4px 4px 0 0; min-height: 4px; }
.bar-val { font-size: 10px; color: var(--muted); }
.bar-day { font-size: 9px; color: var(--muted); }
.heatmap { display: grid; grid-template-columns: 34px repeat(24, minmax(18px, 1fr)); gap: 2px; min-width: 620px; }
.hm-row { display: contents; }
.hm-day { font-size: 10px; color: var(--muted); display: flex; align-items: center; }
.hm-head .hm-hour { font-size: 8px; color: var(--muted); text-align: center; }
.hm-cell { height: 16px; border-radius: 3px; background: rgba(255,255,255,.05); }
.dash-matches { display: flex; flex-direction: column; gap: 10px; }
.dash-match {
  background: linear-gradient(160deg, #241c14, #15100c);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.dash-match.live { border-color: rgba(127, 224, 174, .5); }
.dm-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.dm-score { font-size: 14px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #3ea568; display: inline-block; animation: mg-pulse-2 1.4s ease-in-out infinite; }
@keyframes mg-pulse-2 { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.top-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13.5px; }
.top-row:last-child { border-bottom: none; }
.top-row .rank { width: 22px; height: 22px; border-radius: 50%; background: rgba(201,162,39,.15); color: #c9a227; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.top-row b { margin-left: auto; color: #7fe0ae; }
.tt-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.tt-row > span { width: 110px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-bar { height: 10px; background: linear-gradient(90deg, #c9a227, #8a6d1c); border-radius: 5px; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid2, .dash-grid3 { grid-template-columns: minmax(0, 1fr); }
}

/* —— tournament waiting list —— */.waitlist { border-top: 1px solid var(--line); padding-top: 14px; }
.waitlist-row { display: flex; flex-wrap: wrap; gap: 8px; }
.waitlist-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(201, 162, 39, .08);
  border: 1px solid rgba(201, 162, 39, .35);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  font-size: 13px;
}

/* —— "z kim zagrasz?" player path panel —— */
.path-panel { border-left: 3px solid var(--accent); }
.path-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  font-size: 13.5px;
}
.path-row:last-child { border-bottom: none; }
.path-row.next { background: rgba(201, 162, 39, .08); margin: 0 -12px; padding: 9px 12px; border-radius: 8px; }
.path-round { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.path-opps { text-align: right; font-weight: 600; }
.path-row.next .path-opps { font-weight: 700; color: var(--accent); }
@media (max-width: 600px) { .path-row { flex-direction: column; align-items: flex-start; gap: 4px; } .path-opps { text-align: left; } }
.match-half {
  position: absolute;
  left: -15px;
  top: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  background: linear-gradient(160deg, #241c14, #15100c);
  border: 1px solid var(--line);
  border-radius: 4px 0 0 4px;
  box-sizing: border-box;
  z-index: 1;
}
.match .slot.winner { background: rgba(62,165,104,.22); color: #b7f0cf; font-weight: 700; }
.match .slot .s-name { line-height: 1.3; }
.match .slot .s-side { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.match .slot .savg { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.match .slot .score { font-weight: 700; }
.match .slot .score.win { color: #7fe0ae; }
.match .slot .score.lose { color: var(--muted); }
.match .slot .score.live { color: #f0d060; }
.match .slot.bye { color: var(--muted); font-style: italic; }
.match .slot .partner { font-size: 13px; color: var(--text); font-weight: 400; }
.match .actions { display: flex; gap: 6px; padding: 6px; }
.match .actions .btn { flex: 1; }

.match.pending-match { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 20px rgba(201, 162, 39, .15); }

/* groups */
.groups-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.groups-wrap > .card { min-width: 0; margin-top: 0; }
.multi-cfg { display: grid; grid-template-columns: 46px minmax(46px, 1fr) minmax(0, 1.3fr) minmax(46px, 1fr) minmax(46px, 1fr); gap: 6px 6px; margin-top: 6px; align-items: center; }
.multi-cfg .head { color: var(--muted); font-size: 11px; font-weight: 600; }
.multi-cfg .multi-label { font-weight: 700; }
.multi-cfg input[type="number"] { width: 100%; }
.multi-cfg select { min-width: 0; }
.draft-groups { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.draft-groups .card { width: 100%; }
.draft-groups-members { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.draft-groups-members .roster-item { width: 100%; }
.standings .pos { color: var(--muted); }
.standings .qualified { color: #7fe0ae; font-weight: 700; }
.standings .qstar { color: var(--accent); }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: linear-gradient(165deg, #1e1710, #14100c);
  border: 1px solid rgba(201, 162, 39, .3);
  border-radius: 16px;
  padding: 22px;
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.modal h3 { margin-top: 0; }
.modal-wide { width: min(860px, 94vw); }
.modal .row { display: flex; gap: 12px; align-items: flex-end; }
.score-input {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  width: 100%;
}
.score-col { text-align: center; flex: 1; }
.score-col .pname { font-size: 13px; margin-bottom: 6px; min-height: 36px; }
.modal .hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.break-row { margin-top: 12px; }
.break-input {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  width: 100%;
}
.break-row .pname.sub { font-size: 11px; }

.brk { color: var(--accent); }
.brks { white-space: nowrap; }
.brk-list { white-space: nowrap; }
.brk-list b { color: var(--accent); margin: 0 2px; }
.brk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.brk-chip {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brk-chip b { color: var(--accent); }

/* login */
.auth-wrap { max-width: 440px; margin: 8vh auto; }
.auth-card {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(10, 92, 58, .35), transparent 55%),
    linear-gradient(165deg, #1a2418, #120e0a 60%, #1a150e);
  border: 1px solid rgba(201, 162, 39, .3);
  border-radius: 18px;
  padding: 30px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.auth-logo img {
  height: 34px;
  width: auto;
  filter: drop-shadow(0 3px 10px rgba(201, 162, 39, .35));
}
.auth-logo .brand-name { font-size: 1.4rem; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tabs .tab {
  flex: 1; text-align: center; padding: 9px; border-radius: 999px; cursor: pointer;
  background: var(--panel2); color: var(--muted); font-weight: 600;
}
.auth-tabs .tab.active { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1405; font-weight: 700; }

#aCapTurnstile { margin: 14px 0 6px; }
#aCapTurnstile .cf-turnstile { margin: 0 auto; }
#aCapTurnstile iframe { display: block; margin: 0 auto; }

.notice { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 10px; color: var(--text); font-size: 13px; }
.dispatch-panel { margin-bottom: 14px; border-left: 4px solid #c9a227; max-width: 520px; }
.dispatch-rows { display: flex; flex-direction: column; gap: 8px; }
.dispatch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dispatch-row .dispatch-match { flex: 1; min-width: 140px; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dispatch-row select { width: auto; max-width: 150px; padding: 5px 8px; font-size: 12.5px; }
.err-msg { color: #ff9a8c; font-size: 13px; margin-top: 10px; min-height: 18px; }
.ok-msg { color: #7fe0ae; font-size: 13px; margin-top: 10px; }

.empty { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }

.flex { display: flex; gap: 10px; align-items: center; }
.flex.between { justify-content: space-between; }
/* admin button rows (draft/shuffle/generate): wrap instead of stretching the page */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 480px) {
  .btn-row .btn { flex: 1 1 40%; }
}
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }

.champion-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  background: linear-gradient(90deg, rgba(201, 162, 39, .2), rgba(10, 92, 58, .35));
  border: 1px solid rgba(201, 162, 39, .4);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  font-family: var(--display);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.podium-line { display: inline-flex; align-items: center; gap: 8px; }
.podium-line b { font-weight: 700; }
.podium-line .flag { margin-right: 0; }
.share-page { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.share-footer { text-align: center; margin: 24px 0; color: var(--muted); font-size: 12px; }

.passkey-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.passkey-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.soft-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.soft-link:hover { color: var(--gold-soft); }

.pw-check {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 2px;
}
.pw-check-item {
  font-size: 12.5px;
  color: var(--muted);
  padding-left: 18px;
  position: relative;
}
.pw-check-item::before {
  content: "✗";
  position: absolute;
  left: 0;
  color: var(--red);
  font-weight: 700;
}
.pw-check-item.ok {
  color: #7fe0ae;
}
.pw-check-item.ok::before {
  content: "✓";
  color: #7fe0ae;
}

.rating-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}
.rating-tile {
  background: linear-gradient(165deg, #1e2418, #141a10);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}
.rating-game {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.rating-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--gold-soft);
  line-height: 1.1;
}
.rating-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* player profile */
.player-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
  flex-shrink: 0;
}
.player-photo.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green), #1c5a3a);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
}
.player-link { color: var(--green2); text-decoration: none; font-weight: 600; }
.player-link:hover { text-decoration: underline; color: var(--accent); }

tr.place-gold { background: rgba(201, 162, 39, .18); }
tr.place-silver { background: rgba(190, 200, 210, .16); }
tr.place-bronze { background: rgba(176, 106, 42, .16); }
tr.place-gold td, tr.place-silver td, tr.place-bronze td { border-bottom-color: rgba(0,0,0,.25); }
.tour-link { color: var(--green2); text-decoration: none; }
.tour-link:hover { text-decoration: underline; }

/* country flags */
.flag {
  display: inline-block;
  vertical-align: middle;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 1px 3px rgba(0,0,0,.5);
  margin-right: 8px;
}
.flag-20 { width: 20px; height: 14px; }
.flag-40 { width: 28px; height: 19px; }
.flag-16 { width: 16px; height: 11px; }
.match .slot .s-name .flag,
.match .slot .partner .flag,
.match .slot .s-name .flag-16,
.match .slot .partner .flag-16 { margin-right: 5px; }
.flag-cell { display: inline-flex; align-items: center; gap: 8px; }
.flag-cell .flag { margin-right: 0; }

/* country picker (custom dropdown with flags) */
.country-picker { position: relative; }
.cp-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s;
}
.cp-trigger:hover { border-color: var(--accent); }
.cp-trigger .flag { margin-right: 0; }
.cp-trigger-name { flex: 1; }
.cp-caret { color: var(--muted); font-size: 12px; }
.cp-menu {
  position: absolute;
  z-index: 30;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.cp-search {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel2);
  padding: 8px 12px;
  font-size: 13px;
}
.cp-search:focus { box-shadow: none; border-color: var(--line); }
.cp-list { max-height: 260px; overflow-y: auto; }
.cp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
}
.cp-item:hover { background: var(--panel2); }
.cp-item.selected { background: rgba(201, 162, 39, .15); }
.cp-item .flag { margin-right: 0; flex-shrink: 0; }
.cp-name { flex: 1; }
.cp-none-flag {
  display: inline-block;
  width: 20px; height: 14px;
  flex-shrink: 0;
  text-align: center;
  line-height: 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 3px;
}

/* ===== Mobile ===== */
@media (max-width: 720px) {
  body { overflow-x: hidden; }

  main#app { padding: 12px; }

  header#topbar { padding: 8px 10px; gap: 8px; flex-wrap: nowrap; }
  .brand { gap: 6px; }
  .brand-logo { height: 26px; }
  .brand-name { font-size: 1.05rem; }
  #topbar nav { gap: 4px; flex: 1; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  #topbar nav::-webkit-scrollbar { display: none; }
  .nav-btn { padding: 8px 10px; white-space: nowrap; font-size: 13px; }
  .userbox { gap: 6px; }
  .userbox #userName { display: none; }
  .lang-switch { padding: 2px; gap: 0; }
  .lang-btn { padding: 2px 4px; }
  .lang-btn svg { width: 18px; height: 12px; }

  h1 { font-size: 21px; }
  h2 { font-size: 17px; }

  .card { padding: 12px; border-radius: 10px; }

  .tournament-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .tournament-row .badges { justify-content: flex-start; flex-wrap: wrap; }
  .tournament-row .sub { font-size: 12px; }

  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 7px 6px; }

  .flex.between { flex-wrap: wrap; }
  #rankTabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  #rankTabs .tab { white-space: nowrap; }

  .auth-wrap { margin: 3vh auto; }
  .auth-card { padding: 20px; }

  .modal { width: 95vw; padding: 16px; max-height: 92vh; }
  .modal .row { gap: 8px; }
  .multi-cfg { grid-template-columns: 40px minmax(42px, 1fr) minmax(0, 1.3fr) minmax(42px, 1fr) minmax(42px, 1fr); gap: 4px; }
  .score-input { font-size: 22px; }

  .player-photo { width: 72px; height: 72px; font-size: 26px; }

  .champion-banner { font-size: 15px; padding: 14px; }

  .groups-wrap { grid-template-columns: 1fr; }

  .btn { padding: 10px 16px; }
  .btn.small { padding: 6px 12px; }
  .p-list { max-height: 180px; }
  .bracket { gap: 16px; }
  .bracket .col { min-width: 180px; }
  .finals { gap: 10px; }
}

/* ===== Hamburger + drawer (mobile) ===== */
.menu-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  gap: 3px;
}
.menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.menu-btn:hover { background: rgba(255, 255, 255, .06); }

.drawer, .drawer-backdrop { display: none; }

@media (max-width: 720px) {
  .menu-btn { display: flex; }
  #topbar nav,
  #topbar .lang-switch,
  #topbar .userbox { display: none; }
  .brand-name { font-size: 1rem; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .drawer {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 272px;
    max-width: 82vw;
    z-index: 95;
    background: linear-gradient(180deg, #1e1710, #14100c);
    border-right: 1px solid var(--line);
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 6px 0 24px rgba(0, 0, 0, .45);
  }
  body.drawer-open .drawer { transform: translateX(0); }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

  .drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 14px;
  }
  .drawer-nav .nav-btn {
    justify-content: flex-start;
    padding: 13px 14px;
    border-radius: 10px;
    font-size: 15px;
    text-align: left;
  }
  .drawer-lang { display: flex; gap: 8px; padding: 0 16px 18px; }
  .drawer-lang .lang-switch { flex-wrap: wrap; }
  .drawer-user {
    margin-top: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    border-top: 1px solid var(--line);
  }
  .drawer-logout { width: 100%; padding: 12px; }
}

/* ===== Scrollable tables ===== */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.table-scroll .tbl { min-width: max-content; }

/* ===== Draft bracket template ===== */
.draft-bracket {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  padding: 12px;
  background: rgba(10, 92, 58, .08);
  border: 1px solid rgba(10, 92, 58, .25);
  border-radius: 12px;
}
.draft-match {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.draft-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0,0,0,.2);
}
.draft-slot:last-child { border-bottom: none; }
.draft-slot.bye { color: var(--muted); font-style: italic; padding: 9px 8px; }
.seed-num {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 6px;
  background: var(--felt);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}
.draft-slot input.draft-search {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
}
.draft-slot input.draft-search:focus { border-color: var(--accent); outline: none; }
.draft-clear {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}
.draft-clear:hover { color: var(--red); border-color: var(--red); }
.draft-clear svg { display: block; margin: auto; }
.draft-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.roster-list {
  margin: 4px 0 0;
  padding-left: 24px;
  line-height: 1.9;
  color: var(--text);
}
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.roster-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.roster-item .seed-num {
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 13px;
}
.roster-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draft-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  font-size: 13px;
}
.draft-chip-x {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}
.draft-chip-x:hover { color: var(--red); border-color: var(--red); }

/* ===== Score modal grouping ===== */
.score-row { align-items: stretch; gap: 10px; margin-bottom: 4px; }
.score-card {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.score-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.score-card .score-input {
  background: var(--panel);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
}
.score-card .break-input {
  background: var(--panel);
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}
.score-sep {
  align-self: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 10px;
}
.break-add { display: flex; gap: 6px; }
.break-add .break-input { flex: 1; }
.break-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.break-chips .brk-chip { padding: 3px 6px; }
.chip-x {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  margin-left: 2px;
  padding: 0;
  line-height: 1;
}
.chip-x:hover { color: var(--red); }

/* ---------- rezerwacje ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.table-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.tiles-sep { width: 1px; align-self: stretch; background: var(--line); margin: 6px 2px; }
.tiles-cat {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 12px 0 8px;
}
.tiles-cat:first-child { margin-top: 0; }
.tiles-cat .tt-icon { width: 20px; height: 20px; }
.tiles-cat .tt-icon svg { width: 18px; height: 18px; }
.p-cat {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); padding: 10px 12px 4px;
}
.tbl-catrow td {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: #c9a227; background: rgba(201, 162, 39, .07); padding: 6px 10px;
}
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel2); }
.view-btn { padding: 7px 16px; background: transparent; color: var(--muted); border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
.view-btn + .view-btn { border-left: 1px solid var(--line); }
.view-btn.active { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1405; }
.view-btn:hover:not(.active) { color: var(--text); }
.table-tile {
  width: 64px;
  min-height: 64px;
  padding: 6px 4px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.table-tile:hover { border-color: var(--accent); }
.table-tile.active { border-color: var(--accent); background: rgba(46, 125, 79, .16); }
.tt-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.tt-icon svg { width: 26px; height: 26px; display: block; }
.tt-num { font-size: 12px; font-weight: 800; line-height: 1; }
.tt-cat { font-size: 8.5px; color: var(--muted); line-height: 1; white-space: nowrap; }
.cat-snooker { color: #8fd7ae; }
.cat-bilard { color: #8fb8e0; }
.cat-dart { color: #e0a08f; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: linear-gradient(180deg, var(--gold-soft), var(--gold)); color: #1a1405; border-color: transparent; }

.res-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.res-slot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  text-align: left;
  border: 1px solid var(--line);
  cursor: default;
  transition: transform .1s, box-shadow .15s;
}
.res-slot.free {
  background: rgba(46, 125, 79, .12);
  border-color: rgba(46, 125, 79, .4);
  cursor: pointer;
}
.res-slot.free:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(46, 125, 79, .18); }
.res-slot.taken { background: var(--panel2); color: var(--muted); opacity: .75; }
.res-slot .rs-time { font-weight: 800; }
.res-slot .rs-mark { font-size: 11px; opacity: .9; }

/* widok tygodniowy — kalendarz (dni = kolumny, godziny = wiersze) */
.week-grid {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.week-grid > div, .week-grid > .wg-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.week-grid > *:nth-child(8n) { border-right: none !important; }
.day-grid { display: grid; border: 1px solid var(--line); border-radius: 12px; }
.day-grid .wg-day.day-head { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px; padding: 4px; }
.day-grid .wg-day.day-head .tt-icon { width: 22px; height: 22px; }
.day-grid .wg-day.day-head .tt-icon svg { width: 20px; height: 20px; }
.day-grid .wg-day.day-head .day-head-text { font-size: 13px; font-weight: 700; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.day-grid > div, .day-grid > .wg-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wg-corner { padding: 8px; font-size: 11px; color: var(--muted); text-align: center; height: 42px; display: flex; align-items: center; justify-content: center; }
.wg-day {
  height: 42px;
  padding: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--panel2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.wg-day.today { background: rgba(46, 125, 79, .14); color: var(--green); }
.wg-day .wg-date { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.wg-day.today .wg-date { color: var(--green); }
.wg-time {
  padding: 6px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  background: var(--panel2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.wg-cell {
  border: none;
  padding: 2px;
  min-height: 42px;
  cursor: default;
  font-size: 11px;
  text-align: center;
  position: relative;
}
.wg-cell.closed { background: repeating-linear-gradient(45deg, rgba(0,0,0,.16), rgba(0,0,0,.16) 5px, rgba(0,0,0,.24) 5px, rgba(0,0,0,.24) 10px); }
.wg-cell.free { background: rgba(46, 125, 79, .10); cursor: pointer; }
.wg-cell.free:hover { background: rgba(46, 125, 79, .22); }
.wg-cell.free.past { background: transparent; cursor: default; }
.wg-cell.taken { background: var(--panel2); color: var(--muted); }
.wg-cell.free.overlap { background: rgba(46, 125, 79, .05); cursor: default; }
.wg-cell.free.overlap[data-book] { background: rgba(46, 125, 79, .10); cursor: pointer; }
.wg-cell.free.overlap[data-book]:hover { background: rgba(46, 125, 79, .22); }
.res-bar {
  position: absolute;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
  line-height: 1.15;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  box-sizing: border-box;
}
.res-bar.taken { background: rgba(46, 125, 79, .55); border: 1px solid rgba(127, 224, 174, .5); color: #d9f5e4; }
.res-bar.blocked {
  background: repeating-linear-gradient(45deg, rgba(138, 47, 34, .9), rgba(138, 47, 34, .9) 5px, rgba(164, 60, 45, .9) 5px, rgba(164, 60, 45, .9) 10px);
  border: 1px solid rgba(255, 120, 110, .5);
  color: #ffd9d4;
  cursor: pointer;
}
.res-bar span { display: block; }
.res-bar.mid { font-size: 11.5px; }
.res-bar.big { font-size: 13px; }
.wg-cell.blocked {
  background: repeating-linear-gradient(45deg, #f4d7d2, #f4d7d2 5px, #f9e5e1 5px, #f9e5e1 10px);
  color: #8a2f22;
  cursor: pointer;
}
.wg-note {
  position: absolute;
  left: 2px; right: 2px; bottom: 2px;
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.now-line {
  position: absolute;
  background: #e0392e;
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
}
.now-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e0392e;
}

/* blokada / niedostępność stołu */
.res-slot.blocked {
  background: repeating-linear-gradient(45deg, #f4d7d2, #f4d7d2 6px, #f9e5e1 6px, #f9e5e1 12px);
  border-color: rgba(180, 65, 47, .45);
  color: #8a2f22;
  cursor: pointer;
}
.res-slot.blocked .rs-mark { font-weight: 600; }
.res-closed {
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}
.oh-input { width: 100%; }

/* Rezerwacje — wąskie ekrany: kolumny mieszczą się w widoku, mniejsze nagłówki */
@media (max-width: 720px) {
  .day-grid .wg-day.day-head { gap: 3px; padding: 2px; }
  .day-grid .wg-day.day-head .tt-icon { width: 15px; height: 15px; }
  .day-grid .wg-day.day-head .tt-icon svg { width: 13px; height: 13px; }
  .day-grid .wg-day.day-head .day-head-text { font-size: 9.5px; }
  .wg-time { font-size: 9px; padding: 4px; }
  .res-bar { font-size: 9px; padding: 1px 3px; }
  .res-bar.mid { font-size: 10px; }
  .res-bar.big { font-size: 11px; }
}

/* Poziome przesuwanie widoku rezerwacji (dużo stołów / wąski ekran) */
.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  scrollbar-width: thin;
}
.res-grid-wrap { min-width: fit-content; }

/* przyklejona kolumna godzin (zostaje widoczna podczas przewijania) */
.day-grid .wg-time, .week-grid .wg-time,
.day-grid .wg-corner, .week-grid .wg-corner {
  position: sticky;
  left: 0;
  z-index: 2;
}
.wg-corner { background: var(--panel2); }

/* rating: K-factor and personal best (peak) */
.rating-k {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(201, 162, 39, .18);
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.rating-peak {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* —— live scoring pad —— */
.live-row { align-items: stretch; gap: 10px; margin-bottom: 12px; }
.live-card {
  flex: 1;
  background: linear-gradient(160deg, #0b3d27, #07301e);
  border: 1px solid rgba(201, 162, 39, .45);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  min-width: 0;
}
.live-name { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.live-score { font-family: var(--display); font-weight: 800; font-size: 52px; color: #fff; line-height: 1.1; }
.live-sep { font-family: var(--display); font-weight: 800; font-size: 40px; color: #c9a227; align-self: center; }
.live-btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.live-btns .btn { flex: 1; max-width: 110px; border-radius: 10px; font-size: 22px; font-weight: 800; padding: 12px 0; }
.live-breakrow { display: flex; gap: 8px; }
.live-breakrow input, .live-breakrow select { flex: 1; min-width: 0; }
.live-plusbtn { font-size: 20px; font-weight: 800; padding: 8px 16px; min-width: 48px; }
.live-break-ok { min-height: 16px; text-align: center; color: #6cd08c; font-size: 12px; font-weight: 700; margin: -4px 0 8px; }
.live-breakrow input.saved { border-color: #6cd08c; box-shadow: 0 0 0 2px rgba(108, 208, 140, .35); }
.live-stepper { display: flex; align-items: center; justify-content: center; gap: 10px; }
.live-stepper .btn { flex: 1; max-width: 84px; border-radius: 10px; font-size: 20px; font-weight: 800; padding: 10px 0; }
.live-rackval { font-family: var(--display); font-weight: 800; font-size: 30px; color: #fff; min-width: 44px; text-align: center; }
.live-final-score { display: flex; align-items: center; gap: 12px; font-size: 20px; margin: 12px 0 16px; }
.live-final-score .lfs-name { flex: 1; min-width: 0; }
.live-final-score .lfs-name.right { text-align: right; }
.live-final-score b { font-family: var(--display); font-size: 34px; color: #c9a227; white-space: nowrap; }
.cf-btns .btn { flex: 1; }
/* champion confetti overlay */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

/* —— darts X01 pad —— */
.dz-legline { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; }
.legdots { display: inline-flex; gap: 4px; }
.legdot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.15); }
.legdot.wa { background: #c9a227; }
.legdot.wb { background: #7fe0ae; }
.legdot.live { background: #fff; animation: mg-pulse-2 1.4s ease-in-out infinite; }
.dz-co { min-height: 18px; font-size: 12px; color: #f0d060; margin-top: 4px; }
.dz-avg { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dz-turn { text-align: center; font-size: 14px; margin-bottom: 10px; }
.dz-slots { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 10px; }
.dz-slots span[id] { min-width: 52px; text-align: center; padding: 8px 6px; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-weight: 700; }
.dz-slots span[id].filled { border-style: solid; border-color: #c9a227; color: #fff; }
.dz-slots .dz-prev { border: none; color: #c9a227; font-weight: 800; }
.dz-mult { display: flex; gap: 8px; margin-bottom: 8px; }
.dz-mult .btn { flex: 1; }
.dz-modeswitch { display: flex; gap: 8px; margin-bottom: 12px; }
.dz-modeswitch .btn { flex: 1; }
.dz-simplerow { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.dz-simplerow input { flex: 1; min-width: 0; font-size: 26px; font-weight: 800; text-align: center; }
.dz-simplerow .btn { flex: 1; }
.dz-finish-overlay { position: absolute; inset: 0; z-index: 30; border-radius: 16px;
  background: rgba(10, 8, 6, .85); display: flex; align-items: center; justify-content: center; padding: 20px; }
.dz-finish-card { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.dz-finish-q { font-size: 18px; font-weight: 800; color: #f0d060; }
.dz-finish-btns { display: flex; gap: 12px; }
.dz-finish-btns .btn { font-size: 24px; font-weight: 800; padding: 20px 0; min-width: 84px; }
.modal { position: relative; }
.dz-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dz-key { padding: 12px 0; font-size: 18px; font-weight: 800; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; }
.dz-key:active { filter: brightness(1.3); }
.dz-key.wide { grid-column: span 2; }
/* throwing player's card glows gold */
.live-card.throwing { border-color: #c9a227; box-shadow: 0 0 14px rgba(201, 162, 39, .5); }
/* TV darts countdown sub-line */
.tv-darts-sub { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tv-darts-sub b { color: #f0d060; }
/* TV darts leg score — the match score, unmissable from a distance */
.tv-legscore { text-align: center; margin-top: 6px; font-size: clamp(20px, 2.6vw, 32px); color: var(--muted); letter-spacing: .06em; }
.tv-legscore b { color: #c9a227; font-family: var(--display); font-size: 1.35em; margin-left: 10px; }
/* average riding under each duelist's name */
.tv-pavg { display: block; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; margin-top: 2px; }

/* —— TV wall display —— */
.tv { max-width: 1400px; margin: 0 auto; padding: 18px 18px 40px; }
.tv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.tv-title { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 4vw, 44px); color: #fff; line-height: 1.1; }
.tv-clock { font-family: var(--display); font-weight: 800; font-size: clamp(24px, 3.4vw, 38px); color: #c9a227; white-space: nowrap; }
.tv-soundbtn {
  background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 10px;
  font-size: .65em; padding: 2px 10px; cursor: pointer; vertical-align: middle; margin-left: 8px;
}
.tv-sound-overlay {
  position: fixed; inset: 0; z-index: 9000; cursor: pointer;
  background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center;
  text-align: center; font-size: clamp(20px, 3vw, 32px); color: #fff; padding: 24px; line-height: 1.5;
}
.tv-livepill {
  display: inline-block; background: #c0392b; color: #fff; font-size: .5em;
  padding: 2px 12px; border-radius: 999px; vertical-align: middle; letter-spacing: .1em;
  animation: mg-pulse-2 1.4s ease-in-out infinite;
}
.tv-livegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tv-card {
  background: linear-gradient(160deg, #0b3d27, #07301e);
  border: 1px solid rgba(201, 162, 39, .45);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.tv-card.ongoing { border-color: #3ea568; box-shadow: 0 0 0 1px #3ea568, 0 6px 18px rgba(0,0,0,.25); }
.tv-table { font-size: clamp(20px, 2.6vw, 32px); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #c9a227; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.tv-names { display: flex; flex-direction: column; gap: 2px; font-size: clamp(16px, 2vw, 22px); font-weight: 700; color: #fff; }
.tv-duel { display: flex; align-items: center; gap: 12px; margin: 6px 0; }
.tv-livegrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.tv-duel-name {
  flex: 1; min-width: 0; color: #fff;
  text-transform: uppercase; letter-spacing: .02em;
}
.tv-person { display: block; min-width: 0; }
.tv-duel-name.right .tv-person { text-align: right; }
.tv-first, .tv-last { display: block; white-space: nowrap; font-weight: 800; line-height: 1.12; }
.tv-first { font-size: clamp(22px, 3vw, 42px); }
.tv-last { font-size: clamp(18px, 2.4vw, 32px); color: #f0d060; }
.tv-plus { display: block; color: #c9a227; font-weight: 700; font-size: 14px; margin: 2px 0; }
.tv-duel-name.right { text-align: right; }
.tv-duel-score {
  font-family: var(--display); font-weight: 800; color: #c9a227;
  font-size: clamp(44px, 6vw, 76px); line-height: 1; white-space: nowrap;
}
.tv-score { font-family: var(--display); font-weight: 800; font-size: clamp(54px, 7vw, 92px); color: #fff; line-height: 1.05; margin: 4px 0; }
.tv-score span { color: #c9a227; margin: 0 8px; }
.tv-breaks { display: flex; gap: 8px; flex-wrap: wrap; }
.tv-breaks span { font-size: 13px; background: rgba(201,162,39,.15); color: #f0d060; border-radius: 999px; padding: 2px 12px; }
.tv-empty { text-align: center; color: var(--muted); font-size: 20px; padding: 40px 0; }
.tv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.tv-empty.small { padding: 16px 0; font-size: 15px; }
@media (max-width: 1100px) {
  .tv-cols { grid-template-columns: minmax(0, 1fr); }
}
.tv-sect { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.tv-list { display: flex; flex-direction: column; gap: 8px; }
.tv-duelrow {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(160deg, #241c14, #15100c);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px 14px;
}
.tv-duelrow-score {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(40px, 5vw, 60px); line-height: 1.1;
  color: #c9a227; white-space: nowrap;
}
.tv-row {
  background: linear-gradient(160deg, #241c14, #15100c);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 15px;
}
.tv-row-table { color: #c9a227; font-weight: 700; white-space: nowrap; }
.tv-foot { margin-top: 26px; text-align: center; }
@media (max-width: 700px) {
  .tv-livegrid { grid-template-columns: 1fr; }
  .live-score { font-size: 44px; }
}
/* compact live pad on phones: tighter score row, sub-rows stacked full-width */
@media (max-width: 480px) {
  .modal .live-row { gap: 6px; margin-bottom: 8px; }
  .modal .live-card { padding: 8px 6px; border-radius: 10px; }
  .modal .live-name { font-size: 11px; }
  .modal .live-score { font-size: 38px; }
  .modal .live-sep { font-size: 24px; }
  .modal .live-btns { gap: 6px; margin-top: 6px; }
  .modal .live-btns .btn { font-size: 20px; padding: 10px 0; }
  .modal .live-sub { align-items: stretch; }
  .modal .live-sub .live-plusbtn { padding: 8px 12px; min-width: 44px; }
  .modal .live-stepper { gap: 6px; }
  .modal .live-stepper .btn { flex: 1; max-width: none; font-size: 18px; padding: 8px 0; }
  .modal .live-rackval { font-size: 24px; min-width: 30px; }
  .modal .live-final-score { font-size: 17px; gap: 8px; }
  .modal .live-final-score b { font-size: 28px; }
}

/* —— printable sheet (bar pin-up): paper look on screen, pure B&W on paper —— */
.print-sheet {
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 28px 30px;
  max-width: 820px;
  margin: 0 auto 30px;
}
.print-sheet h1 { color: #111; margin: 0 0 4px; font-size: 26px; }
.print-sheet h2 { color: #111; margin: 22px 0 8px; font-size: 18px; border-bottom: 2px solid #111; padding-bottom: 4px; }
.print-sheet .print-meta { color: #333; font-size: 13px; margin-bottom: 6px; }
.print-sheet table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.print-sheet th, .print-sheet td { border: 1px solid #111; color: #111; padding: 5px 9px; font-size: 13.5px; text-align: left; background: #fff; }
.print-sheet th { background: #eee; font-weight: 700; }
.print-sheet .print-vs { width: 26px; text-align: center; color: #111; }
.print-sheet .print-score { white-space: nowrap; text-align: center; min-width: 90px; }
.print-sheet .print-blank { color: #555; letter-spacing: 1px; }
.print-sheet .print-foot { margin-top: 18px; font-size: 12px; color: #555; text-align: center; }
.print-sheet h2, .print-sheet table, .print-sheet tr { break-inside: avoid; }
.print-bracket { overflow: hidden; }
.print-bracket .bracket { overflow: visible; }

@media print {
  @page { size: landscape; }
  #topbar, #site-footer, #drawer, .drawer-backdrop, #modal-root, .no-print { display: none !important; }
  body { background: #fff; }
  #app { padding: 0; margin: 0; max-width: none; }
  .print-sheet { border-radius: 0; padding: 0; margin: 0; max-width: none; }
  .print-sheet .bracket { overflow: visible; }
  /* monochrome bracket: white cards, black ink, no flags */
  .print-sheet * { animation: none !important; }
  .print-sheet img.flag { display: none !important; }
  .print-sheet .match { background: #fff !important; border: 1px solid #000 !important; box-shadow: none !important; }
  .print-sheet .match-top { background: #fff !important; color: #000 !important; border-color: #000 !important; font-weight: 700; }
  .print-sheet .slot, .print-sheet .s-name, .print-sheet .partner { background: #fff !important; color: #000 !important; }
  .print-sheet .slot.winner { background: #fff !important; }
  .print-sheet .slot.winner .s-name { text-decoration: underline; }
  .print-sheet .score, .print-sheet .score.win, .print-sheet .score.lose, .print-sheet .score.live { color: #000 !important; }
  /* pen-friendly result column: bordered box at the row end, digit-sized */
  .print-sheet .match .slot { padding-right: 0 !important; }
  .print-sheet .match .slot .score {
    border-left: 1px solid #000 !important;
    min-width: 32px !important;
    align-self: stretch !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .print-sheet a, .print-sheet .match-letter, .print-sheet .match-half, .print-sheet .match-loser, .print-sheet .col-title, .print-sheet .rh { color: #000 !important; text-decoration: none !important; border-color: #000 !important; }
  .print-sheet .bracket-body svg.connectors path { stroke: #000 !important; opacity: 1 !important; }
}

/* ---------------- liga ---------------- */
.league-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, transform .1s;
}
.league-row:hover { border-color: var(--accent); }
.league-row:active { transform: scale(.995); }
.league-row-main { min-width: 0; }
.league-name { font-weight: 800; font-size: 17px; }
.league-row-go { font-size: 24px; color: var(--muted); line-height: 1; }

.lg-table { margin-top: 8px; }
.lg-table td, .lg-table th { white-space: nowrap; }

.lg-fixtures { margin-top: 10px; display: grid; gap: 10px; }
.lg-round { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lg-round-head { padding: 6px 12px; font-size: 12px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.lg-fixture { display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: center;
  gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.lg-fixture:last-child { border-bottom: none; }
.lg-fx-a { text-align: left; }
.lg-fx-b { text-align: right; }
.lg-fx-a.win, .lg-fx-b.win { font-weight: 800; color: var(--accent); }
.lg-fx-score { min-width: 44px; text-align: center; font-weight: 800;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.lg-fixture.done .lg-fx-score { color: var(--text); }
.lg-comm { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px;
  padding: 4px 7px; cursor: pointer; font-size: 14px; line-height: 1; }
.lg-comm:hover { border-color: var(--accent); }

/* termin + czat per mecz */
.comm-offer { border: 1px solid #c9a227; border-radius: 10px; padding: 10px; margin-bottom: 10px;
  background: var(--panel2); }
.comm-offer.mine { border-style: dashed; }
.comm-offer .btn { margin-top: 8px; }
.comm-propose { display: grid; gap: 8px; }
.comm-propose label { margin: 0; }
.comm-head { font-weight: 800; margin: 14px 0 6px; }
.comm-msgs { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 8px; padding: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; }
.comm-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 88%; }
.comm-msg.mine { align-self: flex-end; }
.comm-msg[data-mine="0"] { cursor: pointer; }
.comm-avatar { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; }
.comm-bubble { min-width: 0; padding: 7px 10px 4px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); word-break: break-word; }
.comm-msg.mine .comm-bubble { background: var(--accent); color: #10231a; border-color: var(--accent); }
.comm-name { font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.comm-text { white-space: pre-wrap; }
.comm-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  margin-top: 2px; font-size: 10.5px; opacity: .75; }
.comm-status { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid currentColor;
  font-size: 9px; line-height: 1; font-weight: 800; }
.comm-status.read { background: #0b3d28; color: #9be6b4; border-color: #0b3d28; }
.comm-send { display: flex; gap: 8px; margin-top: 8px; }
.comm-send input { flex: 1; min-width: 0; }

.lg-prow { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--line); }
.lg-prow:last-child { border-bottom: none; }
.lg-pname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-pdiv { width: 150px; flex: 0 0 auto; }
.lg-round-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 8px; }

/* strefy awansu/spadku w tabeli ligi */
.lg-table tr.zone-up { background: rgba(80, 200, 120, .10); }
.lg-table tr.zone-up .pos { box-shadow: inset 3px 0 0 #4caf50; }
.lg-table tr.zone-down { background: rgba(220, 80, 80, .10); }
.lg-table tr.zone-down .pos { box-shadow: inset 3px 0 0 #e0575b; }
.lg-legend .lg-up { color: #6cd08c; font-weight: 700; }
.lg-legend .lg-down { color: #e0575b; font-weight: 700; }

/* kreator ligi: przypisywanie zawodników (szukajka) */
.lg-div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 12px; background: var(--panel2); }
.lg-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 6px; margin-bottom: 6px; }
.ac-wrap { position: relative; }
.comm-ok { color: #6cd08c; font-weight: 700; }

/* liga: akcje w wierszu terminarza (wynik / live / termin) */
.lg-fx-a, .lg-fx-b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-fx-actions { display: flex; gap: 4px; justify-content: flex-end; }
.lg-act { border: 1px solid var(--line); background: var(--panel2); border-radius: 7px;
  padding: 3px 7px; font-size: 12px; font-weight: 700; color: var(--text); cursor: pointer; white-space: nowrap; }
.lg-act:hover { border-color: var(--accent); }
.lg-act-icon { padding: 3px 6px; }

/* liga: lista dywizji w karcie sezonu */
.lg-divlist { display: flex; flex-direction: column; }
.lg-divrow { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.lg-divrow:hover { background: var(--panel2); }
.lg-divrow-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lg-divrow-go { color: var(--muted); font-size: 20px; line-height: 1; }

/* Na telefonach ograniczamy wysokość modala do dynamicznego viewportu
   (uwzględnia klawiaturę), ale zostawiamy go wyśrodkowanego. */
@media (max-width: 700px) {
  .modal { max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
}

/* Zablokuj przewijanie tła, gdy otwarty jest modal (żeby strona nie uciekała). */
body.modal-open { overflow: hidden; }

/* filtr listy turniejów: dyscyplina + zakres dat */
.tourn-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tourn-filter select { min-width: 170px; width: auto; }
.tf-dates { display: flex; align-items: center; gap: 6px; }
.tf-dates label { margin: 0; font-size: 12px; color: var(--muted); }
.tf-dates input { width: auto; }

/* filtr dyscyplin: przełączane chipy (wielokrotny wybór) */
.tf-games { display: flex; flex-wrap: wrap; gap: 6px; }
.tf-chip { border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.tf-chip:hover { border-color: var(--accent); }
.tf-chip.on { background: var(--accent); color: #10231a; border-color: var(--accent); }

/* live break log chips */
.live-breakchips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; min-height: 14px; justify-content: center; }
.live-breakchips .brk-chip { font-size: 12px; }

/* legenda nazw turniejów w rankingu cyklu — jedna pod drugą */
.rank-legend div { line-height: 1.5; }

/* live score auto-refresh: hidden until a match goes live, and a brief flash
   on the score that just changed */
.score.score-off { display: none; }
@keyframes mg-score-bump {
  0% { text-shadow: none; }
  25% { color: #fff; text-shadow: 0 0 14px rgba(255,233,138,.95), 0 0 4px rgba(255,255,255,.85); }
  100% { text-shadow: none; }
}
.score.score-bump { animation: mg-score-bump 1.2s ease-out; }
@keyframes mg-score-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); color: #ffe98a; }
  100% { transform: scale(1); }
}
.live-score.score-bump { animation: mg-score-pop .9s ease-out; }
.tv-duel-score.score-bump { animation: mg-score-pop 1s ease-out; }

/* best-of wg etapu: pole etapu rośnie, best of i ✕ mają naturalną szerokość */
.bo-rule-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.bo-rule-row .bo-rule-phase { flex: 1 1 auto; min-width: 0; }
.bo-rule-row .bo-rule-bo { flex: 0 0 auto; width: auto; }
.bo-rule-row .bo-rule-del { flex: 0 0 auto; }
/* multi-ball stage rules: race-to frames per sub-discipline instead of best-of */
.bo-rule-row .bo-frames { display: none; }
.bo-rules-multi .bo-rule-row .bo-rule-bo { display: none; }
.bo-rules-multi .bo-rule-row .bo-frames { display: inline-flex; gap: 6px; align-items: center; }
.bo-rule-row .bo-frames label { display: inline-flex; gap: 3px; align-items: center; color: var(--muted); font-size: 12px; }
.bo-rule-row .bo-frames input { width: 52px; }

/* pre-results play-off draw: placeholder slot order */
.po-predraw-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
