@font-face { font-family: 'Fredoka'; src: url(fonts/fredoka.woff2) format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(fonts/nunito.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --sfondo: #fff7e8;
  --sfondo2: #fde7c7;
  --carta: #fffdf8;
  --inchiostro: #3b2a1a;
  --tenue: #7a6450;
  --bordo: #edd9bb;
  --accento: #f97316;
  --verde: #16a34a;
  --ultimo: #facc15;
  --ombra: 0 6px 0 rgba(120, 72, 20, .18), 0 14px 30px rgba(120, 72, 20, .12);
  --raggio: 22px;
  --emoji: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 600;
  color: var(--inchiostro);
  background: var(--sfondo);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
body.nascondi-cursore, body.nascondi-cursore * { cursor: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 4px solid #2563eb; outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, .titolo-grande { font-family: 'Fredoka', 'Nunito', sans-serif; margin: 0; }

/* ---------- Cielo animato ---------- */
#cielo { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--ultimo) 22%, #fff7e8), transparent 70%),
              linear-gradient(180deg, #fff7e8 0%, #fdebd0 100%);
  transition: background 1.2s ease; }
.bolla-cielo { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .45; animation: deriva 22s ease-in-out infinite alternate; }
.b1 { width: 380px; height: 380px; background: #fecaca; left: -80px; top: 18%; }
.b2 { width: 320px; height: 320px; background: #bbf7d0; right: -60px; top: 6%; animation-delay: -6s; }
.b3 { width: 420px; height: 420px; background: #bfdbfe; left: 30%; bottom: -200px; animation-delay: -12s; }
.b4 { width: 260px; height: 260px; background: #fde68a; right: 18%; bottom: 10%; animation-delay: -3s; }
@keyframes deriva { to { transform: translate(60px, -40px) scale(1.15); } }
.nota-cielo { position: absolute; font-size: 42px; color: #e8cfa8; animation: sale 16s linear infinite; bottom: -60px; }
.n1 { left: 6%; animation-delay: 0s; } .n2 { left: 22%; animation-delay: -4s; font-size: 30px; }
.n3 { left: 48%; animation-delay: -9s; } .n4 { left: 66%; animation-delay: -2s; font-size: 34px; }
.n5 { left: 82%; animation-delay: -12s; } .n6 { left: 92%; animation-delay: -6s; font-size: 28px; }
@keyframes sale { 0% { transform: translateY(0) rotate(-10deg); opacity: 0; } 10% { opacity: .9; } 50% { transform: translateY(-55vh) rotate(12deg) translateX(30px); } 90% { opacity: .8; } 100% { transform: translateY(-115vh) rotate(-8deg); opacity: 0; } }

/* ---------- Struttura ---------- */
#app { position: relative; z-index: 1; height: 100dvh; display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: clamp(6px, 1vh, 12px);
  padding: clamp(6px, 1.2vh, 14px) clamp(10px, 1.4vw, 22px); }

/* Testata */
#testata { display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icona { width: clamp(44px, 6vh, 62px); height: clamp(44px, 6vh, 62px); display: block; animation: dondola 3s ease-in-out infinite; }
.logo-icona svg { width: 100%; height: 100%; }
@keyframes dondola { 50% { transform: rotate(8deg) scale(1.05); } }
.titolo { font-size: clamp(24px, 3.6vh, 40px); line-height: 1; letter-spacing: .5px; }
.titolo span, .titolo-grande span { display: inline-block; animation: lettere 2.4s ease-in-out infinite; }
.titolo span:nth-child(1), .titolo-grande span:nth-child(1) { color: #ef4444; }
.titolo span:nth-child(2), .titolo-grande span:nth-child(2) { color: #f97316; animation-delay: .15s; }
.titolo span:nth-child(3), .titolo-grande span:nth-child(3) { color: #8b5cf6; animation-delay: .3s; }
@keyframes lettere { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px) rotate(-2deg); } }
.sottotitolo { margin: 2px 0 0; color: var(--tenue); font-size: clamp(13px, 1.7vh, 17px); }

.modi { display: flex; gap: 8px; background: var(--carta); padding: 6px; border-radius: 999px; box-shadow: var(--ombra); }
.modo { border: 0; background: transparent; padding: 10px 18px; border-radius: 999px; font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: clamp(15px, 1.9vh, 19px); transition: background .2s, transform .2s, color .2s; }
.modo:hover { background: #fff1db; }
.modo[aria-pressed="true"] { background: linear-gradient(180deg, #fb923c, #f97316); color: #fff; box-shadow: 0 4px 0 #c2410c; transform: translateY(-2px); }
.modo-ico { font-family: var(--emoji); }
.azioni { display: flex; align-items: center; gap: 8px; }
.contatore { background: var(--carta); padding: 8px 14px; border-radius: 999px; box-shadow: var(--ombra); white-space: nowrap; }
.contatore b { font-family: 'Fredoka', sans-serif; font-size: 20px; color: var(--accento); display: inline-block; }
.contatore b.salta { animation: salta .3s; }
.contatore small { color: var(--tenue); }
.tondo { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--carta); box-shadow: var(--ombra); font-size: 20px; font-family: var(--emoji); transition: transform .15s; }
.tondo:hover { transform: translateY(-2px) rotate(-6deg); }
.tondo:active { transform: translateY(2px); }

/* Strumenti */
#strumenti { display: flex; gap: clamp(6px, .8vw, 12px); overflow-x: auto; padding: 4px 4px 10px; scrollbar-width: thin; justify-content: safe center; }
.strumento { flex: 0 0 auto; width: clamp(84px, 8.4vw, 118px); border: 3px solid transparent; border-radius: 18px; background: var(--carta);
  box-shadow: var(--ombra); padding: 6px 4px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .2s, border-color .2s, background .2s; }
.strumento .mini { width: clamp(44px, 6.4vh, 66px); height: clamp(44px, 6.4vh, 66px); }
.strumento .mini svg { width: 100%; height: 100%; overflow: visible; }
.strumento span { font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: clamp(12px, 1.55vh, 15px); white-space: nowrap; }
.strumento:hover { transform: translateY(-4px) rotate(-1.5deg); }
.strumento[aria-pressed="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); transform: translateY(-4px) scale(1.04); }
.strumento[aria-pressed="true"] .mini { animation: dondola 1.6s ease-in-out infinite; }
.strumento.no { opacity: .35; filter: grayscale(1); }

/* Centro */
#centro { display: grid; grid-template-columns: clamp(260px, 22vw, 360px) minmax(0, 1fr) clamp(280px, 26vw, 420px); gap: clamp(8px, 1vw, 16px); min-height: 0; }
#pannello, #scheda { background: var(--carta); border-radius: var(--raggio); box-shadow: var(--ombra); padding: clamp(10px, 1.4vh, 18px); min-height: 0; overflow: auto; }
#pannello h2 { font-size: clamp(19px, 2.5vh, 26px); }
.aiutino { color: var(--tenue); margin: 6px 0 10px; font-size: clamp(14px, 1.7vh, 16px); }
.aiutino.piccolo { font-size: 13.5px; }
.centrato { text-align: center; justify-content: center; }
.riquadro { border: 2px dashed var(--bordo); border-radius: 16px; padding: 10px; margin-top: 10px; }
.riquadro h3 { font-size: 17px; margin-bottom: 8px; font-weight: 500; }
.interruttore { display: flex; gap: 6px; flex-wrap: wrap; }
.scelta { flex: 1 1 auto; border: 2px solid var(--bordo); background: #fff; border-radius: 14px; padding: 8px 10px; font-weight: 800; transition: all .15s; }
.scelta[aria-pressed="true"] { background: #fef3c7; border-color: #f59e0b; box-shadow: 0 3px 0 #f59e0b; transform: translateY(-1px); }
.ritmi { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.ritmi .scelta { padding: 6px 8px; font-size: 14px; }
.cursore { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 8px; }
.cursore input { flex: 1; accent-color: var(--accento); }
.grande { border: 0; border-radius: 16px; padding: 11px 16px; font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 17px; background: linear-gradient(180deg, #60a5fa, #3b82f6); color: #fff; box-shadow: 0 4px 0 #1d4ed8; transition: transform .1s, box-shadow .1s; width: 100%; }
.grande:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #1d4ed8; }
.grande.rosso { background: linear-gradient(180deg, #f87171, #ef4444); box-shadow: 0 4px 0 #b91c1c; }
.grande.verde { background: linear-gradient(180deg, #4ade80, #16a34a); box-shadow: 0 4px 0 #15803d; }
.grande.acceso { background: linear-gradient(180deg, #fbbf24, #f59e0b); box-shadow: 0 4px 0 #b45309; }
.grande.registrando { animation: lampeggia 1s infinite; }
@keyframes lampeggia { 50% { filter: brightness(1.25); transform: scale(1.03); } }
.enorme { font-size: 22px; padding: 16px 20px; margin-top: 12px; }
.riga-bottoni { display: flex; gap: 8px; margin-top: 10px; }
.riga-bottoni.centrato { justify-content: center; }
.riga-bottoni .grande { flex: 1; }

.lista-melodie { display: grid; gap: 7px; }
.melodia { display: flex; align-items: center; gap: 10px; border: 2px solid var(--bordo); background: #fff; border-radius: 14px; padding: 7px 10px; text-align: left; transition: transform .15s, border-color .15s; }
.melodia:hover:not(:disabled) { transform: translateX(4px); }
.melodia .ico { font-size: 26px; font-family: var(--emoji); }
.melodia .t { font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 16px; line-height: 1.1; }
.melodia small { display: block; color: var(--tenue); font-size: 12.5px; font-family: 'Nunito', sans-serif; }
.melodia[aria-pressed="true"] { border-color: #8b5cf6; background: #f3e8ff; box-shadow: 0 3px 0 #8b5cf6; }
.melodia .fatta { margin-left: auto; font-family: var(--emoji); }

.memory-dati { display: flex; gap: 8px; margin-bottom: 10px; }
.dato { flex: 1; background: #fef3c7; border-radius: 14px; padding: 8px; text-align: center; }
.dato span { display: block; font-size: 13px; color: var(--tenue); }
.dato b { font-family: 'Fredoka', sans-serif; font-size: 36px; color: #b45309; display: inline-block; }
.dato b.salta { animation: salta .4s; }

/* Palco */
#palco { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; border-radius: var(--raggio); overflow: hidden;
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--strum, #f59e0b) 16%, #fff) 0%, transparent 65%); transition: background .6s; }
#arte { width: min(64%, 58vh); aspect-ratio: 1; position: relative; z-index: 2; filter: drop-shadow(0 18px 18px rgba(80, 40, 0, .22)); animation: galleggia 4s ease-in-out infinite; }
#arte svg { width: 100%; height: 100%; overflow: visible; }
@keyframes galleggia { 50% { transform: translateY(-10px) rotate(1.5deg); } }
#arte.colpo svg { animation: colpo .32s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes colpo { 0% { transform: scale(1); } 35% { transform: scale(1.07) rotate(-2deg); } 100% { transform: scale(1); } }
#arte .corda { transition: stroke .2s; }
#arte .corda.acceso { stroke: var(--acceso); stroke-width: 3; animation: vibra .08s linear 5; }
@keyframes vibra { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(1.6px); } 75% { transform: translateX(-1.6px); } }
#arte .tasto-p.acceso { fill: var(--acceso); transform: translateY(2px); }
#arte .barra, #arte .campana, #arte .tamburo, #arte .tom, #arte .piatto, #arte .bacchetta { transform-box: fill-box; transform-origin: center; }
#arte .barra.acceso { transform: translateY(4px) scale(.97); filter: brightness(1.25); }
#arte .campana.acceso { animation: campana .6s ease-out; }
@keyframes campana { 25% { transform: rotate(14deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(5deg); } }
#arte .led.acceso { fill: var(--acceso); }
#arte .foro.acceso { fill: var(--acceso); }
#arte.colpo .bacchetta { animation: bacchetta .25s ease-out; transform-origin: 90% 90%; }
#arte.colpo .bacchetta.b2 { transform-origin: 10% 90%; animation-name: bacchetta2; }
@keyframes bacchetta { 40% { transform: rotate(-16deg); } }
@keyframes bacchetta2 { 40% { transform: rotate(16deg); } }
#arte.colpo .tamburo { animation: tamburo .25s ease-out; }
@keyframes tamburo { 40% { transform: scale(1.06, .94); } }
#arte.colpo .piatto { animation: campana .5s; }
#arte.colpo .occhi { animation: occhi .3s; transform-box: fill-box; transform-origin: center; }
@keyframes occhi { 40% { transform: scaleY(.2); } }
#arte.colpo .bocca { animation: bocca .45s; transform-box: fill-box; transform-origin: center; }
@keyframes bocca { 30% { transform: scale(1.4, 1.8); } }
#arte .antenna { animation: antenna 1.2s infinite; }
@keyframes antenna { 50% { fill: #facc15; } }
#arte.colpo .soffio { animation: soffio .5s; }
@keyframes soffio { from { opacity: 1; transform: translate(0, 0); } to { opacity: 0; transform: translate(-20px, -20px); } }
#arte .fulmine { animation: lampeggia 1.4s infinite; }
#arte .scintille { animation: lampeggia 1.8s infinite; }

#onde { position: absolute; inset: 0; pointer-events: none; z-index: 1; display: grid; place-items: center; }
.onda { position: absolute; width: min(50%, 44vh); aspect-ratio: 1; border-radius: 50%; border: 10px solid var(--c); opacity: .7; }

#mascotte { position: absolute; right: 3%; bottom: 3%; width: clamp(110px, 17vh, 190px); z-index: 3; }
#banana svg { width: 100%; height: auto; display: block; }
#banana { transform-origin: 50% 90%; transition: transform .2s; }
#banana.balla { animation: balla .35s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes balla { 0% { transform: scale(1, 1); } 30% { transform: scale(1.12, .86) translateY(6px); } 60% { transform: scale(.92, 1.12) translateY(-12px); } 100% { transform: scale(1); } }
#banana.battito-a { transform: rotate(-8deg); }
#banana.battito-b { transform: rotate(8deg); }
#banana .braccio { transform-box: fill-box; }
#banana .braccio.sx { transform-origin: 100% 50%; animation: saluta 1.2s ease-in-out infinite; }
#banana .braccio.dx { transform-origin: 0% 100%; animation: saluta 1.2s ease-in-out infinite reverse; }
@keyframes saluta { 50% { transform: rotate(18deg); } }
#banana .occhi { animation: ammicca 4s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ammicca { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
#fumetto { position: absolute; bottom: 92%; right: 40%; background: #fff; border: 3px solid var(--inchiostro); border-radius: 20px; padding: 10px 14px;
  font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: clamp(15px, 2.1vh, 22px); width: max-content; max-width: min(34vw, 340px); box-shadow: 0 5px 0 rgba(0,0,0,.12);
  transform-origin: 90% 100%; animation: fumetto .4s cubic-bezier(.3, 1.6, .5, 1); }
#fumetto::after { content: ''; position: absolute; right: 18px; bottom: -14px; border: 12px solid transparent; border-top-color: var(--inchiostro); border-bottom: 0; }
#fumetto.nuovo { animation: fumetto .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes fumetto { from { transform: scale(.4); opacity: 0; } }
.fumetto-emoji { font-family: var(--emoji); }

/* Spartito (impara una canzone) */
#spartito { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 4; background: rgba(255, 253, 248, .92); border-radius: 20px; padding: 8px 10px 4px; box-shadow: var(--ombra); }
.spartito-testa { display: flex; align-items: center; gap: 12px; font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: clamp(16px, 2.2vh, 22px); }
.progresso { flex: 1; height: 12px; background: #f1e4cf; border-radius: 99px; overflow: hidden; }
#barra-progresso { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f472b6, #a78bfa, #60a5fa, #34d399, #facc15); border-radius: 99px; transition: width .3s; }
.spartito-finestra { overflow: hidden; position: relative; height: clamp(86px, 13vh, 120px);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
#riga-note { display: flex; align-items: center; gap: 6px; height: 100%; position: absolute; left: 0; transition: transform .45s cubic-bezier(.3, 1.2, .5, 1); padding: 0 50%; }
.bolla { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: calc(var(--d, 1) * 18px + 38px); transition: transform .3s, opacity .3s; }
.bolla .pallino { width: clamp(38px, 6vh, 54px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8 0 18%, transparent 19%), var(--c); display: grid; place-items: center;
  font-family: var(--emoji); font-size: clamp(20px, 3.2vh, 30px); box-shadow: 0 4px 0 var(--s); position: relative; }
.bolla .sillaba { font-weight: 800; font-size: clamp(12px, 1.7vh, 16px); white-space: nowrap; color: var(--tenue); }
.bolla.fatta { opacity: .45; transform: scale(.82); }
.bolla.fatta .pallino::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 26px; background: #16a34acc; border-radius: 50%; }
.bolla.corrente { transform: scale(1.3); z-index: 2; }
.bolla.corrente .pallino { animation: rimbalza .7s ease-in-out infinite; box-shadow: 0 4px 0 var(--s), 0 0 0 6px #fff, 0 0 0 10px var(--c); }
.bolla.corrente .sillaba { color: var(--inchiostro); }
.bolla.suonata .pallino { animation: none; }
@keyframes rimbalza { 50% { transform: translateY(-8px); } }

/* Scheda */
#scheda { display: flex; flex-direction: column; justify-content: center; }
#scheda-svg svg { width: 100%; height: auto; display: block; overflow: visible; }
.ing .pad-scheda { transition: filter .15s, transform .15s; transform-box: fill-box; transform-origin: center; }
.ing.premuto .pad-scheda { filter: brightness(1.35) drop-shadow(0 0 8px var(--c)); transform: scale(1.18); }
.ing .filo { transition: stroke-width .15s; }
.ing.premuto .filo { stroke-width: 7; filter: drop-shadow(0 0 4px var(--c)); }
.ing.premuto .frutto-scheda { animation: salta .3s; transform-box: fill-box; transform-origin: center; }
.ing .anello { opacity: 0; }
.ing.prossimo .anello { opacity: 1; animation: anello 1s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes anello { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.ing.spento { opacity: .35; }
.terra-filo { stroke-dasharray: 6 6; animation: corrente 1s linear infinite; }
@keyframes corrente { to { stroke-dashoffset: -24; } }
@keyframes salta { 40% { transform: translateY(-6px) scale(1.2); } }

/* Tasti */
#tasti { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.fila { display: flex; gap: clamp(6px, 1vw, 16px); justify-content: center; width: 100%; }
.pad { --c: #f00; --s: #900; position: relative; flex: 0 1 clamp(96px, 13vw, 200px); height: clamp(104px, 17vh, 176px); border: 0; border-radius: 26px;
  background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.55) 0 12%, transparent 13%), linear-gradient(180deg, color-mix(in srgb, var(--c) 80%, #fff), var(--c));
  box-shadow: 0 9px 0 var(--s), 0 16px 24px rgba(0, 0, 0, .16); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: transform .08s, box-shadow .08s, filter .2s; touch-action: none; color: #fff; }
.pad .frutto { font-family: var(--emoji); font-size: clamp(34px, 6vh, 64px); line-height: 1.1; filter: drop-shadow(0 3px 0 rgba(0,0,0,.15)); }
.pad .nome { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: clamp(20px, 3.2vh, 32px); line-height: 1; -webkit-text-stroke: 6px var(--s); paint-order: stroke fill; letter-spacing: .5px; }
.pad .tasto { position: absolute; top: 8px; right: 10px; background: rgba(255,255,255,.88); color: var(--s); border-radius: 10px; padding: 1px 8px; font-weight: 800; font-size: clamp(12px, 1.6vh, 16px); }
.pad .alto { position: absolute; top: 8px; left: 10px; font-size: 12px; background: rgba(0,0,0,.2); border-radius: 8px; padding: 0 6px; }
.pad.premuto { transform: translateY(8px) scale(.97); box-shadow: 0 1px 0 var(--s), 0 4px 10px rgba(0, 0, 0, .2); filter: brightness(1.15) saturate(1.2); }
.pad.premuto .frutto { animation: salta .3s; }
.pad.prossimo { animation: invito 1s ease-in-out infinite; z-index: 2; }
.pad.prossimo::before { content: '👇'; font-family: var(--emoji); position: absolute; top: -48px; font-size: 40px; animation: rimbalza .6s ease-in-out infinite; }
.pad.prossimo::after { content: ''; position: absolute; inset: -8px; border-radius: 32px; border: 5px solid var(--c); animation: anello2 1s ease-out infinite; }
@keyframes invito { 50% { transform: translateY(-6px) scale(1.04); } }
@keyframes anello2 { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.15); } }
.pad.sbagliato { animation: no .3s; }
@keyframes no { 25% { transform: translateX(-8px) rotate(-3deg); } 75% { transform: translateX(8px) rotate(3deg); } }
.pad.spento { filter: grayscale(.85) brightness(.95); opacity: .5; }
.fila.dietro .pad { height: clamp(78px, 11vh, 120px); }
.fila.dietro .pad .frutto { font-size: clamp(26px, 4vh, 44px); }

/* Piede */
#piede { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: clamp(12px, 1.6vh, 15px); color: var(--tenue); padding: 0 6px; }
#piede b { color: var(--inchiostro); }
.motto { font-family: 'Fredoka', sans-serif; font-weight: 500; color: #8b5cf6; font-size: clamp(14px, 1.9vh, 18px); }
.motto small { color: var(--tenue); font-family: 'Nunito', sans-serif; }
.qr-piccolo { display: flex; align-items: center; gap: 6px; border: 0; background: var(--carta); border-radius: 12px; padding: 4px 10px 4px 4px; box-shadow: var(--ombra); font-size: 12px; font-weight: 800; text-align: left; line-height: 1.1; }
.qr-piccolo img { width: 38px; height: 38px; }

/* Particelle e coriandoli */
#particelle { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.particella { position: absolute; font-size: 30px; font-weight: 800; line-height: 1; will-change: transform, opacity; text-shadow: 0 2px 0 rgba(0,0,0,.12); }
.coriandolo { position: absolute; top: -20px; width: 12px; height: 18px; border-radius: 3px; will-change: transform; }

/* Finestre */
.schermo { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(59, 42, 26, .45); backdrop-filter: blur(6px); padding: 16px; animation: compare .25s; }
.schermo.trasparente { background: rgba(59, 42, 26, .25); backdrop-filter: none; }
@keyframes compare { from { opacity: 0; } }
.finestra { position: relative; background: var(--carta); border-radius: 28px; padding: 24px 26px; max-width: 560px; width: 100%; max-height: 92dvh; overflow: auto; box-shadow: 0 10px 0 rgba(0,0,0,.12), 0 30px 60px rgba(0,0,0,.25); animation: entra .35s cubic-bezier(.3, 1.5, .5, 1); }
.finestra.larga { max-width: 860px; }
@keyframes entra { from { transform: scale(.7) translateY(30px); opacity: 0; } }
.finestra h2 { font-size: 28px; margin-bottom: 12px; }
.chiudi { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fde7c7; font-size: 18px; font-weight: 800; }
.spiegazione { font-size: 17px; line-height: 1.45; }
.passi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; padding: 0; list-style: none; counter-reset: p; }
.passi li { background: #fff3df; border-radius: 16px; padding: 12px; font-size: 15px; line-height: 1.35; }
.passo-ico { display: block; font-size: 34px; font-family: var(--emoji); margin-bottom: 4px; }
.circuito svg { width: 100%; height: auto; max-height: 34vh; }
.qr-grande { display: flex; align-items: center; gap: 16px; background: #f3e8ff; border-radius: 18px; padding: 12px; margin-top: 10px; }
.qr-grande img { width: 120px; height: 120px; background: #fff; border-radius: 10px; padding: 4px; }
.qr-grande.solo { flex-direction: column; text-align: center; background: transparent; font-size: 18px; }
.qr-grande.solo img { width: min(60vw, 320px); height: auto; }

.imp-riga { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 2px dashed var(--bordo); font-weight: 800; }
.imp-riga.colonna { flex-direction: column; align-items: stretch; }
.imp-riga input[type=range] { flex: 1; max-width: 260px; accent-color: var(--accento); }
.levetta { appearance: none; width: 56px; height: 32px; border-radius: 99px; background: #e7d8c3; position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto; }
.levetta::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.levetta:checked { background: var(--verde); }
.levetta:checked::after { transform: translateX(24px); }
.scegli-frutti { display: flex; flex-wrap: wrap; gap: 8px; }
.scegli-frutti button { border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 18%, #fff); border-radius: 14px; padding: 4px 10px; display: flex; flex-direction: column; align-items: center; font-weight: 800; }
.scegli-frutti button span { font-size: 28px; font-family: var(--emoji); }
.scegli-frutti button[aria-expanded="true"] { box-shadow: 0 0 0 4px #2563eb55; }
.tavolozza { display: flex; flex-wrap: wrap; gap: 4px; background: #fff3df; border-radius: 14px; padding: 8px; }
.tavolozza button { border: 0; background: #fff; border-radius: 10px; width: 44px; height: 44px; font-size: 26px; font-family: var(--emoji); }
.piccolo-btn { border: 2px solid var(--bordo); background: #fff; border-radius: 12px; padding: 6px 12px; font-weight: 800; }

/* Avvio */
#avvio { background: radial-gradient(circle at 50% 40%, #fff7e8, #fcd9a8); backdrop-filter: none; }
.avvio-contenuto { text-align: center; max-width: 720px; }
.avvio-banana { width: clamp(150px, 26vh, 260px); margin: 0 auto; animation: galleggia 2.6s ease-in-out infinite; }
.avvio-banana svg { width: 100%; height: auto; }
.titolo-grande { font-size: clamp(44px, 9vw, 96px); line-height: 1; margin: 8px 0; }
.avvio-frase { font-size: clamp(18px, 2.6vw, 26px); margin: 6px 0 14px; }
.avvio-frutti { font-family: var(--emoji); font-size: clamp(30px, 5vw, 48px); display: flex; justify-content: center; gap: 10px; }
.avvio-frutti span { animation: rimbalza 1.2s ease-in-out infinite; }
.avvio-frutti span:nth-child(2) { animation-delay: .1s; } .avvio-frutti span:nth-child(3) { animation-delay: .2s; }
.avvio-frutti span:nth-child(4) { animation-delay: .3s; } .avvio-frutti span:nth-child(5) { animation-delay: .4s; } .avvio-frutti span:nth-child(6) { animation-delay: .5s; }
#btn-inizia { width: auto; padding: 18px 34px; font-size: clamp(20px, 3vw, 30px); }
.pulsa { animation: pulsa 1.6s ease-in-out infinite; }
@keyframes pulsa { 50% { transform: scale(1.06); } }

/* Festa */
.finestra.festa { text-align: center; max-width: 520px; }
.festa h2 { font-size: 48px; color: #8b5cf6; }
.festa p { font-size: 20px; }
.festa-stelle { font-size: 64px; font-family: var(--emoji); display: flex; justify-content: center; gap: 6px; }
.festa-stelle span { display: inline-block; animation: stella .6s cubic-bezier(.3, 1.8, .5, 1) both; }
.festa-stelle span.vuota { filter: grayscale(1); opacity: .3; }
.festa-stelle span:nth-child(2) { animation-delay: .25s; } .festa-stelle span:nth-child(3) { animation-delay: .5s; }
@keyframes stella { from { transform: scale(0) rotate(-180deg); } }

/* Schermi piccoli */
@media (max-width: 1100px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; grid-template-rows: auto; }
  #centro { grid-template-columns: 1fr; }
  #palco { min-height: 46vh; order: -1; }
  #arte { width: min(70%, 44vh); }
  .modi { order: 3; width: 100%; justify-content: center; }
  .modo { padding: 8px 10px; font-size: 14px; }
  .fila { flex-wrap: wrap; }
  .pad { flex-basis: calc(33% - 12px); }
  #piede { flex-wrap: wrap; justify-content: center; text-align: center; }
  #fumetto { max-width: 60vw; }
}
@media (max-height: 760px) and (min-width: 1101px) {
  .sottotitolo { display: none; }
  #piede { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
