/* Base (dalla pagina originale) */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}html{scroll-padding-top:env(safe-area-inset-top,0px)}body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}img{max-width:100%}[hidden]:not([hidden=until-found i]){display:none!important}

/* Amatori show — campo da gioco: verde prato profondo, linee di gesso, tabellone ambra.
   Layout: testata a strisce di prato + schede con elenchi/classifiche, una colonna su telefono. */
:root {
  --bg: #eef2ec;
  --surface: #ffffff;
  --surface-2: #f6f8f4;
  --ink: #13211a;
  --muted: #5b6b62;
  --line: #d5ddd3;
  --pitch: #0e4d30;
  --pitch-2: #17683f;
  --chalk: #f4f7f2;
  --amber: #f0b400;
  --amber-ink: #3a2c00;
  --hl: #fff1a1;
  --hl-line: #e6c638;
  --fam: #e9f4dc;
  --ok: #17683f;
  --warn: #9a6400;
  --warn-bg: #fff4d6;
  --bad: #b3261e;
  --bad-bg: #fde8e6;
  --board: #0c1611;
  --shadow: 0 1px 2px rgb(14 40 26 / .06), 0 6px 18px -8px rgb(14 40 26 / .18);
  --f-display: "Big Shoulders Display", "Oswald", "Arial Narrow", sans-serif;
  --f-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1410; --surface: #121e18; --surface-2: #17251e; --ink: #e6efe8; --muted: #9bb0a3; --line: #243a2e;
    --pitch: #0b3d26; --pitch-2: #3fb57a; --chalk: #e9f1eb; --amber: #f5c518; --amber-ink: #1d1600;
    --hl: #4a3f0a; --hl-line: #b8962a; --fam: #18301f; --ok: #5cc98f; --warn: #f0c050; --warn-bg: #3a2d0a; --bad: #ff8a80; --bad-bg: #3d1614;
    --board: #050a07; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 22px -10px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1410; --surface: #121e18; --surface-2: #17251e; --ink: #e6efe8; --muted: #9bb0a3; --line: #243a2e;
  --pitch: #0b3d26; --pitch-2: #3fb57a; --chalk: #e9f1eb; --amber: #f5c518; --amber-ink: #1d1600;
  --hl: #4a3f0a; --hl-line: #b8962a; --fam: #18301f; --ok: #5cc98f; --warn: #f0c050; --warn-bg: #3a2d0a; --bad: #ff8a80; --bad-bg: #3d1614;
  --board: #050a07; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 22px -10px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; line-height: 1.05; letter-spacing: .01em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 2.8rem); text-transform: uppercase; }
h2 { font-size: 1.45rem; text-transform: uppercase; }
h3 { font-size: 1.2rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.num, .tbl td.num, .tbl th.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: .88em; letter-spacing: .02em; }
.upper { text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.pad { padding: 14px; }
.eyebrow { font: 600 .75rem/1.2 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eyebrow.live { color: var(--bad); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 0 var(--bad); animation: pulse 1.6s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(220 50 40 / .55); } 70% { box-shadow: 0 0 0 9px rgb(220 50 40 / 0); } 100% { box-shadow: 0 0 0 0 rgb(220 50 40 / 0); } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } .toast { transition: none; } }

/* ---------- Pulsanti ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--pitch-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--pitch); border-color: var(--pitch); color: var(--chalk); }
.btn.primary:hover { background: var(--pitch-2); border-color: var(--pitch-2); }
:root[data-theme="dark"] .btn.primary { color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.danger-t { color: var(--bad) !important; }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: .9rem; }
.btn.icon { min-height: 34px; width: 34px; padding: 0; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-family: var(--f-display); font-size: 1.5rem; letter-spacing: .06em; text-transform: uppercase; }
.btn.start { min-height: 58px; padding: 0 30px; background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-family: var(--f-display); font-size: 1.7rem; letter-spacing: .08em; text-transform: uppercase; }
.btn.stop { min-height: 52px; background: var(--bad); border-color: var(--bad); color: #fff; font-family: var(--f-display); font-size: 1.3rem; text-transform: uppercase; letter-spacing: .06em; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--pitch-2); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn.strong { font-weight: 700; }
.x { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { color: var(--bad); background: var(--bad-bg); }
.row { display: flex; gap: 8px; align-items: center; }
.wrap-gap { flex-wrap: wrap; }
.row-between { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Testata ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--pitch); }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; color: var(--chalk);
  background: repeating-linear-gradient(90deg, var(--pitch) 0 64px, color-mix(in oklab, var(--pitch) 88%, #000) 64px 128px); border-bottom: 3px solid var(--chalk); }
.top-in, .tabs, .wrap, .sponsors, .demo-bar { max-width: 1180px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; text-align: left; min-width: 0; }
.mark { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--chalk); color: var(--pitch); }
.mark svg { width: 30px; height: 30px; }
.mark.big { width: 72px; height: 72px; }
.as-logo { display: block; height: 64px; width: auto; flex: none; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .35)); }
.as-logo.big { height: auto; width: min(100%, 420px); filter: drop-shadow(0 6px 14px rgb(0 0 0 / .4)); }
.logo-h1 { margin: 0; line-height: 0; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) { .as-logo { height: 46px; } }
.mark.big svg { width: 58px; height: 58px; }
.bname { font: 800 1.55rem/1 var(--f-display); text-transform: uppercase; letter-spacing: .03em; display: flex; flex-direction: column; min-width: 0; }
.bname small { font: 500 .78rem/1.3 var(--f-body); letter-spacing: .04em; text-transform: none; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; align-items: center; gap: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 46vw; border: 0; border-radius: 999px; padding: 6px 12px; background: var(--chalk); color: var(--pitch); font-weight: 700; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-btn { border: 0; background: none; padding: 0; cursor: pointer; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: var(--amber-ink); font: 800 1rem var(--f-display); text-transform: uppercase; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; flex: none; border: 0; background: none; color: var(--chalk); opacity: .78; padding: 10px 12px 12px; font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { opacity: 1; }
.tab.on { opacity: 1; }
.tab.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 4px; border-radius: 4px 4px 0 0; background: var(--amber); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: var(--amber-ink); font-size: .75rem; font-weight: 800; display: inline-grid; place-items: center; }
.demo-bar { font-size: .85rem; color: var(--muted); padding-block: 8px; }

/* ---------- Pagina ---------- */
.wrap { padding-block: 24px 48px; display: flex; flex-direction: column; gap: 22px; }
.page-h { display: flex; flex-direction: column; gap: 8px; }
.page-h > p, .page-h div > p { color: var(--muted); max-width: 65ch; }
.page-h.row-between { flex-direction: row; align-items: flex-end; }
.block { display: flex; flex-direction: column; gap: 12px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.empty { border: 2px dashed var(--line); border-radius: var(--r); padding: 28px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.empty strong { color: var(--ink); font-family: var(--f-display); font-size: 1.3rem; text-transform: uppercase; }
.note { border-radius: 8px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); }
.note.ok { background: var(--fam); border-color: var(--pitch-2); }
.note.err { background: var(--bad-bg); border-color: var(--bad); color: var(--ink); }
.note.warn { background: var(--warn-bg); border-color: var(--warn); }
.hello h1 { font-size: clamp(2.2rem, 7vw, 3.4rem); }

/* ---------- Statistiche ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-align: left; box-shadow: var(--shadow); color: inherit; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--pitch-2); }
.stat .k { font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font: 800 2.6rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 1.3rem; color: var(--muted); }
.stat .s { font-size: .9rem; color: var(--muted); }
.stat.accent { background: var(--pitch); border-color: var(--pitch); color: var(--chalk); }
.stat.accent .k, .stat.accent .s { color: var(--chalk); opacity: .82; }
.stat.accent .v { color: var(--amber); font-size: 2.2rem; }

/* ---------- Loghi gara ---------- */
.glogo { flex: none; width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; background: var(--pitch); color: var(--chalk); overflow: hidden; }
.glogo svg { width: 78%; height: 78%; }
.glogo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.glogo.sm { width: 30px; height: 30px; border-radius: 7px; }
.glogo.lg { width: 92px; height: 92px; border-radius: 18px; }
.glogo.xl { width: 150px; height: 150px; border-radius: 28px; margin-inline: auto; }

/* ---------- Gare ---------- */
.glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.gcard { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.gcard.conclusa { opacity: .82; }
.gcard.in_corso { border-color: var(--bad); box-shadow: 0 0 0 2px color-mix(in oklab, var(--bad) 30%, transparent), var(--shadow); }
.gbody { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gtop { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gtop .num { font: 800 1.1rem var(--f-display); color: var(--muted); }
.rules { color: var(--muted); font-size: .92rem; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip.live { background: var(--bad); color: #fff; border-color: var(--bad); }
.chip.done { background: var(--fam); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin-left: 6px; border-radius: 5px; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); vertical-align: 2px; }
.tag.gk { background: var(--amber); color: var(--amber-ink); }
.tag.gk-soft { background: color-mix(in oklab, var(--amber) 22%, transparent); color: var(--ink); }
.tag.you { background: var(--ink); color: var(--bg); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }

.live-banner { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; border: 2px solid var(--bad); border-radius: var(--r); background: var(--surface); padding: 14px; cursor: pointer; color: inherit; box-shadow: var(--shadow); }
.live-banner > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.live-banner strong { font: 800 1.6rem/1 var(--f-display); text-transform: uppercase; }
.live-banner small { color: var(--muted); }

/* ---------- Classifiche ---------- */
.rank { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.rank li { display: grid; grid-template-columns: 52px 1fr auto auto; align-items: center; gap: 10px; padding: 10px 14px 10px 6px; border-top: 1px solid var(--line); min-height: 52px; }
.rank li:first-child { border-top: 0; }
.rank .pos { font: 800 1.6rem/1 var(--f-display); text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank li:nth-child(1) .pos { color: #c99700; }
.rank li:nth-child(2) .pos { color: #8a97a0; }
.rank li:nth-child(3) .pos { color: #b0703a; }
.rank .who { min-width: 0; overflow-wrap: anywhere; }
.rank .members { display: block; color: var(--muted); font-size: .85rem; }
.rank .pts { font: 800 1.5rem/1 var(--f-display); text-align: right; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; align-items: flex-end; }
.rank .pts small { font: 500 .72rem var(--f-body); color: var(--muted); letter-spacing: .04em; }
.rank li.me { background: var(--hl); box-shadow: inset 5px 0 0 var(--hl-line); }
.rank li.fam { background: color-mix(in oklab, var(--hl) 40%, var(--surface)); }
.row-act { display: flex; }
.seg-switch { display: inline-flex; align-self: flex-start; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.seg-switch button { border: 0; background: none; padding: 8px 16px; border-radius: 7px; font-weight: 700; cursor: pointer; color: var(--muted); font-family: var(--f-display); font-size: 1.1rem; letter-spacing: .05em; text-transform: uppercase; }
.seg-switch button.on { background: var(--pitch); color: var(--chalk); }
.seg-switch.sm button { padding: 4px 10px; font-size: .95rem; }
.seg-switch.sm .muted { font-size: .8rem; padding-left: 6px; }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.choice-btn { border: 0; border-radius: 14px; padding: 30px 22px; text-align: left; cursor: pointer; background: var(--pitch); color: var(--chalk); display: flex; flex-direction: column; gap: 6px; background-image: repeating-linear-gradient(90deg, transparent 0 40px, rgb(255 255 255 / .04) 40px 80px); }
.choice-btn:nth-child(2) { background-color: var(--board); }
.choice-btn .big { font: 800 3rem/1 var(--f-display); text-transform: uppercase; color: var(--amber); }
.scroller { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chipbtn { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; cursor: pointer; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.chipbtn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chipbtn.conclusa:not(.on) { color: var(--muted); }
.chipbtn.in_corso:not(.on) { border-color: var(--bad); color: var(--bad); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fbtn { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.fbtn.on { border-color: var(--pitch-2); background: var(--fam); color: var(--ink); }
.fbtn .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }
.gara-strip { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.gara-strip > div { flex: 1 1 220px; min-width: 0; }
.headline { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.big { font: 800 3.4rem/1 var(--f-display); }

/* ---------- Tabelle ---------- */
.tscroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.card .tbl, .tscroll .tbl { background: transparent; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl thead th { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.tbl tfoot th { font-family: var(--f-display); font-size: 1.2rem; text-transform: uppercase; border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tr.da_iniziare td { color: var(--muted); }
.tcell { display: inline-flex; align-items: center; gap: 10px; }
.tbl.iscr td { font-size: .93rem; }
.tbl.iscr td.r .btn { margin-left: 4px; }
.tbl.diff .old { color: var(--muted); text-decoration: line-through; }
.tbl.diff .new { font-weight: 700; }
.matrix-wrap { max-height: 70vh; }
.matrix th, .matrix td { padding: 6px; border-right: 1px solid var(--line); }
.matrix thead th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; min-width: 86px; text-transform: none; letter-spacing: 0; font-size: .78rem; }
.matrix .mh { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.matrix .sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 180px; white-space: nowrap; font-weight: 500; }
.matrix thead .sticky { z-index: 3; background: var(--surface-2); }
.cell { width: 100%; min-width: 64px; height: 38px; border: 1px solid transparent; border-radius: 6px; background: var(--surface-2); text-align: center; font: 700 1.05rem var(--f-mono); }
.cell:hover { border-color: var(--line); }
.cell:focus { background: var(--surface); border-color: var(--pitch-2); outline: none; }
.cell.gk { background: color-mix(in oklab, var(--amber) 16%, var(--surface)); }

/* ---------- Moduli ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form.grid2, .form.grid4 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form.grid4 { grid-template-columns: 1fr 1.4fr .7fr 1.6fr; align-items: end; }
.span2 { grid-column: 1 / -1; }
.span4 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; min-width: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 400; font-size: 1rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pitch-2); box-shadow: 0 0 0 3px color-mix(in oklab, var(--pitch-2) 22%, transparent); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
label.check { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; }
label.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--pitch-2); flex: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg label { flex-direction: row; align-items: center; gap: 8px; padding: 10px 16px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 600; }
.seg label:has(input:checked) { border-color: var(--pitch-2); background: var(--fam); }
.seg input { accent-color: var(--pitch-2); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.inline-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1 1 240px; }
.search-row { display: flex; gap: 8px; }
.search-row input { flex: 1; }
.privacy { background: var(--warn-bg); border-left: 4px solid var(--amber); padding: 10px 12px; border-radius: 6px; font-size: .92rem; }

/* ---------- Liste ---------- */
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.people li:first-child { border-top: 0; }
.people li.me { background: var(--hl); }
.people.compact li { padding: 6px 10px; }
.people .who { min-width: 0; overflow-wrap: anywhere; }
.pick { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 8px; max-height: 280px; overflow-y: auto; background: var(--surface-2); }
.pick.tall { max-height: 460px; }
.pick button { width: 100%; display: flex; justify-content: space-between; gap: 10px; align-items: center; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 6px; cursor: pointer; min-height: 44px; }
.pick button:hover { background: var(--surface); }
.pick button.on { background: var(--pitch); color: var(--chalk); }
.pick button.on .muted { color: var(--chalk); }
.search { max-width: 520px; }

/* ---------- Gara live ---------- */
.gara-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.gh-body { flex: 1 1 280px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gh-act { display: flex; flex-direction: column; gap: 8px; align-items: stretch; max-width: 260px; flex: 1 1 200px; }
.live-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.assign { position: sticky; top: 120px; }
.assign.idle { background: var(--surface-2); box-shadow: none; }
.sel-name { display: flex; flex-direction: column; gap: 2px; }
.sel-name strong { font: 800 2rem/1.05 var(--f-display); text-transform: uppercase; overflow-wrap: anywhere; }
.scoreboard { display: flex; gap: 10px; align-items: center; justify-content: center; background: var(--board); border-radius: 14px; padding: 14px; color: var(--amber); box-shadow: inset 0 0 0 3px #1f2a24; }
.digit { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.digit output { width: 82px; height: 104px; display: grid; place-items: center; font: 800 5.4rem/1 var(--f-display); font-variant-numeric: tabular-nums; background: linear-gradient(#18221d 0 49%, #0a110d 49% 51%, #18221d 51%); border-radius: 10px; text-shadow: 0 0 18px rgb(245 197 24 / .45); }
.dbtn { width: 82px; height: 40px; border: 0; border-radius: 8px; background: #1f2b25; color: var(--amber); font-size: 1.1rem; cursor: pointer; }
.dbtn:hover { background: #2a3a32; }
.sb-label { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 .8rem var(--f-body); letter-spacing: .25em; text-transform: uppercase; color: #8a9a90; }

/* ---------- Programma ---------- */
.prog { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.prog li { display: grid; grid-template-columns: auto 36px auto 1fr auto auto; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.prog li.off { background: transparent; opacity: .7; }
.prog .ord { font: 800 1.3rem var(--f-display); color: var(--muted); }
.pname { display: flex; flex-direction: column; min-width: 0; }
.pname small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch { position: relative; width: 46px; height: 26px; flex: none; display: block; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.switch input:checked + span { background: var(--pitch-2); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.icons .logo-up { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
.icon-grid label { cursor: pointer; }
.icon-grid input { position: absolute; opacity: 0; }
.icon-grid span { display: grid; place-items: center; height: 48px; border-radius: 8px; border: 1.5px solid var(--line); color: var(--pitch-2); }
.icon-grid span svg { width: 34px; height: 34px; }
.icon-grid input:checked + span { background: var(--pitch); color: var(--chalk); border-color: var(--pitch); }
.icon-grid input:focus-visible + span { outline: 3px solid var(--amber); }

/* ---------- Famiglie, loghi, albo, voti ---------- */
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.fam-card select { flex: 1; min-width: 0; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.logo-grid figure { margin: 0; }
.logo-grid img { height: 100px; object-fit: contain; background: #fff; border-radius: 6px; padding: 8px; }
.logo-grid figcaption { display: flex; flex-direction: column; }
.sponsors { padding-block: 24px 40px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; align-items: center; }
.sponsors .logos { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; }
.sponsors img { height: 76px; width: auto; max-width: 180px; object-fit: contain; background: #fff; border-radius: 8px; padding: 6px 10px; border: 1px solid var(--line); }
.albo-ed .ed { font-size: 2rem; color: var(--pitch-2); }
.albo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.albo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.albo-card h3 { text-transform: uppercase; }
.podium { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.podium li { display: flex; align-items: center; gap: 10px; }
.podium li > span:nth-child(2) { flex: 1; }
.medal { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 1rem var(--f-display); color: #2a2100; flex: none; }
.p1 .medal { background: #f2c94c; } .p2 .medal { background: #c9d1d6; } .p3 .medal { background: #d9a273; }
.p1 > span:nth-child(2) { font-weight: 700; }
.charity { background: var(--pitch); color: var(--chalk); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 10px; background-image: repeating-linear-gradient(90deg, transparent 0 56px, rgb(255 255 255 / .035) 56px 112px); }
.charity .eyebrow { color: var(--chalk); opacity: .8; }
.charity h2 { font-size: 2rem; }
.charity-num { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.charity-num .big { color: var(--amber); font-size: clamp(3rem, 10vw, 4.6rem); }
.stars { display: flex; gap: 4px; align-items: center; }
.star { border: 0; background: none; font-size: 2.6rem; line-height: 1; color: var(--line); cursor: pointer; padding: 0 2px; }
.star.on { color: var(--amber); }
.stars .muted { margin-left: 10px; }
.stars-ro { color: var(--amber); letter-spacing: 2px; }
.stars-ro .off { color: var(--line); }
.vote-sum { flex-direction: row; flex-wrap: wrap; gap: 24px; align-items: center; }
.vote-sum > div { display: flex; flex-direction: column; }
.bars { list-style: none; margin: 0; padding: 0; flex: 1 1 240px; display: flex; flex-direction: column; gap: 4px; }
.bars li { display: grid; grid-template-columns: 30px 1fr 30px; gap: 8px; align-items: center; font-size: .9rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--amber); }
.mods { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mods .read { opacity: .65; box-shadow: none; }
.danger-zone { border: 2px solid var(--bad); border-radius: var(--r); padding: 18px; background: var(--bad-bg); }
.danger-zone h2 { color: var(--bad); }
.danger-zone label { max-width: 320px; }
.next-gara { flex-direction: row; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.next-gara > div { flex: 1 1 240px; display: flex; flex-direction: column; gap: 4px; }
.waiting { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px 24px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; box-shadow: var(--shadow); border-top: 6px solid var(--amber); }
.waiting p { max-width: 60ch; color: var(--muted); }
h3.sub { margin-top: 10px; text-transform: uppercase; }

/* ---------- Accesso ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-hero { position: relative; overflow: hidden; color: var(--chalk); background: repeating-linear-gradient(90deg, var(--pitch) 0 72px, color-mix(in oklab, var(--pitch) 86%, #000) 72px 144px); display: flex; align-items: center; padding-block: 48px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: 28px; }
.pitch-lines { position: absolute; inset: 22px; border: 3px solid rgb(255 255 255 / .55); border-radius: 4px; pointer-events: none; }
.pitch-lines::before { content: ""; position: absolute; left: 50%; top: 50%; width: 180px; height: 180px; border: 3px solid rgb(255 255 255 / .55); border-radius: 50%; transform: translate(-50%, -50%); }
.pitch-lines::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 3px solid rgb(255 255 255 / .55); }
.auth-brand { position: relative; display: flex; flex-direction: column; gap: 16px; max-width: 460px; background: color-mix(in oklab, var(--pitch) 82%, transparent); padding: 22px; border-radius: 14px; }
.auth-brand h1 { font-size: clamp(3.4rem, 9vw, 6.4rem); line-height: .86; }
.auth-brand p { font-size: 1.08rem; opacity: .92; }
.auth-panel { padding-block: 40px; padding-left: max(16px, 4vw); padding-right: max(16px, env(safe-area-inset-right, 0px), 4vw); display: flex; flex-direction: column; gap: 16px; max-width: 640px; width: 100%; justify-self: center; align-self: center; }
.auth-panel h2 { font-size: 2.2rem; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.demo-box { border: 1.5px dashed var(--pitch-2); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.demo-box p { color: var(--muted); font-size: .92rem; }
.done-card { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; border-top: 6px solid var(--amber); background: var(--surface); padding: 24px; border-radius: 12px; box-shadow: var(--shadow); }

/* ---------- Modale e avvisi ---------- */
#modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.modal-back { position: absolute; inset: 0; background: rgb(5 15 10 / .6); }
.modal-card { position: relative; width: min(100%, 460px); max-height: 100%; overflow-y: auto; background: var(--surface); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgb(0 0 0 / .35); }
.modal-card.wide { width: min(100%, 720px); }
.live-modal { width: min(100%, 520px); text-align: center; border-top: 8px solid var(--amber); }
.live-card { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.live-card h2 { font-size: clamp(2.2rem, 8vw, 3.2rem); }
.live-card .obj { font-size: 1.15rem; }
.live-card .btn { min-width: 200px; }
#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / .25); transition: opacity .4s, transform .4s; text-align: center; }
.toast.err { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- Telefono ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding-block: 34px; }
  .pitch-lines { inset: 12px; }
  .live-grid { grid-template-columns: 1fr; }
  .assign { position: static; order: -1; }
  .form.grid4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .form.grid2, .form.grid4 { grid-template-columns: 1fr; }
  .bname { font-size: 1.25rem; }
  .bname small { max-width: 44vw; }
  .rank li { grid-template-columns: 40px 1fr auto; padding-right: 10px; }
  .rank li .row-act { grid-column: 2 / -1; }
  .rank .pos { font-size: 1.35rem; }
  .prog li { grid-template-columns: auto 30px auto 1fr; }
  .prog li > .chip { display: none; }
  .prog li > .row { grid-column: 1 / -1; justify-content: flex-end; }
  .digit output { width: 70px; height: 90px; font-size: 4.6rem; }
  .dbtn { width: 70px; }
  .gcard { flex-direction: column; }
  .stat .v { font-size: 2.1rem; }
  .page-h.row-between { flex-direction: column; align-items: flex-start; }
  .gh-act { max-width: none; }
}

