/* Montserrat ospitato in locale (niente richieste a Google: l'IP del visitatore non esce dall'UE). */
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/montserrat-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(../fonts/montserrat-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Look "notturna allo stadio": fondo melanzana profondo, luce viola dall'alto, viola Effestudio
   come accento, oro solo per MVP e premi, cifre da tabellone (pesanti e a larghezza fissa). */
:root {
  --brand: #683283;
  --bg: #0e0912;
  --glow: rgba(132, 62, 182, .32);
  --surface: #17101e;
  --surface-2: #211829;
  --surface-3: #2c2036;
  --line: #312440;
  --line-strong: #46345a;
  --text: #f6f1fa;
  --muted: #a596b3;
  --faint: #6f6080;
  --accent: #8d47b6;
  --accent-hi: #a75ed3;
  --accent-text: #d6abf2;
  --accent-soft: rgba(157, 84, 205, .16);
  --accent-ink: #ffffff;
  --gold: #ffc65c;
  --warn: #ffb547;
  --danger: #ff5d6c;
  --ok: #3fd68f;
  --radius: 18px;
  --radius-s: 12px;
  --tabbar-h: 62px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 30px -18px rgba(0, 0, 0, .9);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: none; background: var(--bg); }
/* Niente ritardo di 300 ms sul tocco, niente zoom col doppio tap sui controlli */
a, button, label, summary, select, input, .pick { touch-action: manipulation; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -12%, var(--glow), transparent 62%),
    radial-gradient(60% 40% at 100% 0%, rgba(104, 50, 131, .18), transparent 70%),
    var(--bg) fixed;
  color: var(--text);
  font: 500 15px/1.5 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 10px; text-wrap: balance; }
h1 { font-size: 24px; font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; }
h3 { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .2em; margin: 6px 0 2px; }
h3::before { content: ""; width: 14px; height: 3px; border-radius: 3px; background: var(--accent-hi); flex-shrink: 0; }
.card > h3:first-child::before, .legal h3::before { display: none; }
small, .muted { color: var(--muted); }
code { font-size: .92em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }

/* ---------- Icone ---------- */
.ic { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------- Barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; view-transition-name: topbar;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(14, 9, 18, .72); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(70, 52, 90, .55);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(145deg, var(--accent-hi), var(--brand)); box-shadow: 0 6px 18px -6px rgba(167, 94, 211, .7); }
.logo img { width: 20px; height: auto; filter: brightness(0) invert(1); }
.wordmark { display: grid; line-height: 1; }
.wordmark b { font-weight: 800; font-size: 15px; letter-spacing: .05em; white-space: nowrap; }
.wordmark small { font-weight: 600; font-size: 9px; letter-spacing: .34em; color: var(--accent-text); margin-top: 4px; }
#who { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.badge { font-size: 11.5px; font-weight: 700; padding: 5px 10px; white-space: nowrap; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; background: rgba(255, 255, 255, .03); }
.badge.admin { background: var(--danger); color: #fff; border-color: transparent; }
.badge.team { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

main {
  max-width: 760px; margin: 0 auto; display: grid; gap: 16px;
  padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
}
main > * { min-width: 0; }

/* ---------- Barra di navigazione in basso ---------- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; view-transition-name: tabbar;
  display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 0 max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
  background: rgba(20, 14, 26, .82); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid rgba(70, 52, 90, .6);
}
#tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--faint); text-decoration: none; user-select: none; -webkit-user-select: none;
  transition: color .15s var(--ease);
}
#tabbar a .ic { width: 24px; height: 24px; padding: 3px 14px; box-sizing: content-box; border-radius: 99px; transition: background .2s var(--ease), transform .15s var(--ease); }
#tabbar a:active .ic { transform: scale(.88); }
#tabbar a.active { color: var(--text); }
#tabbar a.active .ic { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Card e contenitori ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
a.card { color: var(--text); text-decoration: none; transition: transform .12s var(--ease), border-color .15s; }
a.card:hover { border-color: var(--line-strong); }
.hero {
  position: relative; overflow: hidden; border: 0; padding: 22px 18px;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(255, 255, 255, .14), transparent 55%),
    linear-gradient(140deg, #8d47b6 0%, var(--brand) 45%, #2e1240 100%);
  box-shadow: 0 18px 40px -22px rgba(141, 71, 182, .9);
}
.hero::after {
  content: ""; position: absolute; right: -28px; bottom: -36px; width: 170px; height: 200px; opacity: .13; pointer-events: none;
  background: url(../icons/mark.svg) no-repeat center / contain; filter: brightness(0) invert(1);
}
.hero h1 { font-size: 27px; line-height: 1.05; margin-bottom: 8px; position: relative; }
.hero h2 { position: relative; }
.hero p { margin: 0; color: #eddcf7 !important; position: relative; }
.hero-next { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 14px;
  border-radius: 14px; background: rgba(14, 9, 18, .38); border: 1px solid rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.hero-next small { color: #e2cdee; font-weight: 700; }
.hero-next b { font-size: 18px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.hero-next b span { font-size: 12px; color: #e2cdee; margin: 0 4px; }
.hero .stat { background: rgba(14, 9, 18, .35); border-color: rgba(255, 255, 255, .08); }
.hero .stat small { color: #e2cdee; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 10px; }
.stat { display: grid; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; }
.stat small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat.pos b { color: var(--ok); } .stat.neg b { color: var(--danger); }
a.stat { color: var(--text); text-decoration: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: grid; gap: 10px; }
.empty { color: var(--muted); text-align: center; padding: 18px; margin: 0; border: 1px dashed var(--line); border-radius: var(--radius-s); }
td .empty { border: 0; }

/* Sotto-menu a pillole, scorrevole, con sfumatura a destra per far capire che continua */
.subnav {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent);
          mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent);
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  white-space: nowrap; padding: 8px 14px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; transition: background .15s, color .15s;
}
.subnav a.active { background: var(--text); color: var(--bg); border-color: transparent; }

