/* LA VOCE: la mascotte. Corpo con braccia e gambe dalla prova C, occhi che seguono dalla prova D (D-90). */

/* --- il caricamento: la mascotte si presenta e poi va al suo posto, senza bottoni --- */
.arrivo { position: fixed; inset: 0; z-index: 190; background: var(--grigio); color: var(--inchiostro); display: grid; place-items: center; text-align: center; padding: 24px;
  transition: opacity .6s ease .35s, visibility 0s linear 1s; }
.arrivo.via { opacity: 0; visibility: hidden; }
.arrivo .posto { width: min(58vw, 260px); aspect-ratio: 1; margin: 0 auto 18px; }
.arrivo p { font: 400 19px/1.4 var(--macchina); margin: 0 auto; max-width: 17em; min-height: 2.8em; }
.arrivo p em { font-style: normal; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--arancio) 55%, transparent) 62%); }
.arrivo .cursore { display: inline-block; width: .55em; border-bottom: 2px solid currentColor; animation: cursore .8s steps(1) infinite; }
@keyframes cursore { 50% { opacity: 0; } }

/* --- la mascotte in basso a destra --- */
.mascotte { position: fixed; z-index: 150; left: 0; bottom: calc(10px + env(safe-area-inset-bottom)); width: 86px; height: 86px;
  transform: translate3d(var(--mx, calc(100vw - 98px)), var(--my, 0px), 0); transition: transform .7s cubic-bezier(.3,1.25,.5,1); will-change: transform; }
