:root {
  color-scheme: dark;
  --bg: #06131f;
  --bg-deep: #030b12;
  --surface: #0c2236;
  --surface-2: #12334f;
  --surface-3: #194564;
  --surface-glass: rgba(12, 34, 54, 0.84);
  --border: rgba(165, 211, 235, 0.16);
  --border-strong: rgba(165, 211, 235, 0.28);
  --cyan: #27d7ee;
  --cyan-strong: #06b6d4;
  --cyan-soft: #a9f3fb;
  --lime: #b7ef45;
  --lime-dark: #83b51c;
  --gold: #ffd35a;
  --coral: #ff6178;
  --green: #43e09d;
  --text: #f6fbff;
  --text-soft: #c7d9e7;
  --text-muted: #8ca8bc;
  --ink: #07131f;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.34);
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.24);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 15px;
  --header-height: 72px;
  --nav-height: 76px;

  /* Alias mantenuti per le regole e i commenti storici del progetto. */
  --bg-dark: var(--bg);
  --bg-card: var(--surface);
  --bg-raised: var(--surface-2);
  --border-subtle: var(--border);
  --blue: var(--cyan);
  --blue-deep: var(--cyan-strong);
  --blue-soft: var(--cyan-soft);
  --blue-testo: var(--cyan-soft);
  --oro: var(--gold);
  --oro-scuro: #c79a2f;
  --verde: var(--green);
  --rosso: var(--coral);
  --text-primary: var(--text);
  --text-secondary: var(--text-soft);
  --text-muted-old: var(--text-muted);
  --ombra: var(--shadow-card);
  --raggio: var(--radius-lg);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg-deep); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -8%, rgba(39, 215, 238, 0.17), transparent 28rem),
    radial-gradient(circle at 100% 34%, rgba(183, 239, 69, 0.07), transparent 24rem),
    linear-gradient(180deg, #071a2a 0%, var(--bg) 55%, var(--bg-deep) 100%);
  background-attachment: fixed;
}

body.drawer-open { overflow: hidden; }
body.pwa-standalone { user-select: none; -webkit-user-select: none; }

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid rgba(39, 215, 238, 0.5);
  outline-offset: 3px;
}

[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.app-shell {
  width: 100%;
  min-height: 100vh;
}

.screen {
  display: none;
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(var(--header-height) + env(safe-area-inset-top) + 20px) 16px calc(var(--nav-height) + 28px);
}

body.is-offline .screen { padding-top: calc(var(--header-height) + env(safe-area-inset-top) + 72px); }

.screen.active { display: flex; flex-direction: column; }

/* App chrome */
.app-header {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  background: rgba(4, 17, 28, 0.86);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
}

.icon-btn:hover { color: var(--cyan); border-color: rgba(39, 215, 238, 0.45); }
.brand { min-width: 0; display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(39, 215, 238, 0.5);
  border-radius: 12px 12px 16px 12px;
  color: var(--lime);
  background: linear-gradient(145deg, rgba(39, 215, 238, 0.22), rgba(39, 215, 238, 0.04));
  box-shadow: inset 0 0 18px rgba(39, 215, 238, 0.13);
  transform: rotate(-4deg);
}
/* Il monogramma e' di due lettere: il corpo e' quindi molto piu' piccolo del
   tile di quanto fosse con la sola P, altrimenti FT ne esce dai bordi. */
.brand-mark span { font-size: 15px; font-weight: 950; letter-spacing: -0.02em; transform: rotate(4deg); }
.brand-mark.large { width: 52px; height: 52px; border-radius: 17px 17px 21px 17px; }
.brand-mark.large span { font-size: 20px; }
.brand-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1; }
/* Nove caratteri: a 380px il wordmark deve stare fra il pulsante del menu e il
   chip, quindi corpo piu' piccolo e tracking ridotto. La misura era stata presa
   sui quattordici di PRONOSTICALCIO, quindi ora avanza margine. */