/* Menu "Altro": righe con icona e freccia */
.menu-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; font-weight: 700; }
.menu-row .ic:first-child { color: var(--accent-text); padding: 8px; box-sizing: content-box; border-radius: 12px; background: var(--accent-soft); }
.menu-row .ic:last-child { margin-left: auto; color: var(--faint); width: 18px; height: 18px; }

/* ---------- Squadre, sigle, stati ---------- */
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 38px; padding: 3px 7px; border-radius: 7px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em; background: var(--c, #555); color: #120c17; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25) inset; }
.chip .tlogo { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; background: #fff; margin-left: -3px; }
.tlogo-big { display: inline-grid; place-items: center; border-radius: 16px; object-fit: cover; color: #120c17; font-weight: 800; flex-shrink: 0; background: #fff; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .8); }
.team-head { display: flex; align-items: center; gap: 14px; position: relative; }
.logo-preview { width: 72px; height: 72px; }
.chip-tbd { --c: #3a3046; color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.tag.ok { background: rgba(63, 214, 143, .14); color: var(--ok); }
.tag.warn { background: rgba(255, 181, 71, .14); color: var(--warn); }
.tag.err { background: rgba(255, 93, 108, .14); color: var(--danger); }
.live { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; font-size: 10px; font-weight: 800; letter-spacing: .1em; color: #fff;
  background: var(--danger); padding: 2px 8px 2px 6px; border-radius: 99px; vertical-align: middle; }
.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Partita: tabellone con i colori delle due squadre ai lati ---------- */
.match {
  display: block; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px 14px; box-shadow: var(--shadow); transition: transform .12s var(--ease), border-color .15s;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--h, transparent) 24%, transparent), transparent 32%, transparent 68%, color-mix(in srgb, var(--a, transparent) 24%, transparent)),
    var(--surface);
}
.match:hover { border-color: var(--line-strong); }
.match.is-live { border-color: rgba(255, 93, 108, .55); }
.match-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.match-meta .when { margin-left: auto; font-variant-numeric: tabular-nums; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.match-row .team { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: 13.5px; line-height: 1.2; }
/* Nome su due righe al massimo: su telefono si legge tutto invece di "Atletic…" */
.match-row .team .nm { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.match-row .team .chip { flex-shrink: 0; }
.match-row .team.right { justify-content: flex-end; text-align: right; }
.score {
  display: grid; justify-items: center; min-width: 70px; padding: 6px 10px; border-radius: 12px;
  background: rgba(8, 5, 11, .55); border: 1px solid rgba(255, 255, 255, .06);
  font-size: 20px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; line-height: 1.1;
}
.score strong { font-weight: 800; }
.score small { font-size: 10px; font-weight: 700; color: var(--gold); }
.score .muted { font-size: 16px; color: var(--text); }
.bigscore { font-size: 46px; font-weight: 800; text-align: center; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Tabelle ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 7px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num b { font-size: 14px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
tr.mine td { background: var(--accent-soft); }

/* ---------- Moduli ---------- */
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
label.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: 14px; font-weight: 500; }
/* 16px minimo: sotto questa soglia iOS Safari fa zoom automatico quando tocchi un campo */
input, select, textarea {
  font: inherit; font-size: 16px; font-weight: 500; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 10px 12px; width: 100%; min-height: 46px; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-hi); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface-3); }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input[type=checkbox], input[type=radio] { -webkit-appearance: auto; appearance: auto; min-height: 0; width: 20px; height: 20px; accent-color: var(--accent-hi); }
input[type=file] { padding: 9px; font-size: 14px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 6px 10px; margin-right: 10px; background: var(--surface-3); color: var(--text); }
label.check input { flex-shrink: 0; margin-top: 1px; }
textarea { min-height: 90px; resize: vertical; }

/* ---------- Pulsanti ---------- */
button, .btn {
  position: relative; font: inherit; font-weight: 800; letter-spacing: .01em; cursor: pointer; border: 0; border-radius: var(--radius-s);
  padding: 11px 16px; min-height: 46px; color: var(--accent-ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 18px -10px rgba(167, 94, 211, .9);
  transition: transform .1s var(--ease), filter .15s, box-shadow .15s; user-select: none; -webkit-user-select: none;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active, .match:active, .pick:active, a.card:active, a.stat:active { transform: scale(.97); }
button.ghost, .btn.ghost { background: rgba(255, 255, 255, .03); color: var(--text); border: 1px solid var(--line-strong); box-shadow: none; }
button.danger { background: linear-gradient(180deg, #ff7381, var(--danger)); color: #fff; box-shadow: 0 8px 18px -10px rgba(255, 93, 108, .8); }
button.small, .btn.small { padding: 7px 13px; font-size: 13px; min-height: 36px; border-radius: 10px; }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
/* Pulsante in attesa della risposta del server */
button.busy { color: transparent !important; pointer-events: none; }
button.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Scelta giocatori (Fanta e voto MVP) ---------- */
.pick { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; min-height: 52px;
  background: var(--surface-2); border-radius: var(--radius-s); border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
.pick b { font-variant-numeric: tabular-nums; }
.pick.on { border-color: var(--accent-hi); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-hi) inset; }
.pick.off { opacity: .38; }
.sticky-bar { position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 5; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); background: rgba(23, 16, 30, .9); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-text)); transition: width .3s var(--ease); }

/* ---------- Testi lunghi ---------- */
.legal { font-size: 13.5px; color: var(--text); }
.legal h4 { margin: 18px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.legal p, .legal li { color: #ddd0e6; }
.note { font-size: 12.5px; color: var(--warn); border-left: 3px solid var(--warn); padding: 8px 12px; background: rgba(255, 181, 71, .07); border-radius: 0 10px 10px 0; margin: 0; }
a.card.note { display: block; }

/* Informativa all'apertura */
.privacy-gate { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto; overscroll-behavior: contain; background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: 22px; padding: 22px 20px 0; box-shadow: 0 30px 80px -20px #000;
  animation: rise .28s var(--ease) both; }
.privacy-gate::backdrop { background: rgba(6, 3, 9, .78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.privacy-gate h2 { margin-bottom: 4px; font-size: 20px; }
.privacy-gate details { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 14px; }
.privacy-gate summary { cursor: pointer; color: var(--accent-text); font-weight: 700; min-height: 40px; display: flex; align-items: center; }
.privacy-gate .small-print { font-size: 12px; }
.privacy-gate #pg-ok { position: sticky; bottom: 0; width: 100%; margin: 6px 0 calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -14px 20px var(--surface), 0 8px 18px -10px rgba(167, 94, 211, .9); }
.privacy-points { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 14px; }
.privacy-points li { position: relative; padding-left: 22px; }
.privacy-points li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 8px; height: 8px; border-radius: 3px; background: var(--accent-hi); }
.privacy-table th, .privacy-table td { font-size: 12px; vertical-align: top; }

/* ---------- Partner ---------- */
.partner { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; }
.partner .plogo { width: 56px; height: 56px; border-radius: 14px; background: var(--surface-3); display: grid; place-items: center; font-size: 26px; overflow: hidden; }
.partner .plogo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Avvisi ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); transform: translate(-50%, 16px) scale(.96);
  display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px;
  background: rgba(44, 32, 54, .96); border: 1px solid var(--line-strong); padding: 12px 18px; border-radius: 99px;
  box-shadow: 0 16px 40px -12px #000; opacity: 0; pointer-events: none; transition: opacity .18s var(--ease), transform .25s var(--ease);
  z-index: 20; max-width: calc(100% - 32px); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#toast.err { border-color: rgba(255, 93, 108, .6); color: #ffe1e4; }
#toast.err::before { background: var(--danger); }

/* ---------- Calendario squadra ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .wd { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--faint); padding-bottom: 4px; }
.cal .day {
  aspect-ratio: 1; min-height: 0; padding: 4px 2px; border-radius: 12px; border: 1px solid transparent; box-shadow: none;
  display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center;
  font: inherit; color: var(--faint); background: transparent;
}
.cal .day b { font-size: 14px; font-weight: 700; }
.cal .day small { font-size: 9.5px; line-height: 1; font-weight: 800; color: inherit; }
.cal .day.mine { background: linear-gradient(160deg, var(--accent-hi), var(--accent)); color: #fff; box-shadow: 0 8px 16px -10px rgba(167, 94, 211, .9); }
.cal .day.maybe { border: 1.5px dashed var(--accent-text); color: var(--accent-text); }
.cal .day.other { background: var(--surface-2); color: var(--text); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--gold); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: -8px; }
.legend .dot.mine { background: var(--accent-hi); }
.legend .dot.maybe { border: 1.5px dashed var(--accent-text); }
.legend .dot.other { background: var(--surface-3); border: 1px solid var(--line); }
.slot {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
.slot.mine { border-left: 4px solid var(--accent-hi); }
.slot.maybe { border-style: dashed; color: var(--muted); }
.slot .time { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.slot .res { font-size: 19px; font-variant-numeric: tabular-nums; }
.slot small { color: var(--muted); }
.cal-day { scroll-margin-top: calc(76px + env(safe-area-inset-top)); border-radius: var(--radius-s); transition: background .3s; }
.cal-day.flash { background: var(--accent-soft); }

.cert-row { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cert-row .row { gap: 6px; }
.install { display: flex; gap: 14px; align-items: center; }
.install img { width: 46px; height: 46px; border-radius: 12px; }
.tg { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--text); border-color: rgba(42, 171, 238, .35);
  background: linear-gradient(120deg, rgba(42, 171, 238, .1), transparent 60%), var(--surface); }
.tg .tg-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #2aabee; color: #fff; flex-shrink: 0; }
.tg.off { opacity: .75; border-style: dashed; background: var(--surface); }
.tg.off .tg-icon { background: var(--surface-3); color: var(--muted); }

/* Anagrafiche admin: nome a tutta larghezza, campi piccoli sotto (leggibile su telefono) */
form.anag { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto; gap: 6px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
form.anag > .wide { grid-column: 1 / -1; }
form.anag > * { min-width: 0; margin: 0; }
form.anag input[type=color] { width: 100%; }

details > summary { cursor: pointer; list-style-position: inside; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
dialog.card { border: 1px solid var(--line-strong); max-width: min(480px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(6, 3, 9, .75); }

/* ---------- Primo caricamento: scheletro animato invece di una pagina vuota ---------- */
.skel { border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; border: 1px solid var(--line); }
.skel.hero-s { height: 128px; }
.skel.line { height: 12px; width: 38%; border-radius: 6px; border: 0; }
.skel.match-s { height: 92px; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* ---------- Transizioni tra le pagine ---------- */
/* Browser con View Transitions: dissolvenza con leggero scorrimento; barre fisse ferme. */
::view-transition-old(root) { animation: vt-out .12s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .22s var(--ease) both; }
::view-transition-group(topbar), ::view-transition-group(tabbar) { animation: none; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
/* Altri browser: entrata del contenuto, solo al cambio pagina */
#view.enter > * { animation: enter .22s var(--ease) both; }
#view.enter > *:nth-child(2) { animation-delay: .03s; }
#view.enter > *:nth-child(3) { animation-delay: .06s; }
#view.enter > *:nth-child(n+4) { animation-delay: .09s; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}

@media (max-width: 360px) {
  .wordmark small { display: none; }
  .match-row .team .chip { display: none; }
}
@media (min-width: 900px) {
  main { max-width: 900px; }
  .hero h1 { font-size: 34px; }
}

/* Filtri del mercato Fanta: due menu affiancati, ricerca sotto a tutta larghezza */
#filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#filters input { grid-column: 1 / -1; }
#save input { min-width: 0; }

/* Nuova mora: squadra e motivo a tutta larghezza, importo e pulsante affiancati */
#fine { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#fine select, #fine input[name=reason] { grid-column: 1 / -1; }
