/* ESTILOS INTERFAZ MÓVIL DEL JUGADOR - CASINO LAS VEGAS */
:root {
  --bg-deep: #07090E;
  --bg-surface: #0F172A;
  --bg-card: #1E293B;
  --gold-primary: #F59E0B;
  --gold-light: #FCD34D;
  --emerald: #10B981;
  --emerald-light: #34D399;
  --cyan-blue: #0284C7;
  --cyan-blue-light: #38BDF8;
  --grey-uncalled: #334155;
  --text-main: #FFFFFF;
  --text-muted: #94A3B8;
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Vista Inicial: Registro de Jugador */
.lobby-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, #172554 0%, #07090E 75%);
}

.lobby-card {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid var(--gold-primary);
  border-radius: 24px;
  padding: 32px 24px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(245, 158, 11, 0.2);
}

.lobby-crown {
  font-size: 48px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.7));
}

.lobby-card h1 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--gold-light);
  margin-bottom: 6px;
}

.lobby-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.8);
  color: #FFFFFF;
  font-size: 16px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.btn-get-card {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-primary) 100%);
  color: #000000;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  margin-top: 10px;
  transition: transform 0.15s;
}

.btn-get-card:active {
  transform: scale(0.98);
}

/* ================= VISTA PRINCIPAL DEL JUGADOR ================= */
.game-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 10px 12px 24px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.hidden {
  display: none !important;
}

/* Barra Superior */
.player-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 14px;
  margin-bottom: 8px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #EF4444;
  border-radius: 50%;
  box-shadow: 0 0 8px #EF4444;
}

.player-room {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-light);
  letter-spacing: 1px;
}

/* Píldora de Balota Cantada */
.current-ball-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.pill-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.pill-ball {
  font-size: 16px;
  font-weight: 900;
  color: var(--gold-light);
}

.btn-sound-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFF;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Indicador de Ronda y Miniatura del Premio */
.round-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.prize-thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--gold-primary);
  background: #0F172A;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.prize-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prize-thumb-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.round-info-content {
  flex: 1;
  min-width: 0;
}

.round-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
  gap: 6px;
}

