* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #1a1a2e;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 10px;
  font-family: 'Segoe UI', 'Roboto', Tahoma, sans-serif;
}

.container {
  width: 100%;
  max-width: 820px;
  background: linear-gradient(145deg, #2d1b3d 0%, #1a1a2e 100%);
  border-radius: 28px;
  padding: 18px 16px 14px 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}

.header .logo-titulo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header .logo-titulo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.header .logo-titulo span {
  color: #e0c3f0;
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.header .estado-bola {
  color: #b8a0c8;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.bola-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 6px 0 12px 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 60px;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
}

.bola {
  width: 96px;
  height: 96px;
  background-image: url('https://lineasdasorte.pages.dev/purple1-91x91@2x.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  box-shadow: 0 0 0 3px #7d4b9a, 0 0 20px rgba(125, 75, 154, 0.4);
}

.bola span {
  font-size: 60px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.info-bola {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: #d0c0e0;
  flex: 1;
  min-width: 120px;
}

.info-bola .bola-contador {
  font-size: 0.9rem;
  font-weight: 500;
  color: #e8d8f0;
  letter-spacing: 0.5px;
}

.info-bola .bola-contador span {
  color: #f5c842;
  font-weight: 700;
}

.info-bola .timestamp {
  font-size: 0.65rem;
  color: #9a8aaa;
  margin-top: 2px;
}

.info-bola .estado-conexion {
  font-size: 0.65rem;
  color: #9a8aaa;
  margin-top: 1px;
}

.tubo {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 4px 0 8px 0;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  min-height: 48px;
  flex-wrap: wrap;
}

.tubo-item {
  width: 52px;
  height: 52px;
  background-image: url('https://lineasdasorte.pages.dev/purple1-32x32@2x.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.tubo-item.vacio {
  background-image: none !important;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
  color: #666;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carton {
  display: grid;
  grid-template-columns: 50px repeat(15, 1fr);
  gap: 4px;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px;
  border-radius: 16px;
  margin-top: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow-x: auto;
}

.celda-letra {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 8px;
  image-rendering: pixelated;
}

.numero {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-image: url('https://lineasdasorte.pages.dev/purple1-32x32@2x.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-radius: 8px;
  image-rendering: pixelated;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: background-image 0.12s ease, transform 0.12s ease, filter 0.12s ease;
}

.numero.salido {
  background-image: url('https://lineasdasorte.pages.dev/gold@2x.png');
  color: #000;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.numero.gold {
  background-image: url('https://lineasdasorte.pages.dev/gold@2x.png') !important;
  color: #000 !important;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.numero.gold_green {
  background-image: url('https://lineasdasorte.pages.dev/gold_green@2x.png') !important;
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.numero.ultimo::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  border: 2px solid #f1c40f;
  box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
  pointer-events: none;
}

.numero.grupo-ganador {
  z-index: 5;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  margin-top: 14px;
  color: #8a7a9a;
  font-size: 0.7rem;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  letter-spacing: 0.3px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 10px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .carton {
    grid-template-columns: 36px repeat(15, 1fr);
    gap: 3px;
    padding: 6px;
  }
  .numero {
    font-size: 1rem;
  }
}

@media (max-width: 500px) {
  .carton {
    grid-template-columns: 28px repeat(15, 1fr);
    gap: 2px;
    padding: 4px;
  }
  .numero {
    font-size: 0.8rem;
  }
  .tubo-item {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
  .tubo-item.vacio {
    width: 34px;
    height: 34px;
    font-size: 0.7rem;
  }
}

@media (max-width: 400px) {
  .carton {
    grid-template-columns: 22px repeat(15, 1fr);
    gap: 1px;
    padding: 3px;
  }
  .numero {
    font-size: 0.65rem;
  }
  .bola {
    width: 72px;
    height: 72px;
  }
  .bola span {
    font-size: 42px;
  }
  .tubo-item {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  .tubo-item.vacio {
    width: 30px;
    height: 30px;
    font-size: 0.6rem;
  }
}

@media (min-width: 601px) and (max-width: 1024px) and (max-height: 650px) {
  .container {
    max-width: 700px;
    padding: 12px 10px;
  }
  .bola {
    width: 80px;
    height: 80px;
  }
  .bola span {
    font-size: 50px;
  }
  .carton {
    grid-template-columns: 38px repeat(15, 1fr);
    gap: 3px;
    padding: 6px;
  }
  .numero {
    font-size: 1.1rem;
  }
  .tubo-item {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
  .tubo-item.vacio {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }
}

@media (max-height: 650px) {
  body {
    align-items: center;
    padding: 4px;
  }
  .container {
    padding: 8px 6px;
  }
  .bola-section {
    margin: 2px 0 6px 0;
    padding: 4px 10px;
  }
  .bola {
    width: 70px;
    height: 70px;
  }
  .bola span {
    font-size: 42px;
  }
  .carton {
    padding: 4px;
    gap: 2px;
    grid-template-columns: 30px repeat(15, 1fr);
  }
  .numero {
    font-size: 0.9rem;
  }
  .footer {
    margin-top: 6px;
    padding-top: 4px;
  }
  .header {
    margin-bottom: 4px;
  }
  .tubo-item {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  .tubo-item.vacio {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
  }
}