/* Capa en vivo sobre el tablero. La paleta viene de :root en index.html */
html { color-scheme: dark; scroll-padding-top: 84px; }
html, body { height: auto; }
.hrs { scrollbar-color: var(--border-light) transparent; scrollbar-width: thin; }
body { overflow-x: hidden; overflow-y: auto; display: block; }
header { position: sticky; top: 0; z-index: 40; }
@media (max-width: 800px) { header { position: static; } html { scroll-padding-top: 0; } }
#mapContainer { height: 560px; }
#feedContainer { height: 760px; overflow: hidden; }
@media (max-width: 1200px) { #feedContainer { height: auto; overflow: visible; } #feedContainer section { height: 520px; } }
.num, .bal-n, .rc-pct, .rc-v, .pr-t td { font-variant-numeric: tabular-nums; }

/* Balanza */
.bal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
@media (max-width: 900px) { .bal { grid-template-columns: 1fr; padding: 10px 16px; } }
.bal-c { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.bal-h { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .4px; color: var(--txt-dim); }
.bal-h span:last-child { font-weight: 500; text-align: right; }
.bal-r { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 6px; }
.bal-n { font-size: 30px; font-weight: 800; line-height: 1.1; }
.bal-d { color: var(--dem-light); } .bal-g { color: var(--gop-light); }
.bal-m { font-size: 11px; color: var(--txt-dim); text-align: center; }
.bal-b { position: relative; display: flex; height: 16px; background: #1e293b; border-radius: 4px; overflow: hidden; }
.bal-b i { display: block; height: 100%; transition: width .5s; }
.i-d { background: var(--dem); } .i-dl { background: #1e40af99; } .i-r { background: var(--gop); } .i-rl { background: #99181899; } .i-o { background: #a855f7; }
.bal-l { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; }
.bal-f { margin-top: 6px; font-size: 11px; color: var(--txt-dim); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.bal-win { color: #fff; font-weight: 800; }

/* Barra de última hora */
.tick { display: flex; align-items: center; gap: 12px; padding: 7px 16px; background: #0a101d; border-bottom: 1px solid var(--border); min-height: 36px; }
.tick-t { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fresh { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; flex-shrink: 0; max-width: 58%; }
.fr { font-size: 10.5px; padding: 1px 6px; border-radius: 3px; background: #0f2a22; color: #6ee7b7; white-space: nowrap; }
.fr.warn { background: #3b2a08; color: #fcd34d; } .fr.bad { background: #3f1212; color: #fca5a5; }
@media (max-width: 800px) { .tick { flex-direction: column; align-items: stretch; gap: 4px; } .fresh { max-width: none; justify-content: flex-start; } .tick-t { white-space: normal; } }

/* Noche electoral */
.noche { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); gap: 0; border-bottom: 1px solid var(--border); }
@media (max-width: 1000px) { .noche { grid-template-columns: 1fr; } }
.res { padding: 12px 16px; min-width: 0; }
.dd-t { font-size: 13px; font-weight: 800; letter-spacing: .4px; margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.dd-t small { font-weight: 500; font-size: 11px; color: var(--txt-dim); letter-spacing: 0; }
.hrs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.hr { flex: 0 0 auto; min-width: 104px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; color: var(--txt); cursor: pointer; text-align: left; font: inherit; }
.hr:hover { border-color: var(--border-light); }
.hr.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.hr b { display: block; font-size: 14px; }
.hr span { display: block; font-size: 10.5px; color: var(--txt-dim); }
.hr em { display: block; font-style: normal; font-size: 10.5px; font-weight: 700; margin-top: 2px; color: var(--tossup-light); }
.hr.cl em { color: #6ee7b7; }
.res-sum { font-size: 12px; color: var(--txt-dim); margin: 6px 0 8px; }
.res-sum b { color: var(--txt); }
.res-f { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.res-f button { background: var(--panel); border: 1px solid var(--border); color: var(--txt-dim); border-radius: 4px; padding: 3px 8px; font: inherit; font-size: 11.5px; cursor: pointer; }
.res-f button.on { color: #fff; border-color: var(--accent); background: #0c2a3e; }
.rcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 8px; align-content: start; }
.rc { background: var(--card); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; min-width: 0; }
.rc.flash { animation: fl 1.6s ease-out; }
@keyframes fl { 0% { border-color: #fde047; box-shadow: 0 0 0 2px #fde04766; } 100% { border-color: var(--border); box-shadow: none; } }
.rc-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.rc-h b { font-size: 13px; }
.st { font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.st-open { background: #1e293b; color: #94a3b8; } .st-wait { background: #3b2a08; color: #fcd34d; } .st-count { background: #0c2a3e; color: #7dd3fc; }
.st-d { background: var(--dem); color: #fff; } .st-r { background: var(--gop); color: #fff; } .st-o { background: #7e22ce; color: #fff; }
.rc-c { margin-top: 5px; }
.rc-n { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.rc-n span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-pct { font-weight: 800; }
.rc-v { color: var(--txt-dim); font-size: 10.5px; }
.rc-b { height: 6px; background: #0b1324; border-radius: 3px; overflow: hidden; margin-top: 2px; }
.rc-b i { display: block; height: 100%; transition: width .5s; }
.pD { background: var(--dem-lean); } .pR { background: var(--gop-lean); } .pI { background: #a855f7; }
.rc-f { margin-top: 6px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: 10.5px; color: var(--txt-dim); }
.rc-f a { color: var(--accent); text-decoration: none; }
.vacio { color: var(--txt-dim); font-size: 12.5px; padding: 18px 8px; }
.flip { color: #fde047; font-weight: 800; }

/* Al minuto */
.min { border-left: 1px solid var(--border); background: var(--surface); padding: 12px 12px 8px; display: flex; flex-direction: column; min-width: 0; max-height: 780px; }
@media (max-width: 1000px) { .min { border-left: 0; border-top: 1px solid var(--border); max-height: 560px; } }
.min-l { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.mi { background: var(--panel); border: 1px solid var(--border); border-left-width: 3px; border-radius: 5px; padding: 6px 8px; font-size: 12px; overflow-wrap: anywhere; }
.mi.new { animation: fl 2s ease-out; }
.mi-h { display: flex; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--txt-dim); margin-bottom: 2px; }
.mi-h b { color: var(--txt); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi a { color: var(--accent); text-decoration: none; font-size: 10.5px; }
.t-CALL { border-left-color: #fde047; } .t-CIERRE { border-left-color: #10b981; } .t-LIDER { border-left-color: #f97316; } .t-CONTEO, .t-VOTOS { border-left-color: var(--accent); }
.t-X { border-left-color: #e2e8f0; } .t-TS { border-left-color: #a855f7; }

/* Pronósticos */
.pron { padding: 12px 16px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.ctl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (max-width: 800px) { .ctl { grid-template-columns: 1fr; } }
.ctl-c { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.ctl-c h4 { margin: 0 0 6px; font-size: 12px; }
.ctl-r { display: grid; grid-template-columns: minmax(118px, 1.4fr) minmax(70px, 3fr) 92px; align-items: center; gap: 8px; font-size: 11.5px; padding: 2px 0; }
.ctl-r a { color: var(--txt-dim); text-decoration: none; }
.ctl-b { height: 10px; background: var(--gop-lean); border-radius: 3px; overflow: hidden; }
.ctl-b i { display: block; height: 100%; background: var(--dem-lean); }
.ctl-v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.sep { margin-top: 6px; padding-top: 4px; border-top: 1px dashed var(--border); font-size: 10.5px; color: var(--txt-mut); font-weight: 700; letter-spacing: .4px; }
.pr-w { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; max-height: 620px; overflow-y: auto; }
.pr-t { border-collapse: collapse; width: 100%; font-size: 11.5px; min-width: 980px; }
.pr-t th { position: sticky; top: 0; background: #0e172a; color: var(--txt-dim); font-weight: 700; text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.pr-t td { padding: 5px 8px; border-bottom: 1px solid #16223b; white-space: nowrap; }
.pr-t td.wrap { white-space: normal; min-width: 150px; }
.cD { color: var(--dem-light); font-weight: 700; } .cR { color: var(--gop-light); font-weight: 700; } .cT { color: var(--tossup-light); font-weight: 700; } .cN { color: var(--txt-mut); }
.pr-n { font-size: 10.5px; color: var(--txt-mut); margin-top: 6px; }
.pr-n a { color: var(--accent); }

/* Mapa */
.state-path.fx-sd { fill: #1d4ed8; } .state-path.fx-ld { fill: #3b82f6; } .state-path.fx-nd { fill: #7dabf8; }
.state-path.fx-t { fill: #f59e0b; }
.state-path.fx-nr { fill: #f28b8b; } .state-path.fx-lr { fill: #ef4444; } .state-path.fx-sr { fill: #b91c1c; }
.state-path.fx-win-d { fill: #1d4ed8; stroke: #fff; stroke-width: 1.4; } .state-path.fx-win-r { fill: #b91c1c; stroke: #fff; stroke-width: 1.4; } .state-path.fx-win-o { fill: #7e22ce; stroke: #fff; stroke-width: 1.4; }
.state-path.fx-lead-d { fill: url(#hD); } .state-path.fx-lead-r { fill: url(#hR); }
.state-path.fx-wait { fill: #475569; }
.state-path.fx-closed { fill: #10b981; }
.close-25 { fill: #8b5cf6; }
.sc { margin-top: 8px; font-size: 11px; }
.sc table { width: 100%; border-collapse: collapse; }
.sc td, .sc th { padding: 2px 4px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
.sc td:first-child, .sc th:first-child { text-align: left; }
.sb-c { font-size: 12px; margin: 2px 0; display: flex; justify-content: space-between; gap: 6px; }
.prueba { background: #facc15; color: #000; font-weight: 900; text-align: center; padding: 6px; position: sticky; top: 0; z-index: 60; }

/* Ronda 1 de críticos: legibilidad */
.fr, .st, .hr span, .hr em, .rc-v, .rc-f, .mi-h, .mi a, .pr-n, .sep { font-size: 12px; }
.bal-f, .bal-m, .res-sum { font-size: 12.5px; }
.pr-t { font-size: 13px; }
.rc-n { font-size: 13px; }
.rc-pct { font-size: 14px; }
.mi { font-size: 13px; }
.rcs { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.hrs, .min-l, .pr-w { scrollbar-color: #334155 #0c1220; scrollbar-width: thin; }
.bal-b { background: #334155; box-shadow: inset 0 0 0 1px #475569; }
.cN { color: #8b9bb4; }
.pr-t td:last-child { color: var(--txt); font-weight: 700; }
.pr-t td:first-child, .pr-t th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.pr-t th:first-child { background: #0e172a; z-index: 3; }
.ctl-b { position: relative; }
.ctl-b::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: #fff; }
.ctl-r { grid-template-columns: minmax(118px, 1.2fr) minmax(70px, 3fr) 118px; }
.t-CALL { background: #2a2406; border-left-width: 5px; }
.t-CIERRE { background: #062a1d; border-left-width: 5px; }
.state-path { stroke: #3b4a63; stroke-width: 0.8; }
.state-path.fill-no-race { fill: #243247; }
.state-path.fx-nd { fill: #93c5fd; }
.state-label { font-size: 13px; font-weight: 800; paint-order: stroke; }
.state-label.oscuro { fill: #0b1324; }
.view-mode-tabs .tab-btn { font-size: 13px; }
.countdown-badge b, .countdown-badge span { font-size: 13.5px; }

/* Auditoría: sin mayoría y datos viejos */
.state-path.fx-nomaj { fill: #c4b5fd; }
.st-nm { background: #4c1d95; color: #fff; }
.aviso-viejo { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 9999; padding: 8px 16px; background: #b91c1c; color: #fff; font-weight: 700; font-size: 14px; text-align: center; }
.f-sel { background: #131c2d; border: 1px solid var(--border); color: var(--txt-dim); border-radius: 4px; padding: 2px 4px; font-size: 10.5px; max-width: 100%; cursor: pointer; }
.f-sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
