/* ====================================================================
   Bingo Empresarial — estilos y animaciones
   ==================================================================== */
:root {
    --bg: #0f1226;
    --bg2: #1a1d3a;
    --panel: #20244a;
    --panel-2: #272c57;
    --ink: #eef0ff;
    --muted: #9aa0c7;
    --primary: #6c5ce7;
    --primary-2: #8b7bff;
    --accent: #06d6a0;
    --warn: #ef476f;
    --gold: #ffd166;
    /* Colores por columna B I N G O */
    --c0: #ef476f; --c1: #f78c6b; --c2: #ffd166; --c3: #06d6a0; --c4: #118ab2;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
    font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-2); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, 'Cascadia Code', monospace; letter-spacing: .05em; }

/* -------- Fondos (imágenes de red + degradado de respaldo) -------- */
.auth-bg, .app-bg {
    min-height: 100vh;
    background-color: var(--bg); /* respaldo si la imagen no carga */
    background-image:
        radial-gradient(1200px 600px at 80% -10%, rgba(108,92,231,.35), transparent 60%),
        radial-gradient(900px 500px at 0% 110%, rgba(6,214,160,.22), transparent 55%),
        linear-gradient(160deg, var(--bg), var(--bg2));
    background-attachment: fixed;
    background-size: cover;
}
/* Pantalla de acceso: ambiente festivo */
.auth-bg {
    background-image:
        linear-gradient(160deg, rgba(15,18,38,.88), rgba(26,29,58,.82)),
        url('https://images.unsplash.com/photo-1492684223066-81342ee5ff30?w=1920&q=80');
    background-position: center;
    background-repeat: no-repeat;
}
/* Dashboard: sutil */
.app-bg {
    background-image:
        radial-gradient(1200px 600px at 80% -10%, rgba(108,92,231,.30), transparent 60%),
        linear-gradient(160deg, rgba(15,18,38,.94), rgba(26,29,58,.9)),
        url('https://images.unsplash.com/photo-1530103862676-de8c9debad1d?w=1920&q=80');
    background-position: center;
    background-repeat: no-repeat;
}
/* Vista del organizador: escenario con luces */
.host-bg {
    background-image:
        linear-gradient(160deg, rgba(11,13,30,.93), rgba(20,18,46,.9)),
        url('https://images.unsplash.com/photo-1513151233558-d860c5398176?w=1920&q=80') !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}
/* Vista del jugador: ambiente de fiesta */
.play-bg {
    background-image:
        linear-gradient(160deg, rgba(15,18,38,.9), rgba(26,29,58,.86)),
        url('https://images.unsplash.com/photo-1492684223066-81342ee5ff30?w=1920&q=80') !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* -------- Botones -------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    border: none; border-radius: 12px; padding: .7em 1.2em;
    font-size: 1rem; font-weight: 600; cursor: pointer; color: #fff;
    background: var(--panel-2); transition: transform .08s, filter .15s, box-shadow .15s;
    text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 18px rgba(108,92,231,.4); }
