/* ═══════════════════════════════════════════════════════════════════════
   VOLTAGE BLITZ VORTEX — capa visual "fullscreen"
   - Fondo panorámico (bg_panoramic.webp) con cover → siempre llena la pantalla
   - El marco oficial (3:2) conserva tamaño y posición; sólo se funden sus
     bordes con una máscara cuyo grosor se calcula por CSS según el viewport
   - Textos/controles encajados con container queries (cqw) → nunca desbordan
   - Nuevo efecto del botón SPIN (sin girar el botón)
   Esta hoja NO cambia la geometría de rodillos ni de los paneles del marco.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* Geometría del marco tal y como la calcula el bundle:
     width = min(100% del stage (100vw - 16px), (100vh - 40px) * 1.5), aspect 3/2 */
  --vb-frame-w: min(100vw - 16px, (100vh - 40px) * 1.5);
  --vb-frame-h: calc(var(--vb-frame-w) / 1.5);
  /* Espacio libre a cada lado y arriba/abajo del marco */
  --vb-gap-x: max(0px, calc((100vw - var(--vb-frame-w)) / 2));
  --vb-gap-y: max(0px, calc((100vh - 48px - var(--vb-frame-h)) / 2));
  /* Grosor del fundido: crece con el hueco disponible, acotado */
  --vb-fx: clamp(14px, calc(var(--vb-gap-x) * 0.42 + 10px), 84px);
  --vb-fy: clamp(10px, calc(var(--vb-gap-y) * 0.5 + 8px), 64px);
  --vb-fx-top: clamp(8px, calc(var(--vb-frame-w) * 0.016), 26px);

  --vb-cyan: #22d3ee;
  --vb-purple: #a855f7;
  --vb-gold: #facc15;
}

/* ─── 1. FONDO PANORÁMICO A PANTALLA COMPLETA ───────────────────────────── */
html, body { background: #04041a; }
#root { background: transparent !important; }
/* Crea un contexto de apilamiento para que la capa -z-10 del bundle se pinte
   por encima del fondo de #root (antes quedaba oculta tras él) */
#game-desktop { isolation: isolate; }

/* Capa de fondo del layout de escritorio (el bundle pinta un div -z-10 plano) */
#game-desktop > div:first-child,
#game-desktop > .-z-10 {
  background:
    linear-gradient(180deg, rgba(4, 4, 26, 0.28) 0%, rgba(4, 4, 26, 0.12) 45%, rgba(4, 4, 26, 0.42) 100%),
    url("/games/voltage-blitz-vortex/bg_panoramic.webp") center center / cover no-repeat #04041a !important;
  overflow: hidden;
}
#game-desktop > div:first-child::after {
  /* "respiración" lenta del fondo: sólo transform → barato en GPU */
  content: "";
  position: absolute;
  inset: -4%;
  background: url("/games/voltage-blitz-vortex/bg_panoramic.webp") center center / cover no-repeat;
  opacity: 0;
  animation: vb-bg-breathe 14s ease-in-out infinite;
  pointer-events: none;
}
@keyframes vb-bg-breathe {
  0%, 100% { transform: scale(1); opacity: 0; }
  50%      { transform: scale(1.025); opacity: 0.35; }
}

/* Layout móvil: el <main> lleva el color plano → lo sustituimos por el fondo */
#game-mobile {
  background:
    linear-gradient(180deg, rgba(4, 4, 26, 0.45) 0%, rgba(4, 4, 26, 0.25) 40%, rgba(4, 4, 26, 0.7) 100%),
    url("/games/voltage-blitz-vortex/bg_panoramic.webp") center 38% / cover no-repeat #04041a !important;
}

/* ─── 2. FUNDIDO DEL MARCO (tamaño y posición intactos) ─────────────────── */
#frame-wrap {
  /* Sombra suave hacia el fondo para asentar el marco */
  filter: drop-shadow(0 0 clamp(8px, 2vw, 28px) rgba(34, 211, 238, 0.12));
}

