/* Cartelle sul telefono del giocatore */

.pagina-cartelle { max-width: 560px; margin: 0 auto; padding: 0 16px 40px; padding-top: env(safe-area-inset-top); }
.pagina-cartelle .barra { gap: 8px; }
.pagina-cartelle a.ico { color: inherit; }

.scelta, .mie { display: grid; gap: 16px; }
.scelta[hidden], .mie[hidden] { display: none; }
.scelta h1, .titolo-mie {
  font-family: var(--font-display);
  font-weight: 850; font-stretch: 105%;
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  line-height: 1.05;
  margin: 12px 0 0;
}
[data-tema="estate"] .scelta h1, [data-tema="estate"] .titolo-mie { font-weight: 400; color: #1F3FA6; }
.scelta p, .istruzioni { margin: 0; color: var(--testo-tenue); }
.numeri-cartelle { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.numeri-cartelle button {
  height: 84px;
  border: 0;
  border-radius: 50%;
  aspect-ratio: 1;
  justify-self: center;
  font-family: var(--font-display);
  font-weight: 850; font-stretch: 75%;
  font-size: 2.4rem;
  color: #C62828;
  background: repeating-radial-gradient(circle at 42% 38%, #F4DDB4 0 4px, #E8C792 4px 6px, #F6E2BE 6px 10px);
  box-shadow: inset 0 0 0 6px #F4DDB4, inset 0 0 0 10px #C62828, 0 7px 0 -1px #C2925A, 0 12px 18px rgba(0,0,0,.25);
}
.numeri-cartelle button:active { transform: translateY(3px); }
[data-tema="estate"] .numeri-cartelle button { border-radius: 12px; font-weight: 400; color: #FFFFFF; background: #1F3FA6; box-shadow: 0 5px 0 #142B78; }
.nota { font-size: .95rem; }

/* Una cartella: 3 righe x 9 colonne */
.elenco-cartelle { display: grid; gap: 18px; }
.cartella {
  background: var(--carta);
  color: var(--inchiostro);
  border-radius: 14px;
  padding: 10px 10px 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
[data-tema="estate"] .cartella { box-shadow: 0 0 0 1px #D3DBF1, 0 10px 24px rgba(20,43,120,.12); }
.cartella-testa { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 8px; }
.cartella-testa h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.stato {
  font-size: .8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  background: #C62828; color: #FFF6E6;
}
.stato:empty { display: none; }
[data-tema="estate"] .stato { background: #F2B705; color: #142B78; }
.griglia {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 1px;
  background: var(--linea);
  border: 2px solid var(--bordo-blocco);
  border-radius: 6px;
  overflow: hidden;
}
.casella {
  height: 46px;
  display: grid; place-items: center;
  background: var(--cella);
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--numero);
  font-family: var(--font-display);
  font-weight: 700; font-stretch: 80%;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}
[data-tema="estate"] .casella { font-family: var(--font-testo); font-weight: 600; }
.casella.vuota {
  background-color: #F1E3C6;
  background-image: repeating-linear-gradient(45deg, rgba(198,40,40,.08) 0 2px, transparent 2px 7px);
}
[data-tema="estate"] .casella.vuota { background-color: #EEF2FC; background-image: repeating-linear-gradient(45deg, rgba(31,63,166,.08) 0 2px, transparent 2px 7px); }
.casella b {
  display: grid; place-items: center;
  width: min(36px, 92%); aspect-ratio: 1;
  border-radius: 50%;
  font-weight: inherit;
}
.casella i { display: block; font-style: normal; line-height: 1; text-box: trim-both cap alphabetic; }
.casella.segnato b { background: #C62828; color: #FFF6E6; box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); animation: punto .35s cubic-bezier(.3,1.6,.5,1); }
[data-tema="estate"] .casella.segnato { background: #1F3FA6; color: #FFFFFF; }
[data-tema="estate"] .casella.segnato b { background: none; box-shadow: none; animation: none; }
@supports not (text-box: trim-both cap alphabetic) { .casella i { padding-top: .1em; } }

.azioni-cartelle { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.azioni-cartelle .btn-foglio { color: var(--testo); border-color: currentColor; }
.azioni-cartelle .btn-foglio[data-conferma="1"] { background: var(--testo); color: var(--sfondo); }

/* Avviso grande quando si fa un premio */
.festa {
  position: fixed; inset: 0;
  display: grid; place-content: center; justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: rgba(20,12,8,.72);
  z-index: 30;
  animation: compari .25s ease-out;
}
.festa[hidden] { display: none; }
.festa-premio {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900; font-stretch: 115%;
  font-size: clamp(3.4rem, 18vw, 6rem);
  line-height: 1;
  color: #FFF6E6;
  text-shadow: 0 6px 0 #C62828;
  animation: salta .6s cubic-bezier(.3,1.6,.5,1);
}
[data-tema="estate"] .festa-premio { font-weight: 400; text-shadow: 0 6px 0 #1F3FA6; }
.festa-dove { margin: 0 0 12px; color: #FFF6E6; font-size: 1.1rem; }
.festa button { min-width: 140px; min-height: 52px; border: 0; border-radius: 14px; background: #FFF6E6; color: #2A1A12; font-weight: 700; font-size: 1.1rem; }
@keyframes compari { from { opacity: 0; } to { opacity: 1; } }
@keyframes salta { 0% { transform: scale(.4) rotate(-8deg); } 100% { transform: none; } }

@media (min-width: 900px) {
  .pagina-cartelle { max-width: 1100px; }
  .elenco-cartelle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pagina-cartelle ~ .piede { background: transparent; color: var(--testo); padding-top: 24px; }

/* Tema Halloween */
[data-tema="halloween"] .scelta h1, [data-tema="halloween"] .titolo-mie { font-weight: 900; }
[data-tema="halloween"] .numeri-cartelle button {
  height: 78px; aspect-ratio: 1.12;
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  font-weight: 900; font-stretch: 100%;
  color: #2A1745;
  background: radial-gradient(ellipse 60% 45% at 42% 32%, rgba(255,214,140,.5), transparent 70%), #FF7A1A;
  box-shadow: inset 10px 0 10px -6px rgba(168,66,10,.4), inset -10px 0 10px -6px rgba(168,66,10,.4), 0 10px 16px rgba(10,0,25,.4);
}
[data-tema="halloween"] .cartella { box-shadow: 0 10px 24px rgba(10,0,25,.45); }
[data-tema="halloween"] .stato { background: #FF7A1A; color: #2A1745; }
[data-tema="halloween"] .casella { font-weight: 800; font-stretch: 100%; }
[data-tema="halloween"] .casella.vuota { background-color: #EFE5FB; background-image: repeating-linear-gradient(45deg, rgba(91,46,145,.08) 0 2px, transparent 2px 7px); }
[data-tema="halloween"] .casella.segnato b {
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: #FF7A1A; color: #2A1745;
  box-shadow: inset 5px 0 5px -3px rgba(168,66,10,.45), inset -5px 0 5px -3px rgba(168,66,10,.45);
}
[data-tema="halloween"] .festa { background: rgba(20,8,40,.82); }
[data-tema="halloween"] .festa-premio { font-weight: 900; text-shadow: 0 6px 0 #FF7A1A; }
