/* ==========================================================================
   BINGO — NOWEY
   ========================================================================= */

.titulo-juego {
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  color: #14ffe9;
  text-shadow: 0 0 12px rgba(20, 255, 233, 0.6);
  letter-spacing: 2px;
  margin: 20px 0 10px 0;
}

.bng-container { display: flex; flex-direction: column; align-items: center; padding: 0 10px 30px 10px; }
.bng-viewport { width: 100%; max-width: 480px; display: flex; flex-direction: column; align-items: center; }

.bng-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: 'Chakra Petch', monospace;
  font-weight: 700;
  font-size: 0.8rem;
  color: #94a3b8;
  padding: 8px 4px;
}
.hud-item span { color: #14ffe9; text-shadow: 0 0 6px rgba(20, 255, 233, 0.5); }
.hud-rivales span { color: #ffe94d; text-shadow: 0 0 6px rgba(255, 233, 77, 0.5); }
.hud-item span.lbl { color: #94a3b8; text-shadow: none; }

.bng-board {
  position: relative;
  width: 100%;
  min-height: 680px;
  background: #04080c;
  border: 1px solid rgba(20, 255, 233, 0.25);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(20, 255, 233, 0.08) inset;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 10px 14px 10px;
  box-sizing: border-box;
}

.bng-logo-fondo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 45%;
  opacity: 0.05;
  pointer-events: none;
  z-index: 1;
}

.btn-icono {
  position: absolute;
  top: 8px;
  z-index: 25;
  background: rgba(4, 8, 12, 0.7);
  border: 1px solid rgba(20, 255, 233, 0.35);
  color: #14ffe9;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icono:hover { background: rgba(20, 255, 233, 0.15); }
.btn-fullscreen-mate { right: 8px; }
.btn-pausa-mate { right: 50px; }
.btn-sonido-mate { right: 92px; }

/* ---------- Bola ---------- */
.bng-cantada { position: relative; z-index: 3; margin-top: 30px; min-height: 120px; display: flex; align-items: center; justify-content: center; }

.bola {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  color: #04080c;
  background: radial-gradient(circle at 35% 30%, #ffffff, #94a3b8);
  line-height: 1;
}
.bola-grande { width: 112px; height: 112px; box-shadow: 0 0 22px rgba(20, 255, 233, 0.35); }
.bola-grande .bola-letra { font-size: 1.1rem; margin-bottom: 2px; }
.bola-grande .bola-num { font-size: 2.6rem; }
.bola-grande.pop { animation: bola-pop 0.45s ease; }
@keyframes bola-pop {
  0% { transform: scale(0.2) translateY(-40px); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.bola.col-B { background: radial-gradient(circle at 35% 30%, #8fe0ff, #0090cc); box-shadow: 0 0 22px rgba(0, 183, 255, 0.55); }
.bola.col-I { background: radial-gradient(circle at 35% 30%, #ff9db5, #d4153f); box-shadow: 0 0 22px rgba(255, 43, 94, 0.55); }
.bola.col-N { background: radial-gradient(circle at 35% 30%, #fff6a8, #d9bd00); box-shadow: 0 0 22px rgba(255, 233, 77, 0.55); }
.bola.col-G { background: radial-gradient(circle at 35% 30%, #a8ff95, #1ea80a); box-shadow: 0 0 22px rgba(57, 255, 20, 0.55); }
.bola.col-O { background: radial-gradient(circle at 35% 30%, #ffc48a, #d95f00); box-shadow: 0 0 22px rgba(255, 123, 0, 0.55); }

.bng-historial {
  position: relative;
  z-index: 3;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-height: 34px;
  margin: 8px 0 2px 0;
}
.bng-historial .bola { width: 34px; height: 34px; font-size: 0.7rem; }
.bng-historial .bola .bola-letra { font-size: 0.5rem; }
.bng-historial .bola .bola-num { font-size: 0.8rem; }

.bng-aviso {
  position: relative;
  z-index: 3;
  min-height: 22px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  color: #ffe94d;
  text-shadow: 0 0 10px rgba(255, 233, 77, 0.7);
  text-align: center;
  margin: 2px 0 6px 0;
}

/* ---------- Cartón ---------- */
.bng-letras, .bng-carton {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 340px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  box-sizing: border-box;
}
.bng-letras span {
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.3rem;
  padding-bottom: 2px;
}
.bng-letras span:nth-child(1) { color: #00b7ff; text-shadow: 0 0 8px rgba(0, 183, 255, 0.6); }
.bng-letras span:nth-child(2) { color: #ff2b5e; text-shadow: 0 0 8px rgba(255, 43, 94, 0.6); }
.bng-letras span:nth-child(3) { color: #ffe94d; text-shadow: 0 0 8px rgba(255, 233, 77, 0.6); }
.bng-letras span:nth-child(4) { color: #39ff14; text-shadow: 0 0 8px rgba(57, 255, 20, 0.6); }
.bng-letras span:nth-child(5) { color: #ff7b00; text-shadow: 0 0 8px rgba(255, 123, 0, 0.6); }

.celda {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(160deg, #06201e, #04100f);
  border: 1px solid rgba(20, 255, 233, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: #e2e8f0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
}
.celda:active { transform: scale(0.94); }
.celda.libre { color: #ffe94d; cursor: default; }
.celda .num { position: relative; z-index: 2; }
.celda.marcada { border-color: rgba(57, 255, 20, 0.7); }
.celda.marcada::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 78%;
  height: 78%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(57, 255, 20, 0.7), rgba(15, 120, 10, 0.65));
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.55);
  pointer-events: none;
}
.celda.marcada .num { color: #04140a; }
.celda.error { animation: celda-error 0.25s ease; }
@keyframes celda-error {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.btn-bingo {
  position: relative;
  z-index: 4;
  margin-top: 14px;
  width: 100%;
  max-width: 340px;
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 2px;
}
.btn-bingo:disabled { opacity: 0.4; cursor: default; }

/* ---------- Tablero de 75 ---------- */
.bng-tablero {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 340px;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 2px;
  margin-top: 14px;
}
.mini {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Chakra Petch', monospace;
  font-weight: 700;
  font-size: 0.5rem;
  color: #475569;
}
.mini.salio { background: rgba(20, 255, 233, 0.25); color: #14ffe9; }

/* ---------- Overlays ---------- */
.overlay-modo, .overlay-inicio, .overlay-online, .overlay-sala, .overlay-fin, .overlay-pausa {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(4, 8, 12, 0.95);
  padding: 20px;
}
.oculto { display: none !important; }

.overlay-modo h2, .overlay-inicio h2, .overlay-online h2, .overlay-sala h2, .overlay-fin h2, .overlay-pausa h2 {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 1.6rem;
  color: #14ffe9;
  text-shadow: 0 0 12px rgba(20, 255, 233, 0.6);
  margin-bottom: 12px;
}
.overlay-fin h2.perdio { color: #ff2b5e; text-shadow: 0 0 12px rgba(255, 43, 94, 0.6); }

.overlay-modo p, .overlay-inicio p, .overlay-online p, .overlay-sala p, .overlay-fin p {
  font-family: 'Chakra Petch', monospace;
  color: #94a3b8;
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: 16px;
  max-width: 320px;
}

.vel-selector { display: flex; gap: 8px; margin-bottom: 16px; }
.btn-vel {
  font-family: 'Chakra Petch', monospace;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 1px;
  background: rgba(20, 255, 233, 0.06);
  border: 1px solid rgba(20, 255, 233, 0.3);
  color: #94a3b8;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-vel.activo {
  background: rgba(20, 255, 233, 0.2);
  border-color: #14ffe9;
  color: #14ffe9;
  box-shadow: 0 0 10px rgba(20, 255, 233, 0.35);
}

.record-chip {
  font-family: 'Chakra Petch', monospace;
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: #94a3b8;
  border: 1px solid rgba(20, 255, 233, 0.25);
  border-radius: 20px;
  padding: 6px 16px;
  margin-bottom: 14px;
  background: rgba(20, 255, 233, 0.06);
}
.record-chip span { color: #14ffe9; font-weight: 800; text-shadow: 0 0 6px rgba(20, 255, 233, 0.5); }

.record-nuevo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 800;
  color: #ffe94d;
  text-shadow: 0 0 10px rgba(255, 233, 77, 0.7);
  font-size: 0.9rem;
  margin: -6px 0 14px 0 !important;
  animation: record-brillo 0.9s ease-in-out infinite;
}
@keyframes record-brillo { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

.btn-mate {
  font-family: 'Chakra Petch', monospace;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #14ffe9, #0a9e91);
  color: #02140f;
  border: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(20, 255, 233, 0.4);
  margin-bottom: 10px;
}
.btn-mate:active { transform: scale(0.96); }
.btn-mate.btn-multi {
  background: linear-gradient(135deg, #00b7ff, #0080b3);
  color: #021018;
  box-shadow: 0 0 16px rgba(0, 183, 255, 0.4);
}
.overlay-modo .btn-mate, .overlay-online .btn-mate, .overlay-sala .btn-mate { width: 230px; }
.btn-salir {
  display: inline-block;
  background: none;
  box-shadow: none;
  color: #94a3b8;
  text-decoration: none;
  font-family: 'Chakra Petch', monospace;
  font-size: 0.8rem;
}
.btn-volver {
  background: none;
  border: none;
  color: #64748b;
  font-family: 'Chakra Petch', monospace;
  font-size: 0.8rem;
  margin-top: 6px;
  cursor: pointer;
}

.overlay-online input {
  width: 230px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid rgba(20, 255, 233, 0.3);
  background: #04100f;
  color: #e2e8f0;
  font-family: 'Chakra Petch', monospace;
  text-align: center;
  box-sizing: border-box;
}
.sala-o-divisor { color: #64748b; font-family: 'Chakra Petch', monospace; margin: 6px 0; }
.sala-estado { min-height: 18px; color: #ffe94d !important; }

.overlay-sala h2 span { color: #ffe94d; letter-spacing: 3px; }
.sala-jugadores { display: flex; flex-direction: column; gap: 6px; width: 230px; margin-bottom: 14px; }
.sala-jugador {
  font-family: 'Chakra Petch', monospace;
  font-weight: 700;
  font-size: 0.85rem;
  color: #e2e8f0;
  background: rgba(20, 255, 233, 0.08);
  border: 1px solid rgba(20, 255, 233, 0.25);
  border-radius: 8px;
  padding: 7px 12px;
  display: flex;
  justify-content: space-between;
}
.sala-jugador.yo { border-color: #14ffe9; }
.sala-jugador .tag { color: #ffe94d; font-size: 0.7rem; }

.bng-board.sacudida { animation: sacudida-tablero 0.3s ease; }
@keyframes sacudida-tablero {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(4px); }
}

.staff-footer-note { margin-top: 18px; text-align: center; }
.staff-footer-note a { color: #64748b; text-decoration: none; font-family: 'Chakra Petch', monospace; font-size: 0.8rem; }

/* ==========================================================================
   PANTALLA COMPLETA — todos los jugadores a la vista
   ========================================================================= */
.bng-col { display: contents; }
.bng-tablero { order: 5; }
.bng-rivales { display: none; }
.bng-carton-wrap { position: relative; z-index: 3; width: 100%; max-width: 340px; }
body.bng-fs-activo { overflow: hidden; }

.bng-viewport.fs {
  position: fixed;
  inset: 0;
  z-index: 9999;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  background: #04080c;
  padding: 6px 8px 8px;
  box-sizing: border-box;
  align-items: stretch;
}
.bng-viewport.fs .bng-hud { flex: 0 0 auto; padding: 2px 4px 6px; }
.bng-viewport.fs .bng-board {
  flex: 1 1 auto;
  min-height: 0;
  padding: 44px 8px 8px;
  justify-content: space-around;
  gap: 6px;
}
.bng-viewport.fs .bng-logo-fondo { width: 30%; }
.bng-viewport.fs .bng-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
}
.bng-viewport.fs .bng-tablero { order: 0; }
.bng-viewport.fs .bng-rivales { display: grid; }

/* Cabecera: bola + historial */
.bng-viewport.fs .bng-col-izq { flex-direction: row; flex-wrap: wrap; gap: 2px 10px; }
.bng-viewport.fs .bng-cantada { margin-top: 0; min-height: 0; }
.bng-viewport.fs .bola-grande { width: 84px; height: 84px; }
.bng-viewport.fs .bola-grande .bola-letra { font-size: 0.9rem; }
.bng-viewport.fs .bola-grande .bola-num { font-size: 2rem; }
.bng-viewport.fs .bng-historial { margin: 0; min-height: 0; flex-wrap: wrap; flex: 1 1 0; min-width: 120px; }
.bng-viewport.fs .bng-aviso { width: 100%; margin: 0; min-height: 20px; }
.bng-viewport.fs .bng-tablero { display: none; }

/* Cartón y botón */
.bng-viewport.fs .bng-carton-wrap {
  max-width: clamp(190px, calc(100vh - 440px), 340px);
  max-width: clamp(190px, calc(100dvh - 440px), 340px);
}
.bng-viewport.fs .btn-bingo { margin: 8px 0 0 0; padding: 10px 20px; max-width: 340px; }

/* Rivales */
.bng-rivales { grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; --rcs: clamp(78px, 27vw, 130px); }
.rival {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 4px;
  border: 1px solid rgba(20, 255, 233, 0.2);
  border-radius: 8px;
  background: rgba(20, 255, 233, 0.04);
  min-width: 0;
}
.rival.cerca { border-color: rgba(255, 233, 77, 0.6); box-shadow: 0 0 10px rgba(255, 233, 77, 0.2); }
.rival-info { display: flex; flex-direction: column; align-items: center; font-family: 'Chakra Petch', monospace; font-weight: 700; line-height: 1.15; max-width: 100%; }
.rival-nombre { font-size: 0.7rem; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rival-falta { font-size: 0.65rem; color: #94a3b8; }
.rival.cerca .rival-falta { color: #ffe94d; }
.rival-carton { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; width: var(--rcs); }
.rc {
  aspect-ratio: 1 / 1;
  background: #04100f;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Chakra Petch', monospace;
  font-weight: 700;
  font-size: calc(var(--rcs) * 0.085);
  color: #64748b;
}
.rc.marcada { background: #1fae10; color: #04140a; }
.rc.libre { color: #ffe94d; }
.rc.libre.marcada { color: #04140a; }

/* Horizontal: tres columnas — bola/historial | mi cartón | rivales */
@media (orientation: landscape) {
  .bng-viewport.fs .bng-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 10px;
    padding: 8px;
    align-items: center;
  }
  .bng-viewport.fs .bng-col-izq { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
  .bng-viewport.fs .bng-historial { flex: 0 0 auto; justify-content: center; min-width: 0; }
  .bng-viewport.fs .bng-tablero { display: grid; max-width: 100%; margin-top: 4px; }
  .bng-viewport.fs .bng-carton-wrap {
    max-width: clamp(170px, calc(100vh - 190px), 420px);
    max-width: clamp(170px, calc(100dvh - 190px), 420px);
  }
  .bng-viewport.fs .bng-col-der { padding-top: 40px; box-sizing: border-box; }
  .bng-viewport.fs .bng-rivales {
    grid-template-columns: 1fr;
    gap: 6px;
    --rcs: clamp(58px, calc((100vh - 170px) / 3 - 14px), 110px);
    --rcs: clamp(58px, calc((100dvh - 170px) / 3 - 14px), 110px);
  }
  .bng-viewport.fs .rival { flex-direction: row; justify-content: center; gap: 10px; }
}
