/* ==========================================================================
   Bingo App Design System & Stylesheet (3x9 Teal Cards + 4 Prizes System)
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-app: #0b1120;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-surface-glass: rgba(30, 41, 59, 0.85);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --accent-gold: #f59e0b;
  --accent-gold-hover: #d97706;
  --accent-green: #10b981;
  --accent-rose: #f43f5e;
  --accent-cyan: #06b6d4;
  --accent-purple: #a855f7;
  --accent-teal: #00838f;
  --accent-teal-dark: #006064;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border-subtle: #334155;
  --border-active: #64748b;

  /* Typography */
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-numbers: 'Outfit', var(--font-main);

  /* Elevation & Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.4);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.main-content {
  flex: 1;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 48px;
  box-sizing: border-box;
}

/* Header & Navbar */
.app-header {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-teal), #00acc1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(0, 172, 193, 0.4);
}

.brand-name {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-gold);
  color: #111827;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  text-transform: uppercase;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--accent-teal);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Status Indicator Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.loading {
  background-color: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold);
}

.status-dot.offline {
  background-color: var(--accent-rose);
  box-shadow: 0 0 8px var(--accent-rose);
}

/* ==========================================================================
   PANEL DE LOS 4 PREMIOS EN VIVO
   ========================================================================== */
.prizes-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .prizes-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .prizes-dashboard {
    grid-template-columns: 1fr;
  }
}

