/* S1DE – tema scuro con colori accesi */
:root {
  color-scheme: dark;
  --bg: #0A0A0B;
  --card: #141416;
  --card2: #1D1D22;
  --bordo: #2A2A31;
  --testo: #F4F4F6;
  --muted: #A1A1AA;
  --lime: #C6FF3D;
  --orange: #FF8A3D;
  --cyan: #3DD9FF;
  --red: #FF4D5E;
  --gold: #FFD23D;
  --raggio: 16px;
  --nav-h: 66px;
  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--testo); font-size: 16px; line-height: 1.4; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.1; }
h1 { font-family: var(--display); font-weight: 800; font-size: 2.1rem; text-transform: uppercase; letter-spacing: .01em; }
h2 { font-family: var(--display); font-weight: 700; font-size: 1.45rem; text-transform: uppercase; letter-spacing: .02em; }
h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: .45rem; } .between { justify-content: space-between; }
.wrap { flex-wrap: wrap; } .grow { flex: 1; } .mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; }
.ic { flex: none; vertical-align: middle; }
.gold { color: var(--gold); }
a.muted { display: inline-flex; align-items: center; gap: .25rem; }
a.muted:hover { color: var(--testo); }

/* Barra in alto e navigazione */
.topbar {
  position: sticky; top: 0; z-index: 10; background: rgba(10, 10, 11, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bordo);
  padding: calc(env(safe-area-inset-top) + .7rem) 1rem .7rem;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.topbar .titolo { font-family: var(--display); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ruolo { font-size: .75rem; color: var(--lime); font-weight: 600; }
.topbar a.prof { width: 40px; height: 40px; border-radius: 50%; background: var(--card2); border: 1px solid var(--bordo); display: grid; place-items: center; flex: none; }
main { max-width: 720px; margin: 0 auto; padding: 1rem 1rem calc(var(--nav-h) + env(safe-area-inset-bottom) + 1.5rem); }
nav.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: #0F0F11; border-top: 1px solid var(--bordo);
  display: flex; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
nav.bottom a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .68rem; color: var(--muted); gap: 4px; font-weight: 600; }
nav.bottom a.on { color: var(--lime); }

/* Card */
.card { display: block; background: var(--card); border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 1rem; margin-bottom: .75rem; }
.card.live { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 24px rgba(255, 77, 94, .25); }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
a.card:active { background: var(--card2); }
.sez { margin: 1.4rem 0 .55rem; font-family: var(--display); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* Partite */
.match-top { display: flex; align-items: center; gap: .4rem; justify-content: space-between; margin-bottom: .4rem; font-size: .85rem; }
.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .5rem; margin: .3rem 0 .5rem; }
.match-teams .team { font-weight: 700; } .match-teams .right { text-align: right; }
.match-teams .score { font-family: var(--display); font-size: 2rem; font-weight: 800; min-width: 74px; text-align: center; color: var(--lime); }
.big-score { text-align: center; padding: .5rem 0; }
.big-score .score { font-family: var(--display); font-size: 4rem; font-weight: 800; letter-spacing: .04em; color: var(--lime); line-height: 1; }
.big-score .teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; }
.big-score .teams div:first-child { text-align: right; } .big-score .teams div:last-child { text-align: left; }
.big-score .nome { font-weight: 700; font-size: 1.05rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 800; background: var(--card2); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.badge.live { background: var(--red); color: #fff; animation: pulse 1.5s infinite; }
.badge.r-V { background: var(--lime); color: #0A0A0B; } .badge.r-N { background: #52525B; color: #fff; } .badge.r-P { background: var(--red); color: #fff; }
@keyframes pulse { 50% { opacity: .65; } }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .35rem .75rem; border-radius: 999px; background: var(--card2); border: 1px solid var(--bordo); font-size: .85rem; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--lime); border-color: var(--lime); color: #0A0A0B; }
.chip.att { border-color: var(--orange); color: var(--orange); }

/* Tabs */
.tabs { display: flex; background: var(--card); border: 1px solid var(--bordo); border-radius: 14px; padding: 4px; margin-bottom: .85rem; gap: 4px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; padding: .55rem .7rem; border-radius: 10px; font-weight: 700; font-size: .85rem; color: var(--muted); white-space: nowrap; cursor: pointer; }
.tabs button.on { background: var(--lime); color: #0A0A0B; }

/* Tabelle */
table.st { width: 100%; border-collapse: collapse; }
table.st td, table.st th { padding: .5rem .3rem; border-bottom: 1px solid var(--bordo); }
table.st th { font-size: .72rem; color: var(--muted); text-align: left; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
table.st td.n, table.st th.n { text-align: center; width: 3.2rem; font-weight: 700; }
table.st tr.mio td { background: rgba(198, 255, 61, .08); }
.cmp td:nth-child(2) { text-align: center; color: var(--muted); font-size: .85rem; }
.cmp td:first-child, .cmp td:last-child { font-family: var(--display); font-weight: 800; width: 3.5rem; text-align: center; font-size: 1.4rem; }
.cmp td:first-child { color: var(--lime); } .cmp td:last-child { color: var(--red); }

/* Classifiche */
.rank { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--bordo); }
.rank:last-child { border-bottom: 0; }
.rank .pos { width: 1.6rem; text-align: center; font-family: var(--display); font-weight: 800; font-size: 1.2rem; color: var(--muted); }
.rank:first-child .pos { color: var(--gold); }
.rank .val { font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--lime); }
.rank.mio { background: rgba(198, 255, 61, .08); border-radius: 10px; padding-left: .4rem; padding-right: .4rem; }
.num { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; border-radius: 50%; background: var(--card2); border: 1.5px solid var(--lime); color: var(--lime); font-family: var(--display); font-weight: 800; font-size: 1rem; padding: 0 .2rem; }
.mvp-badge { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 210, 61, .15); color: var(--gold); flex: none; }

/* KPI */
.kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.kpi div { background: var(--card2); border-radius: 12px; padding: .7rem .4rem; text-align: center; }
.kpi b { display: block; font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1.05; }
.kpi div:nth-child(3n+1) b { color: var(--lime); }
.kpi div:nth-child(3n+2) b { color: var(--cyan); }
.kpi div:nth-child(3n) b { color: var(--orange); }
.kpi span { font-size: .7rem; color: var(--muted); font-weight: 600; }
.bar { height: 10px; background: var(--card2); border-radius: 99px; overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; background: var(--lime); border-radius: 99px; }
.forma { display: flex; gap: 4px; }

/* Bottoni e form */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 0; border-radius: 12px; padding: .8rem 1rem; font-weight: 800; cursor: pointer; background: var(--lime); color: #0A0A0B; text-align: center; min-height: 44px; }
.btn.block { width: 100%; } .btn.sec { background: var(--card2); color: var(--testo); border: 1px solid var(--bordo); }
.btn.danger { background: rgba(255, 77, 94, .12); color: var(--red); border: 1px solid rgba(255, 77, 94, .35); }
.btn.big { padding: 1rem; font-size: 1.05rem; } .btn.sm { padding: .4rem .7rem; font-size: .85rem; border-radius: 10px; min-height: 36px; }
.btn:disabled { opacity: .4; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; } .btns .btn { flex: 1; }
label.f { display: block; margin-bottom: .8rem; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
label.f input, label.f select, label.f textarea { display: block; width: 100%; margin-top: .35rem; padding: .75rem .85rem; border: 1px solid var(--bordo); border-radius: 12px; background: var(--card2); font-size: 1rem; color: var(--testo); font-weight: 500; text-transform: none; letter-spacing: 0; }
label.f input:focus, label.f select:focus, label.f textarea:focus { outline: 2px solid var(--lime); outline-offset: 1px; border-color: transparent; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.fab { position: fixed; right: 1rem; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem); width: 58px; height: 58px; border-radius: 50%; background: var(--orange); color: #0A0A0B; font-size: 2rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 6px 24px rgba(255, 138, 61, .45); z-index: 9; border: 0; }

/* Live */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .75rem; }
.seg button { border: 2px solid var(--bordo); background: var(--card); border-radius: 12px; padding: .75rem; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button.on.noi { background: var(--lime); border-color: var(--lime); color: #0A0A0B; }
.seg button.on.loro { background: var(--red); border-color: var(--red); color: #fff; }
.evgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.evgrid button { border: 1px solid var(--bordo); background: var(--card); border-radius: 14px; padding: .75rem .2rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700; min-height: 78px; justify-content: center; color: var(--testo); }
.evgrid button:active { transform: scale(.96); background: var(--card2); }
.ev-gol .ic, .ev-ic.ev-gol { color: var(--lime); }
.ev-tiro .ic, .ev-ic.ev-tiro, .ev-angolo .ic, .ev-ic.ev-angolo { color: var(--cyan); }
.ev-rigore .ic, .ev-ic.ev-rigore, .ev-fallo .ic, .ev-ic.ev-fallo { color: var(--gold); }
.ev-punizione .ic, .ev-ic.ev-punizione { color: var(--orange); }
.ev-autogol .ic, .ev-ic.ev-autogol { color: var(--red); }
.ev-parata .ic, .ev-ic.ev-parata { color: var(--cyan); }
.ev-cambio .ic, .ev-ic.ev-cambio { color: #C4B5FD; }
.pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.pgrid button { border: 2px solid var(--bordo); background: var(--card2); border-radius: 12px; padding: .6rem .3rem; cursor: pointer; font-weight: 700; font-size: .85rem; position: relative; min-height: 58px; color: var(--testo); }
.pgrid button.on { border-color: var(--lime); background: rgba(198, 255, 61, .12); }
.pgrid button.por::after { content: "GK"; position: absolute; top: -9px; right: -6px; font-size: .62rem; font-weight: 800; background: var(--cyan); color: #0A0A0B; border-radius: 6px; padding: 1px 5px; }
.pgrid button small { display: block; color: var(--lime); font-family: var(--display); font-weight: 800; font-size: 1rem; }
.ev { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--bordo); }
.ev:last-child { border-bottom: 0; }
.ev .min { width: 2.4rem; color: var(--muted); font-size: .8rem; font-weight: 700; text-align: right; }
.ev .loro { color: var(--red); }
.ev-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--card2); display: inline-grid; place-items: center; flex: none; }
.ev-ic.is-loro { color: var(--red); }
.ev .x { margin-left: auto; border: 1px solid var(--bordo); background: var(--card2); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; display: grid; place-items: center; color: var(--muted); }

/* Pannello dal basso */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); border: 1px solid var(--bordo); border-bottom: 0; width: 100%; max-width: 720px; border-radius: 22px 22px 0 0; padding: 1.1rem 1rem calc(1rem + env(safe-area-inset-bottom)); max-height: 85vh; overflow-y: auto; animation: su .18s ease-out; }
@keyframes su { from { transform: translateY(40px); opacity: .5; } }
.sheet h2 { text-align: center; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.scelte { display: grid; gap: .5rem; grid-template-columns: repeat(3, 1fr); }
.scelte button { border: 1px solid var(--bordo); border-radius: 14px; padding: 1rem .4rem; font-weight: 800; cursor: pointer; background: var(--card2); display: flex; flex-direction: column; align-items: center; gap: .4rem; color: var(--testo); }
.scelte button .ic { color: var(--lime); }

/* Avvisi */
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem); z-index: 60; display: flex; flex-direction: column; gap: .4rem; width: min(92vw, 480px); pointer-events: none; }
#toast .t { background: var(--card2); border: 1px solid var(--bordo); color: var(--testo); padding: .8rem 1rem; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: .75rem; pointer-events: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-weight: 600; }
#toast .t.err { background: var(--red); border-color: var(--red); color: #fff; }
#toast .t button { background: transparent; border: 1px solid var(--lime); color: var(--lime); border-radius: 8px; padding: .3rem .7rem; font-weight: 800; cursor: pointer; }

/* Benvenuto */
.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 2rem 1.25rem; max-width: 480px; margin: 0 auto; }
.welcome .logo { margin-bottom: 1rem; text-align: center; }
.big-ic { color: var(--lime); }
.brand { font-family: var(--display); font-weight: 800; letter-spacing: .06em; font-size: 3.4rem; color: var(--testo); margin: 0; }
.ruoli { display: grid; gap: .75rem; margin-top: 1.75rem; }
.ruoli button { display: flex; align-items: center; gap: 1rem; text-align: left; background: var(--card); border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 1rem; cursor: pointer; color: var(--testo); }
.ruoli button:active { background: var(--card2); }
.ruoli button b { display: block; font-size: 1.05rem; }
.ruoli .i { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.i-lime { background: rgba(198, 255, 61, .14); color: var(--lime); }
.i-orange { background: rgba(255, 138, 61, .15); color: var(--orange); }
.i-cyan { background: rgba(61, 217, 255, .14); color: var(--cyan); }
.splash { min-height: 100vh; display: grid; place-items: center; }
.vuoto { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.avviso { background: rgba(255, 210, 61, .1); border: 1px solid rgba(255, 210, 61, .35); color: #FFE58A; border-radius: 12px; padding: .75rem; font-size: .9rem; margin-bottom: .75rem; }
.avviso a { color: var(--gold); text-decoration: underline; }
code { background: var(--card2); color: var(--lime); padding: .15rem .4rem; border-radius: 6px; font-size: .85em; word-break: break-all; }

/* Cronometro */
.clock { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.clock.big { display: block; font-size: 5rem; line-height: 1; color: var(--lime); margin: .35rem 0 .8rem; }
.clock.over { color: var(--orange); }
.clock-card { text-align: center; border-color: rgba(198, 255, 61, .35); }
.i-red { background: rgba(255, 77, 94, .14); color: var(--red); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--lime); font-weight: 700; text-decoration: underline; cursor: pointer; font-size: inherit; }
.badge .clock.over { color: inherit; }
