/* =====================================================================
   TEMI
   Ogni tema definisce gli stessi colori. "auto" usa Padel o Padel notte
   in base alle impostazioni del dispositivo.
   ===================================================================== */

/* Padel (predefinito): blu campo e giallo pallina */
:root {
  color-scheme: light;
  --bg: #eef3fa;
  --card: #ffffff;
  --card-alt: #f6f9fd;
  --text: #0f1d33;
  --muted: #5a6b85;
  --border: #dbe4f0;
  --accent: #1f5fbf;
  --accent-ink: #ffffff;
  --accent-soft: #e4edfb;
  --ball: #d4f53c;
  --ball-ink: #1d2a00;
  --hero-from: #173f80;
  --hero-to: #2a6fd4;
  --hero-ink: #ffffff;
  --nav-bg: #12325f;
  --score-bg: #0f1d33;
  --score-ink: #d4f53c;
  --score-empty: #2a3a57;
  --win: #1f5fbf;
  --warn: #9a5b00;
  --warn-soft: #fff4d6;
  --danger: #c4321f;
  --input: #ffffff;
  --shadow: 0 1px 2px rgba(15, 29, 51, 0.06), 0 10px 28px -14px rgba(15, 29, 51, 0.22);
}

/* Padel notte: campo sotto i riflettori */
:root[data-theme="notte"] {
  color-scheme: dark;
  --bg: #080e1c;
  --card: #111a2e;
  --card-alt: #0d1526;
  --text: #e8eefb;
  --muted: #8d9bb8;
  --border: #22304f;
  --accent: #5b9dff;
  --accent-ink: #06122a;
  --accent-soft: #15254a;
  --ball: #d4f53c;
  --ball-ink: #1d2a00;
  --hero-from: #081634;
  --hero-to: #173a86;
  --hero-ink: #ffffff;
  --nav-bg: #060d1f;
  --score-bg: #03060d;
  --score-ink: #d4f53c;
  --score-empty: #1d2a44;
  --win: #8cc0ff;
  --warn: #f5c542;
  --warn-soft: #2e2710;
  --danger: #ff7a66;
  --input: #0b1222;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -16px rgba(0, 0, 0, 0.8);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #080e1c;
    --card: #111a2e;
    --card-alt: #0d1526;
    --text: #e8eefb;
    --muted: #8d9bb8;
    --border: #22304f;
    --accent: #5b9dff;
    --accent-ink: #06122a;
    --accent-soft: #15254a;
    --hero-from: #081634;
    --hero-to: #173a86;
    --nav-bg: #060d1f;
    --score-bg: #03060d;
    --score-empty: #1d2a44;
    --win: #8cc0ff;
    --warn: #f5c542;
    --warn-soft: #2e2710;
    --danger: #ff7a66;
    --input: #0b1222;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -16px rgba(0, 0, 0, 0.8);
  }
}

/* Campo verde */
:root[data-theme="verde"] {
  color-scheme: light;
  --bg: #eef5f0;
  --card: #ffffff;
  --card-alt: #f5faf6;
  --text: #0f2418;
  --muted: #587062;
  --border: #d5e5da;
  --accent: #1d7a4a;
  --accent-ink: #ffffff;
  --accent-soft: #e0f1e6;
  --ball: #f2e94e;
  --ball-ink: #2a2600;
  --hero-from: #125233;
  --hero-to: #22915a;
  --nav-bg: #0e3f27;
  --score-bg: #0f2418;
  --score-ink: #f2e94e;
  --score-empty: #29453a;
  --win: #1d7a4a;
  --shadow: 0 1px 2px rgba(15, 36, 24, 0.06), 0 10px 28px -14px rgba(15, 36, 24, 0.22);
}

