/* Barra in basso (js/tabbar.js): tenendo premuto un tasto si alza, si trascina e si lascia dove si vuole;
   gli altri scorrono al posto nuovo. «Nuovo» resta fermo al centro. */
.bottombar { touch-action: none; }
.bottombar .bb { transition: transform .18s ease; }
.bottombar .bb.is-lift { z-index: 2; transition: none; color: var(--accent); }
.bottombar .bb.is-lift::before {
  content: ''; position: absolute; inset: 2px 4px; z-index: -1; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); box-shadow: var(--shadow);
}
.bottombar.is-drag .bb:not(.is-lift):not(.bb-add) { opacity: .7; }
@media (prefers-reduced-motion: reduce) { .bottombar .bb { transition: none; } }

/* «Vetro sospeso» (Stefano 5/11/2026, proposta 07 di demo/proposte/barra): sul telefono la barra si stacca dal fondo,
   è di vetro e sotto si vede passare il calendario. Una lente scivola sul tasto attivo (la mette js/tabbar.js con
   --lx e --lw) e ogni tasto toccato ha la sua animazione: il foglio del calendario si gira, da Social parte un
   aeroplanino come un messaggio, il cuore di Health batte per 5 secondi, il profilo saluta con un anello.
   Lente e animazioni partono SEMPRE, anche con «Riduci movimento» acceso sul telefono (5/11, Stefano: «deve funzionare
   punto e stop»): per questo hanno !important, che batte la regola di styles.css che con «Riduci movimento» spegne
   tutte le animazioni della app (* { animation: none !important }). Il trascinamento dei tasti resta com'era. */
