/* =====================================================================
   PANEL DE RESULTADOS. Una pregunta arriba (¿cómo va?), luego el detalle.
   Barras de rivales en gris azulado, la nuestra en tinta sobre fila
   resaltada en amarillo. Verde/rojo solo para gana/pierde, siempre con ▲▼.
   ===================================================================== */
:root { --bien: #0b6b3d; --mal: #b3261e; --barra: #9aa3b8; --pista: #e6e9f0; }

.panel h2 { font-size: 1.3rem; }
.p-cabecera { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .8rem 1rem; margin: .5rem 0 1rem; }
.p-sobretitulo { margin: 0; font-size: .95rem; color: var(--texto-2); }
.p-titulo { font-size: clamp(2rem, 4.4vw, 2.9rem); margin: 0; line-height: 1.02; font-stretch: 80%; }
.p-controles { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.p-vivo { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--texto-2); font-weight: 600; margin-right: .3rem; font-variant-numeric: tabular-nums; }
.p-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--bien); box-shadow: 0 0 0 0 rgba(11,107,61,.45); animation: latido 2.4s infinite; }
@keyframes latido { 70% { box-shadow: 0 0 0 8px rgba(11,107,61,0); } 100% { box-shadow: 0 0 0 0 rgba(11,107,61,0); } }
@media (prefers-reduced-motion: reduce) { .p-punto { animation: none; } }

