/* ============================================================
   SBLOCCA IL LUCCHETTO — stile locale
   Carica prima css/kids-base.css (variabili, header, footer).
   Le parti comuni vengono da _modello/style.css; in fondo, da
   «IL LUCCHETTO» in giù, quelle proprie di questa app.
   ============================================================ */

/* ---------- Layout principale ---------- */
.game-container {
    position: relative;
    width: 100%;
    min-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 3vw, 36px) 12px 48px;
    overflow: hidden;
    color: var(--ink);
    font-family: var(--kids-font-body);
    /* lo sfondo di questa app: ottone e cielo */
    background:
        radial-gradient(620px 320px at 6% -40px, rgba(250, 204, 21, .16), transparent 60%),
        radial-gradient(720px 420px at 104% 104%, rgba(56, 189, 248, .14), transparent 60%),
        linear-gradient(180deg, #fffbeb 0%, #f0f9ff 100%);
}

.bg-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-decor span {
    position: absolute;
    opacity: .13;
    line-height: 1;
    animation: decorFloat 9s ease-in-out infinite alternate;
}

@keyframes decorFloat {
    from { transform: translateY(-12px) rotate(-8deg); }
    to   { transform: translateY(14px) rotate(10deg); }
}

/* ---------- Schermate ---------- */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 760px;
    padding: 0.5rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Schermata iniziale ---------- */
.hero-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2.5vw, 18px);
    margin-bottom: 0.9rem;
    min-height: 92px;
}

.hero-item {
    width: clamp(62px, 12vw, 88px);
    aspect-ratio: 1;
    border-radius: 20px;
    background: #fff;
    border: 3px solid #d7efec;
    box-shadow: 0 5px 0 rgba(10, 91, 99, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.9rem, 6vw, 2.6rem);
    font-family: var(--kids-font-title);
    font-weight: 700;
    color: var(--brand);
    line-height: 1;
    animation: heroBob 2.6s ease-in-out infinite;
}

.hero-item:nth-child(2) { animation-delay: .35s; }
.hero-item:nth-child(3) { animation-delay: .7s; }
.hero-item:nth-child(4) { animation-delay: 1.05s; }

@keyframes heroBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

.game-title {
    font-family: var(--kids-font-title);
    font-size: clamp(2rem, 5.6vw, 3.2rem);
    font-weight: 700;
    color: var(--brand);
    margin: 0 0 0.4rem;
    text-shadow: 0 3px 0 rgba(10, 91, 99, .12);
}

.game-subtitle {
    font-size: clamp(1.05rem, 3vw, 1.35rem);
    color: var(--ink-2);
    font-weight: 700;
    margin: 0 0 1.8rem;
}

.choose-label {
    font-family: var(--kids-font-title);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--brand);
    margin: 0 0 1rem;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 300px));
    gap: clamp(12px, 2.5vw, 22px);
    justify-content: center;
    width: 100%;
}

.level-card {
    --lvl: #22c55e;
    --lvl-dark: #15803d;
    --lvl-soft: #f0fdf4;
    appearance: none;
    border: 3px solid var(--lvl);
    background: #fff;
    border-radius: var(--kids-radius);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 7px 0 var(--lvl-dark), var(--kids-shadow-sm);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
    font-family: var(--kids-font-body);
}

.level-card:hover {
    transform: translateY(-4px);
    background: var(--lvl-soft);
    box-shadow: 0 11px 0 var(--lvl-dark), var(--kids-shadow);
}

.level-card:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--lvl-dark);
}