@media (max-width: 820px) {
  :root { --bar-h: 72px; } /* 62 di barra + 10 di aria sotto: pagine, contenuto e avvisi finiscono sopra il vetro */
  .bottombar {
    align-items: start; padding: 0 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: transparent; border-top: 0;
  }
  .bottombar.six { padding-inline: 12px; } /* coach, 6 tasti: anche loro dentro il vetro */
  /* con una pagina aperta, intorno al vetro il colore della pagina (non il calendario che c'è sotto) */
  body.has-screen .bottombar { background: var(--strip, var(--surface)); } /* --strip: il colore della pagina in cima (js/tabbar.js) */
  .bottombar::before {
    content: ''; position: absolute; z-index: -1; left: 10px; right: 10px; top: 0; bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-radius: 31px; border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
    background: color-mix(in srgb, var(--surface) 62%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(1.7); backdrop-filter: blur(18px) saturate(1.7);
    box-shadow: 0 2px 4px rgb(0 0 0 / .08), 0 10px 26px rgb(0 0 0 / .16);
  }
  .bottombar::after {
    content: ''; position: absolute; z-index: 0; top: 6px; height: 50px; left: var(--lx, 0px); width: var(--lw, 0px); border-radius: 25px;
    background: color-mix(in srgb, var(--ink) 9%, transparent);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), inset 0 -1px 0 rgb(0 0 0 / .06);
    opacity: 0; pointer-events: none; transition: opacity .2s !important;
  }
  .bottombar.has-lens::after { opacity: 1; }
  .bottombar.lens-ready::after {
    transition: left .5s cubic-bezier(.3, 1.3, .45, 1), width .5s cubic-bezier(.3, 1.3, .45, 1), scale .25s ease, opacity .2s !important;
  }
  .bottombar.is-moving::after { scale: 1.16 .88; }
  .bottombar.is-drag::after { opacity: 0; }
  .bottombar .bb { z-index: 1; height: 62px; justify-content: center; padding: 0; font-size: 10px; }
  .bottombar .bb-add { padding: 0; }
  .bottombar .bb-add .bb-l { display: none; } /* la formica basta: il nome resta nell'aria-label */
  .bottombar .bb-plus { width: 44px; height: 44px; margin-top: 0; }

  /* le animazioni dei tasti (js/tabbar.js mette e toglie le classi fx-…) */
  .bb-fx { position: absolute; left: 50%; pointer-events: none; }
  /* Calendario: il foglio fa un giro e il puntino rimbalza */
  .bb.fx-cal > svg { animation: fx-flip .8s cubic-bezier(.3, 1.2, .5, 1) !important; }
  .bb.fx-cal > svg circle { animation: fx-dot .8s ease !important; transform-box: fill-box; transform-origin: center; }
  @keyframes fx-flip { 0% { transform: perspective(60px) rotateX(0); } 65% { transform: perspective(60px) rotateX(-380deg); } 100% { transform: perspective(60px) rotateX(-360deg); } }
  @keyframes fx-dot { 0%, 45% { transform: none; } 65% { transform: scale(2.1); } 100% { transform: none; } }
  /* Social: la nuvoletta si stringe e parte un aeroplanino, come un messaggio spedito */
  .bb.fx-send > svg { animation: fx-squeeze .55s ease !important; }
  @keyframes fx-squeeze { 0%, 100% { transform: none; } 30% { transform: scale(.8) rotate(-8deg); } 65% { transform: scale(1.1); } }
  .bb-fx.fx-plane { width: 21px; height: 21px; margin-left: -10px; color: var(--accent); opacity: 0; animation: fx-plane 1.05s cubic-bezier(.45, 0, .55, 1) .12s forwards !important; }
  .bb-fx.fx-plane svg { display: block; width: 100%; height: 100%; }
  @keyframes fx-plane {
    0% { transform: translate(0, 3px) scale(.4); opacity: 0; }
    15% { transform: translate(-3px, 1px) scale(.95) rotate(-12deg); opacity: 1; }
    100% { transform: translate(38px, -52px) scale(.7) rotate(14deg); opacity: 0; }
  }
  /* Health: il cuore si riempie e batte per 5 secondi, con un'onda a ogni battito */
  .bb.fx-beat > svg { animation: fx-beat 1s ease-in-out 5 !important; transform-origin: 50% 55%; }
  .bb.fx-beat > svg path { fill: currentColor; }
  @keyframes fx-beat { 0%, 100% { transform: none; } 12% { transform: scale(1.3); } 24% { transform: scale(1.02); } 36% { transform: scale(1.22); } 60% { transform: none; } }
  .bb-fx.fx-wave { z-index: -1; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: fx-wave 1s ease-out 5 !important; }
  @keyframes fx-wave { 0% { transform: scale(.7); opacity: .7; } 70%, 100% { transform: scale(2.1); opacity: 0; } }
  /* Profilo: la testa fa sì e un anello si disegna intorno, come una foto profilo */
  .bb.fx-hi > svg circle { animation: fx-nod .8s ease !important; transform-box: fill-box; transform-origin: center; }
  @keyframes fx-nod { 0%, 100% { transform: none; } 25% { transform: translateY(-3px); } 50% { transform: none; } 72% { transform: translateY(-1.5px); } }
  .bb-fx.fx-ring { width: 38px; height: 38px; margin-left: -19px; color: var(--accent); animation: fx-ring-out 1.3s ease forwards !important; }
  .bb-fx.fx-ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
  .bb-fx.fx-ring circle { stroke-dasharray: 113.1; stroke-dashoffset: 113.1; animation: fx-ring .65s cubic-bezier(.4, 0, .2, 1) forwards !important; }
  @keyframes fx-ring { to { stroke-dashoffset: 0; } }
  @keyframes fx-ring-out { 0%, 65% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(1.25); } }
  /* Atleti (coach): un saltello */
  .bb.fx-hop > svg { animation: fx-hop .55s cubic-bezier(.3, .7, .4, 1) !important; }
  @keyframes fx-hop { 0%, 100% { transform: none; } 35% { transform: translateY(-7px) scale(1.08); } 65% { transform: translateY(1px) scale(.96); } }
  /* Nuovo: la formica prende la rincorsa, scappa dal cerchio a destra correndo con le zampe e le antenne che vanno,
     rientra da sinistra, frena; il cerchio la «riprende» con un piccolo colpo e un'onda (js: .bb-fx.fx-ping) */
  .bb.fx-pop .bb-plus { overflow: hidden; animation: fx-catch 1.1s ease !important; }
  .bb.fx-pop .bb-plus > svg { animation: fx-run 1.1s ease-in-out !important; }
  .bb.fx-pop .bb-plus g g path:first-child { animation: fx-feel .16s ease-in-out 6 alternate !important; transform-box: fill-box; transform-origin: 0 100%; }
  .bb.fx-pop .bb-plus g g path:last-child { animation: fx-legs .1s ease-in-out 8 alternate !important; transform-box: fill-box; transform-origin: 50% 0; }
  @keyframes fx-run {
    0%, 100% { transform: none; }
    12% { transform: translateX(-3px) rotate(-8deg); }
    42% { transform: translateX(36px) translateY(-1px); }
    42.1% { transform: translateX(-36px) translateY(-1px); }
    76% { transform: translateX(3px) rotate(5deg); }
    88% { transform: translateX(-1px) rotate(-2deg); }
  }
  @keyframes fx-legs { from { transform: skewX(-16deg); } to { transform: skewX(16deg); } }
  @keyframes fx-feel { from { transform: rotate(-12deg); } to { transform: rotate(10deg); } }
  @keyframes fx-catch { 0%, 70%, 100% { transform: none; } 80% { transform: scale(1.1); } 92% { transform: scale(.97); } }
  .bb-fx.fx-ping { z-index: -1; width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: fx-ping .6s ease-out .78s !important; }
  @keyframes fx-ping { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
}
