:root {
  --bg: #f6f5f1;
  --ok: #2b7347; --bad: #b0412b; --warn: #855c00;
  --pos-f: #2a6496; --pos-x: #a1520f; --pos-m: #6a4f9e;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a64;
  --line: #dddbd3;
  --accent: #b5452b;
  --nodata: #e4e2db;
  --nodata-line: #c9c6bc;
  --stroke: rgba(70, 45, 25, .18);
  --border-strong: #3a3a36;
  --hover: #1d1d1b;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  /* escala del mapa: blanco = poco, naranja = mucho */
  --c0: #fdfaf6; --c1: #fde8d4; --c2: #fbd1ac; --c3: #f9b47f;
  --c4: #f69553; --c5: #f0782d; --c6: #e15a0e;
  --neutro: #e6e3dc; /* sin capa */
  /* mapa de dos datos: --bXY, X = tercio del dato del mapa (naranja),
     Y = tercio del segundo dato (azul); el mismo en los dos temas */
  --b00: #e8e8e8; --b10: #ecc19c; --b20: #d98a4a;
  --b01: #aecbe0; --b11: #b3a99f; --b21: #a87a52;
  --b02: #5f9fcb; --b12: #6e8aa3; --b22: #5b4a44;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ok: #7cc79a; --bad: #f0907a; --warn: #e0b45a; --pos-f: #8ec1ec; --pos-x: #f2a65e; --pos-m: #c2aef0;
    --bg: #161614; --surface: #1f1f1c; --ink: #ecebe6; --muted: #a09f97;
    --line: #34332f; --accent: #f08a63; --nodata: #2b2a27; --nodata-line: #4d4b45;
    --stroke: rgba(0,0,0,.45); --border-strong: #d8d6ce; --hover: #111110;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
    --c0: #ece8e2; --c1: #f0d6bf; --c2: #f2bf98; --c3: #f4a56f;
    --c4: #f48a48; --c5: #f06f26; --c6: #e8580c;
    --neutro: #3b3a36;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ok: #7cc79a; --bad: #f0907a; --warn: #e0b45a; --pos-f: #8ec1ec; --pos-x: #f2a65e; --pos-m: #c2aef0;
  --bg: #161614; --surface: #1f1f1c; --ink: #ecebe6; --muted: #a09f97;
  --line: #34332f; --accent: #f08a63; --nodata: #2b2a27; --nodata-line: #4d4b45;
  --stroke: rgba(0,0,0,.45); --border-strong: #d8d6ce; --hover: #111110;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  --c0: #ece8e2; --c1: #f0d6bf; --c2: #f2bf98; --c3: #f4a56f;
  --c4: #f48a48; --c5: #f06f26; --c6: #e8580c;
  --neutro: #3b3a36;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  /* margen lateral único de la página; respeta las barras del sistema en móvil */
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* el enlace de salto solo se ve al llegar con el teclado */
.saltar { position: absolute; left: 8px; top: -60px; z-index: 30; background: var(--ink); color: var(--bg); border: 0; border-radius: 8px; padding: 8px 12px; }
.saltar:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--c6); outline-offset: 2px; }
.tabla-t tr:focus-visible { outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
button { font: inherit; color: inherit; cursor: pointer; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.search input {
  width: 280px; max-width: 100%; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}

.layout {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px;
  padding-block: 16px; min-height: 0;
}
@media (min-width: 901px) {
  html, body { height: 100%; }
  body { min-height: 640px; }
}
.map-wrap {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; min-height: 0;
}
#mapa { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.panel { overflow-y: auto; }
#mapa:active { cursor: grabbing; }

.map-toolbar {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 2;
  display: flex; justify-content: space-between; gap: 8px; pointer-events: none;
}
.map-toolbar > * { pointer-events: auto; }
.seg, .zoom-btns {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: var(--shadow); overflow: hidden;
}
.seg button, .zoom-btns button {
  border: 0; background: none; padding: 6px 12px; font-size: 13px;
}
.zoom-btns button { width: 34px; padding: 6px 0; font-size: 16px; }
.zoom-btns #vista-3d { width: auto; padding: 6px 10px; font-size: 13px; font-weight: 600; }
.zoom-btns #vista-3d.on { background: var(--ink); color: var(--bg); }
.zoom-btns #btn-est, .zoom-btns #btn-yo { width: auto; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.zoom-btns #btn-est.on { background: var(--ink); color: var(--bg); }
/* estaciones: tonos fríos, que no se confunden con la escala blanco-naranja */
:root { --t-avld: #5b2a86; --t-cer: #1565c0; --t-metro: #0b7285; --t-tram: #4f7d14; }
.vias path { fill: none; stroke-linejoin: round; stroke-linecap: round; opacity: .85; vector-effect: non-scaling-stroke; pointer-events: none; }
.est-capas { display: flex; flex-wrap: wrap; max-width: 260px; gap: 0 12px; padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.estaciones circle { stroke: #fff; stroke-width: .8px; vector-effect: non-scaling-stroke; cursor: default; }
.est-legend {
  position: absolute; left: 12px; top: 56px; z-index: 2; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12px;
}
.est-legend .t { color: var(--muted); margin-bottom: 4px; }
.est-plegar { display: flex; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: none; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.est-legend.plegado .t { margin-bottom: 0; }
.est-legend.plegado .est-row, .est-legend.plegado .est-capas { display: none; }
.est-row { display: flex; align-items: center; gap: 6px; cursor: pointer; line-height: 1.6; }
.est-row input { margin: 0; accent-color: var(--ink); }
.est-dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.tooltip .est-t { display: block; font-weight: 400; font-size: 12px; }
.map3d { position: absolute; inset: 0; }
.seg button + button, .zoom-btns button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg .short, .zoom-btns .short { display: none; }
@media (max-width: 520px) {
  .seg .long, .zoom-btns .long { display: none; }
  .seg .short, .zoom-btns .short { display: inline; }
  /* en el móvil se acerca con dos dedos: + y − dejan sitio a los niveles */
  .zoom-btns #zoom-in, .zoom-btns #zoom-out { display: none; }
}

.unit { stroke: var(--stroke); vector-effect: non-scaling-stroke; stroke-width: .4px; }
.unit.ccaa, .unit.prov { stroke-width: .8px; }
.unit:hover { stroke: var(--hover); stroke-width: 1.5px; }
.unit.sel { stroke: var(--hover); stroke-width: 2.2px; }
.mesh { fill: none; vector-effect: non-scaling-stroke; pointer-events: none; }
.unit.sec { stroke-width: .25px; }
.mesh.mun { stroke: var(--border-strong); stroke-opacity: .55; stroke-width: .8px; }
.aviso {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--ink); color: var(--bg); border-radius: 8px; padding: 6px 12px;
  font-size: 13px; box-shadow: var(--shadow); max-width: calc(100% - 24px); text-align: center;
}
.ind-list button.na { opacity: .45; }
.mesh.prov { stroke: var(--border-strong); stroke-opacity: .35; stroke-width: .7px; }
.mesh.ccaa { stroke: var(--border-strong); stroke-opacity: .7; stroke-width: 1.1px; }
.composition { fill: none; stroke: var(--muted); stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }

.tooltip {
  position: absolute; z-index: 3; pointer-events: none; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px;
  padding: 6px 10px; font-size: 13px; max-width: 260px;
}
.tooltip b { display: block; }
.tooltip .v { font-variant-numeric: tabular-nums; }
.tooltip .tip-anio { color: var(--muted); font-size: 12px; }

.legend {
  position: absolute; right: 12px; bottom: 12px; z-index: 2; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow);
  font-size: 12px;
}
.legend .t { color: var(--muted); margin-bottom: 4px; }
.legend .row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.legend .sw { width: 14px; height: 10px; border-radius: 2px; }
.hint {
  position: absolute; bottom: 8px; left: 12px; margin: 0; font-size: 11px; color: var(--muted);
}

.panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.block {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: 0 0 8px; font-weight: 600;
}
.ind-list { display: flex; flex-direction: column; gap: 2px; }
.ind-list button {
  text-align: left; border: 0; background: none; border-radius: 6px; padding: 6px 8px;
  display: flex; justify-content: space-between; gap: 8px;
}
.ind-list button:hover { background: var(--bg); }
.ind-list button.on { background: var(--ink); color: var(--bg); }
.ind-list .yr { opacity: .65; font-size: 12px; }
.ind-list .grp { font-size: 11.5px; color: var(--muted); margin: 8px 8px 2px; }
.ind-list .grp:first-child { margin-top: 0; }
.ind-note { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.ind-note a { color: var(--accent); }

.crumbs { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { color: var(--accent); text-decoration: none; cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.place { font-size: 22px; margin: 2px 0 10px; letter-spacing: -.01em; }

.stat { padding: 8px 0; border-top: 1px solid var(--line); }
.stat:first-child { border-top: 0; }
.stat.on .name { color: var(--accent); font-weight: 600; }
.stat .head { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.stat .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.stat .val.na { color: var(--muted); font-weight: 400; }
.stat .sub2 { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { position: relative; height: 6px; background: var(--bg); border-radius: 3px; margin-top: 5px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; }
.bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }
/* la del sitio de arriba (provincia de un municipio…): más corta y de otro color */
.bar b.padre { top: -2px; bottom: -2px; width: 3px; margin-left: -1px; background: var(--b02); opacity: 1;
  box-shadow: 0 0 0 1px var(--surface); }
.drill { margin: 10px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.drill button {
  border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 5px 10px; font-size: 13px;
}
/* «Volver al mapa», solo cuando la ficha va debajo del mapa */
.drill .volver-mapa { display: none; }
@media (max-width: 900px) { .drill .volver-mapa { display: inline-block; } }
/* el resumen de arriba de la ficha */
.resumen-lugar { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 4px 0 2px; }
.resumen-lugar p { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }
.resumen-lugar p.sub2 { margin: 0; font-size: 12px; }
.res-capa { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }

.ranking { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.ranking li {
  counter-increment: r; display: flex; gap: 8px; align-items: baseline; padding: 4px 0;
  font-size: 13.5px; cursor: pointer; border-radius: 4px;
}
.ranking li:hover { background: var(--bg); }
.ranking li::before { content: counter(r); color: var(--muted); width: 1.6em; text-align: right; font-size: 12px; }
.ranking .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.ranking .empty { color: var(--muted); cursor: default; }
.ranking .empty::before { content: ""; }

.foot { padding-block: 10px 18px; color: var(--muted); font-size: 12px; }
.foot a { color: inherit; }

@media (max-width: 900px) {
  body {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .top { padding-block: 12px; }
  .search, .search input { width: 100%; }
  .layout { grid-template-columns: 1fr; padding-block: 12px; height: auto; min-height: 0; }
  .panel { overflow: visible; }
  .map-wrap { min-height: 0; height: auto; aspect-ratio: 1 / 1.3; }
  .map-toolbar { top: 8px; left: 8px; right: 8px; }
  .seg button { padding: 5px 7px; font-size: 12px; }
  .zoom-btns button { width: 28px; font-size: 14px; }
  .hint { display: none; }
  .est-legend { top: 48px; left: 8px; padding: 5px 8px; font-size: 11px; }
  .zoom-btns #btn-est, .zoom-btns #btn-yo { padding: 5px 7px; font-size: 12px; }
  .legend {
    left: 8px; right: 8px; bottom: 8px; padding: 5px 8px; font-size: 11.5px; line-height: 1.3;
    display: flex; flex-wrap: wrap; gap: 2px 10px;
  }
  .legend .t { width: 100%; margin-bottom: 1px; }
  .legend .sw { width: 10px; height: 8px; }
  .foot { padding-block: 8px 16px; }
}

/* ---------- extras: sobre los datos, evolución, comparación, poco fiable ---------- */
.top-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-sobre {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px 12px; font-size: 13px;
}
.btn-sobre:hover { border-color: var(--accent); }
/* la pregunta principal, destacada */
.btn-sobre.btn-primario { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn-sobre.btn-primario:hover { filter: brightness(1.08); }
/* «Ayuda» y «Tema» con texto donde cabe; con poco sitio, solo el símbolo */
.btn-txt { display: none; }
@media (min-width: 1200px) { .btn-txt { display: inline; } }

.weak-t { color: var(--muted); font-style: italic; }
.rank-note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.rank-note:empty { display: none; }
.enlace {
  width: 100%; margin-top: 8px; padding: 6px 8px; font: inherit; font-size: 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink);
}

.evol { margin-top: 8px; }
.evol svg { display: block; overflow: visible; }
.evol-l { fill: none; stroke: var(--accent); stroke-width: 2; }
.evol-es { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 4 3; }
.evol-cero { stroke: var(--line); }
.evol-p { fill: var(--accent); }
.evol-t, .evol-leg { fill: var(--muted); font-size: 11px; }
.evol-v { fill: var(--ink); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.evol-x { fill: var(--muted); font-size: 10.5px; }

.cmp-head { display: flex; justify-content: space-between; align-items: baseline; }
.cmp-vaciar, .cmp-x {
  border: 0; background: none; color: var(--muted); font-size: 12px; padding: 0 2px;
}
.cmp-vaciar:hover, .cmp-x:hover { color: var(--accent); }
.cmp-scroll { overflow-x: auto; }
.cmp { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; font-variant-numeric: tabular-nums; }
.cmp th:first-child, .cmp td:first-child { width: 42%; }
.cmp-u { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.th-f { display: block; color: var(--muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
.cmp th { text-align: right; font-weight: 600; padding: 2px 3px 6px; vertical-align: bottom; overflow-wrap: anywhere; font-size: 11.5px; }
.cmp th span { display: inline; }
.cmp td { padding: 3px 3px; border-top: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
.cmp td:first-child { text-align: left; white-space: normal; color: var(--muted); }
.cmp .cmp-g td { color: var(--ink); font-weight: 600; border-top: 0; padding-top: 10px; font-size: 11.5px; }
.cmp .cmp-r { cursor: pointer; }
.cmp .cmp-r:hover td { background: var(--bg); }
.cmp .cmp-r.on td { color: var(--accent); font-weight: 600; }
.cmp td.weak { opacity: .55; font-style: italic; }

/* historias guiadas */
.historias-lista { display: flex; flex-wrap: wrap; gap: 6px; }
.historias-lista button {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; text-align: left;
}
.historias-lista button:hover { border-color: var(--accent); }
.historias-lista button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.historia {
  position: absolute; left: 12px; top: 56px; z-index: 3; width: min(340px, calc(100% - 24px));
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c6); border-radius: 8px;
  box-shadow: var(--shadow); padding: 10px 12px; font-size: 13.5px;
}
.historia p { margin: 6px 0 8px; line-height: 1.45; }
.hi-cab { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.hi-x { border: 0; background: none; font-size: 20px; line-height: 1; padding: 0 4px; }
.hi-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.hi-nav button { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 6px; padding: 4px 9px; font-size: 12.5px; }
.hi-nav button[disabled] { opacity: .4; }
.hi-sig, .hi-fin { background: var(--ink) !important; color: var(--bg) !important; border-color: var(--ink) !important; }
/* arriba a la izquierda, donde suele haber mar; el cuadro de transporte se esconde mientras tanto */
.map-wrap:has(.historia:not([hidden])) .est-legend { display: none; }
@media (max-width: 900px) {
  .historia { top: 48px; left: 8px; right: 8px; width: auto; }
}

/* tabla */
.tabla-caja { width: min(1100px, 100%); display: flex; flex-direction: column; }
.cruce-ctl input[type="search"] {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; width: 100%;
}
.tabla-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 8px; margin-top: 8px; }
.tabla-t { border-collapse: collapse; font-size: 13px; width: 100%; }
.tabla-t th, .tabla-t td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tabla-t th { position: sticky; top: 0; background: var(--surface); font-weight: 600; font-size: 12px; cursor: pointer; vertical-align: bottom; white-space: normal; min-width: 70px; }
.tabla-t th:hover { color: var(--accent); }
.tabla-t .n { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-t .tb-n { color: var(--muted); text-align: right; width: 1%; cursor: default; }
.tabla-t .tb-p { color: var(--muted); }
.tabla-t tbody tr { cursor: pointer; }
.tabla-t tbody tr:hover td { background: var(--bg); }
.tabla-t td.weak { opacity: .55; font-style: italic; }
#tabla-pie .btn-sobre { padding: 3px 8px; font-size: 12px; }

/* línea del tiempo */
.tiempo {
  position: absolute; right: 12px; top: 56px; z-index: 2; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px;
  box-shadow: var(--shadow); font-size: 13px; width: min(390px, calc(100% - 24px));
}
.tiempo button { border: 0; background: none; padding: 2px 6px; font-size: 14px; }
#t-play { width: 30px; font-size: 13px; }
#t-rango { flex: 1; min-width: 60px; accent-color: var(--c6); }
#t-anio { min-width: 52px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.t-hoy { font-size: 12px !important; color: var(--accent); white-space: nowrap; }
@media (max-width: 900px) {
  .tiempo { top: auto; bottom: 8px; right: 8px; left: 8px; width: auto; }
  .map-wrap:has(.tiempo:not([hidden])) .legend { bottom: 54px; }
  /* con la fila de etapas la barra mide unos 64 px */
  .map-wrap:has(.tiempo:not([hidden]) #t-etapas:not([hidden])) .legend { bottom: 80px; }
}

/* informe de un sitio */
.inf-marca { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
#informe-cuerpo h2 { margin: 6px 0 2px; font-size: 26px; }
.inf-sub { color: var(--muted); margin: 0 0 10px; }
.inf-acc { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.inf-leyenda { color: var(--muted); font-size: 12px; margin-top: 6px; }
.inf-tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.inf-tabla td { padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.inf-tabla td:first-child { padding-left: 0; width: 52%; }
.inf-tabla td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inf-tabla td.es { color: var(--muted); }
.inf-tabla tr.weak td.n:nth-child(2) { opacity: .55; font-style: italic; }
.inf-anio { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.inf-evol { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 18px; }
.inf-fuentes { margin-top: 16px; }
@media print {
  body { background: #fff; padding: 0; }
  body > *:not(#informe) { display: none !important; }
  .informe { position: static; background: none; padding: 0; display: block; }
  .informe .sobre-caja { box-shadow: none; max-height: none; overflow: visible; width: 100%; padding: 0; }
  .informe .sobre-cerrar, .inf-acc { display: none; }
  .inf-tabla tr, .inf-evol .evol { break-inside: avoid; }
}

/* cruzar datos */
.cruce-caja { width: min(900px, 100%); }
.cruce-ctl { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin: 10px 0 4px; }
.cruce-ctl label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); flex: 1 1 220px; min-width: 0; }
.cruce-ctl select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; width: 100%;
}
.cruce-cambiar { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; font-size: 16px; }
.cruce-ctl .seg button { padding: 7px 10px; }
.cruce-ctl .seg button[disabled] { opacity: .4; cursor: not-allowed; }
.cruce-rel { margin: 8px 0; }
.cruce-graf-wrap { position: relative; }
#cruce-graf svg { display: block; overflow: visible; }
.cr-eje text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cr-eje path, .cr-eje line { stroke: var(--line); }
.cr-t { fill: var(--muted); font-size: 11.5px; }
.cr-es { stroke: var(--muted); stroke-dasharray: 3 3; opacity: .7; }
.cr-es-t { fill: var(--muted); font-size: 10.5px; }
.cr-p { fill: var(--c5); fill-opacity: .45; stroke: var(--c6); stroke-opacity: .7; stroke-width: .6px; cursor: pointer; }
.cr-p:hover { fill-opacity: .9; stroke: var(--hover); stroke-width: 1.5px; }
.cr-p.on { fill: var(--ink); fill-opacity: .9; stroke: var(--surface); stroke-width: 1.5px; }
.cr-n { fill: var(--ink); font-size: 11px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; pointer-events: none; }
.cr-n.on { font-weight: 700; }
#cruce-tip b { display: block; }

.sobre {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
           max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.sobre-caja {
  background: var(--surface); color: var(--ink); border-radius: 12px; box-shadow: var(--shadow);
  width: min(760px, 100%); max-height: 100%; overflow-y: auto; padding: 18px 22px 24px;
  font-size: 14px;
}
.sobre-caja p, .sobre-caja li { max-width: 68ch; }
.sobre-cab { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -18px; background: var(--surface); padding-top: 4px; }
.sobre-cab h2 { margin: 0; font-size: 20px; }
.sobre-cerrar { border: 0; background: none; font-size: 24px; line-height: 1; padding: 4px 8px; }
.sobre h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 6px; }
.sobre-ind { border-top: 1px solid var(--line); padding: 8px 0; }
.sobre-h { display: flex; justify-content: space-between; gap: 12px; }
.sobre-h span { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sobre-ind p { margin: 4px 0; }
.sobre-meta { color: var(--muted); font-size: 12.5px; }
.sobre a { color: var(--accent); }
.todo-botones { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }

@media (max-width: 900px) {
  .top-r { width: 100%; }
  /* en su propia fila: con «flex: 1» y los botones al lado, en la tableta se quedaba en un cuadrado */
  .top-r .search { flex: 1 1 100%; min-width: 0; }
}
/* con el dedo, los botones de la ficha de al menos 44 px de alto */
@media (pointer: coarse) {
  .drill button { min-height: 44px; }
}
/* en el móvil el buscador va en su propia fila: con cuatro botones al lado no le quedaba sitio */
@media (max-width: 600px) {
  .top-r .search { flex: 1 1 100%; }
  /* cinco botones en una fila: un poco más justos */
  .top-r { gap: 6px; }
  .top-r .btn-sobre { padding: 7px 9px; font-size: 12.5px; }
  .top-r .btn-ayuda { min-width: 30px; padding-inline: 0; }
}

/* ---------- mapa de dos datos ---------- */
.bi-ctl { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.bi-ctl select { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.bi-aviso { margin: 4px 0 0; font-size: 12px; color: var(--accent); }
.bi-ley { display: flex; flex-direction: column; gap: 3px; margin: 2px 0 6px; }
.bi-y, .bi-x { max-width: 220px; color: var(--muted); font-size: 11px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.bi-grid { display: grid; grid-template-columns: repeat(3, 20px); grid-auto-rows: 20px; gap: 1px; }
.bi-sw { display: block; }
.bi-cortes { display: flex; align-items: center; gap: 6px; max-width: 250px; font-size: 11.5px;
  font-variant-numeric: tabular-nums; }
.bi-k { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.bi-tip { color: var(--muted); }
@media (max-width: 520px) {
  .bi-ley { margin: 0; }
  .bi-grid { grid-template-columns: repeat(3, 14px); grid-auto-rows: 14px; }
  .bi-cortes { max-width: none; font-size: 10.5px; }
}

/* ---------- sitios parecidos ---------- */
.parecidos:empty { display: none; }
.parecidos { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.par-t { margin: 0; font-size: 13px; font-weight: 600; }
.par-n { margin: 2px 0 6px; font-size: 12px; color: var(--muted); }
.par-l { list-style: none; margin: 0; padding: 0; }
.par-l button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%;
  padding: 5px 6px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit;
  text-align: left; cursor: pointer; }
.par-l button:hover, .par-l button:focus-visible { background: var(--bg); }
.par-nom { font-size: 13px; }
.par-p, .par-d { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ---------- dónde estoy ---------- */
#btn-yo[aria-busy="true"], #btn-img[aria-busy="true"] { opacity: .6; cursor: progress; }
.yo-msg { top: 96px; }
#btn-yo { white-space: nowrap; }
@media (max-width: 1200px) {
  #btn-yo .long { display: none; }
  #btn-yo .short { display: inline; }
}

/* ---------- ayuda de primera visita ---------- */
.btn-ayuda { min-width: 34px; font-weight: 700; }
.ayuda {
  position: fixed; z-index: 50; width: 280px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 28px rgba(0,0,0,.28);
}
.ayuda-n { margin: 0; font-size: 11px; color: var(--muted); }
.ayuda-t { margin: 2px 0 4px; font-size: 15px; }
.ayuda-x { margin: 0 0 10px; font-size: 13px; line-height: 1.4; }
.ayuda-b { display: flex; justify-content: flex-end; gap: 8px; }
.ayuda-b button { font: inherit; font-size: 13px; border-radius: 6px; padding: 5px 12px; cursor: pointer;
  border: 1px solid var(--line); background: none; color: var(--ink); }
.ayuda-b .ayuda-sig { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ayuda-foco { outline: 3px solid var(--b02); outline-offset: 2px; border-radius: 6px; }
.map-wrap.ayuda-foco { outline-offset: -3px; }
@media (max-width: 900px) {
  .ayuda { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* ---------- grandes caseros con nombre (Civio) ---------- */
.duenos-l { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.duenos-l li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: baseline; padding: 3px 0; }
.duenos-g { width: 10px; height: 10px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); align-self: center; }
.duenos-n { font-variant-numeric: tabular-nums; }

/* ---------- quitar selección, sin capa, color proporcional ---------- */
.lugar-cab { display: flex; align-items: center; gap: 8px; }
.lugar-cab .place { flex: 1; min-width: 0; }
.quitar-sel { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.quitar-sel:hover { color: var(--ink); border-color: var(--ink); }
.legend[hidden] { display: none; }
.ley-modo { display: flex; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ley-modo button { flex: 1; border: 0; background: none; color: var(--muted); font: inherit; font-size: 11px; padding: 3px 8px; cursor: pointer; }
.ley-modo button + button { border-left: 1px solid var(--line); }
.ley-modo button.on { background: var(--ink); color: var(--bg); }
.prop-barra { position: relative; width: 200px; height: 12px; border-radius: 3px; margin: 4px 0 2px;
  background: linear-gradient(to right, var(--c0), var(--c6)); box-shadow: inset 0 0 0 1px var(--line); }
.prop-barra i { position: absolute; top: -3px; bottom: -3px; border: 2px solid var(--ink); border-radius: 3px; }
.prop-eje { display: flex; justify-content: space-between; width: 200px; color: var(--muted); font-size: 11px; }
.prop-txt { max-width: 200px; margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.35; }
@media (max-width: 520px) {
  .legend .ley-modo, .legend .prop-txt { width: 100%; max-width: none; }
}

/* ---------- cambio entre años ---------- */
.t-cambio.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- círculos para cantidades ---------- */
.circulos circle { fill: var(--ink); fill-opacity: .16; stroke: var(--ink); stroke-opacity: .65;
  stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.circ-ley { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.circ-ctl { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11.5px; }
.circ-ctl input { margin: 0; accent-color: var(--ink); }
.circ-ref { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; font-size: 11px;
  font-variant-numeric: tabular-nums; }
.circ-muestra { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.circ-muestra circle { fill: var(--ink); fill-opacity: .16; stroke: var(--ink); stroke-opacity: .65; }
.circ-nombre { color: var(--muted); max-width: 120px; line-height: 1.3; }

/* ---------- lista de datos y ficha lado a lado ---------- */
/* en una columna, los dos bloques no existen para el diseño: el panel queda como siempre */
.panel-col { display: contents; }
#btn-columnas.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (min-width: 1401px) {
  .layout.dos-col { grid-template-columns: minmax(0, 1fr) 732px; }
  .layout.dos-col .panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; overflow: hidden; min-height: 0; }
  .layout.dos-col .panel-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow-y: auto; }
  /* el mapa queda más estrecho: su barra usa los nombres cortos (CCAA, Prov., Est., ◎) */
  .layout.dos-col .seg .long, .layout.dos-col .zoom-btns .long { display: none; }
  .layout.dos-col .seg .short, .layout.dos-col .zoom-btns .short { display: inline; }
}
@media (max-width: 1400px) {
  #btn-columnas { display: none; }
}

/* ---------- dos mapas lado a lado ---------- */
.zoom-btns #btn-dos { width: auto; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.zoom-btns #btn-dos.on { background: var(--ink); color: var(--bg); }
.map-wrap.dividido #mapa { right: 50%; width: 50%; }
.mapa2 { position: absolute; top: 0; bottom: 0; left: 50%; right: 0; width: 50%; height: 100%;
  border-left: 2px solid var(--line); cursor: grab; touch-action: none; }
.mapa2[hidden] { display: none; }
.map-wrap.dividido .legend { right: calc(50% + 12px); }
.m2-cab { position: absolute; z-index: 2; top: 56px; right: 12px; max-width: calc(50% - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  box-shadow: var(--shadow); font-size: 12px; }
.m2-cab[hidden] { display: none; }
.m2-fila { display: flex; gap: 6px; align-items: center; }
.m2-fila select { min-width: 0; max-width: 240px; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; }
.m2-fila button { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.m2-ley { margin-top: 4px; }
.m2-ley .row { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.m2-ley .sw { width: 12px; height: 9px; border-radius: 2px; }
@media (max-width: 1200px) {
  #btn-dos .long { display: none; }
  #btn-dos .short { display: inline; }
}
.layout.dos-col #btn-dos .long { display: none; }
.layout.dos-col #btn-dos .short { display: inline; }
/* en pantallas estrechas no se ofrece (dos.js, DOS_MIN) */
@media (max-width: 700px) {
  #btn-dos { display: none; }
}

/* ---------- descripción de un dato al pasar por la lista ---------- */
.ind-desc { position: fixed; z-index: 40; width: 340px; max-width: calc(100vw - 16px);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 12.5px; line-height: 1.45; pointer-events: none; }
.ind-desc[hidden] { display: none; }
.ind-desc p { margin: 0; }
.desc-t { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px !important; font-size: 13.5px; }
.desc-t span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.desc-aviso { color: var(--accent); margin-bottom: 6px !important; }
.desc-f { margin-top: 6px !important; color: var(--muted); font-size: 11.5px; }

/* ---------- novedades ---------- */
.novedades { padding-left: 18px; }
.novedades li { margin-bottom: 4px; }
.nov-f { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#btn-sobre.con-novedad { position: relative; }
#btn-sobre.con-novedad::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }

/* ¿Qué se puede hacer? (politicas.js) */
.pol-caja { width: min(1000px, 100%); }
.pol-caja p { max-width: 80ch; }
.pol-resumen { overflow-x: auto; }
.pol-tabla { border-collapse: collapse; font-size: 13px; width: 100%; }
.pol-tabla th, .pol-tabla td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pol-tabla thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
.pol-tabla tr.pol-g th { padding-top: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 0; }
.pol-tabla th a { color: var(--ink); }
.pol-conf { white-space: nowrap; color: var(--accent); letter-spacing: -1px; }
.pol-lugar { display: inline-flex; gap: 8px; align-items: center; margin: 6px 0 10px; }
.pol-lugar select { font: inherit; padding: 3px 6px; }
.pol-sim { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .pol-sim { grid-template-columns: 1fr; } }
.pol-col { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.pol-col h4 { margin: 0 0 6px; font-size: 14px; }
.pol-partida { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.pol-res { background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; }
.pol-res span { display: block; font-weight: 600; font-size: 15px; }
.pol-res small { color: var(--muted); }
.pol-sl { display: block; margin: 10px 0; }
.pol-sl span { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.pol-sl input { width: 100%; accent-color: var(--accent); }
.pol-sl small, .pol-ck small { display: block; color: var(--muted); font-size: 12px; }
.pol-ck { display: block; font-size: 13px; margin: 10px 0; }
.pol-ficha { border-top: 1px solid var(--line); padding: 10px 0 6px; scroll-margin-top: 48px; }
.pol-ficha ul { margin: 4px 0 6px; padding-left: 18px; }
.pol-ficha li { margin: 2px 0; }
.pol-sub { margin: 8px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pol-args { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .pol-args { grid-template-columns: 1fr; } }
.pol-ver { font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--accent); border-radius: 6px; padding: 1px 8px; cursor: pointer; }
.pol-sl b { white-space: nowrap; }
.pol-casos { list-style: none; padding-left: 0 !important; }
.pol-casos li { margin: 4px 0; }
.pol-val { display: inline-block; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 0 7px; margin: 0 2px; border: 1px solid currentColor; }
.pol-v-si { color: var(--ok); }
.pol-v-no { color: var(--bad); }
.pol-v-parte { color: var(--warn); }
.pol-v-ns { color: var(--muted); }
.pol-p-f { color: var(--pos-f); }
.pol-p-x { color: var(--pos-x); }
.pol-p-m { color: var(--pos-m); }
/* en las tablas de posturas, un símbolo además del color (no todo el mundo distingue los colores) */
.pol-voces td.pol-p-f::before { content: "✓ "; }
.pol-voces td.pol-p-x::before { content: "✕ "; }
.pol-voces td.pol-p-m::before { content: "~ "; }
.pol-voces td { font-size: 12.5px; }
/* la primera columna se queda al deslizar la tabla de lado */
.pol-voces tbody th[scope="row"], .pol-voces thead tr:last-child th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.pol-partidos td.pol-elegida { outline: 2px solid var(--accent); outline-offset: -2px; }
/* lo que dice la casilla tocada, fijo al pie de la ventana */
#pol-partido-det, #pol-voz-det { position: sticky; bottom: 0; z-index: 3; box-shadow: var(--shadow); border: 1px solid var(--line); padding-right: 36px; }
.pol-det-x { position: absolute; top: 4px; right: 6px; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
/* ¿qué hicieron? */
.qh-graf { width: 100%; height: auto; margin: 6px 0 0; }
/* en el móvil la gráfica no se encoge hasta no leerse: conserva un ancho y se desliza */
.qh-graf-caja { overflow-x: auto; }
@media (max-width: 640px) { .qh-graf { min-width: 620px; } }
.qh-b0 { fill: var(--surface); }
.qh-b1 { fill: var(--bg); }
.qh-t { font-size: 11px; fill: var(--muted); }
.qh-leyenda { fill: var(--ink); }
.qh-linea { fill: none; stroke: var(--ink); stroke-width: 2; }
.qh-eje { stroke: var(--line); }
.qh-libres { fill: var(--b00); }
.qh-prot { fill: var(--b20); }
.qh-cuadro { display: inline-block; width: 10px; height: 10px; vertical-align: -1px; margin-right: 3px; }
span.qh-libres { background: var(--b00); outline: 1px solid var(--line); }
span.qh-prot { background: var(--b20); }
.qh-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.qh-cols ul { margin: 0; padding-left: 16px; }
.qh-cols li { margin-bottom: 4px; }
@media (max-width: 760px) { .qh-cols { grid-template-columns: 1fr; } }
.pol-partidos td.pol-voto { font-style: italic; }

/* ---------- selector de fuente de una capa (leyenda) ---------- */
.ley-fuente { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.ley-fuente select { flex: 1; min-width: 0; max-width: 200px; font: inherit; font-size: 12px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; }
.ley-fiab { margin: 1px 0 4px; font-size: 11px; color: var(--muted); }
@media (max-width: 520px) {
  .ley-fuente select { max-width: none; }
}

/* quién defiende cada argumento de una política */
.pol-quien { margin-left: 2px; font-size: 11px; color: var(--muted); }
.pol-quien::before { content: "— "; }

/* años y fuente de cada fuente de una capa, en la lista de datos */
.ind-list .yr-fuentes { display: flex; flex-direction: column; align-items: flex-end; text-align: right; white-space: nowrap; }

/* otras fuentes de una capa en la ficha de un sitio */
.fuentes-alt { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.fuente-alt { border: 0; background: none; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-align: left; }
.fuente-alt:hover b, .fuente-alt:focus-visible b { text-decoration: underline; }
.fuente-alt b { color: var(--ink); font-weight: 600; }
.fuente-alt .pts { letter-spacing: -1px; }

/* quién dice qué (politicas.js) */
.pol-voces td { white-space: nowrap; font-size: 12px; cursor: help; }
.pol-voces thead th { white-space: nowrap; }
.pol-fuentes { padding-left: 18px; font-size: 13px; }
.pol-fuentes li { margin: 3px 0; }

/* ---------- glosario ---------- */
.glos { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.glos:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 2px; }
.glos-tip {
  position: fixed; z-index: 60; max-width: 300px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.4;
  box-shadow: 0 4px 18px rgba(0,0,0,.25); pointer-events: none;
}
.glos-tip b { display: block; margin-bottom: 2px; }
.glosario { margin: 0; font-size: 13px; }
.glosario dt { font-weight: 700; margin-top: 8px; }
.glosario dd { margin: 2px 0 0; color: var(--muted); line-height: 1.4; }

/* ---------- ¿dónde puedo vivir? ---------- */
.vivir {
  position: fixed; z-index: 45; top: 136px; left: 32px; width: 300px; max-height: calc(100vh - 160px); overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 12px; box-shadow: 0 6px 28px rgba(0,0,0,.28); font-size: 13px;
}
.vivir h2 { font-size: 15px; margin: 0; }
/* simulador: la expropiación va debajo, a todo el ancho */
.pol-exp { grid-column: 1 / -1; }
.pol-exp-g { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; }
.vivir form { display: grid; gap: 8px; margin: 8px 0; }
.vivir label { display: grid; gap: 3px; min-width: 0; }
.vivir input[type=number], .vivir input:not([type]), .vivir select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
/* al ancho de la caja: la opción larga del transporte ensanchaba todo el formulario */
.vivir label > select, .vivir label > input:not([type]) { width: 100%; min-width: 0; box-sizing: border-box; }
.vivir-eur { display: flex; align-items: center; gap: 4px; }
.vivir-eur input { width: 110px; }
.vivir fieldset { border: 0; margin: 0; padding: 0; display: flex; gap: 14px; }
.vivir .vivir-modo { display: flex; gap: 5px; align-items: center; cursor: pointer; }
.vivir-ver { font: inherit; padding: 6px 12px; border-radius: 6px; cursor: pointer; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); justify-self: start; }
#vivir-res p { margin: 6px 0; line-height: 1.4; }
.vivir-lista { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.vivir-lista button { width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left; font: inherit; font-size: 13px;
  padding: 8px 10px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); cursor: pointer; }
.vivir-lista button span { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .vivir { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; max-height: 60vh; }
}

.pol-cita { font-size: 11px; text-decoration: none; white-space: nowrap; }
.pol-cita:hover { text-decoration: underline; }

/* ---------- etapas de la línea del tiempo ---------- */
.tiempo { flex-wrap: wrap; }
/* las etapas en una sola fila que se desliza: en dos o tres filas la barra tapaba el mapa y la leyenda */
.t-etapas { flex-basis: 100%; display: flex; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.t-etapas button { flex: none; }
.t-etapas button { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.t-etapas button small { color: var(--muted); font-size: 11px; }
.t-etapas button.aqui { border-color: var(--ink); }
.t-etapas button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.t-etapas button.on small { color: inherit; opacity: .8; }
.evol-etapa rect { fill: var(--ink); opacity: .04; }
.evol-etapa.par rect { opacity: .09; }
.evol-etapa text { font-size: 9px; fill: var(--muted); }
/* con el mapa partido, la línea del tiempo baja a la esquina de abajo de la mitad derecha: arriba
   están la cabecera y la leyenda de esa mitad */
.map-wrap.dividido .tiempo { top: auto; bottom: 30px; }

/* ---------- la película: rótulo sobre el mapa mientras se reproduce ---------- */
.t-rotulo { position: absolute; z-index: 3; left: 16px; top: 64px; pointer-events: none; display: flex; flex-direction: column;
  gap: 2px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--line); box-shadow: var(--shadow); max-width: min(320px, calc(100% - 32px)); }
.t-r-anio { font-size: 34px; font-weight: 700; line-height: 1; }
.t-r-etapa { font-size: 15px; font-weight: 700; color: var(--accent, var(--ink)); }
.t-r-dato { font-size: 12px; color: var(--muted); }
.t-r-v { font-size: 14px; }

/* ---------- modo presentación ---------- */
.hi-pres { font: inherit; font-size: 12px; margin-left: auto; margin-right: 6px; padding: 2px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
body.presentando .map-wrap { position: fixed; inset: 0; z-index: 90; border-radius: 0; border: 0; }
body.presentando { overflow: hidden; }
body.presentando .historia { font-size: 22px; line-height: 1.45; width: max(300px, min(640px, calc(100% - 444px))); top: auto; bottom: 24px; left: 24px; padding: 18px 22px; }
body.presentando .historia .hi-cab b { font-size: 16px; }
body.presentando .historia .hi-nav button { font-size: 16px; padding: 6px 14px; }
body.presentando .hint, body.presentando #t-rotulo { display: none; }

/* ---------- gráficos dentro de una historia ---------- */
.hi-graf { margin: 6px 0 8px; }
.hi-graf svg { display: block; overflow: visible; }
.hg-l { fill: none; stroke-width: 2.2px; }
.hg-eje text { font-size: 9px; fill: var(--muted); }
.hg-eje line { stroke: var(--line); }
.hg-ley { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 11px; }
.hg-ley i { display: inline-block; width: 10px; height: 3px; margin-right: 5px; vertical-align: middle; }
body.presentando .hg-ley { font-size: 15px; }

/* ---------- «¿Qué se puede hacer?» en pestañas, una ficha cada vez ---------- */
.pol-tabs { position: sticky; top: -1px; z-index: 2; display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0; margin: 4px 0 8px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.pol-tabs button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 8px 8px 0 0; cursor: pointer;
  border: 1px solid transparent; background: none; color: var(--muted); }
.pol-tabs button.on { color: var(--ink); border-color: var(--line); border-bottom-color: var(--surface); background: var(--bg); font-weight: 700; }
.pol-nav { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.pol-nav select { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); max-width: 100%; }
.pol-nav button { font: inherit; padding: 3px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.pol-nav button:disabled { opacity: .4; cursor: default; }
.pol-ap { border-top: 1px solid var(--line); padding: 6px 0; }
.pol-ap > summary { cursor: pointer; font-weight: 700; font-size: 13px; padding: 4px 0; }
.pol-n { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  font-size: 11px; font-weight: 400; text-align: center; color: var(--muted); }
.pol-lados th { font-size: 11px; font-weight: 400; color: var(--muted); text-align: center; }
.pol-voces .pol-lado-sep { border-left: 2px solid var(--ink); }
/* qué proponen los partidos: el año y el punto de los cambios frente a 2023 */
.pol-anios { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.pol-anio { font: inherit; font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.pol-anio.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pol-partidos td.pol-cambio { position: relative; }
.pol-partidos td.pol-cambio::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pol-etq { font-size: 11px; padding: 0 5px; border-radius: 4px; white-space: nowrap; }

/* mientras llegan los datos */
.carga { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; margin: 0; padding: 16px; text-align: center;
  color: var(--muted); font-size: 14px; background: var(--surface); }

/* en el móvil, encima del mapa: qué dato se ve y un botón para ir a la lista */
.btn-dato { display: none; }
@media (max-width: 900px) {
  .btn-dato { display: block; width: 100%; text-align: left; font: inherit; font-size: 14px; font-weight: 600; padding: 10px 12px; margin: 0 0 8px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; }
}
.qh-cuenta { color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
.pol-eje { margin-bottom: 6px; }
