:root {
  --page: #f3f4f2;
  --panel: #fbfbf9;
  --ink: #14181a;
  --ink-2: #4b5357;
  --muted: #737b80;
  --rule: #dde0dc;
  --rule-strong: #b9beba;
  --focus: #14181a;
  --control: #14181a;
  --control-ink: #fbfbf9;
  --datadaf-blue: #316bea;

  /* familias del mapa: 1 = inclinada ... 4 = casi segura / decidida */
  /* f0 Somos Perú (azul) · f1 APP (rojo) · f2 Avanza País (ámbar) · f3 Renovación Popular (celeste) · f4 otros */
  --f0-1: #d3d7f7; --f0-2: #9aa3ec; --f0-3: #3d4fd1; --f0-4: #28338f;
  --f1-1: #f8cfcf; --f1-2: #f09a99; --f1-3: #e34948; --f1-4: #bf2e33;
  --f2-1: #fbe4b0; --f2-2: #f5c966; --f2-3: #eda100; --f2-4: #b58400;
  --f3-1: #c4ebf8; --f3-2: #7dd3f0; --f3-3: #1fb3e0; --f3-4: #0f86b3;
  --f4-1: #dcdfe1; --f4-2: #b0b5b9; --f4-3: #737a80; --f4-4: #454b50;
  /* candidatos no destacados, en orden fijo; naranja reservado para Fuerza Popular */
  --x0: #1baf7a; --x1: #e87ba4; --x2: #008300; --x3: #4a3aa7; --xr: #9aa0a5; --fp: #eb6834;
  /* avance del conteo por departamento */
  --g0: #eceeeb; --g1: #d5d9d5; --g2: #b3bab5; --g3: #8b938e; --g4: #5f6762;
  --toss: #f7f7f4;
  --loc-empty: #c9cec9;
  --deepen: #000;
  --loc-base: #fbfbf9;
  --off-bg: #eceeeb;
  --off-line: #c6cbc7;
  --shadow: 0 6px 24px rgba(20, 24, 26, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f1214; --panel: #15191b; --ink: #eef1ef; --ink-2: #b9c0c3; --muted: #879094;
    --rule: #2a3033; --rule-strong: #434b4f; --focus: #eef1ef; --control: #eef1ef; --control-ink: #15191b;
    --f0-1: #20244f; --f0-2: #343b8f; --f0-3: #6f7cf0; --f0-4: #b2b8f6;
    --f1-1: #3d1a1f; --f1-2: #8f2f3a; --f1-3: #e8606b; --f1-4: #f2a3a3;
    --f2-1: #3b2e05; --f2-2: #8a6b00; --f2-3: #d9a91c; --f2-4: #f0c25a;
    --f3-1: #0c2f3c; --f3-2: #0f5f7c; --f3-3: #1fb0d6; --f3-4: #86dcf3;
    --f4-1: #2a2f32; --f4-2: #4d5459; --f4-3: #80878c; --f4-4: #b4b8bc;
    --x0: #199e70; --x1: #d55181; --x2: #2f9a2f; --x3: #9085e9; --xr: #7d8488; --fp: #d95926;
    --g0: #1b2022; --g1: #283033; --g2: #3a4447; --g3: #56605f; --g4: #7c8885;
    --toss: #1f2527; --off-bg: #1b2022; --off-line: #343c3f; --loc-empty: #4a5255; --loc-base: #15191b; --deepen: #fff;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1214; --panel: #15191b; --ink: #eef1ef; --ink-2: #b9c0c3; --muted: #879094;
  --rule: #2a3033; --rule-strong: #434b4f; --focus: #eef1ef; --control: #eef1ef; --control-ink: #15191b;
  --f0-1: #20244f; --f0-2: #343b8f; --f0-3: #6f7cf0; --f0-4: #b2b8f6;
  --f1-1: #3d1a1f; --f1-2: #8f2f3a; --f1-3: #e8606b; --f1-4: #f2a3a3;
  --f2-1: #3b2e05; --f2-2: #8a6b00; --f2-3: #d9a91c; --f2-4: #f0c25a;
  --f3-1: #0c2f3c; --f3-2: #0f5f7c; --f3-3: #1fb0d6; --f3-4: #86dcf3;
  --f4-1: #2a2f32; --f4-2: #4d5459; --f4-3: #80878c; --f4-4: #b4b8bc;
  --x0: #199e70; --x1: #d55181; --x2: #2f9a2f; --x3: #9085e9; --xr: #7d8488; --fp: #d95926;
  --g0: #1b2022; --g1: #283033; --g2: #3a4447; --g3: #56605f; --g4: #7c8885;
  --toss: #1f2527; --off-bg: #1b2022; --off-line: #343c3f; --loc-empty: #4a5255; --loc-base: #15191b; --deepen: #fff;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
  padding-inline: 16px;
}

h1, h2, h3 { text-wrap: balance; margin: 0; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- barra superior ---------- */
.bar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  margin-inline: -16px;
  padding: 12px 16px 10px;
  background: var(--page);
  border-bottom: 1px solid var(--rule);
  display: grid;
  /* la columna no crece más que la pantalla: con la columna automática, el ancho
     natural de pestañas y selectores ensanchaba la página en el celular */
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.bar-row { display: flex; align-items: center; gap: 16px; max-width: 1320px; width: 100%; margin-inline: auto; }
.bar-top { justify-content: space-between; flex-wrap: wrap; row-gap: 8px; }
.brand h1 {
  font-stretch: 72%;
  font-weight: 750;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
/* nota del modo bajo la ubicación: qué se elige y cómo se gana */
.kicker { margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.pickers { display: flex; gap: 10px; flex-wrap: wrap; }
.picker { display: grid; }
.picker select {
  min-width: 11rem;
  max-width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--panel);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.bar-time { gap: 14px; }
.play {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--control);
  color: var(--control-ink);
  display: grid; place-items: center;
  cursor: pointer;
}
.play svg { width: 14px; height: 14px; fill: currentColor; }
.play .icon-pause, .play[aria-pressed="true"] .icon-play { display: none; }
.play[aria-pressed="true"] .icon-pause { display: inline; }

.time-track { flex: 1; min-width: 0; position: relative; padding-bottom: 14px; }
#time {
  --time-progress: 0%;
  width: 100%;
  height: 18px;
  appearance: none;
  background: transparent;
  accent-color: var(--datadaf-blue);
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}
#time::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--control) 0%, var(--datadaf-blue) var(--time-progress), var(--rule-strong) var(--time-progress) 100%);
}
#time::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--control) calc(100% - var(--time-progress)), var(--datadaf-blue) var(--time-progress));
}
#time::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--control) 0%, var(--datadaf-blue) var(--time-progress), var(--rule-strong) var(--time-progress) 100%);
}
#time::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--control) calc(100% - var(--time-progress)), var(--datadaf-blue) var(--time-progress));
}
/* en vivo: la barra es el 100% de las mesas; el control llega hasta el último corte
   (--reach) y el resto queda como pendiente (needle_map_time.js) */