.prize-card {
  background: linear-gradient(145deg, #131d31 0%, #0b1220 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.prize-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.prize-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 35px -5px rgba(0, 0, 0, 0.6);
}

/* 1ª Línea: Tarjeta Esmeralda */
.prize-card.linea-card {
  border: 1.5px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.12), 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.prize-card.linea-card::before {
  background: linear-gradient(90deg, #10b981, #34d399, #10b981);
}

/* Bingo Mayor: Tarjeta Dorada Estelar */
.prize-card.grand-bingo {
  border: 2px solid #f59e0b;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.25), 0 12px 28px -5px rgba(0, 0, 0, 0.6);
}

.prize-card.grand-bingo::before {
  background: linear-gradient(90deg, #f59e0b, #fef08a, #f59e0b);
}

.prize-card.grand-bingo:hover {
  box-shadow: 0 0 45px rgba(245, 158, 11, 0.4), 0 18px 38px -5px rgba(0, 0, 0, 0.7);
}

/* Gran Sorteo Final: Tarjeta Cyan Holográfica */
.prize-card.raffle-card {
  border: 1.5px solid rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.12), 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.prize-card.raffle-card::before {
  background: linear-gradient(90deg, #06b6d4, #8b5cf6, #06b6d4);
}

.prize-card.won {
  border-color: #10b981;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.22), #0b1220);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.45);
}

.prize-badge-rank {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  align-self: flex-start;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.prize-linea-badge { background: linear-gradient(135deg, #10b981, #059669); color: #ffffff; }
.prize-bingo-badge { background: linear-gradient(135deg, #f59e0b, #d97706); color: #111827; }
.prize-carton-badge { background: linear-gradient(135deg, #06b6d4, #0284c7); color: #ffffff; }

.prize-title {
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 3px;
  color: #ffffff;
}

.prize-amount {
  font-size: 1.75rem;
  font-weight: 900;
  font-family: var(--font-numbers);
  color: #ffffff;
  margin-bottom: 6px;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.prize-card.grand-bingo .prize-amount {
  color: #fbbf24;
  font-size: 2.1rem;
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.5), 0 2px 8px rgba(0,0,0,0.6);
}

.prize-card.linea-card .prize-amount {
  color: #34d399;
  text-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}

.prize-card.raffle-card .prize-amount {
  color: #38bdf8;
  text-shadow: 0 0 14px rgba(6, 182, 212, 0.4);
}

.prize-status-text {
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 6px;
}

.prize-status-text.pending {
  color: var(--text-muted);
}

.prize-status-text.claimed {
  color: #34d399;
  font-weight: 800;
}
  color: var(--accent-green);
}

/* Banner / Welcome Hero */
.hero-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 172, 193, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: 1.55rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.hero-description {
  color: var(--text-muted);
  max-width: 860px;
  font-size: 0.88rem;
}

/* Grid Layouts */
.grid-game-layout {
  display: grid;
  grid-template-columns: 310px 1fr 300px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1280px) {
  .grid-game-layout {
    grid-template-columns: 320px 1fr;
  }
}

@media (max-width: 960px) {
  .grid-game-layout {
    grid-template-columns: 1fr;
  }
  .header-inner {
    flex-wrap: wrap;
  }
}

/* Cards */
.app-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.12rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Bolillero 1-90 Caller Board */
.caller-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.current-ball-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px;
  background: rgba(11, 17, 32, 0.75);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-height: 140px;
}

.bingo-ball-90 {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-numbers);
  font-weight: 900;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6), inset 0 3px 8px rgba(255, 255, 255, 0.7);
  position: relative;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ball-badge-range {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
  font-weight: 800;
}

.ball-num-huge {
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

/* Color ranges for 90 balls */
.ball-range-1 { background: radial-gradient(circle at 32% 30%, #fda4af, #e11d48 80%, #881337); color: #fff; }
.ball-range-2 { background: radial-gradient(circle at 32% 30%, #fed7aa, #ea580c 80%, #7c2d12); color: #fff; }
.ball-range-3 { background: radial-gradient(circle at 32% 30%, #fef08a, #ca8a04 80%, #713f12); color: #1e293b; }
.ball-range-4 { background: radial-gradient(circle at 32% 30%, #a7f3d0, #059669 80%, #064e3b); color: #fff; }
.ball-range-5 { background: radial-gradient(circle at 32% 30%, #bae6fd, #0284c7 80%, #0c4a6e); color: #fff; }

/* Mini balls history */
.recent-balls-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  max-height: 100px;
  overflow-y: auto;
}

.mini-ball {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  animation: popIn 0.2s ease;
}

.mini-ball.highlight {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
  background: #0284c7;
  color: #fff;
}

/* Matrix 90-ball board */
.board-90-matrix {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  margin-top: 10px;
  background: rgba(11, 17, 32, 0.8);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.matrix-cell {
  font-family: var(--font-numbers);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 0;
  text-align: center;
  border-radius: 3px;
  background: var(--bg-surface);
  color: var(--text-dim);
  transition: all 0.2s ease;
}

.matrix-cell.drawn {
  background: var(--accent-teal);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 0 5px rgba(0, 172, 193, 0.5);
}

.matrix-cell.clickable-cell:hover {
  background: rgba(0, 172, 193, 0.35);
  color: #ffffff;
  border: 1px solid var(--accent-teal);
  transform: scale(1.12);
  z-index: 2;
  cursor: pointer;
}

/* ==========================================================================
   CARTÓN DE BINGO CLÁSICO 3 FILAS x 9 COLUMNAS (Formato Foto Teal)
   ========================================================================== */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ==========================================================================
   PALETA OFICIAL DE COLOR PARA CARTONES (Tema Oficial Rojo)
   ========================================================================== */
.card-theme-ruby,
.card-theme-sapphire,
.card-theme-emerald,
.card-theme-amethyst,
.card-theme-gold,
.card-theme-teal {
  --ticket-gradient: linear-gradient(135deg, #e11d48 0%, #be123c 50%, #881337 100%);
  --cell-gradient: linear-gradient(180deg, #fb7185 0%, #e11d48 55%, #9f1239 100%);
  --cell-empty: #4c0519;
  --accent-color: #fda4af;
  --tag-bg: rgba(251, 113, 133, 0.15);
  --tag-color: #fb7185;
}

.bingo-card-3x9-wrapper {
  --ticket-gradient: linear-gradient(135deg, #e11d48 0%, #be123c 50%, #881337 100%);
  --cell-gradient: linear-gradient(180deg, #fb7185 0%, #e11d48 55%, #9f1239 100%);
  --cell-empty: #4c0519;
  --accent-color: #fda4af;
  --tag-bg: rgba(251, 113, 133, 0.15);
  --tag-color: #fb7185;
  background: linear-gradient(145deg, #131d31 0%, #0c1322 100%);
  border: 1.5px solid var(--accent-color, rgba(225, 29, 72, 0.45));
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
  position: relative;
}

/* Muescas decorativas laterales estilo ticket de lotería físico */
.bingo-card-3x9-wrapper::before,
.bingo-card-3x9-wrapper::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background-color: var(--bg-app, #0f172a);
  border-radius: 50%;
  transform: translateY(-50%);
  border: 1.5px solid var(--accent-color, rgba(0, 172, 193, 0.35));
  z-index: 5;
}

.bingo-card-3x9-wrapper::before {
  left: -8px;
}

.bingo-card-3x9-wrapper::after {
  right: -8px;
}

.bingo-card-3x9-wrapper:hover {
  border-color: var(--accent-color, rgba(0, 172, 193, 0.7));
  box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.6), 0 0 20px var(--tag-bg, rgba(0, 172, 193, 0.2));
  transform: translateY(-2px);
}

.bingo-card-3x9-wrapper.has-1-line {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.bingo-card-3x9-wrapper.has-2-lines {
  border-color: #8b5cf6;
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35);
}

.bingo-card-3x9-wrapper.card-winner {
  border-color: var(--accent-green);
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.5);
  animation: winnerGlow 1.5s infinite alternate;
}

.bingo-card-3x9-wrapper.is-user-card,
.bingo-card-3x9-wrapper.is-selected-card {
  border: 2.5px solid #10b981 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.45), 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(-2px);
}

.ticket-cell.lucky-match {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%) !important;
  color: #111827 !important;
  font-weight: 900 !important;
  box-shadow: 0 0 12px #f59e0b, inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
  transform: scale(1.06);
  z-index: 3;
}

@keyframes winnerGlow {
  0% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
  100% { box-shadow: 0 0 40px rgba(16, 185, 129, 0.8), 0 0 60px rgba(245, 158, 11, 0.4); }
}

.card-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.card-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-title-text {
  font-family: var(--font-numbers);
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-serial-tag {
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--tag-color, var(--accent-cyan));
  background: var(--tag-bg, rgba(6, 182, 212, 0.12));
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--accent-color, rgba(6, 182, 212, 0.4));
  letter-spacing: 0.05em;
}

/* El Cartón Físico - Adaptable al tema cromático */
.teal-bingo-ticket {
  background: var(--ticket-gradient, linear-gradient(135deg, #e11d48 0%, #be123c 50%, #881337 100%));
  border: 3.5px solid #ffffff;
  border-radius: 10px;
  padding: 7px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), inset 0 0 16px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.teal-bingo-ticket::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

/* Column Header (Decades Range: 1-9, 10-19, etc.) */
.ticket-col-headers {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 4px;
  width: 100%;
}

.ticket-col-header-item {
  text-align: center;
  font-size: clamp(0.55rem, 1.1vw, 0.74rem);
  font-weight: 900;
  color: #e0f2fe;
  background: rgba(0, 40, 48, 0.5);
  padding: 2.5px 0;
  border-radius: 4px;
  font-family: var(--font-numbers);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Grilla 3 Filas x 9 Columnas */
.ticket-grid-3x9 {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  background-color: #ffffff;
  border: 2.5px solid #ffffff;
  border-radius: 6px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.ticket-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
}

/* Celda del Cartón */
.ticket-cell {
  background: var(--cell-gradient, linear-gradient(180deg, #fb7185 0%, #e11d48 55%, #9f1239 100%));
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-family: var(--font-numbers);
  font-size: clamp(0.92rem, 2.3vw, 1.95rem);
  font-weight: 900;
  color: #ffffff;
  user-select: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: clamp(26px, 4.8vw, 46px);
  min-width: 0;
  padding: 1px 0;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  overflow: hidden;
}

@media (max-width: 768px) {
  .ticket-cell {
    font-size: clamp(0.8rem, 2vw, 1.25rem);
    min-height: clamp(24px, 4vw, 36px);
  }
}

@media (max-width: 480px) {
  .ticket-cell {
    font-size: 0.8rem;
    min-height: 24px;
  }
}

/* Celda vacía con tramado diagonal de contraste */
.ticket-cell.empty {
  background: repeating-linear-gradient(
    45deg,
    var(--cell-empty, #4c0519),
    var(--cell-empty, #4c0519) 6px,
    rgba(255, 255, 255, 0.04) 6px,
    rgba(255, 255, 255, 0.04) 12px
  );
  opacity: 0.95;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.45);
}

.ticket-cell.empty .watermark-text {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Celda Pintada Automáticamente cuando sale la bolilla */
.ticket-cell.painted {
  background-color: #0b1322;
  color: #ffffff;
}

/* El Sello de Tinta / Ficha de Pintado */
.ticket-cell.painted::before {
  content: '';
  position: absolute;
  width: 86%;
  height: 86%;
  border-radius: 50%;
  background: radial-gradient(circle, #f43f5e 0%, #dc2626 65%, #991b1b 100%);
  border: 2px solid rgba(254, 202, 202, 0.9);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.9), inset 0 0 6px rgba(255, 255, 255, 0.6);
  z-index: 1;
  animation: stampDab 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
  z-index: 1;
  animation: stampDab 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ticket-cell.painted span {
  position: relative;
  z-index: 2;
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

@keyframes stampDab {
  0% { transform: scale(1.6); opacity: 0; }
  60% { transform: scale(0.9); opacity: 0.95; }
  100% { transform: scale(1); opacity: 1; }
}

/* Barra de Estado y Progreso de Líneas */
.ticket-status-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.row-indicators {
  display: flex;
  gap: 8px;
}

.row-indicator-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 700;
  border: 1px solid var(--border-subtle);
}

.row-indicator-badge.completed {
  background: var(--accent-green);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* Banner de Celebración de Premio */
.prize-won-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(16, 185, 129, 0.2));
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: popIn 0.3s ease;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-teal);
  color: #ffffff;
}

.btn-primary:hover {
  background: #00acc1;
  box-shadow: 0 0 15px rgba(0, 172, 193, 0.4);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: #475569;
}

.btn-accent {
  background: var(--accent-gold);
  color: #111827;
}

.btn-accent:hover {
  background: var(--accent-gold-hover);
}

.btn-purple {
  background: var(--accent-purple);
  color: #ffffff;
}

.btn-purple:hover {
  background: #9333ea;
}

.btn-success {
  background: var(--accent-green);
  color: #ffffff;
}

.btn-danger {
  background: var(--accent-rose);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

/* Info Tables */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.info-table th, .info-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
}

.info-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(15, 23, 42, 0.4);
}

.code-badge {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #38bdf8;
}

/* Animations */
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   PORTAL DE INICIO Y ACCESO (AuthPortal Styles)
   ========================================================================== */
.auth-portal-container {
  width: 100%;
  max-width: 720px;
  margin: 10px auto 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: popIn 0.35s ease;
  box-sizing: border-box;
}

.auth-hero-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo-badge {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 35px rgba(244, 63, 94, 0.45);
  margin-bottom: 12px;
  overflow: hidden;
}

.auth-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-family: var(--font-numbers);
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.auth-card-wrapper {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-tab-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  padding: 6px;
  gap: 4px;
}

@media (max-width: 640px) {
  .auth-tab-bar {
    grid-template-columns: repeat(2, 1fr);
  }
}

.auth-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.auth-tab-btn i {
  font-size: 1.1rem;
}

.auth-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.auth-tab-btn.active {
  background: var(--accent-teal);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.auth-form-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-form-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 540px) {
  .auth-grid-2 {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.92rem;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(0, 131, 143, 0.25);
}

.receipt-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.receipt-dropzone:hover {
  border-color: var(--accent-teal);
  background: rgba(0, 131, 143, 0.08);
}

/* Selector de Cartones y Promo 3+1 */
.ticket-selector-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

@media (max-width: 540px) {
  .ticket-selector-chips {
    grid-template-columns: 1fr;
  }
}

.ticket-chip-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.ticket-chip-btn:hover {
  border-color: var(--accent-teal);
  background: rgba(0, 131, 143, 0.12);
}

.ticket-chip-btn.active {
  border-color: var(--accent-gold);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(15, 23, 42, 0.9));
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.ticket-chip-qty {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-numbers);
}

.ticket-chip-price {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.ticket-chip-promo {
  font-size: 0.72rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  margin-top: 2px;
}

.ticket-stepper-control {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ticket-stepper-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.1rem;
  width: 44px;
  height: 42px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.ticket-stepper-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-gold);
}

.ticket-stepper-value {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 900;
  font-family: var(--font-numbers);
  color: var(--text-main);
  background: transparent;
  border: none;
}

.promo-summary-box {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.promo-summary-box.has-promo {
  border-color: var(--accent-green);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.1), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.18);
}

.receipt-preview-img {
  max-height: 140px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  object-fit: contain;
}

.auth-prizes-top-container {
  width: 100%;
  margin-top: 14px;
  margin-bottom: 22px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.75) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), 0 0 15px rgba(245, 158, 11, 0.08);
}

.auth-prizes-top-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  text-transform: uppercase;
}

/* Card Destacado Hero: 1° Gran Premio Mayor */
.auth-grand-prize-hero {
  width: 100%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(15, 23, 42, 0.96) 65%, rgba(217, 119, 6, 0.22) 100%);
  border: 2px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(245, 158, 11, 0.25);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-grand-prize-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 26px rgba(245, 158, 11, 0.35);
}

.auth-grand-prize-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-grand-prize-crown {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(217, 119, 6, 0.55));
  border: 2px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.45);
  flex-shrink: 0;
  animation: pulse-gold 3s infinite ease-in-out;
}

@keyframes pulse-gold {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 22px rgba(245, 158, 11, 0.7);
  }
}

.auth-grand-prize-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-grand-prize-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gold);
  color: #111827;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: fit-content;
}

.auth-grand-prize-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.auth-grand-prize-subtitle {
  font-size: 0.8rem;
  color: #fbbf24;
  font-weight: 500;
}

.auth-grand-prize-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
  flex-shrink: 0;
}

.auth-grand-prize-amount {
  font-size: 2.3rem;
  font-weight: 900;
  font-family: var(--font-numbers);
  color: var(--accent-gold);
  text-shadow: 0 0 16px rgba(245, 158, 11, 0.5);
  line-height: 1;
}

.auth-grand-prize-plus {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f1f5f9;
}

@media (max-width: 640px) {
  .auth-grand-prize-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 16px;
    gap: 12px;
  }
  .auth-grand-prize-left {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .auth-grand-prize-badge {
    margin: 0 auto;
  }
  .auth-grand-prize-right {
    align-items: center;
    text-align: center;
  }
  .auth-grand-prize-amount {
    font-size: 2rem;
  }
}

.auth-prizes-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 0;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .auth-prizes-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .auth-prizes-strip > :last-child {
    grid-column: span 2;
  }
}

.auth-prize-mini-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.auth-prize-mini-item:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.45);
}

.auth-prize-mini-item span {
  font-size: 0.75rem;
  color: #cbd5e1;
  font-weight: 700;
}

.auth-prize-mini-item strong {
  font-size: 1.15rem;
  font-family: var(--font-numbers);
  color: var(--accent-gold);
}

.auth-prize-mini-item.highlight {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.09);
}

/* Banner Especial Diferenciado: Premio por Número de Cartón */
.auth-prize-carton-banner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.14) 0%, rgba(30, 41, 59, 0.88) 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 12px rgba(56, 189, 248, 0.12);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.auth-prize-carton-banner:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.22);
}

.auth-prize-carton-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.auth-prize-carton-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.auth-prize-carton-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  min-width: 0;
  flex: 1;
}

.auth-prize-carton-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #38bdf8;
  letter-spacing: 0.05em;
}

.auth-prize-carton-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

.auth-prize-carton-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: break-word;
}

.auth-prize-carton-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.65);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.35);
  flex-shrink: 0;
}

.auth-prize-carton-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-prize-carton-amount {
  font-size: 1.3rem;
  font-weight: 900;
  font-family: var(--font-numbers);
  color: #38bdf8;
  line-height: 1.1;
}

@media (max-width: 768px) {
  .auth-prize-carton-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
    padding: 12px;
  }
  .auth-prize-carton-left {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .auth-prize-carton-text {
    text-align: center;
    align-items: center;
  }
  .auth-prize-carton-right {
    align-items: center;
    padding: 6px 10px;
  }
}

/* ==========================================================================
   TABLA EN VIVO: CARTONES CON MÁS ACIERTOS (Live Leaderboard)
   ========================================================================== */
.live-leaderboard-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.leaderboard-item.is-user-card {
  border-color: var(--accent-teal);
  background: linear-gradient(135deg, rgba(0, 131, 143, 0.15), rgba(15, 23, 42, 0.9));
  box-shadow: 0 0 12px rgba(0, 172, 193, 0.25);
}

.leaderboard-item.near-bingo {
  border-color: var(--accent-gold);
  animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.5); }
}

