:root {
  color-scheme: dark;
  font-family: Manrope, "Segoe UI", sans-serif;
  --header: #141816;
  --panel: #1a1e1b;
  --surface: #242a25;
  --ink: #f2f4eb;
  --muted: #abb9af;
  --line: #39433b;
  --rule: #303831;
  --mint: #a3f1ce;
  --amber: #f6c787;
  --mono: "Cascadia Mono", Consolas, monospace;
  --header-height: 64px;
  color: var(--ink);
  background: var(--header);
}
:root:lang(he) { font-family: Rubik, "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--mint); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

.topbar {
  height: var(--header-height);
  padding: 0 23px;
  background: var(--header);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.wordmark, .header-actions { display: flex; align-items: center; gap: 10px; }
.wordmark, .wordmark-text { min-width: 0; }
.wordmark-text { display: flex; align-items: center; gap: 12px; }
.header-actions { flex: 0 0 auto; }
.header-link {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--mint);
}
.header-link:hover { background: var(--surface); }
.logo {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  border-radius: 7px;
  background: var(--mint);
  color: #18302a;
  box-shadow: 0 0 16px #a3f1ce35;
}
.logo svg, .icon-button svg { width: 21px; height: 21px; }
h1 { font-size: 20px; font-weight: 800; line-height: 1.16; }
.election {
  max-width: 100%;
  min-height: 34px;
  border: 1px solid #5a4932;
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--amber);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.election:hover { border-color: var(--amber); }
.language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}
.language-toggle svg { flex: 0 0 auto; color: var(--mint); }
.language-toggle:hover { background: var(--surface); }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(355px, 414px);
  height: calc(100dvh - var(--header-height));
}
.map-panel { position: relative; min-width: 0; min-height: 0; background: #111716; }
#map { position: absolute; inset: 0; }
#map .maplibregl-canvas-container { cursor: crosshair; }
#map .maplibregl-canvas-container.maplibregl-interactive:active { cursor: grabbing; }
.map-controls { position: absolute; top: 18px; left: 18px; }
.icon-button, .map-key, .coordinates {
  background: #1b231fea;
  border: 1px solid #49554c;
  border-radius: 7px;
  box-shadow: 0 4px 18px #0006;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--mint);
  cursor: pointer;
}
.icon-button:hover { background: #303d33; }
.map-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 15px;
  position: absolute;
  bottom: 38px;
  left: 18px;
  max-width: calc(100% - 95px);
  padding: 8px 11px;
  font-size: 12px;
}
.map-key span { display: flex; gap: 7px; align-items: center; }
.map-key b { font-weight: 700; }
.contour-key { width: 13px; height: 12px; border: 1px solid var(--mint); background: #78e5bc38; border-radius: 3px; }
.dot-key { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px #f6c787a8; }
.coordinates {
  position: absolute;
  top: 28px;
  left: 70px;
  padding: 4px 8px;
  color: var(--muted);
  font: 11px/1.2 var(--mono);
}
.pin {
  width: 27px;
  height: 27px;
  border-radius: 50% 50% 50% 3px;
  background: #172722;
  border: 2px solid var(--mint);
  transform: rotate(-45deg);
  box-shadow: 0 0 12px #a3f1ce95, 0 1px 4px #000b;
}
.pin::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--mint); }
#map .maplibregl-ctrl-group { border: 1px solid #49554c; background: #1b231f; box-shadow: 0 4px 18px #0006; }
#map .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
#map .maplibregl-ctrl-group button:hover { background: #303d33; }
#map .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
#map .maplibregl-ctrl-attrib, #map .maplibregl-ctrl-scale { background: #1b231fea; color: var(--ink); }
#map .maplibregl-ctrl-scale { border-color: #92a498; }
#map .maplibregl-ctrl-attrib a { color: var(--muted); }
#map .maplibregl-ctrl-attrib-button { filter: invert(1); }

.results {
  min-width: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  scrollbar-color: #516257 transparent;
  scrollbar-gutter: stable;
}
.summary { padding: 24px 23px 20px; border-bottom: 1px solid var(--line); }
h2 { font-size: 25px; font-weight: 800; line-height: 1.18; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.walk-control { direction: ltr; margin-top: 9px; }
#walk-minutes { display: block; width: 100%; height: 30px; margin: 0; accent-color: var(--mint); cursor: pointer; }
.walk-ticks { display: flex; justify-content: space-between; padding-inline: 2px; color: var(--muted); font: 12px/1 var(--mono); }
.metrics { display: grid; grid-template-columns: 1.3fr 1fr; margin-top: 17px; border-block: 1px solid var(--rule); }
.metrics > div { padding: 12px 12px; min-width: 0; }
.metrics > div:first-child { background: #26342d; border-top: 2px solid var(--mint); }
.metrics > div + div { background: #252923; border-top: 2px solid var(--amber); }
.metrics span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.3; }
.metrics strong {
  display: block;
  margin-top: 5px;
  color: var(--mint);
  font: 700 32px/1.12 var(--mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  white-space: nowrap;
}
.metrics > div + div strong { color: var(--amber); font-size: 25px; }
.metrics small { font: 650 12px/1 Manrope, "Segoe UI", sans-serif; }
:lang(he) .metrics small { font-family: Rubik, "Segoe UI", sans-serif; }
.status { margin-top: 11px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.status:not(:empty)[data-error] { color: #ffad97; }
.status:empty { display: none; }

.vote-section { padding: 17px 23px 19px; text-align: start; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
h3 { font-size: 16px; font-weight: 800; }
.section-title span { font-size: 12px; color: var(--muted); }
.vote-list { margin: 9px 0 0; padding: 0; list-style: none; }
.vote-row { border-bottom: 1px solid var(--rule); }
.party-toggle {
  display: block;
  width: 100%;
  padding: 8px 0 9px;
  background: transparent;
  border: 0;
  border-radius: 4px;
  text-align: start;
  cursor: pointer;
}
.party-toggle:not(:disabled):hover, .party-toggle[aria-pressed="true"] { background: #a3f1ce0d; }
.party-toggle:disabled { cursor: default; }
.party-toggle[aria-pressed="true"] .swatch { outline: 1px solid var(--ink); outline-offset: 2px; }
.vote-label { display: grid; grid-template-columns: 9px minmax(0, 1fr) 59px 46px; gap: 8px; align-items: baseline; font-size: 13px; }
.swatch { align-self: center; width: 7px; height: 7px; border-radius: 50%; background: var(--party); box-shadow: 0 0 7px var(--party); }
.party-name { font-weight: 700; overflow-wrap: anywhere; text-align: match-parent; }
.count, .share { font: 12px/1.3 var(--mono); direction: ltr; text-align: end; }
:lang(he) .count, :lang(he) .share { text-align: left; }
.share { color: var(--muted); }
.track { display: block; height: 3px; margin-top: 6px; margin-inline-start: 17px; border-radius: 2px; background: #333d36; }
.track i { display: block; width: var(--share); height: 100%; border-radius: 2px; background: var(--party); box-shadow: 0 0 6px color-mix(in srgb, var(--party) 62%, transparent); }
.text-button { margin-top: 9px; color: var(--mint); background: transparent; border: 0; padding: 6px 0; font-size: 13px; font-weight: 750; cursor: pointer; }
.text-button:hover { text-decoration: underline; }
.results-note { border-top: 1px solid var(--line); padding: 13px 23px 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.site-links { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 0 23px 18px; font-size: 12px; }
.site-links a { color: var(--mint); text-underline-offset: 3px; }
.results:lang(he) { text-align: right; }

@media (max-width: 720px) {
  :root { --header-height: 64px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .wordmark-text { flex-direction: column; align-items: flex-start; gap: 2px; }
  .header-actions { gap: 6px; }
  h1 { font-size: 17px; }
  .election { min-height: 29px; padding: 2px 4px; font-size: 11px; }
  .language-toggle { min-width: 0; padding: 0 10px; border-radius: 8px; font-size: 13px; }
  .workspace { display: flex; flex-direction: column; height: auto; }
  .map-panel { height: 54svh; min-height: 320px; }
  .map-controls { top: 9px; left: 9px; }
  .map-key { bottom: 36px; left: 9px; }
  .coordinates { top: 20px; left: 61px; }
  .results { border-top: 1px solid var(--line); border-left: 0; overflow: visible; }
  .summary, .vote-section, .results-note, .site-links { padding-inline: 16px; }
  .summary { padding-top: 18px; padding-bottom: 15px; }
  h2 { font-size: 23px; }
  .metrics { margin-top: 12px; }
  .metrics strong { font-size: 27px; }
  .metrics > div + div strong { font-size: 21px; }
}
@media (max-width: 430px) {
  .wordmark .logo { display: none; }
}
@media (max-width: 360px) {
  :root { --header-height: 74px; }
}