/* Classico: il tema originale, sobrio */
:root[data-theme="classico"] {
  color-scheme: light;
  --bg: #f3f6f5;
  --card: #ffffff;
  --card-alt: #f8faf9;
  --text: #17201d;
  --muted: #5d6b66;
  --border: #dbe3e0;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f0;
  --ball: #0f766e;
  --ball-ink: #ffffff;
  --hero-from: #0f766e;
  --hero-to: #0f766e;
  --nav-bg: #ffffff;
  --score-bg: #ffffff;
  --score-ink: #17201d;
  --score-empty: #ffffff;
  --win: #0f766e;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
:root[data-theme="classico"] .tabs { border-bottom: 1px solid var(--border); }
:root[data-theme="classico"] .tabs button { color: var(--muted); }
:root[data-theme="classico"] .tabs button.active { background: var(--accent); color: #fff; }

/* Dimensione del testo */
html { font-size: 15px; }
html[data-size="grande"] { font-size: 17px; }
html[data-size="molto-grande"] { font-size: 19px; }

/* =====================================================================
   BASE
   ===================================================================== */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name, .display {
  font-family: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  letter-spacing: 0.01em;
}

svg { flex-shrink: 0; }

/* =====================================================================
   TESTATA
   ===================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  color: var(--hero-ink);
}
.court-deco {
  position: absolute;
  inset: 10px 16px;
  width: calc(100% - 32px);
  height: calc(100% - 20px);
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.5;
  opacity: 0.16;
  vector-effect: non-scaling-stroke;
}
.court-deco * { vector-effect: non-scaling-stroke; }
.hero-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo { width: 46px; height: 46px; }
.logo-head, .logo-handle { fill: #ffffff; }
.logo-holes { fill: var(--hero-from); opacity: 0.55; }
.logo-ball { fill: var(--ball); stroke: var(--hero-from); stroke-width: 2; }
.logo-seam { fill: none; stroke: var(--hero-from); stroke-width: 1.6; opacity: 0.5; }
:root[data-theme="classico"] .logo-ball { fill: #ffffff; }
.brand-name { font-size: 1.75rem; font-weight: 800; line-height: 1; text-transform: uppercase; }
.brand-sub { font-size: 0.93rem; opacity: 0.85; margin-top: 3px; }
.version {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  font-family: "Barlow", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
}
.brand-sub:empty { display: none; }

/* =====================================================================
   SCHEDE DI NAVIGAZIONE
   ===================================================================== */

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  padding: 8px max(16px, calc((100% - 1100px) / 2 + 16px));
  background: var(--nav-bg);
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: 0 4px 14px -8px rgba(0, 0, 0, 0.35);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tabs button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabs button:hover:not(:disabled):not(.active) { background: rgba(255, 255, 255, 0.1); color: #fff; }
.tabs button.active { background: var(--ball); color: var(--ball-ink); }
.tabs button:disabled { opacity: 0.35; cursor: default; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* =====================================================================
   CARD E TESTI
   ===================================================================== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
}
.card h2::before {
  content: "";
  flex-shrink: 0;
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  background:
    radial-gradient(circle at -12% 50%, transparent 58%, rgba(255, 255, 255, 0.85) 60%, rgba(255, 255, 255, 0.85) 68%, transparent 70%),
    radial-gradient(circle at 112% 50%, transparent 58%, rgba(255, 255, 255, 0.85) 60%, rgba(255, 255, 255, 0.85) 68%, transparent 70%),
    var(--ball);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.card h3 { margin: 0; font-size: 1.2rem; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.87rem; margin: 12px 0 0; }
.warn { color: var(--warn); font-weight: 600; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  justify-content: center;
}
.notice {
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 16px;
}

/* =====================================================================
   CONTROLLI
   ===================================================================== */

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { width: 100%; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, filter 0.15s, background 0.15s;
}
.btn:hover:not(:disabled) { filter: brightness(0.97); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ball {
  background: var(--ball);
  border-color: color-mix(in srgb, var(--ball) 70%, #000);
  color: var(--ball-ink);
  font-weight: 700;
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--ball) 90%, #000);
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 0.87rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
}
.icon:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.icon.danger:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.icon:disabled { opacity: 0.3; cursor: default; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  align-items: end;
}
.grid-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.grid-form label input, .grid-form label select {
  color: var(--text);
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar .spacer { flex: 1; }
.toolbar label { display: flex; gap: 8px; align-items: center; font-weight: 600; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* =====================================================================
   TORNEI
   ===================================================================== */

.t-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.t-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-alt);
}
.t-list li.current { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--ball); }
.t-list .t-title { display: flex; align-items: center; gap: 10px; }
.t-list .t-title strong { font-size: 1.05rem; }
.t-list .t-date { font-size: 0.85rem; color: var(--muted); }
.t-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ball); box-shadow: 0 0 0 3px var(--accent-soft); }
.import { margin-top: 14px; }

/* =====================================================================
   COPPIE
   ===================================================================== */

.bulk { margin-top: 14px; }
.bulk summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.bulk .btn { margin-top: 8px; }

.teams { list-style: none; padding: 0; margin: 16px 0 0; counter-reset: team; }
.teams li {
  display: grid;
  grid-template-columns: 34px 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.teams .num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.teams li.seeded .num { background: var(--ball); color: var(--ball-ink); }
.teams li.seeded input { border-color: color-mix(in srgb, var(--ball) 55%, var(--border)); }
.teams li.incomplete input:placeholder-shown { background: var(--card-alt); border-style: dashed; }
.teams input.is-default { color: var(--muted); font-style: italic; background: var(--card-alt); }

/* Etichetta "TdS" (testa di serie) */
.tds {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--ball);
  color: var(--ball-ink);
  font-weight: 800;
  font-size: 0.75rem;
  margin-right: 4px;
}

.badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.badge.ok { background: var(--ball); color: var(--ball-ink); }

/* Scelta del sorteggio */
.draw-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.draw-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card-alt);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.draw-option:hover:not(:disabled) { border-color: var(--accent); box-shadow: var(--shadow); }
.draw-option:active:not(:disabled) { transform: translateY(1px); }
.draw-option:disabled { opacity: 0.45; cursor: not-allowed; }
.draw-option strong { display: block; font-size: 1.05rem; }
.draw-option .muted { display: block; font-size: 0.85rem; line-height: 1.3; margin-top: 2px; }
.draw-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--ball);
  color: var(--ball-ink);
  flex-shrink: 0;
}
.draw-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

.summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.summary p { margin: 0; }

@media (max-width: 560px) {
  .teams li { grid-template-columns: 30px 1fr auto; }
  .teams li input:nth-of-type(2) { grid-column: 2; }
  .teams li .row-actions { grid-row: 1 / span 2; grid-column: 3; flex-direction: column; }
}

/* =====================================================================
   GIRONI
   ===================================================================== */

.groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 470px), 1fr));
  gap: 18px;
}
.groups .card { margin: 0; padding: 0; overflow: hidden; }
.group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  color: var(--hero-ink);
}
.group-title { display: flex; align-items: center; gap: 10px; }
.group-letter {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ball);
  color: var(--ball-ink);
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.4);
}
.group-title h3 { font-size: 1.3rem; text-transform: uppercase; font-weight: 700; }
.done-tag {
  display: inline-block;
  font-family: "Barlow", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
}
.where { display: flex; gap: 6px; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.chip select {
  border: 0;
  background: rgba(255, 255, 255, 0.92);
  color: #0f1d33;
  border-radius: 999px;
  padding: 2px 6px;
  font-weight: 700;
  font-size: 0.85rem;
}
:root[data-theme="classico"] .group-head { background: var(--card-alt); color: var(--text); border-bottom: 1px solid var(--border); }
:root[data-theme="classico"] .chip, :root[data-theme="classico"] .done-tag { background: var(--accent-soft); color: var(--accent); }
.group-body { padding: 6px 16px 14px; }

/* Scelte a pulsanti (al posto dei menu a tendina) */
.option-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 16px; }
.option-label {
  min-width: 220px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Scambio coppie a due clic */
.swap-btn {
  font: inherit;
  color: var(--text);
  background: var(--card-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  text-align: left;
}
.swap-btn:hover { border-color: var(--accent); }
.swap-btn[draggable="true"] { cursor: grab; }
.matches-toggle { width: 100%; margin-top: 10px; justify-content: center; color: var(--accent); }
.court-pick {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 4px 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.court-pick button {
  min-width: 26px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #0f1d33;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.court-pick button.active { background: var(--ball); color: var(--ball-ink); }
:root[data-theme="classico"] .court-pick { background: var(--accent-soft); color: var(--accent); }
.swap-btn.dragging { opacity: 0.45; }
.drop-group.drop-over { box-shadow: 0 0 0 3px var(--ball), var(--shadow); }
.swap-btn.picked { background: var(--ball); color: var(--ball-ink); border-style: solid; border-color: transparent; font-weight: 700; }

/* =====================================================================
   SIMULAZIONE
   ===================================================================== */

.steppers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.stepper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--card-alt);
  border: 1px solid var(--border);
}
.stepper-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.stepper-ctl { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper-val {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.step-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.step-btn:active { transform: translateY(1px); }

.sim-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.sim-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card-alt);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sim-option:hover { border-color: var(--accent); }
.sim-option.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.so-title { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.so-best {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--ball);
  color: var(--ball-ink);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  vertical-align: middle;
}
.so-line { font-size: 0.88rem; color: var(--muted); }
.so-line strong { color: var(--text); }
.so-line.warn { color: var(--warn); }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  color: var(--hero-ink);
}
:root[data-theme="classico"] .kpi { background: var(--accent-soft); color: var(--text); }
.kpi-val { font-family: "Barlow Condensed", sans-serif; font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--ball); }
:root[data-theme="classico"] .kpi-val { color: var(--accent); }
.kpi-lbl { font-size: 0.82rem; opacity: 0.9; }

.lanes { display: grid; gap: 8px; }
.lane { display: grid; grid-template-columns: 76px 1fr; gap: 10px; align-items: center; }
.lane-name { font-weight: 700; font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.lane-bar { display: flex; gap: 4px; min-height: 44px; }
.lane-block, .lane-free {
  flex-basis: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 8px;
  overflow: hidden;
  white-space: nowrap;
}
.lane-block { background: var(--accent); color: var(--accent-ink); }
.lane-block:nth-child(even) { background: color-mix(in srgb, var(--accent) 70%, var(--card)); }
.lane-block strong { font-family: "Barlow Condensed", sans-serif; font-size: 1.05rem; line-height: 1.1; }
.lane-block small { font-size: 0.72rem; opacity: 0.9; overflow: hidden; text-overflow: ellipsis; }
.lane-free {
  background: repeating-linear-gradient(45deg, var(--card-alt), var(--card-alt) 6px, var(--border) 6px, var(--border) 7px);
  color: var(--muted);
  font-size: 0.78rem;
  align-items: center;
}
.sim-notes { margin: 14px 0 0; padding-left: 20px; color: var(--warn); font-size: 0.9rem; }
.plan-sub { margin: 20px 0 10px !important; font-size: 1.05rem !important; text-transform: uppercase; color: var(--muted); }
.plan-sub:first-child { margin-top: 0 !important; }
.create-row { display: flex; justify-content: flex-end; margin-top: 20px; }
.stepper-val small { font-family: "Barlow", sans-serif; font-size: 0.75rem; font-weight: 600; color: var(--muted); margin-left: 4px; }

/* Regolamento */
.rules-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.rules-field textarea { color: var(--text); font-size: 1rem; text-transform: none; letter-spacing: 0; line-height: 1.5; min-height: 120px; }
.rules-text { white-space: pre-wrap; line-height: 1.55; }
.rules-list { margin: 0 0 6px; padding-left: 22px; display: grid; gap: 6px; line-height: 1.45; }
.rules-list li::marker { color: var(--accent); font-weight: 700; }
.rules-list strong { color: var(--text); }

/* Tipi di torneo */
.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.type-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--card-alt);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.type-card:hover { border-color: var(--accent); }
.type-card.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.type-art { width: 56px; height: 50px; flex-shrink: 0; }
.type-text strong { font-size: 1.05rem; }
.type-text .muted { display: block; font-size: 0.85rem; line-height: 1.35; margin-top: 3px; }
.btn.big { padding: 14px 28px; font-size: 1.1rem; border-radius: 14px; }
@media (max-width: 560px) { .create-row .btn { width: 100%; } }
.sim-rounds { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sim-rounds li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* =====================================================================
   CALENDARIO
   ===================================================================== */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.cal-grid .card { margin: 0; }
.cal { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.cal li {
  display: grid;
  grid-template-columns: 28px auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--card-alt);
  font-size: 0.93rem;
}
.cal li.done { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.cal li.now { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--ball); }
.cal-n {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
}
.cal li.now .cal-n { background: var(--ball); color: var(--ball-ink); border-color: transparent; }
.cal-tag {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--hero-to);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  white-space: nowrap;
}
:root[data-theme="classico"] .cal-tag { background: var(--accent); }
.cal-when { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.cal-time { font-family: "Barlow Condensed", sans-serif; font-weight: 800; font-size: 1.05rem; line-height: 1; }
.cal-teams { min-width: 0; line-height: 1.25; }
.cal-teams .win { font-weight: 700; color: var(--win); }
.cal-vs { color: var(--muted); margin: 0 2px; }
.cal-score { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 1.05rem; white-space: pre; }
.cal-now { font-weight: 700; font-size: 0.8rem; color: var(--accent); white-space: nowrap; }
.cal-todo { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.cal-bad { font-size: 0.8rem; color: var(--danger); font-weight: 700; white-space: nowrap; }
@media (max-width: 560px) {
  .cal li { grid-template-columns: 26px auto 1fr; }
  .cal li > :last-child { grid-column: 2 / -1; }
}

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 5px; text-align: center; border-bottom: 1px solid var(--border); }
th {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
th.l, td.l { text-align: left; }
td.pos { width: 34px; }
.pos-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--card-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}
tr.first .pos-badge { background: var(--ball); color: var(--ball-ink); border-color: transparent; }
tr.first td.l { font-weight: 700; }
td.pts { font-weight: 700; color: var(--accent); }
.rank-no {
  display: inline-block;
  min-width: 22px;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}
td.l .tag { display: block; font-size: 0.72rem; color: var(--warn); font-weight: 600; }
td.l select { margin-top: 4px; width: 100%; font-size: 0.85rem; padding: 4px; }
tr.band td {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
}
.table-wrap { overflow-x: auto; }

/* =====================================================================
   SEGNAPUNTI (gironi e tabellone): una colonna per set, come nel tennis
   ===================================================================== */

.matches { margin-top: 14px; display: grid; gap: 8px; }
.sb {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--card-alt);
}
.sb.done { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.sb.bad { box-shadow: inset 0 0 0 2px var(--danger); }
.sb-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: auto minmax(38px, auto) minmax(38px, auto);
  grid-template-columns: minmax(0, 1fr);
  grid-auto-columns: 44px;
  column-gap: 6px;
  row-gap: 4px;
  align-items: center;
}
.sb-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-align: center;
  line-height: 1;
  white-space: nowrap;
}
.sb-team { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 0.95rem; line-height: 1.15; }
.sb-team .nm { min-width: 0; overflow-wrap: anywhere; }
.sb-team.win .nm { font-weight: 700; color: var(--win); }
.sb-team.lose .nm { color: var(--muted); }
.sb-team .seed {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sb-team.win .seed { background: var(--ball); color: var(--ball-ink); border-color: transparent; }
.sb-won {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.85rem;
  text-align: center;
}
.sb-team.win .sb-won { background: var(--ball); color: var(--ball-ink); }
.sb-error { margin-top: 6px; font-size: 0.8rem; color: var(--danger); font-weight: 600; }

/* Caselle dei game stile tabellone luminoso */
.sb input {
  width: 44px;
  height: 38px;
  text-align: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--score-bg);
  color: var(--score-ink);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.sb input:placeholder-shown { background: var(--score-empty); }
.sb input::placeholder { color: rgba(255, 255, 255, 0.35); }
:root[data-theme="classico"] .sb input { border: 1px solid var(--border); }
:root[data-theme="classico"] .sb input::placeholder { color: var(--muted); }
.sb input:focus { box-shadow: 0 0 0 3px var(--ball); }
.sb input.bad { box-shadow: 0 0 0 2px var(--danger); }
.sb input:disabled { opacity: 0.25; cursor: not-allowed; }
.sb input::-webkit-outer-spin-button, .sb input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* =====================================================================
   CLASSIFICA
   ===================================================================== */

.zone {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--accent-soft);
  color: var(--accent);
}
.zone.z0 { background: var(--card-alt); color: var(--muted); border: 1px solid var(--border); }
.zone.z1 { background: var(--accent-soft); color: var(--accent); }
.zone.z2 { background: var(--ball); color: var(--ball-ink); }
.zone.out { background: transparent; color: var(--muted); font-weight: 400; border: 0; }

