body {
  margin: 0;
  padding: 20px;
  font-family: Arial, sans-serif;
  background: transparent;
  text-align: center;
}

.contenedor-oyentes {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 10px 20px;
  background: transparent;
  border-radius: 18px;
  overflow: visible;
}

.contador-wrap {
  position: relative;
  display: inline-block;
  min-width: 190px;
}

.contador {
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  color: #d40000;
  letter-spacing: 1px;
  transition: transform 0.35s ease, filter 0.35s ease, opacity 0.35s ease, text-shadow 0.35s ease;
  will-change: transform, filter, opacity;
}

.contador.sube {
  animation: alegriaNumero 0.9s cubic-bezier(.2,.9,.2,1);
}

.contador.baja {
  animation: tristezaNumero 0.9s cubic-bezier(.2,.9,.2,1);
}

@keyframes alegriaNumero {
  0% {
    transform: scale(0.9);
    filter: brightness(1);
    text-shadow: 0 0 0 rgba(255,0,0,0);
  }
  30% {
    transform: scale(1.28);
    filter: brightness(1.25);
    text-shadow:
      0 0 14px rgba(255, 80, 80, 0.65),
      0 0 28px rgba(255, 0, 0, 0.35);
  }
  60% {
    transform: scale(1.15);
    filter: brightness(1.15);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
    text-shadow: 0 0 0 rgba(255,0,0,0);
  }
}

@keyframes tristezaNumero {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: grayscale(0);
  }
  30% {
    transform: scale(0.9);
    opacity: 0.75;
    filter: grayscale(0.3);
    text-shadow: 0 0 8px rgba(80, 0, 0, 0.2);
  }
  60% {
    transform: scale(0.95);
    opacity: 0.88;
  }
  100% {
    transform: scale(1);
    opacity: 1;
    filter: grayscale(0);
    text-shadow: 0 0 0 rgba(0,0,0,0);
  }
}

.texto {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #000;
}

.estado-en-vivo {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.punto-vivo {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d40000;
  box-shadow: 0 0 10px rgba(212, 0, 0, 0.5);
  animation: pulsoVivo 1.5s infinite;
}

@keyframes pulsoVivo {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
  100% { transform: scale(1); opacity: 1; }
}

.cambio {
  position: absolute;
  left: 50%;
  top: 50%;
  font-weight: 900;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.cambio.positivo {
  color: #ff1a1a;
  font-size: 34px;
  text-shadow:
    0 0 10px rgba(255, 80, 80, 0.45),
    0 0 22px rgba(255, 0, 0, 0.25);
  animation: cambioFeliz 1.8s cubic-bezier(.2,.85,.2,1) forwards;
}

@keyframes cambioFeliz {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.35) rotate(-8deg);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.35) rotate(4deg);
  }
  45% {
    opacity: 1;
    transform: translate(-50%, -95%) scale(1.12) rotate(-3deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -165%) scale(0.82) rotate(8deg);
  }
}

.cambio.negativo {
  color: #7a0000;
  font-size: 30px;
  text-shadow: 0 3px 10px rgba(0,0,0,0.12);
  animation: cambioTriste 2s cubic-bezier(.2,.85,.2,1) forwards;
}

@keyframes cambioTriste {
  0% {
    opacity: 0;
    transform: translate(-50%, -10%) scale(0.5);
    filter: blur(0px);
  }
  20% {
    opacity: 0.95;
    transform: translate(-50%, 8%) scale(1.05);
    filter: blur(0px);
  }
  55% {
    opacity: 0.85;
    transform: translate(-50%, 48%) scale(0.95);
    filter: blur(0.4px);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 110%) scale(0.72);
    filter: blur(1px);
  }
}

.flash-feliz,
.flash-triste {
  position: absolute;
  inset: -10px;
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
}

.flash-feliz.activo {
  animation: pulseFeliz 0.95s ease-out;
}

.flash-triste.activo {
  animation: pulseTriste 1s ease-out;
}

@keyframes pulseFeliz {
  0% {
    opacity: 0;
    transform: scale(0.85);
    box-shadow: 0 0 0 rgba(255,0,0,0);
  }
  30% {
    opacity: 1;
    transform: scale(1.12);
    box-shadow:
      0 0 0 3px rgba(255, 60, 60, 0.22),
      0 0 30px rgba(255, 0, 0, 0.22),
      0 0 55px rgba(255, 80, 80, 0.18);
  }
  100% {
    opacity: 0;
    transform: scale(1.28);
    box-shadow:
      0 0 0 14px rgba(255, 0, 0, 0),
      0 0 0 rgba(255, 0, 0, 0);
  }
}

@keyframes pulseTriste {
  0% {
    opacity: 0;
    transform: scale(1);
    box-shadow: 0 0 0 rgba(80,0,0,0);
  }
  35% {
    opacity: 0.55;
    transform: scale(0.96);
    box-shadow:
      0 0 0 2px rgba(90, 0, 0, 0.12),
      0 0 14px rgba(50, 0, 0, 0.10);
  }
  100% {
    opacity: 0;
    transform: scale(0.9);
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
}
