/* ============================================================
   MEMORY MAGICO — stile locale
   Carica prima css/kids-base.css (variabili, header, footer).
   ============================================================ */

/* ---------- 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);
    background:
        radial-gradient(620px 320px at 6% -40px, rgba(139, 92, 246, .12), transparent 60%),
        radial-gradient(720px 420px at 104% 104%, rgba(254, 168, 0, .12), transparent 60%),
        linear-gradient(180deg, #f5f3ff 0%, #ecfeff 100%);
}

/* Carte e simboli decorativi sullo sfondo */
.bg-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.bg-decor .decor-shape {
    position: absolute;
    opacity: .13;
    animation: decorFloat 9s ease-in-out infinite alternate;
}

.bg-decor .decor-char {
    position: absolute;
    opacity: .12;
    font-family: var(--kids-font-title);
    font-weight: 700;
    color: var(--brand);
    animation: decorFloat 9s ease-in-out infinite alternate;
    line-height: 1;
}

@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 ---------- */
/* Selettore della lingua (IT / EN / ES / FR) */
.lang-switch {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 1rem;
}

.lang-btn {
    appearance: none;
    border: 2px solid #e2dcf5;
    background: #fff;
    border-radius: 999px;
    padding: 7px 14px;
    font-family: var(--kids-font-title);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink-2);
    cursor: pointer;
    box-shadow: var(--kids-shadow-sm);
    transition: transform .15s ease, background .15s ease, color .15s ease;
}

.lang-btn:hover {
    transform: translateY(-2px);
}

.lang-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* Carte del "logo": una per ogni tipo di coppia */
.hero-cards {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2.5vw, 18px);
    margin-bottom: 0.9rem;
    min-height: 92px;
}

.hero-card {
    width: clamp(58px, 10vw, 84px);
    aspect-ratio: 1;
    background: #fff;
    border: 3px solid #d7efec;
    border-radius: 16px;
    box-shadow: 0 5px 0 rgba(10, 91, 99, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: heroBob 2.6s ease-in-out infinite;
}

.hero-card:nth-child(1) { rotate: -6deg; }
.hero-card:nth-child(2) { rotate: 4deg;  animation-delay: .35s; }
.hero-card:nth-child(3) { rotate: -3deg; animation-delay: .7s; }
.hero-card:nth-child(4) { rotate: 6deg;  animation-delay: 1.05s; }

.hero-card svg { width: 72%; height: 72%; }
.hero-card .he { font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1; }
.hero-card .hl {
    font-family: var(--kids-font-title);
    font-size: clamp(2rem, 6.5vw, 2.8rem);
    font-weight: 700;
    color: var(--brand);
}
.hero-card .hn {
    font-family: var(--kids-font-title);
    font-size: clamp(2rem, 6.5vw, 2.8rem);
    font-weight: 700;
    color: #7c3aed;
}

@keyframes heroBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

.game-title {
    font-family: var(--kids-font-title);
    font-size: clamp(2.2rem, 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;
}

/* Card delle modalità */
.level-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 250px));
    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: 1.1rem 0.9rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    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.forme   { --lvl: #f59e0b; --lvl-dark: #b45309; --lvl-soft: #fffbeb; }
.level-card.lettere { --lvl: #3b82f6; --lvl-dark: #1d4ed8; --lvl-soft: #eff6ff; }
.level-card.numeri  { --lvl: #8b5cf6; --lvl-dark: #6d28d9; --lvl-soft: #f5f3ff; }
.level-card.mix     { --lvl: #ec4899; --lvl-dark: #be185d; --lvl-soft: #fdf2f8; }

/* Card larga "Mix" sotto le quattro modalità */
.level-card.wide {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    gap: 18px;
    padding: 1rem 1.2rem;
}

.level-card.wide .level-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 2px;
}

.level-card.wide .level-icon {
    min-height: auto;
}

.level-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 58px;
}

.level-icon svg {
    width: 44px;
    height: 44px;
}

.level-icon .mini {
    display: flex;
    align-items: center;
    gap: 4px;
}

.level-icon .mini svg {
    width: 32px;
    height: 32px;
}

.level-icon .pair-emoji { font-size: 2rem; line-height: 1; }

.level-icon .letter-demo {
    font-family: var(--kids-font-title);
    font-weight: 700;
    font-size: 2.1rem;
    line-height: 1;
    color: var(--brand);
}

.level-icon .letter-demo.low { color: #c2410c; }

.level-icon .digit-demo {
    font-family: var(--kids-font-title);
    font-weight: 700;
    font-size: 2.1rem;
    line-height: 1;
    color: #7c3aed;
}

.level-icon .eq {
    font-weight: 800;
    color: var(--ink-2);
    font-size: 1.2rem;
}

.level-icon .qty-demo {
    font-size: 1.05rem;
    letter-spacing: -2px;
    line-height: 1;
}

.level-name {
    font-family: var(--kids-font-title);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
}

.level-desc {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink-2);
}

/* ---------- Scheda informativa per 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 di gioco ---------- */
.hud {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 1.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;
}

.mode-pill {
    border-color: #d7efec;
    font-size: 1.05rem;
}

.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: #e2dcf5;
    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, #a78bfa, #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: 42px;
    height: 42px;
    font-size: 1.05rem;
    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;
    font-size: 1.2rem;
}

.hud-btn.home:hover {
    background: #ccfbf1;
}

/* ---------- Tabellone ---------- */
.board {
    display: grid;
    gap: clamp(8px, 2vw, 14px);
    justify-content: center;
    width: 100%;
    perspective: 1200px;
    margin-bottom: 0.6rem;
}

.board.n4  { grid-template-columns: repeat(2, minmax(110px, 150px)); }
.board.n6  { grid-template-columns: repeat(3, minmax(100px, 145px)); }
.board.n8  { grid-template-columns: repeat(4, minmax(92px, 138px)); }
.board.n12 { grid-template-columns: repeat(4, minmax(92px, 138px)); }
.board.n16 { grid-template-columns: repeat(4, minmax(0, 128px)); }

/* Carta memory con giro 3D */
.memory-card {
    appearance: none;
    border: none;
    background: transparent;
    padding: 0;
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: cardIn .35s cubic-bezier(.34, 1.56, .64, 1) backwards;
    transition: transform .15s ease;
}

@keyframes cardIn {
    from { opacity: 0; transform: scale(.55); }
}

.memory-card:not(.flipped):not(.matched):hover {
    transform: translateY(-4px);
}

.card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform .5s cubic-bezier(.4, 1.4, .6, 1);
}