.podium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.podium-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  color: var(--hero-ink);
  box-shadow: var(--shadow);
}
.podium-item .rank {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--ball);
  line-height: 1;
}
.podium-item .who { font-weight: 700; line-height: 1.2; }
.podium-item .meta { font-size: 0.8rem; opacity: 0.8; }
:root[data-theme="classico"] .podium-item { background: var(--card); color: var(--text); border: 1px solid var(--border); }
:root[data-theme="classico"] .podium-item .rank { color: var(--accent); }

/* =====================================================================
   TABELLONE
   ===================================================================== */

.champion {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 22px;
  text-align: center;
  background: linear-gradient(120deg, var(--hero-from), var(--hero-to));
  color: var(--hero-ink);
  border: 0;
}
.champion svg.trophy { width: 54px; height: 54px; fill: var(--ball); }
.champion .label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.85; }
.champion .who { font-family: "Barlow Condensed", sans-serif; font-size: 2rem; font-weight: 800; text-transform: uppercase; line-height: 1.1; }
:root[data-theme="classico"] .champion { background: var(--accent-soft); color: var(--accent); }

.bracket {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  align-items: stretch;
}
.round { flex: 0 0 330px; display: flex; flex-direction: column; }
.round h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  margin: 0 0 10px;
  text-transform: uppercase;
  color: var(--muted);
}
.round.final h3 { color: var(--accent); }
.round h3 svg { width: 20px; height: 20px; fill: currentColor; }
.round-matches { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.kmatch {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.round:not(:last-child) .kmatch::after {
  content: "";
  position: absolute;
  right: -23px;
  top: 50%;
  width: 22px;
  border-top: 2px solid var(--border);
}
.round:not(:first-child) .kmatch::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 50%;
  width: 22px;
  border-top: 2px solid var(--border);
}
.round .kmatch, .round .pending { overflow: visible; }
.kmatch .sb { background: transparent; box-shadow: none; border-radius: 14px 14px 0 0; padding: 10px; }
.kmatch .sb.done { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.kmatch .sb.bad { box-shadow: inset 0 0 0 2px var(--danger); }
.kmeta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--card-alt);
  font-size: 0.78rem;
  color: var(--muted);
  border-radius: 0 0 14px 14px;
}
.kmeta select { padding: 2px 6px; font-size: 0.8rem; border-radius: 7px; }
.pending {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 12px;
  font-size: 0.87rem;
  color: var(--muted);
  background: var(--card-alt);
}
.pending ul { margin: 6px 0 0; padding-left: 18px; }