#frame-wrap > img {
  /* Capas de máscara (de arriba hacia abajo = primera a última):
     C  gradiente vertical (fade superior e inferior)            → intersect
     A1 banda superior (20%) con fade lateral mínimo             → add
     A2 banda inferior (80%) con fade lateral calculado         (base)
     Resultado: C ∩ (A1 ∪ A2). La banda superior protege los paneles
     SALDO / GANANCIA, que llegan casi hasta el borde del marco. */
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0, #000 var(--vb-fy), #000 calc(100% - var(--vb-fy)), transparent 100%),
    linear-gradient(to right, transparent 0, #000 var(--vb-fx-top), #000 calc(100% - var(--vb-fx-top)), transparent 100%),
    linear-gradient(to right, transparent 0, #000 var(--vb-fx), #000 calc(100% - var(--vb-fx)), transparent 100%);
  -webkit-mask-size: 100% 100%, 100% 20.5%, 100% 80%;
  -webkit-mask-position: 0 0, 0 0, 0 100%;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-composite: source-in, source-over, source-over;
  mask-image:
    linear-gradient(to bottom, transparent 0, #000 var(--vb-fy), #000 calc(100% - var(--vb-fy)), transparent 100%),
    linear-gradient(to right, transparent 0, #000 var(--vb-fx-top), #000 calc(100% - var(--vb-fx-top)), transparent 100%),
    linear-gradient(to right, transparent 0, #000 var(--vb-fx), #000 calc(100% - var(--vb-fx)), transparent 100%);
  mask-size: 100% 100%, 100% 20.5%, 100% 80%;
  mask-position: 0 0, 0 0, 0 100%;
  mask-repeat: no-repeat;
  mask-composite: intersect, add, add;
}

/* ─── 3. TEXTOS Y CONTROLES BIEN ENCAJADOS ──────────────────────────────── */
/* Los contenedores del marco pasan a ser "containers" → tipografía en cqw */
#frame-balance, #frame-win, #frame-controls {
  container-type: size;
}

#frame-balance > div, #frame-win > div {
  padding: 4% 7% 2%;
}
#frame-balance span:first-child, #frame-win span:first-child {
  font-size: clamp(7px, 4.6cqw, 13px) !important;
  letter-spacing: 0.22em !important;
  line-height: 1 !important;
  opacity: 0.9;
}
#frame-balance span:last-child, #frame-win span:last-child {
  font-size: clamp(12px, 9.2cqw, 27px) !important;
  line-height: 1.05 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

/* Barra de controles */
#frame-controls > div {
  gap: 1.1cqw !important;
  padding: 0 2.2cqw !important;
}
#frame-controls .fbtn,
#frame-controls .fbtn-wide {
  height: 76% !important;
  line-height: 1 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase;
  font-family: Orbitron, system-ui, sans-serif !important;
  color: #dff7ff !important;
  border: 1px solid rgba(34, 211, 238, 0.42) !important;
  background:
    linear-gradient(180deg, rgba(16, 20, 72, 0.95), rgba(7, 8, 38, 0.95)) padding-box !important;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 14px rgba(34, 211, 238, 0.12),
    0 0 10px rgba(34, 211, 238, 0.18) !important;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.55);
  transition: transform .12s, box-shadow .2s, background .2s, color .2s !important;
}
#frame-controls .fbtn {
  font-size: clamp(12px, 3.4cqw, 26px) !important;
  border-radius: 24% !important;
  font-weight: 900 !important;
}
#frame-controls .fbtn-wide {
  font-size: clamp(8px, 1.65cqw, 15px) !important;
  padding: 0 1.6cqw !important;
  min-width: 9cqw;
  border-radius: 999px !important;
  font-weight: 800 !important;
}
#frame-controls .fbtn:hover:not(:disabled),
#frame-controls .fbtn-wide:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.32), rgba(14, 90, 120, 0.5)) padding-box !important;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 18px rgba(34, 211, 238, 0.45) !important;
}
#frame-controls .fbtn:active:not(:disabled),
#frame-controls .fbtn-wide:active:not(:disabled) {
  transform: scale(0.94) !important;
}
#frame-controls .fbtn:disabled,
#frame-controls .fbtn-wide:disabled {
  opacity: 0.38 !important;
}
/* Estados activos (TURBO / AUTO / MAX) → dorado o cian de la paleta oficial */
#frame-controls #btn-turbo.bg-yellow-500\/25,
#frame-controls .fbtn-wide.text-yellow-200 {
  color: #fde68a !important;
  border-color: rgba(250, 204, 21, 0.75) !important;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.28), rgba(120, 70, 0, 0.45)) padding-box !important;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 16px rgba(250, 204, 21, 0.4) !important;
}
#frame-controls #btn-auto.bg-cyan-500\/25 {
  color: #cffafe !important;
  border-color: rgba(34, 211, 238, 0.9) !important;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.35), rgba(8, 100, 130, 0.55)) padding-box !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 0 18px rgba(34, 211, 238, 0.5) !important;
}

