/* Widgets para incrustar (/embed/…): hoja propia y ligera. Los colores son los mismos de style.css. */
@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --bg: #ffffff; --fg: #09090b; --card: #ffffff; --muted: #f4f4f5; --muted-fg: #6b6b74; --border: #e4e4e7;
  --sepia: #a8743f; --sepia-ink: #8c5c2c; --sepia-soft: #fbf5ee; --sepia-line: #ecd9c3;
  --shadow-lg: 0 10px 30px -12px rgba(9, 9, 11, 0.18);
  --font: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #09090b; --fg: #fafafa; --card: #0f0f12; --muted: #18181b; --muted-fg: #a1a1aa; --border: #27272a;
    --sepia: #d9a873; --sepia-ink: #d9a873; --sepia-soft: #1d1710; --sepia-line: #3d2f20; --shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, 0.6); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #09090b; --fg: #fafafa; --card: #0f0f12; --muted: #18181b; --muted-fg: #a1a1aa; --border: #27272a;
  --sepia: #d9a873; --sepia-ink: #d9a873; --sepia-soft: #1d1710; --sepia-line: #3d2f20; --shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, 0.6); color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.45; }
:root[data-fondo="transparente"] body { background: transparent; }
.num { font-variant-numeric: tabular-nums; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Tarjeta */
.emb { position: relative; padding: 16px 18px 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); overflow: hidden; }
:root[data-marco="no"] .emb { border: 0; border-radius: 0; padding: 4px 2px 6px; background: transparent; }
.emb-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.emb-t { margin: 0; font-size: 17px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.emb-s { margin: 3px 0 0; font-size: 13px; color: var(--muted-fg); }
.emb-marca { flex: none; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 12.5px; font-weight: 650; color: var(--fg); }
.emb-marca .mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #18181b; color: #fff; font-size: 11px; font-weight: 800; position: relative; }
.emb-marca .mark::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 4px; height: 2px; background: #a8743f; border-radius: 1px; }
:root[data-theme="dark"] .emb-marca .mark { box-shadow: inset 0 0 0 1px #3f3f46; }
@media (max-width: 420px) { .emb-marca span:last-child { display: none; } }

/* Hemiciclo (assets/hemiciclo.js) */
.hemi-camara { position: relative; margin: 10px auto 0; max-width: 620px; }
.hemi-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: manipulation; }
.hemi-svg .asiento { cursor: pointer; transition: opacity .15s; }
.hemi-svg .asiento.apagado { opacity: .16; }
.hemi-svg circle.libre, .hemi-svg .libre rect:first-child { fill: var(--border); cursor: default; }
.hemi-svg .respaldo { fill: rgba(0, 0, 0, .24); pointer-events: none; }
.hemi-svg .hemi-suelo { fill: var(--muted); stroke: var(--border); stroke-width: 1; }
.hemi-svg .hemi-pupitre { fill: none; stroke: var(--muted-fg); stroke-opacity: .32; stroke-linecap: round; }
.hemi-svg .hemi-mesa { fill: var(--card); stroke: var(--fg); stroke-opacity: .35; stroke-width: 1.2; }
.hemi-svg .hemi-tribuna { fill: var(--muted-fg); opacity: .45; }
.hemi-svg .hemi-mayoria { stroke: var(--fg); stroke-width: 1.4; stroke-dasharray: 4 4; opacity: .5; }
.hemi-svg .hemi-num { fill: var(--fg); font-size: 38px; font-weight: 700; text-anchor: middle; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.hemi-svg .hemi-sub { fill: var(--muted-fg); font-size: 12.5px; font-weight: 550; text-anchor: middle; }
.hemi-svg.es-plano .hemi-num { font-size: 32px; }
.hemi-svg.es-plano .hemi-sub { font-size: 11.5px; }
.sen-pop { position: absolute; left: 0; top: 0; z-index: 5; display: grid; gap: 3px; max-width: 260px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 9px 11px; font-size: 13px; pointer-events: none; }
.sen-pop[hidden] { display: none; }
.sen-pop .party { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.sen-pop .party i { width: 8px; height: 8px; border-radius: 2px; }
.sen-pop .muted { color: var(--muted-fg); font-size: 12px; }
.emb-mayoria { margin: 2px 0 0; text-align: center; font-size: 12.5px; color: var(--muted-fg); }
.hemi-ley { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; font-size: 13.5px; color: var(--muted-fg); }
.hemi-ley li { display: flex; }
.hemi-ley button { display: inline-flex; align-items: center; gap: 6px; font: inherit; color: inherit; background: none; border: 0; padding: 2px 5px; margin: 0 -3px; border-radius: 6px; cursor: pointer; }
.hemi-ley button:hover, .hemi-ley button:focus-visible, .hemi-ley button[aria-pressed="true"] { background: var(--muted); color: var(--fg); }
.hemi-ley i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hemi-ley b { color: var(--fg); font-weight: 650; }
.hemi-ley .libre span { display: inline-flex; align-items: center; gap: 6px; }
.hemi-ley .libre i { background: var(--border); }

/* Tabla de votos */
.emb-tabla { width: 100%; border-collapse: collapse; margin: 12px 0 0; font-size: 13px; }
.emb-tabla th { text-align: right; font-weight: 550; color: var(--muted-fg); font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.emb-tabla th:first-child, .emb-tabla td:first-child { text-align: left; }
.emb-tabla td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--border); }
.emb-tabla tr:last-child td { border-bottom: 0; }
.emb-tabla .p { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.emb-tabla .p i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.emb-tabla .bar { position: relative; display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--muted); vertical-align: middle; margin-right: 8px; overflow: hidden; }
.emb-tabla .bar span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
@media (max-width: 380px) { .emb-tabla .bar { display: none; } }

/* Antes del 29N */
.emb-espera { margin: 4px auto 0; max-width: 460px; text-align: center; font-size: 13.5px; color: var(--muted-fg); }
.emb-espera b { color: var(--fg); }

/* Pie: fuentes y créditos */
.emb-pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted-fg); }
.emb-pie a { color: var(--muted-fg); text-underline-offset: 2px; }
.emb-pie a:hover { color: var(--fg); }
.emb-ver { font-weight: 600; color: var(--fg) !important; text-decoration: none; }
.emb-error { padding: 24px; text-align: center; color: var(--muted-fg); }

