:root { --blu: #0b3d91; --blu-chiaro: #e8eef9; --nero: #111418; --grigio: #5b6270; --bianco: #ffffff;
        --rosso: #b00020; --verde: #0a6b2d; }
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 1.1rem;
       line-height: 1.55; color: var(--nero); background: #f4f6fa; }
header { background: var(--nero); color: var(--bianco); border-bottom: 5px solid var(--blu); }
header .contenitore { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
header a.marchio { color: var(--bianco); text-decoration: none; font-weight: 700; font-size: 1.15rem; }
nav { display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; }
nav a, nav button { color: var(--bianco); text-decoration: none; background: none; border: 0; font: inherit;
                    cursor: pointer; padding: .2rem 0; }
nav a:hover, nav button:hover { text-decoration: underline; }
.contenitore { max-width: 46rem; margin: 0 auto; padding: .8rem 1rem; }
main.contenitore { padding-top: 1.2rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; color: var(--blu); }
h2 { font-size: 1.2rem; margin: 1.6rem 0 .6rem; }
.scheda { background: var(--bianco); border: 1px solid #d9dee8; border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin: .8rem 0 .25rem; }
input[type=text], input[type=password], input[type=number] { width: 100%; font-size: 1.1rem; padding: .6rem .7rem;
      border: 1px solid #b8c0cf; border-radius: 8px; }
input:focus { outline: 3px solid var(--blu-chiaro); border-color: var(--blu); }
.bottone { display: inline-block; background: var(--blu); color: var(--bianco); border: 0; border-radius: 8px;
           padding: .6rem 1.1rem; font-size: 1.05rem; font-weight: 600; cursor: pointer; margin-top: 1rem; text-decoration: none; }
.bottone.secondario { background: var(--bianco); color: var(--blu); border: 1px solid var(--blu); }
.bottone.piccolo { padding: .3rem .7rem; font-size: .95rem; margin-top: 0; }
.avviso { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.avviso.ok { background: #e6f4ea; color: var(--verde); }
.avviso.errore { background: #fdecee; color: var(--rosso); }
.nota { color: var(--grigio); font-size: .95rem; }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid #e3e7ef; vertical-align: top; }
th { color: var(--grigio); font-weight: 600; }
.tabella-scorrevole { overflow-x: auto; }
.segreto { font-family: ui-monospace, Consolas, monospace; font-size: 1.4rem; background: var(--blu-chiaro);
           padding: .5rem .8rem; border-radius: 8px; display: inline-block; letter-spacing: .05em; }
.distintivo { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.distintivo.ok { background: #e6f4ea; color: var(--verde); }
.distintivo.no { background: #fdecee; color: var(--rosso); }
form.in-linea { display: inline; }
.intestazione-partita { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem; }
.risultato { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.risultato input { width: 4.2rem; text-align: center; font-size: 1.4rem; }
select { width: 100%; font-size: 1.05rem; padding: .55rem .6rem; border: 1px solid #b8c0cf; border-radius: 8px; background: #fff; }
.partita.con-errore { border-color: var(--rosso); box-shadow: 0 0 0 2px #fdecee; }
.errore-campo { color: var(--rosso); margin: .4rem 0 0; font-size: .95rem; }
.bottone.largo { width: 100%; padding: .9rem; font-size: 1.15rem; }
tr.evidenziata td { background: var(--blu-chiaro); }
table.griglia td { text-align: center; }
table.griglia td:first-child, table.griglia th:first-child { text-align: left; }
.pt { font-weight: 700; font-size: .9rem; color: var(--grigio); }
td.punti-1 .pt, td.punti-2 .pt, td.punti-3 .pt { color: var(--blu); }
td.punti-4, td.punti-5, td.punti-6 { background: var(--blu-chiaro); }
td.punti-4 .pt, td.punti-5 .pt, td.punti-6 .pt { color: var(--blu); }
tr.totale td { border-top: 2px solid var(--nero); }

/* ---------------- schede pronostici con gli stemmi ---------------- */
.quando-partita { text-align: center; margin-bottom: .4rem; }
.sfida { display: flex; align-items: flex-start; justify-content: center; gap: .4rem; }
.sfida .squadra { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 0; }
.stemma { width: 64px; height: 64px; object-fit: contain; }
.stemma-riserva { display: flex; align-items: center; justify-content: center; border-radius: 50%;
                  background: var(--blu); color: var(--bianco); font-weight: 700; letter-spacing: .03em; }
.nome-squadra { font-weight: 600; text-align: center; line-height: 1.2; overflow-wrap: anywhere; }
.sfida .squadra input[type=number] { width: 4.2rem; text-align: center; font-size: 1.5rem; padding: .45rem .2rem; }
.centro-sfida { display: flex; align-items: center; align-self: stretch; padding-bottom: .4rem; }
.trattino { font-size: 1.6rem; font-weight: 700; color: var(--grigio); }
.partita label { margin-top: 1rem; }

/* ---------------- animazioni ---------------- */
@view-transition { navigation: auto; }

@keyframes comparsa { from { opacity: 0; } to { opacity: 1; } }
@keyframes scomparsa { from { opacity: 1; } to { opacity: 0; } }

/* ripiego per i browser senza transizioni di pagina */
html.senza-vt body { animation: comparsa .22s ease both; }
html.senza-vt.in-uscita body { animation: scomparsa .18s ease both; }

/* busta che si chiude e parte: decorativa, non blocca il salvataggio */
.busta-strato { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
                background: rgba(17, 20, 24, .55); z-index: 50; animation: comparsa .15s ease both;
                pointer-events: none; }
.busta { width: 150px; height: 104px; animation: busta-vola 1.25s cubic-bezier(.4, 0, .5, 1) .45s both; }
.busta .lembo { transform-origin: 50% 0; animation: busta-chiude .45s ease-in both; }
@keyframes busta-chiude { from { transform: rotateX(180deg); } to { transform: rotateX(0deg); } }
@keyframes busta-vola {
  0%   { transform: translateY(0) scale(1); opacity: 1; }
  25%  { transform: translateY(14px) scale(.96); opacity: 1; }
  100% { transform: translateY(-120vh) scale(.7) rotate(-8deg); opacity: 0; }
}

/* interruttore in fondo alla pagina */
footer.piede { text-align: center; padding: 1.2rem 1rem 2rem; }
footer.piede button { background: none; border: 0; color: var(--grigio); font: inherit; font-size: .95rem;
                      text-decoration: underline; cursor: pointer; padding: .4rem; }

/* animazioni disattivate: dall'interruttore o dalle preferenze del telefono */
html.senza-animazioni .busta-strato,
html.senza-animazioni .busta,
html.senza-animazioni .busta .lembo,
html.senza-animazioni body { animation: none !important; }
html.senza-animazioni .busta-strato { display: none; }
@media (prefers-reduced-motion: reduce) {
  .busta-strato { display: none; }
  .busta, .busta .lembo, html.senza-vt body, html.senza-vt.in-uscita body { animation: none !important; }
}

/* ---------------- giornata: strisce scorrevoli ---------------- */
.barra-punti { position: sticky; top: 0; z-index: 20; display: flex; gap: .4rem; justify-content: center;
               background: var(--nero); color: var(--bianco); border-radius: 0 0 10px 10px;
               padding: .5rem .6rem; margin: -1.2rem -1rem 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.barra-punti .punteggio { flex: 1 1 0; text-align: center; border-radius: 8px; padding: .25rem .2rem; min-width: 0; }
.barra-punti .punteggio.mio { background: var(--blu); }
.barra-punti .punteggio.primo .valore { color: #ffd966; }
.barra-punti .nome { display: block; font-size: .8rem; opacity: .85; overflow: hidden; text-overflow: ellipsis;
                     white-space: nowrap; }
.barra-punti .valore { display: block; font-size: 1.35rem; font-weight: 700; line-height: 1.1; }

.striscia-partita { margin-bottom: 1rem; }
.striscia { display: flex; gap: .6rem; overflow-x: auto; scroll-snap-type: x mandatory;
            scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: .2rem; }
.striscia::-webkit-scrollbar { display: none; }
.striscia .pagina { flex: 0 0 100%; scroll-snap-align: center; margin-bottom: 0; }
.etichetta-pagina { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
                    font-weight: 700; color: var(--blu); margin-bottom: .5rem; }
.punti-pagina { font-size: .95rem; color: var(--nero); background: var(--blu-chiaro); border-radius: 999px;
                padding: .1rem .55rem; }
.punteggio-grande { font-size: 1.7rem; font-weight: 700; padding: .2rem .5rem; border-radius: 10px;
                    align-self: flex-start; margin-top: 1rem; white-space: nowrap; }
.punteggio-grande.indovinato { background: var(--blu-chiaro); color: var(--blu); }
.punteggio-grande.parziale { background: #eef2fa; }
.marcatori-squadra { margin-top: .55rem; display: flex; flex-direction: column; gap: .25rem; align-items: center;
                     text-align: center; width: 100%; }
.marcatore { font-size: .98rem; line-height: 1.3; overflow-wrap: anywhere; }
.marcatore .minuto { color: var(--grigio); font-size: .9rem; margin-right: .3rem; }
.marcatore.scelto { font-weight: 600; }
.marcatore.indovinato { background: var(--blu-chiaro); color: var(--blu); font-weight: 700;
                        border-radius: 999px; padding: .1rem .7rem; }
.stato-partita { margin-top: .8rem; text-align: center; color: var(--grigio); font-size: .95rem; }
.niente-pronostico { text-align: center; padding: 1.6rem 0; color: var(--grigio); }
.pallini { display: flex; justify-content: center; gap: .35rem; margin-top: .4rem; }
.pallini i { width: 7px; height: 7px; border-radius: 50%; background: #c4ccda; display: block; }
.pallini i.attivo { background: var(--blu); transform: scale(1.25); }
html:not(.senza-animazioni) .pallini i { transition: background .2s ease, transform .2s ease; }

/* ================= sfondo e riquadri della home ================= */
:root { --viola: #4a2a8f; --viola-scuro: #3b2173; --verde-azione: #0d7a36; --verde-scuro: #0a5d29;
        --arancio: #b35309; --vetro: rgba(255, 255, 255, .93); }

body::before {                      /* l'immagine resta ferma mentre si scorre */
  content: ""; position: fixed; inset: 0; z-index: -2;
  background-image: var(--sfondo); background-size: cover; background-position: center;
}
body::after {                       /* velatura: tiene leggibile il testo su qualsiasi foto */
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(rgba(10, 14, 22, .55), rgba(10, 14, 22, .70));
}
body { background: transparent; }
.scheda, .barra-punti { backdrop-filter: blur(3px); }
.scheda { background: var(--vetro); }
main.contenitore h1 { color: var(--bianco); text-shadow: 0 1px 3px rgba(0, 0, 0, .45); }
footer.piede button { color: #d9dee8; }

.riquadro { background: var(--vetro); border-radius: 14px; padding: 1.3rem 1.1rem 1.5rem;
            margin-bottom: 1.1rem; text-align: center; backdrop-filter: blur(3px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, .28); }
.riquadro h2 { margin: 0 0 .9rem; font-size: 1.3rem; color: var(--nero); }
.riga-forte { font-size: 1.35rem; font-weight: 700; color: var(--blu); margin: .3rem 0; }
.riga-media { font-size: 1.1rem; margin: .3rem 0 .2rem; }
.sotto-conto { color: var(--grigio); margin: .5rem 0 0; }

.conto-grande { display: inline-block; font-size: 1.9rem; font-weight: 700; letter-spacing: .01em;
                color: var(--blu); border: 3px solid var(--blu); border-radius: 12px;
                padding: .45rem 1.1rem; background: #fff; }
.conto-grande.vicino { color: var(--arancio); border-color: var(--arancio); }
.conto-grande.urgente { color: var(--rosso); border-color: var(--rosso); }
html:not(.senza-animazioni) .conto-grande.urgente { animation: pulsa 1.6s ease-in-out infinite; }
@keyframes pulsa { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

.bottone-grande { display: block; width: 100%; margin-top: 1.2rem; padding: .95rem 1rem;
                  border: 0; border-radius: 10px; font-size: 1.1rem; font-weight: 700; letter-spacing: .02em;
                  color: var(--bianco); text-decoration: none; text-align: center; cursor: pointer;
                  box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.bottone-grande.blu { background: var(--blu); }
.bottone-grande.blu:active { background: #09317a; }
.bottone-grande.viola { background: var(--viola); }
.bottone-grande.viola:active { background: var(--viola-scuro); }
.bottone-grande.verde { background: var(--verde-azione); }
.bottone-grande.verde:active { background: var(--verde-scuro); }
html:not(.senza-animazioni) .bottone-grande { transition: background .15s ease, transform .1s ease; }
.bottone-grande:active { transform: translateY(1px); }

.classifica-home { margin-top: .2rem; }
.classifica-home th { font-weight: 600; }
.classifica-home td { font-size: 1.05rem; }
.classifica-home .nome-giocatore { font-weight: 600; width: 100%; }
.classifica-home .punti-classifica { font-weight: 700; color: var(--blu); text-align: right; }
.classifica-home .punti-totali { color: var(--grigio); text-align: right; }
.classifica-home tr.evidenziata td { background: var(--blu-chiaro); }

/* il viola come colore secondario anche nelle altre pagine */
.bottone.secondario { background: var(--bianco); color: var(--viola); border-color: var(--viola); }

/* menu delle giornate passate nella barra in alto */
.menu-giornate { position: relative; }
.menu-giornate > summary { list-style: none; cursor: pointer; padding: .2rem 0; }
.menu-giornate > summary::-webkit-details-marker { display: none; }
.menu-giornate > summary::after { content: " \25BE"; }
.elenco-giornate { position: absolute; right: 0; top: 1.9rem; z-index: 30; background: var(--nero);
                   border: 1px solid #333a45; border-radius: 10px; padding: .4rem; min-width: 10rem;
                   max-height: 60vh; overflow-y: auto; box-shadow: 0 8px 20px rgba(0, 0, 0, .4); }
.elenco-giornate a { display: block; padding: .45rem .6rem; border-radius: 6px; white-space: nowrap; }
.elenco-giornate a:hover { background: var(--blu); text-decoration: none; }

/* ---------------- banner delle statistiche ---------------- */
.banner-statistiche { position: fixed; left: .6rem; right: .6rem; bottom: .6rem; z-index: 60;
                      background: var(--vetro); border: 1px solid #d9dee8; border-radius: 12px;
                      padding: .9rem 1rem; max-width: 44rem; margin: 0 auto;
                      box-shadow: 0 8px 24px rgba(0, 0, 0, .35); backdrop-filter: blur(4px); }
.banner-statistiche p { margin: 0; font-size: .98rem; line-height: 1.45; }
.scelte-statistiche { display: flex; gap: .6rem; margin-top: .8rem; }
.scelte-statistiche .bottone { flex: 1 1 0; margin-top: 0; padding: .55rem .8rem; font-size: 1rem; }
html:not(.senza-animazioni) .banner-statistiche { animation: comparsa .25s ease both; }
