/* Allenamento Mente — stile glass delle app di Pietro (sfondo diagonale fisso, barre di vetro, schede bianche con riflesso,
   pulsanti sfumati con luce interna). Mobile first, ripieghi per telefoni vecchi (senza dvh, clamp, aspect-ratio). */
:root {
  --fondo-1: #2b1d6e; --fondo-2: #6c5ce7; --su-fondo: #ffffff; --su-fondo-2: rgba(255,255,255,.82);
  --vetro: rgba(255,255,255,.16); --vetro-bordo: rgba(255,255,255,.32); --barra: rgba(30,18,84,.55);
  --card-1: #ffffff; --card-2: #efeaff; --bordo: #d9d1f7; --testo: #241a52; --sotto: #5b5190;
  --ombra: 0 6px 18px rgba(25,12,80,.28), 0 1px 2px rgba(25,12,80,.12), inset 0 1px 0 rgba(255,255,255,.95);
  --accento-1: #ff9f43; --accento-2: #ee6a10; --ok-bg: #dff7ee; --quasi-bg: #fff2cc; --sol-bg: #e4ecff; --err: #ffd1d1;
  --c-dec: #e63946; --c-uni: #2f7de1; --c-uni2: #1b5cb8; --c-cent: #1a1a1a; --c-migl: #2eb85c; --vuota: #e3def7; --ripiano: #f0ecff;
  --raggio: 22px;
}
@media (prefers-color-scheme: dark) { :root[data-tema="auto"] { --fondo-1: #0e0a26; --fondo-2: #2f2570; --card-1: #2a2450; --card-2: #221d44; --bordo: #433b7c; --testo: #f1efff; --sotto: #bdb7e6;
  --ok-bg: #12372f; --quasi-bg: #3d3414; --sol-bg: #1f2c4a; --c-cent: #d6d6d6; --vuota: #3a3463; --ripiano: #342e5e; --err: #5a2330; } }
:root[data-tema="scuro"] { --fondo-1: #0e0a26; --fondo-2: #2f2570; --card-1: #2a2450; --card-2: #221d44; --bordo: #433b7c; --testo: #f1efff; --sotto: #bdb7e6;
  --ok-bg: #12372f; --quasi-bg: #3d3414; --sol-bg: #1f2c4a; --c-cent: #d6d6d6; --vuota: #3a3463; --ripiano: #342e5e; --err: #5a2330; }
:root[data-font="dislessia"] body { font-family: "OpenDyslexic", "Comic Sans MS", "Comic Neue", Verdana, sans-serif; letter-spacing: .04em; word-spacing: .12em; line-height: 1.7; }
:root[data-anim="no"] * { animation: none !important; transition: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background-color: var(--fondo-1); touch-action: pan-x pan-y; }
body { margin: 0; color: var(--su-fondo); min-height: 100vh; overflow-x: hidden; background: transparent;
  font: 16px/1.5 ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 1.125rem;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
body::before { content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: -1;
  background: linear-gradient(135deg, var(--fondo-1) 0%, var(--fondo-2) 50%, var(--fondo-1) 100%); }
[hidden] { display: none !important; }
#app { max-width: 44rem; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.schermata { padding: 1rem; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.schermata > * + * { margin-top: 1rem; }
.schermata.centro { align-items: center; justify-content: center; text-align: center; }
h1 { font-size: 1.6rem; margin: 0; text-shadow: 0 1px 6px rgba(0,0,0,.3); } h2 { font-size: 1.15rem; margin: .5rem 0; }
.titolo-app { font-size: 2rem; } .sotto { color: var(--su-fondo-2); margin: 0; } .nota { color: var(--su-fondo-2); font-size: .95rem; max-width: 30rem; }
.errore { color: #ffd1d1; min-height: 1.5em; margin: 0; font-weight: 700; } .etichetta { margin: .25rem 0 0; font-weight: 700; }

/* pulsanti: sfumati con luce interna */
.btn { font: inherit; font-weight: 700; min-height: 48px; min-width: 48px; padding: .6rem 1.1rem; border-radius: 16px; border: 1px solid var(--vetro-bordo);
  background: linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,.10)); color: var(--su-fondo); cursor: pointer; touch-action: manipulation;
  box-shadow: 0 3px 8px rgba(20,10,70,.25), inset 0 1px 0 rgba(255,255,255,.4); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .1s; }
.btn:active { transform: scale(.97); } .btn:disabled { opacity: .45; }
.btn.primario { background: linear-gradient(180deg, var(--accento-1), var(--accento-2)); border-color: rgba(255,255,255,.5); color: #fff; text-shadow: 0 1px 2px rgba(120,40,0,.4);
  box-shadow: 0 8px 18px rgba(214,90,16,.38), inset 0 1px 0 rgba(255,255,255,.45); }
.btn.grande { min-height: 56px; font-size: 1.15rem; width: 100%; max-width: 24rem; } .btn.enorme { min-height: 80px; font-size: 1.6rem; width: 100%; max-width: 24rem; }
.btn.piccolo { min-height: 44px; padding: .3rem .8rem; } .btn.icona { font-size: 1.3rem; padding: .3rem; }
.btn.attivo { background: linear-gradient(180deg, var(--accento-1), var(--accento-2)); border-color: rgba(255,255,255,.6); }
.card .btn, .riga-imp .btn, .schedina .btn.secondario { color: var(--testo); background: linear-gradient(180deg, #fff, var(--card-2)); border-color: var(--bordo); box-shadow: 0 3px 8px rgba(25,12,80,.12), inset 0 1px 0 #fff; text-shadow: none; }
.card .btn.attivo, .riga-imp .btn.attivo { color: #fff; background: linear-gradient(180deg, var(--accento-1), var(--accento-2)); }
.btn.secondario { color: var(--su-fondo); }
:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }

.barra { display: grid; grid-template-columns: 3rem 1fr 3rem; align-items: center; text-align: center; padding: .4rem; border-radius: 18px;
  background: var(--barra); border: 1px solid var(--vetro-bordo); -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%); box-shadow: 0 4px 12px rgba(0,0,0,.22); }
.campo, .risposta { font: inherit; width: 100%; padding: .8rem 1rem; border-radius: 16px; border: 1px solid var(--bordo); background: linear-gradient(180deg, #fff, #f4f0ff); color: #241a52;
  box-shadow: inset 0 1px 3px rgba(25,12,80,.15); }
.campo { font-size: 18px; } .risposta { text-align: center; font-size: 32px; font-weight: 700; max-width: 12rem; align-self: center; }
label { display: flex; flex-direction: column; font-weight: 700; } label > * + * { margin-top: .4rem; }

/* schede bianche con riflesso */
.card, .voce, .riga-imp, .schedina, .album .slot.piena { color: var(--testo); background: linear-gradient(180deg, var(--card-1) 0%, var(--card-2) 100%); border: 1px solid var(--bordo); box-shadow: var(--ombra); }
.card { border-radius: var(--raggio); padding: 1rem; }
.griglia-profili { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); grid-gap: 1rem; gap: 1rem; width: 100%; }
.card.profilo { display: flex; flex-direction: column; align-items: center; font: inherit; color: var(--testo); min-height: 8rem; cursor: pointer; }
.avatar { font-size: 3rem; line-height: 1; } .avatar.grande { font-size: 5rem; }
.griglia-avatar, .griglia-eta { display: grid; grid-template-columns: repeat(auto-fit, minmax(3.4rem, 1fr)); grid-gap: .5rem; gap: .5rem; }
.avatar-btn { font-size: 2rem; min-height: 56px; } .eta-btn { font-size: 1.4rem; min-height: 56px; }
.stats { display: flex; flex-wrap: wrap; justify-content: center; font-weight: 700; } .stats span { margin: 0 .5rem; padding: .2rem .8rem; border-radius: 14px; background: var(--vetro); border: 1px solid var(--vetro-bordo); }
.menu { display: grid; grid-template-columns: 1fr 1fr; grid-gap: .75rem; gap: .75rem; width: 100%; max-width: 24rem; }

.sessione > * + * { margin-top: .75rem; }
.progresso { height: 1rem; background: var(--vetro); border: 1px solid var(--vetro-bordo); border-radius: 1rem; overflow: hidden; margin: 0 .5rem; }
.riempi { height: 100%; width: 0; background: linear-gradient(180deg, #6df0b9, #00b894); border-radius: 1rem; transition: width .5s; }
.punti { font-weight: 700; font-size: .95rem; text-align: right; padding-right: .3rem; }
.schedina { border-radius: var(--raggio); padding: 1rem; display: flex; flex-direction: column; align-items: center; text-align: center; }
.schedina > * + * { margin-top: .9rem; }
.testo-es { font-size: 2.4rem; font-weight: 800; margin: 0; } .visuale { width: 100%; display: flex; justify-content: center; } .consegna { margin: 0; color: var(--sotto); }
.azioni { display: flex; flex-wrap: wrap; width: 100%; max-width: 24rem; margin-left: -.375rem; margin-right: -.375rem; } .azioni .btn { margin: .375rem; } .azioni .primario { flex: 1 1 10rem; } .azioni .secondario { flex: 1 1 8rem; }
.feedback { width: 100%; border-radius: 16px; } .feedback:not(:empty) { padding: .8rem 1rem; display: flex; flex-direction: column; align-items: center; color: #241a52; }
.feedback > * + * { margin-top: .6rem; } .feedback p { margin: 0; } .feedback.giusto { background: var(--ok-bg); animation: pop .3s; } .feedback.quasi, .feedback.aiuto { background: var(--quasi-bg); } .feedback.soluzione { background: var(--sol-bg); }
:root[data-tema="scuro"] .feedback:not(:empty) { color: #f1efff; } @media (prefers-color-scheme: dark) { :root[data-tema="auto"] .feedback:not(:empty) { color: #f1efff; } }
@keyframes pop { from { transform: scale(.92); } to { transform: scale(1); } }

.strumento { width: 100%; max-width: 30rem; height: auto; -webkit-user-select: none; user-select: none; touch-action: none; }
.linea20 .cella.uni { fill: var(--c-uni); } .linea20 .cella.uni.g2 { fill: var(--c-uni2); } .linea20 .cella.dec { fill: var(--c-dec); } .linea20 .scelta .cella { stroke: var(--testo); stroke-width: 3; }
.linea100 { max-width: 22rem; } .strumento .ripiano { fill: var(--ripiano); } .strumento .etichetta { fill: var(--sotto); font-weight: 700; }
.pal.dec { fill: var(--c-dec); } .pal.unita { fill: var(--c-uni); } .pal.vuota { fill: var(--vuota); } .pal.alt1 { fill: #00b894; } .pal.alt2 { fill: #a29bfe; } .palline { max-width: 20rem; }
.linea100 .l-dec, .linea1000 .l-dec { fill: var(--c-dec); } .linea100 .l-uni, .linea1000 .l-uni { fill: var(--c-uni); } .linea1000 .l-cent { fill: var(--c-cent); } .linea1000 .l-migl { fill: var(--c-migl); }
.linea1000 { max-width: 24rem; } .linea1000 .pz.cent { fill: var(--c-cent); } .linea1000 .pz.dec { fill: var(--c-dec); } .linea1000 .pz.uni { fill: var(--c-uni); } .linea1000 .pz.migl { fill: var(--c-migl); } .linea1000 .pz.vuoto { fill: var(--vuota); }

.stelle-fine { font-size: 3rem; } .figurina { font-size: 4rem; } .nuova-fig { animation: pop .5s; }
.gruppo > * + * { margin-top: .5rem; } .voce { display: flex; align-items: center; border-radius: 16px; padding: .6rem .8rem; } .voce > * + * { margin-left: .75rem; }
.voce small { display: block; color: var(--sotto); } .voce.bloccata { opacity: .6; } .voce .ic { font-size: 1.6rem; }
.album { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: .6rem; gap: .6rem; }
.slot { position: relative; height: 0; padding-bottom: 100%; border-radius: 16px; background: var(--vetro); border: 1px solid var(--vetro-bordo); color: var(--su-fondo-2); }
.slot > span { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.riga-imp { display: flex; flex-direction: column; border-radius: 16px; padding: .7rem; } .riga-imp > * + * { margin-top: .4rem; } .gruppo-btn { display: flex; flex-wrap: wrap; margin: -.25rem; } .gruppo-btn .btn { margin: .25rem; }
.caricamento { text-align: center; padding: 3rem; }

@media (min-width: 900px) { #app { max-width: 52rem; } .schermata { padding: 2rem; } .testo-es { font-size: 3rem; } }   /* desktop: contenitore centrato, come un sito */
@media (orientation: landscape) and (max-height: 32rem) { .schermata { padding: .5rem 1rem; } .testo-es { font-size: 1.8rem; } .btn.enorme { min-height: 60px; } .linea100 { max-height: 55vh; width: auto; } }