/* Tabellone completo: un foglio unico da ingrandire, stampare o condividere */
.ko-sheet-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
  max-height: 78vh;
  -webkit-overflow-scrolling: touch;
}
.ko-sheet { width: 100%; }
.ko-sheet svg { display: block; width: 100%; height: auto; }
.zoom { display: inline-flex; align-items: center; gap: 4px; }
.zoom-val { min-width: 54px; text-align: center; font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.champion svg.crossed { width: 64px; height: 58px; flex-shrink: 0; }

/* =====================================================================
   IMPOSTAZIONI
   ===================================================================== */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.theme-card:hover { border-color: var(--accent); }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card .tname { font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.theme-card .tname .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
}
.theme-card .tdesc { font-size: 0.82rem; color: var(--muted); line-height: 1.3; }

/* Miniatura del tema: usa i colori passati come variabili --p-* */
.preview {
  display: block;
  position: relative;
  height: 96px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--p-bg);
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.preview .p-hero {
  display: block;
  height: 30px;
  background: linear-gradient(120deg, var(--p-hero1), var(--p-hero2));
  position: relative;
}
.preview .p-hero::after {
  content: "";
  position: absolute;
  inset: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-left: 0;
  border-right: 0;
}
.preview .p-nav { height: 10px; background: var(--p-nav); display: flex; gap: 4px; padding: 2px 8px; }
.preview .p-nav i { width: 18px; border-radius: 3px; background: rgba(255, 255, 255, 0.3); }
.preview .p-nav i:first-child { background: var(--p-ball); }
.preview .p-card {
  position: absolute;
  left: 8px;
  right: 30px;
  bottom: 8px;
  top: 48px;
  background: var(--p-card);
  border-radius: 6px;
  padding: 6px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.preview .p-card b { flex: 1; height: 6px; border-radius: 3px; background: var(--p-text); opacity: 0.25; }
.preview .p-card s { width: 16px; height: 16px; border-radius: 4px; background: var(--p-score); }
.preview .p-ball {
  position: absolute;
  right: 8px;
  bottom: 10px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--p-ball);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.12);
}
.preview-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 10px;
  overflow: hidden;
}
.preview-split .preview { border-radius: 0; }
.preview-split .preview:last-child { border-left: 0; }

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: var(--card-alt);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
}
.segmented button.active { background: var(--accent); color: var(--accent-ink); }
.segmented button .aa { font-family: "Barlow Condensed", sans-serif; font-weight: 700; margin-right: 6px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch-row p { margin: 0; }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.15s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* =====================================================================
   VARIE
   ===================================================================== */

.empty { text-align: center; padding: 36px 16px; }
.empty svg.court { width: 180px; max-width: 70%; height: auto; margin-bottom: 8px; }
.empty p { color: var(--muted); font-size: 1.05rem; }
.court .c-floor { fill: var(--accent); opacity: 0.9; }
.court .c-line { stroke: #fff; stroke-width: 2; fill: none; opacity: 0.85; }
.court .c-net { stroke: #fff; stroke-width: 3; }
.court .c-ball { fill: var(--ball); }
.court .c-racket { fill: #ffffff; }
.court .c-holes { fill: var(--accent); opacity: 0.6; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  transform: translateX(-50%) translateY(20px);
  background: var(--score-bg);
  color: #fff;
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 0.93rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100% - 32px);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  border-left: 4px solid var(--ball);
}
:root[data-theme="classico"] #toast { background: var(--text); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.warn { background: var(--danger); border-left-color: #fff; }

#help-tip {
  position: fixed;
  z-index: 100;
  max-width: min(320px, calc(100vw - 16px));
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--score-bg);
  color: #f1f5fb;
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.35);
  border-top: 3px solid var(--ball);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s;
}
:root[data-theme="classico"] #help-tip { background: var(--text); border-top-color: var(--accent); }
#help-tip.show { opacity: 1; visibility: visible; }

