/* ============================================================================
   BINGOXOW — tema visual (familiar, festivo, tropical — NUNCA casino).
   Paleta tomada del logo: BINGO amarillo/naranja, XOW azul, globo rojo/magenta,
   fondo morado violeta con rayos y puntos (réplica de la estética original).
   ========================================================================== */
:root {
  --bx-purple: #6d28d9;
  --bx-purple-deep: #4c1d95;
  --bx-purple-soft: #8b5cf6;
  --bx-yellow: #ffc928;
  --bx-orange: #ff8a00;
  --bx-red: #e5342c;
  --bx-magenta: #a321a4;
  --bx-blue: #38bdf8;
  --bx-blue-deep: #0284c7;
  --bx-green: #22c55e;
  --bx-green-deep: #15803d;
  --bx-card: #f6f2ff;          /* paneles claros translúcidos (como BINGOXOW) */
  --bx-card-solid: #ffffff;
  --bx-ink: #241b4d;           /* texto sobre paneles claros */
  --bx-ink-soft: #5b5484;
  --bx-line: #d9d2f2;
  --bx-white: #ffffff;
  --bx-marked: #2563eb;        /* celda marcada del cartón */
  --bx-shadow: 0 18px 50px rgba(28, 12, 74, .45);
  --bx-radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body.bx {
  margin: 0;
  font-family: 'Baloo 2', 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--bx-white);
  background-color: var(--bx-purple);
  /* rayos de sol + puntos + degradado violeta (la firma visual de BINGOXOW) */
  background-image:
    radial-gradient(rgba(255,255,255,.14) 2.6px, transparent 2.6px),
    repeating-conic-gradient(from 0deg at 72% 30%, rgba(255,255,255,.05) 0deg 9deg, transparent 9deg 18deg),
    linear-gradient(155deg, #7c3aed 0%, #6d28d9 40%, #4c1d95 100%);
  background-size: 34px 34px, auto, auto;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.bx-wrap {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center;
  padding: 22px;
  gap: 18px;
}
@supports (height: 100dvh) { .bx-wrap { min-height: 100dvh; } }
.bx-wrap {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}
.bx-center { align-items: center; justify-content: center; }

/* ---------- header ---------- */
.bx-top {
  width: 100%; max-width: 1200px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}
.bx-logo { height: 54px; display: block; }
.bx-logo.small { height: 40px; }
.bx-top .spacer { flex: 1; }

/* ---------- paneles ---------- */
.bx-card {
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(243,238,255,.94) 100%);
  color: var(--bx-ink);
  border-radius: var(--bx-radius);
  padding: 24px;
  box-shadow: var(--bx-shadow);
}
.bx-card.wide { max-width: 1200px; }
.bx-card h1 { font-size: 26px; margin: 0 0 6px; font-weight: 800; }
.bx-card h2 { font-size: 20px; margin: 0 0 10px; font-weight: 800; }
.bx-muted { color: var(--bx-ink-soft); }
.bx-title-blue { color: var(--bx-blue-deep); }
.hidden { display: none !important; }
.bx-center-text { text-align: center; }

/* ---------- inputs ---------- */
.bx label { display: block; font-size: 13px; font-weight: 700; color: var(--bx-ink-soft); margin: 14px 0 6px; }
.bx input[type=text], .bx input[type=email], .bx input[type=password], .bx input[type=number], .bx select {
  width: 100%; padding: 13px 15px; font-size: 16px;
  border-radius: 12px; border: 2px solid var(--bx-line);
  background: var(--bx-card-solid); color: var(--bx-ink); outline: none;
}
.bx input:focus, .bx select:focus { border-color: var(--bx-purple-soft); }

/* ---------- botones ---------- */
.bx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px; font-size: 16px; font-weight: 800; font-family: inherit;
  border: 0; border-radius: 999px; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, var(--bx-blue), var(--bx-blue-deep));
  box-shadow: 0 4px 0 rgba(0,0,0,.18), 0 10px 24px rgba(0,0,0,.22);
  transition: transform .06s ease, filter .15s ease;
}
.bx-btn:hover { filter: brightness(1.07); }
.bx-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.bx-btn:disabled { opacity: .45; cursor: default; }
.bx-btn.green { background: linear-gradient(180deg, #34d399, var(--bx-green-deep)); }
.bx-btn.red { background: linear-gradient(180deg, #f87171, #b91c1c); }
.bx-btn.yellow { background: linear-gradient(180deg, var(--bx-yellow), var(--bx-orange)); color: #4a2c00; }
.bx-btn.purple { background: linear-gradient(180deg, var(--bx-purple-soft), var(--bx-purple-deep)); }
.bx-btn.ghost { background: rgba(255,255,255,.14); box-shadow: none; border: 2px solid rgba(255,255,255,.35); }
.bx-btn.onlight { box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.bx-btn.small { padding: 9px 15px; font-size: 14px; }
.bx-btn.block { width: 100%; }
.bx-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* toggles de premios (como los chips de BINGOXOW: Línea verde, 4 Esquinas
   naranja, Podium gris, Bloquear rojo — encendido = color, apagado = gris) */
.bx-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 800; font-size: 14px; font-family: inherit;
  background: #e8e3f7; color: var(--bx-ink-soft);
  transition: all .15s ease;
}
.bx-toggle.on { color: #fff; }
.bx-toggle.t-line.on { background: var(--bx-green); }
.bx-toggle.t-corners.on { background: var(--bx-orange); }
.bx-toggle.t-full.on { background: var(--bx-blue-deep); }
.bx-toggle.t-podium.on { background: var(--bx-purple-soft); }
.bx-toggle.t-block.on { background: var(--bx-red); }

/* radios de tipo de juego */
.bx-variant { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-radius: 12px; border: 2px solid var(--bx-line); background: #fff; cursor: pointer;
  font-weight: 700; font-size: 14px; color: var(--bx-ink); }
.bx-variant.sel { border-color: var(--bx-blue); background: #eaf6ff; }
.bx-variant.locked { opacity: .5; cursor: not-allowed; }

/* ---------- cartón del jugador ---------- */
.bx-cardgame {
  display: grid; gap: 6px;
  background: var(--bx-card-solid); border-radius: 16px; padding: 12px;
  box-shadow: var(--bx-shadow);
}
.bx-cardgame .cell {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; border-radius: 10px;
  background: #f1edff; color: var(--bx-ink);
  font-weight: 800; font-size: clamp(15px, 4.2vw, 24px);
  position: relative;
}
.bx-cardgame .cell.blank { background: transparent; }
.bx-cardgame .cell.free { background: linear-gradient(180deg, var(--bx-yellow), var(--bx-orange)); color: #4a2c00; font-size: 11px; letter-spacing: .5px; }
.bx-cardgame .cell.loteria { font-size: clamp(20px, 6vw, 34px); }
.bx-cardgame .cell.loteria .lname { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 8px; font-weight: 700; color: var(--bx-ink-soft); text-align: center; overflow: hidden; white-space: nowrap; }
/* MARCADO MANUAL (efecto WOW):
   - .callable = número llamado que el huésped AÚN NO tocó → PARPADEA en ámbar
     ("tócame"); tras reconectar, todos los llamados sin marcar parpadean.
   - .marked   = el huésped lo tocó → queda SÓLIDO azul (confirmado). */
.bx-cardgame .cell.callable {
  background: var(--bx-yellow); color: #4a2c00; cursor: pointer;
  animation: bxBlink 1.05s ease-in-out infinite;
}
@keyframes bxBlink {
  0%, 100% { background-color: var(--bx-yellow); box-shadow: 0 0 0 0 rgba(245,158,11,0); transform: scale(1); }
  50% { background-color: #ffdd57; box-shadow: 0 0 16px 3px rgba(245,158,11,.75); transform: scale(1.06); }
}
.bx-cardgame .cell.marked {
  background: var(--bx-marked); color: #fff; cursor: pointer;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.bx-cardgame .cell.markable { cursor: pointer; } /* tocable aunque no esté llamado (no hace nada) */
/* encabezado B-I-N-G-O (americano) */
.bx-bingohead { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 6px; }
.bx-bingohead span {
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; padding: 6px 0; font-weight: 800; color: #fff; font-size: 18px;
}
.bx-bingohead .h0 { background: var(--bx-yellow); color: #4a2c00; }
.bx-bingohead .h1 { background: var(--bx-blue); }
.bx-bingohead .h2 { background: var(--bx-red); }
.bx-bingohead .h3 { background: var(--bx-green); }
.bx-bingohead .h4 { background: var(--bx-purple-soft); }

/* ---------- número actual (bola grande) ---------- */
.bx-ball {
  width: 130px; height: 130px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #dbeafe 18%, var(--bx-blue) 45%, var(--bx-blue-deep) 100%);
  color: #fff; font-weight: 800; font-size: 52px;
  box-shadow: inset -6px -10px 18px rgba(0,0,0,.25), var(--bx-shadow);
  text-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.bx-ball.small { width: 84px; height: 84px; font-size: 34px; }
.bx-ball .letter { font-size: 18px; line-height: 1; opacity: .9; }
.bx-ball.empty { background: radial-gradient(circle at 32% 28%, #fff, #e7e2f7 60%, #cfc7ec); color: var(--bx-ink-soft); }
.bx-ball.pop { animation: bxPop .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes bxPop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
.bx-ball.loteria { font-size: 44px; }
.bx-ball .lotname { font-size: 12px; font-weight: 800; margin-top: 2px; }

/* ---------- tablero de números llamados ---------- */
.bx-board { display: grid; gap: 6px; }
/* columnas que dividen exacto el total → tablero simétrico, sin filas cojas:
   90 = 10×9, 75 = 15×5, 54 = 9×6 */
.bx-board.n90 { grid-template-columns: repeat(10, 1fr); }
.bx-board.n75 { grid-template-columns: repeat(15, 1fr); }
.bx-board.n54 { grid-template-columns: repeat(9, 1fr); }
.bx-board .b {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; border-radius: 50%;
  background: rgba(255,255,255,.92); color: var(--bx-ink);
  font-weight: 800; font-size: clamp(10px, 1.5vw, 18px);
}
.bx-board .b.on {
  background: radial-gradient(circle at 32% 28%, #93c5fd, var(--bx-marked) 70%);
  color: #fff; box-shadow: 0 0 10px rgba(59,130,246,.55);
}
.bx-board .b.last { animation: bxBlink 1.15s ease-in-out infinite; background: var(--bx-marked); color: #fff; }
.bx-board .b.loteria { font-size: clamp(14px, 2vw, 26px); border-radius: 12px; }

/* ---------- Lotería: cartas con IMAGEN real (Don Clemente) ---------- */
.lm-img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* cartón del móvil: la carta llena la casilla */
.bx-cardgame .cell.loteria { overflow: hidden; padding: 0; background: #fff; }
.bx-cardgame .cell.loteria .lname {
  z-index: 2; background: rgba(255,255,255,.86); border-radius: 6px;
  padding: 1px 4px; bottom: 4px; left: 4px; right: 4px; color: var(--bx-ink);
}
.bx-cardgame .cell.loteria.callable .lm-img { filter: brightness(.86); }
.bx-cardgame .cell.loteria.callable { animation: bxBlink 1.05s ease-in-out infinite; }
.bx-cardgame .cell.loteria.marked .lm-img { filter: brightness(.48) saturate(1.15); }
.bx-cardgame .cell.loteria.marked::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-size: clamp(26px, 8vw, 40px); color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.7); z-index: 3;
}
/* tablero del teatro: mini-carta en vez de círculo, tenue hasta que se canta */
.bx-board .b.loteria { border-radius: 10px; overflow: hidden; padding: 0; background: #fff;
  opacity: .4; transition: opacity .25s ease, box-shadow .25s ease, transform .25s ease; }
.bx-board .b.loteria.on { opacity: 1; box-shadow: 0 0 0 3px var(--bx-marked); animation: none; }
.bx-board .b.loteria.last { opacity: 1; box-shadow: 0 0 0 4px var(--bx-yellow); transform: scale(1.05);
  animation: bxBlink 1.15s ease-in-out infinite; }
/* "número actual" = carta grande (rompe el círculo de la bola) */
.bx-ball.lm-card { border-radius: 16px; background: #fff; box-shadow: var(--bx-shadow);
  padding: 6px; width: auto !important; height: auto !important; overflow: visible; text-shadow: none; }
.bx-ball.lm-card .lm-big { max-width: 100%; border-radius: 10px; display: block; }

/* ---------- QR ---------- */
.bx-qr { display: inline-block; background: #fff; padding: 14px; border-radius: 18px; box-shadow: var(--bx-shadow); }
.bx-qr img, .bx-qr canvas { display: block; }
.bx-code {
  font-size: clamp(26px, 4.5vw, 48px); font-weight: 800; letter-spacing: 2px;
  background: rgba(255,255,255,.14); border: 2px dashed rgba(255,255,255,.45);
  border-radius: 16px; padding: 10px 22px; display: inline-block; color: #fff;
}

/* ---------- ranking ---------- */
.bx-rank { width: 100%; border-collapse: collapse; }
.bx-rank th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--bx-ink-soft); padding: 6px 8px; }
.bx-rank td { padding: 9px 8px; border-top: 1px solid var(--bx-line); font-weight: 700; color: var(--bx-ink); font-size: 15px; }
.bx-rank .pos { width: 34px; }
.bx-rank .medal { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 800; background: var(--bx-purple-soft); }
.bx-rank tr:nth-child(1) .medal { background: linear-gradient(180deg, #fbbf24, #d97706); }
.bx-rank tr:nth-child(2) .medal { background: linear-gradient(180deg, #cbd5e1, #64748b); }
.bx-rank tr:nth-child(3) .medal { background: linear-gradient(180deg, #fdba74, #c2410c); }
.bx-rank .headgrad { background: linear-gradient(90deg, var(--bx-blue), var(--bx-purple-soft)); color: #fff; border-radius: 10px; }
.bx-rank .headgrad th { color: #fff; }
.bx-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; color: #fff;
  vertical-align: middle; margin-left: 6px;
}
.bx-badge.line { background: var(--bx-green); }
.bx-badge.corners { background: var(--bx-orange); }
.bx-badge.full { background: linear-gradient(90deg, var(--bx-yellow), var(--bx-orange)); color: #4a2c00; }
.bx-badge.blocked { background: #94a3b8; }

/* ---------- podio ---------- */
.bx-podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; margin-top: 18px; }
.bx-podium .col { text-align: center; }
.bx-podium .bar {
  width: clamp(90px, 14vw, 150px); border-radius: 14px 14px 0 0;
  display: flex; align-items: flex-end; justify-content: center;
  color: #fff; font-weight: 800; font-size: 26px; padding-bottom: 8px;
}
.bx-podium .p1 .bar { height: 150px; background: linear-gradient(180deg, #fde047, #d97706); color: #4a2c00; }
.bx-podium .p2 .bar { height: 112px; background: linear-gradient(180deg, #e2e8f0, #94a3b8); color: #1e293b; }
.bx-podium .p3 .bar { height: 84px; background: linear-gradient(180deg, #fdba74, #ea580c); }
.bx-podium .who { margin-top: 8px; font-weight: 800; }
.bx-podium .pts { font-size: 13px; opacity: .85; }
.bx-winline { font-size: 20px; font-weight: 800; margin: 8px 0; }

/* ---------- pills de estado ---------- */
.bx-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 800;
  background: rgba(255,255,255,.92); color: var(--bx-ink);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.bx-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bx-green); }
.bx-pill.warn .dot { background: var(--bx-yellow); }
.bx-pill.bad .dot { background: var(--bx-red); }
.bx-pill.float { position: fixed; right: 16px; bottom: 16px; z-index: 60; }
.bx-pill.float2 { position: fixed; left: 16px; bottom: 16px; z-index: 60; }

/* ---------- selector de idioma ---------- */
.bx-lang {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.94); color: var(--bx-ink);
  border: 0; border-radius: 999px; padding: 9px 14px;
  font-weight: 800; font-size: 14px; font-family: inherit; cursor: pointer;
}

/* ---------- overlay de celebración (animación BINGO) ---------- */
.bx-celebrate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(40, 16, 90, .72); backdrop-filter: blur(3px);
  animation: bxFadeIn .3s ease both;
}
@keyframes bxFadeIn { from { opacity: 0; } to { opacity: 1; } }
.bx-celebrate .word {
  font-size: clamp(56px, 14vw, 170px); font-weight: 800; letter-spacing: 4px;
  background: linear-gradient(180deg, #fff7c2 8%, var(--bx-yellow) 38%, var(--bx-orange) 72%, #c2410c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 rgba(120, 40, 0, .55)) drop-shadow(0 16px 34px rgba(0,0,0,.5));
  animation: bxZoomIn .6s cubic-bezier(.2,.8,.2,1) both, bxGlowPulse 1.2s ease-in-out .6s infinite;
}
@keyframes bxZoomIn { 0% { transform: scale(.2) rotate(-6deg); opacity: 0; } 70% { transform: scale(1.12) rotate(2deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes bxGlowPulse { 0%,100% { filter: drop-shadow(0 6px 0 rgba(120,40,0,.55)) drop-shadow(0 0 26px rgba(255,201,40,.55)); } 50% { filter: drop-shadow(0 6px 0 rgba(120,40,0,.55)) drop-shadow(0 0 60px rgba(255,201,40,.95)); } }
.bx-celebrate .who {
  margin-top: 14px; font-size: clamp(22px, 4.5vw, 44px); font-weight: 800; color: #fff;
  text-shadow: 0 4px 18px rgba(0,0,0,.55); animation: bxFadeUp .5s ease .35s both;
}
@keyframes bxFadeUp { from { transform: translateY(26px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.bx-celebrate canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* bolas decorativas flotantes (esquina, como la web original) */
.bx-balls-decor { position: fixed; right: 18px; bottom: 10px; z-index: 5; display: flex; gap: -10px; pointer-events: none; }
.bx-balls-decor .db {
  width: 74px; height: 74px; border-radius: 50%; margin-left: -14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 26px;
  box-shadow: inset -5px -8px 14px rgba(0,0,0,.3), 0 10px 22px rgba(0,0,0,.35);
  animation: bxFloat 3.4s ease-in-out infinite;
}
.bx-balls-decor .db small { background: #fff; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.bx-balls-decor .g { background: radial-gradient(circle at 32% 28%, #86efac, #16a34a); color: #16a34a; animation-delay: 0s; }
.bx-balls-decor .r { background: radial-gradient(circle at 32% 28%, #fca5a5, #dc2626); color: #dc2626; animation-delay: .4s; }
.bx-balls-decor .bl { background: radial-gradient(circle at 32% 28%, #93c5fd, #2563eb); color: #2563eb; animation-delay: .8s; }
@keyframes bxFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* banner de conexión (rojo/ámbar/verde) */
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 200; text-align: center;
  font-weight: 800; font-size: 14px; padding: 8px; transform: translateY(-100%); transition: transform .25s; }
.conn-banner.show { transform: translateY(0); }
.conn-banner.good { background: var(--bx-green); color: #052e16; }
.conn-banner.warn { background: var(--bx-yellow); color: #4a2c00; }
.conn-banner.bad { background: var(--bx-red); color: #fff; }

/* util */
.bx-grid2 { display: grid; grid-template-columns: 1fr 340px; gap: 16px; width: 100%; max-width: 1200px; align-items: start; }
@media (max-width: 900px) { .bx-grid2 { grid-template-columns: 1fr; } }
.bx-sep { border: 0; border-top: 2px solid var(--bx-line); margin: 16px 0; }
.bx-danger-title { color: var(--bx-red); font-weight: 800; }
.bx-list { display: grid; gap: 8px; }
.bx-list .item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid var(--bx-line); border-radius: 12px;
  padding: 9px 12px; color: var(--bx-ink); font-weight: 700; font-size: 14px;
}
.bx-list .item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-list .item.off { opacity: .55; }
.bx-iconbtn { border: 0; background: #ece7fb; color: var(--bx-ink); border-radius: 9px; width: 32px; height: 32px;
  cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.bx-iconbtn:hover { background: #ddd4f6; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .05ms !important; }
  .bx-cardgame .cell.marked { animation: none; box-shadow: 0 0 0 3px rgba(59,130,246,.8); }
}
:focus-visible { outline: 3px solid var(--bx-yellow); outline-offset: 2px; }