/* Bloque APUESTA (entre − y +) */
#frame-controls .fbtn + div {
  min-width: 11cqw;
  padding: 0 1cqw !important;
}
#frame-controls .fbtn + div span:first-child {
  font-size: clamp(6px, 1.45cqw, 11px) !important;
  letter-spacing: 0.22em !important;
  line-height: 1 !important;
}
#frame-controls .fbtn + div span:last-child {
  font-size: clamp(12px, 3.2cqw, 24px) !important;
  line-height: 1.05 !important;
  margin-top: 0.5cqw;
  font-variant-numeric: tabular-nums;
}

/* Iconos vectoriales (sustituyen a los emoji que se veían inconsistentes) */
button[data-icon]::before,
button[data-muted]::before {
  content: "";
  display: block;
  width: 56%;
  height: 56%;
  background: currentColor;
  -webkit-mask: var(--vb-ico) center / contain no-repeat;
  mask: var(--vb-ico) center / contain no-repeat;
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.6));
}
button[data-muted="0"] {
  --vb-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 9v6h4l5 4V5L7 9H3z'/><path d='M16.5 12c0-1.8-1-3.3-2.5-4.1v8.2c1.5-.8 2.5-2.3 2.5-4.1z'/><path d='M14 3.2v2.1c2.9.9 5 3.6 5 6.7s-2.1 5.8-5 6.7v2.1c4-.9 7-4.5 7-8.8s-3-7.9-7-8.8z'/></svg>");
}
button[data-muted="1"] {
  --vb-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M3 9v6h4l5 4V5L7 9H3z'/><path d='M16.3 8.9l-1.4 1.4 1.7 1.7-1.7 1.7 1.4 1.4 1.7-1.7 1.7 1.7 1.4-1.4-1.7-1.7 1.7-1.7-1.4-1.4-1.7 1.7z'/></svg>");
  color: #93a4c0 !important;
}
button[data-icon="info"] {
  --vb-ico: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm0 2.2a7.8 7.8 0 1 1 0 15.6 7.8 7.8 0 0 1 0-15.6zM11 10h2v7h-2zm0-3.5h2v2.2h-2z'/></svg>");
}
button[data-icon]:disabled::before { opacity: .5; }

/* ─── 4. BOTÓN SPIN — nuevo efecto (el botón NO gira) ───────────────────── */
#btn-spin, #btn-spin-mobile {
  position: relative;
  /* anulamos la rotación/escala inline que aplicaba framer-motion */
  transform: none !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: url("/games/voltage-blitz-vortex/assets/boton_girar.webp") center / 100% 100% no-repeat !important;
  box-shadow: none !important;
  color: #fff !important;
  overflow: visible !important;
  isolation: isolate;
  transition: scale .15s ease, filter .2s ease !important;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 10px rgba(34, 211, 238, 0.35));
}
#btn-spin { aspect-ratio: 775 / 830; height: 112% !important; margin: 0 .4cqw; }
#btn-spin:hover:not(:disabled), #btn-spin-mobile:hover:not(:disabled) {
  scale: 1.05;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 16px rgba(34, 211, 238, 0.7));
}
#btn-spin:active:not(:disabled), #btn-spin-mobile:active:not(:disabled) { scale: 0.94; }
#btn-spin:disabled, #btn-spin-mobile:disabled { opacity: 1 !important; cursor: default; }
#btn-spin:disabled:not([data-spinning="1"]), #btn-spin-mobile:disabled:not([data-spinning="1"]) {
  filter: grayscale(.5) brightness(.6);
}

