/* MiniBingo -- pantalla del jugador */
:root {
    --bg: #0b1020;
    --panel: #131a31;
    --panel-2: #1a2342;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --text: #eef1fb;
    --muted: rgba(238, 241, 251, 0.58);
    --gold: #f5c542;
    --gold-ink: #2a1f00;
    --ok: #34d399;
    --err: #f87171;
    /* Columnas B I N G O */
    --col-b: #3b82f6;
    --col-i: #ef4444;
    --col-n: #22c55e;
    --col-g: #f59e0b;
    --col-o: #a855f7;
    --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
    --font-body: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;
    --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Sin el recuadro azul que ponen los celulares al tocar botones y enlaces;
   el contorno de foco solo se ve al navegar con teclado. */
* { -webkit-tap-highlight-color: transparent; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible), input:focus:not(:focus-visible),
label:focus:not(:focus-visible), [tabindex]:focus:not(:focus-visible) { outline: none; }
html, body { margin: 0; }
body {
    background: radial-gradient(1200px 600px at 20% -10%, #1b2552 0%, transparent 60%), var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    min-height: 100vh;
}
button { font-family: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); }

/* ---------- Barra superior ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; max-width: 1280px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-ball {
    width: 38px; height: 38px; border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, #fff 0 18%, var(--gold) 19% 100%);
    color: var(--gold-ink); font: 400 22px var(--font-display);
}
.brand-name { font: 400 30px/1 var(--font-display); letter-spacing: 1px; }
.brand-name b { color: var(--gold); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
    display: flex; flex-direction: column; align-items: flex-end;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 5px 12px;
}
.pill-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-value { font: 700 15px var(--font-mono); }
.pill-jackpot { border-color: rgba(245, 197, 66, 0.4); }
.pill-jackpot .pill-value { color: var(--gold); }

.btn {
    border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text);
    border-radius: 10px; padding: 11px 18px; font-weight: 700; font-size: 15px;
    cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-ghost { background: transparent; }

/* ---------- Layout ---------- */
.layout {
    display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px;
    max-width: 1280px; margin: 0 auto; padding: 16px 16px 120px;
}
.col-main, .col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 960px) {
    /* Una sola columna: la venta y mis cartones suben justo debajo de los
       premios (antes que el tablero), que es lo que importa en el celular. */
    .layout { grid-template-columns: 1fr; display: flex; flex-direction: column; }
    .col-main, .col-side { display: contents; }
    .stage { order: 1; }
    .prizes { order: 2; }
    .acumulado { order: 2; }
    #sale-panel { order: 3; }
    #my-panel { order: 4; }
    #board-panel { order: 5; }
}

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { font: 400 22px/1 var(--font-display); letter-spacing: .8px; margin: 0; flex: 1; }

