/* Layout: header + hero "tavolo da gioco" (blu con linee bianche), contenuti a colonna singola larga max 1120px. */
:root {
  --table: #16407a;      /* blu tavolo */
  --table-deep: #0e2c57;
  --ball: #ff8a1f;       /* arancio pallina */
  --ball-ink: #3a1a00;
  --paddle: #d6342d;     /* rosso gomma */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #e9eef5;
  --fg: #142033;
  --muted: #5a6880;
  --line: #d8e0eb;
  --primary: #16407a;
  --primary-ink: #ffffff;
  --ok: #1f7a4d;   --ok-bg: #e3f4ea;
  --warn: #8a5a00; --warn-bg: #fff1d6;
  --err: #b42318;  --err-bg: #fde8e6;
  --live: #c2410c; --live-bg: #ffedd5;
  --gold: #c99a1a; --silver: #8a96a8; --bronze: #b06a3b;
  --shadow: 0 1px 2px rgba(14, 44, 87, .06), 0 4px 16px rgba(14, 44, 87, .06);
  --radius: 10px;
  --f-display: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  --f-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1424; --surface: #121e33; --surface-2: #1a2943; --fg: #e6ecf5; --muted: #95a4bb; --line: #263753;
    --primary: #6ea2ec; --primary-ink: #08162b;
    --ok: #5fd39a; --ok-bg: #12301f; --warn: #f5c15c; --warn-bg: #33270c; --err: #ff8a80; --err-bg: #3a1514; --live: #ffa463; --live-bg: #3a2010;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1424; --surface: #121e33; --surface-2: #1a2943; --fg: #e6ecf5; --muted: #95a4bb; --line: #263753;
  --primary: #6ea2ec; --primary-ink: #08162b;
  --ok: #5fd39a; --ok-bg: #12301f; --warn: #f5c15c; --warn-bg: #33270c; --err: #ff8a80; --err-bg: #3a1514; --live: #ffa463; --live-bg: #3a2010;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 15px/1.55 var(--f-body);
  min-height: 100vh; display: flex; flex-direction: column;
}
body.no-scroll { overflow: hidden; }
main { flex: 1; outline: none; }
img { max-width: 100%; display: block; }
a { color: var(--primary); }
h1, h2, h3, h4, h5 { font-family: var(--f-display); font-weight: 700; line-height: 1.1; margin: 0 0 .5em; text-wrap: balance; letter-spacing: .005em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
small { font-size: .82em; }
.block { display: block; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.selectable { user-select: all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; border-radius: 4px; }

.wrap {
  width: 100%; max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.section { padding-block: 40px; }
.band { background: var(--surface-2); }
.sub { margin-top: 1.6em; }

/* ---------- header ---------- */
.site-header { background: var(--table-deep); color: #fff; position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-right: auto; }
.brand img { width: 40px; height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--f-display); font-size: 1.35rem; letter-spacing: .02em; text-transform: uppercase; }
.brand-text small { font-size: .72rem; opacity: .75; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav .link-btn { color: rgba(255,255,255,.86); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav .link-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.active { color: #fff; box-shadow: inset 0 -2px 0 var(--ball); border-radius: 0; }
.nav .nav-cta { background: var(--ball); color: var(--ball-ink); font-weight: 600; }
.nav .nav-cta:hover { background: #ffa04a; color: var(--ball-ink); }
.nav .nav-cta.active { box-shadow: none; border-radius: 8px; }
#nav-utente { display: contents; }
.icon-btn.menu-btn { display: none; color: #fff; font-size: 1.3rem; }

@media (max-width: 860px) {
  .icon-btn.menu-btn { display: inline-flex; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--table-deep);
    padding: 8px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); border-top: 1px solid rgba(255,255,255,.1); }
  .nav.open { display: flex; }
  .nav a, .nav .link-btn { padding: 12px; text-align: left; }
  .nav a.active { box-shadow: inset 3px 0 0 var(--ball); }
}

/* ---------- hero (tavolo) ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.55) calc(50% - 1px), rgba(255,255,255,.55) calc(50% + 1px), transparent calc(50% + 1px)),
    var(--table);
  border-bottom: 6px solid #fff;
}
.hero::before { content: ""; position: absolute; inset: 14px; border: 3px solid rgba(255,255,255,.85); pointer-events: none; }
.hero-net { position: absolute; top: 0; bottom: 0; left: 50%; width: 10px; transform: translateX(-50%);
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.18) 0 2px, transparent 2px 7px), repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 2px, transparent 2px 5px); display: none; }
.hero-inner { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; align-items: center; padding-block: 64px; }
.hero h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); text-transform: uppercase; letter-spacing: .01em; line-height: .95; margin-bottom: .35em; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 600; color: var(--ball); margin-bottom: .6em; }
.eyebrow-dark { text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; font-weight: 600; color: var(--muted); margin: 0 0 .3em; }
.lead { font-size: 1.12rem; max-width: 52ch; color: rgba(255,255,255,.9); }
.lead-dark { color: var(--muted); max-width: 60ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.4em; }
.hero-next {
  background: var(--surface); color: var(--fg); border-radius: var(--radius); padding: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.25); min-width: 0;
}
.hero-next .eyebrow { color: var(--paddle); }
.hero-next h2 { font-size: 1.6rem; margin-bottom: .25em; }
.next-date { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.next-date span { font-family: var(--f-display); font-size: 4rem; font-weight: 800; line-height: .9; color: var(--primary); }

.next-date small { font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); line-height: 1.25; }
.hero-next .btn { margin-top: 14px; }
@media (max-width: 760px) {
  .hero-inner { grid-template-columns: 1fr; padding-block: 44px; gap: 28px; }
  .hero { background: var(--table); }
}

/* ---------- pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 .95rem/1 var(--f-body); padding: 11px 18px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-accent { background: var(--ball); color: var(--ball-ink); }
.btn-accent:hover:not(:disabled) { background: #ffa04a; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); }
.btn-light { background: var(--table); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }
.btn-lg { padding: 14px 22px; font-size: 1.02rem; }
.btn-sm { padding: 7px 12px; font-size: .86rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn.danger:hover, .link-btn.danger:hover { color: var(--err); }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: var(--err); }
.danger { color: var(--err); }
.link-arrow { font-weight: 600; text-decoration: none; }

/* ---------- chip / tag ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--ok); background: var(--ok-bg); }
.chip-warn { color: var(--warn); background: var(--warn-bg); }
.chip-live { color: var(--live); background: var(--live-bg); }
.chip-live::before { animation: pulse 1.4s ease-in-out infinite; }
.chip-muted { color: var(--muted); background: var(--surface-2); }
@keyframes pulse { 50% { opacity: .3; } }
.tag { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--surface-2); color: var(--fg); font-size: .8rem; font-weight: 500; }
.count { display: inline-block; font-family: var(--f-body); font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 2px 9px; border-radius: 999px; vertical-align: middle; }
.cats { display: flex; flex-wrap: wrap; gap: 6px; margin: .5em 0 0; }

/* ---------- card / sezioni ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.block { margin-top: 28px; }
.block > h2, .block > h3 { margin-bottom: 14px; }

/* ---------- tappe ---------- */
.tappe-list { display: flex; flex-direction: column; gap: 12px; }
.tappa-card {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.tappa-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.tappa-card h3 { margin: 4px 0 2px; font-size: 1.35rem; }
.tappa-data { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--table); color: #fff; border-radius: 8px; padding: 8px 4px; line-height: 1; border-bottom: 4px solid var(--ball); }
.tappa-data .g { font-family: var(--f-display); font-size: 2.1rem; font-weight: 800; }
.tappa-data .m { text-transform: uppercase; font-size: .8rem; font-weight: 600; letter-spacing: .1em; margin-top: 2px; }
.tappa-data .a { font-size: .7rem; opacity: .7; margin-top: 3px; }
.tappa-data.small { width: 54px; padding: 6px 2px; }
.tappa-data.small .g { font-size: 1.5rem; }
.tappa-thumb { width: 72px; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.meta { margin: 0; color: var(--muted); font-size: .9rem; }
.tappa-top { display: flex; gap: 8px; }
@media (max-width: 520px) {
  .tappa-card { grid-template-columns: 62px minmax(0, 1fr); gap: 12px; }
  .tappa-thumb { display: none; }
}

.tappa-hero { background: var(--table); color: #fff; border-bottom: 6px solid #fff; }
.tappa-hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: start; padding-block: 36px 40px; }
.tappa-hero h1 { margin: 10px 0 18px; }
.tappa-hero .tag { background: rgba(255,255,255,.14); color: #fff; }
.back { color: rgba(255,255,255,.8); text-decoration: none; font-size: .9rem; }
.back:hover { color: #fff; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; margin: 0 0 12px; }
.facts div { min-width: 0; }
.facts dt { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--ball); font-weight: 600; }
.facts dd { margin: 2px 0 0; }
.facts a { color: #fff; }
.note { background: rgba(255,255,255,.1); border-left: 3px solid var(--ball); padding: 10px 14px; border-radius: 0 8px 8px 0; margin-top: 16px; white-space: pre-line; max-width: 70ch; }
.locandina img { width: 260px; max-width: 100%; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.3); border: 4px solid #fff; }
@media (max-width: 760px) { .tappa-hero-inner { grid-template-columns: 1fr; } .locandina img { width: 100%; max-width: 360px; } }

/* ---------- passi ---------- */
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.steps li::before { content: counter(s); font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; width: 34px; height: 34px; border-radius: 50%; background: var(--ball); color: var(--ball-ink); display: grid; place-items: center; margin-bottom: 8px; }
.steps strong { font-size: 1.05rem; }
.steps span { color: var(--muted); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; padding: 12px 14px; font: 600 .95rem var(--f-body); color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--ball); }

/* ---------- tabelle ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card .table-scroll, .girone .table { border: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * + * { margin-left: 4px; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table.narrow { max-width: 360px; }
.podio td:first-child { font-weight: 700; }
.podio.p1 td:first-child { color: var(--gold); }
.podio.p2 td:first-child { color: var(--silver); }
.podio.p3 td:first-child { color: var(--bronze); }
.isc-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: flex-end; }

/* ---------- liste ---------- */
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list small { color: var(--muted); text-align: right; }
.editable-list { margin-bottom: 14px; }
.grid-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ---------- form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: .9rem; padding: 0; }
.opt { font-weight: 400; color: var(--muted); font-size: .85em; }
input, select, textarea {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); }
.select-sm { width: auto; padding: 6px 10px; font-size: .88rem; }
.search { width: 220px; max-width: 100%; padding: 8px 12px; }
.hint { color: var(--muted); font-size: .86rem; margin: 0; }
.form-error { color: var(--err); background: var(--err-bg); padding: 10px 12px; border-radius: 8px; font-size: .9rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; margin-bottom: 16px; }
.check.inline { display: inline-flex; margin: 0; }
.row-wrap .check { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 560px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.choice-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .choice-row { grid-template-columns: 1fr; } }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-wrap input { width: auto; flex: 1 1 160px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 16px; }
.toolbar p { margin: 0; }
.inline-field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.inline-field select { text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--fg); font-weight: 400; width: auto; max-width: 100%; }

.auth { display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; padding: 28px; }
.auth-card.wide { max-width: 620px; }
.auth-links { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 18px; font-size: .92rem; }

/* ---------- alert / stati ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin: 0 0 16px; }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-error { background: var(--err-bg); color: var(--err); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 24px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty strong { color: var(--fg); font-size: 1.05rem; }
.empty p { margin: 0 0 8px; max-width: 48ch; }

/* ---------- area ---------- */
.area-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.area-head h1 { margin: 0; }
.isc-card { margin-bottom: 14px; padding: 16px; }
.isc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.isc-head > div:nth-child(2) { flex: 1; min-width: 0; }
.isc-head h3 { margin: 0 0 2px; }
.isc-head h3 a { color: inherit; text-decoration: none; }

/* ---------- gara ---------- */
.admin-bar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px; }
.admin-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.step { font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.step.done { background: var(--ok-bg); color: var(--ok); }
.step.doing { background: var(--live-bg); color: var(--live); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

.gironi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 400px) { .gironi-grid { grid-template-columns: 1fr; } }
.girone { padding: 0; overflow: hidden; }
.girone-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--table); color: #fff; }
.girone-head h4 { margin: 0; text-transform: uppercase; letter-spacing: .04em; }
.girone-head .tag { background: rgba(255,255,255,.15); color: #fff; }
.standings tr.qualified td:nth-child(2) { font-weight: 600; }
.standings tr.qualified td:first-child { box-shadow: inset 3px 0 0 var(--ball); }
.matches { list-style: none; margin: 0; padding: 6px; border-top: 1px solid var(--line); background: var(--surface-2); }
.match-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; width: 100%;
  padding: 8px; border-radius: 6px; font: inherit; font-size: .88rem; color: var(--fg); background: none; border: 0; text-align: left;
}
.match-row.editable { cursor: pointer; }
.match-row.editable:hover { background: var(--surface); }
.m-turno { font-size: .7rem; color: var(--muted); font-weight: 600; }
.m-g { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-g.right { text-align: right; }
.m-g.win { font-weight: 700; }
.m-score { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); min-width: 34px; text-align: center; }
.m-sets { grid-column: 2 / -1; color: var(--muted); font-size: .76rem; text-align: center; margin-top: -4px; font-variant-numeric: tabular-nums; }

.bracket-scroll { overflow-x: auto; padding-bottom: 8px; }
.bracket { display: grid; grid-template-columns: repeat(var(--turni), minmax(190px, 1fr)); gap: 18px; min-width: calc(var(--turni) * 200px); }
.b-col h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; font-family: var(--f-body); }
.b-matches { display: flex; flex-direction: column; justify-content: space-around; gap: 10px; height: calc(100% - 28px); }
.b-match { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font: inherit; font-size: .88rem; color: var(--fg); padding: 0; text-align: left; width: 100%; }
.b-match.editable { cursor: pointer; }
.b-match.editable:hover { border-color: var(--primary); }
.b-match.bye { opacity: .7; }
.b-p { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; }
.b-p + .b-p { border-top: 1px solid var(--line); }
.b-p > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-p.win { font-weight: 700; background: color-mix(in srgb, var(--ball) 14%, var(--surface)); }
.b-p b { font-variant-numeric: tabular-nums; }
.b-match small { color: var(--muted); font-size: .72rem; padding: 3px 10px 6px; font-variant-numeric: tabular-nums; }

/* editor punteggio */
.score-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; font-weight: 700; align-items: center; margin-bottom: 8px; }
.score-head span:last-child { text-align: right; }
.sets { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.set-row { display: grid; grid-template-columns: 56px 1fr auto 1fr; gap: 10px; align-items: center; }
.set-n { font-size: .8rem; color: var(--muted); font-weight: 600; }
.set-row input { text-align: center; font-size: 1.25rem; font-weight: 700; padding: 10px 6px; font-variant-numeric: tabular-nums; }
.score-live { min-height: 1.4em; font-weight: 600; margin: 0; }
.score-live.ok { color: var(--ok); }
.score-live.err { color: var(--err); }
.more { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.more summary { cursor: pointer; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }

/* presenze */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); padding: 6px 10px; font: 500 .82rem var(--f-body); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on.ok { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.seg button.on.no { background: var(--err-bg); color: var(--err); font-weight: 700; }

/* ---------- modale / toast ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(8, 18, 36, .55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: max(24px, env(safe-area-inset-top, 0px)) 12px 24px; overflow-y: auto; animation: fade .15s ease-out; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: rise .18s ease-out; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-weight: 500; z-index: 60; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--err); color: #fff; }
.toast-warn { background: var(--warn); color: #fff; }

/* ---------- testi lunghi ---------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-left: 1.2em; }

/* ---------- footer ---------- */
.site-footer { background: var(--table-deep); color: rgba(255,255,255,.8); margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 28px; font-size: .9rem; }
.footer-inner p { max-width: 48ch; margin: 4px 0 0; }
.footer-inner strong { color: #fff; font-family: var(--f-display); font-size: 1.15rem; text-transform: uppercase; letter-spacing: .03em; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.meta .chip { white-space: normal; }
.isc-head { flex-wrap: wrap; }
.chip-err { color: var(--err); background: var(--err-bg); }
.chiusura { margin-top: 14px; font-weight: 600; }
.fitet-cell { min-width: 150px; }
.fitet-cell .link-btn { font-size: .82rem; }
p.hint.danger { color: var(--err); }