.memory-card.flipped .card-inner,
.memory-card.matched .card-inner {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-back {
    background:
        radial-gradient(circle at 25% 20%, rgba(255, 255, 255, .18) 0%, transparent 45%),
        radial-gradient(circle at 80% 85%, rgba(0, 0, 0, .08) 0%, transparent 45%),
        linear-gradient(145deg, #2dd4bf, #0A5B63);
    border: 3px solid #0f766e;
    box-shadow: 0 5px 0 rgba(10, 91, 99, .35);
}

.card-back::after {
    content: '?';
    font-family: var(--kids-font-title);
    font-size: clamp(2rem, 7vw, 3rem);
    font-weight: 700;
    color: rgba(255, 255, 255, .75);
    text-shadow: 0 2px 0 rgba(10, 91, 99, .3);
}

.card-front {
    background: #fff;
    border: 3px solid #d7efec;
    box-shadow: 0 5px 0 rgba(10, 91, 99, .12);
    transform: rotateY(180deg);
    flex-direction: column;
    gap: 2px;
    padding: 7%;
}

/* Tinte leggere per distinguere i "tipi" di carta (aiutano la ricerca) */
.card-front.tint-up   { background: #eff6ff; }
.card-front.tint-low  { background: #fff7ed; }
.card-front.tint-num  { background: #f5f3ff; }

.memory-card.matched {
    transform: scale(.94);
    cursor: default;
    pointer-events: none;
}

.memory-card.matched .card-front {
    background: #f0fdf4;
    border-color: #22c55e;
    box-shadow: 0 4px 10px rgba(34, 197, 94, .3);
}

.memory-card.matched .card-inner {
    animation: matchPop .55s ease;
}

@keyframes matchPop {
    0%   { transform: rotateY(180deg) scale(1); }
    40%  { transform: rotateY(180deg) scale(1.12); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* Contenuti delle carte */
.card-emoji {
    font-size: clamp(1.9rem, 7vw, 3.1rem);
    line-height: 1.1;
}

.card-label {
    font-family: var(--kids-font-title);
    font-size: clamp(.62rem, 2vw, .85rem);
    font-weight: 600;
    color: var(--ink-2);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-shape {
    width: 100%;
    height: 78%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-shape svg {
    width: 82%;
    height: 100%;
    filter: drop-shadow(0 3px 4px rgba(15, 23, 42, .16));
}

.card-letter,
.card-digit {
    font-family: var(--kids-font-title);
    font-size: clamp(2.3rem, 9vw, 3.8rem);
    font-weight: 700;
    line-height: 1;
}

.card-letter.upper { color: var(--brand); }
.card-letter.lower { color: #c2410c; }
.card-digit        { color: #7c3aed; }

/* Quantità 1-6: disposizione come i punti del dado (griglia 3x3) */
.qty-dice {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    place-items: center;
}

.qd-cell {
    font-size: clamp(.9rem, 4vw, 1.6rem);
    line-height: 1;
}

/* Quantità 7-10: due file da cinque, come la tabella del dieci */
.ten-frame {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
    width: 100%;
}

.tf-cell {
    aspect-ratio: 1;
    border: 1.5px solid #cfe2e2;
    border-radius: 4px;
    background: #fbfefe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(.7rem, 3vw, 1.05rem);
    line-height: 1;
    min-width: 0;
}

/* Alla coppia trovata gli animaletti "si contano" uno alla volta */
.memory-card.matched .qd-cell.filled,
.memory-card.matched .tf-cell.filled {
    animation: cellPop .45s ease both;
    animation-delay: calc(var(--d) * .32s);
}

@keyframes cellPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* Scintille sulla coppia trovata */
.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; }
}

/* Badge serie di coppie di fila */
.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); }
}

/* ---------- Avviso di fine livello ---------- */
.round-toast {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    background: rgba(240, 253, 250, .78);
    backdrop-filter: blur(3px);
}

.round-toast.show {
    display: flex;
    animation: fadeIn .3s ease-out;
}

.toast-card {
    background: #fff;
    border: 3px solid #d7efec;
    border-radius: 24px;
    padding: 1.8rem 2.6rem;
    text-align: center;
    box-shadow: var(--kids-shadow);
    animation: toastPop .45s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes toastPop {
    from { opacity: 0; transform: scale(.5); }
}

.toast-emoji {
    font-size: 3.4rem;
    line-height: 1.15;
}

.toast-text {
    font-family: var(--kids-font-title);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand);
    margin-top: 0.4rem;
}

/* ---------- 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;
}

/* Pulsanti grandi */
.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;
}

/* ---------- Touch ----------
   kids-base.css impone min-height:44px a tutti i button sugli schermi
   touch: sui pulsanti tondi alzava solo l'altezza e li schiacciava in
   ovali. Il minimo va imposto anche in larghezza. */
@media (pointer: coarse) {
    .hud-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .level-grid {
        grid-template-columns: minmax(200px, 320px);
    }

    .level-card {
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        padding: 0.8rem 1.1rem;
        text-align: left;
    }

    .level-icon { min-height: auto; }
    .level-icon svg { width: 36px; height: 36px; }
    .level-icon .mini svg { width: 26px; height: 26px; }
    .level-icon .pair-emoji { font-size: 1.6rem; }
    .level-icon .letter-demo,
    .level-icon .digit-demo { font-size: 1.7rem; }

    .level-name { font-size: 1.15rem; }
    .level-desc { font-size: 0.85rem; }

    .level-card .level-name { margin-right: auto; }

    .level-card.wide .level-desc { font-size: 0.8rem; }

    .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; }
    .mode-pill { font-size: .95rem; }

    .board { gap: 8px; }
    .board.n4  { grid-template-columns: repeat(2, minmax(96px, 132px)); }
    .board.n6  { grid-template-columns: repeat(3, minmax(0, 120px)); }
    .board.n8  { grid-template-columns: repeat(4, minmax(0, 110px)); }
    .board.n12 { grid-template-columns: repeat(4, minmax(0, 110px)); }
    .board.n16 { grid-template-columns: repeat(4, minmax(0, 105px)); }

    /* Numeri: 12 carte su 3 colonne, per carte-quantità più grandi */
    .board.mode-numeri.n12 { grid-template-columns: repeat(3, minmax(0, 118px)); }

    .card-back::after { font-size: 1.7rem; }
    .toast-card { padding: 1.4rem 1.8rem; }
    .toast-text { font-size: 1.25rem; }
}

@media (max-width: 400px) {
    .board.n4 { grid-template-columns: repeat(2, minmax(88px, 120px)); }
}

/* Meno animazioni se richiesto dal sistema */
@media (prefers-reduced-motion: reduce) {
    .hero-card,
    .bg-decor .decor-shape,
    .bg-decor .decor-char,
    .end-icon,
    .memory-card,
    .screen.active {
        animation: none !important;
    }
}

/* ---------- Pulsante dell'audio ----------
   Sta nell'HUD accanto al 🏠: si spegne mentre si gioca. Da spento
   resta ben visibile che è spento, altrimenti un adulto pensa che
   l'app sia rotta. */
.hud-btn.audio-btn { border-color: #ffe1a6; background: #fff8ec; }
.hud-btn.audio-btn.spento { border-color: #fecaca; background: #fef2f2; opacity: .85; }
