/* Fantapoiscopa2 · tema chiaro e vivace, con avatar animati */
:root {
  color-scheme: light;
  --ink: #1d1a3a;
  --ink-soft: #5b5878;
  --linea: #e7e4f2;
  --fondo-tenue: #f6f5fb;
  --viola: #6a3de8;
  --rosa: #ff4f9a;
  --arancio: #ff8a1f;
  --giallo: #ffcf3d;
  --verde: #1fbf75;
  --azzurro: #1fa8f0;
  --rosso: #ef4b5b;
  --ombra: 0 2px 6px #1d1a3a0f, 0 8px 22px #1d1a3a12;
  --ombra-forte: 0 4px 10px #1d1a3a14, 0 14px 34px #1d1a3a1f;
  --raggio: 1.1rem;
}

* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent }
body {
  margin: 0;
  min-height: 100vh;
  background: #fff;
  color: var(--ink);
  font: 600 16px/1.45 'Nunito', system-ui, sans-serif;
}
h1, h2, h3 { font-weight: 900; line-height: 1.15; letter-spacing: -.02em }
p, small { color: var(--ink-soft) }
[hidden] { display: none !important }

/* ---------- Testata ---------- */
header, main { max-width: 920px; margin: 0 auto; padding: 1rem }
header {
  position: relative;
  isolation: isolate;
  margin-top: 1rem;
  padding: 1.3rem 1.2rem 1.1rem;
  overflow: hidden;
  border-radius: 1.4rem;
  box-shadow: var(--ombra-forte);
  background: linear-gradient(120deg, #5b2fd6 0%, #a23ee0 45%, var(--rosa) 80%, var(--arancio) 100%);
}
header::before, header::after { position: absolute; z-index: -1; content: ''; border-radius: 50% }
header::before { width: 12rem; height: 12rem; right: -3.5rem; bottom: -6rem; background: #ffffff1f }
header::after { width: 6rem; height: 6rem; right: 7rem; top: -3rem; background: #ffffff14 }
h1 {
  margin: 0 0 1rem;
  padding-right: 3.5rem;
  color: #fff;
  font-size: clamp(2rem, 7.5vw, 3.3rem);
  overflow-wrap: anywhere;
  text-shadow: 0 3px 12px #2a0d6a55;
}
.pallone-testata {
  position: absolute;
  top: .9rem;
  right: 1.1rem;
  font-size: clamp(2.2rem, 8vw, 3.3rem);
  filter: drop-shadow(0 4px 6px #0000003a);
  pointer-events: none;
}

/* ---------- Pulsanti e campi ---------- */
button, select, input {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #dcd8ea;
  border-radius: .75rem;
  padding: .5rem .75rem;
}
button {
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 1px 2px #1d1a3a14;
  transition: transform .15s, box-shadow .15s, background-color .15s, border-color .15s, color .15s;
}
button:not(:disabled):hover { border-color: #b9b2d6; box-shadow: 0 3px 10px #1d1a3a1a }
button:not(:disabled):active { transform: scale(.97) }
button:disabled { opacity: .4; cursor: default }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #1fa8f080; outline-offset: 2px
}
select { font-weight: 800; padding-right: 2rem; appearance: none; background:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d1a3a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") right .7rem center / .7rem no-repeat, #fff }
input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--viola) }
.actions, button.actions { margin-top: 1rem }

nav { display: grid; grid-template-columns: repeat(6, auto); justify-content: start; gap: .45rem }
nav button {
  --tinta: var(--giallo);
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .85rem;
  color: #fff;
  border: 1.5px solid #ffffff55;
  border-radius: 999px;
  background: #ffffff22;
  box-shadow: none;
  backdrop-filter: blur(4px);
}
nav button:not(:disabled):hover { border-color: #ffffffaa; background: #ffffff33; box-shadow: none }
nav button[aria-pressed=true] { color: var(--ink); background: #fff; border-color: #fff; box-shadow: 0 4px 14px #2a0d6a40 }
.icona-nav { font-size: 1.05em; line-height: 1 }
#installa { margin-top: .8rem; padding: .3rem .9rem; border-radius: 999px; color: var(--ink); background: var(--giallo); border-color: var(--giallo); font-size: .88rem }

/* ---------- Sezioni ---------- */
main { padding-block: 1.2rem 2rem }
main section {
  padding: 1.3rem;
  border: 1px solid var(--linea);
  border-radius: 1.4rem;
  background: #fff;
  box-shadow: var(--ombra);
}
main section > h2 {
  position: relative;
  margin: 0 0 1rem;
  padding-left: .8rem;
  font-size: clamp(1.4rem, 5vw, 1.8rem);
}
main section > h2::before {
  position: absolute; left: 0; top: .12em; bottom: .12em; width: .32rem; content: '';
  border-radius: 999px; background: var(--tinta, var(--viola));
}
#mio-match { --tinta: var(--giallo) }
#classifica { --tinta: var(--verde) }
#calendario { --tinta: var(--azzurro) }
#storico { --tinta: var(--arancio) }
#analisi { --tinta: var(--rosa) }
#admin { --tinta: var(--viola) }
h3 { font-size: 1.1rem; margin: 1rem 0 .6rem }
section > p, form > p { line-height: 1.5 }

/* ---------- Stemmi e avatar ---------- */
.team-label { display: inline-flex; align-items: center; gap: .6rem; min-width: 0; color: var(--ink); font-weight: 800 }
.team-crest { display: inline-block; flex: 0 0 auto; width: 1.9rem; height: 2.25rem; line-height: 0 }
.team-crest svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 2px #1d1a3a30) }
.sigla-stemma {
  font-family: 'Nunito', system-ui, sans-serif; font-weight: 900; font-size: 16px; letter-spacing: -.5px;
  fill: #fff; stroke: #1d1a3a; stroke-opacity: .55; stroke-width: 2.4px; paint-order: stroke fill; stroke-linejoin: round;
}
.nome-squadra { min-width: 0; overflow-wrap: break-word; line-height: 1.2 }
.apri-squadra, .apri-squadra:not(:disabled):hover, .apri-squadra:not(:disabled):active {
  padding: .1rem; background: transparent; border: 0; border-radius: .6rem; box-shadow: none; transform: none; text-align: left;
}
.apri-squadra:hover .nome-squadra { text-decoration: underline; text-decoration-color: var(--c1); text-decoration-thickness: 2px; text-underline-offset: .2em }

/* Allenatore a figura intera, senza sfondo, con lo stemma piccolo davanti */
.avatar-badge {
  position: relative; flex: 0 0 auto; display: inline-block;
  width: 3rem; height: 3.9rem;
}
.avatar-badge > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 3px 3px #1d1a3a40);
}
.avatar-badge::after {
  position: absolute; left: 18%; right: 18%; bottom: -.12rem; height: .3rem; content: ''; border-radius: 50%;
  background: radial-gradient(#1d1a3a33, transparent 70%);
}
.avatar-badge.senza-avatar { display: inline-grid; place-items: center }
.avatar-badge.senza-avatar::after { display: none }
.avatar-badge.senza-avatar .team-crest { width: 2.3rem; height: 2.75rem }
.avatar-badge .stemma-mini { position: absolute; z-index: 1; right: -.3rem; bottom: -.1rem; width: 1.25rem; height: 1.5rem }

/* Figura intera (match) */
.team-figura { position: relative; display: grid; place-items: end center; width: min(100%, calc(var(--altezza-figura, 6.5rem) * 1.15)); height: var(--altezza-figura, 6.5rem); margin-inline: auto }
.match { --altezza-figura: 8.5rem }
.team-figura .attore { position: relative; display: grid; place-items: end center; width: 100%; height: 100%; transform-origin: 50% 100% }
.team-figura img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 4px 5px #1d1a3a38) }
.team-figura .stemma-grande { width: 62%; height: 78%; align-self: center }
.team-figura .stemma-mini { position: absolute; z-index: 1; left: 4%; bottom: 2%; width: 1.7rem; height: 2rem }
.ombra-terra {
  position: absolute; left: 22%; right: 22%; bottom: -.15rem; height: .45rem; border-radius: 50%;
  background: radial-gradient(#1d1a3a40, transparent 70%);
}

/* ---------- Classifica (tabella su schermi larghi) ---------- */
.criteri-classifica { margin: 0 0 1rem; font-size: .9rem }
.criteri-classifica summary {
  display: inline-block; cursor: pointer; padding: .3rem .85rem; border-radius: 999px;
  color: var(--viola); background: #f0ebff; font-weight: 800; list-style: none;
}
.criteri-classifica summary::-webkit-details-marker { display: none }
.criteri-classifica summary::before { content: 'ℹ︎  ' }
.criteri-classifica p { margin: .6rem 0 0; padding: .7rem .9rem; background: var(--fondo-tenue); border-radius: .8rem }

.table { overflow-x: auto; border: 1px solid var(--linea); border-radius: var(--raggio); box-shadow: var(--ombra) }
table { width: 100%; border-collapse: separate; border-spacing: 0; white-space: nowrap }
th {
  padding: .7rem .45rem; color: var(--ink-soft); background: var(--fondo-tenue);
  font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; text-align: center;
  border-bottom: 1px solid var(--linea);
}
td { padding: .55rem .45rem; text-align: center; border-bottom: 1px solid #f0eef7; font-variant-numeric: tabular-nums; font-weight: 700 }
tbody tr:last-child td { border-bottom: 0 }
th:nth-child(2), td:nth-child(2) { text-align: left }
#posizioni td:first-child { box-shadow: inset 4px 0 var(--c1) }
#posizioni tr:hover td { background: color-mix(in srgb, var(--c1) 6%, #fff) }
#posizioni tr.mia-squadra td { background: #fff8dc }
.fp-breve, .fp-tondo, .solo-mobile, .classifica-tabella td:nth-child(12) { display: none }

.pos-badge {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem;
  font-weight: 900; font-size: .95rem; border-radius: 50%; background: var(--fondo-tenue); color: var(--ink-soft);
}
.podio-1 .pos-badge { background: linear-gradient(135deg, #ffe27a, #f5b700); color: #5a4200 }
.podio-2 .pos-badge { background: linear-gradient(135deg, #f1f3f8, #c3c9d6); color: #3d4352 }
.podio-3 .pos-badge { background: linear-gradient(135deg, #ffd3a8, #e0904a); color: #5c3110 }
.punti {
  display: inline-block; min-width: 2.3rem; padding: .12rem .45rem;
  font-size: 1.1rem; font-weight: 900; color: #fff;
  border-radius: .55rem; background: var(--verde);
}

/* ---------- Analisi ---------- */
.controlli-statistiche { display: flex; flex-wrap: wrap; gap: .6rem; margin-block: .5rem .9rem }
.controlli-statistiche label { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; font-weight: 800 }
#posizione-mia-squadra {
  margin: 0 0 1rem; padding: .6rem .9rem; color: var(--ink); font-weight: 800;
  border-radius: .9rem; background: #fff8dc; border: 1px solid #f7e3a1;
}
#posizione-mia-squadra::before { content: '⭐ ' }
#analisi .table { overflow: visible; border: 0; border-radius: 0; box-shadow: none }
#analisi thead {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
#analisi table, #analisi tbody { display: block; white-space: normal }
#graduatoria-statistiche tr {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  grid-template-areas: 'pos squadra classifica' 'pos barra barra';
  align-items: center;
  gap: .35rem .65rem;
  margin-bottom: .6rem;
  padding: .6rem .8rem;
  border: 1px solid var(--linea);
  border-left: 5px solid var(--c1);
  border-radius: var(--raggio);
  background: #fff;
  box-shadow: var(--ombra);
}
#graduatoria-statistiche td { padding: 0; border: 0; text-align: left }
#graduatoria-statistiche td:nth-child(1) { grid-area: pos }
#graduatoria-statistiche td:nth-child(2) { grid-area: squadra }
#graduatoria-statistiche td:nth-child(3) { grid-area: barra }
#graduatoria-statistiche td:nth-child(4) {
  grid-area: classifica; font-size: .75rem; padding: .12rem .55rem; color: var(--ink-soft);
  border-radius: 999px; background: var(--fondo-tenue); white-space: nowrap;
}
#graduatoria-statistiche td:nth-child(4)::before { content: 'Class. '; font-weight: 600 }
#graduatoria-statistiche tr.mia-squadra { background: #fffbea }
#graduatoria-statistiche tr:nth-child(1) .pos-badge { background: linear-gradient(135deg, #ffe27a, #f5b700); color: #5a4200 }
.barra { display: flex; align-items: center; gap: .6rem }
.barra-traccia { flex: 1; height: .7rem; overflow: hidden; border-radius: 999px; background: #efedf6 }
.barra-traccia i {
  display: block; height: 100%; min-width: .35rem; border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c1) 70%, #fff), var(--c1));
  transition: width .5s cubic-bezier(.3, 1.3, .5, 1);
}
.barra-traccia i.negativa { background: linear-gradient(90deg, #ff9aa5, var(--rosso)) }
.barra b { min-width: 2.4rem; text-align: right; font-size: 1.15rem; font-weight: 900 }

/* ---------- Navigazione giornate ---------- */
.round-nav {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .35rem; text-align: center;
  background: var(--fondo-tenue); border: 1px solid var(--linea); border-radius: 999px;
}
.round-nav strong, .round-nav h3 { margin: 0; font-weight: 900; font-size: 1rem; color: var(--ink) }
.round-nav button {
  display: grid; place-items: center; min-width: 2.6rem; min-height: 2.6rem; padding: 0;
  font-size: 1.4rem; line-height: 1; border-radius: 50%; color: #fff; border: 0; background: var(--viola);
  box-shadow: 0 3px 8px #6a3de84d;
}
.round-nav button:disabled { opacity: 1; color: #b9b5cc; background: #fff; box-shadow: none }
#partite { touch-action: pan-y }
#istruzioni-risultati { font-size: .9rem }

/* ---------- Card partita ---------- */
#partite, #archivio { display: grid; gap: .9rem; margin-top: 1rem }
.match {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: .55rem .5rem;
  padding: .9rem .7rem .8rem;
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 1.3rem;
  box-shadow: var(--ombra);
  background:
    linear-gradient(100deg,
      color-mix(in srgb, var(--casa) 17%, #fff) 0 calc(50% - 1px),
      #fff calc(50% - 1px) calc(50% + 1px),
      color-mix(in srgb, var(--trasferta) 17%, #fff) calc(50% + 1px));
}
.match > .team-label { flex-direction: column; justify-content: flex-end; gap: .45rem; text-align: center; justify-self: stretch }
.match > .team-label.apri-squadra { text-align: center }
.match .nome-squadra, .sfida-personale .nome-squadra, #locandina-scontro .nome-squadra {
  display: block; max-width: 100%; padding: .18rem .55rem;
  font-size: .85rem; font-weight: 800; background: #ffffffe6; border-radius: 999px; box-shadow: 0 1px 4px #1d1a3a1f;
}
.team-label.vincente .nome-squadra { color: #fff; background: var(--c1) }
.team-label.perdente .nome-squadra { color: var(--ink-soft) }

.punteggio {
  position: relative; z-index: 1; align-self: center;
  display: flex; align-items: center; justify-content: center; gap: .25rem;
  min-width: 4.4rem; padding: .25rem .7rem;
  font-weight: 900; font-size: 1.6rem; line-height: 1.15; color: #fff;
  border-radius: .9rem; background: var(--ink); box-shadow: 0 6px 16px #1d1a3a40;
  font-variant-numeric: tabular-nums;
}
.punteggio.da-giocare { color: var(--viola); background: #fff; font-size: 1.05rem; letter-spacing: .08em; box-shadow: 0 4px 14px #6a3de82e }
.punteggio .trattino { opacity: .5 }
.punteggio input {
  width: 3rem; padding: .15rem .1rem; text-align: center; font-size: 1.3rem; font-weight: 900;
  border-radius: .5rem; -moz-appearance: textfield;
}
.punteggio input::-webkit-inner-spin-button, .punteggio input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0 }

.fantapunti-partita {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: .5rem; text-align: center; font-size: .88rem;
}
.valore-fp { justify-self: center; padding: .05rem .6rem; background: #ffffffcc; border-radius: 999px; font-variant-numeric: tabular-nums; font-weight: 800 }
.etichetta-fp { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft) }
.fantapunti-partita input { width: 100%; max-width: 6rem; justify-self: center; text-align: center; padding: .3rem }
.match .apri-scontro {
  grid-column: 1 / -1; justify-self: center;
  padding: .32rem 1rem; font-size: .82rem; color: var(--viola); background: #ffffffd9; border-color: #ffffff; border-radius: 999px;
}
.match > .match-note {
  grid-column: 1 / -1; justify-self: center; padding: .15rem .7rem; font-size: .76rem; font-weight: 800; color: var(--ink-soft);
  background: #ffffffd9; border-radius: 999px;
}
.match.fuori-classifica { filter: saturate(.6) }
#regola { font-size: .92rem }
.avviso-giornata { margin: 0; padding: .5rem .8rem; border-radius: .8rem; background: #fff8dc; color: var(--ink) }
#storico > label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800 }

/* Pallone che attraversa la scena */
.pallone-scena {
  position: absolute; z-index: 2; left: 50%; top: calc(.9rem + var(--altezza-figura, 6.5rem) - 1.1rem);
  font-size: 1rem; line-height: 1; opacity: 0; pointer-events: none;
}

/* ---------- Il mio match ---------- */
.squadre-personali { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .65rem }
.squadre-personali button {
  display: flex; padding: .6rem .8rem; text-align: left;
  border: 1px solid var(--linea); border-left: 5px solid var(--c1);
  background: color-mix(in srgb, var(--c1) 8%, #fff);
}
#incontro-personale .round-nav { margin-block: .2rem .9rem }
.esito-personale {
  width: fit-content; margin: 0 auto .9rem; padding: .3rem 1rem;
  font-size: 1.05rem; font-weight: 900; color: var(--ink);
  border-radius: 999px; background: var(--fondo-tenue);
}
.esito-personale.vittoria { color: #0c6b40; background: #d9f7e8 }
.esito-personale.pareggio { color: #0b5f8a; background: #dcf1fd }
.esito-personale.sconfitta { color: #9b1f2c; background: #fde3e6 }
.sfida-personale {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: .6rem .4rem;
  width: 100%; margin-bottom: 1rem; padding: 1rem .7rem;
  border: 1px solid var(--linea); border-radius: 1.4rem; box-shadow: var(--ombra-forte);
  background:
    linear-gradient(100deg,
      color-mix(in srgb, var(--casa) 28%, #fff) 0 calc(50% - 1px),
      #fff calc(50% - 1px) calc(50% + 1px),
      color-mix(in srgb, var(--trasferta) 28%, #fff) calc(50% + 1px));
}
.sfida-personale:not(:disabled):hover { box-shadow: var(--ombra-forte) }
.sfida-personale .team-label { flex-direction: column; gap: .5rem; text-align: center }
.sfida-personale { --altezza-figura: clamp(8.5rem, 38vw, 13rem) }
.sfida-personale .punteggio { font-size: 1.9rem }
.sfida-personale .fantapunti-partita { align-self: center }
.cambia-squadra { display: block; margin-inline: auto; border-radius: 999px }

/* ---------- Finestre ---------- */
dialog {
  max-height: 90dvh; overflow: auto; padding: 1rem;
  color: var(--ink); background: #fff;
  border: 0; border-radius: 1.4rem; box-shadow: 0 20px 60px #1d1a3a59;
}
dialog::backdrop { background: #1d1a3a99; backdrop-filter: blur(3px) }
dialog > form[method=dialog] { text-align: right }
dialog > form[method=dialog] button { width: 2.3rem; height: 2.3rem; padding: 0; border-radius: 50%; font-size: 1.3rem; line-height: 1; background: var(--fondo-tenue); border: 0 }
dialog h2 { margin: 0 0 .5rem; font-size: 1.45rem }
#guida-installazione { width: min(94%, 31rem) }
#guida-installazione p { color: var(--ink) }

#scontro { width: min(calc(100% - 1rem), 46rem); text-align: center }
#titolo-scontro { color: var(--viola) }
#locandina-scontro {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: .5rem;
  margin-block: 1rem; padding: 1rem .6rem;
  border-radius: 1.3rem; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 120%, #ffffffaa, transparent 60%),
    linear-gradient(100deg,
      color-mix(in srgb, var(--casa) 40%, #fff) 0 calc(50% - 1px),
      #fff calc(50% - 1px) calc(50% + 1px),
      color-mix(in srgb, var(--trasferta) 40%, #fff) calc(50% + 1px));
}
#locandina-scontro .team-label { flex-direction: column; gap: .5rem; text-align: center }
#locandina-scontro { --altezza-figura: clamp(10rem, 45vw, 17rem) }
#locandina-scontro .stemma-mini { width: 2.4rem; height: 2.85rem }
#locandina-scontro .nome-squadra { font-size: clamp(.9rem, 3.6vw, 1.2rem) }
#locandina-scontro > strong {
  position: relative; z-index: 1; align-self: center; padding: .3rem .85rem;
  font-size: clamp(1.5rem, 6.5vw, 2.6rem); font-weight: 900; color: #fff;
  background: var(--ink); border-radius: 1rem; box-shadow: 0 8px 22px #1d1a3a4d;
}
#locandina-scontro .pallone-scena { font-size: 1.4rem }
#esito-scontro {
  display: inline-block; margin: 0; padding: .35rem 1rem; color: var(--ink);
  font-size: 1.1rem; font-weight: 900; background: var(--fondo-tenue); border-radius: 999px;
}

#scheda-squadra { width: min(94%, 38rem); border-top: 8px solid var(--c1, var(--ink)) }
.profilo-squadra { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem }
.profilo-squadra figure {
  display: grid; align-content: end; justify-items: center; gap: .6rem; margin: 0; padding: .8rem .3rem;
  text-align: center; background: color-mix(in srgb, var(--c1, #ccc) 10%, #fff); border-radius: 1rem;
}
.profilo-squadra figcaption { font-size: .8rem; color: var(--ink-soft) }
#profilo-logo { width: 4.2rem; height: 5rem }
#profilo-avatar { color: var(--ink-soft); font-size: .85rem }
#profilo-avatar img { width: 100%; max-height: 9rem; object-fit: contain; filter: drop-shadow(0 4px 5px #1d1a3a38) }
#profilo-divisa {
  width: min(100%, 5.5rem); aspect-ratio: 1;
  background: linear-gradient(90deg, var(--club) 0 38%, var(--club2, #fff) 38% 62%, var(--club) 62%);
  clip-path: polygon(20% 5%, 37% 0, 43% 13%, 57% 13%, 63% 0, 80% 5%, 100% 30%, 84% 47%, 77% 40%, 77% 100%, 23% 100%, 23% 40%, 16% 47%, 0 30%);
}

/* ---------- Admin ---------- */
#accesso-admin { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem }
#accesso-admin label { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-weight: 800 }
#accesso-admin button, #salva-risultati { color: #fff; background: var(--verde); border-color: var(--verde) }
#stato, #stato-admin { font-weight: 800; color: var(--viola) }

/* ---------- Animazioni degli avatar nei match ---------- */
@keyframes entra-casa { from { opacity: 0; transform: translateX(-60%) } to { opacity: 1; transform: none } }
@keyframes entra-trasferta { from { opacity: 0; transform: translateX(60%) } to { opacity: 1; transform: none } }
@keyframes risultato-pop { 0% { opacity: 0; transform: scale(.4) } 70% { opacity: 1; transform: scale(1.12) } 100% { opacity: 1; transform: scale(1) } }
/* Attesa: si studiano, piccolo passo avanti verso l'avversario */
@keyframes studia-casa { 0%, 100% { transform: none } 40% { transform: translateX(5%) rotate(3deg) } 55% { transform: translateX(2%) rotate(1deg) } }
@keyframes studia-trasferta { 0%, 100% { transform: none } 40% { transform: translateX(-5%) rotate(-3deg) } 55% { transform: translateX(-2%) rotate(-1deg) } }
@keyframes vs-pulsa { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.1) } }
/* Vittoria: saltelli di esultanza */
@keyframes esulta {
  0%, 52%, 100% { transform: none }
  60% { transform: translateY(-14%) rotate(-3deg) }
  68% { transform: none }
  76% { transform: translateY(-9%) rotate(3deg) }
  84% { transform: none }
}
/* Sconfitta: si piega un po' e resta giù */
@keyframes abbattuto { 0%, 100% { transform: translateY(3%) rotate(-4deg) scale(.96) } 50% { transform: translateY(4%) rotate(-6deg) scale(.95) } }
/* Pareggio: ondeggiano */
@keyframes ondeggia { 0%, 100% { transform: rotate(-2.5deg) } 50% { transform: rotate(2.5deg) } }
@keyframes respira { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-3%) } }
/* Il pallone parte dal vincente e finisce nella porta dello sconfitto */
@keyframes tiro-verso-trasferta {
  0% { opacity: 0; transform: translate(-7rem, 0) rotate(0) }
  10% { opacity: 1 }
  50% { transform: translate(0, -2.2rem) rotate(360deg) }
  85% { opacity: 1; transform: translate(7rem, 0) rotate(720deg) }
  100% { opacity: 0; transform: translate(7.5rem, .2rem) rotate(760deg) }
}
@keyframes tiro-verso-casa {
  0% { opacity: 0; transform: translate(7rem, 0) rotate(0) }
  10% { opacity: 1 }
  50% { transform: translate(0, -2.2rem) rotate(-360deg) }
  85% { opacity: 1; transform: translate(-7rem, 0) rotate(-720deg) }
  100% { opacity: 0; transform: translate(-7.5rem, .2rem) rotate(-760deg) }
}
@keyframes palleggio { 0%, 100% { opacity: 1; transform: translate(-50%, 0) } 50% { opacity: 1; transform: translate(-50%, -1.2rem) } }
@keyframes passaggio {
  0%, 100% { opacity: 1; transform: translate(-5.5rem, 0) rotate(0) }
  50% { opacity: 1; transform: translate(5.5rem, 0) rotate(540deg) }
}

@media (prefers-reduced-motion: no-preference) {
  .pallone-testata { animation: respira 3s ease-in-out infinite }

  /* Ingresso in campo */
  .scena .team-figura { opacity: 0 }
  .scena > .punteggio, .scena > strong { opacity: 0 }
  .scena.in-campo .lato-casa .team-figura { animation: entra-casa .6s cubic-bezier(.2, .9, .3, 1.15) both }
  .scena.in-campo .lato-trasferta .team-figura { animation: entra-trasferta .6s cubic-bezier(.2, .9, .3, 1.15) both }
  .scena.in-campo > .punteggio, .scena.in-campo > strong { animation: risultato-pop .45s .45s both }

  /* Comportamento dopo l'ingresso */
  .scena.in-campo .attore { animation: respira 3.2s .7s ease-in-out infinite }
  .scena.in-campo.esito-attesa .lato-casa .attore { animation: studia-casa 2.8s .7s ease-in-out infinite }
  .scena.in-campo.esito-attesa .lato-trasferta .attore { animation: studia-trasferta 2.8s .7s ease-in-out infinite }
  .scena.in-campo.esito-attesa > .punteggio.da-giocare { animation: risultato-pop .45s .45s both, vs-pulsa 2.8s 1.1s ease-in-out infinite }
  .scena.in-campo .vincente .attore { animation: esulta 3s .9s ease-in-out infinite }
  .scena.in-campo .perdente .attore { animation: abbattuto 3.5s .7s ease-in-out infinite }
  .scena.in-campo .perdente .team-figura img { filter: drop-shadow(0 4px 5px #1d1a3a38) saturate(.6) brightness(.97) }
  .scena.in-campo .pari .attore { animation: ondeggia 2.6s .7s ease-in-out infinite }
  .scena.in-campo .lato-trasferta.pari .attore { animation-delay: 2s }
  .scena.in-campo .lato-trasferta .attore { animation-delay: 1.5s }
  .scena.in-campo .lato-trasferta.vincente .attore { animation-delay: .9s }

  /* Pallone */
  .scena.in-campo.esito-vince-casa .pallone-scena { animation: tiro-verso-trasferta 1.3s .8s ease-in-out both }
  .scena.in-campo.esito-vince-trasferta .pallone-scena { animation: tiro-verso-casa 1.3s .8s ease-in-out both }
  .scena.in-campo.esito-pari .pallone-scena { margin-left: -.5rem; animation: passaggio 3.2s 1s ease-in-out infinite }
  .scena.in-campo.esito-attesa .pallone-scena { animation: palleggio .9s 1s ease-in-out infinite }

  .match:hover .attore { animation-play-state: paused }
}
@media (prefers-reduced-motion: reduce) {
  button, .barra-traccia i { transition: none }
  .pallone-scena { display: none }
}

/* ---------- Telefono ---------- */
@media (max-width: 680px) {
  header, main { padding-inline: .6rem }
  header { margin: .6rem .5rem 0; padding: 1rem .8rem .9rem; border-radius: 1.2rem }
  main { padding: .9rem .5rem 1.5rem }
  main section { padding: 1rem .75rem; border-radius: 1.2rem }
  h1 { margin-bottom: .8rem; font-size: clamp(1.8rem, 8.5vw, 2.3rem) }
  .pallone-testata { top: .8rem; right: .8rem; font-size: 2.2rem }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem }
  nav button { flex-direction: column; justify-content: center; gap: .1rem; min-height: 3.2rem; padding: .3rem .2rem; font-size: .78rem; line-height: 1.1; border-radius: .9rem }
  .icona-nav { font-size: 1.2rem }

  /* Classifica: tabella compatta, tutta in una schermata */
  .classifica-tabella { overflow: hidden }
  .classifica-tabella table, .classifica-tabella thead, .classifica-tabella tbody { display: block; white-space: normal }
  .classifica-tabella tr {
    display: grid;
    grid-template-columns: 1.25rem minmax(0, 1fr) 1.7rem repeat(4, .95rem) 2.25rem 1.6rem 1.7rem;
    column-gap: .15rem; align-items: center; padding: .4rem .25rem .4rem .4rem;
  }
  .classifica-tabella :is(th, td) { padding: 0; border: 0; font-size: .78rem; text-align: center; min-width: 0 }
  .classifica-tabella th { font-size: .62rem; letter-spacing: .02em; background: none }
  .classifica-tabella thead tr { background: var(--fondo-tenue); border-bottom: 1px solid var(--linea) }
  .classifica-tabella tbody tr { border-bottom: 1px solid #f0eef7; box-shadow: inset 3px 0 var(--c1) }
  .classifica-tabella tbody tr:last-child { border-bottom: 0 }
  #posizioni td:first-child { box-shadow: none }
  #posizioni tr.mia-squadra { background: #fffbea }
  #posizioni tr.mia-squadra td, #posizioni tr:hover td { background: transparent }
  .classifica-tabella :is(th, td):nth-child(1) { order: 1 }
  .classifica-tabella :is(th, td):nth-child(2) { order: 2; text-align: left }
  .classifica-tabella :is(th, td):nth-child(3) { order: 3 }
  .classifica-tabella :is(th, td):nth-child(5) { order: 4 }
  .classifica-tabella :is(th, td):nth-child(6) { order: 5 }
  .classifica-tabella :is(th, td):nth-child(7) { order: 6 }
  .classifica-tabella :is(th, td):nth-child(8) { order: 7 }
  .classifica-tabella :is(th, td):nth-child(12) { order: 8; display: block }
  .classifica-tabella :is(th, td):nth-child(11) { order: 9 }
  .classifica-tabella :is(th, td):nth-child(4) { order: 10 }
  .classifica-tabella :is(th, td):nth-child(9), .classifica-tabella :is(th, td):nth-child(10) { display: none }
  .classifica-tabella .fp-esteso, .classifica-tabella .fp-pieno { display: none }
  .classifica-tabella .fp-breve, .classifica-tabella .fp-tondo { display: inline; text-decoration: none }
  .classifica-tabella td:nth-child(4) { color: var(--ink-soft); font-size: .72rem }
  .classifica-tabella .pos-badge { width: 1.3rem; height: 1.3rem; font-size: .7rem }
  .classifica-tabella .punti { min-width: 0; width: 100%; padding: .1rem 0; font-size: .85rem; border-radius: .4rem }
  .classifica-tabella .team-label { gap: .3rem; width: 100% }
  .classifica-tabella .avatar-badge { width: 1.45rem; height: 2rem }
  .classifica-tabella .avatar-badge .stemma-mini { right: -.2rem; bottom: -.05rem; width: .78rem; height: .93rem }
  .classifica-tabella .avatar-badge.senza-avatar .team-crest { width: 1.3rem; height: 1.55rem }
  .classifica-tabella .nome-squadra { font-size: .74rem; line-height: 1.1 }
  #classifica { padding-inline: .5rem }

  /* Analisi */
  .controlli-statistiche { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem }
  .controlli-statistiche label { display: grid; gap: .2rem; font-size: .8rem }
  .controlli-statistiche select { width: 100% }
  #filtro-squadra-statistiche { grid-column: 1 / -1; display: flex }
  #graduatoria-statistiche tr { grid-template-columns: 2rem minmax(0, 1fr) auto; padding: .55rem .65rem }
  #graduatoria-statistiche .avatar-badge { width: 2.7rem; height: 3.5rem }
  .pos-badge { width: 1.8rem; height: 1.8rem; font-size: .9rem }

  /* Partite */
  .match { padding: .8rem .45rem .7rem; gap: .5rem .3rem }
  .match { --altezza-figura: 5.6rem }
  .match .team-figura { height: var(--altezza-figura) }
  .match .nome-squadra { font-size: .76rem; padding: .15rem .45rem }
  .match .stemma-mini { width: 1.4rem; height: 1.65rem }
  .punteggio { min-width: 3.8rem; padding: .2rem .5rem; font-size: 1.4rem }
  .punteggio input { width: 2.6rem; font-size: 1.15rem }
  .round-nav strong, .round-nav h3 { font-size: .9rem }
  .sfida-personale { padding: .9rem .45rem }
  .sfida-personale .punteggio { font-size: 1.55rem }
  #scontro { padding: .75rem }
  #locandina-scontro { padding: .8rem .35rem }
  .profilo-squadra { gap: .4rem }
  @keyframes tiro-verso-trasferta {
    0% { opacity: 0; transform: translate(-5rem, 0) rotate(0) } 10% { opacity: 1 }
    50% { transform: translate(0, -2rem) rotate(360deg) }
    85% { opacity: 1; transform: translate(5rem, 0) rotate(720deg) } 100% { opacity: 0; transform: translate(5.4rem, .2rem) rotate(760deg) }
  }
  @keyframes tiro-verso-casa {
    0% { opacity: 0; transform: translate(5rem, 0) rotate(0) } 10% { opacity: 1 }
    50% { transform: translate(0, -2rem) rotate(-360deg) }
    85% { opacity: 1; transform: translate(-5rem, 0) rotate(-720deg) } 100% { opacity: 0; transform: translate(-5.4rem, .2rem) rotate(-760deg) }
  }
  @keyframes passaggio {
    0%, 100% { opacity: 1; transform: translate(-4rem, 0) rotate(0) }
    50% { opacity: 1; transform: translate(4rem, 0) rotate(540deg) }
  }
}
@media (max-width: 360px) {
  .match .nome-squadra { font-size: .7rem }
  .punteggio { min-width: 3.3rem; font-size: 1.25rem }
}
