/*! =============================================================================
 *  © 2026 Renzo Núñez · RonBStudio — "Perú Elige 2026 · Segunda Vuelta".
 *  Código propietario. https://www.ronbstudio.com
 * ============================================================================= */
/* =============================================================================
 *  ganador-matematico.css — indicador "cuánto falta para el ganador matemático"
 *  (reemplaza la barra de Conteo ONPE). Vive en el race-header.
 *  v0.1.16.171 — barra más grande + latido permanente (glow/brillo pulsantes).
 * ===========================================================================*/

.ganmat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  max-width: 340px;
}

.ganmat__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ganmat__label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-mv-ink-soft, #64748b);
  white-space: nowrap;
}
/* Ícono SVG de la etiqueta (reloj / check). Monocromo: hereda currentColor. */
.ganmat__ico { display: inline-flex; flex: 0 0 auto; }
.ganmat__ico svg { display: block; width: 12px; height: 12px; }
.ganmat__ltxt { letter-spacing: inherit; }

.ganmat__faltan {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 14px;
  font-weight: 800;
  color: var(--c-party-fp, #f37021);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Barra MÁS GRANDE + overflow visible para que el glow del latido irradie. */
.ganmat__bar {
  height: 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.09);
  overflow: visible;
}

.ganmat__fill {
  --ganmat-glow: 243, 112, 33;            /* rgb del glow (naranja por defecto) */
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f9a849, #f37021);
  transition: width 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
  /* LATIDO PERMANENTE: glow expande/contrae + brillo sube/baja al ritmo. */
  animation: ganmatLatido 1.3s ease-in-out infinite;
}

.ganmat__note {
  margin: 0;
  font-family: var(--font-sans, Inter, system-ui, sans-serif);
  font-size: 9.5px;
  line-height: 1.45;
  color: var(--c-mv-ink-soft, #94a3b8);
}

/* Estado BLINDADO: la barra se llena, pasa a verde y el latido se vuelve verde. */
.ganmat.is-locked .ganmat__fill {
  --ganmat-glow: 34, 176, 79;
  background: linear-gradient(90deg, #2ecc6a, #16a34a);
}
.ganmat.is-locked .ganmat__faltan {
  color: #16a34a;
}

@keyframes ganmatLatido {
  0%, 100% { box-shadow: 0 0 5px rgba(var(--ganmat-glow), 0.45); filter: brightness(0.97); }
  50%      { box-shadow: 0 0 18px 2px rgba(var(--ganmat-glow), 0.92); filter: brightness(1.16); }
}

/* === Cuenta regresiva al 100% (anclada a las actas restantes en el JEE) === */
.ganmat__faltan .gmc-n {
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}
.ganmat__faltan .gmc-u {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-mv-ink-soft, #64748b);
  margin-left: 1px;
}
/* Destello de tensión cuando baja una acta. */
.ganmat__faltan .gmc-n.is-tick { animation: gmTick 0.6s cubic-bezier(0.2, 0.8, 0.3, 1.2); }
@keyframes gmTick {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.34); color: #16a34a; }
  100% { transform: scale(1); }
}
/* Al 100%: número + etiqueta en verde (conteo cerrado). */
.ganmat.is-100 .ganmat__faltan .gmc-n { color: #16a34a; }
.ganmat.is-100 .ganmat__label { color: #16a34a; }

/* Puntos de la cuenta regresiva: cada punto = un acta por contabilizar en el JEE. */
.gmc-dots { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; min-height: 14px; margin: 1px 0 2px; }
.gmc-dot {
  --c1: #f9a849; --c2: #f37021; --glow: 243, 112, 33;   /* default: naranja (FP) */
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 0 6px rgba(var(--glow), 0.55);
  animation: gmDotPulse 1.3s ease-in-out infinite;
  flex: 0 0 auto;
}
/* Paleta CÁLIDA variada (atardecer): cada acta pendiente con su propio matiz y un
   latido escalonado. Se evita VERDE (= acta ya contabilizada) y AZUL/MORADO
   (lectura partidaria) para no romper la semántica ni la neutralidad. */
.gmc-dot:nth-child(5n+1) { --c1:#f9a849; --c2:#f37021; --glow:243,112,33;  animation-delay:0s;   }
.gmc-dot:nth-child(5n+2) { --c1:#fcd34d; --c2:#f59e0b; --glow:245,158,11;  animation-delay:.16s; }
.gmc-dot:nth-child(5n+3) { --c1:#fdba74; --c2:#fb923c; --glow:251,146,60;  animation-delay:.32s; }
.gmc-dot:nth-child(5n+4) { --c1:#fda4af; --c2:#fb7185; --glow:251,113,133; animation-delay:.48s; }
.gmc-dot:nth-child(5n+5) { --c1:#fbbf24; --c2:#f97316; --glow:249,115,22;  animation-delay:.64s; }
@keyframes gmDotPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(var(--glow), 0.45); transform: scale(1); }
  50%      { box-shadow: 0 0 11px 1px rgba(var(--glow), 0.9); transform: scale(1.12); }
}
/* Acta contabilizada: el punto "estalla" en verde y se apaga. */
.gmc-dot.is-spent { animation: gmDotSpent 0.62s ease forwards; pointer-events: none; }
@keyframes gmDotSpent {
  0%   { transform: scale(1); background: #f37021; }
  40%  { transform: scale(1.7); background: #16a34a; box-shadow: 0 0 16px 3px rgba(34, 176, 79, 0.95); }
  100% { transform: scale(0); opacity: 0; }
}

/* Botón "Volver a Vivir Nuestro Viaje" — solo en el estado 100% (relanza el recap).
   LATE (latido tipo corazón con glow) y EMANA notas musicales (♪♫ que suben en loop). */
.gmc-replay {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  margin: 9px 0 1px; padding: 8px 16px;
  border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #f9a849, #f37021);
  color: #fff; font: 800 12.5px/1 'Inter', system-ui, -apple-system, sans-serif;
  letter-spacing: 0.2px; cursor: pointer;
  box-shadow: 0 3px 12px rgba(243, 112, 33, 0.35);
  /* aparición + latido permanente (el latido arranca cuando termina la aparición) */
  animation: gmReplayIn 0.5s cubic-bezier(0.22, 1.2, 0.36, 1) both,
             gmReplayBeat 1.25s ease-in-out 0.55s infinite;
}
.gmc-replay:active { transform: scale(0.97); }
.gmc-replay svg { display: block; }
.gmc-replay-txt { position: relative; z-index: 1; }
@keyframes gmReplayIn {
  0%   { opacity: 0; transform: scale(0.85) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
/* Latido "lub-dub" + glow pulsante. */
@keyframes gmReplayBeat {
  0%, 58%, 100% { transform: scale(1);    box-shadow: 0 3px 12px rgba(243, 112, 33, 0.35); }
  12%           { transform: scale(1.07); box-shadow: 0 6px 22px 2px rgba(243, 112, 33, 0.62); }
  24%           { transform: scale(1.0);  box-shadow: 0 3px 12px rgba(243, 112, 33, 0.35); }
  38%           { transform: scale(1.045);box-shadow: 0 5px 17px 1px rgba(243, 112, 33, 0.5); }
}

/* Notas musicales que emanan del botón (glifo en modo TEXTO → monocromo, no emoji). */
.gmc-note {
  position: absolute; top: 1px;
  font-style: normal; font-size: 13px; line-height: 1;
  color: #ffe9a8; pointer-events: none; opacity: 0; z-index: 0;
  text-shadow: 0 1px 5px rgba(243, 112, 33, 0.65);
  animation: gmNoteFloat 2.3s ease-in-out infinite;
}
.gmc-note--1 { left: 17%; --dx: -14px; --dr: -18deg; animation-delay: 0s; }
.gmc-note--2 { left: 50%; --dx: 2px;   --dr: 12deg;  animation-delay: 0.77s; font-size: 15px; }
.gmc-note--3 { left: 82%; --dx: 14px;  --dr: 20deg;  animation-delay: 1.53s; }
@keyframes gmNoteFloat {
  0%   { opacity: 0;   transform: translate(0, 0) rotate(0deg) scale(0.7); }
  18%  { opacity: 1; }
  72%  { opacity: 0.9; }
  100% { opacity: 0;   transform: translate(var(--dx, 0), -32px) rotate(var(--dr, 14deg)) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .ganmat__fill, .gmc-dot, .gmc-replay, .gmc-note { transition: none; animation: none; }
}