/* ----- Héroe: la respuesta en una frase ----- */
.p-heroe { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 1rem 1.2rem; padding: 1.2rem 1.2rem 1.3rem; background: var(--papel); border: 1px solid var(--linea); border-top: 8px solid var(--barra); border-radius: var(--radio); margin-bottom: 1rem; }
.p-heroe.heroe-gana { border-top-color: var(--bien); }
.p-heroe.heroe-pierde { border-top-color: var(--mal); }
.p-heroe > .p-heroe-txt:only-child { grid-column: 1 / -1; }
.p-foto { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: top; border: 4px solid var(--amarillo); background: #fff; flex: none; align-self: start; }
.p-heroe-txt { min-width: 0; }
.p-heroe-etq { margin: 0; font-size: 1rem; font-weight: 600; color: var(--texto-2); }
.p-heroe h2 { font-size: clamp(2.3rem, 8vw, 4.4rem); font-stretch: 75%; margin: .1rem 0 .45rem; line-height: .98; letter-spacing: .005em; color: var(--tinta); }
.p-marca { background: linear-gradient(transparent 56%, var(--resaltador) 56%, var(--resaltador) 94%, transparent 94%); -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .08em; }
.heroe-pierde .p-marca { background: linear-gradient(transparent 56%, #ffd3cd 56%, #ffd3cd 94%, transparent 94%); }
.p-icono { font-size: .62em; vertical-align: .18em; margin-right: -.1em; }
.heroe-gana .p-icono { color: var(--bien); }
.heroe-pierde .p-icono { color: var(--mal); }
.p-heroe-sub { margin: 0; color: var(--texto-2); font-size: 1.05rem; max-width: 52ch; }
.p-heroe-sub strong { color: var(--texto); }
.p-heroe-cifras { grid-column: 1 / -1; display: flex; gap: 0; border-top: 1px solid var(--linea-suave); padding-top: .9rem; }
.p-cifra { display: flex; flex-direction: column; flex: 1; }
.p-cifra + .p-cifra { border-left: 1px solid var(--linea-suave); padding-left: 1rem; }
.p-cifra-v { font-family: var(--display); font-stretch: 75%; font-size: clamp(2.6rem, 9vw, 4.6rem); font-weight: 700; line-height: .95; font-variant-numeric: tabular-nums; color: var(--tinta); }
.p-cifra-e { color: var(--texto-2); font-size: .9rem; margin-top: .3rem; }
@media (min-width: 860px) {
  .p-heroe { grid-template-columns: auto 1fr auto; padding: 1.5rem 1.6rem; gap: 1.6rem; }
  .p-foto { width: 112px; height: 112px; align-self: center; }
  .p-heroe-cifras { grid-column: auto; border-top: 0; padding-top: 0; gap: 0; }
  .p-cifra { flex: none; padding: 0 0 0 1.5rem; border-left: 1px solid var(--linea-suave); }
  .p-cifra + .p-cifra { padding-left: 1.5rem; }
}

/* ----- Tira de avance: una sola hoja dividida ----- */
.p-avance { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--linea); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; margin-bottom: 1rem; }
@media (min-width: 760px) { .p-avance { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
.p-dato { background: var(--papel); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .1rem; color: var(--texto); text-decoration: none; }
.p-dato-v { font-family: var(--display); font-stretch: 80%; font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; color: var(--tinta); }
.p-dato-v small { font-size: 1.1rem; color: var(--texto-3); font-weight: 600; }
.p-dato-e { font-size: .86rem; color: var(--texto-2); }
.p-dato-link { position: relative; }
.p-dato-link .p-dato-e { text-decoration: underline; text-underline-offset: .2em; }
.p-dato-link:hover { background: #f5f7fb; }
.p-dato-atencion { background: var(--ambar-fondo); box-shadow: inset 0 4px 0 #d19a00; }
.p-dato-atencion:hover { background: #ffeab0; }
.p-dato-atencion .p-dato-v { color: var(--ambar); }
.p-mini-barra { display: block; height: 6px; background: var(--pista); overflow: hidden; margin-top: .45rem; }
.p-mini-barra span { display: block; height: 100%; width: 0; background: var(--tinta); transition: width .6s ease-out; }
@media (max-width: 759px) { .p-avance > .p-dato:last-child:nth-child(odd) { grid-column: 1 / -1; } }

.p-rejilla { display: grid; gap: 1rem; }
@media (min-width: 1040px) { .p-rejilla { grid-template-columns: 1.35fr 1fr; align-items: start; } }
.p-rejilla > .tarjeta { margin-bottom: 0; }
.p-ayuda { color: var(--texto-3); font-size: .86rem; margin: -.4rem 0 .9rem; }

/* ----- Barras de candidatos ----- */
.cands { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cand { display: grid; grid-template-columns: 1.8rem 1fr auto; grid-template-areas: "p n v" "p b b"; gap: .35rem .75rem; align-items: center; padding: .7rem .5rem; border-bottom: 1px solid var(--linea-suave); }
.cand:last-child { border-bottom: 0; }
.cand-puesto { grid-area: p; font-family: var(--display); font-size: 1.35rem; font-weight: 700; color: var(--texto-3); text-align: center; font-variant-numeric: tabular-nums; align-self: start; }
.cand-nombre { grid-area: n; display: flex; flex-direction: column; font-weight: 700; line-height: 1.2; min-width: 0; }
.cand-nombre small { font-weight: 400; font-size: .82rem; }
.cand-pista { grid-area: b; height: 16px; background: var(--pista); overflow: hidden; }
.cand-relleno { display: block; height: 100%; width: 0; background: var(--barra); transition: width .7s cubic-bezier(.2,.7,.2,1); }
.cand-valor { grid-area: v; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cand-valor strong { font-family: var(--display); font-size: 1.4rem; color: var(--tinta); }
.cand-valor small { font-size: .82rem; }
.cand-nuestra { background: var(--resaltador); border-bottom-color: transparent; border-radius: 3px; }
.cand-nuestra .cand-pista { background: rgba(255,255,255,.7); }
.cand-nuestra .cand-relleno { background: var(--tinta); }
.cand-nuestra .cand-puesto { color: var(--tinta); }
.cand-nuestra .cand-nombre { color: var(--tinta); }
.cand-nuestra .cand-nombre small { color: #4a4320; }
.cand-nuestra .cand-nombre::before { content: "★ Nuestra candidata"; font-size: .78rem; font-weight: 700; }
@media (min-width: 760px) {
  .cand { grid-template-columns: 1.8rem minmax(170px, 250px) 1fr 88px; grid-template-areas: "p n b v"; }
  .cand-puesto { align-self: center; }
}

/* ----- Fuertes / débiles ----- */
.p-fd { display: grid; gap: 1.2rem; }
@media (min-width: 640px) and (max-width: 1039px) { .p-fd { grid-template-columns: 1fr 1fr; } .p-fd-nota { grid-column: 1 / -1; } }
.p-fd h2 { margin-bottom: .4rem; font-size: 1.15rem; }
.ico-bien, .txt-bien { color: var(--bien); }
.ico-mal, .txt-mal { color: var(--mal); }
.lista-fd { list-style: none; margin: 0; padding: 0; }
.lista-fd li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--linea-suave); }
.lista-fd li span { display: flex; flex-direction: column; font-weight: 600; font-size: .92rem; line-height: 1.25; min-width: 0; }
.lista-fd li small { font-weight: 400; font-size: .8rem; }
.lista-fd strong { white-space: nowrap; font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 1.1rem; }
.p-fd-nota { margin: 0; }

/* ----- Por parroquia ----- */
.p-seccion { margin: 1.6rem 0 1rem; }
.p-seccion > h2 { margin-bottom: .7rem; }
.parroquias { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.parroquia { background: var(--papel); border: 1px solid var(--linea); border-left: 6px solid var(--linea); border-radius: var(--radio); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.parroquia header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.parroquia h3 { margin: 0; font-size: 1.15rem; }
.parroquia-tipo { font-size: .8rem; color: var(--texto-3); }
.parroquia-estado { margin: 0; font-weight: 800; font-size: .98rem; }
.parroquia-gana { border-left-color: var(--bien); }
.parroquia-gana .parroquia-estado { color: var(--bien); }
.parroquia-pierde { border-left-color: var(--mal); }
.parroquia-pierde .parroquia-estado { color: var(--mal); }
.parroquia-vacia { background: #f3f5f9; }
.parroquia-vacia .parroquia-estado { color: var(--texto-3); font-weight: 600; }
.duelo { display: flex; flex-direction: column; gap: .35rem; }
.duelo-fila { display: grid; grid-template-columns: 78px 1fr 56px; align-items: center; gap: .5rem; font-size: .88rem; }
.duelo-fila > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duelo-fila strong { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--display); font-size: 1rem; }
.duelo-pista { height: 10px; background: var(--pista); overflow: hidden; }
.duelo-pista span { display: block; height: 100%; width: 0; background: var(--barra); transition: width .7s ease-out; }
.duelo-nuestra .duelo-pista span { background: var(--tinta); }
.duelo-nuestra { font-weight: 700; color: var(--tinta); }
.duelo-nuestra > span:first-child { background: var(--resaltador); padding: 0 .25rem; justify-self: start; max-width: 100%; }
.parroquia-pie { margin: 0; font-size: .82rem; color: var(--texto-3); }

/* ----- Detalles plegables ----- */
.p-detalle summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .6rem; min-height: 44px; }
.p-detalle summary::-webkit-details-marker { display: none; }
.p-detalle summary::before { content: ""; width: .55rem; height: .55rem; border: solid var(--tinta); border-width: 0 2.5px 2.5px 0; transform: rotate(-45deg); transition: transform .15s; flex: none; }
.p-detalle[open] summary::before { transform: rotate(45deg); }
.p-detalle summary h2 { margin: 0; font-size: 1.15rem; }
.p-detalle[open] summary { margin-bottom: .8rem; }
.p-legal { text-align: center; color: var(--texto-3); font-size: .85rem; margin: 1.6rem auto 0; max-width: 60ch; }

/* ----- Modo TV: se lee desde el fondo de la sala ----- */
body.modo-tv { background: var(--tinta-osc); }
body.modo-tv > .barra, body.modo-tv > .pie { display: none; }
.modo-tv .contenedor.ancho { max-width: none; padding: 1.4rem 2.2rem; }
.modo-tv .p-titulo, .modo-tv .p-seccion > h2 { color: #fff; }
.modo-tv .p-sobretitulo, .modo-tv .p-vivo, .modo-tv .p-legal { color: #c3cce4; }
.modo-tv .p-controles .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.modo-tv .p-heroe { border: 0; border-top: 12px solid var(--barra); }
.modo-tv .p-heroe.heroe-gana { border-top-color: #22a463; }
.modo-tv .p-heroe.heroe-pierde { border-top-color: #e2483c; }
.modo-tv .p-heroe h2 { font-size: clamp(3rem, 7vw, 6rem); }
.modo-tv .p-heroe-sub { font-size: 1.4rem; }
.modo-tv .p-cifra-v { font-size: clamp(3.4rem, 8vw, 6.4rem); }
.modo-tv .p-foto { width: 150px; height: 150px; border-width: 6px; }
.modo-tv .p-avance { border: 0; }
.modo-tv .p-dato-v { font-size: 2.8rem; }
.modo-tv .p-dato-e { font-size: 1.05rem; }
.modo-tv .tarjeta, .modo-tv .parroquia { border: 0; }
.modo-tv .cand { padding: .9rem .6rem; }
.modo-tv .cand-nombre { font-size: 1.3rem; }
.modo-tv .cand-valor strong { font-size: 2rem; }
.modo-tv .cand-pista { height: 26px; }
.modo-tv .parroquia h3 { font-size: 1.35rem; }
.modo-tv .duelo-fila { font-size: 1.05rem; grid-template-columns: 100px 1fr 70px; }
.modo-tv .duelo-pista { height: 14px; }