/* Anillo de energía: un halo cónico que gira ALREDEDOR (el botón queda fijo) */
#btn-spin::before, #btn-spin-mobile::before {
  content: "";
  position: absolute;
  inset: -9%;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgba(34, 211, 238, 0) 40deg, rgba(34, 211, 238, .95) 90deg,
    rgba(168, 85, 247, .9) 130deg, transparent 180deg,
    transparent 220deg, rgba(34, 211, 238, .95) 270deg, rgba(168, 85, 247, .9) 310deg, transparent 360deg);
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 66%, #000 74%, transparent 80%);
  mask: radial-gradient(circle, transparent 60%, #000 66%, #000 74%, transparent 80%);
  opacity: 0;
  z-index: -1;
  filter: blur(1px);
  transition: opacity .25s ease;
}
/* Pulso electrico interior (brillo del rayo) */
#btn-spin::after, #btn-spin-mobile::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(165, 243, 252, .55) 0%, rgba(34, 211, 238, .25) 40%, transparent 70%);
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
  transition: opacity .25s ease;
}
#btn-spin[data-spinning="1"]::before, #btn-spin-mobile[data-spinning="1"]::before {
  opacity: 1;
  animation: vb-ring-spin 1.1s linear infinite;
}
#btn-spin[data-spinning="1"]::after, #btn-spin-mobile[data-spinning="1"]::after {
  opacity: 1;
  animation: vb-core-pulse .55s ease-in-out infinite;
}
#btn-spin[data-spinning="1"], #btn-spin-mobile[data-spinning="1"] {
  animation: vb-btn-charge .9s ease-in-out infinite;
}
/* Modo AUTO: el contador se lee sobre el rayo */
#btn-spin b, #btn-spin-mobile > span {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9em;
  height: 1.5em;
  padding: 0 .35em;
  border-radius: 999px;
  background: rgba(3, 4, 30, 0.82);
  border: 1px solid rgba(34, 211, 238, 0.7);
  font-size: .78em !important;
  line-height: 1;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.9);
}
#btn-spin .vb-spin-ico, #btn-spin-mobile .vb-spin-ico { display: none; }

@keyframes vb-ring-spin { to { transform: rotate(360deg); } }
@keyframes vb-core-pulse {
  0%, 100% { opacity: .35; transform: scale(.92); }
  50%      { opacity: 1;   transform: scale(1.06); }
}
@keyframes vb-btn-charge {
  0%, 100% { filter: drop-shadow(0 4px 10px rgba(0,0,0,.55)) drop-shadow(0 0 10px rgba(34,211,238,.45)) brightness(1); }
  50%      { filter: drop-shadow(0 4px 10px rgba(0,0,0,.55)) drop-shadow(0 0 22px rgba(34,211,238,.95)) brightness(1.18); }
}

/* ─── 5. MÓVIL: textos y zona del personaje ─────────────────────────────── */
#game-mobile #hud-bar h1 { display: none; }           /* título duplicado */
#game-mobile #hud-bar { padding-top: 0 !important; }
#game-mobile header .m-ctrl-sm { color: #dff7ff; }
#mobile-stage { padding-top: var(--vb-m-pad, 0px); transition: padding-top .25s ease; }
#game-mobile .m-ctrl, #game-mobile .m-ctrl-label, #game-mobile .m-ctrl-sm {
  background: linear-gradient(180deg, rgba(16, 20, 72, 0.96), rgba(7, 8, 38, 0.96)) !important;
  border: 1px solid rgba(34, 211, 238, 0.42) !important;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 10px rgba(34, 211, 238, 0.18);
  color: #dff7ff !important;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.55);
}
#game-mobile .m-ctrl-label { font-size: 12px !important; min-width: 58px !important; }
#game-mobile .m-ctrl-label.bg-yellow-500\/30 {
  color: #fde68a !important; border-color: rgba(250, 204, 21, 0.75) !important;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.3), rgba(120, 70, 0, 0.5)) !important;
}
#game-mobile .m-ctrl-label.bg-cyan-500\/30 {
  border-color: rgba(34, 211, 238, 0.95) !important;
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.38), rgba(8, 100, 130, 0.6)) !important;
}
#game-mobile .m-panel {
  background: linear-gradient(180deg, rgba(10, 12, 48, 0.9), rgba(5, 6, 30, 0.92)) !important;
  border: 1px solid rgba(34, 211, 238, 0.4) !important;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.12), inset 0 0 14px rgba(0, 0, 0, 0.6);
}
#game-mobile .m-panel-value { font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(34, 211, 238, .5); }
#btn-spin-mobile { width: 92px !important; height: 98px !important; }