.brand-copy strong { overflow: hidden; font-size: 12px; font-weight: 700; letter-spacing: 0.035em; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy strong span { font-weight: 950; }
.brand-copy small { margin-top: 5px; color: var(--text-muted); font-size: 9px; font-weight: 800; letter-spacing: 0.1em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-chip { display: flex; align-items: center; gap: 7px; max-width: 120px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-soft); background: rgba(255, 255, 255, 0.04); font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.header-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(183, 239, 69, 0.1), 0 0 12px rgba(183, 239, 69, 0.8); }

.bottom-nav {
  position: fixed;
  z-index: 55;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 10px;
  height: 66px;
  max-width: 600px;
  margin: 0 auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(10, 31, 49, 0.94);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
}
.bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; color: var(--text-muted); background: transparent; border: 0; border-radius: 16px; cursor: pointer; }
.bottom-nav button .icon { width: 21px; height: 21px; }
.bottom-nav button span { font-size: 10px; font-weight: 800; }
.bottom-nav button.active { color: var(--ink); background: var(--lime); box-shadow: 0 5px 16px rgba(183, 239, 69, 0.2); }
.bottom-nav button[hidden], .drawer-nav button[hidden] { display: none; }
body[data-league-selected="false"] .bottom-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.drawer-backdrop { position: fixed; z-index: 80; inset: 0; background: rgba(1, 7, 12, 0.7); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.25s ease; }
.drawer-backdrop.open { opacity: 1; }
.app-drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(88vw, 360px);
  padding: max(22px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 0 0, rgba(39, 215, 238, 0.18), transparent 18rem),
    #071b2c;
  border-right: 1px solid var(--border-strong);
  box-shadow: 30px 0 80px rgba(0, 0, 0, 0.52);
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(.22,.8,.24,1);
}
.app-drawer.open { transform: translateX(0); }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-brand { min-width: 0; display: flex; align-items: center; gap: 12px; }
.drawer-brand div { min-width: 0; }
.drawer-brand div span, .drawer-label { display: block; color: var(--cyan-soft); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; }
.drawer-brand div strong { display: block; max-width: 205px; margin-top: 4px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-league { margin: 28px 0 16px; padding: 16px; background: linear-gradient(135deg, rgba(39, 215, 238, 0.12), rgba(183, 239, 69, 0.06)); border: 1px solid rgba(39, 215, 238, 0.22); border-radius: 18px; }
.drawer-league strong { display: block; margin-top: 7px; font-size: 18px; }
.drawer-nav { display: grid; gap: 7px; }
.drawer-nav button, .drawer-bottom button { width: 100%; display: flex; align-items: center; gap: 13px; padding: 13px 14px; color: var(--text-soft); background: transparent; border: 1px solid transparent; border-radius: 14px; text-align: left; font-weight: 750; cursor: pointer; }
.drawer-nav button:hover, .drawer-nav button.active { color: var(--text); background: rgba(255, 255, 255, 0.055); border-color: var(--border); }
.drawer-nav button.active .icon { color: var(--lime); }
.drawer-bottom { margin-top: auto; padding-top: 20px; display: grid; gap: 8px; border-top: 1px solid var(--border); }
.drawer-bottom .drawer-cta { color: var(--ink); background: var(--lime); }
.drawer-bottom .drawer-install { color: var(--cyan-soft); background: rgba(39, 215, 238, 0.08); border-color: rgba(39, 215, 238, 0.22); }
.drawer-bottom .drawer-install:hover { color: var(--text); background: rgba(39, 215, 238, 0.14); border-color: rgba(39, 215, 238, 0.4); }
.drawer-bottom .drawer-logout { color: var(--coral); }

/* PWA: connettività, installazione e aggiornamenti */
.connection-status {
  position: fixed;
  z-index: 58;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 8px);
  left: 50%;
  width: min(calc(100% - 24px), 620px);
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #ffe7a3;
  background: rgba(94, 62, 8, 0.96);
  border: 1px solid rgba(255, 211, 90, 0.38);
  border-radius: 13px;
  box-shadow: var(--shadow-card);
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 750;
}
.connection-status .icon { flex: 0 0 auto; color: var(--gold); }

.install-panel { text-align: center; }
.install-app-icon { display: block; margin: 0 auto 17px; border-radius: 23px; box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35); }
.install-instructions { margin: 18px 0; color: var(--text-soft); text-align: left; line-height: 1.55; }
.install-instructions p { margin: 0; }
.install-steps { margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: install-step; list-style: none; }
.install-steps li { display: grid; grid-template-columns: 31px 1fr; align-items: center; gap: 10px; }
.install-steps li::before { counter-increment: install-step; content: counter(install-step); width: 31px; height: 31px; display: grid; place-items: center; color: var(--ink); background: var(--lime); border-radius: 10px; font-size: 12px; font-weight: 950; }

.pwa-update-toast {
  position: fixed;
  z-index: 150;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  width: min(calc(100% - 24px), 460px);
  margin: 0 auto;
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--text);
  background: rgba(12, 34, 54, 0.98);
  border: 1px solid var(--border-strong);
  border-radius: 17px;
  box-shadow: var(--shadow);
}
.pwa-update-toast div { min-width: 0; display: grid; gap: 3px; }
.pwa-update-toast span { color: var(--text-muted); font-size: 11px; }
.pwa-update-toast button { padding: 10px 13px; color: var(--ink); background: var(--lime); border: 0; border-radius: 11px; font-weight: 900; cursor: pointer; }