.leaderboard-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.leaderboard-rank-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 900;
  font-family: var(--font-numbers);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.leaderboard-rank-tag.rank-1 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #111827;
}

.leaderboard-rank-tag.rank-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: #ffffff;
}

.leaderboard-rank-tag.rank-3 {
  background: linear-gradient(135deg, #b45309, #78350f);
  color: #ffffff;
}

.leaderboard-card-name {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.leaderboard-badge-alert {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-1-left {
  background: #f43f5e;
  color: #fff;
  animation: popIn 0.3s ease;
}

.badge-2-left {
  background: #f59e0b;
  color: #111;
}

.badge-user-tag {
  background: var(--accent-teal);
  color: #fff;
}

.leaderboard-progress-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.leaderboard-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.35s ease;
}

/* ==========================================================================
   RADAR DE CARTONES CERCANOS A GANAR & INSPECTOR EN VIVO (Para Organizador)
   ========================================================================== */
.ticket-cell.waiting-target {
  border: 2px solid var(--accent-gold) !important;
  background: rgba(245, 158, 11, 0.15) !important;
  color: var(--accent-gold) !important;
  font-weight: 900 !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
  animation: pulseGlow 1.5s infinite ease-in-out;
}

.radar-tab-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.radar-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.radar-tab-btn.active {
  background: var(--accent-teal);
  color: #ffffff;
  border-color: var(--accent-teal);
  box-shadow: var(--shadow-sm);
}

.leaderboard-inspect-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  margin-top: 4px;
}

.leaderboard-inspect-btn:hover {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: #ffffff;
}

.card-radar-missing-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ==========================================================================
   ANIMACIONES SUAVES Y FÍSICAS DE RESORTE (Spring Animations)
   ========================================================================== */

/* 1. Bolilla 3D Animada con Resorte y Giro */
@keyframes ballSpringPop {
  0% {
    transform: scale(0.2) rotate(-35deg) translateY(40px);
    opacity: 0;
    box-shadow: 0 0 0 rgba(0, 172, 193, 0);
  }
  60% {
    transform: scale(1.15) rotate(8deg) translateY(-8px);
    opacity: 1;
    box-shadow: 0 0 45px rgba(0, 229, 255, 0.7);
  }
  80% {
    transform: scale(0.95) rotate(-3deg) translateY(2px);
  }
  100% {
    transform: scale(1) rotate(0deg) translateY(0);
    opacity: 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 -6px 12px rgba(0, 0, 0, 0.4), inset 0 6px 12px rgba(255, 255, 255, 0.6);
  }
}

.ball-spring-active {
  animation: ballSpringPop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 2. Estampado Elástico de Números en Cartones */
@keyframes stampElastic {
  0% {
    transform: scale(1.8) rotate(-12deg);
    opacity: 0;
  }
  60% {
    transform: scale(0.88) rotate(4deg);
    opacity: 1;
  }
  85% {
    transform: scale(1.08) rotate(-1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.ticket-cell.painted {
  position: relative;
  background-color: var(--accent-rose) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35), 0 0 10px rgba(244, 63, 94, 0.4) !important;
  animation: stampElastic 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 3. Onda de Iluminación en Tablero 1-90 */
@keyframes matrixRipple {
  0% {
    transform: scale(0.8);
    box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.8);
  }
  50% {
    transform: scale(1.18);
    box-shadow: 0 0 20px 8px rgba(0, 229, 255, 0.5);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(0, 172, 193, 0.35);
  }
}

.matrix-cell.drawn {
  background: linear-gradient(135deg, var(--accent-teal), #00e5ff) !important;
  color: #0b132b !important;
  font-weight: 900 !important;
  border-color: #a5f3fc !important;
  animation: matrixRipple 0.5s ease-out forwards;
}

/* 4. Layouts Dedicados: Organizador vs Espectador */
.spectator-main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}

.spectator-stage-hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.spectator-big-ball-display {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.organizer-control-deck {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(0, 172, 193, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1024px) {
  .spectator-main-layout {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: var(--bg-app);
}

/* ==========================================================================
   OPTIMIZACIONES MÓVILES EXCLUSIVAS (Smartphone & Responsive Total)
   ========================================================================== */
html, body {
  overflow-x: hidden !important;
  width: 100%;
}

@media (max-width: 768px) {
  .main-content {
    padding: 8px 6px 32px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Header en Móvil */
  .header-inner {
    padding: 8px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .brand-logo {
    gap: 8px;
  }

  .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .brand-name {
    font-size: 1rem;
  }

  .brand-badge {
    font-size: 0.6rem;
    padding: 1px 5px;
    margin-left: 3px;
  }

  .nav-tabs {
    width: 100%;
    justify-content: center;
    order: 3;
    margin-top: 4px;
    gap: 4px;
  }

  .tab-btn {
    padding: 5px 8px;
    font-size: 0.75rem;
    flex: 1;
    justify-content: center;
  }

  .status-pill {
    padding: 2px 6px;
    font-size: 0.68rem;
  }

  /* Portada (AuthPortal) en Móvil */
  .auth-portal-container {
    margin: 2px auto 20px;
    padding: 0 2px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .auth-hero-header {
    margin-bottom: 10px;
    padding: 0 4px;
  }

  .auth-logo-badge {
    width: 76px !important;
    height: 76px !important;
    margin-bottom: 8px !important;
  }

  .brand-logo-img {
    width: 32px !important;
    height: 32px !important;
  }

  .auth-title {
    font-size: clamp(1.2rem, 5.5vw, 1.55rem) !important;
    line-height: 1.15;
    word-break: break-word;
    letter-spacing: normal !important;
  }

  .auth-subtitle {
    font-size: clamp(0.74rem, 3.2vw, 0.85rem) !important;
    line-height: 1.35;
    padding: 0 2px;
  }

  .auth-hero-badges {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    justify-content: center !important;
  }

  .auth-hero-badge-pill {
    font-size: 0.72rem !important;
    padding: 3px 8px !important;
    max-width: 100%;
  }

  .auth-prizes-top-container {
    padding: 8px 8px 10px;
    margin-top: 8px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .auth-prizes-top-title {
    font-size: 0.7rem;
    margin-bottom: 6px;
  }

  .auth-prizes-strip {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .auth-prizes-strip > :first-child {
    grid-column: span 2 !important;
  }

  .auth-prize-mini-item {
    padding: 6px 4px !important;
    min-width: 0 !important;
  }

  .auth-prize-mini-item span {
    font-size: 0.68rem !important;
  }

  .auth-prize-mini-item strong {
    font-size: 0.95rem !important;
  }

  .auth-prize-carton-banner {
    display: flex !important;
    flex-direction: column !important;
    padding: 8px 10px !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left;
  }

  .auth-prize-carton-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
    box-sizing: border-box !important;
  }

  .auth-prize-carton-text {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }

  .auth-prize-carton-icon {
    width: 32px !important;
    height: 32px !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
  }

  .auth-prize-carton-title {
    font-size: 0.82rem !important;
    word-break: break-word !important;
  }

  .auth-prize-carton-desc {
    font-size: 0.66rem !important;
    line-height: 1.2;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .auth-prize-carton-right {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 4px 10px !important;
    box-sizing: border-box !important;
  }

  .auth-prize-carton-amount {
    font-size: 1.05rem !important;
  }

  /* Barra de Pestañas en Móvil */
  .auth-card-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--radius-md) !important;
    box-sizing: border-box !important;
  }

  .auth-tab-bar {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    padding: 4px 2px !important;
    gap: 2px !important;
    box-sizing: border-box !important;
  }

  .auth-tab-btn {
    padding: 6px 2px !important;
    min-width: 0 !important;
    gap: 2px;
  }

  .auth-tab-btn i {
    font-size: 0.85rem;
  }

  .auth-tab-btn span {
    font-size: 0.65rem !important;
    line-height: 1.1;
    text-align: center;
    word-break: break-word;
  }

  /* Formulario y Tarjetas en Móvil */
  .auth-form-body {
    padding: 12px 10px !important;
    box-sizing: border-box !important;
  }

  .auth-lookup-box {
    padding: 12px 10px !important;
  }

  /* Cartones de Bingo en Móvil (Reducción armónica para que entren sin scroll horizontal) */
  .ticket-wrapper {
    margin-bottom: 10px;
    border-radius: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
  }

  .ticket-card {
    padding: 5px 3px 6px;
  }

  .ticket-header {
    margin-bottom: 3px;
    padding-bottom: 3px;
  }

  .ticket-code {
    font-size: 0.68rem;
  }

  .ticket-title {
    font-size: 0.72rem;
  }

  .ticket-col-headers {
    gap: 2px;
    margin-bottom: 2px;
  }

  .ticket-col-header-item {
    font-size: 0.48rem;
    padding: 1px 0;
  }

  .ticket-grid-3x9 {
    gap: 2px;
    border-width: 1.5px;
  }

  .ticket-row {
    gap: 2px;
  }

  .ticket-cell {
    font-size: 0.72rem !important;
    min-height: 22px !important;
    border-radius: 3px;
  }

  /* Terminal de Vendedores en Móvil */
  .grid-2-col {
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
}

@media (max-width: 380px) {
  .auth-title {
    font-size: 1.25rem !important;
  }

  .auth-tab-btn span {
    font-size: 0.65rem;
  }

  .ticket-cell {
    font-size: 0.7rem !important;
    min-height: 20px !important;
  }
}