.time-track.capped #time { width: max(20px, var(--reach)); }
.time-track.capped::before {
  content: "";
  position: absolute;
  top: 4px; left: var(--reach); right: 0;
  height: 10px;
  border-radius: 999px;
  background: repeating-linear-gradient(135deg, var(--rule-strong) 0 1px, transparent 1px 6px);
  box-shadow: inset 0 0 0 1px var(--rule-strong);
  pointer-events: none;
}
/* antes de la primera acta no hay nada que recorrer */
.time-empty #time { visibility: hidden; }
.time-empty .play { opacity: 0.35; pointer-events: none; }
.ticks { position: absolute; inset: auto 0 0 0; height: 12px; font-size: 10px; color: var(--muted); }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.time-readout { display: grid; text-align: right; min-width: 10.5rem; }
.time-readout strong { font-stretch: 80%; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.time-readout span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- disposición ---------- */
.layout {
  max-width: 1320px;
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
/* columna única que no crece más que el espacio disponible (ver .bar) */
.map-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }

.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.crumbs button {
  border: 0; background: none; padding: 2px 0; cursor: pointer; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-strong);
}
.crumbs button:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted); }
.crumbs .here { font-weight: 650; }

.summary { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); }
.summary .item { display: inline-flex; align-items: center; gap: 6px; }
.summary b { color: var(--ink); font-variant-numeric: tabular-nums; }

