/* ── CONTADOR DE SERVIDORES EN VIVO ───────────────────────────────────────────
   Usa los tokens de index.html (--surface, --border, --accent, --accent2,
   --success, --muted, --text). Los valores tras la coma son solo respaldo. */

.live-servers {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 1rem 1.25rem 3rem;
}

.ls-card {
  position: relative;
  width: 100%;
  max-width: 760px;
  padding: 2.2rem 2.4rem 2.4rem;
  text-align: center;
  background: var(--surface, #0c0c1d);
  border: 1px solid var(--border, rgba(255, 255, 255, .06));
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  transition: border-color .3s, box-shadow .3s;
}

.ls-card::before {
  /* halo superior sutil, mismo lenguaje que .stat-card */
  content: '';
  position: absolute;
  inset: -40% -10% auto;
  height: 80%;
  background: radial-gradient(ellipse at center, rgba(88, 101, 242, .16) 0%, transparent 65%);
  z-index: -1;
  pointer-events: none;
}

.ls-card:hover {
  border-color: rgba(88, 101, 242, .35);
  box-shadow: 0 16px 40px rgba(88, 101, 242, .10);
}

.ls-card.is-goal {
  border-color: rgba(87, 242, 135, .35);
  box-shadow: 0 16px 50px rgba(87, 242, 135, .08);
}

/* ── Estado ── */
.ls-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.ls-title {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted, #6b6b8a);
}

.ls-status {
  --c: var(--muted, #6b6b8a);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .8rem .35rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  transition: color .3s, background .3s, border-color .3s;
}

.ls-status[data-state="live"] { --c: var(--success, #57f287); }
.ls-status[data-state="stale"] { --c: #fbbf24; }

.ls-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}

.ls-status[data-state="live"] .ls-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--c);
  animation: lsPing 1.8s cubic-bezier(0, 0, .2, 1) infinite;
}

.ls-status[data-state="connecting"] .ls-dot { animation: lsBlink 1.2s ease-in-out infinite; }

@keyframes lsPing {
  0% { transform: scale(1); opacity: .7; }
  80%, 100% { transform: scale(3); opacity: 0; }
}

@keyframes lsBlink {
  50% { opacity: .3; }
}

/* ── Contador ── */
.ls-count {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.ls-number {
  display: block;
  font-family: "Inter", "DM Sans", sans-serif;
  font-size: clamp(4.2rem, 17vw, 8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent, #5865F2), var(--accent2, #eb459e));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: filter .4s;
}

.ls-number.is-bump { animation: lsBump .6s cubic-bezier(.2, .8, .2, 1); }
.ls-number.is-up { filter: drop-shadow(0 0 22px rgba(87, 242, 135, .35)); }
.ls-number.is-down { filter: drop-shadow(0 0 22px rgba(235, 69, 158, .4)); }

@keyframes lsBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

.ls-delta {
  position: absolute;
  top: 6%;
  left: 100%;
  margin-left: .5rem;
  padding: .15rem .5rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.ls-delta.up { color: var(--success, #57f287); background: rgba(87, 242, 135, .12); }
.ls-delta.down { color: var(--accent2, #eb459e); background: rgba(235, 69, 158, .12); }
.ls-delta.show { animation: lsDelta 2.2s ease forwards; }

@keyframes lsDelta {
  0% { opacity: 0; transform: translateY(8px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(-4px); }
  100% { opacity: 0; transform: translateY(-10px); }
}

.ls-sub {
  margin-top: .7rem;
  font-size: 1rem;
  color: var(--muted, #6b6b8a);
  font-weight: 500;
}

.ls-note {
  min-height: 1.2em;
  margin-top: .35rem;
  font-size: .8rem;
  color: #fbbf24;
}

/* ── Progreso ── */
.ls-progress { margin-top: 1.9rem; text-align: left; }

.ls-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .6rem;
  font-size: .85rem;
  color: var(--muted, #6b6b8a);
}

.ls-progress-top strong { color: var(--text, #e8e8f0); font-weight: 600; }

.ls-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}

.ls-fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent, #5865F2), var(--accent2, #eb459e));
  box-shadow: 0 0 18px rgba(88, 101, 242, .5);
  transition: width .9s cubic-bezier(.22, 1, .36, 1);
  overflow: hidden;
}

.ls-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: lsShine 3s ease-in-out infinite;
}

.ls-card.is-goal .ls-fill {
  background: linear-gradient(90deg, var(--accent, #5865F2), var(--success, #57f287));
  box-shadow: 0 0 18px rgba(87, 242, 135, .5);
}

@keyframes lsShine {
  60%, 100% { transform: translateX(100%); }
}

.ls-scale {
  display: flex;
  justify-content: space-between;
  margin-top: .45rem;
  font-size: .72rem;
  color: var(--muted, #6b6b8a);
  font-variant-numeric: tabular-nums;
}

/* ── Celebración ── */
#ls-confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
}

.ls-celebrate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(5, 5, 15, .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity .5s ease;
}

.ls-celebrate.show { opacity: 1; }

.ls-celebrate-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 2.6rem 2rem 2.2rem;
  text-align: center;
  background: linear-gradient(160deg, rgba(17, 17, 40, .96), rgba(12, 12, 29, .96));
  border: 1px solid rgba(88, 101, 242, .45);
  border-radius: 28px;
  box-shadow: 0 0 0 1px rgba(235, 69, 158, .12), 0 30px 90px rgba(88, 101, 242, .35);
  overflow: hidden;
  transform: translateY(24px) scale(.94);
  transition: transform .7s cubic-bezier(.2, 1.1, .3, 1);
}

.ls-celebrate.show .ls-celebrate-card { transform: none; }

.ls-celebrate-card::before {
  /* aro de luz que gira detrás del texto */
  content: '';
  position: absolute;
  width: 140%;
  aspect-ratio: 1;
  left: -20%;
  top: -60%;
  background: conic-gradient(from 0deg, transparent, rgba(88, 101, 242, .35), transparent 30%, rgba(235, 69, 158, .3), transparent 60%);
  animation: lsSpin 9s linear infinite;
  z-index: -1;
  filter: blur(30px);
}

@keyframes lsSpin { to { transform: rotate(360deg); } }

.ls-celebrate-num {
  font-family: "Inter", "DM Sans", sans-serif;
  font-size: clamp(3.4rem, 16vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--accent, #5865F2), var(--accent2, #eb459e));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ls-celebrate-title {
  margin-top: 1rem;
  font-family: "Inter", "DM Sans", sans-serif;
  font-size: clamp(1.15rem, 4.6vw, 1.6rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text, #e8e8f0);
}

.ls-celebrate-text {
  margin-top: .8rem;
  font-size: .98rem;
  line-height: 1.55;
  color: var(--muted, #6b6b8a);
}

.ls-celebrate-btn {
  margin-top: 1.6rem;
  padding: .8rem 1.8rem;
  border: 0;
  border-radius: 12px;
  font: 600 .95rem "Inter", "DM Sans", sans-serif;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent, #5865F2), var(--accent2, #eb459e));
  transition: transform .2s, box-shadow .2s;
}

.ls-celebrate-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(88, 101, 242, .45); }
.ls-celebrate-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.ls-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .live-servers { padding: .5rem 1rem 2.2rem; }
  .ls-card { padding: 1.5rem 1.2rem 1.7rem; border-radius: 20px; }
  .ls-head { justify-content: center; }
  .ls-delta { position: static; display: block; margin: .5rem auto 0; width: max-content; }
  .ls-progress-top { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .ls-fill, .ls-celebrate, .ls-celebrate-card { transition: none; }
  .ls-fill::after, .ls-celebrate-card::before, .ls-dot::after, .ls-dot { animation: none !important; }
  .ls-number.is-bump { animation: none; }
}
