/* ==========================================================================
   Estilos del escenario del avatar (independientes del portafolio)
   ========================================================================== */
.sa-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  touch-action: pan-y;               /* deja hacer scroll vertical en móvil */
  -webkit-tap-highlight-color: transparent;
}

.sa-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(.2,.8,.2,1);
}
.sa-ready .sa-canvas { opacity: 1; transform: none; }

/* Ilustración estática mientras arranca el 3D. Ocupa exactamente lo mismo
   que el plano en pantalla: 2/2,08 del alto (96,15 %) o 1/1,08 del ancho
   (92,6 %), centrada; así el relevo al 3D no se nota. */
.sa-placeholder {
  position: absolute;
  top: 1.923%;
  bottom: 1.923%;
  left: 3.7%;
  right: 3.7%;
  width: 92.6%;
  height: 96.15%;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
}
.sa-stage.has-placeholder .sa-canvas { transition: none; transform: none; }
.sa-ready .sa-placeholder { visibility: hidden; }
.sa-fallback .sa-placeholder { visibility: visible; }

/* Bocadillo tipo "Anyone here on the left?" */
.sa-bubble {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: max-content;                 /* sin esto, cerca del borde se estrecha mucho */
  max-width: min(260px, calc(100vw - 40px));
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.82), rgba(255,255,255,0.55));
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  color: #2A1A1E;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.35;
  border-radius: 20px 20px 6px 20px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.95), inset 0 0 14px rgba(255,255,255,0.4), 0 14px 36px rgba(120, 30, 60, 0.16);
  pointer-events: none;
  opacity: 0;
  transform: translate(-100%, -100%) scale(0.85);
  transform-origin: 100% 100%;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(.2,1.4,.4,1);
}
.sa-bubble.is-visible {
  opacity: 1;
  transform: translate(-100%, -100%) scale(1);
}

/* Barra de acciones bajo el avatar */
.sa-actions {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 3;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}
.sa-actions[hidden] { display: none; }

/* Botones de cristal líquido */
.sa-hint {
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(255,255,255,0.35));
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.95), inset 0 0 12px rgba(255,255,255,0.35), 0 8px 24px rgba(120,30,60,0.12);
  transition: transform .45s cubic-bezier(.34,1.56,.64,1);
  color: var(--accent-ink, #B0124F);
  font: 500 0.66rem/1 'DM Sans', system-ui, sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
.sa-hint:hover { transform: scale(1.06); }
.sa-hint.is-jelly { animation: sa-jelly .6s; }
@keyframes sa-jelly { 25% { transform: scale(.92,1.06); } 50% { transform: scale(1.06,.94); } 100% { transform: none; } }
/* Sin WebGL: se muestra la ilustración */
.sa-fallback-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  mix-blend-mode: multiply;          /* funde el fondo blanco con el de la página */
}

.sa-debug {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 4;
  margin: 0;
  padding: 8px 10px;
  background: rgba(20, 10, 14, 0.82);
  color: #9EF0B8;
  font: 11px/1.45 ui-monospace, monospace;
  border-radius: 6px;
  pointer-events: none;
  white-space: pre;
}

@media (prefers-reduced-motion: reduce) {
  .sa-canvas, .sa-bubble { transition: none; }
}

/* Pantallas táctiles: zonas de toque de al menos 44 px (recomendación de Apple/Google) */
@media (pointer: coarse) {
  .sa-hint { min-height: 44px; padding: 0 18px; }
}

/* Modo oscuro (lo activa la página con <html data-theme="dark">) */
html[data-theme="dark"] .sa-bubble {
  background: linear-gradient(135deg, rgba(60,36,48,0.92), rgba(40,24,32,0.85));
  color: #F7EEF2;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.18), 0 14px 36px rgba(0,0,0,0.45);
}
html[data-theme="dark"] .sa-hint {
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.22), 0 8px 24px rgba(0,0,0,0.35);
  color: var(--accent-3, #FF7AB0);
}