/* Login */
.login-screen { position: relative; isolation: isolate; width: 100%; padding: 28px 16px; justify-content: center; overflow: hidden; }
.login-screen::before { content: ""; position: absolute; z-index: -2; inset: 0; background: linear-gradient(130deg, rgba(39, 215, 238, 0.08), transparent 45%); }
.login-orbit { position: absolute; z-index: -1; border: 1px solid rgba(39, 215, 238, 0.18); border-radius: 50%; }
.orbit-one { width: 480px; height: 480px; top: -290px; right: -180px; }
.orbit-two { width: 290px; height: 290px; bottom: -190px; left: -120px; border-color: rgba(183, 239, 69, 0.16); }
.login-panel { width: min(100%, 920px); display: grid; gap: 28px; align-items: center; }
.logo-section { text-align: left; }
.login-brand-mark { width: 74px; height: 74px; margin-bottom: 28px; display: grid; place-items: center; color: var(--lime); background: linear-gradient(145deg, rgba(39, 215, 238, 0.24), rgba(39, 215, 238, 0.04)); border: 1px solid rgba(39, 215, 238, 0.45); border-radius: 24px 24px 30px 24px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35), inset 0 0 28px rgba(39, 215, 238, 0.12); transform: rotate(-5deg); }
.login-brand-mark span { font-size: 31px; font-weight: 950; letter-spacing: -0.02em; transform: rotate(5deg); }
.eyebrow { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--cyan-soft); font-size: 10px; font-style: normal; font-weight: 900; letter-spacing: 0.14em; }
.logo-section h1, .dashboard-hero h1 { margin: 9px 0 13px; font-size: clamp(40px, 11vw, 64px); line-height: 0.98; letter-spacing: -0.055em; }
.logo-section h1 em, .dashboard-hero h1 em { color: var(--lime); font-style: normal; }
.logo-section .subtitle { max-width: 510px; margin: 0; color: var(--text-soft); font-size: 15px; line-height: 1.65; }
.login-benefits { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.login-benefits span { display: flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--text-soft); background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 999px; font-size: 11px; font-weight: 800; }
.login-benefits .icon { color: var(--cyan); }
.auth-card { padding: 24px; background: linear-gradient(160deg, rgba(18, 51, 79, 0.96), rgba(9, 28, 45, 0.96)); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.auth-heading { margin-bottom: 22px; }
.auth-heading span { color: var(--lime); font-size: 10px; font-weight: 900; letter-spacing: 0.13em; text-transform: uppercase; }
.auth-heading h2 { margin: 5px 0 0; font-size: 22px; }
.auth-switch { margin: 17px 0 0; color: var(--text-muted); font-size: 13px; text-align: center; }
.auth-switch button { padding: 0; color: var(--cyan-soft); background: none; border: 0; font-weight: 800; cursor: pointer; }

/* Forms and actions */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 7px; color: var(--text-soft); font-size: 11px; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.form-group input { width: 100%; min-height: 50px; padding: 13px 15px; color: var(--text); background: rgba(1, 10, 17, 0.34); border: 1px solid var(--border-strong); border-radius: 14px; outline: none; }
.form-group input::placeholder { color: #7692a6; }
.form-group input:focus { border-color: var(--cyan); background: rgba(39, 215, 238, 0.055); box-shadow: 0 0 0 4px rgba(39, 215, 238, 0.09); }
.btn { min-height: 48px; width: 100%; padding: 12px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); background: linear-gradient(135deg, var(--lime), #d7ff72); border: 0; border-radius: 14px; box-shadow: 0 8px 20px rgba(183, 239, 69, 0.14); font-size: 13px; font-weight: 900; letter-spacing: 0.035em; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(183, 239, 69, 0.22); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { color: var(--text); background: rgba(255,255,255,.035); border: 1px solid var(--border-strong); box-shadow: none; }
.btn.secondary:hover:not(:disabled) { color: var(--cyan-soft); border-color: rgba(39, 215, 238, .48); box-shadow: none; }
/* Corallo = cio' che richiede attenzione. Testo scuro sul corallo pieno per
   restare sopra la soglia di contrasto AA. */
.btn.pericolo { color: var(--ink); background: linear-gradient(135deg, var(--coral), #ff8b9c); box-shadow: 0 8px 20px rgba(255,97,120,.16); }
.btn.pericolo:hover:not(:disabled) { box-shadow: 0 12px 26px rgba(255,97,120,.24); }
.status-text { color: var(--text-soft); font-size: 13px; line-height: 1.55; }
.error, .success { margin-top: 13px; padding: 12px 14px; border-radius: 13px; font-size: 13px; line-height: 1.45; }
.error { color: #ffd4da; background: rgba(255, 97, 120, .12); border: 1px solid rgba(255, 97, 120, .28); }
.success { color: #c9ffe7; background: rgba(67, 224, 157, .11); border: 1px solid rgba(67, 224, 157, .28); }

/* Dashboard */
.dashboard-screen { gap: 22px; }
/* Senza i tre riquadri l'altezza minima e' scesa: prima serviva a tenerli
   staccati dal titolo, ora lascerebbe solo un vuoto. */
.dashboard-hero { position: relative; overflow: hidden; min-height: 204px; padding: 26px 22px 24px; display: flex; flex-direction: column; justify-content: center; background: linear-gradient(145deg, rgba(23, 65, 94, 0.98), rgba(9, 29, 47, 0.98)); border: 1px solid rgba(39, 215, 238, .25); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.hero-content { position: relative; z-index: 2; max-width: 70%; }
.dashboard-hero h1 { margin-top: 12px; font-size: clamp(36px, 10vw, 54px); }
.dashboard-hero .status-text { margin: 0; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Filigrana del marchio. Con due lettere il corpo scende da 142 a 100: a 142 la
   sigla sarebbe uscita dalla testata verso sinistra. */
.hero-mark { position: absolute; top: 26px; right: 17px; color: transparent; font-size: 100px; font-weight: 950; letter-spacing: -0.03em; line-height: .8; -webkit-text-stroke: 2px rgba(183, 239, 69, .22); transform: rotate(7deg); }
/* CAMPO DA GIOCO
   Disegnato con bordi e gradienti invece che con un'immagine: non aggiunge
   richieste di rete, non pesa nulla e resta nitido su qualunque schermo.
   Le opacita' sono volutamente bassissime. E' uno sfondo: il testo che ci
   sta sopra deve restare sopra la soglia di contrasto AA, e con valori piu'
   alti le righe bianche del campo se la mangerebbero. */
.campo { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; border-radius: inherit;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.019) 0 34px, transparent 34px 68px); }
/* L'opacita' delle righe non e' una scelta estetica libera: schiarisce lo
   sfondo e quindi abbassa il contrasto del testo che ci finisce sopra.
   Misurato sul punto peggiore (riga del campo sull'estremo chiaro del
   gradiente): a .06 --text e --text-soft restano a 8,9 e 6,4, ampiamente
   sopra 4,5. Il grigio --text-muted scenderebbe invece a 4,31: NON va usato
   dentro un contenitore con .campo. Se serve un testo tenue qui, usare
   --text-soft. */
.campo span { position: absolute; border: 1.5px solid rgba(183, 239, 69, .06); }
/* Linea di meta' campo: un bordo solo, non un rettangolo. */
.campo-linea { top: -1px; bottom: -1px; left: 50%; width: 0; border-width: 0 0 0 1.5px; }
.campo-cerchio { top: 50%; left: 50%; width: 118px; height: 118px; margin: -59px 0 0 -59px; border-radius: 50%; }
/* Le due aree di rigore sbordano di 1.5px cosi' il lato esterno resta fuori
   dalla card e si vedono solo i tre lati che contano. */
.campo-area { top: 50%; width: 52px; height: 132px; margin-top: -66px; }
.campo-area.sinistra { left: -1.5px; border-left: 0; border-radius: 0 10px 10px 0; }
.campo-area.destra { right: -1.5px; border-right: 0; border-radius: 10px 0 0 10px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading span, .list-label > span { color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .15em; }
.section-heading h2 { margin: 4px 0 0; font-size: 23px; }
.round-action { width: 46px; height: 46px; display: grid; place-items: center; color: var(--ink); background: var(--lime); border: 0; border-radius: 15px; cursor: pointer; box-shadow: 0 8px 20px rgba(183,239,69,.17); }
.leagues-section { display: grid; gap: 12px; }
.league-card { position: relative; overflow: hidden; min-height: 118px; padding: 19px; display: grid; align-content: space-between; background: linear-gradient(145deg, var(--surface-2), var(--surface)); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); cursor: pointer; transition: transform .2s ease, border-color .2s ease; }
.league-card::after { content: ""; position: absolute; width: 100px; height: 100px; top: -52px; right: -28px; border: 20px solid rgba(39,215,238,.07); border-radius: 50%; }
.league-card:hover { transform: translateY(-3px); border-color: rgba(39,215,238,.5); }
/* Il pulsante che apre la lega copre l'intera card ed e' trasparente: cosi'
   tutta la superficie resta cliccabile come prima, ma senza annidare un
   pulsante dentro un altro elemento interattivo. Il contenuto della card sta
   sotto (z-index 1) e non intercetta i clic; il menu opzioni sta sopra. */
.league-card-open { position: absolute; inset: 0; z-index: 2; padding: 0; background: none; border: 0; border-radius: inherit; cursor: pointer; }
.league-card-open:focus-visible { outline: 2px solid var(--cyan); outline-offset: -3px; }
.league-card-menu { position: absolute; z-index: 3; top: 9px; right: 9px; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; color: var(--text-muted); background: rgba(1,10,17,.4); border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; }
.league-card-menu:hover { color: var(--text); border-color: rgba(39,215,238,.5); }
.league-card-menu .icon { width: 18px; height: 18px; }
/* Il tocco lungo non deve far comparire la lente di ingrandimento di iOS ne'
   il menu contestuale del browser: senza queste due righe l'interazione
   funziona sul desktop e non sul telefono, che e' dove viene usata. */
.league-card.con-opzioni { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.league-card-top { display: flex; align-items: center; gap: 12px; padding-right: 40px; }
.league-symbol { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; color: var(--gold); background: rgba(255,211,90,.1); border: 1px solid rgba(255,211,90,.24); border-radius: 14px; }
.league-card h3 { position: relative; z-index: 1; margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.league-card .meta { position: relative; z-index: 1; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-muted); font-size: 11px; }
.league-card .meta-item { display: flex; align-items: center; gap: 6px; }
.league-open { color: var(--lime); font-weight: 850; }
.league-card.create-new { min-height: 90px; display: flex; align-items: center; justify-content: center; border: 1px dashed rgba(39,215,238,.42); background: rgba(39,215,238,.045); box-shadow: none; }
.league-card.create-new::after { display: none; }
.create-text { display: flex; align-items: center; gap: 8px; color: var(--cyan-soft); font-weight: 850; }
.empty-state { padding: 26px 18px; text-align: center; color: var(--text-soft); background: rgba(255,255,255,.025); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }

/* Matchday */
.matchday-screen { gap: 14px; padding-bottom: calc(var(--nav-height) + 120px); }
.matchday-header { position: relative; overflow: hidden; padding: 19px; background: linear-gradient(145deg, rgba(18,51,79,.98), rgba(8,27,44,.98)); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); }
/* Il campo e' posizionato, quindi verrebbe disegnato sopra i fratelli statici:
   basta alzare il contenuto di un livello perche' torni dietro a tutto. */
.matchday-header > *:not(.campo) { position: relative; z-index: 1; }
.back-btn { margin: -3px 0 18px; padding: 5px 0; display: inline-flex; align-items: center; gap: 6px; color: var(--cyan-soft); background: none; border: 0; font-size: 12px; font-weight: 800; cursor: pointer; }
.matchday-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.matchday-heading h2 { margin: 6px 0 0; font-size: 28px; letter-spacing: -.035em; }
.matchday-badge { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; color: var(--cyan); background: rgba(39,215,238,.1); border: 1px solid rgba(39,215,238,.24); border-radius: 15px; }
.matchday-badge .icon { width: 25px; height: 25px; }
.matchday-badge.trophy { color: var(--gold); background: rgba(255,211,90,.1); border-color: rgba(255,211,90,.23); }
.matchday-header .status-info { margin-top: 11px; color: var(--text-soft); font-size: 12px; line-height: 1.5; }
.prediction-progress { margin-top: 17px; padding: 12px; background: rgba(1,10,17,.3); border: 1px solid var(--border); border-radius: 14px; }
.progress-copy { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font-size: 10px; font-weight: 800; }
.progress-copy strong { color: var(--lime); font-size: 12px; }
.progress-track { height: 7px; overflow: hidden; background: rgba(255,255,255,.08); border-radius: 999px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--lime)); border-radius: inherit; box-shadow: 0 0 14px rgba(39,215,238,.45); transition: width .28s ease; }
.azioni-lega { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.azioni-lega .btn { min-height: 42px; flex: 1 1 120px; padding: 9px 12px; font-size: 11px; }
.test-mode-panel { padding: 16px; background: linear-gradient(145deg, rgba(61, 43, 13, .94), rgba(16, 31, 42, .98)); border: 1px solid rgba(255, 211, 90, .38); border-radius: var(--radius-lg); box-shadow: 0 14px 35px rgba(0, 0, 0, .28); }
.test-mode-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.test-mode-heading span { color: var(--gold); font-size: 8px; font-weight: 950; letter-spacing: .14em; }
.test-mode-heading h2 { margin: 4px 0 0; font-size: 20px; }
.test-mode-heading > strong { padding: 6px 9px; color: var(--ink); background: var(--gold); border-radius: 9px; font-size: 9px; letter-spacing: .1em; }
.test-mode-panel > p { margin: 10px 0 14px; color: var(--text-soft); font-size: 11px; line-height: 1.5; }
.test-mode-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.test-mode-actions .btn { min-height: 42px; padding: 8px 10px; font-size: 9px; line-height: 1.25; }
.test-mode-actions .danger { color: #ffd4da; border-color: rgba(255, 97, 120, .38); }
.test-match-controls { margin-top: 14px; display: grid; gap: 8px; }
.test-match-row { padding: 10px; display: grid; gap: 9px; background: rgba(1, 10, 17, .34); border: 1px solid var(--border); border-radius: 13px; }
.test-match-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 7px; font-size: 10px; font-weight: 850; }
.test-match-summary span:nth-child(3) { text-align: right; }
.test-score { min-width: 42px; color: var(--gold); font-size: 14px; font-weight: 950; text-align: center; }
.test-status { padding: 4px 6px; color: var(--text-muted); background: rgba(255,255,255,.05); border-radius: 7px; font-size: 7px; letter-spacing: .07em; text-transform: uppercase; }
.test-status.live { color: var(--ink); background: var(--coral); }
.test-status.finished { color: var(--ink); background: var(--green); }
.test-match-buttons { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.test-match-buttons button { min-height: 32px; padding: 4px; color: var(--text-soft); background: rgba(255,255,255,.04); border: 1px solid var(--border); border-radius: 8px; font-size: 8px; font-weight: 900; cursor: pointer; }
.test-match-buttons button:hover { color: var(--cyan-soft); border-color: rgba(39,215,238,.45); }
.test-match-buttons .goal { color: var(--lime); }
.test-match-buttons .finish { grid-column: span 2; color: var(--gold); }
.test-match-buttons .reopen { grid-column: span 2; color: var(--cyan-soft); }
.list-label { padding: 4px 2px 0; display: flex; align-items: center; justify-content: space-between; }
.list-label small { color: var(--text-muted); font-size: 10px; }
.matches-container { display: grid; gap: 12px; }
.match-card { position: relative; overflow: hidden; padding: 15px; background: linear-gradient(145deg, rgba(18,51,79,.97), rgba(8,27,44,.97)); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); transition: border-color .2s ease, transform .2s ease; }
.match-card::before { content: ""; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--coral); }
.match-card.completed::before { background: var(--green); }
.match-card.locked { opacity: .72; }
.match-testata { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.match-time { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.pallino-stato { width: 8px; height: 8px; flex: 0 0 auto; background: var(--coral); border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,97,120,.08); }
.pallino-stato.fatto { background: var(--green); box-shadow: 0 0 0 4px rgba(67,224,157,.08); }
.match-mancante { padding: 5px 8px; color: var(--lime); background: rgba(183,239,69,.09); border: 1px solid rgba(183,239,69,.2); border-radius: 999px; font-size: 9px; font-weight: 850; white-space: nowrap; }
.match-mancante.iniziata { color: var(--text-muted); background: transparent; border-color: var(--border); }
.match-teams { display: grid; grid-template-columns: 44px minmax(0,1fr) auto minmax(0,1fr) 44px; align-items: center; gap: 8px; margin-bottom: 13px; }
.team { min-width: 0; }
.team.casa { text-align: left; }
.team.fuori { text-align: right; }
.team strong { display: block; overflow: hidden; color: var(--text); font-size: 14px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.vs { color: var(--text-muted); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.stemma { width: 42px; height: 46px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; border: 2px solid rgba(255,255,255,.2); border-radius: 13px 13px 18px 18px; box-shadow: inset 0 -10px 15px rgba(0,0,0,.28), 0 6px 14px rgba(0,0,0,.22); font-size: 10px; font-weight: 950; letter-spacing: .03em; }
.stemma.grande { width: 50px; height: 54px; font-size: 12px; }
.prediction-buttons { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.prediction-btn { min-height: 53px; padding: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text); background: rgba(1,10,17,.32); border: 1px solid var(--border-strong); border-radius: 13px; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.prediction-btn:hover:not(:disabled) { border-color: rgba(39,215,238,.55); transform: translateY(-1px); }
.prediction-btn.selected { color: var(--ink); background: linear-gradient(135deg, var(--lime), #d7ff72); border-color: var(--lime); box-shadow: 0 7px 18px rgba(183,239,69,.15); }
.prediction-btn:disabled { opacity: .52; cursor: not-allowed; }
.prediction-label { font-size: 17px; font-weight: 950; line-height: 1; }
.prediction-points { color: var(--cyan-soft); font-size: 10px; font-weight: 800; }
.prediction-btn.selected .prediction-points, .prediction-btn.selected .prediction-label { color: var(--ink); }

.sticky-footer { position: fixed; z-index: 50; right: 10px; bottom: calc(var(--nav-height) + max(7px, env(safe-area-inset-bottom))); left: 10px; max-width: 600px; margin: 0 auto; padding: 8px; align-items: center; gap: 8px; background: rgba(7,24,39,.96); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: 0 15px 45px rgba(0,0,0,.45); backdrop-filter: blur(16px); }
.sticky-footer .save-copy { display: none; flex: 1; padding-left: 8px; color: var(--text-muted); line-height: 1.35; }
.sticky-footer .btn { width: 100%; min-height: 47px; }

/* Bonus stagione */
.bonus-screen { gap: 14px; padding-bottom: calc(var(--nav-height) + 120px); }
.bonus-hero { background: linear-gradient(145deg, rgba(41, 52, 72, .98), rgba(8, 27, 44, .98)); border-color: rgba(255, 211, 90, .24); }
.matchday-badge.bonus { color: var(--gold); background: rgba(255, 211, 90, .1); border-color: rgba(255, 211, 90, .25); }
.bonus-score-strip { margin-top: 16px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-soft); background: rgba(255, 211, 90, .07); border: 1px solid rgba(255, 211, 90, .18); border-radius: 14px; font-size: 11px; font-weight: 800; }
.bonus-score-strip strong { color: var(--gold); font-size: 17px; }
.bonus-notice { padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-radius: 15px; }
.bonus-notice div { display: grid; gap: 4px; }
.bonus-notice strong { font-size: 14px; }
.bonus-notice span { color: var(--text-soft); font-size: 11px; line-height: 1.45; }
.bonus-notice b { min-width: 48px; color: var(--gold); font-size: 28px; text-align: center; }
.bonus-notice.open { background: rgba(39, 215, 238, .08); border: 1px solid rgba(39, 215, 238, .22); }
.bonus-notice.locked { background: rgba(255, 211, 90, .07); border: 1px solid rgba(255, 211, 90, .2); }
.bonus-form { display: grid; gap: 12px; }
.bonus-card { min-width: 0; margin: 0; padding: 16px; background: linear-gradient(145deg, rgba(18, 51, 79, .97), rgba(8, 27, 44, .97)); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.bonus-card legend { width: 100%; padding: 0 0 13px; display: flex; align-items: flex-start; gap: 10px; }
.bonus-card legend > span:last-child { min-width: 0; display: grid; gap: 4px; }
.bonus-card legend strong { color: var(--text); font-size: 14px; line-height: 1.35; }
.bonus-card legend small { color: var(--text-muted); font-size: 10px; font-weight: 700; line-height: 1.4; }
.bonus-question-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; color: var(--gold); background: rgba(255, 211, 90, .1); border: 1px solid rgba(255, 211, 90, .2); border-radius: 11px; }
.bonus-team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.bonus-team-choice { min-width: 0; min-height: 61px; padding: 7px 9px; display: flex; align-items: center; gap: 8px; color: var(--text-soft); background: rgba(1, 10, 17, .3); border: 1px solid var(--border); border-radius: 13px; text-align: left; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.bonus-team-choice:hover:not(:disabled) { border-color: rgba(39, 215, 238, .55); transform: translateY(-1px); }
.bonus-team-choice .stemma { width: 32px; height: 36px; border-radius: 10px 10px 13px 13px; font-size: 8px; }
.bonus-team-choice > span { min-width: 0; flex: 1; overflow: hidden; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.bonus-team-choice > .icon { width: 17px; height: 17px; flex: 0 0 auto; }
.bonus-team-choice.selected { color: var(--ink); background: linear-gradient(135deg, var(--lime), #d7ff72); border-color: var(--lime); box-shadow: 0 7px 18px rgba(183, 239, 69, .12); }
.bonus-team-choice:disabled { cursor: default; opacity: .78; }
.bonus-team-choice.selected:disabled { opacity: 1; }
.bonus-result { margin-top: 12px; padding-top: 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 10px; }
.bonus-result strong { color: var(--gold); font-size: 12px; }
.bonus-admin-panel { margin-top: 8px; padding: 14px; background: rgba(255, 211, 90, .045); border: 1px solid rgba(255, 211, 90, .18); border-radius: var(--radius-lg); }
.bonus-admin-panel > .btn { margin-bottom: 0; }
.bonus-admin-panel #bonus-admin-editor { margin-top: 18px; }
.bonus-admin-panel .section-heading.compact { margin-bottom: 8px; }
.bonus-admin-panel .section-heading.compact h2 { font-size: 20px; }
.bonus-admin-panel #bonus-admin-save { margin-top: 12px; }

/* Standings */
.standings-screen { gap: 13px; }
.standings-hero { background: linear-gradient(145deg, rgba(42,55,72,.98), rgba(9,29,47,.98)); border-color: rgba(255,211,90,.2); }
.avviso-provvisoria { padding: 12px 14px; display: flex; align-items: center; gap: 9px; color: var(--text-soft); background: rgba(255,211,90,.07); border: 1px solid rgba(255,211,90,.18); border-radius: 14px; font-size: 11px; line-height: 1.45; }
.pallino-live { width: 8px; height: 8px; flex: 0 0 auto; background: var(--coral); border-radius: 50%; box-shadow: 0 0 0 4px rgba(255,97,120,.1); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .45; box-shadow: 0 0 0 8px rgba(255,97,120,0); } }
/* REGOLAMENTO
   Testo lungo da leggere sul telefono: interlinea generosa e blocchi
   separati, cosi' si trova il paragrafo che interessa senza rileggere tutto. */
.rules-screen, .scheda-screen, .stats-screen { gap: 12px; padding-bottom: calc(var(--nav-height) + 40px); }
.regola { padding: 17px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.regola h3 { margin: 0 0 10px; color: var(--cyan-soft); font-size: 13px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.regola p { margin: 0 0 10px; color: var(--text-soft); font-size: 13px; line-height: 1.62; }
.regola p:last-child { margin-bottom: 0; }
.regola strong { color: var(--text); }
.regola ul { margin: 0 0 10px; padding-left: 18px; color: var(--text-soft); font-size: 13px; line-height: 1.75; }

/* SCHEDA PERSONALE E STATISTICHE */
.stat-griglia { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.stat-riquadro { padding: 14px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.stat-riquadro strong { display: block; color: var(--gold); font-size: 22px; font-weight: 950; line-height: 1.1; }
.stat-riquadro span { display: block; margin-top: 5px; color: var(--text-soft); font-size: 10px; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.scheda-form { padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.scheda-form h3 { margin: 0 0 4px; font-size: 16px; }
.scheda-form .status-text { margin: 0 0 14px; }
.scheda-form select, .scheda-form input { width: 100%; min-height: 46px; padding: 0 12px; color: var(--text); background: rgba(1,10,17,.32); border: 1px solid var(--border-strong); border-radius: 13px; font-size: 14px; }

.stat-blocco { padding: 17px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.stat-blocco h3 { margin: 0 0 3px; font-size: 15px; }
.stat-blocco > p { margin: 0 0 13px; color: var(--text-muted); font-size: 11px; }
.classifica-mini { display: flex; flex-direction: column; gap: 7px; }
.classifica-mini div { display: flex; align-items: center; gap: 11px; padding: 9px 11px; background: rgba(1,10,17,.3); border-radius: 11px; font-size: 13px; }
.classifica-mini .posto { width: 20px; flex: 0 0 auto; color: var(--gold); font-weight: 950; }
.classifica-mini .nome { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classifica-mini .valore { flex: 0 0 auto; color: var(--lime); font-weight: 900; }
.classifica-mini div.io { border: 1px solid rgba(183,239,69,.4); }

/* ELENCO PARTECIPANTI */
.members-list { display: flex; flex-direction: column; gap: 9px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.member-row.io { border-color: rgba(183,239,69,.4); }
.member-nome { min-width: 0; flex: 1; }
.member-nome strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-nome span { display: block; margin-top: 2px; color: var(--text-soft); font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.member-azioni { display: flex; flex-shrink: 0; gap: 7px; }
.member-azioni button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; color: var(--text-muted); background: rgba(1,10,17,.32); border: 1px solid var(--border-strong); border-radius: 11px; cursor: pointer; }
.member-azioni button:hover:not(:disabled) { color: var(--cyan-soft); border-color: rgba(39,215,238,.5); }
.member-azioni button.rimuovi:hover:not(:disabled) { color: var(--coral); border-color: rgba(255,97,120,.5); }
.member-azioni button:disabled { opacity: .3; cursor: not-allowed; }
.member-azioni .icon { width: 17px; height: 17px; }

/* NAVIGAZIONE FRA LE GIORNATE
   Le frecce servono per spostarsi di uno, il menu a tendina per saltare a una
   giornata qualsiasi: con 38 giornate arrivare alla 30 a colpi di freccia
   sarebbe assurdo. Su telefono il select apre il selettore nativo, che e' il
   modo piu' comodo di scegliere in una lista lunga. */
.nav-giornate { margin-top: 14px; display: flex; align-items: center; gap: 8px; }
.nav-giornata { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; color: var(--cyan-soft); background: rgba(1,10,17,.32); border: 1px solid var(--border-strong); border-radius: 12px; cursor: pointer; }
.nav-giornata:hover:not(:disabled) { border-color: rgba(39,215,238,.5); }
.nav-giornata:disabled { opacity: .35; cursor: not-allowed; }
.nav-giornata.avanti .icon { transform: rotate(180deg); }
.nav-giornate select, .filtro-riga select {
  min-height: 40px; padding: 0 10px; color: var(--text); background: rgba(1,10,17,.32);
  border: 1px solid var(--border-strong); border-radius: 12px; font-size: 13px; font-weight: 800; cursor: pointer;
}
.nav-giornate select { flex: 1; }

/* FILTRO DELLA CLASSIFICA
   Da giornata X a giornata Y. Quando le due coincidono si guarda una sola
   giornata: non serve un terzo comando per quel caso. */
.filtro-classifica { margin-top: 14px; padding: 12px; background: rgba(1,10,17,.3); border: 1px solid var(--border); border-radius: 14px; }
.filtro-riga { display: flex; align-items: center; gap: 8px; }
.filtro-riga label { color: var(--text-soft); font-size: 11px; font-weight: 800; }
.filtro-riga select { flex: 1; min-width: 0; }
.filtro-scorciatoie { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 7px 11px; color: var(--cyan-soft); background: rgba(39,215,238,.09); border: 1px solid rgba(39,215,238,.28); border-radius: 999px; font-size: 11px; font-weight: 800; cursor: pointer; }
.chip:hover { background: rgba(39,215,238,.16); }
.chip.attivo { color: var(--ink); background: var(--lime); border-color: var(--lime); }

.table-caption { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 2px; }
.table-caption strong { font-size: 14px; }
.table-caption span { color: var(--text-muted); font-size: 9px; text-align: right; }
.tabellone-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); -webkit-overflow-scrolling: touch; }
.tabellone { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.tabellone th, .tabellone td { min-width: 52px; padding: 10px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.tabellone thead th { position: sticky; top: 0; z-index: 2; color: var(--text-soft); background: #102d47; font-weight: 850; }
.tabellone tbody tr:last-child > * { border-bottom: 0; }
.tabellone tr > *:last-child { border-right: 0; }
.tabellone .col-pos { position: sticky; left: 0; z-index: 3; min-width: 42px; color: var(--gold); background: #0e293f; }
.tabellone .col-nome { position: sticky; left: 42px; z-index: 3; min-width: 132px; max-width: 132px; overflow: hidden; color: var(--text); background: #0e293f; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.tabellone thead .col-pos, .tabellone thead .col-nome { z-index: 5; background: #143651; }
.tabellone tbody tr.tu > * { background-color: rgba(39,215,238,.09); }
.tabellone tbody tr.tu .col-pos, .tabellone tbody tr.tu .col-nome { background: #14374f; }
.col-partita .squadre { display: block; min-width: 48px; color: var(--text-muted); font-size: 8px; line-height: 1.25; }
.punteggio { display: inline-block; margin-top: 5px; padding: 3px 5px; color: var(--text); background: rgba(255,255,255,.07); border-radius: 6px; font-size: 10px; }
.punteggio.viva { color: var(--ink); background: var(--coral); }
.pick { font-size: 13px; font-weight: 900; }
.pick.buono { color: var(--green); }
.pick sup { margin-left: 2px; color: var(--gold); font-size: 8px; }
.pick-state { display: inline-flex; min-width: 34px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 900; line-height: 1; }
.pick-state .icon { width: 13px; height: 13px; }
.pick-state small { font-size: 7px; letter-spacing: .02em; text-transform: uppercase; }
.pick-state.saved { color: var(--green); }
.pick-state.missing { color: var(--coral); }
.tabellone .col-p { color: var(--cyan-soft); font-weight: 900; }
.tabellone .col-b { color: var(--lime); background: rgba(183,239,69,.045); font-weight: 900; }
.tabellone .col-t { color: var(--gold); background: rgba(255,211,90,.05); font-weight: 950; }

/* Join and modals */
.join-screen { justify-content: center; padding-top: 30px; padding-bottom: 30px; }
.join-card { width: min(100%, 420px); margin: auto; padding: 30px 24px; text-align: center; background: linear-gradient(150deg, var(--surface-2), var(--surface)); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.join-card .eyebrow { justify-content: center; }
.join-card h2 { margin: 8px 0; font-size: 27px; }
.join-card .btn + .btn { margin-top: 9px; }
.join-icon, .modal-icon { width: 58px; height: 58px; margin: 0 auto 18px; display: grid; place-items: center; color: var(--lime); background: rgba(183,239,69,.09); border: 1px solid rgba(183,239,69,.2); border-radius: 19px; }
.modal-icon.pericolo { color: var(--coral); background: rgba(255,97,120,.1); border-color: rgba(255,97,120,.24); }
.join-icon .icon, .modal-icon .icon { width: 28px; height: 28px; }
.modal { position: fixed; z-index: 120; inset: 0; padding: 18px; align-items: center; justify-content: center; background: rgba(1,7,12,.82); backdrop-filter: blur(8px); }
.modal-panel { width: min(100%, 430px); max-height: calc(100vh - 36px); overflow-y: auto; padding: 26px 22px; background: linear-gradient(150deg, #153a57, #091d2f); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: 0 30px 90px rgba(0,0,0,.58); }
.modal-panel .eyebrow { justify-content: center; }
.modal-panel h2 { margin: 7px 0 8px; text-align: center; font-size: 25px; }
.modal-panel > .status-text { margin: 0 0 20px; text-align: center; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 17px; }
/* Il menu della lega impila azioni a piena larghezza invece di affiancarle:
   "Elimina" non deve trovarsi accanto a un'altra voce e finire premuto per
   sbaglio con il pollice. */
.menu-azioni { display: grid; gap: 9px; margin-top: 18px; }
/* Stacca l'uscita dall'azione distruttiva che la precede: sono i due tocchi
   piu' probabili e non devono essere adiacenti. */
.menu-azioni .btn:last-child { margin-top: 7px; }

.gruppo-impostazioni { margin: 0 0 18px; padding: 15px 14px 4px; background: rgba(1,10,17,.26); border: 1px solid var(--border-strong); border-radius: 16px; }
.gruppo-impostazioni legend { padding: 0 8px; color: var(--cyan-soft); font-size: 11px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.gruppo-impostazioni .nota { margin: 0 0 13px; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.gruppo-impostazioni .nota.anteprima { margin: 2px 0 12px; padding: 10px 12px; color: var(--text-soft); background: rgba(39,215,238,.06); border-left: 2px solid var(--cyan); border-radius: 0 10px 10px 0; }
/* Due campi affiancati stanno comodi anche a 380px; sotto i 340 tornano
   in colonna invece di stringersi fino a diventare inutilizzabili. */
.coppia-campi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 340px) { .coppia-campi { grid-template-columns: 1fr; } }
.interruttore { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 15px; color: var(--text-soft); font-size: 13px; line-height: 1.4; cursor: pointer; }
.interruttore input { width: 22px; height: 22px; flex: 0 0 auto; margin-top: 1px; accent-color: var(--lime); cursor: pointer; }
#invite-link { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }

@media (min-width: 700px) {
  .screen { padding-right: 24px; padding-left: 24px; }
  .login-panel { grid-template-columns: 1.05fr .95fr; gap: 64px; }
  .auth-card { padding: 30px; }
  .leagues-section { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .league-card.create-new { min-height: 118px; }
  .matches-container { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .bonus-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .bonus-admin-panel .bonus-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .matchday-header { padding: 24px; }
  .sticky-footer .save-copy { display: block; }
  .sticky-footer .btn { width: auto; min-width: 235px; }
}

@media (min-width: 1000px) {
  .app-header { padding-right: calc((100vw - 920px) / 2); padding-left: calc((100vw - 920px) / 2); }
  .dashboard-hero { min-height: 232px; padding: 34px 32px 30px; }
  .hero-mark { right: 36px; font-size: 128px; }
}

@media (max-width: 370px) {
  :root { --header-height: 66px; }
  .brand-copy small, .header-chip { display: none; }
  .app-header { grid-template-columns: 42px 1fr; }
  .dashboard-hero { min-height: 190px; padding: 22px 17px 20px; }
  .hero-content { max-width: 76%; }
  .match-teams { grid-template-columns: 38px minmax(0,1fr) auto minmax(0,1fr) 38px; gap: 5px; }
  .stemma { width: 37px; height: 41px; }
  .team strong { font-size: 12px; }
  .bottom-nav { right: 6px; left: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
