/* Tombola online: temi Classica ed Estate */

:root,
[data-tema="classica"] {
  --sfondo: #1E7A4E;
  --trama: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 2px, transparent 2px 5px), repeating-linear-gradient(-45deg, rgba(0,0,0,.06) 0 2px, transparent 2px 5px);
  --testo: #FFF6E6;
  --testo-tenue: rgba(255,246,230,.88);
  --accento: #C62828;
  --accento-ombra: #8E1B16;
  --su-accento: #FFF6E6;
  --carta: #FBF1DC;
  --cella: #FFFCF4;
  --linea: #E9D3AE;
  --bordo-blocco: #C62828;
  --numero: #9E1F1A;
  --inchiostro: #2A1A12;
  --tenue-chip: rgba(0,0,0,.18);
  --prossimo-sfondo: #FFF6E6;
  --prossimo-testo: #9E1F1A;
  --font-display: "Anybody", "Arial Narrow", system-ui, sans-serif;
  --font-testo: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --raggio: 16px;
  color-scheme: dark;
}

[data-tema="estate"] {
  --sfondo: #FFFFFF;
  --trama: linear-gradient(#E3E8F6 1px, transparent 1px), linear-gradient(90deg, #E3E8F6 1px, transparent 1px);
  --testo: #142B78;
  --testo-tenue: #3B4A7A;
  --accento: #1F3FA6;
  --accento-ombra: #142B78;
  --su-accento: #FFFFFF;
  --carta: #FFFFFF;
  --cella: #FFFFFF;
  --linea: #D3DBF1;
  --bordo-blocco: #1F3FA6;
  --numero: #1F3FA6;
  --inchiostro: #142B78;
  --tenue-chip: #23704A;
  --prossimo-sfondo: #F2B705;
  --prossimo-testo: #142B78;
  --font-display: "Bagel Fat One", system-ui, sans-serif;
  --font-testo: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --raggio: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: var(--sfondo); -webkit-text-size-adjust: 100%; }
body {
  background-color: var(--sfondo);
  background-image: var(--trama);
  color: var(--testo);
  font-family: var(--font-testo);
  font-size: 1.0625rem;
  line-height: 1.5;
  min-height: 100vh;
}
[data-tema="estate"] body { background-size: 65px 65px, 65px 65px; }

button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--prossimo-sfondo); outline-offset: 3px; }
[data-tema="estate"] :focus-visible { outline-color: #F2B705; }

.salta { position: absolute; left: -999px; }
.salta:focus { left: 16px; top: 16px; z-index: 10; background: var(--carta); color: var(--inchiostro); padding: 8px 12px; border-radius: 8px; }

/* ---------- Area di gioco ---------- */

.gioco {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 24px;
  padding-top: env(safe-area-inset-top);
  display: grid;
  gap: 16px;
  grid-template-areas: "barra" "palco" "tabellone";
}

.barra { grid-area: barra; display: flex; align-items: center; gap: 8px; height: 60px; }
.marchio {
  flex-grow: 1;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1.2rem;
  letter-spacing: -.01em;
}
[data-tema="estate"] .marchio { font-weight: 400; color: #1F3FA6; }
.conta { font-weight: 600; font-size: .9rem; margin-right: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ico {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,246,230,.16);
  display: grid; place-items: center;
  flex-shrink: 0;
}
a.ico { color: inherit; }
[data-tema="estate"] .ico { border-radius: 12px; background: #FFFFFF; border: 2px solid #C9D3EE; color: #1F3FA6; }
.ico[aria-pressed="false"] .onde { display: none; }
.ico[aria-pressed="true"] .muto { display: none; }

.palco { grid-area: palco; display: grid; gap: 16px; }

.estratto { display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 318px; }

/* Il pezzo estratto: bussolotto (Classica) o piastrella (Estate) */
.pezzo {
  position: relative;
  width: 172px; height: 172px;
  display: grid; place-items: center;
  margin: 8px 0 34px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 42% 38%, #F4DDB4 0 5px, #E8C792 5px 8px, #F6E2BE 8px 14px);
  box-shadow: inset 0 -10px 18px rgba(120,70,20,.22), inset 0 8px 12px rgba(255,250,235,.6), 0 15px 0 -1px #C2925A, 0 24px 30px rgba(0,0,0,.35);
}
.pezzo::before {
  content: "";
  position: absolute; inset: 11px;
  border-radius: 50%;
  border: 7px solid #C62828;
  box-shadow: inset 0 1px 2px rgba(80,10,10,.35);
}
.pezzo span {
  position: relative;
  text-box: trim-both cap alphabetic;
  font-family: var(--font-display);
  font-weight: 850;
  font-stretch: 70%;
  font-size: 92px;
  line-height: 1;
  letter-spacing: -.02em;
  color: #C62828;
  font-variant-numeric: tabular-nums;
}
.pezzo.vuoto span { font-size: 64px; opacity: .45; }

[data-tema="estate"] .pezzo {
  width: 184px; height: 184px;
  border-radius: 10px;
  margin: 8px 0 30px;
  background-color: #FFFFFF;
  background-image:
    radial-gradient(circle at 0 0, #F2B705 0 30px, #2E8B57 30px 37px, transparent 37.5px),
    radial-gradient(circle at 100% 0, #F2B705 0 30px, #2E8B57 30px 37px, transparent 37.5px),
    radial-gradient(circle at 0 100%, #F2B705 0 30px, #2E8B57 30px 37px, transparent 37.5px),
    radial-gradient(circle at 100% 100%, #F2B705 0 30px, #2E8B57 30px 37px, transparent 37.5px);
  box-shadow: inset 0 0 0 7px #1F3FA6, inset 0 0 0 10px #FFFFFF, inset 0 0 0 12px #1F3FA6, 0 3px 0 #C9D3EE, 0 18px 36px rgba(20,43,120,.22);
}
[data-tema="estate"] .pezzo::before { display: none; }
[data-tema="estate"] .pezzo span { font-weight: 400; font-stretch: 100%; font-size: 100px; color: #1F3FA6; letter-spacing: 0; }

.cade { animation: cade .75s cubic-bezier(.2,.8,.3,1.1); }
@keyframes cade {
  0% { transform: translateY(-70px) rotate(-140deg) scale(.6); opacity: 0; }
  55% { transform: translateY(8px) rotate(10deg) scale(1.03); opacity: 1; }
  78% { transform: translateY(-4px) rotate(-4deg); }
  100% { transform: none; }
}
.estratto { perspective: 700px; }
.mescola { animation: scuoti .16s linear infinite; }
.mescola span { opacity: .55; }
@keyframes scuoti {
  0%, 100% { transform: rotate(0) translateX(0); }
  25% { transform: rotate(-7deg) translateX(-4px); }
  75% { transform: rotate(7deg) translateX(4px); }
}
.smorfia.in-attesa { visibility: hidden; }
[data-tema="estate"] .cade { animation: gira .7s cubic-bezier(.3,.7,.3,1); }
@keyframes gira {
  0% { transform: rotateY(-180deg) scale(.85); opacity: .2; }
  60% { transform: rotateY(12deg) scale(1.02); opacity: 1; }
  100% { transform: none; }
}

.smorfia { margin: 0; display: grid; gap: 2px; min-height: 3.4em; }
.smorfia[hidden] { display: none; }
.sm-d { font-family: var(--font-display); font-style: italic; font-weight: 600; font-stretch: 100%; font-size: 1.6rem; line-height: 1.1; }
[data-tema="estate"] .sm-d { font-family: var(--font-testo); font-weight: 600; }
.sm-i { font-size: .95rem; color: var(--testo-tenue); }
.suggerimento { margin: 0; font-size: .95rem; color: var(--testo-tenue); max-width: 30ch; }

.precedenti { list-style: none; margin: 12px 0 0; padding: 0; display: flex; gap: 8px; min-height: 40px; }
.precedenti li {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 80%;
  font-size: 1rem;
  color: #C62828;
  background: #F4DDB4;
  box-shadow: inset 0 0 0 3px #F4DDB4, inset 0 0 0 5px #C62828, 0 4px 0 -1px #C2925A;
}
[data-tema="estate"] .precedenti li { border-radius: 7px; background: #1F3FA6; color: #FFFFFF; font-weight: 400; box-shadow: none; }
.precedenti li:nth-child(2) { opacity: .85; }
.precedenti li:nth-child(3) { opacity: .7; }
.precedenti li:nth-child(4) { opacity: .55; }

.comandi { display: flex; gap: 10px; }
.estrai {
  flex-grow: 1;
  height: 60px;
  border: 0;
  border-radius: var(--raggio);
  background: var(--accento);
  color: var(--su-accento);
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 115%;
  font-size: 1.45rem;
  box-shadow: 0 5px 0 var(--accento-ombra);
  touch-action: manipulation;
}
[data-tema="estate"] .estrai { font-weight: 400; font-size: 1.5rem; }
.estrai:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--accento-ombra); }
.estrai:disabled { opacity: .55; }
.auto {
  width: 128px; height: 60px;
  border-radius: var(--raggio);
  border: 2px solid rgba(255,246,230,.55);
  background: transparent;
  font-weight: 700;
  font-size: 1rem;
}
.auto[aria-pressed="true"] { background: var(--testo); color: var(--sfondo); border-color: var(--testo); }
[data-tema="estate"] .auto { border-color: #1F3FA6; color: #1F3FA6; background: #FFFFFF; }
[data-tema="estate"] .auto[aria-pressed="true"] { background: #F2B705; border-color: #F2B705; color: #142B78; }

.annulla {
  justify-self: center;
  border: 0; background: none;
  padding: 10px 12px;
  font-size: .95rem; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  color: var(--testo-tenue);
  margin: -8px 0 -6px;
}
.annulla:disabled { visibility: hidden; }
.azioni-piccole { display: flex; justify-content: center; gap: 4px 18px; flex-wrap: wrap; margin: -8px 0 -6px; }
.azioni-piccole .annulla { margin: 0; justify-self: auto; }
.verifica-griglia { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; }
.verifica-griglia button {
  aspect-ratio: 1; min-height: 30px;
  border: 1px solid #E2D5BC; border-radius: 6px;
  background: #FFFFFF; color: #2A1A12;
  font-weight: 700; font-size: .85rem; padding: 0;
  font-variant-numeric: tabular-nums;
}
.verifica-griglia button[aria-pressed="true"].si { background: #1E7A4E; border-color: #1E7A4E; color: #FFFFFF; }
.verifica-griglia button[aria-pressed="true"].no { background: #FFFFFF; border: 2px solid #C62828; color: #C62828; text-decoration: line-through; }
.verifica-esito { margin: 0; font-weight: 700; font-size: 1.05rem; min-height: 1.5em; }
.verifica-esito.valida { color: #1E7A4E; }
.verifica-esito.non-valida { color: #C62828; }

.premi { display: grid; grid-template-columns: repeat(var(--n-premi, 5), minmax(0, 1fr)); gap: 5px; }
.premio {
  min-height: 40px;
  border-radius: 20px;
  display: grid; place-items: center; align-content: center;
  padding: 2px 2px;
  font-size: .78rem; font-weight: 700; line-height: 1.1;
  border: 1.5px dashed rgba(255,246,230,.5);
  background: transparent;
  text-align: center;
}
.premio small { display: block; font-size: .68rem; font-weight: 600; opacity: .9; }
.premio.fatto { border: 0; background: var(--tenue-chip); }
.premio.fatto b { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.premio.prossimo { border: 0; background: var(--prossimo-sfondo); color: var(--prossimo-testo); }
.premio.prossimo:disabled { opacity: .6; }
[data-tema="estate"] .premio { border-radius: 8px; border-color: #AEBBE3; background: #FFFFFF; color: #3B4A7A; }
[data-tema="estate"] .premio.fatto { background: #23704A; color: #FFFFFF; }
[data-tema="estate"] .premio.prossimo { background: #F2B705; color: #142B78; }
.invita {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  border-radius: var(--raggio);
  border: 2px solid rgba(255,246,230,.4);
  background: rgba(0,0,0,.1);
  text-align: left;
}
.invita span { display: grid; font-weight: 700; }
.invita small { font-weight: 400; font-size: .85rem; color: var(--testo-tenue); }
[data-tema="estate"] .invita { border-color: #C9D3EE; background: #FFFFFF; color: #142B78; }
.qr-spiega { margin: 0; }
.qr { justify-self: center; width: min(260px, 70vw); aspect-ratio: 1; background: #FFFFFF; border-radius: 12px; padding: 10px; }
.qr svg { display: block; width: 100%; height: 100%; }
.qr-link { margin: -6px 0 0; text-align: center; font-weight: 600; word-break: break-all; }
.nota-premi { margin: -6px 0 0; text-align: center; font-size: .85rem; color: var(--testo-tenue); }

/* ---------- Tabellone ---------- */

.tabellone {
  grid-area: tabellone;
  align-self: start;
  background: var(--carta);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  box-shadow: 0 14px 30px rgba(0,0,0,.3);
  --h-cella: 30px;
  --f-cella: 15px;
}
[data-tema="estate"] .tabellone { box-shadow: 0 0 0 1px #D3DBF1, 0 10px 24px rgba(20,43,120,.12); }
.blocco {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--linea);
  border: 2px solid var(--bordo-blocco);
  border-radius: 6px;
  overflow: hidden;
}
[data-tema="estate"] .blocco { gap: 2px; padding: 3px; background: #EEF2FC; border-radius: 8px; }
.cella {
  position: relative;
  height: var(--h-cella);
  display: grid; place-items: center;
  background: var(--cella);
  color: var(--numero);
  font-family: var(--font-display);
  font-weight: 700; font-stretch: 80%;
  font-size: var(--f-cella);
  font-variant-numeric: tabular-nums;
}
[data-tema="estate"] .cella { font-family: var(--font-testo); font-weight: 600; border-radius: 4px; border: 1px solid #D3DBF1; }
.cella b { font-weight: inherit; display: grid; place-items: center; width: calc(var(--h-cella) - 5px); height: calc(var(--h-cella) - 5px); border-radius: 50%; }
.cella i { display: block; font-style: normal; line-height: 1; text-box: trim-both cap alphabetic; }
.cella.uscito b { background: #C62828; color: #FFF6E6; box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.cella.ultimo b { animation: punto .5s cubic-bezier(.3,1.6,.5,1); }
.cella.ultimo::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--h-cella) - 5px); height: calc(var(--h-cella) - 5px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid #C62828;
  animation: anello 1.6s ease-out infinite;
}
@keyframes punto { 0% { transform: scale(0); } 100% { transform: none; } }
@keyframes anello { 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; } }

[data-tema="estate"] .cella b { width: auto; height: auto; border-radius: 0; }
[data-tema="estate"] .cella.uscito { background: #1F3FA6; border-color: #1F3FA6; color: #FFFFFF; }
[data-tema="estate"] .cella.uscito b { background: none; color: inherit; box-shadow: none; }
[data-tema="estate"] .cella.ultimo { background: #F2B705; border-color: #F2B705; color: #142B78; animation: piastrella .6s ease-out; }
[data-tema="estate"] .cella.ultimo b { animation: none; }
[data-tema="estate"] .cella.ultimo::after { display: none; }
@keyframes piastrella { 0% { transform: rotateY(180deg); } 100% { transform: none; } }

/* ---------- Schermo grande (PC, TV) ---------- */

@media (min-width: 900px) {
  .gioco {
    max-width: 1400px;
    padding: 0 32px 32px;
    grid-template-columns: minmax(340px, 400px) 1fr;
    grid-template-areas: "barra barra" "palco tabellone";
    column-gap: 40px;
    min-height: 100svh;
    align-content: start;
  }
  .tabellone {
    padding: 16px;
    gap: 14px;
    --h-cella: clamp(34px, 6.4vh, 72px);
    --f-cella: clamp(17px, 3vh, 34px);
  }
  .estratto { min-height: 0; padding-top: 2vh; }
  .pezzo { width: clamp(200px, 30vh, 300px); height: clamp(200px, 30vh, 300px); margin-bottom: 40px; }
  .pezzo::before { inset: 7%; border-width: 10px; }
  .pezzo span { font-size: clamp(108px, 16vh, 168px); }
  [data-tema="estate"] .pezzo { width: clamp(210px, 31vh, 310px); height: clamp(210px, 31vh, 310px); }
  [data-tema="estate"] .pezzo span { font-size: clamp(116px, 17vh, 176px); }
  .sm-d { font-size: 2rem; }
  .sm-i { font-size: 1.1rem; }
  .precedenti li { width: 46px; height: 46px; font-size: 1.2rem; }
  .estrai, .auto { height: 68px; }
  .premio { font-size: .9rem; min-height: 46px; }
}

/* ---------- Impostazioni ---------- */

.foglio {
  border: 0;
  padding: 0;
  width: min(480px, 100%);
  max-width: 100%;
  margin: auto auto 0;
  border-radius: 20px 20px 0 0;
  background: #FFFCF4;
  color: #2A1A12;
  font-family: var(--font-testo);
  color-scheme: light;
}
[data-tema="estate"] .foglio { background: #FFFFFF; color: #142B78; }
@media (min-width: 600px) { .foglio { margin: auto; border-radius: 20px; } }
.foglio::backdrop { background: rgba(10,20,15,.55); }
.foglio form { padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 18px; }
.foglio h2 { margin: 0; font-family: var(--font-display); font-weight: 800; font-stretch: 110%; font-size: 1.4rem; }
[data-tema="estate"] .foglio h2 { font-weight: 400; }
.foglio fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.foglio legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.scelte { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scelte label {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; border-radius: 12px;
  border: 2px solid #E2D5BC;
  font-weight: 600;
  cursor: pointer;
}
.scelte input { position: absolute; opacity: 0; pointer-events: none; }
.scelte label:has(input:checked) { border-color: currentColor; background: rgba(0,0,0,.04); }
.scelte label:has(input:focus-visible) { outline: 3px solid #C62828; outline-offset: 2px; }
.campione { width: 18px; height: 18px; border-radius: 50%; }
.campione.classica { background: #1E7A4E; box-shadow: inset 0 0 0 3px #C62828; }
.campione.estate { background: #1F3FA6; border-radius: 4px; box-shadow: inset 0 0 0 3px #F2B705; }
.interruttore { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; cursor: pointer; }
.interruttore input { width: 22px; height: 22px; accent-color: #C62828; flex-shrink: 0; }
[data-tema="estate"] .interruttore input { accent-color: #1F3FA6; }
.interruttore.secondario { padding-left: 16px; margin-top: -6px; }
.interruttore:has(input:disabled) { opacity: .45; cursor: default; }
.interruttore small { display: block; font-size: .85rem; opacity: .75; }
.intervallo { display: grid; gap: 6px; }
.intervallo input { width: 100%; accent-color: #C62828; }
[data-tema="estate"] .intervallo input { accent-color: #1F3FA6; }
.azioni-foglio { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-foglio {
  flex: 1 1 auto;
  min-height: 48px; border-radius: 12px;
  border: 2px solid currentColor; background: transparent;
  font-weight: 700; padding: 0 16px;
}
.btn-foglio.primario { background: #C62828; border-color: #C62828; color: #FFF6E6; }
[data-tema="estate"] .btn-foglio.primario { background: #1F3FA6; border-color: #1F3FA6; color: #FFFFFF; }
.btn-foglio.pericolo[data-conferma="1"] { background: #2A1A12; border-color: #2A1A12; color: #FFFCF4; }

/* ---------- Avvisi ---------- */

.avviso {
  position: fixed;
  left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 150%);
  width: max-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  background: #2A1A12; color: #FFF6E6;
  font-size: .95rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transition: transform .25s ease;
  z-index: 20;
}
.avviso.visibile { transform: translate(-50%, 0); }
.avviso button { border: 0; border-radius: 10px; padding: 8px 12px; background: #FFF6E6; color: #2A1A12; font-weight: 700; }
.avviso:empty { display: none; }
[data-tema="estate"] .avviso { background: #142B78; color: #FFFFFF; }
[data-tema="estate"] .avviso button { background: #F2B705; color: #142B78; }

/* ---------- Testo della pagina ---------- */

.testo {
  background: var(--carta);
  color: var(--inchiostro);
  margin-top: 24px;
  padding: 40px 20px 56px;
  border-radius: 24px 24px 0 0;
}
[data-tema="estate"] .testo { border-top: 2px solid #1F3FA6; }
.testo-interno { max-width: 40rem; margin: 0 auto; }
.testo h1 {
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 110%;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 0 0 16px;
  text-wrap: balance;
}
[data-tema="estate"] .testo h1 { font-weight: 400; color: #1F3FA6; }
.testo h2 { font-family: var(--font-display); font-weight: 800; font-stretch: 105%; font-size: 1.45rem; line-height: 1.2; margin: 40px 0 10px; }
[data-tema="estate"] .testo h2 { font-weight: 400; color: #1F3FA6; }
.testo h3 { font-size: 1.05rem; margin: 24px 0 4px; }
.testo p, .testo li { max-width: 68ch; }
.testo p { margin: 0 0 12px; }
.testo ul { padding-left: 1.2em; margin: 0 0 12px; }
.testo li { margin-bottom: 6px; }
.testo a { color: var(--numero); text-underline-offset: 3px; }
.attacco { font-size: 1.15rem; }
.faq details { border-top: 1px solid var(--linea); }
.faq details:last-of-type { border-bottom: 1px solid var(--linea); }
.faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; min-height: 48px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex-shrink: 0; width: 10px; height: 10px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .2s ease; margin-right: 6px; }
.faq details[open] summary::after { transform: rotate(225deg) translateY(-3px); }
.faq summary h3 { margin: 0; font-size: 1.05rem; }
.faq details p { margin: 0 0 16px; }

.piede {
  background: var(--carta);
  color: var(--inchiostro);
  text-align: center;
  padding: 0 20px 40px;
  font-size: .95rem;
}
.piede p { margin: 0 0 6px; }
.piede a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Browser senza text-box: piccola correzione ottica */
@supports not (text-box: trim-both cap alphabetic) {
  .cella i { padding-top: .1em; }
  .pezzo span { margin-top: .08em; }
  [data-tema="estate"] .pezzo span { margin-top: -.02em; }
}

.link-piede { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; max-width: 46rem; margin: 0 auto 14px; }
.link-piede a { color: inherit; font-size: .9rem; text-underline-offset: 3px; padding: 4px 0; }
.legale mark { background: #FFE08A; color: #2A1A12; padding: 0 4px; border-radius: 4px; }

/* Pulsante verso la tombola nelle pagine di contorno */
.vai-tombola {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px;
  border-radius: 12px;
  background: #C62828; color: #FFF6E6;
  font-family: var(--font-display); font-weight: 800; font-stretch: 110%;
  font-size: .95rem; text-decoration: none; white-space: nowrap;
  box-shadow: 0 3px 0 #8E1B16;
}
.vai-tombola:active { transform: translateY(2px); box-shadow: 0 1px 0 #8E1B16; }
[data-tema="estate"] .vai-tombola { background: #1F3FA6; color: #FFFFFF; box-shadow: 0 3px 0 #142B78; font-weight: 400; }
.vai-tombola.grande { min-height: 56px; padding: 0 26px; font-size: 1.2rem; box-shadow: 0 5px 0 #8E1B16; }
.invito-gioco {
  display: flex; align-items: center; gap: 22px;
  margin: 8px 0 40px; padding: 24px;
  background: var(--carta); color: var(--inchiostro);
  border: 3px solid #C62828; border-radius: 18px;
  box-shadow: 0 0 0 5px var(--carta), 0 16px 30px rgba(0,0,0,.25);
}
[data-tema="estate"] .invito-gioco { border-color: #1F3FA6; }
.invito-gioco h2 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 850; font-stretch: 105%; font-size: 1.6rem; color: #C62828; }
[data-tema="estate"] .invito-gioco h2 { color: #1F3FA6; font-weight: 400; }
.invito-gioco p { margin: 0 0 16px; max-width: 36rem; }
.invito-azioni { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.link-altri { color: var(--inchiostro); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; padding: 6px 0; }
.invito-gettone {
  flex-shrink: 0; width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 850; font-stretch: 70%; font-size: 46px; 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;
  transform: rotate(-8deg);
}
@media (max-width: 560px) { .invito-gioco { flex-direction: column; align-items: flex-start; } .invito-gettone { width: 76px; height: 76px; font-size: 36px; } }

@media (max-width: 420px) { .barra .vai-tombola { font-size: .82rem; padding: 0 12px; font-stretch: 100%; } .barra .marchio { font-size: 1.05rem; } }

.scelte.tre-temi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.scelte.tre-temi label { gap: 6px; padding: 0 4px; font-size: .95rem; }
[data-tema="halloween"] {
  --sfondo: #2A1745;
  --trama: url("/assets/img/halloween-stelle.svg");
  --testo: #FFF3E3;
  --testo-tenue: rgba(255,243,227,.86);
  --accento: #FF7A1A;
  --accento-ombra: #A8420A;
  --su-accento: #2A1745;
  --carta: #F7F0FF;
  --cella: #FFFFFF;
  --linea: #E4D6F7;
  --bordo-blocco: #5B2E91;
  --numero: #5B2E91;
  --inchiostro: #2A1745;
  --tenue-chip: rgba(0,0,0,.28);
  --prossimo-sfondo: #FFD23F;
  --prossimo-testo: #2A1745;
  --font-display: "Grandstander", "Comic Sans MS", system-ui, sans-serif;
  --font-testo: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --raggio: 20px;
  color-scheme: dark;
}
[data-tema="halloween"] body {
  background-image: url("/assets/img/halloween-cielo.svg"), var(--trama);
  background-repeat: no-repeat, repeat;
  background-size: 300px auto, 320px 320px;
  background-position: right -76px top 66px, 0 0;
}
[data-tema="halloween"] :focus-visible { outline-color: #FFD23F; }
[data-tema="halloween"] .marchio { font-weight: 900; letter-spacing: 0; }
[data-tema="halloween"] .ico { background: rgba(243,236,255,.14); }

/* La zucca al posto del bussolotto */
[data-tema="halloween"] .pezzo {
  width: 196px; height: 172px;
  margin: 22px 0 30px;
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background:
    radial-gradient(ellipse 60% 45% at 42% 32%, rgba(255,214,140,.55), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 100%, rgba(168,66,10,.45), transparent 60%),
    #FF7A1A;
  box-shadow: inset -10px -6px 0 rgba(168,66,10,.25), 0 22px 30px -6px rgba(10,0,25,.55);
}
[data-tema="halloween"] .pezzo::before {
  display: block;
  inset: auto;
  left: 50%; top: -22px;
  width: 22px; height: 34px;
  margin-left: -11px;
  border: 0;
  border-radius: 7px 11px 4px 4px;
  background: linear-gradient(90deg, #4E9B2A, #6BBF3A 55%, #3E7F22);
  box-shadow: 14px 6px 0 -6px #6BBF3A;
  transform: rotate(9deg);
}
[data-tema="halloween"] .pezzo::after {
  content: "";
  position: absolute;
  inset: 3px 24%;
  border-radius: 50%;
  box-shadow: inset 9px 0 10px -4px rgba(168,66,10,.38), inset -9px 0 10px -4px rgba(168,66,10,.38);
  pointer-events: none;
}
[data-tema="halloween"] .pezzo span {
  z-index: 1;
  font-weight: 900; font-stretch: 100%;
  font-size: 88px;
  letter-spacing: 0;
  color: #2A1745;
  text-shadow: 0 3px 0 rgba(255,214,140,.45);
}
[data-tema="halloween"] .pezzo.vuoto span { font-size: 70px; opacity: .55; }
[data-tema="halloween"] .cade { animation: zucca .8s cubic-bezier(.25,.8,.35,1.1); transform-origin: 50% 100%; }
@keyframes zucca {
  0% { transform: translateY(-90px) rotate(-18deg) scale(.55); opacity: 0; }
  50% { transform: translateY(4px) scale(1.12, .86); opacity: 1; }
  70% { transform: translateY(-8px) scale(.95, 1.06) rotate(3deg); }
  85% { transform: scale(1.03, .97); }
  100% { transform: none; }
}
[data-tema="halloween"] .sm-d { font-family: var(--font-display); font-style: normal; font-weight: 800; }

[data-tema="halloween"] .precedenti { gap: 10px; margin-top: 14px; }
[data-tema="halloween"] .precedenti li {
  position: relative;
  width: 42px; height: 37px;
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  font-weight: 900; font-stretch: 100%;
  color: #2A1745;
  background: #FF8A2E;
  box-shadow: inset 6px 0 6px -4px rgba(168,66,10,.4), inset -6px 0 6px -4px rgba(168,66,10,.4), 0 4px 6px rgba(10,0,25,.35);
}
[data-tema="halloween"] .precedenti li:nth-child(n) { opacity: 1; }
[data-tema="halloween"] .precedenti li:nth-child(2) { transform: scale(.9); filter: saturate(.85); }
[data-tema="halloween"] .precedenti li:nth-child(3) { transform: scale(.8); filter: saturate(.7); }
[data-tema="halloween"] .precedenti li:nth-child(4) { transform: scale(.7); filter: saturate(.55); }
[data-tema="halloween"] .precedenti li::before {
  content: ""; position: absolute; left: 50%; top: -6px;
  width: 7px; height: 10px; margin-left: -3px;
  border-radius: 3px 4px 2px 2px; background: #6BBF3A;
  transform: rotate(10deg);
}

[data-tema="halloween"] .estrai { font-weight: 900; font-stretch: 100%; font-size: 1.6rem; }
[data-tema="halloween"] .auto { border-color: rgba(243,236,255,.5); }
[data-tema="halloween"] .auto[aria-pressed="true"] { background: #FFD23F; border-color: #FFD23F; color: #2A1745; }
[data-tema="halloween"] .premio { border-color: rgba(243,236,255,.45); }
[data-tema="halloween"] .invita { border-color: rgba(243,236,255,.35); background: rgba(10,0,25,.2); }

[data-tema="halloween"] .tabellone { box-shadow: 0 14px 30px rgba(10,0,25,.45); }
[data-tema="halloween"] .blocco { border-radius: 10px; }
[data-tema="halloween"] .cella { font-weight: 800; font-stretch: 100%; }
[data-tema="halloween"] .cella.uscito b {
  border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%;
  background: #FF7A1A; color: #2A1745;
  box-shadow: inset 4px 0 4px -3px rgba(168,66,10,.45), inset -4px 0 4px -3px rgba(168,66,10,.45);
}
[data-tema="halloween"] .cella.ultimo::after { border-color: #6BBF3A; border-width: 3px; }

[data-tema="halloween"] .foglio { background: #FFFFFF; color: #2A1745; }
[data-tema="halloween"] .foglio h2 { font-weight: 900; }
[data-tema="halloween"] .foglio::backdrop { background: rgba(20,8,40,.6); }
[data-tema="halloween"] .interruttore input,
[data-tema="halloween"] .intervallo input { accent-color: #5B2E91; }
[data-tema="halloween"] .btn-foglio.primario { background: #5B2E91; border-color: #5B2E91; color: #FFFFFF; }
[data-tema="halloween"] .scelte label:has(input:focus-visible) { outline-color: #5B2E91; }
.campione.halloween { background: #FF7A1A; border-radius: 50% 50% 46% 46% / 54% 54% 46% 46%; box-shadow: inset 0 0 0 3px #5B2E91; }

[data-tema="halloween"] .avviso { background: #F7F0FF; color: #2A1745; }
[data-tema="halloween"] .avviso button { background: #FF7A1A; color: #2A1745; }

[data-tema="halloween"] .testo { border-radius: 28px 28px 0 0; }
[data-tema="halloween"] .testo h1, [data-tema="halloween"] .testo h2 { font-weight: 900; color: #5B2E91; letter-spacing: 0; }

@media (min-width: 900px) {
  [data-tema="halloween"] body { background-size: 400px auto, 320px 320px; background-position: left calc(66% - 278px) top -64px, 0 0; }
  [data-tema="halloween"] .pezzo { width: clamp(220px, 34vh, 340px); height: clamp(192px, 30vh, 300px); margin-top: 36px; }
  [data-tema="halloween"] .pezzo::before { top: -30px; width: 30px; height: 46px; margin-left: -15px; }
  [data-tema="halloween"] .pezzo span { font-size: clamp(100px, 15vh, 160px); }
  [data-tema="halloween"] .precedenti li { width: 50px; height: 44px; }
}
@supports not (text-box: trim-both cap alphabetic) {
  [data-tema="halloween"] .pezzo span { margin-top: .04em; }
}
/* Pagine con testo in alto: la luna resta solo sugli schermi larghi, per non coprire le scritte */
@media (max-width: 899px) {
  [data-tema="halloween"] body:has(.dolcetto, .pagina-cartelle, .hub) { background-image: var(--trama); background-size: 320px 320px; background-position: 0 0; }
}
@media (min-width: 900px) {
  [data-tema="halloween"] body:has(.dolcetto, .pagina-cartelle, .hub) { background-size: 380px auto, 320px 320px; background-position: left calc(50% + 290px) top 40px, 0 0; }
}