.map-wrap { position: relative; }
.map-svg { width: 100%; height: auto; display: block; max-height: 78vh; }
.map-svg path { vector-effect: non-scaling-stroke; }
/* zoom propio del mapa (needle_map_zoom.js) */
.map-zoom-reset {
  position: absolute; top: 8px; right: 8px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink);
  background: var(--panel); border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 4px 10px; cursor: pointer; box-shadow: var(--shadow);
}
.map-zoom-reset:hover { border-color: var(--ink-2); }
.map-zoom-reset:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.map-zoom-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  pointer-events: none; opacity: 0; transition: opacity 0.2s;
  background: var(--control); color: var(--control-ink); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; white-space: nowrap;
}
.map-zoom-hint.show { opacity: 0.92; }
.hatch-bg { fill: var(--off-bg); }
.hatch-line { stroke: var(--off-line); stroke-width: 2.2; }
.dept-shape { stroke: var(--panel); stroke-width: 1; cursor: pointer; transition: fill 0.25s; }
.dept-shape:hover { filter: brightness(0.94); }
.dept-shape.context { fill: var(--g0); }
.dept-shape.current { pointer-events: none; fill: none; }
.prov-shape { stroke: var(--panel); stroke-width: 0.8; cursor: pointer; transition: fill 0.25s; }
/* borde de la forma bajo el cursor, en una capa encima de las vecinas (hoverOutline) */
.hover-outline { fill: none; stroke: var(--ink); stroke-width: 1.4; pointer-events: none; }
.prov-shape.selected { stroke: var(--ink); stroke-width: 2.4; }
.dept-outline { fill: none; stroke: var(--rule-strong); stroke-width: 1; pointer-events: none; }
.dept-outline.current { stroke: var(--ink-2); stroke-width: 1.6; }
.loc-districts path { fill: none; stroke: var(--rule-strong); vector-effect: non-scaling-stroke; pointer-events: none; }
.loc-dot { stroke: var(--panel); stroke-width: 0; fill-opacity: 0.88; cursor: default; }
.loc-dot.empty { fill-opacity: 0.7; }
.loc-ring { fill: none; pointer-events: none; }
.prov-shape.with-locales { fill: var(--loc-base) !important; }
.logo { display: inline-block; flex: none; border-radius: 4px; background: #fff; object-fit: contain; vertical-align: middle; }
.who { display: inline-flex; align-items: center; gap: 6px; }
.needle-caption .who .logo { margin-right: 2px; }
.legend-grid .name { display: inline-flex; align-items: center; gap: 6px; }
.l-meta .logo { margin-right: 5px; }
.prov-mark { pointer-events: none; }
.prov-mark-bg { fill: #fff; }
.prov-label {
  fill: var(--ink); font-weight: 700; font-stretch: 85%; text-anchor: middle; dominant-baseline: middle;
  paint-order: stroke; stroke: var(--panel); stroke-linejoin: round; pointer-events: none;
}

.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  font-size: 12.5px;
  max-width: 250px;
  z-index: 5;
}
.tooltip h4 { margin: 0 0 3px; font-size: 13px; font-stretch: 85%; }
.tooltip .row { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .muted { color: var(--muted); }

.legend { display: grid; gap: 8px; font-size: 12px; color: var(--ink-2); }
.legend-grid { display: grid; grid-template-columns: auto repeat(4, minmax(34px, 1fr)); gap: 3px 4px; align-items: center; max-width: 440px; }
.legend-grid .head { font-size: 10.5px; color: var(--muted); text-align: center; }
.legend-grid .name { padding-right: 8px; white-space: nowrap; }
.sw { display: inline-block; height: 12px; border-radius: 2px; }
.legend-grid .sw { width: 100%; }
.legend-extra { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-extra span { display: inline-flex; gap: 6px; align-items: center; }
.legend-extra .sw, .summary .sw { width: 14px; }
.sw.toss { background: var(--toss); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.sw.off { background: repeating-linear-gradient(45deg, var(--off-bg) 0 3px, var(--off-line) 3px 5px); }
.ramp { display: flex; gap: 2px; max-width: 320px; }
.ramp .sw { flex: 1; }
.ramp-labels { display: flex; justify-content: space-between; max-width: 320px; font-size: 10.5px; color: var(--muted); }

/* ---------- panel ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 18px 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 128px);
  max-height: calc(100vh - 146px);
  overflow-y: auto;
}
.panel h2 { font-stretch: 75%; font-size: 26px; font-weight: 750; line-height: 1.05; }
.panel h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 650;
  margin-bottom: 8px;
}
.p-head { display: grid; gap: 6px; }
.p-title-line { display: flex; align-items: center; gap: 5px; }
.panel-back {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: -5px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  color: var(--ink-2);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.panel-back:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); color: var(--ink); }
.panel-back:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.p-sub { color: var(--ink-2); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: 1px 9px 1px 6px;
  font-size: 12px; font-weight: 600; color: var(--ink);
}
.chip .sw { width: 10px; height: 10px; border-radius: 50%; }
.progress { height: 6px; background: var(--g0); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; }

.needle-box { display: grid; justify-items: center; gap: 2px; width: 100%; min-width: 0; }
.needle-box > #needle { width: min(100%, 360px) !important; min-width: 0; }
.needle-box svg { display: block; width: 100%; max-width: 100%; height: auto; overflow: visible; }
.needle-caption { width: 100%; max-width: 360px; min-width: 0; text-align: center; }
.needle-caption .who { justify-content: center; flex-wrap: wrap; max-width: 100%; font-stretch: 80%; font-weight: 700; font-size: 18px; }
.needle-caption .what { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.needle-labels { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; width: min(100%, 360px); margin: 2px auto 0; }
.needle-label { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: 11px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.needle-label i { flex: none; width: 8px; height: 8px; border-radius: 2px; }
.needle-line { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.needle-hub { fill: var(--ink); }
.arc-track { fill: var(--g0); }
.arc-seg { stroke: var(--panel); stroke-width: 2; }

table.cands { width: 100%; border-collapse: collapse; font-size: 13px; }
.cands th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  font-weight: 600; padding: 0 6px 6px; border-bottom: 1px solid var(--rule);
}
.cands-scroll { max-width: 100%; overflow-x: auto; }
.cands td { padding: 6px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.cands td.r, .cands th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* la columna de nombre absorbe el ancho sobrante y trunca: la tabla nunca desborda el panel */
.cands th:first-child, .cands td:first-child { width: 100%; max-width: 0; }
.cands th:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cands .nm { display: flex; gap: 8px; align-items: center; min-width: 0; }
.cands .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* organización con su cabeza de lista debajo (tablas y tooltips) */
.nm-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nm-txt .head { color: var(--muted); font-size: 11.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* en el tooltip (ancho fijo) el nombre se parte en líneas y el número a la derecha no se comprime */
.tooltip .row .who { flex: 1 1 auto; min-width: 0; }
.tooltip .row .num { flex: none; }
.tooltip .nm-txt .head { white-space: normal; }
.cands .nm .sw { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.pbar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pbar .track { width: 64px; height: 6px; background: var(--g0); border-radius: 3px; overflow: hidden; }
.pbar .track i { display: block; height: 100%; border-radius: 3px; }
.cands .muted { color: var(--muted); font-size: 12px; }
.linkish {
  border: 0; background: none; padding: 6px 0 0; cursor: pointer; color: var(--ink-2); font-size: 12.5px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-strong);
}

.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis line, .chart .axis path { stroke: var(--rule-strong); }
.chart .grid line { stroke: var(--rule); }
.chart .lbl { font-size: 11.5px; fill: var(--ink-2); font-weight: 600; }
.chart .note { font-size: 11px; fill: var(--muted); }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--ink-2); }
.toggle input { accent-color: var(--control); }
.cursor-line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.off-zone { fill: url(#hatch-small); }
.hover-dot { stroke: var(--panel); stroke-width: 2; }

.list { display: grid; }
.list button {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  text-align: left; border: 0; border-bottom: 1px solid var(--rule); background: none; padding: 8px 2px; cursor: pointer;
}
.list button:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.list .l-name { font-weight: 650; }
.list .l-meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.squares { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; padding: 2px; }
.squares i { width: 18px; height: 18px; border-radius: 3px; display: block; }
.squares .sq-logo { width: 18px; height: 18px; border-radius: 3px; display: block; background: #fff; object-fit: contain; }
.squares i.toss { background: var(--toss); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.squares i.off { background: repeating-linear-gradient(45deg, var(--off-bg) 0 2px, var(--off-line) 2px 4px); }
.note-box { font-size: 12.5px; color: var(--ink-2); border-left: 3px solid var(--rule-strong); padding: 2px 0 2px 10px; }

.foot { max-width: 1320px; margin: 24px auto 0; padding-block: 12px 28px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 12px; }
.foot p { max-width: 90ch; margin: 0; }
.foot code { font-size: 11.5px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; overflow: visible; }
  .map-svg { max-height: 62vh; }
}
@media (max-width: 560px) {
  .bar { padding-block: 10px 8px; gap: 8px; }
  .brand h1 { font-size: 19px; }
  .pickers { width: 100%; }
  .picker { flex: 1; min-width: 0; }
  .picker select { min-width: 0; width: 100%; }
  .time-readout { min-width: 0; }
  .time-readout strong { font-size: 14px; }
  .pbar .track { width: 40px; }
  .cands .hide-sm { display: none; }
  .cands th.r { white-space: normal; vertical-align: bottom; }
  /* leyenda regional: los nombres pueden partirse para que las rampas quepan */
  .legend-grid { grid-template-columns: minmax(0, auto) repeat(4, minmax(26px, 1fr)); }
  .legend-grid .name { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.switch-link {
  align-self: end; padding: 6px 2px; font-size: 13px; color: var(--ink-2); white-space: nowrap;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-strong);
}
.switch-link:hover { color: var(--ink); }
