.map-tools{display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin:0 0 5px;font-size:10px}.map-tools label{display:flex;align-items:center;gap:4px}.map-tools select{padding:3px;min-height:26px;font-size:10px;width:auto}.map-tools button{padding:2px 8px;min-height:27px;font-size:12px}.map-tools output{min-width:33px;font-variant-numeric:tabular-nums}.map-viewport{overflow:hidden;touch-action:pan-y}.map-callout{fill:none;stroke:var(--map-callout-ink,#29465c);stroke-width:1.2px;vector-effect:non-scaling-stroke;opacity:1;pointer-events:none;stroke-linecap:round;stroke-linejoin:round}.map-label text{pointer-events:none}.map-label-inside text{font-weight:600}.map-label-outside text{font-weight:500;stroke-width:1px}.projection .map-tools{margin:0;gap:4px}.projection .map-area{padding-top:3px}.projection .map-tools select,.projection .map-tools button{min-height:22px;padding:1px 5px}.projection .map-viewport svg{height:210px!important}.projection .map-label-key{font-size:9px}:root[data-theme=night] .map-area{--map-callout-ink:#deebf5;--map-callout-halo:#142a3c}@media(max-width:700px){.map-tools{font-size:11px}.map-tools button{min-width:34px;min-height:32px}.map-tools select{min-height:32px}.map-viewport svg{min-height:230px}}
.map-area.map-expanded{position:fixed!important;inset:16px;z-index:1200;background:var(--card,#fff);height:auto!important;width:auto!important;padding:14px;overflow:auto;border:1px solid var(--line);box-shadow:0 10px 40px #0004}.map-area.map-expanded .map-viewport svg{width:100%;height:calc(100vh - 180px)!important;min-height:350px}.map-area.map-expanded .map-tools{font-size:12px}.map-area.map-expanded .map-label-key{font-size:12px}:root[data-theme=night] .map-area.map-expanded{background:#142a3c}@media(max-width:700px){.map-area.map-expanded{inset:4px;padding:8px}}
:root[data-theme=night] .map-label-outside text{fill:#deebf5;stroke:#142a3c;stroke-width:.8px}.map-area.map-expanded .map-viewport{overflow:auto;touch-action:pan-x pan-y}.map-area.map-expanded .map-viewport svg{min-width:1100px}
.map-line-options{position:relative;align-self:center}.map-line-options summary{cursor:pointer;padding:5px 7px;border:1px solid var(--line);border-radius:5px;background:var(--card,#fff)}.map-line-options>div{position:absolute;z-index:30;top:100%;left:0;width:230px;padding:12px;background:var(--card,#fff);border:1px solid var(--line);border-radius:6px;box-shadow:0 6px 16px #0003;display:grid;gap:10px}.map-line-options p,.map-routing-help{font-size:11px;line-height:1.5;color:var(--muted)}.map-line-options input{width:auto;margin:0}.map-routing-help{margin:6px 12px}:root[data-theme=night] .map-line-options summary,:root[data-theme=night] .map-line-options>div{background:#173047}
/* A narrow opposite-tone halo keeps the connector visible over both party
   fills and the map surface. Only its interior map endpoint has a dot; the
   renderer owns the radius and clearance used by the collision solver. */
.map-callout-halo{
 fill:none;stroke:var(--map-callout-halo,#f8fbfd);stroke-width:2.8px;
 stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;
 opacity:1;pointer-events:none;
}
.map-callout-anchor{
 fill:var(--map-callout-ink,#29465c);stroke:var(--map-callout-halo,#f8fbfd);
 stroke-width:1.2px;vector-effect:non-scaling-stroke;opacity:1;pointer-events:none;
}
/* Match the measured label metrics used by the collision solver. */
.map-label text{font-family:Arial,sans-serif;letter-spacing:0}
/* The external toolbar and key retain their space; the map receives the remaining card height. */
.projection .map-area:not(.map-expanded)>.map-note{display:none}.projection .map-area.map-expanded .map-viewport svg{height:calc(100vh - 180px)!important}
/* Constituency codes use CSS-pixel geometry so every code remains readable at Fit. */
.map-area.map-all-constituencies .map-viewport{flex:none;width:100%;overflow:hidden}
.map-area.map-all-constituencies.map-expanded{justify-content:flex-start}
.map-area.map-all-constituencies .map-viewport svg{display:block;width:100%;height:var(--map-canvas-height,260px)!important;min-width:0;min-height:0;max-height:none;flex:none}
.map-all-constituencies .map-label text{font-family:Arial,sans-serif;font-weight:600;letter-spacing:0}
.projection .project-map .map-area.map-all-constituencies:not(.map-expanded){height:auto;min-height:0}
.projection:has(.map-all-constituencies) .project-grid{height:auto;min-height:350px;align-items:stretch}
.projection .project-grid.compact-constituency-map{height:350px;min-height:350px}
.projection .compact-constituency-map .project-map>.card-head{padding-top:8px;padding-bottom:8px}
.projection .compact-constituency-map .project-map .map-area{padding-top:6px;padding-bottom:6px}
/* Saved comparisons keep their text without adding an unintended hidden row. */
.projection #movement-explanation[hidden]{display:none}
@media(min-width:1000px) and (min-height:821px){
.projection .project-stats{margin-bottom:8px}
 .projection .project-grid .project-standings .candidate-movement{display:inline;margin-left:5px;font-size:9px}
 .projection .project-grid .project-standings .candidate{padding-top:3px;padding-bottom:3px}
 .projection .project-grid .project-standings .candidate-top{margin-bottom:2px}
}
/* The map owns its canvas; reserved chrome stays in the outer corners. */
.map-stage{position:relative;isolation:isolate;width:100%;height:340px;min-height:260px;flex:none}
.map-stage>.map-viewport{position:absolute;inset:0;width:100%;height:100%;overflow:hidden}
.map-stage>.map-viewport svg,.map-area.map-all-constituencies .map-stage>.map-viewport svg{display:block;width:100%;height:var(--map-canvas-height,100%)!important;min-width:0;min-height:0;max-height:none}
.map-stage>.map-tools{position:absolute;z-index:4;top:3px;left:8px;max-width:calc(100% - 16px);margin:0;padding:0;background:var(--card,#fff);border-radius:4px}
.map-stage>.map-label-key{position:absolute;z-index:4;left:8px;bottom:3px;margin:0;padding:0;max-width:calc(100% - 16px)}
.map-stage>.map-label-key>summary{padding:2px 5px;background:var(--card,#fff);border:1px solid var(--line,#b7c6d3);border-radius:3px}
.map-stage>.map-label-key[open]>div{position:absolute;z-index:6;left:0;right:auto;top:auto;bottom:calc(100% + 3px);width:min(520px,calc(100vw - 48px));max-height:190px;border:1px solid var(--line);box-shadow:0 3px 12px #0002}
.map-stage>.map-locality-caption{--map-caption-ink:#145d45;--map-caption-underline:#b52335;display:flex;align-items:center;gap:7px;position:absolute;z-index:3;right:8px;bottom:3px;width:max-content;max-width:52%;margin:0;padding:2px 7px;border:1px solid var(--line,#b7c6d3);border-right:3px solid #687f92;border-radius:3px;background:var(--card,#fff);color:var(--ink,#17364c);text-align:right;line-height:1.2;letter-spacing:0}
.map-locality-caption>.map-caption-copy{display:flex;align-items:baseline;justify-content:flex-end;flex-wrap:wrap;gap:2px 6px;min-width:0}
.map-area .map-stage>.map-locality-caption .map-caption-copy>strong{display:inline-block;min-width:0;max-width:100%;font-size:20px;font-weight:800;line-height:1.15;letter-spacing:-.01em;color:var(--map-caption-ink);border-bottom:3px solid var(--map-caption-underline);padding-bottom:2px;overflow-wrap:anywhere}
.map-locality-caption .map-caption-copy>small{font-size:9px;font-weight:700;letter-spacing:.06em;color:inherit;white-space:nowrap}
.map-locality-caption>img{display:block;flex:none;width:27px;height:18px;border:1px solid #8898a855}
:root[data-theme=night] .map-stage>:is(.map-tools,.map-locality-caption),:root[data-theme=night] .map-stage>.map-label-key>summary{background:#172c3f;color:#edf5fa}
:root[data-theme=night] .map-stage>.map-locality-caption{--map-caption-ink:#b6f1d7;--map-caption-underline:#f07c8b}
.map-area.map-expanded{display:flex;flex-direction:column;justify-content:flex-start}
.map-area.map-expanded>.map-stage{flex:1;min-height:360px}
.map-area.map-expanded>.expanded-map-legend,.map-area.map-expanded>.map-routing-help{flex:none}
.map-area.map-expanded>.map-stage>.map-viewport{overflow:hidden;touch-action:pan-x pan-y}
.map-area.map-expanded>.map-stage>.map-viewport svg{min-width:0;height:var(--map-canvas-height,100%)!important}
@media(max-width:700px){
 .map-stage>.map-tools{top:3px;left:4px;max-width:calc(100% - 8px);gap:4px}
 .map-stage>.map-locality-caption{right:4px;bottom:3px;max-width:calc(100% - 8px)}
 .map-area .map-stage>.map-locality-caption .map-caption-copy>strong{font-size:19px}
 .map-stage>.map-label-key{left:4px;bottom:calc(var(--map-caption-height,24px) + 9px)}
 .map-area.map-expanded>.map-stage{min-height:400px}
}
/* Override the older projector-only key positioning as well as the normal view. */
.map-area .map-stage>.map-label-key{position:absolute}
/* Council palettes supply dark backgrounds; retain a readable light caption. */
.map-stage>.council-map-caption{--map-caption-ink:#b6f1d7;--map-caption-underline:#f07c8b;background:#102d42;color:#fff}

/* Closing an automatic fit fallback stays integrated. Keep every callout on
   the same canvas and let only that canvas scroll inside its existing card. */
.map-area.map-inline-fit>.map-stage{height:100%!important;min-height:0;max-height:100%}
.map-area.map-inline-fit>.map-stage>.map-viewport{overflow:auto;overscroll-behavior:contain;touch-action:pan-x pan-y}
.map-area.map-inline-fit>.map-stage>.map-viewport{box-sizing:border-box;padding-bottom:max(40px,calc(var(--map-caption-height,24px) + 16px))}
@media(min-width:1200px){body.desktop-fit:has(.map-inline-fit) .project-grid{min-height:0}}