.btn-accent  { background: linear-gradient(135deg, #04b386, var(--accent)); box-shadow: 0 6px 18px rgba(6,214,160,.35); }
.btn-warn    { background: linear-gradient(135deg, #c9264c, var(--warn)); }
.btn-ghost   { background: rgba(255,255,255,.08); }
.btn-ghost:hover { background: rgba(255,255,255,.16); }
.btn.icon { padding: .55em .7em; font-size: 1.1rem; }
.btn.icon.active { background: var(--primary); }
.btn.sm { padding: .4em .7em; font-size: .85rem; border-radius: 9px; }
.btn.block { width: 100%; }

.btn-draw {
    background: linear-gradient(135deg, var(--gold), #ffb703);
    color: #3a2a00; font-size: 1.15rem; padding: .8em 1.6em;
    box-shadow: 0 8px 24px rgba(255,209,102,.45);
}
.btn-draw:not(:disabled) { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 8px 24px rgba(255,209,102,.45);} 50% { box-shadow: 0 8px 34px rgba(255,209,102,.8);} }

.btn-bingo {
    background: linear-gradient(135deg, var(--warn), #ff6b9d);
    font-size: 1.6rem; font-weight: 800; letter-spacing: .05em;
    padding: .7em 1.4em; width: 100%;
    box-shadow: 0 10px 30px rgba(239,71,111,.5);
}
.btn-bingo:not(:disabled) { animation: bingoPulse 1s infinite; }
@keyframes bingoPulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.04);} }

/* -------- Auth -------- */
.auth-card {
    max-width: 420px; margin: 7vh auto; padding: 2rem;
    background: rgba(32,36,74,.85); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius); box-shadow: var(--shadow); position: relative; z-index: 2;
}
.auth-card h1 { margin: 0 0 1rem; font-size: 1.6rem; text-align: center; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1.2rem; background: rgba(0,0,0,.2); padding: .3rem; border-radius: 12px; }
.tab { flex: 1; background: none; border: none; color: var(--muted); padding: .6em; border-radius: 9px; cursor: pointer; font-weight: 600; }
.tab.active { background: var(--primary); color: #fff; }

.form { display: flex; flex-direction: column; gap: .9rem; }
.form.row { flex-direction: row; align-items: center; }
.form label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--muted); }
.form input, .form select {
    background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12);
    color: var(--ink); padding: .7em .8em; border-radius: 10px; font-size: 1rem; outline: none;
}
.form input:focus, .form select:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(139,123,255,.25); }
.code-input { text-transform: uppercase; letter-spacing: .25em; text-align: center; font-weight: 700; }

/* Login con Google */
.g-btn-wrap { display: flex; justify-content: center; margin: .2rem 0 .4rem; }
.auth-divider { display: flex; align-items: center; gap: .8rem; color: var(--muted); margin: 1rem 0; font-size: .85rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.12); }

.msg { min-height: 1.2em; text-align: center; color: var(--warn); margin: .6rem 0; }
.msg.ok { color: var(--accent); }
.msg.err { color: var(--warn); }
.flash { background: rgba(255,255,255,.07); padding: .6em .9em; border-radius: 10px; margin-bottom: .6rem; font-size: .92rem; }

/* Bolas flotantes de fondo */
.floating-balls { position: fixed; inset: 0; overflow: hidden; z-index: 1; pointer-events: none; }
.fball {
    position: absolute; width: 70px; height: 70px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; color: #fff;
    opacity: .18; animation: float 14s infinite ease-in-out;
    box-shadow: inset -8px -8px 16px rgba(0,0,0,.3);
}
.fball.b { background: var(--c0); left: 8%; top: 20%; }
.fball.i { background: var(--c1); left: 75%; top: 12%; animation-delay: -2s; }
.fball.n { background: var(--c2); left: 20%; top: 70%; animation-delay: -5s; }
.fball.g { background: var(--c3); left: 85%; top: 65%; animation-delay: -7s; }
.fball.o { background: var(--c4); left: 50%; top: 40%; animation-delay: -9s; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-40px) rotate(20deg); } }

/* -------- Topbar -------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1.4rem; background: rgba(0,0,0,.25);
    border-bottom: 1px solid rgba(255,255,255,.08); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.brand .back { background: rgba(255,255,255,.1); border-radius: 8px; padding: 0 .5em; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.user-chip { color: var(--muted); }
.badge { background: var(--primary); color: #fff; font-size: .7rem; padding: .15em .5em; border-radius: 6px; vertical-align: middle; }
.pill { background: rgba(255,255,255,.08); padding: .35em .8em; border-radius: 20px; font-size: .85rem; }
.pill.st-running { background: rgba(239,71,111,.25); color: #ff9bb5; }
.pill.st-paused  { background: rgba(255,209,102,.2); color: var(--gold); }
.pill.st-finished{ background: rgba(6,214,160,.2); color: var(--accent); }

/* -------- Dashboard -------- */
.container { max-width: 1000px; margin: 0 auto; padding: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
.panel { background: rgba(32,36,74,.7); border: 1px solid rgba(255,255,255,.07); border-radius: var(--radius); padding: 1.3rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.2rem; }
.panel h3 { margin: 0 0 .8rem; font-size: 1rem; }

/* Encabezado con buscador */
.events-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.events-head h2 { margin: 0; }
.search-box { position: relative; flex: 1 1 240px; max-width: 360px; }
.search-box .search-ico { position: absolute; left: .7em; top: 50%; transform: translateY(-50%); opacity: .7; pointer-events: none; }
.search-box input { width: 100%; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.12);
    color: var(--ink); padding: .6em .8em .6em 2.2em; border-radius: 10px; font-size: .95rem; outline: none; }