@media (max-width: 560px) {
  .brand-name { font-size: 1.45rem; }
  .logo { width: 38px; height: 38px; }
  .tabs button { padding: 8px 11px; }
  .card { padding: 14px; }
  .group-body { padding: 4px 10px 12px; }
  .stepper { padding: 8px 10px; }
  .step-btn { width: 40px; height: 40px; }
  .stepper-val { font-size: 1.6rem; }
  .sb { padding: 8px; }
  .sb-grid { grid-auto-columns: 40px; column-gap: 5px; }
  .sb input { width: 40px; }
  .sb-team { font-size: 0.9rem; }
}

@media print {
  body.print-ko-fit .hero, body.print-ko-multi .hero,
  body.print-ko-fit main > :not(.ko-sheet-wrap), body.print-ko-multi main > :not(.ko-sheet-wrap) { display: none !important; }
  body.print-ko-fit .ko-sheet-wrap, body.print-ko-multi .ko-sheet-wrap {
    overflow: visible; max-height: none; border: 0; border-radius: 0; box-shadow: none;
  }
  body.print-ko-fit .ko-sheet, body.print-ko-multi .ko-sheet { width: auto !important; }
  /* Una pagina A4 orizzontale (297 x 210 mm meno i margini): il tabellone si adatta. */
  body.print-ko-fit .ko-sheet svg { width: 281mm; height: 192mm; }
  /* Più fogli: largo quanto la pagina, in altezza continua sui fogli successivi. */
  body.print-ko-multi .ko-sheet svg { width: 281mm; height: auto; }
  .tabs, .toolbar, .no-print, #toast, #help-tip { display: none !important; }
  .hero { background: none; color: #000; }
  .court-deco { display: none; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  .bracket { overflow: visible; flex-wrap: wrap; }
  input, select { border: 0; background: transparent !important; color: #000 !important; box-shadow: none !important; appearance: none; -webkit-appearance: none; }
  .group-head { background: none; color: #000; border-bottom: 2px solid #000; }
}
