/* Moduli, schede, pulsanti, tastierino del PIN e procedura di configurazione. */

:root {
  --errore: #9a3b1f;
  --errore-sfondo: #f8e6df;
  --ok: #2f7a3a;
}

/* Pulsanti */
.pulsante {
  min-height: var(--tocco-minimo);
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--bordo);
  background: var(--carta);
  color: var(--testo);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pulsante.primario { background: var(--accento); border-color: var(--accento); color: var(--accento-testo); }
.pulsante.grande { min-height: 64px; padding: 14px 32px; font-size: 1.2rem; margin-top: 24px; }
.pulsante.leggero { border-color: transparent; background: transparent; color: var(--tenue); }
.pulsante:disabled { opacity: .45; cursor: default; }
.pulsante:active:not(:disabled) { transform: translateY(1px); }

/* Schede e griglie */
.scheda {
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: var(--raggio);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.scheda h2 { font-size: 1.25rem; margin: 0; }
.colonna { display: flex; flex-direction: column; gap: 20px; }
.griglia-due { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }

/* Campi */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .etichetta { font-weight: 600; font-size: 0.95rem; }
.campo-riga { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.campo-riga > label { font-weight: 500; }
.campo input[type="text"], .campo input[type="date"], .campo input[type="time"], .campo select {
  min-height: var(--tocco-minimo);
  padding: 8px 12px;
  border: 1px solid var(--bordo);
  border-radius: 10px;
  background: #fff;
  color: var(--testo);
  font: inherit;
  width: 100%;
}
.campo { min-width: 0; }
.campo input[type="text"], .campo input[type="date"], .campo input[type="time"], .campo select { height: 48px; }
.campo input[type="date"], .campo input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  min-width: 0;
  text-align: left;
}
.campo input::-webkit-date-and-time-value { text-align: left; }
.campo-riga select { width: auto; min-width: 180px; }
.campo input:focus, .campo select:focus { outline: 3px solid color-mix(in srgb, var(--accento) 40%, transparent); outline-offset: 1px; }
.con-errore input, .con-errore select { border-color: var(--errore); background: var(--errore-sfondo); }
.campo-errore { color: var(--errore); font-size: 0.9rem; font-weight: 600; margin: 0; }
.avviso-errori {
  background: var(--errore-sfondo);
  border: 1px solid var(--errore);
  color: var(--errore);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 600;
  margin: 0 0 16px;
}
.solo-lettori { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Interruttore sì/no */
.interruttore {
  appearance: none;
  -webkit-appearance: none;
  width: 60px;
  height: 36px;
  border-radius: 18px;
  background: var(--bordo);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background .15s;
}
.interruttore::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.interruttore:checked { background: var(--accento); }
.interruttore:checked::after { transform: translateX(24px); }

/* Cursore */
.cursore { display: flex; align-items: center; gap: 12px; }
.cursore input { flex: 1; min-height: var(--tocco-minimo); accent-color: var(--accento); }
.cursore-estremo { color: var(--tenue); font-size: 0.85rem; }

/* Contatore (età) */
.contatore { display: flex; align-items: center; gap: 16px; }
.contatore .pulsante { width: 56px; font-size: 1.4rem; }
.eta-valore { font-size: 1.3rem; font-weight: 700; min-width: 5ch; text-align: center; }

/* Passo 1: genitori */
.riga-pin { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stato-pin { color: var(--tenue); font-weight: 600; }
.stato-pin.fatto { color: var(--ok); }

/* Passo 3: calendario */
.riga-tipo { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: end; }
.riga-tipo > .campo-errore { grid-column: 1 / -1; }
.pulsante-colore { width: var(--tocco-minimo); padding: 0; }
.campione { width: 24px; height: 24px; border-radius: 50%; display: block; }
.riga-eccezione {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "nome nome tipo"
    "dal  al   elimina";
  gap: 12px 16px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--bordo);
}
.riga-eccezione .area-nome { grid-area: nome; }
.riga-eccezione .area-tipo { grid-area: tipo; }
.riga-eccezione .area-dal { grid-area: dal; }
.riga-eccezione .area-al { grid-area: al; }
.riga-eccezione .area-elimina { grid-area: elimina; align-self: end; justify-self: end; }
.riga-campi { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
@media (max-width: 700px) {
  .riga-eccezione {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "nome nome" "tipo tipo" "dal al" "elimina elimina";
  }
}

/* Procedura di configurazione */
.procedura { display: flex; flex-direction: column; gap: 20px; padding-bottom: 8px; }
.intestazione-passo h1 { margin: 4px 0 0; font-size: 2rem; }
.intestazione-passo .descrizione { color: var(--tenue); margin: 6px 0 0; max-width: 70ch; }
.sopratitolo { margin: 0 0 8px; color: var(--tenue); font-weight: 600; font-size: 0.9rem; }
.avanzamento { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; }
.avanzamento li { flex: 1; height: 6px; border-radius: 3px; background: var(--bordo); }
.avanzamento li.fatto { background: color-mix(in srgb, var(--accento) 55%, var(--bordo)); }
.avanzamento li.attuale { background: var(--accento); }
.navigazione-passi {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  background: linear-gradient(to bottom, transparent, var(--sfondo) 25%);
}
.navigazione-passi .nota { margin: 0; text-align: center; font-size: 0.85rem; }
.navigazione-passi .pulsante { min-width: 140px; min-height: 56px; }

/* Schermata "aprite dall'icona" */
.istruzioni-icona { width: 100%; max-width: 900px; margin-top: 24px; text-align: left; }
.istruzioni { margin: 0; padding-left: 1.4em; display: grid; gap: 8px; }

/* Tastierino del PIN */
.pin-sfondo {
  position: fixed;
  inset: 0;
  background: rgba(43, 42, 40, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 16px;
}
.pin-finestra {
  background: var(--carta);
  border-radius: 24px;
  padding: 28px;
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.pin-finestra:focus { outline: none; }
.pin-finestra h2 { margin: 0; font-size: 1.3rem; text-align: center; }
.pin-messaggio { margin: 0; color: var(--tenue); text-align: center; min-height: 1.4em; }
.pin-messaggio.errore { color: var(--errore); font-weight: 600; }
.pin-puntini { display: flex; gap: 14px; margin: 6px 0; }
.pin-puntino { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accento); }
.pin-puntino.pieno { background: var(--accento); }
.pin-tasti { display: grid; grid-template-columns: repeat(3, 84px); gap: 12px; }
.pin-tasto {
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--bordo);
  background: #fff;
  font: inherit;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--testo);
  cursor: pointer;
}
.pin-tasto:active { background: var(--bordo); }
.pin-azioni { display: flex; gap: 12px; width: 100%; justify-content: space-between; margin-top: 6px; }
.pin-azioni .pulsante { flex: 1; }

/* Aree di testo */
.campo textarea {
  padding: 10px 12px;
  border: 1px solid var(--bordo);
  border-radius: 10px;
  background: #fff;
  color: var(--testo);
  font: inherit;
  width: 100%;
  resize: vertical;
  min-height: 72px;
}
.con-errore textarea { border-color: var(--errore); background: var(--errore-sfondo); }
.campo .nota { margin: 0; font-size: 0.88rem; }

/* Contatore numerico */
.contatore-valore { font-size: 1.15rem; font-weight: 700; min-width: 6ch; text-align: center; color: var(--testo); white-space: nowrap; }
.contatore .pulsante { width: 52px; padding: 0; font-size: 1.4rem; }

/* Scelta a pulsanti affiancati */
.segmenti { display: flex; gap: 0; border: 1px solid var(--bordo); border-radius: 12px; overflow: hidden; background: #fff; width: fit-content; max-width: 100%; }
.segmenti.a-capo { flex-wrap: wrap; gap: 8px; border: 0; background: transparent; overflow: visible; }
.segmento {
  min-height: var(--tocco-minimo);
  padding: 8px 16px;
  border: 0;
  border-right: 1px solid var(--bordo);
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--testo);
  cursor: pointer;
}
.segmento:last-child { border-right: 0; }
.segmento.attivo { background: var(--accento); color: var(--accento-testo); }
.segmenti.a-capo .segmento { border: 1px solid var(--bordo); border-radius: 10px; background: #fff; }
.segmenti.a-capo .segmento.attivo { background: var(--accento); color: var(--accento-testo); border-color: var(--accento); }

/* Elenco dei comportamenti (passo 4) */
.elenco-ca { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.scheda-ca {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--bordo);
  border-radius: var(--raggio);
  background: var(--carta);
  font: inherit;
  color: var(--testo);
  cursor: pointer;
}
.scheda-ca.incompleta { border-style: dashed; }
.scheda-ca.con-errore { border-color: var(--errore); background: var(--errore-sfondo); }
.scheda-ca-testo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.scheda-ca-testo .nota { margin: 0; font-size: 0.85rem; }
.etichette { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; color: var(--tenue); }
.etichette > span { background: var(--sfondo); border-radius: 999px; padding: 2px 10px; }
.etichetta-tipo.scelta { background: #e7e0f3 !important; color: #5b4690; }
.etichetta-tipo.catalogo { background: #eef0f2 !important; }
.etichetta-tipo.fisso { background: #dfeee9 !important; color: var(--accento); }
.icona-vuota { width: 56px; height: 56px; border-radius: 12px; border: 2px dashed var(--bordo); }
.freccia { font-size: 1.6rem; color: var(--tenue); }
.scheda.vuoto { color: var(--tenue); text-align: center; padding: 32px; }
.riga-pulsanti { display: flex; flex-wrap: wrap; gap: 12px; }

/* Scelta dell'icona */
.griglia-icone { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.scelta-icona {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
}
.scelta-icona img { width: 100%; height: auto; max-width: 52px; }
.scelta-icona.attiva { border-color: var(--accento); background: #dfeee9; }

/* Giorni del comportamento */
.riga-giorno {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto auto;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--bordo);
}
.riga-giorno.spenta .nome-tipo { color: var(--tenue); }
.riga-giorno .campo { gap: 2px; }
.riga-giorno .campo-riga { gap: 10px; }
.riga-giorno .etichetta { font-size: 0.8rem; }
.nome-tipo { display: flex; align-items: center; gap: 10px; font-weight: 600; }
@media (max-width: 900px) {
  .riga-giorno { grid-template-columns: 1fr 1fr; }
  .riga-giorno .nome-tipo { grid-column: 1 / -1; }
}

/* Passo 5 */
.riga-scelta { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bordo); }
.riga-scelta .campo .etichetta { font-size: 1rem; }
.esito { margin: 0; font-weight: 600; }
.esito.ok { color: var(--ok); }
.esito.ko { color: var(--errore); }
.esito.avviso { color: #8a5a00; }

/* Scheda a tutto schermo */
body.bloccato { overflow: hidden; }
.scheda-sfondo {
  position: fixed;
  inset: 0;
  background: rgba(43, 42, 40, .45);
  z-index: 9;
  display: flex;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.scheda-finestra {
  background: var(--sfondo);
  border-radius: 24px;
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.scheda-finestra:focus, .conferma-finestra:focus { outline: none; }
.scheda-testata { padding: 18px 24px 10px; }
.scheda-testata h2 { margin: 0; font-size: 1.5rem; }
.scheda-corpo { flex: 1; overflow-y: auto; padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 20px; -webkit-overflow-scrolling: touch; }
.scheda-azioni {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--bordo);
  background: var(--carta);
}
.azioni-destra { display: flex; gap: 12px; }
.scheda-azioni .pulsante { min-height: 52px; min-width: 120px; }
.pulsante.pericolo { color: var(--errore); }

/* Richiesta di conferma */
.conferma-finestra {
  background: var(--carta);
  border-radius: 24px;
  padding: 28px;
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.conferma-finestra h2 { margin: 0; font-size: 1.35rem; }
.conferma-finestra p { margin: 0; color: var(--tenue); }
.conferma-azioni { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.conferma-azioni .pulsante { min-height: 52px; }

/* Note di spiegazione dentro le schede: stesso aspetto ovunque */
.scheda .nota { margin: 0; font-size: 0.9rem; color: var(--tenue); }
.scheda.vuoto { font-size: 1rem; }

/* Passi 6–10 */
.riassunto { margin: 0; font-weight: 700; color: var(--accento); }
.riga-categoria {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto auto;
  gap: 16px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bordo);
}
.riga-categoria > .campo-errore { grid-column: 1 / -1; }
.riga-categoria > .pulsante { align-self: end; }
@media (max-width: 900px) {
  .riga-categoria { grid-template-columns: 1fr 1fr; }
  .riga-categoria > :first-child { grid-column: 1 / -1; }
}
.riga-premio { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; }
.riga-premio.fissa, .riga-premio:not(:has(.numero-livello)) { grid-template-columns: 1fr; }
.scheda-ca.fissa { cursor: default; grid-template-columns: 56px 1fr; background: var(--sfondo); }
.numero-livello { font-weight: 700; color: var(--accento); white-space: nowrap; }
.frecce { display: flex; gap: 6px; }
.frecce .pulsante { width: var(--tocco-minimo); padding: 0; font-size: 1.2rem; }
.premio-in-linea { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; }
.colonna-stretta { display: flex; flex-direction: column; gap: 14px; }
.elenco-alert { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.scheda-alert h2 { display: flex; align-items: center; gap: 10px; }
.codice-alert { font-size: 0.8rem; background: var(--sfondo); border-radius: 999px; padding: 2px 10px; color: var(--tenue); }
.riassunto-alert { margin: 0; font-weight: 700; }

/* Passo 11: riepilogo */
.elenco-riepilogo.errori { border-color: var(--errore); background: var(--errore-sfondo); }
.elenco-riepilogo.avvisi { border-color: #d9b45a; background: #fbf3df; }
.voce-riepilogo { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 0; border-top: 1px solid rgba(0, 0, 0, .06); }
.voce-riepilogo:first-of-type { border-top: 0; }
.voce-riepilogo p { margin: 0; }
.voce-riepilogo .pulsante { flex: none; }
.griglia-riepilogo { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.testata-riepilogo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.righe-riepilogo { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; color: var(--testo); }
.riga-avvio { display: flex; justify-content: center; }
.riga-avvio .pulsante.grande { margin-top: 4px; min-width: 320px; }

/* Tastierino del PIN dentro una schermata */
.pin-tastierino { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }

/* Passo 12: area della bambina chiusa e accesso dei genitori */
.area-chiusa { position: relative; }
.logo.grande { width: 200px; height: 200px; border-radius: 44px; }
.accesso-discreto {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.accesso-anello {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px solid var(--bordo);
}
.accesso-discreto.premuto .accesso-anello {
  border-color: var(--accento);
  animation: riempi var(--durata, 1500ms) linear forwards;
}
@keyframes riempi {
  from { box-shadow: inset 0 0 0 0 color-mix(in srgb, var(--accento) 35%, transparent); }
  to { box-shadow: inset 0 0 0 14px color-mix(in srgb, var(--accento) 35%, transparent); }
}
.accesso, .area-genitori { display: flex; flex-direction: column; gap: 20px; }
.testata-accesso, .testata-genitori { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.testata-accesso h1, .testata-genitori h1 { margin: 0; font-size: 2rem; }
.corpo-accesso { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.scheda-pin { width: min(440px, 100%); align-items: center; }
.titolo-pin { text-align: center; }
.elenco-oggi { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.nota.sicurezza { text-align: center; }

/* Passo 13: Oggi e registrazione */
.portafoglio { margin: 0; font-size: 1.6rem; font-weight: 700; color: #b8860b; letter-spacing: 2px; }
.testata-elenco { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.testata-elenco h2 { margin: 0; }
.elenco-oggi li { list-style: none; }
li.riga-oggi {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 8px 4px 0;
  border: 1px solid var(--bordo);
  border-radius: 14px;
  background: var(--carta);
}
.riga-oggi-apri {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 8px 4px 8px 12px;
  min-height: 64px;
  border: 0;
  border-radius: 12px;
  background: none;
  font: inherit;
  color: var(--testo);
  text-align: left;
  cursor: pointer;
}
.riga-oggi-testo { display: flex; flex-direction: column; min-width: 0; }

/* La stellina accanto a ogni comportamento (RF-G03): grande, per il dito della bambina */
.stella { display: block; width: 100%; height: 100%; overflow: visible; }
.stella polygon { fill: var(--stella); stroke: #d99a1a; stroke-width: 7; stroke-linejoin: round; }
.stella.vuota polygon { fill: #fffaf0; stroke: #e0b44e; stroke-width: 6; }
.stella.automatica { opacity: .5; }
.stella.spenta polygon { fill: none; stroke: var(--bordo); stroke-dasharray: 9 7; }
.stella-registra, .stella-riga {
  width: 72px;
  height: 72px;
  padding: 8px;
  flex: none;
}
.stella-registra {
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  -webkit-touch-callout: none;
}
.stella-registra:active .stella { transform: scale(.88); }
.stella-registra .stella { transition: transform 120ms ease-out; }
.per-domani { margin: 0; font-weight: 600; color: #8a6a1a; }
.distintivo-stato { font-size: 0.85rem; font-weight: 600; border-radius: 999px; padding: 4px 12px; background: var(--sfondo); color: var(--tenue); white-space: nowrap; }
.stato-eseguito .distintivo-stato { background: #dfeee9; color: var(--ok); }
.stato-rifiutata .distintivo-stato { background: #fbf3df; color: #8a5a00; }
.stato-non-eseguito .distintivo-stato { background: #eef0f2; color: var(--tenue); }
.stato-automatico .distintivo-stato { background: #e7e0f3; color: #5b4690; }
.stato-da-fare { border-color: #e0b44e; }
.testata-registrazione { display: flex; gap: 16px; align-items: flex-start; }
.scelta-grande { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pulsante.grande-scelta { min-height: 72px; font-size: 1.25rem; }
.pulsante.grande-scelta.attivo { background: var(--accento); border-color: var(--accento); color: var(--accento-testo); }
.suggerimenti { display: flex; flex-direction: column; gap: 6px; }
.proposta-definizione { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 12px; background: #fbf3df; }
/* Festa della stellina (RF-G04): sopra ogni altra finestra */
.festa {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 249, 228, .97), rgba(246, 241, 231, .94) 70%);
  animation: festa-entra 180ms ease-out both;
  transition: opacity 300ms ease-in;
  cursor: pointer;
}
.festa.esce { opacity: 0; }
.festa-stelline { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 100%; }
.festa-stella {
  position: relative;
  width: clamp(120px, 30vmin, 260px);
  aspect-ratio: 1;
  animation: stella-entra 720ms cubic-bezier(.2, 1.5, .4, 1) var(--ritardo) both;
}
.festa-stella > .stella:not(.scintilla) {
  filter: drop-shadow(0 8px 14px rgba(184, 134, 11, .35));
  animation: stella-brilla 900ms ease-in-out calc(var(--ritardo) + 720ms) infinite alternate;
}
.festa-stella > .scintilla {
  position: absolute;
  left: 36%;
  top: 36%;
  width: 28%;
  height: 28%;
  opacity: 0;
  animation: scintilla 1000ms ease-out calc(var(--ritardo) + 180ms) both;
}
.stella.scintilla polygon { fill: #ffd95a; stroke: #f0b429; stroke-width: 5; }
.festa-etichetta { margin: 0; font-size: 1.3rem; font-weight: 600; color: #8a6a1a; }
@keyframes festa-entra { from { opacity: 0; } to { opacity: 1; } }
@keyframes stella-entra {
  0% { opacity: 0; transform: scale(0) rotate(-140deg); }
  60% { opacity: 1; transform: scale(1.18) rotate(12deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes stella-brilla { from { transform: scale(1); } to { transform: scale(1.06); } }
@keyframes scintilla {
  0% { opacity: 0; transform: rotate(var(--angolo)) translateY(0) scale(.4); }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--angolo)) translateY(-290%) scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  .festa-stella { animation: festa-entra 300ms ease-out var(--ritardo) both; }
  .festa-stella > .stella:not(.scintilla) { animation: none; }
  .festa-stella > .scintilla { display: none; }
}
