/* Estilo alineado con www.teleamazonas.com: Inter, fondo blanco plano, rojo de marca. */
@font-face {
  font-family: "InterTA";
  src: url("fuentes/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --fondo: #ffffff;
  --texto: #151c26;
  --texto-2: #4b4b4b;
  --suave: #7e8da2;
  --linea: #eaeaea;
  --pista: #f1f3f6;
  --rojo: #f41c0c;
  --sin-datos: #e4e8ee;
  --sin-eleccion: #f4f5f7;
  --sombra: 0 10px 30px rgba(21, 28, 38, .14), 0 2px 6px rgba(21, 28, 38, .08);
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-family: "InterTA", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fondo); }
body { -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.35; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.pagina { max-width: 1240px; margin: 0 auto; padding: 20px 16px 24px; }

/* ── Cabecera, como los titulares del portal ── */
.cabecera { border-bottom: 1px solid var(--linea); padding-bottom: 14px; margin-bottom: 4px; }
.antetitulo { margin: 0 0 6px; display: flex; align-items: center; gap: 10px; color: var(--suave); font-weight: 500; font-size: 17px; }
.sello { background: var(--rojo); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .06em; padding: 4px 9px 4px 8px; border-radius: 3px; line-height: 1; }
.sello::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #fff; vertical-align: 1px; animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .2; } }
.cabecera-fila { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 24px; }
.cabecera h1 { margin: 0; font-weight: 900; font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.02em; color: #000; }
.cabecera-estado { margin: 0; color: var(--suave); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.cabecera-estado.error { color: var(--rojo); }

/* ── Controles ── */
.controles { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); padding: 12px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--linea); }
.pestanas { display: inline-flex; gap: 22px; }
.pestana { position: relative; border: 0; background: none; padding: 6px 0; font-weight: 700; font-size: 18px; color: var(--suave); cursor: pointer; white-space: nowrap; transition: color .2s; }
.pestana::after { content: ""; position: absolute; left: 0; right: 0; bottom: -13px; height: 3px; background: var(--rojo); transform: scaleX(0); transition: transform .3s var(--ease); }
.pestana[aria-selected="true"] { color: #000; }
.pestana[aria-selected="true"]::after { transform: scaleX(1); }
.pestana .cuenta { font-weight: 500; font-size: 14px; margin-left: 4px; color: var(--suave); }
.filtros { display: flex; gap: 8px; flex: 1 1 320px; justify-content: flex-end; }
.campo { flex: 1 1 170px; max-width: 250px; }
.campo-buscar { max-width: 290px; }
.campo select, .campo input { width: 100%; height: 40px; border: 1px solid #d5dae1; border-radius: 4px; background: #fff; padding: 0 12px; font-size: 15px; }
.campo select:focus, .campo input:focus, .pestana:focus-visible, .ver-todos:focus-visible, .mapa [tabindex]:focus-visible { outline: 2px solid var(--texto); outline-offset: 2px; }

/* ── Resumen ── */
.resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 18px 0 8px; border: 1px solid var(--linea); border-radius: 6px; }
.dato { padding: 14px 18px; border-left: 1px solid var(--linea); min-width: 0; }
.dato:first-child { border-left: 0; }
.dato-valor { display: block; font-weight: 900; font-size: clamp(24px, 3vw, 32px); line-height: 1.05; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.dato-texto { display: block; margin-top: 4px; color: var(--suave); font-size: 13px; font-weight: 500; }
.dato-lider { display: flex; align-items: center; gap: 10px; }
.dato-lider .chip { width: 14px; height: 14px; }
.dato-lider .dato-valor { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(18px, 2.2vw, 24px); }

/* ── Mapa + detalle ── */
.tablero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 24px; align-items: start; margin: 16px 0 28px; }
.mapa-caja { position: relative; }
.mapa svg { display: block; width: 100%; height: auto; overflow: visible; }
.mapa .prov { fill: var(--sin-datos); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; cursor: pointer; transform-box: fill-box; transform-origin: center; transition: fill .6s var(--ease), transform .35s var(--ease), filter .35s var(--ease), opacity .3s; }
.mapa .prov.sin-eleccion { fill: var(--sin-eleccion); cursor: default; }
.mapa.con-hover .prov:not(.activa):not(.sin-eleccion) { opacity: .55; }
.mapa .prov.activa { transform: scale(1.07); filter: drop-shadow(0 6px 10px rgba(21, 28, 38, .35)); stroke-width: 2; }
.mapa [tabindex]:focus:not(:focus-visible) { outline: none; }
/* Lugar elegido: borde casi negro (se ve sobre cualquier color de partido), elevado y al frente. */
.mapa .prov.seleccionada { stroke: var(--texto); stroke-width: 3; transform: scale(1.03); filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 6px 10px rgba(21, 28, 38, .35)); }
.mapa .prov.seleccionada.activa { transform: scale(1.07); }
.mapa.con-hover .prov.seleccionada:not(.activa) { opacity: .9; }
.mapa.alcaldias .prov.contiene { fill: #cdd5e0; }
.mapa.alcaldias .prov { fill: #e3e8ef; stroke: #fff; cursor: default; }
.mapa.alcaldias.con-hover .prov { opacity: 1; }
.mapa .ciudad { display: none; cursor: pointer; transform-box: fill-box; transform-origin: center; transition: fill .6s var(--ease), transform .3s var(--ease), r .3s; stroke: #fff; stroke-width: 2.5; fill: #b9c2cf; }
.mapa.alcaldias .ciudad { display: inline; }
.mapa .ciudad.activa { transform: scale(1.45); filter: drop-shadow(0 3px 6px rgba(21, 28, 38, .4)); }
.mapa .ciudad.seleccionada { stroke: var(--texto); stroke-width: 3.5; transform: scale(1.25); filter: drop-shadow(0 0 1.5px #fff); }
.mapa .ciudad.seleccionada.activa { transform: scale(1.45); }
/* Halo del lugar elegido: pulsa suave hacia afuera. */
.mapa .halo { fill: none; stroke: var(--texto); pointer-events: none; opacity: 0; transform-box: fill-box; transform-origin: center; }
.mapa .halo-ciudad { display: none; }
.mapa.alcaldias .halo-prov { display: none; }
.mapa.alcaldias .halo-ciudad { display: inline; }
.mapa .halo-prov.visible { animation: halo-prov 2.2s var(--ease) infinite; }
.mapa .halo-ciudad.visible { animation: halo-ciudad 1.8s var(--ease) infinite; }
@keyframes halo-prov { 0% { opacity: .6; transform: scale(1.03); stroke-width: 3; } 100% { opacity: 0; transform: scale(1.16); stroke-width: 1; } }
@keyframes halo-ciudad { 0% { opacity: .7; transform: scale(1.2); stroke-width: 3; } 100% { opacity: 0; transform: scale(2.6); stroke-width: 1; } }
.mapa .recuadro { fill: none; stroke: #c9d0da; stroke-dasharray: 4 4; }
.mapa .recuadro-texto { fill: var(--suave); font-size: 15px; font-weight: 600; }
.mapa .etiqueta { fill: var(--texto); font-size: 15px; font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: 4px; pointer-events: none; text-anchor: middle; dominant-baseline: middle; opacity: 0; transition: opacity .3s var(--ease); }
.mapa .etiqueta.visible { opacity: 1; animation: etiqueta-entra .45s var(--ease); }
.mapa.con-hover .etiqueta.visible { opacity: .35; }
@keyframes etiqueta-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.globo { position: absolute; z-index: 20; width: 270px; background: #fff; border-radius: 6px; box-shadow: var(--sombra); padding: 12px 14px; pointer-events: none; opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .18s, transform .18s var(--ease); }
.globo.visible { opacity: 1; transform: none; }
.globo-titulo { margin: 0; font-weight: 800; font-size: 17px; }
.globo-sub { margin: 1px 0 8px; color: var(--suave); font-size: 12.5px; font-weight: 500; }
.globo-fila { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--linea); font-size: 14px; }
.globo-fila .mini { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--pista); }
.globo-fila b { font-variant-numeric: tabular-nums; }
.globo-nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.globo-barra { grid-column: 2 / 4; height: 4px; background: var(--pista); border-radius: 4px; overflow: hidden; margin-top: -2px; }
.globo-barra span { display: block; height: 100%; }

.leyenda { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--texto-2); }
.leyenda li { display: inline-flex; align-items: center; gap: 6px; }
.chip { display: inline-block; width: 11px; height: 11px; border-radius: 2px; flex: none; }
.mapa-ayuda { margin: 6px 0 0; color: var(--suave); font-size: 12.5px; }

.detalle { position: sticky; top: 76px; min-height: 200px; }
.detalle .lugar { border-color: var(--texto); }

/* ── Tarjetas ── */
.titulo-seccion { margin: 0 0 12px; font-weight: 900; font-size: 26px; letter-spacing: -.01em; color: #000; }
.lugares { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.celda { position: relative; min-width: 0; transition: opacity .3s; }
.lugares.enfoque .celda:not(.abierta) { opacity: .45; }
.lugar { position: relative; background: #fff; border: 1px solid var(--linea); border-radius: 6px; padding: 14px 16px 10px; display: flex; flex-direction: column; min-width: 0; height: 100%; transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
.celda.abierta .lugar { position: absolute; top: 0; left: 0; right: 0; height: auto; z-index: 15; transform: scale(1.035); box-shadow: var(--sombra); border-color: transparent; }
.celda.resaltada .lugar { border-color: var(--texto); }
.lugar-cabecera { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lugar-sub { margin: 0 0 1px; color: var(--suave); font-size: 13px; font-weight: 500; }
.lugar-nombre { margin: 0; font-weight: 800; font-size: 21px; line-height: 1.15; color: #000; }
.lugar-escrutado { text-align: right; flex: none; }
.escrutado-valor { display: block; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.escrutado-texto { font-size: 11px; color: var(--suave); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.avance { height: 3px; background: var(--pista); margin: 10px 0 4px; overflow: hidden; }
.avance span { display: block; height: 100%; width: 0; background: var(--rojo); transition: width .8s var(--ease); }

.candidatos { list-style: none; margin: 0; padding: 0; }
.candidato { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--linea); background: #fff; max-height: 90px; transition: max-height .4s var(--ease), opacity .35s, padding .4s var(--ease); will-change: transform; }
.candidato:first-child { border-top: 0; }
.candidato.extra { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; border-top-width: 0; overflow: hidden; }
.celda.abierta .candidato.extra, .celda.fija .candidato.extra { max-height: 90px; opacity: 1; padding-top: 9px; padding-bottom: 9px; border-top-width: 1px; transition-delay: calc(var(--i, 0) * 35ms); }
.foto { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: var(--pista); display: grid; place-items: center; }
.foto img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.iniciales { font-weight: 800; color: var(--suave); font-size: 15px; }
.foto img[src] + .iniciales { display: none; }
.datos { flex: 1; min-width: 0; }
.fila { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.nombre { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Nombres en mayúsculas (29/11): en pantallas angostas pasan a dos líneas en vez de cortarse. */
@media (max-width: 520px) { .nombre { white-space: normal; line-height: 1.2; } }
.porcentaje { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; flex: none; }
.partido { display: flex; align-items: center; gap: 6px; color: var(--texto-2); font-size: 12.5px; margin-top: 2px; min-width: 0; }
.partido-texto { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 20px; height: 20px; object-fit: contain; flex: none; }
.logo:not([src]) { display: none; }
.barra { height: 5px; background: var(--pista); border-radius: 5px; margin-top: 6px; overflow: hidden; }
.barra span { display: block; height: 100%; width: 0; border-radius: 5px; background: #b9c2cf; transition: width .8s var(--ease); }
.celda.abierta .candidato.extra .barra span { transition-delay: calc(120ms + var(--i, 0) * 45ms); }

.candidato.primero .foto { width: 58px; height: 58px; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--color-lider, var(--texto)); }
.candidato.primero .nombre { font-size: 17.5px; }
.candidato.primero .porcentaje { font-size: 24px; font-weight: 900; }
.candidato.primero .barra { height: 7px; }

.lugar.sin-datos .escrutado-valor { font-size: 14px; color: var(--suave); font-weight: 700; }
.lugar.sin-datos .porcentaje, .lugar.sin-datos .barra, .lugar.sin-datos .avance { display: none; }

.lugar-pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }
.ver-todos { border: 0; background: none; color: var(--texto); font-weight: 700; padding: 6px 0; cursor: pointer; font-size: 13px; text-decoration: underline; text-decoration-color: var(--rojo); text-underline-offset: 3px; }
.ver-todos[hidden] { display: none; }
.lugar-hora { color: var(--suave); font-size: 12px; margin-left: auto; text-align: right; }

/* Cambio de líder: destello y aviso. */
.aviso-lider { position: absolute; top: -10px; left: 14px; background: var(--rojo); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 3px 8px; border-radius: 3px; animation: aparecer .4s var(--ease); }
.lugar.nuevo-lider { animation: destello 1.8s var(--ease); }
@keyframes destello { 0%, 100% { box-shadow: 0 0 0 0 rgba(244, 28, 12, 0); } 20% { box-shadow: 0 0 0 4px rgba(244, 28, 12, .45); } }
@keyframes aparecer { from { opacity: 0; transform: translateY(4px); } }

.vacio { grid-column: 1 / -1; text-align: center; color: var(--suave); padding: 40px 16px; border: 1px dashed var(--linea); border-radius: 6px; }
.pie { color: var(--suave); font-size: 12.5px; text-align: center; margin: 28px 0 4px; border-top: 1px solid var(--linea); padding-top: 14px; }

/* ── Embebido en teleamazonas.com ── */
.embebido, .embebido body { background: transparent; }
.embebido .pagina { padding: 0 0 4px; }
.embebido .cabecera, .embebido .pie { display: none; }
.solo-lugar .controles, .solo-lugar .resumen, .solo-lugar .tablero, .solo-lugar .titulo-seccion { display: none; }
.solo-lugar .lugares { grid-template-columns: minmax(0, 1fr); }
.sin-mapa .tablero { display: none; }

@media (max-width: 980px) {
  .tablero { grid-template-columns: minmax(0, 1fr); }
  .detalle { position: static; }
  .globo { display: none; }
}

@media (max-width: 560px) {
  .pagina { padding: 14px 12px; }
  .filtros { flex-basis: 100%; }
  .campo { max-width: none; }
  .pestanas { width: 100%; justify-content: space-around; }
  .resumen { grid-template-columns: 1fr 1fr; }
  .dato:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--linea); }
  .lugares { grid-template-columns: minmax(0, 1fr); }
  .controles { top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .mapa .halo.visible { opacity: .45; }
}