.mascotte .corpo-btn { transition: transform .5s var(--molla); }
/* le pose: cammina sul fondo, appesa al bordo destro, sbircia dal bordo sinistro */
.mascotte.verso-sx .corpo-btn { transform: scaleX(-1); }
.mascotte.appesa .corpo-btn { transform: rotate(-78deg) translateY(-14px); }
.mascotte.sbircia .corpo-btn { transform: rotate(80deg) translateY(-10px); }
.mascotte.salta .pupazzo { animation: saltello .45s ease-out; }
@keyframes saltello { 0% { transform: translateY(0); } 40% { transform: translateY(-16px) rotate(-4deg); } 100% { transform: translateY(0); } }
.mascotte.cammina .pupazzo .gamba.sx { animation: passo .5s ease-in-out infinite; }
.mascotte.cammina .pupazzo .gamba.dx { animation: passo .5s ease-in-out infinite reverse; }
.mascotte.cammina .pupazzo .braccio.sx { animation: passo .5s ease-in-out infinite reverse; }
@keyframes passo { 0%, 100% { transform: rotate(18deg); } 50% { transform: rotate(-18deg); } }
.mascotte.appesa .pupazzo .braccio.dx, .mascotte.appesa .pupazzo .braccio.sx { transform: rotate(-60deg); }
/* il fumetto segue la mascotte: a sinistra se lei è a destra, a destra se è a sinistra */
.mascotte.lato-sx .fumetto-m { right: auto; left: 74px; border-radius: 16px 16px 16px 4px; transform-origin: 0 100%; }
.mascotte.appesa .fumetto-m { bottom: 90px; }
.mascotte .corpo-btn { position: absolute; inset: 0; border: 0; background: none; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mascotte svg { width: 100%; height: 100%; overflow: visible; }
.pupazzo .arto { fill: none; stroke: var(--inchiostro); stroke-width: 4.2; stroke-linecap: round; }
.pupazzo .alone { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; }
.pupazzo .guanto { fill: #fff; stroke: var(--inchiostro); stroke-width: 2; }
.pupazzo .scarpa { fill: var(--inchiostro); stroke: #fff; stroke-width: 1.5; }
.pupazzo .occhio { fill: #fff; stroke: var(--inchiostro); stroke-width: 1.6; }
.pupazzo .pupilla { fill: var(--inchiostro); transition: transform .12s; }
.pupazzo .palpebra { transform-box: fill-box; transform-origin: 50% 50%; animation: batti 5.2s infinite; }
@keyframes batti { 0%, 47%, 51%, 100% { transform: scaleY(1); } 49% { transform: scaleY(.08); } }
.pupazzo .corpo { transform-box: fill-box; transform-origin: 50% 100%; animation: respira 3.2s ease-in-out infinite; }
@keyframes respira { 50% { transform: translateY(-1.5px) scaleY(1.02); } }
.pupazzo .braccio { transform-box: view-box; transform-origin: var(--spalla); }
.pupazzo .gamba { transform-box: view-box; transform-origin: var(--anca); }
.parla .pupazzo .braccio.dx { animation: saluta .5s ease-in-out 3 alternate; }
.parla .pupazzo .corpo { animation: salta .35s ease-in-out 2 alternate; }
@keyframes saluta { from { transform: rotate(0); } to { transform: rotate(-38deg); } }
@keyframes salta { to { transform: translateY(-5px); } }
.mascotte:hover .pupazzo .braccio.dx { animation: saluta .4s ease-in-out infinite alternate; }

/* il fumetto, a macchina da scrivere */
.fumetto-m { position: absolute; right: 70px; bottom: 50px; width: min(236px, calc(100vw - 100px)); background: #fff; color: var(--inchiostro); border: 2px solid var(--inchiostro); border-radius: 16px 16px 4px 16px;
  padding: 9px 11px; font: 400 13px/1.35 var(--macchina); box-shadow: 4px 4px 0 var(--inchiostro); opacity: 0; transform: translateY(8px) scale(.96); transform-origin: 100% 100%;
  transition: opacity .25s, transform .3s var(--molla); pointer-events: none; }
.fumetto-m.su { opacity: 1; transform: none; pointer-events: auto; }
.fumetto-m small { display: block; margin-top: 6px; font: 600 10px/1 var(--sans); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; color: var(--testo-2); }

/* --- l'aiuto: domande frequenti come chiacchierata --- */
.aiuto { position: fixed; z-index: 160; right: 0; left: 0; bottom: 0; max-height: 82svh; display: flex; flex-direction: column; background: var(--grigio); color: var(--inchiostro);
  border-top: 2px solid var(--inchiostro); border-radius: 14px 14px 0 0; transform: translateY(105%); transition: transform .45s var(--morbido); max-width: 460px; margin-left: auto;
  box-shadow: 0 -20px 50px rgba(0,0,0,.2); }
@media (min-width: 700px) { .aiuto { right: 16px; bottom: 16px; left: auto; width: 420px; border: 2px solid var(--inchiostro); border-radius: 14px; } }
.aiuto.aperto { transform: none; }
.aiuto header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1.5px dashed var(--inchiostro); }
.aiuto header .mini { width: 42px; height: 42px; flex: none; }
.aiuto header b { font: 800 16px/1.1 var(--sans); flex: 1; }
.aiuto header small { display: block; font: 400 12px/1.3 var(--macchina); color: var(--testo-2); }
.aiuto .chiudi { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--inchiostro); background: none; font-size: 20px; cursor: pointer; }
.aiuto .chat { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.aiuto .msg { max-width: 86%; padding: 9px 12px; border-radius: 14px; font-size: 15px; line-height: 1.4; animation: entra .3s var(--molla) both; }
.aiuto .msg.lei { background: #fff; border: 1.5px solid var(--inchiostro); border-bottom-left-radius: 4px; font-family: var(--macchina); }
.aiuto .msg.tu { align-self: flex-end; background: var(--inchiostro); color: #fff; border-bottom-right-radius: 4px; }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
.aiuto .domande { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--grigio-2); }
.aiuto .domande button { border: 1.5px solid var(--inchiostro); background: #fff; border-radius: 999px; padding: 8px 12px; font: 600 13px/1 var(--sans); cursor: pointer; }
.aiuto .domande button:hover { background: var(--inchiostro); color: #fff; }
@media (min-width: 900px) { .fumetto-m { width: 290px; font-size: 14px; } }
@media (max-width: 600px) { .mascotte { width: 70px; height: 70px; } .fumetto-m { right: 60px; bottom: 44px; } .mascotte.lato-sx .fumetto-m { left: 60px; } }
@media (max-width: 600px) { .fumetto-m { width: min(205px, calc(100vw - 96px)); font-size: 12.5px; } .fumetto-m small { display: none; } }