/* ─── 6. PERSONAJE "VOLT" (sprite sheet, 11 columnas × 11 filas) ────────── */
#volt-char {
  position: fixed;
  z-index: 25;             /* sobre el fondo/marco, bajo overlays de premio (z-40+) */
  pointer-events: none;
  will-change: transform;
  opacity: 0;
  transition: opacity .6s ease;
  animation: vb-hover 4.2s ease-in-out infinite;
}
#volt-char.ready { opacity: 1; }
#volt-char.hidden { opacity: 0 !important; }
#volt-char .volt-sprite {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 1100% 1100%;
  background-position: 0 0;
  opacity: 0;
  transition: opacity .28s ease;
  image-rendering: auto;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 14px rgba(34, 211, 238, 0.35));
}
#volt-char .volt-sprite.on { opacity: 1; }
#volt-char.bonus .volt-sprite { filter: drop-shadow(0 10px 14px rgba(0,0,0,.55)) drop-shadow(0 0 18px rgba(168, 85, 247, .75)); }
#volt-char .volt-ground {
  position: absolute;
  left: 18%; right: 18%; bottom: -3%;
  height: 7%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(34, 211, 238, .55) 0%, rgba(34, 211, 238, .18) 45%, transparent 70%);
  filter: blur(4px);
  animation: vb-ground 4.2s ease-in-out infinite;
}
@keyframes vb-hover  { 0%,100% { transform: translateY(0) scaleX(var(--vb-flip, 1)); } 50% { transform: translateY(-1.6%) scaleX(var(--vb-flip, 1)); } }
@keyframes vb-ground { 0%,100% { transform: scaleX(1); opacity: .9; } 50% { transform: scaleX(.86); opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  #volt-char, #volt-char .volt-ground, #game-desktop > div:first-child::after { animation: none; }
}

/* ─── 7. CUADRÍCULAS DE LOS RODILLOS (estilo del marco oficial) ─────────── */
/* Cada símbolo va en su propia casilla: placa azul marino con bisel cian,
   igual que las celdas del marco. Las casillas giran junto con el rodillo. */
#reel-backdrop {
  background:
    radial-gradient(ellipse at 50% 35%, #0a0c38 0%, #060730 55%, #04051e 100%) !important;
  box-shadow: inset 0 0 46px rgba(0, 0, 0, 0.85), inset 0 0 0 1px rgba(34, 211, 238, 0.22) !important;
}
#reel-grid { gap: 1.4% !important; padding: 1.6% !important; }
#reel-grid .reel-column {
  background: linear-gradient(180deg, rgba(6, 8, 40, 0.55), rgba(4, 5, 28, 0.75)) !important;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.10) !important;
  border-radius: 6px !important;
}
#reel-grid .symbol-cell { padding: 8% 1.5% !important; }
#reel-grid .symbol-cell::before {
  content: "";
  position: absolute;
  inset: 4% 0;
  border-radius: 10%;
  background:
    linear-gradient(155deg, rgba(14, 22, 78, 0.95) 0%, rgba(7, 10, 46, 0.98) 55%, rgba(5, 7, 36, 1) 100%);
  border: 1px solid rgba(34, 211, 238, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 14px rgba(34, 211, 238, 0.14),
    inset 0 -6px 12px rgba(0, 0, 0, 0.45),
    0 0 6px rgba(34, 211, 238, 0.22);
  z-index: 0;
}
/* Puntos de unión en las esquinas, como el marco */
#reel-grid .symbol-cell::after {
  content: "";
  position: absolute;
  inset: 4% 0;
  border-radius: 10%;
  background:
    radial-gradient(circle at 0 0,     rgba(103, 232, 249, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 100% 0,  rgba(103, 232, 249, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 0 100%,  rgba(103, 232, 249, .9) 0 2px, transparent 3px),
    radial-gradient(circle at 100% 100%, rgba(103, 232, 249, .9) 0 2px, transparent 3px);
  pointer-events: none;
  z-index: 0;
}
#reel-grid .symbol-img { position: relative; z-index: 1; }
#reel-grid .win-cell-glow { z-index: 1; border-radius: 10%; inset: 4% 0 !important; }
#reel-grid .symbol-img { transform: scale(1.06); transform-origin: center; }