.search-box input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(139,123,255,.25); }

/* Filtro de eventos (chips) */
.events-filter { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chip { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); color: var(--muted);
    padding: .4em .9em; border-radius: 20px; cursor: pointer; font-size: .85rem; font-weight: 600; transition: all .15s; }
.chip:hover { background: rgba(255,255,255,.14); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.events-list { display: flex; flex-direction: column; gap: .7rem; }
.tag-finished { font-size: .72rem; background: rgba(6,214,160,.22); color: var(--accent); padding: .12em .5em; border-radius: 6px; font-weight: 700; vertical-align: middle; margin-left: .3em; }
.event-row.finished { opacity: .88; }
.event-row.finished .event-name { color: var(--muted); }
.event-row.finished.won { opacity: 1; }
.event-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    background: rgba(0,0,0,.2); padding: 1rem; border-radius: 12px; }
.event-name { font-weight: 700; font-size: 1.05rem; }
.event-sub { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.event-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .35em; background: var(--muted); }
.status-dot.running { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.status-dot.paused { background: var(--gold); }
.status-dot.finished { background: var(--accent); }
.status-dot.lobby { background: var(--primary-2); }

/* Aviso de ganador en la lista de eventos */
.event-row.won { border: 1px solid rgba(255,209,102,.55); background: linear-gradient(135deg, rgba(255,209,102,.12), rgba(0,0,0,.2)); box-shadow: 0 0 18px rgba(255,209,102,.18); }
.tag-win { font-size: .75rem; background: var(--gold); color: #3a2a00; padding: .12em .5em; border-radius: 6px; font-weight: 800; vertical-align: middle; margin-left: .3em; }
.event-winner { margin-top: .4rem; font-size: .9rem; color: var(--gold); }
.event-winner.me { color: var(--accent); font-weight: 700; }

/* ====================================================================
   ESCENARIO / BOLA ACTUAL
   ==================================================================== */
.play-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.5rem; padding: 1.5rem; max-width: 1300px; margin: 0 auto; align-items: start; }
/* ---- Host a pantalla completa: ocupa todo el alto y ancho ---- */
body.host-bg { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.host-bg .topbar { flex: 0 0 auto; }
.host-layout {
    flex: 1 1 auto; min-height: 0;
    display: grid;
    grid-template-columns: minmax(380px, 1.25fr) minmax(300px, 1fr) minmax(300px, 360px);
    gap: 1rem; padding: 1rem 1.2rem; width: 100%; max-width: none; margin: 0;
}
.col-machine, .col-center, .col-side { display: flex; flex-direction: column; min-height: 0; gap: .8rem; }
.col-machine { align-items: center; background: rgba(0,0,0,.28); border-radius: var(--radius); padding: 1rem; }
.col-machine .machine { flex: 1 1 auto; min-height: 0; width: 100%; justify-content: flex-start; }
.col-side { overflow: hidden; }

/* Bloques de la columna central */
.center-block { background: rgba(0,0,0,.28); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; min-height: 0; }
.center-block.grow { flex: 1 1 auto; }
.block-title { margin: 0 0 .7rem; font-size: 1rem; color: var(--ink); display: flex; align-items: center; gap: .4rem; }
.counter.inline { color: var(--muted); font-weight: 400; font-size: .95rem; }

/* El tablero 1-75 rellena su bloque */
.col-center .recent { margin: 0; }
.col-center .board-mini.host { max-width: none; margin: 0; height: 100%; grid-template-rows: repeat(5, 1fr); }
.col-center .board-mini.host .mini-num { aspect-ratio: auto; font-size: clamp(.7rem, 1.4vw, 1.1rem); }

/* Paneles laterales con scroll interno */
.col-side .panel { min-height: 0; }
.col-side .panel.grow { flex: 1 1 auto; display: flex; flex-direction: column; }
.col-side .claims-list, .col-side .players-list { flex: 1 1 auto; max-height: none; overflow-y: auto; }
.col-side .winners-panel { flex: 0 0 auto; max-height: 38%; overflow-y: auto; }

/* La bola del visor se adapta un poco al alto disponible en proyección */
.col-machine .result-visor { flex: 0 0 auto; }
.col-machine .host-controls { margin: .3rem 0 0; flex: 0 0 auto; }
.col-machine .cb-caption.big { margin: .2rem 0; flex: 0 0 auto; }

.stage { background: rgba(0,0,0,.25); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.stage-big { padding: 2rem; }

.current-ball-wrap { display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.current-ball {
    width: 170px; height: 170px; border-radius: 50%;
    display: grid; place-items: center; position: relative;
    background: radial-gradient(circle at 35% 30%, #fff, #ddd 40%, #999);
    color: #222; box-shadow: inset -10px -12px 22px rgba(0,0,0,.35), var(--shadow);
}
.current-ball.big { width: 240px; height: 240px; }
.current-ball.empty { background: radial-gradient(circle at 35% 30%, #3a3f6e, #20244a); color: var(--muted); }
.current-ball .cb-letter { position: absolute; top: 16%; font-weight: 800; font-size: 1.2rem; letter-spacing: .1em; }
.current-ball.big .cb-letter { font-size: 1.8rem; }
.current-ball .cb-number { font-size: 4rem; font-weight: 900; line-height: 1; }
.current-ball.big .cb-number { font-size: 6rem; }
/* color del aro según columna */
.current-ball.col0 { box-shadow: inset -10px -12px 22px rgba(0,0,0,.3), 0 0 0 8px var(--c0), var(--shadow); }
.current-ball.col1 { box-shadow: inset -10px -12px 22px rgba(0,0,0,.3), 0 0 0 8px var(--c1), var(--shadow); }
.current-ball.col2 { box-shadow: inset -10px -12px 22px rgba(0,0,0,.3), 0 0 0 8px var(--c2), var(--shadow); }
.current-ball.col3 { box-shadow: inset -10px -12px 22px rgba(0,0,0,.3), 0 0 0 8px var(--c3), var(--shadow); }
.current-ball.col4 { box-shadow: inset -10px -12px 22px rgba(0,0,0,.3), 0 0 0 8px var(--c4), var(--shadow); }

.current-ball.spinning { animation: ballSpin .5s linear infinite; }
@keyframes ballSpin { 0% { transform: rotate(0) scale(1);} 50% { transform: rotate(180deg) scale(1.05);} 100% { transform: rotate(360deg) scale(1);} }
.current-ball.reveal { animation: ballReveal .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes ballReveal { 0% { transform: scale(.3); opacity: 0;} 60% { transform: scale(1.2);} 100% { transform: scale(1); opacity: 1;} }

.cb-caption { margin-top: .4rem; font-size: 1.1rem; color: var(--muted); min-height: 1.4em; }
.cb-caption.big { font-size: 1.8rem; font-weight: 800; color: var(--ink); }

/* Jaula de bolas (host) */
.cage-wrap { position: relative; display: inline-grid; place-items: center; padding: 1rem; }
.cage {
    position: absolute; width: 320px; height: 320px; border-radius: 50%;
    border: 6px dashed rgba(255,255,255,.12); pointer-events: none;
}
.cage.shaking { animation: cageShake .3s linear infinite; }
@keyframes cageShake { 0%,100% { transform: rotate(-3deg);} 50% { transform: rotate(3deg);} }
.cage-ball {
    position: absolute; width: 26px; height: 26px; border-radius: 50%;
    top: 50%; left: 50%;
    transform: rotate(calc(var(--i) * 22.5deg)) translateX(130px);
    box-shadow: inset -4px -4px 8px rgba(0,0,0,.35);
}
.cage.shaking .cage-ball { animation: orbit 1.2s linear infinite; }
@keyframes orbit { from { transform: rotate(calc(var(--i)*22.5deg)) translateX(130px);} to { transform: rotate(calc(var(--i)*22.5deg + 360deg)) translateX(130px);} }
.cage-ball.col0 { background: var(--c0);} .cage-ball.col1 { background: var(--c1);}
.cage-ball.col2 { background: var(--c2);} .cage-ball.col3 { background: var(--c3);}
.cage-ball.col4 { background: var(--c4);}

/* Bolas recientes */
.recent { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: 1.2rem 0; min-height: 2.6rem; }
.recent-ball {
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 800; font-size: .85rem; color: #fff;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.5), transparent), var(--panel-2);
    box-shadow: inset -4px -5px 10px rgba(0,0,0,.35);
}
.recent-ball.col0 { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.45), transparent), var(--c0); }
.recent-ball.col1 { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.45), transparent), var(--c1); color:#3a2a00;}
.recent-ball.col2 { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.45), transparent), var(--c2); color:#3a2a00;}
.recent-ball.col3 { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.45), transparent), var(--c3); }
.recent-ball.col4 { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.45), transparent), var(--c4); }
.recent-ball.newest { animation: pop .5s cubic-bezier(.2,1.5,.4,1); outline: 3px solid #fff; }
@keyframes pop { 0% { transform: scale(.2);} 100% { transform: scale(1);} }

/* Tablero mini 1-75 */
.board-mini { display: grid; grid-template-columns: repeat(15, 1fr); gap: 4px; margin: 1rem auto 0; max-width: 560px; }
.board-mini.host { max-width: 720px; }
.mini-num {
    aspect-ratio: 1; display: grid; place-items: center; border-radius: 6px;
    background: rgba(255,255,255,.05); color: var(--muted); font-size: .72rem; font-weight: 600;
    transition: all .25s;
}
.board-mini.host .mini-num { font-size: .85rem; }
.mini-num.hit { background: var(--accent); color: #042b20; transform: scale(1.05); box-shadow: 0 0 8px rgba(6,214,160,.6); }
.counter { margin-top: 1rem; color: var(--muted); }
.counter b { color: var(--ink); font-size: 1.1rem; }

/* ====================================================================
   CARTILLA
   ==================================================================== */
.card-area h2 { margin-top: 0; }
.bingo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 420px; margin: 0 auto; }
.bingo-head {
    aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px;
    font-weight: 900; font-size: 1.5rem; color: #fff;
}
.bingo-head.h0 { background: var(--c0); } .bingo-head.h1 { background: var(--c1); color:#3a2a00;}
.bingo-head.h2 { background: var(--c2); color:#3a2a00;} .bingo-head.h3 { background: var(--c3); }
.bingo-head.h4 { background: var(--c4); }
.bingo-cell {
    aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px;
    background: rgba(255,255,255,.07); font-size: 1.4rem; font-weight: 700;
    transition: transform .25s, background .25s; position: relative;
}
.bingo-cell.free { background: rgba(108,92,231,.3); color: var(--gold); }
.bingo-cell.marked {
    background: linear-gradient(135deg, var(--accent), #04b386); color: #042b20;
    animation: daub .4s cubic-bezier(.2,1.5,.4,1);
}
.bingo-cell.marked::after {
    content: ''; position: absolute; inset: 8%; border-radius: 50%;
    border: 3px solid rgba(255,255,255,.5);
}
@keyframes daub { 0% { transform: scale(.6) rotate(-15deg);} 100% { transform: scale(1) rotate(0);} }
.bingo-cell.win { background: linear-gradient(135deg, var(--gold), #ffb703); color: #3a2a00; animation: winflash 1s infinite; }
@keyframes winflash { 0%,100% { box-shadow: 0 0 0 rgba(255,209,102,.0);} 50% { box-shadow: 0 0 18px rgba(255,209,102,.9);} }
/* Casilla clicable (marcado manual) */
.bingo-cell.clickable { cursor: pointer; }
.bingo-cell.clickable:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); }
.bingo-cell.marked.clickable:hover { background: linear-gradient(135deg, var(--accent), #04b386); }
/* Pendiente: ya salió pero no lo marcaste (tras "Revisar") */
.bingo-cell.pending { animation: pendPulse 1s infinite; }
@keyframes pendPulse { 0%,100% { box-shadow: inset 0 0 0 3px rgba(255,209,102,.5); } 50% { box-shadow: inset 0 0 0 3px rgba(255,209,102,1), 0 0 14px rgba(255,209,102,.7); } }

/* Encabezado de la cartilla + ayudas */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.card-head h2 { margin: 0; }
.hint { color: var(--muted); font-size: .82rem; margin: .3rem 0 .8rem; }
.review-msg { margin-top: .7rem; color: var(--gold); font-size: .9rem; min-height: 1.2em; text-align: center; }

.claim-area { margin-top: 1.5rem; text-align: center; }
.claim-status { margin-top: .8rem; color: var(--muted); min-height: 1.4em; }

/* ====================================================================
   HOST: controles, side, modal
   ==================================================================== */
.host-controls { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin: 1.5rem 0; }
.side { display: flex; flex-direction: column; gap: 1.2rem; }
.claims-list, .players-list { display: flex; flex-direction: column; gap: .6rem; max-height: 320px; overflow-y: auto; }
.claim-row, .player-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    background: rgba(0,0,0,.2); padding: .6rem .8rem; border-radius: 10px; }
.claim-row { border-left: 3px solid var(--warn); animation: glowin 1s; }
@keyframes glowin { from { background: rgba(239,71,111,.3);} to { background: rgba(0,0,0,.2);} }
/* Panel de ganadores (host) */
.winners-panel { border: 1px solid rgba(255,209,102,.5); background: linear-gradient(135deg, rgba(255,209,102,.14), rgba(0,0,0,.25)); box-shadow: 0 0 22px rgba(255,209,102,.2); }
.winners-panel h3 { color: var(--gold); }
.winners-list { display: flex; flex-direction: column; gap: .6rem; }
.winner-row { display: flex; align-items: center; gap: .7rem; background: rgba(0,0,0,.22); padding: .6rem .8rem; border-radius: 10px; border-left: 3px solid var(--gold); animation: winnerIn .5s cubic-bezier(.2,1.4,.4,1); }
.winner-medal { font-size: 1.5rem; }
.winner-info { flex: 1; }
@keyframes winnerIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.dot-badge { display: none; background: var(--warn); color: #fff; border-radius: 20px; padding: 0 .5em; font-size: .8rem; }
.dot-badge.show { display: inline-block; animation: bingoPulse 1s infinite; }

.overlay { position: fixed; inset: 0; background: rgba(5,7,20,.8); backdrop-filter: blur(6px);
    display: grid; place-items: center; z-index: 100; }
.overlay-box { background: var(--panel); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius);
    padding: 2rem; text-align: center; max-width: 90vw; box-shadow: var(--shadow); position: relative; }
.overlay-box.wide { width: 480px; }
.overlay-box.xwide { width: min(820px, 94vw); }
.review-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; text-align: left; }
.review-right h3 { margin: 0 0 .7rem; font-size: 1rem; }
/* Bolas que salieron, en columnas B-I-N-G-O */
.modal-balls { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; max-height: 340px; overflow-y: auto; }
.bb-col { display: flex; flex-direction: column; gap: 4px; }
.bb-head { height: 34px; display: grid; place-items: center; border-radius: 8px; font-weight: 900; font-size: 1.1rem; color: #fff; position: sticky; top: 0; }
.bb-head.h0 { background: var(--c0); } .bb-head.h1 { background: var(--c1); color:#3a2a00; }
.bb-head.h2 { background: var(--c2); color:#3a2a00; } .bb-head.h3 { background: var(--c3); } .bb-head.h4 { background: var(--c4); }
.bb-nums { display: flex; flex-direction: column; gap: 4px; }
.bb-num { text-align: center; padding: .28em 0; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--muted); font-weight: 700; font-size: .85rem; }
.bb-num.oncard { background: linear-gradient(135deg, var(--accent), #04b386); color: #042b20; outline: 2px solid #fff; }
.bb-empty { text-align: center; color: rgba(255,255,255,.2); padding: .2em 0; }
@media (max-width: 700px) { .review-cols { grid-template-columns: 1fr; } }
.overlay-box h1 { font-size: 3rem; margin: .2rem 0; color: var(--gold); }
.modal-close { position: absolute; top: .8rem; right: 1rem; background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; }
.modal-verdict { margin: 1rem 0; font-size: 1.1rem; }
.ok-big { color: var(--accent); font-weight: 800; }
.err-big { color: var(--warn); font-weight: 800; }
.modal-actions { display: flex; gap: .8rem; justify-content: center; }
.overlay-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: .6rem; }
.redirect-note { margin-top: 1rem; color: var(--muted); font-size: .9rem; }

/* ====================================================================
   MÁQUINA DE BINGO 3D (host)
   ==================================================================== */
.machine { position: relative; display: flex; flex-direction: column; align-items: center; }
.machine-canvas-wrap { flex: 1 1 auto; width: 100%; min-height: 0; margin-top: -4px; }
#machine-canvas { width: 100%; height: 100%; display: block; }

/* Visor donde aparece la bola cantada (sale del tubo) */
.result-visor {
    position: relative; z-index: 3;
    width: 168px; height: 168px; border-radius: 50%;
    display: grid; place-items: center;
    background: radial-gradient(circle at 50% 35%, rgba(40,44,90,.6), rgba(15,18,38,.9));
    border: 4px solid rgba(139,123,255,.5);
    box-shadow: 0 0 0 6px rgba(15,18,38,.7), 0 14px 34px rgba(0,0,0,.45), inset 0 4px 18px rgba(0,0,0,.5);
    perspective: 700px;
}
.result-visor::before {
    /* "Cuello" que conecta el visor con el tubo de la máquina */
    content: ''; position: absolute; bottom: -26px; width: 46px; height: 30px;
    background: linear-gradient(180deg, rgba(139,123,255,.4), rgba(60,47,135,.15));
    border-radius: 0 0 8px 8px; z-index: -1;
}
.result-ball {
    width: 138px; height: 138px; border-radius: 50%;
    display: grid; place-items: center; position: relative;
    background: radial-gradient(circle at 35% 28%, #fff, #ddd 38%, #9aa 100%);
    color: #222; box-shadow: inset -10px -12px 24px rgba(0,0,0,.35), 0 6px 14px rgba(0,0,0,.4);
    transform-style: preserve-3d;
}
.result-ball.empty { background: radial-gradient(circle at 35% 30%, #3a3f6e, #20244a); color: var(--muted); box-shadow: inset -6px -8px 18px rgba(0,0,0,.4); }
.result-ball .cb-letter { position: absolute; top: 14%; font-weight: 800; font-size: 1.4rem; letter-spacing: .12em; }
.result-ball .cb-number { font-size: 3.6rem; font-weight: 900; line-height: 1; }
/* Aro de color por columna */
.result-ball.col0 { box-shadow: inset -10px -12px 24px rgba(0,0,0,.3), 0 0 0 7px var(--c0), 0 8px 20px rgba(239,71,111,.5); }
.result-ball.col1 { box-shadow: inset -10px -12px 24px rgba(0,0,0,.3), 0 0 0 7px var(--c1), 0 8px 20px rgba(247,140,107,.5); }
.result-ball.col2 { box-shadow: inset -10px -12px 24px rgba(0,0,0,.3), 0 0 0 7px var(--c2), 0 8px 20px rgba(255,209,102,.5); }
.result-ball.col3 { box-shadow: inset -10px -12px 24px rgba(0,0,0,.3), 0 0 0 7px var(--c3), 0 8px 20px rgba(6,214,160,.5); }
.result-ball.col4 { box-shadow: inset -10px -12px 24px rgba(0,0,0,.3), 0 0 0 7px var(--c4), 0 8px 20px rgba(17,138,178,.5); }
.result-ball.col0 .cb-letter, .result-ball.col0 .cb-number { color: var(--c0); }
.result-ball.col1 .cb-letter, .result-ball.col1 .cb-number { color: #c25a36; }
.result-ball.col2 .cb-letter, .result-ball.col2 .cb-number { color: #a87f0e; }
.result-ball.col3 .cb-letter, .result-ball.col3 .cb-number { color: #04996f; }
.result-ball.col4 .cb-letter, .result-ball.col4 .cb-number { color: var(--c4); }

.result-ball.waiting { animation: visorWait 1s infinite; }
.result-ball.waiting .cb-number { color: var(--muted); }
@keyframes visorWait { 0%,100% { transform: scale(.96) rotateX(0); } 50% { transform: scale(1) rotateX(-12deg); } }
.result-ball.reveal { animation: ballPop 1s cubic-bezier(.2,1.5,.35,1); }
@keyframes ballPop {
    0%   { transform: translateY(-70px) scale(.2) rotateX(180deg); opacity: 0; }
    55%  { transform: translateY(6px) scale(1.18) rotateX(0); opacity: 1; }
    100% { transform: translateY(0) scale(1); }
}

/* Chispas al revelar */
.spark {
    position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%;
    background: var(--gold); pointer-events: none;
    animation: spark .6s ease-out forwards;
}
@keyframes spark {
    0% { transform: translate(-50%,-50%) translate(0,0) scale(1); opacity: 1; }
    100% { transform: translate(-50%,-50%) translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* ====================================================================
   VISTA DE RESULTADOS
   ==================================================================== */
.results-layout { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.results-title { font-size: 1.8rem; margin: .2rem 0 .2rem; }
.results-meta { color: var(--muted); margin: 0 0 1.3rem; }
.results-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.2rem; margin-top: 1.2rem; }
.results-winners { border: 1px solid rgba(255,209,102,.4); background: linear-gradient(135deg, rgba(255,209,102,.1), rgba(0,0,0,.2)); }

/* Podio de ganadores */
.podium { display: flex; flex-wrap: wrap; gap: 1rem; }
.podium-card { flex: 1 1 160px; min-width: 160px; background: rgba(0,0,0,.25); border-radius: 12px;
    padding: 1rem; text-align: center; border-top: 3px solid var(--gold); display: flex; flex-direction: column; gap: .35rem; align-items: center; }
.podium-medal { font-size: 2.4rem; line-height: 1; }
.podium-name { font-weight: 800; font-size: 1.1rem; }
.podium-email { word-break: break-all; }

/* Tablero de resultados por columnas */
.results-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.rb-col { display: flex; flex-direction: column; gap: 4px; }
.rb-head { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; font-weight: 900; font-size: 1.2rem; color: #fff; }
.rb-head.h0 { background: var(--c0); } .rb-head.h1 { background: var(--c1); color:#3a2a00; }
.rb-head.h2 { background: var(--c2); color:#3a2a00; } .rb-head.h3 { background: var(--c3); } .rb-head.h4 { background: var(--c4); }
.rb-num { aspect-ratio: 1.6; display: grid; place-items: center; border-radius: 6px; background: rgba(255,255,255,.05); color: var(--muted); font-size: .8rem; font-weight: 600; }
.rb-num.hit { background: var(--accent); color: #042b20; box-shadow: 0 0 8px rgba(6,214,160,.5); }

/* Orden de salida */
.draw-sequence { display: flex; flex-wrap: wrap; gap: .4rem; }
.seq-ball { position: relative; display: inline-flex; align-items: center; justify-content: center;
    min-width: 48px; height: 40px; padding: 0 .4em; border-radius: 8px; font-weight: 800; font-size: .85rem; color: #fff;
    background: var(--panel-2); }
.seq-ball small { position: absolute; top: -7px; left: -5px; background: #000; color: #fff; font-size: .6rem; padding: 0 .35em; border-radius: 8px; opacity: .7; }
.seq-ball.col0 { background: var(--c0); } .seq-ball.col1 { background: var(--c1); color:#3a2a00; }
.seq-ball.col2 { background: var(--c2); color:#3a2a00; } .seq-ball.col3 { background: var(--c3); } .seq-ball.col4 { background: var(--c4); }

@media (max-width: 800px) { .results-grid { grid-template-columns: 1fr; } }

/* Confeti */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti span { position: absolute; top: -10px; width: 10px; height: 16px; opacity: .9;
    animation: fall 2.4s linear infinite; }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); } }

/* -------- Responsive -------- */
/* Host: vertical con scroll cuando no hay ancho para 3 columnas */
@media (max-width: 1100px) {
    body.host-bg { height: auto; overflow: auto; display: block; }
    .host-layout { grid-template-columns: 1fr; height: auto; }
    .col-machine, .col-center, .col-side { min-height: auto; }
    .machine-canvas-wrap { height: 64vw; min-height: 340px; flex: none; }
    .col-center .board-mini.host { height: auto; }
    .col-center .board-mini.host .mini-num { aspect-ratio: 1; }
    .col-side .winners-panel { max-height: none; }
}
@media (max-width: 900px) {
    .play-layout, .grid-2 { grid-template-columns: 1fr; }
    .current-ball.big { width: 180px; height: 180px; }
    .current-ball.big .cb-number { font-size: 4.5rem; }
    .result-visor { width: 132px; height: 132px; }
    .result-ball { width: 108px; height: 108px; }
    .result-ball .cb-number { font-size: 2.8rem; }
}
