/* ==========================================================================
   BOTON-JUEGO.CSS — «Botón con sorpresa» en M1   (v18.85)
   Solo se usa si CONFIG.mundo1.botonJuego.activo es true.
   ========================================================================== */

.bj-raiz{
  display:flex;flex-direction:column;align-items:center;gap:.7rem;
  animation:fadeIn 1s ease .6s both;
}
.bj-frase{
  margin:0;min-height:1.5em;width:max-content;max-width:min(92vw,28rem);text-align:center;
  font-family:var(--bj-frase-font, inherit);
  font-size:var(--bj-frase-tam, 1.1rem);
  color:var(--bj-frase-color, var(--btn-m1-borde, #F5EDD8));
  line-height:1.35;text-wrap:balance;
  text-shadow:0 2px 14px rgba(0,0,0,.55);
}
.bj-frase.bj-frase-in{animation:bjFrase .38s cubic-bezier(.2,.8,.2,1) both}
@keyframes bjFrase{from{opacity:0;transform:translateY(6px) scale(.97)}to{opacity:1;transform:none}}

/* Cuando el ícono flota, la frase lo acompaña */
.bj-frase.bj-frase-flotante{
  position:fixed;z-index:61;transform:translate(-50%,-100%);
  width:max-content;max-width:min(80vw,22rem);pointer-events:none;
  transition:left .55s cubic-bezier(.2,.8,.2,1), top .55s cubic-bezier(.2,.8,.2,1);
}
.bj-frase.bj-frase-flotante.bj-abajo{transform:translate(-50%,0)}
.bj-frase.bj-frase-flotante.bj-frase-in{animation:bjFraseF .38s cubic-bezier(.2,.8,.2,1) both}
@keyframes bjFraseF{from{opacity:0}to{opacity:1}}

.bj-hueco{display:flex;justify-content:center;align-items:center;min-height:var(--bj-tam,76px)}

/* El ícono (botón accesible) */
.bj-icono{
  --bj-tam:76px;
  width:var(--bj-tam);height:var(--bj-tam);min-width:48px;min-height:48px;
  display:inline-flex;align-items:center;justify-content:center;
  padding:0;margin:0;border:0;background:none;cursor:pointer;
  -webkit-tap-highlight-color:transparent;touch-action:manipulation;
  border-radius:50%;
  animation:bjLlama 2.4s ease-in-out 1.6s infinite;
}
.bj-icono:focus-visible{outline:2px solid var(--btn-m1-borde,#C9A84C);outline-offset:6px}
.bj-icono .bj-emoji{font-size:calc(var(--bj-tam) * .8);line-height:1;filter:drop-shadow(0 6px 16px rgba(0,0,0,.45));user-select:none}
.bj-icono img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 6px 16px rgba(0,0,0,.45));user-select:none;pointer-events:none}
@keyframes bjLlama{0%,82%,100%{transform:rotate(0)}86%{transform:rotate(-9deg)}90%{transform:rotate(8deg)}94%{transform:rotate(-5deg)}97%{transform:rotate(3deg)}}

/* Flotando por la pantalla */
.bj-icono.bj-flotando{position:fixed;left:0;top:0;z-index:60;animation:none}
.bj-icono.bj-flotando .bj-emoji,.bj-icono.bj-flotando img{animation:bjLlamaIn 2.4s ease-in-out 1.2s infinite}
@keyframes bjLlamaIn{0%,82%,100%{transform:rotate(0)}86%{transform:rotate(-9deg)}90%{transform:rotate(8deg)}94%{transform:rotate(-5deg)}97%{transform:rotate(3deg)}}

.bj-icono.bj-mov-salto{transition:transform .55s cubic-bezier(.2,.8,.2,1)}
.bj-icono.bj-mov-salto .bj-emoji,.bj-icono.bj-mov-salto img{animation:bjSalto .55s ease both}
@keyframes bjSalto{0%{transform:scale(1)}35%{transform:scale(.7) translateY(-14px)}70%{transform:scale(1.12)}100%{transform:scale(1)}}

.bj-icono.bj-mov-giro{transition:transform .6s cubic-bezier(.65,0,.35,1)}
.bj-icono.bj-mov-giro .bj-emoji,.bj-icono.bj-mov-giro img{animation:bjGiro .6s cubic-bezier(.65,0,.35,1) both}
@keyframes bjGiro{from{transform:rotate(0) scale(.8)}to{transform:rotate(360deg) scale(1)}}

.bj-icono.bj-mov-rebote{transition:transform .7s cubic-bezier(.34,1.56,.64,1)}
.bj-icono.bj-mov-rebote .bj-emoji,.bj-icono.bj-mov-rebote img{animation:bjRebote .7s ease both}
@keyframes bjRebote{0%{transform:scale(1,1)}30%{transform:scale(1.25,.75)}55%{transform:scale(.85,1.15)}80%{transform:scale(1.05,.95)}100%{transform:scale(1,1)}}

/* Último toque: el ícono se agranda y se va */
.bj-icono.bj-final .bj-emoji,.bj-icono.bj-final img{animation:bjFinal .4s ease forwards}
@keyframes bjFinal{to{transform:scale(1.6);opacity:0}}

/* v18.85b — «Queda fijo y cambia»: la misma animación, en el lugar */
.bj-icono.bj-pop-salto .bj-emoji,.bj-icono.bj-pop-salto img{animation:bjSalto .55s ease both}
.bj-icono.bj-pop-giro .bj-emoji,.bj-icono.bj-pop-giro img{animation:bjGiro .6s cubic-bezier(.65,0,.35,1) both}
.bj-icono.bj-pop-rebote .bj-emoji,.bj-icono.bj-pop-rebote img{animation:bjRebote .7s ease both}
.bj-icono.bj-pop-salto,.bj-icono.bj-pop-giro,.bj-icono.bj-pop-rebote{animation:none}

/* Sin movimiento: solo cambia */
.bj-icono.bj-cambia{opacity:0;transition:opacity .15s ease}

/* «Entrar directo» discreto */
.bj-salida{
  margin-top:.4rem;padding:.5rem .8rem;min-height:40px;
  background:none;border:0;cursor:pointer;
  font:inherit;font-size:.82rem;letter-spacing:.02em;
  color:var(--bj-frase-color, #F5EDD8);opacity:0;visibility:hidden;
  text-decoration:underline;text-underline-offset:3px;
  transition:opacity .6s ease, visibility 0s linear .6s;
}
.bj-salida.bj-salida-in{opacity:.62;visibility:visible;transition:opacity .6s ease}
.bj-salida:hover,.bj-salida:focus-visible{opacity:1}
.bj-salida:focus-visible{outline:2px solid var(--btn-m1-borde,#C9A84C);outline-offset:3px;border-radius:6px}

.bj-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;margin:-1px}

/* Mientras corre la apertura, el ícono flotante no estorba */
body.apertura-en-curso .bj-icono.bj-flotando,
body.apertura-en-curso .bj-frase.bj-frase-flotante{opacity:0;transition:opacity .3s ease}

@media (prefers-reduced-motion: reduce){
  .bj-icono,.bj-icono .bj-emoji,.bj-icono img,.bj-frase.bj-frase-in{animation:none !important}
  .bj-icono{transition:none !important}
}