/* Resultado de una zona */
.emb-kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; margin: 14px 0 4px; }
.emb-kpis div { padding: 8px 10px; border-radius: 10px; background: var(--muted); min-width: 0; }
.emb-kpis span { display: block; font-size: 11.5px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* El número cabe siempre en su cuadro: se encoge con el ancho del widget (24.952.447 en un móvil) */
.emb-kpis b { display: block; font-size: clamp(13px, 3.9vw, 18px); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
@media (max-width: 340px) { .emb-kpis div { padding: 7px 8px; } }
.emb-barras { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 9px; }
.emb-b-cab { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.emb-b-cab .p { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; flex: 1; }
.emb-b-cab .p i { width: 9px; height: 9px; border-radius: 2px; flex: none; align-self: center; }
.emb-b-cab small { font-weight: 500; }
.emb-b-num { display: inline-flex; gap: 8px; align-items: baseline; margin-left: auto; white-space: nowrap; }
.emb-b-num b { font-weight: 650; }
.emb-b-num .muted, .emb-barras .muted, .emb-ley .muted { color: var(--muted-fg); font-size: 12px; }
.emb-b-barra { height: 7px; margin-top: 4px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.emb-b-barra span { display: block; height: 100%; border-radius: 4px; }
.emb-barras li.gris .p { font-weight: 500; color: var(--muted-fg); }
.emb-esc { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 6px; background: var(--fg); color: var(--card); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.emb-esc.vacio { visibility: hidden; }
.emb-electo { display: inline-block; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 650; color: var(--sepia-ink); background: var(--sepia-soft); border: 1px solid var(--sepia-line); }
.emb-barras.personas .p { flex-wrap: wrap; row-gap: 0; }
.emb-cols { display: flex; align-items: flex-start; margin: 14px 0 0; border-top: 0; }
.emb-col { flex: 1 1 0; display: grid; grid-template-rows: 166px auto auto; justify-items: center; row-gap: 5px; padding: 0 3px; min-width: 0; }
.emb-col-zona { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; width: 100%; height: 166px; border-bottom: 1px solid var(--border); }
.emb-col-zona b { font-size: clamp(9.5px, 2.7vw, 12px); font-weight: 650; white-space: nowrap; }
.emb-col-b { display: block; width: 100%; max-width: 46px; border-radius: 5px 5px 0 0; flex: none; }
.emb-col-esc { display: flex; justify-content: center; height: 20px; }
.emb-col-n { font-size: clamp(10px, 2.8vw, 12px); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emb-anillo { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 12px 0 0; }
.emb-anillo svg { width: 190px; height: 190px; flex: none; }
.emb-anillo path { stroke: var(--card); stroke-width: 1.5; }
.emb-an-n { fill: var(--fg); font-size: 30px; font-weight: 700; text-anchor: middle; font-variant-numeric: tabular-nums; }
.emb-an-s { fill: var(--muted-fg); font-size: 12px; text-anchor: middle; }
.emb-anillo ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; min-width: 150px; font-size: 13.5px; }
.emb-anillo li { display: flex; justify-content: space-between; gap: 14px; }
.emb-anillo .p { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.emb-anillo .p i { width: 9px; height: 9px; border-radius: 2px; }
.emb-espera-sola { margin: 26px auto 14px; }

/* Mapa */
.emb-mapa { position: relative; margin: 10px 0 0; }
.emb-mapa-svg { display: block; width: 100%; height: auto; max-height: 520px; touch-action: manipulation; }
.emb-zonas path { fill: var(--muted); stroke: var(--card); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke; cursor: pointer; }
.emb-zonas.finas path { stroke-width: .5; }
.emb-zonas path:hover { stroke: var(--fg); stroke-width: 1.5; }
.emb-canarias { fill: none; stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.emb-ley-t { margin: 8px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted-fg); }
.emb-ley { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.emb-ley li { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.emb-ley i { width: 10px; height: 10px; border-radius: 3px; }
.emb-grad { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted-fg); max-width: 320px; }
.emb-grad i { flex: 1; height: 9px; border-radius: 5px; }
.emb-ley-n { font-weight: 450; }

/* Hemiciclo en arco: un tramo por partido (como los hemiciclos por comunidad del mapa electoral) */
.hemi-camara.es-arco { max-width: 440px; }
.arco-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: manipulation; }
.arco-svg path { stroke: var(--card); stroke-width: 1.2; stroke-linejoin: round; cursor: pointer; transition: opacity .15s; }
.arco-svg path.libre { fill: var(--border); cursor: default; }
.arco-svg path.apagado { opacity: .25; }
.arco-svg .arco-mayoria { fill: none; stroke: var(--fg); stroke-width: .8; stroke-dasharray: 2 2; opacity: .55; pointer-events: none; }
.arco-num { fill: var(--fg); font-size: 30px; font-weight: 700; text-anchor: middle; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.arco-sub { fill: var(--muted-fg); font-size: 9px; font-weight: 550; text-anchor: middle; }
.hemi-nombres { margin: 2px 0 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 1px; }
.hemi-nombres .muted { font-size: 11.5px; }
/* Columnas en un widget estrecho (móvil): sin el «%» encima de cada barra y los nombres en dos líneas si hace falta */
@media (max-width: 560px) {
  .emb-col { padding: 0 2px; }
  .emb-col-zona b { font-size: 10px; letter-spacing: -.02em; }
  .emb-col-zona b .pc { display: none; }
  .emb-col-n { font-size: 9.5px; white-space: normal; text-align: center; line-height: 1.15; overflow: visible; text-overflow: clip; max-width: none; letter-spacing: -.02em; }
  .emb-col .emb-esc { min-width: 0; padding: 0 3px; font-size: 10.5px; height: 18px; }
}