.level-card.piccoli { --lvl: #ec4899; --lvl-dark: #be185d; --lvl-soft: #fdf2f8; }
.level-card.medium  { --lvl: #f59e0b; --lvl-dark: #b45309; --lvl-soft: #fffbeb; }
.level-card.hard    { --lvl: #8b5cf6; --lvl-dark: #6d28d9; --lvl-soft: #f5f3ff; }
.level-card.libera  { --lvl: #0ea5e9; --lvl-dark: #0369a1; --lvl-soft: #f0f9ff; }

.level-card.wide { grid-column: 1 / -1; }

.level-icon { font-size: 2.2rem; line-height: 1; flex-shrink: 0; }

.level-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.level-name {
    font-family: var(--kids-font-title);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
}

.level-desc {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink-2);
}

/* ---------- Scheda per gli adulti ---------- */
.info-box {
    background: #fff;
    border: 2px dashed #cfe2e2;
    border-radius: 18px;
    padding: 1.3rem 1.4rem;
    margin-top: 2.2rem;
    width: 100%;
    text-align: left;
    color: #3b4a4a;
    font-size: 0.95rem;
    line-height: 1.6;
}

.info-box h2 {
    font-family: var(--kids-font-title);
    font-size: 1.15rem;
    color: var(--brand);
    margin: 0 0 0.7rem;
}

.info-box h3 {
    font-family: var(--kids-font-title);
    font-size: 1rem;
    color: var(--brand);
    margin: 1.1rem 0 0.4rem;
}

.info-box p { margin: 0 0 0.55rem; }
.info-box ul { margin: 0 0 0.55rem; padding-left: 1.2rem; }
.info-box li { margin-bottom: 0.35rem; }

.info-box .info-tip {
    margin-top: 0.9rem;
    background: #f0fdfa;
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
}

/* ---------- HUD ---------- */
.hud {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 1rem;
}

.hud-pill {
    background: #fff;
    border: 2px solid #ffe1a6;
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-family: var(--kids-font-title);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    box-shadow: var(--kids-shadow-sm);
    white-space: nowrap;
}

.free-pill { border-color: #bae6fd; font-size: 1.05rem; margin-right: auto; }

.score-pill.bump { animation: scoreBump .45s ease; }

@keyframes scoreBump {
    30% { transform: scale(1.22); }
}

.hud-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.progress-track {
    flex: 1;
    height: 16px;
    background: #e4ece7;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(10, 91, 99, .12);
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #38bdf8, #2dd4bf);
    transition: width .5s cubic-bezier(.22, 1, .36, 1);
}

.progress-label {
    font-family: var(--kids-font-title);
    font-weight: 600;
    color: var(--brand);
    font-size: 1rem;
    white-space: nowrap;
}

.hud-right { display: flex; gap: 8px; }

.hud-btn {
    appearance: none;
    border: 2px solid #d7efec;
    background: #fff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--kids-shadow-sm);
    transition: transform .15s ease, background .15s ease;
    padding: 0;
    line-height: 1;
}

.hud-btn:hover { transform: translateY(-2px); background: #f0fdfa; }
.hud-btn.home { border-color: var(--brand); background: #f0fdfa; }

/* ---------- Consegna: la scena del lucchetto ----------
   La domanda (bigliettino + lucchetto) ha un fondo diverso dal
   tastierino che sta sotto: il bambino deve capire subito che cosa
   guardare e che cosa toccare. */
.prompt-card {
    position: relative;
    background: linear-gradient(180deg, #fefce8 0%, #fff 70%);
    border: 3px solid #fde68a;
    border-radius: var(--kids-radius);
    box-shadow: var(--kids-shadow-sm);
    padding: 1rem 3.6rem 1.1rem 1.4rem;
    width: 100%;
    margin-bottom: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#free-screen .prompt-card { padding-right: 1.4rem; }

.say-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #ffe1a6;
    background: #fff8ec;
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: var(--kids-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: transform .15s ease;
}

.say-btn:hover { transform: scale(1.1); }
.say-btn:active { transform: scale(0.9); }

.prompt-text {
    font-family: var(--kids-font-title);
    font-size: clamp(1.1rem, 3.4vw, 1.5rem);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

/* ---------- Riscontro ---------- */
.feedback-msg {
    min-height: 3.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--kids-font-title);
    font-size: clamp(1.1rem, 3.4vw, 1.45rem);
    font-weight: 600;
    text-align: center;
    padding: 0 4px;
}

.feedback-msg span {
    display: inline-block;
    padding: 0.35rem 1.2rem;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--kids-shadow-sm);
    animation: toastIn .35s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes toastIn {
    from { opacity: 0; transform: scale(.6) translateY(8px); }
}

.feedback-msg.correct span { color: #15803d; border: 2px solid #bbf7d0; background: #f0fdf4; }
.feedback-msg.wrong span   { color: #b91c1c; border: 2px solid #fecaca; background: #fef2f2; }

.streak-badge {
    position: fixed;
    top: 18%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #f97316, #fbbf24);
    color: #fff;
    font-family: var(--kids-font-title);
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem 1.6rem;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(249, 115, 22, .4);
    opacity: 0;
    pointer-events: none;
    z-index: 40;
}

.streak-badge.show { animation: badgePop 1.4s ease forwards; }

@keyframes badgePop {
    0%   { opacity: 0; transform: translateX(-50%) scale(.4); }
    15%  { opacity: 1; transform: translateX(-50%) scale(1.15); }
    25%  { transform: translateX(-50%) scale(1); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) scale(.9) translateY(-18px); }
}

/* ---------- Schermata finale ---------- */
.result-content {
    background: #fff;
    border: 3px solid #d7efec;
    color: var(--ink);
    padding: clamp(1.6rem, 5vw, 3rem);
    border-radius: 28px;
    text-align: center;
    width: min(480px, 94%);
    box-shadow: var(--kids-shadow);
}

.stars-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: clamp(2.4rem, 8vw, 3.4rem);
    margin-bottom: 0.4rem;
    min-height: 1.2em;
}

.stars-row .star { filter: grayscale(1) opacity(.35); }

.stars-row .star.earned {
    filter: none;
    animation: starPop .5s cubic-bezier(.34, 1.56, .64, 1) backwards;
}

@keyframes starPop {
    from { transform: scale(0) rotate(-40deg); }
}

.end-icon {
    font-size: clamp(3rem, 9vw, 4.2rem);
    margin-bottom: 0.6rem;
    animation: heroBob 2.4s ease-in-out infinite;
}

#end-title {
    font-family: var(--kids-font-title);
    font-size: clamp(1.8rem, 5.5vw, 2.4rem);
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: var(--brand);
}

.final-score {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink-2);
    margin: 0 0 1.6rem;
}

.final-score span {
    color: var(--accent);
    font-family: var(--kids-font-title);
    font-size: 1.45rem;
}

.action-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.btn-big {
    appearance: none;
    font-family: var(--kids-font-title);
    font-size: 1.15rem;
    font-weight: 600;
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform .15s ease, box-shadow .15s ease;
}

.btn-big.primary   { background: var(--brand); color: #fff; box-shadow: 0 5px 0 #063d42; }
.btn-big.secondary { background: var(--accent); color: #4a3200; box-shadow: 0 5px 0 #b97b00; }
.btn-big.ghost     { background: #fff; color: var(--brand); border: 2px solid var(--brand); box-shadow: 0 5px 0 rgba(10, 91, 99, .25); }

.btn-big:hover { transform: translateY(-2px); }
.btn-big:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }

/* ---------- Coriandoli ---------- */
.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 60;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -5vh;
    width: 10px;
    height: 15px;
    border-radius: 3px;
    animation: confettiFall linear forwards;
}

.confetti-piece.round { height: 10px; border-radius: 50%; }

@keyframes confettiFall {
    to { top: 108vh; transform: translateX(var(--drift)) rotate(var(--spin)); }
}

/* ---------- Header (bottone "Torna alle App") ---------- */
.site-header .btn {
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border-radius: 14px;
    box-shadow: none;
}

/* ============================================================
   IL LUCCHETTO
   ============================================================ */

/* Larghezza di una casella: la stessa per il bigliettino e per le
   fessure del lucchetto, così l'indizio sta proprio sopra il suo posto. */
.scena-lucchetto {
    --cella: clamp(48px, 13vw, 72px);
    --spazio: clamp(6px, 1.6vw, 10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
}

/* Il bigliettino giallo con il codice da copiare */
.bigliettino {
    display: flex;
    gap: var(--spazio);
    padding: 10px 12px 12px;
    background: #fef08a;
    border-radius: 6px 6px 14px 6px;
    box-shadow: 0 4px 0 rgba(161, 98, 7, .18), 0 6px 14px rgba(161, 98, 7, .14);
    transform: rotate(-1.5deg);
    position: relative;
}

/* lo scotch che lo tiene attaccato */
.bigliettino::before {
    content: '';
    position: absolute;
    top: -9px;
    left: 50%;
    width: 56px;
    height: 18px;
    transform: translateX(-50%) rotate(2deg);
    background: rgba(255, 255, 255, .7);
    border: 1px solid rgba(0, 0, 0, .06);
    border-radius: 2px;
}

.indizio {
    width: var(--cella);
    min-height: var(--cella);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 10px;
    border: 2px dashed rgba(161, 98, 7, .35);
    transition: background .2s ease, border-color .2s ease, opacity .3s ease;
}

.indizio .cifra-grande {
    font-family: var(--kids-font-title);
    font-weight: 700;
    font-size: calc(var(--cella) * .58);
    line-height: 1;
    color: #713f12;
}

/* L'indizio della casella da riempire adesso: è l'aiuto che dice
   DOVE guardare, non che cosa premere. */
.indizio.adesso {
    background: #fff;
    border: 3px solid #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, .2);
}

.indizio.fatto { opacity: .45; }

/* ---------- La memoria ----------
   Bigliettino coperto: i numeri e i pallini restano al loro posto (la
   casella non cambia misura) ma non si vedono; al loro posto un «?».
   La casella da riempire resta accesa: dice DOVE si è arrivati, non che cosa. */
.indizio { position: relative; }
.bigliettino.coperto { background: #fcd34d; }
.bigliettino.coperto .indizio > * { visibility: hidden; }
.bigliettino.coperto .indizio::after {
    content: '?';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: var(--kids-font-title);
    font-weight: 700;
    font-size: calc(var(--cella) * .55);
    color: #92400e;
}
.bigliettino.coperto .indizio.fatto { opacity: .55; }

.memo-bar { display: flex; justify-content: center; margin-top: 14px; }
.memo-btn { min-height: 48px; }
.memo-btn.nascosto { visibility: hidden; }

/* Mentre si guarda il bigliettino il tastierino aspetta: si vede, ma è spento. */
.tastierino.attesa .tasto { opacity: .45; filter: grayscale(.4); }

.indizio.sveglia { animation: sveglia .8s ease; }

@keyframes sveglia {
    20%, 60% { transform: rotate(-7deg) scale(1.08); }
    40%, 80% { transform: rotate(7deg) scale(1.08); }
}

/* Il lucchetto: l'arco SVG e il corpo con le fessure */
.lucchetto {
    position: relative;
    margin-top: 22px;   /* spazio per l'arco che si alza quando si apre: non deve coprire il bigliettino */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lucchetto .arco {
    width: clamp(110px, 30vw, 150px);
    height: auto;
    display: block;
    margin-bottom: -6px;
    transition: transform .55s cubic-bezier(.34, 1.56, .64, 1);
    transform-origin: 26% 100%;
}

.lucchetto.aperto .arco {
    transform: translateY(-22%) rotate(-14deg);
}

.lucchetto .corpo {
    position: relative;
    padding: 14px 16px 16px;
    min-width: clamp(140px, 40vw, 190px);
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 55%, #d97706 100%);
    border: 3px solid #b45309;
    border-radius: 18px;
    box-shadow: 0 6px 0 #92400e, var(--kids-shadow-sm);
    display: flex;
    justify-content: center;
    transition: background .4s ease, border-color .4s ease, box-shadow .4s ease;
}

.lucchetto.aperto .corpo {
    background: linear-gradient(180deg, #86efac 0%, #22c55e 60%, #16a34a 100%);
    border-color: #15803d;
    box-shadow: 0 6px 0 #166534, 0 0 0 6px rgba(34, 197, 94, .2);
    animation: apertoPop .6s ease;
}

@keyframes apertoPop {
    40% { transform: scale(1.06) rotate(-2deg); }
    70% { transform: scale(.98) rotate(1deg); }
}

.lucchetto.chiuso-scossa .corpo { animation: scossaLucchetto .5s ease; }

@keyframes scossaLucchetto {
    20%, 60% { transform: translateX(-7px); }
    40%, 80% { transform: translateX(7px); }
}

.fessure {
    display: flex;
    gap: var(--spazio);
}

.fessura {
    width: var(--cella);
    height: calc(var(--cella) * 1.15);
    border-radius: 10px;
    background: #fff;
    border: 3px solid #92400e;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, .14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--kids-font-title);
    font-weight: 700;
    font-size: calc(var(--cella) * .62);
    color: var(--ink);
    line-height: 1;
}

/* La casella da riempire adesso lampeggia piano */
.fessura.adesso {
    border-color: #0A5B63;
    box-shadow: inset 0 4px 6px rgba(0, 0, 0, .1), 0 0 0 4px rgba(10, 91, 99, .25);
    animation: respiro 1.4s ease-in-out infinite;
}

@keyframes respiro {
    50% { box-shadow: inset 0 4px 6px rgba(0, 0, 0, .1), 0 0 0 7px rgba(10, 91, 99, .12); }
}

.fessura.piena { animation: entraCifra .35s cubic-bezier(.34, 1.56, .64, 1); }

@keyframes entraCifra {
    from { transform: scale(.4); }
}

/* ---------- I pallini (dado e tabella del dieci) ---------- */
.pallini {
    display: grid;
    gap: 2px;
}

.pallini.dado {
    grid-template-columns: repeat(3, 1fr);
    width: calc(var(--dim, 40px));
    aspect-ratio: 1;
}

.pallini.dieci {
    grid-template-columns: repeat(5, 1fr);
    width: calc(var(--dim, 40px) * 1.3);
    aspect-ratio: 5 / 2;
}

.pallini i {
    display: block;
    border-radius: 50%;
    aspect-ratio: 1;
}

.pallini i.si { background: var(--pallino, #dc2626); }
.pallini.dieci i.no { border: 1.5px solid rgba(0, 0, 0, .18); }

.indizio .pallini { --dim: calc(var(--cella) * .78); --pallino: #b91c1c; }
/* Nel bigliettino la tabella del dieci sta in VERTICALE: due colonne da
   cinque, riempite colonna per colonna (il 7 resta «cinque e ancora due»).
   In orizzontale, dentro una casella quadrata, i pallini venivano di 8 px
   sul telefono e 7, 8 e 9 non si distinguevano. */
.indizio .pallini.dieci {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr);
    grid-auto-flow: column;
    width: calc(var(--cella) * .56);
    aspect-ratio: 2 / 5;
    gap: 3px;
    margin: 4px 0;
}

/* ---------- Il tastierino ---------- */
.tastierino {
    display: grid;
    gap: clamp(8px, 2.2vw, 14px);
    justify-content: center;
    width: 100%;
    margin-bottom: 0.3rem;
}

/* tre tasti grandi (Piccolissimi) */
.tastierino.t3 { grid-template-columns: repeat(3, minmax(0, 150px)); }
/* cinque tasti (Facile) */
.tastierino.t5 { grid-template-columns: repeat(5, minmax(0, 118px)); }
/* da 0 a 9, come un vero tastierino (Medio, Difficile, Esplora) */
.tastierino.t10 { grid-template-columns: repeat(3, minmax(0, 120px)); }
.tastierino.t10 .tasto.zero { grid-column: 2; }

.tasto {
    appearance: none;
    position: relative;
    background: #fff;
    border: 3px solid #cbd5e1;
    border-radius: var(--kids-radius);
    box-shadow: 0 6px 0 #94a3b8, var(--kids-shadow-sm);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    min-height: 64px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    font-family: var(--kids-font-title);
    color: var(--ink);
    transition: transform .12s ease, box-shadow .12s ease, border-color .15s ease, background .15s ease, opacity .3s ease;
    animation: cardIn .35s cubic-bezier(.34, 1.56, .64, 1) backwards;
    overflow: hidden;
}

@keyframes cardIn {
    from { opacity: 0; transform: scale(.6); }
}

.tastierino.t3 .tasto,
.tastierino.t5 .tasto { aspect-ratio: 1; }

.tastierino.t10 .tasto { aspect-ratio: 1.45; }

.tasto .cifra {
    font-size: clamp(1.9rem, 6vw, 2.6rem);
    font-weight: 700;
    line-height: 1;
}

.tastierino.t3 .tasto .cifra { font-size: clamp(2.6rem, 10vw, 3.6rem); }

.tasto .pallini { --dim: clamp(28px, 7vw, 40px); --pallino: #0A5B63; }
.tastierino.t3 .tasto .pallini { --dim: clamp(36px, 10vw, 52px); }
.tastierino.t10 .tasto .pallini { --dim: clamp(20px, 5vw, 28px); }

.tasto:hover {
    transform: translateY(-3px);
    border-color: #94a3b8;
    box-shadow: 0 9px 0 #94a3b8, var(--kids-shadow);
}

/* il tasto si abbassa davvero: è la conferma che il tocco è arrivato */
.tasto:active,
.tasto.premuto {
    transform: translateY(5px);
    box-shadow: 0 1px 0 #94a3b8;
}

.tasto.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.tasto.wrong {
    border-color: #ef4444;
    background: #fef2f2;
    animation: shakeCard .5s ease;
}

@keyframes shakeCard {
    20%, 60% { transform: translateX(-9px); }
    40%, 80% { transform: translateX(9px); }
}

/* Il tasto già provato per QUESTA casella: resta al suo posto, spento.
   Torna acceso alla casella dopo, perché lì potrebbe servire.
   animation:none è obbligatorio (vedi GUIDA-APP-KIDS.md, cap. 3). */
.tasto.fuori {
    opacity: .3;
    pointer-events: none;
    filter: grayscale(1);
    box-shadow: none;
    transform: none;
    animation: none;
}

.tasto.locked { pointer-events: none; }

/* Scintille */
.sparkle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    animation: sparkleFly .65s ease-out forwards;
    z-index: 3;
}

@keyframes sparkleFly {
    from { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    to   { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.1); opacity: 0; }
}

/* Esplora: il bigliettino mostra il numero appena toccato */
.bigliettino.libero { min-width: calc(var(--cella) * 2.2); min-height: calc(var(--cella) + 24px); justify-content: center; }
.bigliettino.libero .indizio { border: none; width: auto; min-width: var(--cella); flex-direction: row; gap: 10px; }
.bigliettino.libero:empty { visibility: hidden; }

/* ---------- Touch ----------
   kids-base.css impone min-height:44px a tutti i button sugli schermi
   touch: sui pulsanti tondi alzava solo l'altezza. NON togliere. */
@media (pointer: coarse) {
    .hud-btn, .say-btn { min-width: 44px; min-height: 44px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .level-grid { grid-template-columns: minmax(200px, 340px); }

    .level-icon { font-size: 2rem; }
    .level-name { font-size: 1.15rem; }
    .level-desc { font-size: 0.85rem; }

    .hud { flex-wrap: wrap; gap: 8px; }
    .hud-progress { order: 3; width: 100%; flex-basis: 100%; }
    .hud-right { margin-left: auto; }
    .hud-pill { font-size: 1rem; padding: 0.4rem 0.8rem; }

    .prompt-card { padding: 0.9rem 0.8rem 1rem; }
    .prompt-text { padding: 0 3rem; }
    .say-btn { top: 0.6rem; right: 0.6rem; }

    /* il tastierino cambia forma, non solo scala */
    .tastierino.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tastierino.t5 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .tastierino.t5 .tasto { grid-column: span 2; }
    .tastierino.t5 .tasto:nth-child(4) { grid-column: 2 / span 2; }
    .tastierino.t10 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .tasto { border-width: 2px; }
}

/* Meno animazioni se richiesto dal sistema */
@media (prefers-reduced-motion: reduce) {
    .hero-item,
    .bg-decor span,
    .end-icon,
    .tasto,
    .fessura,
    .indizio,
    .lucchetto .corpo,
    .screen.active {
        animation: none !important;
    }
    .lucchetto .arco { transition: none; }
}

/* ---------- Pulsante dell'audio ---------- */
.hud-btn.audio-btn { border-color: #ffe1a6; background: #fff8ec; }
.hud-btn.audio-btn.spento { border-color: #fecaca; background: #fef2f2; opacity: .85; }