/* ---------- Pantalla de video ---------- */
.stage {
    position: relative; aspect-ratio: 16 / 9; background: #000;
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
}
.stage-video {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity .25s;
}
.stage-video.active { opacity: 1; }
.stage-fallback {
    position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
    background: radial-gradient(circle at 50% 40%, #26306a, #0b1020 70%);
}
/* Pausa entre videos de venta */
/* En la pausa de los 👇 el título se va con animación (y vuelve con rebote) */
.stage-overlay.on-gap .idle-title.title-box { opacity: 0; transform: scale(0.4) translateY(24px); pointer-events: none; }
.stage-overlay.on-gap { background: none; }
.stage-fallback.black { background: #000; }
/* "¡Compra tus cartones!" encima de su video de fondo: un velo suave para que se lea */
.stage-fallback.on-video { background: radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55)); }
.sale-gap { display: flex; flex-direction: column; align-items: center; margin-top: 6%; animation: pop .5s ease-out; }
/* Muestra de cómo se compra: manito que toca un cartón */
.tap-hint {
    position: absolute; left: 10%; top: 24%; z-index: 3; pointer-events: none;
    font-size: 78cqw; line-height: 1;
    animation: hand-tap 1.3s ease-in-out 0.3s 3 both;
}
@keyframes hand-tap {
    0%   { opacity: 0; transform: translate(0, 40%) scale(1); }
    25%  { opacity: 1; transform: translate(0, 0) scale(1); }
    40%  { transform: translate(0, 0) scale(0.8); }   /* toque */
    55%  { transform: translate(0, 0) scale(1); }
    85%  { opacity: 1; transform: translate(0, 10%) scale(1); }
    100% { opacity: 0; transform: translate(0, 40%) scale(1); }
}
.bcard.demo-tap { overflow: visible; z-index: 4; } /* la manito grande puede salir del cartón */
.bcard.demo-tap::after {
    content: '✓'; position: absolute; inset: 0; border-radius: 8px; display: grid; place-items: center;
    background: rgba(22, 163, 74, 0.62); box-shadow: inset 0 0 0 3px #16a34a;
    color: #fff; font: 700 60cqw/1 var(--font-body); opacity: 0;
    animation: demo-select 1.3s ease-in-out 0.3s 3 both;
}
@keyframes demo-select { 0%, 38% { opacity: 0; } 42%, 80% { opacity: 1; } 100% { opacity: 0; } }
.sale-gap-btn { margin-top: 14px; padding: 11px 34px; font-size: clamp(15px, 2.4vw, 18px); }
/* La franja de textos sobre el video no debe tapar el botón */
.stage-overlay.over-video { pointer-events: none; }
.sale-gap-arrows { font-size: clamp(30px, 6vw, 52px); margin-top: 10px; letter-spacing: 6px; animation: arrows-bounce 1s ease-in-out infinite; }
@keyframes arrows-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.sale-gap .fallback-title { color: var(--gold); }
.fallback-title { font: 400 clamp(32px, 7vw, 64px)/1 var(--font-display); letter-spacing: 2px; }
.fallback-sub { color: var(--muted); margin-top: 8px; }
/* Pantalla de espera tras el video de ganador: abajo y por encima de la lista de ganadores */
.stage-waiting { position: absolute; left: 0; right: 0; bottom: 56px; z-index: 4; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.stage-waiting .fallback-balls { margin-bottom: 8px; }
.stage-waiting .fallback-balls span { width: 22px; height: 22px; }
.waiting-text { font: 400 clamp(20px, 4vw, 32px)/1.1 var(--font-display); letter-spacing: 1px; color: var(--gold); }
.fallback-balls { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.fallback-balls span {
    width: 34px; height: 34px; border-radius: 50%; background: var(--c, var(--gold));
    animation: tumble 0.9s ease-in-out infinite; animation-delay: calc(var(--i) * -0.18s);
}
@keyframes tumble { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-26px) rotate(180deg); } }

.stage-live {
    position: absolute; top: 12px; left: 12px; background: rgba(220, 38, 38, 0.9); color: #fff;
    font: 700 12px var(--font-mono); padding: 4px 9px; border-radius: 6px; letter-spacing: 1px;
    display: flex; align-items: center; gap: 6px;
}
.stage-live span { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }

.stage-ball { position: absolute; top: 12px; right: 12px; }

/* Efecto "foto" al cantar el número (como la captura de pantalla del celular):
   destello blanco + la imagen congelada se achica hacia la esquina de abajo
   a la izquierda, se queda un momento y sale. El video sigue por debajo. */
.snap-flash { position: absolute; inset: 0; z-index: 7; background: #fff; opacity: 0; pointer-events: none; }
.snap-flash.go { animation: snap-flash 420ms ease-out; }
@keyframes snap-flash { 0% { opacity: 0; } 10% { opacity: 0.92; } 100% { opacity: 0; } }
.snap-photo {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 7;
    box-sizing: border-box; border: 18px solid #fff; border-radius: 34px; opacity: 0;
    pointer-events: none; transform-origin: 0 100%; will-change: transform, opacity;
}
.snap-photo.go { animation: snap-photo 3600ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }
/* ~0,55 s achicándose, ~2,5 s quieta en la esquina y ~0,5 s saliendo
   (solo transform/opacity: fluido en el celular) */
@keyframes snap-photo {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    15%  { opacity: 1; transform: translate(14px, -14px) scale(0.3); }
    86%  { opacity: 1; transform: translate(14px, -14px) scale(0.3); }
    100% { opacity: 0; transform: translate(-38%, -14px) scale(0.3); }
}
/* Distintivo de bingo de prueba (panel → Pruebas): solo un ícono de bot */
.stage-test {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6;
    font-size: 22px; line-height: 1;
}
.stage-test[hidden] { display: none; }

.stage-overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 16px; background: rgba(8, 11, 24, 0.72);
}
.idle-title { font: 400 clamp(30px, 6vw, 56px)/1 var(--font-display); letter-spacing: 1.5px; }
.idle-sub { color: var(--muted); margin-top: 8px; max-width: 460px; }
.idle-countdown { font: 700 clamp(44px, 10vw, 88px)/1 var(--font-mono); color: var(--gold); margin-top: 14px; }
/* Con video de venta de fondo: los textos van en una franja abajo */
.stage-overlay.over-video {
    inset: auto 0 0 0; justify-content: flex-end; padding: 40px 16px 58px;
    background: none; /* sin sombra sobre el video */
}
.over-video .idle-title { font-size: clamp(22px, 4vw, 38px); }
/* Título de la venta: caja negra con borde morado */
.idle-title.title-box, .over-video .idle-title.title-box {
    display: inline-block; background: #000; border: 3px solid #7c3aed; border-radius: 12px;
    padding: 6px 18px 4px; color: #fff;
    opacity: 1; transform: none;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: title-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes title-in { from { opacity: 0; transform: scale(0.4) translateY(24px); } to { opacity: 1; transform: none; } }
.over-video .idle-sub, .over-video .idle-countdown { }
.over-video .idle-sub { font-size: 13px; margin-top: 4px; }
.over-video .idle-countdown { font-size: clamp(30px, 7vw, 56px); margin-top: 6px; }
.sound-btn.is-muted { color: var(--muted); }

/* "Empezamos cuando se vendan todos los cartones.": fondo amarillo que late,
   arriba del todo en la pantalla del video */
.stage-pill {
    position: absolute; top: 12px; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 24px); z-index: 5;
    padding: 6px 14px; border-radius: 999px; white-space: nowrap; text-align: center;
    background: var(--gold); color: var(--gold-ink); font-weight: 700; font-size: clamp(11px, 3vw, 16px);
    animation: sub-pulse 1.6s ease-in-out infinite;
}
@keyframes sub-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.06); }
}