.badge-round {
  background: var(--gold-primary);
  color: #000;
  font-weight: 900;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.figure-name {
  color: var(--emerald-light);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prize-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prize-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
}

.prize-value {
  font-size: 13px;
  color: #F8FAFC;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================= FILA HORIZONTAL DE BALOTAS CANTADAS ================= */
.balls-horizontal-section {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.tray-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.tray-count {
  color: var(--gold-light);
  font-weight: 900;
}

.balls-horizontal-tray {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 3px 2px 5px;
  -webkit-overflow-scrolling: touch;
}

.balls-horizontal-tray::-webkit-scrollbar {
  height: 3px;
}

.balls-horizontal-tray::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.3);
  border-radius: 3px;
}

.tray-empty-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

.ball-pill-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  font-family: var(--font-sans);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.ball-pill-mini .b-letter {
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.9;
}

.ball-pill-mini .b-num {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  margin-top: 1px;
}

/* Colores de las balotas según letra B-I-N-G-O */
.ball-pill-mini.ball-col-B { background: radial-gradient(circle at 35% 35%, #EF4444, #991B1B); }
.ball-pill-mini.ball-col-I { background: radial-gradient(circle at 35% 35%, #3B82F6, #1E40AF); }
.ball-pill-mini.ball-col-N { background: radial-gradient(circle at 35% 35%, #10B981, #065F46); }
.ball-pill-mini.ball-col-G { background: radial-gradient(circle at 35% 35%, #F59E0B, #92400E); }
.ball-pill-mini.ball-col-O { background: radial-gradient(circle at 35% 35%, #8B5CF6, #5B21B6); }

/* Balota más reciente destacada */
.ball-pill-mini.is-newest {
  transform: scale(1.12);
  border: 2px solid #FEF08A;
  box-shadow: 0 0 10px rgba(254, 240, 138, 0.8), 0 2px 6px rgba(0,0,0,0.5);
  animation: newest-ball-pulse 1.2s infinite alternate;
}

@keyframes newest-ball-pulse {
  0% { box-shadow: 0 0 6px rgba(254, 240, 138, 0.5); }
  100% { box-shadow: 0 0 14px rgba(254, 240, 138, 0.95); }
}

/* Leyenda de Estados de Color */
.color-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.swatch-grey { background: var(--grey-uncalled); }
.swatch-blink { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.4); }
.swatch-blue { background: var(--cyan-blue); box-shadow: 0 0 6px var(--cyan-blue); }
.swatch-green { background: var(--emerald); box-shadow: 0 0 6px var(--emerald); }

/* CONTENEDOR DEL CARTÓN (100% ANCHO DE LA PANTALLA) */
.bingo-card-container {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.bingo-card {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid var(--gold-primary);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
}

/* Encabezado B - I - N - G - O */
.card-header-letters {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.letter-col {
  background: linear-gradient(180deg, #1E293B, #0F172A);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 8px;
  color: var(--gold-light);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  padding: 4px 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Matriz 5x5 de Casillas */
.card-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

/* ================= LOS 4 ESTADOS DE COLOR DE CASILLA ================= */

/* Estado 1: Gris Mate (No cantado) */
.card-cell {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  background: var(--grey-uncalled);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  position: relative;
}

.card-cell:active {
  transform: scale(0.92);
}

/* Estado 2: Reflejo sutil semitransparente (Apenas una leve insinuación de luz para mantener la emoción de búsqueda) */
.card-cell.cell-blink {
  background: rgba(30, 41, 59, 0.95) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.28) !important;
  color: #E2E8F0 !important;
  position: relative;
  overflow: hidden;
  animation: cell-subtle-glow 2.2s infinite ease-in-out !important;
  z-index: 2;
}

.card-cell.cell-blink::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.12) 0%, transparent 75%);
  pointer-events: none;
}

/* Estado 3: Azul Neón (Marcado por el jugador al tocar) */
.card-cell.cell-marked-blue {
  background: radial-gradient(circle, #0284C7 0%, #0369A1 100%) !important;
  border: 2px solid var(--cyan-blue-light) !important;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.7) !important;
  color: #FFFFFF !important;
  font-weight: 900 !important;
  transform: scale(1.02);
}

/* Estado 4: Verde Esmeralda Radiante (¡Forma parte de la figura de victoria!) */
.card-cell.cell-in-figure-green {
  background: radial-gradient(circle, #10B981 0%, #065F46 100%) !important;
  border: 2px solid var(--emerald-light) !important;
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.9), 0 0 30px rgba(16, 185, 129, 0.6) !important;
  color: #FFFFFF !important;
  font-weight: 900 !important;
  transform: scale(1.03);
}

/* Casilla Central Estrella 'FREE' */
.card-cell.cell-free {
  background: radial-gradient(circle, #F59E0B 0%, #B45309 100%) !important;
  border: 2px solid var(--gold-light) !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
  color: #FFFFFF !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.free-star {
  font-size: 18px;
  line-height: 1;
}

.free-text {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
}

/* Pie del Cartón */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.card-serial {
  font-family: monospace;
  font-weight: 700;
  color: var(--gold-light);
}

/* Botón Flotante "¡CANTAR BINGO!" */
.player-actions {
  margin-top: 12px;
}

.btn-cantar-bingo {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(180deg, #FCD34D 0%, #F59E0B 50%, #B45309 100%);
  color: #000000;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 30px rgba(245, 158, 11, 0.5);
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-cantar-bingo:active {
  transform: scale(0.96);
}

/* Estado habilitado pulsante para cantar victoria */
.btn-cantar-bingo.ready-to-win {
  animation: bingo-jackpot-pulse 1s infinite alternate;
  background: linear-gradient(180deg, #FEF08A 0%, #10B981 60%, #047857 100%);
  color: #FFFFFF;
}

/* Modal de Reclamo */
.claim-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.claim-card {
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  border: 2px solid var(--gold-primary);
  border-radius: 20px;
  padding: 28px 24px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.claim-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.claim-card h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #FFFFFF;
}

.claim-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

.btn-claim-close {
  background: var(--gold-primary);
  color: #000;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 28px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
}

/* Animaciones */
@keyframes cell-subtle-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.45);
  }
}

@keyframes bingo-jackpot-pulse {
  0% {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 40px rgba(52, 211, 153, 1), 0 0 70px rgba(16, 185, 129, 0.8);
    transform: scale(1.03);
  }
}