.winners-overlay { background: rgba(8, 11, 24, 0.55); }
.winners-title {
    font: 400 clamp(30px, 6vw, 54px)/1 var(--font-display); letter-spacing: 1.5px; color: var(--gold); animation: pop .5s ease-out;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.winners-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; width: min(460px, 100%); max-height: 60%; overflow: auto; }
.winner-row {
    display: flex; align-items: center; gap: 10px; background: rgba(19, 26, 49, 0.92);
    border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; text-align: left;
}
.winner-row .who { flex: 1; min-width: 0; }
.winner-row .who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winner-row .amt { font: 700 16px var(--font-mono); color: var(--ok); text-align: right; }
.winner-row .jp { display: block; font-size: 12px; color: var(--gold); }
.winner-row.me { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.stage-controls { position: absolute; bottom: 12px; right: 12px; display: flex; gap: 8px; align-items: flex-end; z-index: 5; }
.sound-btn { display: flex; align-items: center; gap: 6px; }
.sound-btn {
    border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 8px; height: 34px;
    background: rgba(0, 0, 0, 0.6); color: #fff; padding: 0 11px; font-size: 13px; cursor: pointer;
}

/* ---------- Bolas ---------- */
.ball {
    --c: var(--gold);
    width: var(--size, 64px); height: var(--size, 64px); border-radius: 50%;
    display: grid; place-items: center; align-content: center;
    background: radial-gradient(circle at 50% 50%, #fff 0 46%, var(--c) 47% 100%);
    color: #111;
    font-family: var(--font-display); line-height: .9;
}
.ball .l { font-size: calc(var(--size, 64px) * 0.22); color: var(--c); }
.ball .n { font-size: calc(var(--size, 64px) * 0.42); }
.ball.pop { animation: pop .45s ease-out; }
.ball-giant { --size: clamp(120px, 26vw, 220px); }
.c-B { --c: var(--col-b); } .c-I { --c: var(--col-i); } .c-N { --c: var(--col-n); } .c-G { --c: var(--col-g); } .c-O { --c: var(--col-o); }

.last-balls { display: flex; gap: 6px; }
/* Tiempo de la partida, al lado del título "Tablero" */
#board-panel .panel-head { flex-wrap: wrap; row-gap: 8px; }
#board-panel .panel-head h2 { flex: 0 0 auto; }
#board-panel .last-balls { margin-left: auto; }
@media (max-width: 600px) { #board-panel #balls-count { margin-left: auto; } }
.game-timer {
    font: 700 14px/1 var(--font-mono); color: var(--gold-500, #f5c542);
    background: rgba(245, 197, 66, 0.12); border: 1px solid rgba(245, 197, 66, 0.35);
    padding: 4px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.game-timer:empty { display: none; }
.last-balls .ball { --size: 30px; box-shadow: none; }

/* ---------- Premios ---------- */
.prizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
/* Acumulado (jackpot): centrado debajo de las figuras */
.acumulado {
    align-self: center; width: min(100%, 460px); text-align: center;
    padding: 6px 14px 7px; border-radius: 12px;
    background: linear-gradient(180deg, rgba(245, 197, 66, 0.14), rgba(245, 197, 66, 0.04));
    border: 1px solid rgba(245, 197, 66, 0.45);
}
.acumulado[hidden] { display: none; }
/* Título al lado del monto, en la misma línea */
.acumulado-top { display: flex; align-items: baseline; justify-content: center; gap: 10px; flex-wrap: nowrap; }
.acumulado-label { font: 400 clamp(15px, 4vw, 18px)/1 var(--font-display); letter-spacing: 2px; color: var(--muted); }
.acumulado-value { font: 400 clamp(24px, 5.5vw, 30px)/1 var(--font-display); letter-spacing: 1px; color: var(--gold); white-space: nowrap; }
.acumulado-how { margin-top: 1px; line-height: 1.2; }
.acumulado-cur { font: 700 0.45em var(--font-body, 'Space Grotesk', sans-serif); letter-spacing: 0; vertical-align: 0.15em; }
.acumulado-how { font-size: clamp(11px, 3.1vw, 12.5px); color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
    /* En el celular las 3 siguen en una fila: figura arriba, texto abajo */
    .prizes { gap: 6px; }
    .prize { flex-direction: column; align-items: center; text-align: center; padding: 8px 4px; gap: 6px; }
    .prize-info { width: 100%; }
    .prize-name { font-size: 13px; }
    .prize-amount { font-size: 12px; }
    .prize-label { font-size: 10px; }
}
.prize {
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
    display: flex; gap: 10px; align-items: center; position: relative; min-width: 0;
}
.prize.active { border-color: var(--gold); }
.prize.done { opacity: .6; }
.prize-info { min-width: 0; }
.prize-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.prize-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prize-amount { font: 700 14px var(--font-mono); color: var(--gold); }
.prize-won { font-size: 11px; color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mini-figure { display: grid; grid-template-columns: repeat(5, 7px); gap: 2px; flex-shrink: 0; }
.mini-figure i { width: 7px; height: 7px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.mini-figure i.on { background: var(--gold); }
/* Centro libre: estrella morada */
.mini-figure i.free {
    background: #a855f7; border-radius: 0; transform: scale(1.9);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* ---------- Tablero 1-75 ---------- */
.board { display: grid; grid-template-columns: 34px repeat(15, minmax(0, 1fr)); gap: 4px; }
.board .row-letter {
    display: grid; place-items: center; border-radius: 6px; font: 400 20px var(--font-display);
    background: var(--c); color: #fff;
}
.board .cell {
    aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%;
    font: 700 clamp(9px, 1.4vw, 13px) var(--font-mono); color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
}
.board .cell.on { background: var(--c); color: #fff; }
.board .cell.last { box-shadow: 0 0 0 2px #fff; animation: pop .45s ease-out; }
@media (max-width: 640px) {
    .board { grid-template-columns: 22px repeat(15, minmax(0, 1fr)); gap: 2px; }
    .board .row-letter { font-size: 14px; }
}

/* ---------- Venta ---------- */
/* Barra de progreso de la venta (encima de los cartones) */
.sale-progress {
    position: relative; height: 20px; border-radius: 999px; overflow: hidden; margin-bottom: 10px;
    background: rgba(124, 58, 237, 0.14); border: 1px solid rgba(168, 85, 247, 0.5);
}
/* Barra de carga clásica: morado → fucsia → azul, con rayas diagonales que
   siempre se mueven a la derecha y un brillo que late. */
.sale-progress i {
    /* Solo la punta izquierda redonda: el borde derecho del relleno es recto
       (la barra de afuera sí es redonda y lo recorta al llegar al 100%). */
    position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px 0 0 999px; overflow: hidden;
    background: linear-gradient(90deg, #7c3aed, #d946ef 55%, #3b82f6);
    transition: width .6s cubic-bezier(0.22, 0.8, 0.3, 1);
}
/* Rayas de barra de carga: una capa más ancha que se desliza a la derecha con
   transform (lo mueve la placa de video del celular, sin redibujar la página). */
.sale-progress i::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: -26px; right: 0;
    background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.24) 0 9px, rgba(255, 255, 255, 0) 9px 18px);
    background-size: 25.46px 25.46px;
    will-change: transform;
    animation: bar-stripes 0.7s linear infinite;
}
@keyframes bar-stripes { from { transform: translateX(0); } to { transform: translateX(25.46px); } }
.sale-progress span {
    position: relative; display: flex; align-items: center; justify-content: center; height: 100%;
    font: 700 12px var(--font-mono); color: #fff; letter-spacing: 0.5px;
}
.card-cost { font-size: 15px; margin-bottom: 8px; }
.card-cost b { color: var(--gold); font-family: var(--font-mono); font-size: 17px; }
.promo {
    background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.35); color: var(--ok);
    border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.my-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ---------- Cartón ---------- */
/* Los números se escalan con el ancho del cartón (container queries):
   sin márgenes de más, así ocupan todo el espacio posible. */
.bcard {
    container-type: inline-size;
    background: #f7f4ea; color: #1b1b1b; border-radius: 8px; padding: 3px; cursor: pointer;
    position: relative; user-select: none; overflow: hidden;
    transition: transform .1s;
}
.bcard:hover { transform: translateY(-1px); }
/* Seleccionado: capa verde encima con un check */
.bcard.selected::after {
    content: '✓'; position: absolute; inset: 0; border-radius: 8px;
    display: grid; place-items: center;
    background: rgba(22, 163, 74, 0.62); box-shadow: inset 0 0 0 3px #16a34a;
    color: #fff; font: 700 60cqw/1 var(--font-body);
}
/* Vendido: capa azul con candado y el nombre de quien lo compró */
.bcard.sold { cursor: not-allowed; }
.sold-layer { display: none; }
.bcard.sold .sold-layer {
    position: absolute; inset: 0; border-radius: 8px; z-index: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%;
    background: rgba(29, 78, 216, 0.78); box-shadow: inset 0 0 0 3px #1d4ed8; color: #fff; text-align: center; padding: 6px;
}
.sold-layer i { font-size: 26cqw; }
.sold-layer .owner {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 700 12px/1.2 var(--font-body); font-size: max(11px, 11cqw);
    background: rgba(0, 0, 0, 0.35); border-radius: 999px; padding: 3px 8px;
}
.bcard.sold:hover { transform: none; }
.bcard-head {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px;
    font: 700 11px/1 var(--font-mono); font-size: max(10px, 9cqw); padding: 0 0 3px;
}
.bcard-head .side { display: flex; min-width: 0; }
/* Cartón de regalo: 🎁 centrado en el cartón (no en su columna) */
.bcard-head { position: relative; }
.bcard-head .gift { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -55%); font-size: clamp(13px, 11cqw, 18px); line-height: 1; }
.bcard-head .side.right { justify-content: flex-end; }
/* Número del cartón: arriba a la izquierda, pegado al borde del cartón como
   una pestaña (esquina de afuera igual a la del cartón, esquina de adentro redonda) */
.bcard-head .no {
    background: #1e1b4b; color: #fff; margin: -3px 0 0 -3px; border-radius: 8px 0 8px 0;
    padding: 4px 9px 4px 8px; font: 700 12px/1 var(--font-mono); font-size: clamp(11px, 10cqw, 15px);
}
.bcard-head .tag { background: var(--ok); color: #06281c; border-radius: 3px; padding: 1px 3px; font-size: clamp(9px, 7cqw, 12px); }
.bcard-head .need {
    white-space: nowrap; font-size: clamp(9px, 7.5cqw, 12px); letter-spacing: -0.02em;
    background: #7c3aed; color: #fff; border-radius: 999px; padding: 2px 6px;
}
.bcard-head .need.two { background: #ea580c; }
.bcard-head .tag { white-space: nowrap; }
.bcard-head .need.one { background: #dc2626; animation: need-one 0.9s ease-in-out infinite; }
@keyframes need-one { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.bcard-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
/* Encabezado B I N G O del cartón: todo morado, letras grandes */
.bcard-grid .h {
    text-align: center; color: #fff; border-radius: 2px; background: #7c3aed;
    font: 400 14px/1.1 var(--font-display); font-size: 15cqw; padding-top: 1px;
}
.bcard-grid .c {
    aspect-ratio: 1; display: grid; place-items: center; border-radius: 2px; background: #e8e3d3;
    font: 700 12px/1 var(--font-body); font-size: 12.4cqw; font-variant-numeric: tabular-nums; /* ~1px menos */
}
/* Casillero libre del centro: "k1" en morado */
.bcard-grid .c.free { background: #7c3aed; color: #fff; font: 800 12cqw/1 var(--font-body); letter-spacing: -0.5px; }
.bcard-grid .c.hit { background: var(--c); color: #fff; }
.bcard-grid .c.fig { outline: 2px dashed rgba(0, 0, 0, 0.35); outline-offset: -2px; }
.bcard-grid .c.hit.fig { outline-color: rgba(255, 255, 255, 0.8); }
.bcard.winner { box-shadow: 0 0 0 3px var(--ok); }
.my-grid .bcard { cursor: default; overflow: visible; } /* la ficha que cae se ve entera */
/* Cartón de regalo: fondo lila en vez de blanco (la figura sigue en amarillo) */
.my-grid .bcard.gift { background: #e7dcff; }
.my-grid .bcard.gift .bcard-grid .c:not(.free),
.my-grid .bcard.gift .bcard-grid .c.hit { background: #d9c8fb; }
.my-grid .bcard.gift.has-fig .bcard-grid .c.fig:not(.free) { background: #fcd34d; }
.my-grid .bcard:hover { transform: none; }

/* ---------- Carrito ---------- */
.cart {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20;
    width: min(620px, calc(100% - 32px));
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: #1d2750; border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px 14px;
}
.cart-info { display: flex; flex-direction: column; min-width: 0; }
.cart-gift { color: var(--ok); font-size: 13px; font-weight: 600; }
.cart-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Chat flotante (botón + panel, como en la ruleta de frutas) ---------- */
.chat-fab {
    position: fixed; right: 18px; bottom: 18px; z-index: 40;
    width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
    background: linear-gradient(160deg, #ffd766, var(--gold)); color: var(--gold-ink); font-size: 24px;
    display: flex; align-items: center; justify-content: center;
}
.chat-fab-badge {
    position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 4px;
    border-radius: 10px; background: var(--err); color: #fff; border: 2px solid var(--bg);
    font: 700 11px var(--font-mono); display: flex; align-items: center; justify-content: center;
}
.chat-panel {
    position: fixed; right: 18px; bottom: 84px; z-index: 40;
    width: min(340px, calc(100vw - 26px)); height: min(480px, calc(100vh - 110px));
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 14px;
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-header {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line);
    font: 400 18px var(--font-display); letter-spacing: .8px; color: var(--gold);
}
.chat-header > span:first-child { flex: 1; }
.chat-online { display: flex; align-items: center; gap: 6px; font: 12px var(--font-mono); color: var(--ok); letter-spacing: 0; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: blink 2s infinite; }
.chat-close {
    width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--panel-2); color: var(--text); font-size: 12px; flex-shrink: 0;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-message { display: flex; font-size: 13.5px; line-height: 1.4; }
.chat-message.own { justify-content: flex-end; }
.chat-message.system { color: var(--muted); font-style: italic; font-size: 13px; }
.chat-bubble {
    max-width: 82%; padding: 6px 10px; border-radius: 12px; border-bottom-left-radius: 4px;
    background: var(--panel-2); overflow-wrap: anywhere;
}
.chat-message.own .chat-bubble { background: #2563eb; color: #fff; border-radius: 12px; border-bottom-right-radius: 4px; }
.chat-user { color: var(--gold); font-weight: 700; margin-right: 6px; }
.chat-guest-tag {
    display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    color: var(--gold-ink); background: var(--gold); padding: 1px 6px; border-radius: 4px; margin-right: 6px; vertical-align: middle;
}
.chat-form { display: flex; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--line); }
.chat-form input {
    flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--text);
    border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 14px;
}
.chat-form input:focus { outline: none; border-color: var(--gold); }
.chat-login-note { margin: 0; padding: 11px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
    .panel { padding: 10px; }
    .layout { padding-left: 10px; padding-right: 10px; gap: 12px; }
    .chat-fab { width: 48px; height: 48px; font-size: 21px; right: 12px; bottom: 12px; }
    .chat-panel { left: 0; right: 0; bottom: 0; width: 100%; height: min(55vh, 420px); border-radius: 14px 14px 0 0; }
    /* La barra de compra deja lugar al botón del chat */
    .cart { left: 12px; right: 72px; width: auto; transform: none; bottom: 12px; padding: 10px; }
    .cart .btn { padding: 9px 12px; }
}

/* ---------- Bienvenida ---------- */
.welcome-overlay {
    position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px;
    background: rgba(8, 11, 24, 0.82);
}
.welcome-box {
    width: min(380px, 100%); text-align: center; padding: 28px 22px 22px;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px; animation: pop .35s ease-out;
}
.welcome-ball { width: 56px; height: 56px; font-size: 32px; margin: 0 auto 12px; }
.welcome-box h2 { font: 400 38px/1 var(--font-display); letter-spacing: 1px; margin: 0 0 10px; color: var(--gold); }
.welcome-box p { margin: 0 0 20px; font-size: 16px; line-height: 1.45; }
.welcome-btn { width: 100%; font-size: 17px; padding: 13px; }

.funds-box { border-color: rgba(248, 113, 113, 0.5); }
.funds-box h2 { color: var(--err); }
.funds-icon { font-size: 52px; line-height: 1; margin-bottom: 10px; }
.funds-missing { color: var(--err); font-size: 20px; }
.funds-box .welcome-btn { display: block; text-align: center; text-decoration: none; }
.funds-close { width: 100%; margin-top: 10px; }

/* ---------- Mantenimiento ---------- */
.maint-overlay {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
    background: rgba(8, 11, 24, 0.94);
}
.maint-box { text-align: center; max-width: 420px; }
.maint-icon { font-size: 54px; }
.maint-title { font: 400 40px/1 var(--font-display); letter-spacing: 1px; color: var(--gold); margin: 10px 0; }
.maint-box p { color: var(--muted); font-size: 16px; }

/* ---------- Aviso ---------- */
.toast {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30;
    background: #1d2750; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 16px; max-width: calc(100% - 32px); font-weight: 600;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--err); }

/* ---------------------------------------------------------
   Cortinilla entre videos (como en TV): 5 barras entran desde la
   derecha, tapan todo con el logo y salen por la izquierda. Los
   tiempos los pone js (--in, --out, --stagger).
   --------------------------------------------------------- */
.stinger { position: absolute; inset: 0; z-index: 8; overflow: hidden; container-type: inline-size; pointer-events: none; display: grid; grid-template-rows: repeat(5, 1fr); border-radius: inherit; }
.stinger[hidden] { display: none; }
.stinger i { display: block; transform: translateX(101%); will-change: transform; }
.stinger i:nth-child(1) { background: #7c3aed; }
.stinger i:nth-child(2) { background: #f5c542; }
.stinger i:nth-child(3) { background: #1e1b4b; }
.stinger i:nth-child(4) { background: #6d28d9; }
.stinger i:nth-child(5) { background: #f5c542; }
.stinger.in i { transform: translateX(0); transition: transform var(--in, 500ms) cubic-bezier(0.22, 0.8, 0.3, 1) calc(var(--i) * var(--stagger, 60ms)); }
.stinger.out i { transform: translateX(-101%); transition: transform var(--out, 500ms) cubic-bezier(0.7, 0, 0.84, 0.3) calc(var(--i) * var(--stagger, 60ms)); }
.stinger-logo {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0.28em;
    font: 400 clamp(34px, 11cqw, 96px)/1 var(--font-display, 'Bebas Neue', sans-serif); letter-spacing: 1px; color: #fff;
    opacity: 0; transition: opacity 120ms ease;
}
.stinger-logo b { color: #f5c542; font-weight: 400; }
.stinger.logo .stinger-logo { opacity: 1; }

/* ---------------------------------------------------------
   Deslizar hacia abajo para actualizar (celular): un círculo con el
   ícono de actualizar sigue al dedo y gira; al pasar el punto se pone
   de colores y, al soltar, gira con un halo y recarga la página.
   --------------------------------------------------------- */
html, body { overscroll-behavior-y: contain; } /* sin el "tirón" del navegador: usamos el nuestro */
.ptr {
    position: fixed; top: 0; left: 50%; z-index: 60; pointer-events: none;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transform: translate(-50%, calc(var(--pull, 0px) - 64px)); opacity: var(--ptr-op, 0);
}
.ptr.back { transition: transform .35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity .35s; }
.ptr-ring {
    position: relative; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center;
    background: #141b33;
}
/* Aro de colores que se va completando según cuánto tirás */
.ptr-ring::before {
    content: ''; position: absolute; inset: -3px; border-radius: 50%; padding: 3px;
    background: conic-gradient(#7c3aed, #d946ef, #3b82f6, #7c3aed var(--ptr-deg, 0deg), rgba(255, 255, 255, 0.12) 0);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.ptr-ring i { font-size: 21px; color: #f5c542; transform: rotate(var(--ptr-rot, 0deg)); transition: color .2s; }
.ptr.ready .ptr-ring { animation: ptr-pop .25s ease-out; }
.ptr.ready .ptr-ring i { color: #fff; }
.ptr.ready .ptr-ring { background: linear-gradient(135deg, #7c3aed, #d946ef 55%, #3b82f6); }
.ptr-label {
    font: 700 12px var(--font-mono); color: #fff; letter-spacing: .5px; white-space: nowrap;
    background: rgba(20, 27, 51, 0.92); padding: 4px 10px; border-radius: 999px; opacity: var(--ptr-op, 0);
}
/* Al soltar: gira sin parar con un halo que late, y se recarga */
.ptr.loading { transform: translate(-50%, 14px); opacity: 1; transition: transform .25s ease-out; }
.ptr.loading .ptr-ring { background: linear-gradient(135deg, #7c3aed, #d946ef 55%, #3b82f6); animation: ptr-halo 1s ease-in-out infinite; }
.ptr.loading .ptr-ring::before { background: conic-gradient(#fff, rgba(255, 255, 255, 0) 70%); animation: ptr-spin .7s linear infinite; }
.ptr.loading .ptr-ring i { color: #fff; animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
@keyframes ptr-pop { 0% { transform: scale(1); } 50% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes ptr-halo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* Fichas anotadas en "Mis cartones": redondas, verdes si son parte de la
   figura en juego y gris oscuro si no. La ficha es UNA sola pieza (el <span>
   con el número) para que la animación sea liviana aunque haya 50 cartones. */
.my-grid .bcard-grid .c { position: relative; }
.my-grid .bcard-grid .c.hit { background: #e8e3d3; outline: none; }
.my-grid .bcard-grid .c.hit span {
    display: grid; place-items: center; width: 98%; aspect-ratio: 1; border-radius: 50%;
    background: #16a34a; color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}
/* La figura en juego, marcada en amarillo en el cartón */
.my-grid .bcard.has-fig .bcard-grid .c.fig { background: #fcd34d; outline: none; }
/* El centro "k1" sigue morado aunque sea parte de la figura (con borde amarillo) */
.my-grid .bcard.has-fig .bcard-grid .c.free.fig { background: #7c3aed; box-shadow: inset 0 0 0 3px #fcd34d; }
/* Gris oscuro: ficha anotada fuera de la figura en juego */
.my-grid .bcard.has-fig .bcard-grid .c.hit:not(.fig) span { background: #8d95a3; color: #fff; }
/* La última ficha cantada: en azul (hasta que salga la siguiente) */
.my-grid .bcard-grid .c.hit.last span,
.my-grid .bcard.has-fig .bcard-grid .c.hit.last span { background: #2563eb; color: #fff; }
/* …y si cayó FUERA de la figura: azul más apagado, tirando a gris */
.my-grid .bcard.has-fig .bcard-grid .c.hit.last:not(.fig) span { background: #4a6184; }
/* Se anota, EN CASCADA (cada cartón visible un poco después del anterior):
   la ficha cae desde bien arriba, grande, rebota y se asienta; un aro dorado
   se abre y el cartón da un saltito con borde dorado. */
.my-grid .bcard-grid .c.just { z-index: 3; }
.my-grid .bcard-grid .c.just span {
    animation: chip-drop .7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    animation-delay: calc(var(--d, 0) * 150ms);
}
@keyframes chip-drop {
    0%   { transform: translateY(-420%) scale(2.4); opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
.my-grid .bcard-grid .c.just::after {
    content: ''; position: absolute; left: 1%; top: 1%; width: 98%; height: 98%; border-radius: 50%;
    border: 4px solid #fcd34d; pointer-events: none; opacity: 0;
    animation: chip-ring .6s ease-out both;
    animation-delay: calc(var(--d, 0) * 150ms + 450ms);
}
@keyframes chip-ring { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2.6); opacity: 0; } }
.my-grid .bcard.got-mark {
    animation: card-bump .5s ease-out both;
    animation-delay: calc(var(--d, 0) * 150ms + 420ms);
}
@keyframes card-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.05); } }
.my-grid .bcard.got-mark::after {
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    border: 4px solid #fcd34d; opacity: 0;
    animation: card-got-mark 1.1s ease-out both;
    animation-delay: calc(var(--d, 0) * 150ms + 420ms);
}
@keyframes card-got-mark { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Ganadores (abajo de todo): cada uno con su cartón ganador en chico */
@media (max-width: 960px) { #winners-panel { order: 6; } }
.win-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.win-item { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.win-item.me { border-color: var(--gold); }
.win-card { width: 104px; flex: 0 0 104px; cursor: default; }
.win-card:hover { transform: none; }
.win-card .bcard-grid .c.hit { background: #16a34a; color: #fff; }
.win-card.has-fig .bcard-grid .c.fig { background: #fcd34d; }
.win-card.has-fig .bcard-grid .c.fig.hit { background: #16a34a; color: #fff; box-shadow: inset 0 0 0 2px #fcd34d; }
.win-card .bcard-grid .c.hit:not(.fig) { background: #9ca3af; color: #fff; }
.win-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.win-fig { font-size: 12px; color: var(--muted); }
.win-user { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-you { color: var(--gold); font-weight: 600; }
.win-amount { font: 700 16px var(--font-mono); color: var(--gold); }
.win-jp { font: 600 11px var(--font-body); color: #d946ef; }
.win-ball { font-size: 12px; color: var(--muted); }
