:root {
  --dock-height: 68px;
  --utility-strip-height: 21px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ledger-open-top: 0px;
  --ledger-peek-height: 53px;
  --bg: #05070a;
  --surface: rgba(15, 19, 25, 0.88);
  --surface-strong: rgba(20, 25, 32, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.055);
  --line: rgba(214, 228, 238, 0.17);
  --line-strong: rgba(214, 228, 238, 0.28);
  --ink: #f7f9fc;
  --muted: #aab8c8;
  --blue: #0105b4;
  --blue-bright: #315cff;
  --red: #be1e2d;
  --cream: #f4f0df;
  --header: #a9c3c6;
  --shadow: 0 20px 52px rgba(0, 0, 0, 0.46);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', sans-serif;
}

@media (display-mode: standalone) {
  body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 11000;
    height: env(safe-area-inset-top, 0px);
    background: #020304;
    pointer-events: none;
  }

}

body {
  display: flex;
  min-height: 100dvh;
  height: 100dvh;
  flex-direction: column;
  padding-bottom: calc(var(--dock-height) + var(--utility-strip-height) + var(--safe-bottom));
}

.launch-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 45%, rgba(42, 128, 159, 0.12), transparent 34%),
    #020304;
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms ease, visibility 320ms ease;
}

.launch-screen.is-dismissed {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.launch-content {
  display: grid;
  width: min(240px, 62vw);
  place-items: center;
  gap: 18px;
}

.launch-content img {
  display: block;
  width: min(176px, 46vw);
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 18px 38px rgba(0, 0, 0, 0.72));
}

.launch-content p {
  margin: 0;
  color: rgba(242, 247, 250, 0.76);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.launch-progress {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
}

.launch-progress span {
  display: block;
  width: 46%;
  height: 100%;
  background: linear-gradient(90deg, #ed2f36 0 32%, #2f9659 48% 62%, #2785bd 78% 100%);
  box-shadow: 0 0 18px rgba(47, 150, 89, 0.48);
  animation: launch-scan 1.25s cubic-bezier(0.45, 0, 0.2, 1) infinite;
}

@keyframes launch-scan {
  from { transform: translateX(-115%); }
  to { transform: translateX(235%); }
}

html[data-theme='light'] {
  --bg: #e8efef;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: rgba(248, 251, 251, 0.98);
  --surface-soft: rgba(24, 45, 57, 0.07);
  --line: rgba(31, 54, 67, 0.16);
  --line-strong: rgba(31, 54, 67, 0.28);
  --ink: #122331;
  --muted: #536776;
  --shadow: 0 18px 42px rgba(28, 49, 58, 0.16);
}

html[data-theme='light'] .paper-grain {
  background: #e8efef;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: #05070a;
}

.masthead {
  position: relative;
  flex: 0 0 clamp(130px, 11vw, 190px);
  height: clamp(130px, 11vw, 190px);
  width: 100%;
  margin: 0 0 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-width: 0 0 1px;
  border-radius: 0;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.24), transparent 34%),
    linear-gradient(135deg, #9fc4c4 0%, #83afb3 52%, #99bec0 100%);
  box-shadow: var(--shadow);
}

.masthead::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(90deg, rgba(1, 5, 180, 0.08), transparent 28%, transparent 72%, rgba(190, 30, 45, 0.1));
}

.masthead::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  box-shadow: inset 0 -22px 38px rgba(5, 7, 10, 0.12);
}

.masthead-stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.82;
  pointer-events: none;
}

.masthead-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.2vw, 42px);
  width: 100%;
  height: 100%;
  padding: 3px clamp(4px, 0.8vw, 14px);
}

.masthead-animal,
.masthead-wordmark {
  display: block;
  position: relative;
  max-width: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 10px 10px rgba(17, 27, 35, 0.14));
}

.masthead-animal {
  position: relative;
  top: auto;
  z-index: 2;
  flex: 0 1 auto;
  width: auto;
  height: calc(100% - 6px);
  max-width: none;
}

.masthead-donkey {
  left: auto;
  object-position: left center;
}

.masthead-wordmark {
  position: relative;
  left: auto;
  z-index: 3;
  flex: 0 1 auto;
  width: auto;
  height: 86%;
  max-width: 64%;
  aspect-ratio: 1415 / 427;
  transform: none;
}

.masthead-wordmark-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.masthead-wordmark-black {
  clip-path: inset(80% 0 0 0);
  filter: brightness(0);
}

.masthead-elephant {
  right: auto;
  object-position: right center;
}

.control-drawer {
  position: fixed;
  right: 0;
  bottom: calc(-1 * min(72dvh, 680px));
  left: 0;
  z-index: 9000;
  width: 100%;
  max-height: min(72dvh, 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--line-strong);
  border-radius: 24px 24px 0 0;
  background: #070a0e;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.58);
  isolation: isolate;
  pointer-events: none;
  transform: none;
  visibility: hidden;
  transition: bottom 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 220ms;
}

.control-drawer.open {
  bottom: calc(var(--dock-height) + var(--utility-strip-height) + var(--safe-bottom));
  pointer-events: auto;
  visibility: visible;
  transition: bottom 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme='light'] .control-drawer,
html[data-theme='light'] .drawer-head {
  background: rgba(247, 251, 250, 0.97);
}

.drawer-handle {
  position: sticky;
  top: 0;
  z-index: 3;
  width: 42px;
  height: 5px;
  margin: 9px auto -10px;
  border-radius: 999px;
  background: rgba(170, 184, 200, 0.58);
}

body.drawer-open {
  overflow: hidden;
}

body.drawer-open::after {
  display: none;
}

.control-drawer button,
.control-drawer input,
.control-drawer select,
.control-drawer summary,
.control-drawer a {
  position: relative;
  pointer-events: auto;
  touch-action: manipulation;
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 14, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.drawer-head h2,
.panel-bar h2,
.ledger h2 {
  margin: 3px 0 0;
  font: 700 1.28rem/1.1 'Sora', sans-serif;
  letter-spacing: -0.025em;
}

.drawer-close {
  width: 42px;
  height: 42px;
  padding: 0 0 3px;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
}

.controls {
  display: grid;
  gap: 16px;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 20px 28px;
}

.controls > details,
.controls > .inline-check {
  grid-column: 1 / -1;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.range-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-label strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.inline-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.inline-check input {
  width: 19px;
  height: 19px;
  min-height: 19px;
  padding: 0;
  border-radius: 6px;
}

.inline-check input:checked {
  border-color: var(--blue-bright);
  background: var(--blue-bright);
  box-shadow: inset 0 0 0 4px #10141b;
}

.settings-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.settings-group summary {
  padding: 15px 16px;
  cursor: pointer;
  color: #dce5ef;
  font-size: 0.84rem;
  font-weight: 800;
  list-style: none;
}

html[data-theme='light'] .settings-group summary,
html[data-theme='light'] .party-key,
html[data-theme='light'] .footer strong {
  color: var(--ink);
}

.settings-group summary::-webkit-details-marker {
  display: none;
}

.settings-group summary::after {
  content: '+';
  float: right;
  color: var(--muted);
  font-size: 1rem;
}

.settings-group[open] summary::after {
  content: '-';
}

.settings-body {
  display: grid;
  gap: 12px;
  padding: 2px 14px 14px;
}

.location-field {
  position: relative;
}

.location-suggestions {
  position: absolute;
  top: calc(100% + 3px);
  right: 0;
  left: 0;
  z-index: 12;
  display: none;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  background: #10151c;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.48);
}

.location-suggestions.open {
  display: block;
}

html[data-theme='light'] .location-suggestions {
  background: #f8fbfb;
}

.location-option {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  white-space: normal;
  font-size: 0.76rem;
  line-height: 1.3;
}

.location-option:last-child {
  border-bottom: 0;
}

.location-option:hover,
.location-option:focus-visible {
  transform: none;
  background: var(--surface-soft);
}

.drawer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

input,
select,
button {
  appearance: none;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font: 650 0.9rem/1.2 'Manrope', sans-serif;
  padding: 11px 12px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23aab8c8' stroke-width='2' d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

input:focus,
select:focus,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(49, 92, 255, 0.75);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  background: var(--red);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 800;
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.secondary-button,
.drawer-close {
  background: rgba(255, 255, 255, 0.07);
}

input[type='range'] {
  height: 7px;
  min-height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue-bright);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.layout {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  gap: 12px;
  padding: 12px;
}

.map-panel,
.ledger {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-panel {
  display: flex;
  flex-direction: column;
}

.panel-bar,
.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.panel-bar {
  position: relative;
  z-index: 1300;
  justify-content: stretch;
  min-height: 30px;
  padding: 3px 12px;
  overflow: visible;
  text-align: center;
}

.ledger-head {
  border-bottom: 0;
}

.panel-titleline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.panel-location-search {
  position: relative;
  display: flex;
  width: min(206px, 93.5%);
  min-width: 0;
  height: 24px;
  align-items: stretch;
}

.panel-location-search input {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  height: 24px;
  padding: 3px 7px;
  border-color: rgba(214, 228, 238, 0.24);
  border-right: 0;
  background: rgba(255, 255, 255, 0.075);
  color: var(--ink);
  font-size: 0.66rem;
  line-height: 1;
}

.panel-location-search input::placeholder {
  color: rgba(170, 184, 200, 0.84);
}

.panel-location-search > button {
  width: 28px;
  min-width: 28px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border-color: rgba(214, 228, 238, 0.24);
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  font-size: 0.7rem;
  line-height: 1;
}

.panel-location-search .location-suggestions {
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  width: min(340px, calc(100vw - 14px));
  text-align: left;
}

.panel-titleline h2 {
  margin: 0;
  white-space: nowrap;
}

.panel-edge-left {
  justify-self: start;
  text-align: left;
}

.panel-mode {
  align-self: center;
  justify-self: center;
  font-size: 0.9rem;
  line-height: 1;
  text-align: center;
}

.panel-edge-right {
  justify-self: end;
  text-align: right;
}

.title-separator {
  color: var(--muted);
  font-weight: 800;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #39d98a;
  box-shadow: 0 0 0 4px rgba(57, 217, 138, 0.12);
}

.party-key {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #d8e1eb;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 7px 10px;
}

.scope-summary {
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #69ff9a;
  font-size: calc(0.72rem + 2px);
  font-weight: 900;
  letter-spacing: 0.025em;
  text-shadow: 0 0 8px rgba(105, 255, 154, 0.58);
  text-transform: uppercase;
}

.scope-summary::after {
  content: "\25BE";
  display: inline-block;
  margin-left: 4px;
  font-size: 0.78em;
  line-height: 1;
  transform: translateY(-1px);
}

.scope-summary:disabled::after {
  display: none;
}

.scope-summary:hover,
.scope-summary:focus-visible,
.scope-summary[aria-expanded='true'] {
  transform: none;
  background: transparent;
  color: #9dffbc;
  filter: none;
  text-shadow: 0 0 12px rgba(105, 255, 154, 0.9);
}

.scope-summary:disabled {
  cursor: default;
  color: var(--muted);
  opacity: 1;
  text-shadow: none;
}

.quick-radius-wrap {
  position: static;
}

.quick-radius-popover {
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  z-index: 1200;
  width: min(340px, calc(100vw - 16px));
  padding: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 11, 15, 0.98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -7px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.quick-radius-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

html[data-theme='light'] .quick-radius-popover {
  background: rgba(248, 251, 251, 0.99);
}

.quick-radius-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-radius-heading strong {
  color: #69ff9a;
  font-size: 0.84rem;
  text-shadow: 0 0 8px rgba(105, 255, 154, 0.5);
}

.quick-radius-popover input[type='range'] {
  display: block;
  width: 100%;
  margin: 0 0 14px;
}

.radius-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.radius-presets button {
  min-height: 36px;
  padding: 6px 3px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.7rem;
}

.radius-presets button:hover,
.radius-presets button:focus-visible {
  transform: none;
  border-color: #69ff9a;
  filter: none;
}

.ledger-meta {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-direction: column;
}

.data-summary {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.party-key i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 3px 0 5px;
  border-radius: 50%;
}

.dem-key {
  background: var(--blue-bright);
}

.rep-key {
  background: var(--red);
}

.map {
  flex: 1 1 auto;
  min-height: 0;
  background: #11161d;
}

.terracivic-draw-control {
  margin-top: 10px !important;
}

.terracivic-draw-control button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 5px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #333;
  cursor: pointer;
}

.terracivic-draw-control button:hover,
.terracivic-draw-control button:focus-visible {
  background: #f4f4f4;
  color: #0105b4;
}

.terracivic-draw-control svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.leaflet-container.freehand-drawing {
  cursor: crosshair;
  overscroll-behavior: contain;
  touch-action: none;
}

.freehand-capture {
  position: absolute;
  inset: 0;
  z-index: 1200;
  cursor: crosshair;
  overscroll-behavior: contain;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.freehand-capture::before {
  content: "Drag one continuous outline";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  background: rgba(7, 9, 13, 0.82);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

.map-notice {
  position: absolute;
  top: 46px;
  left: 50%;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100% - 32px));
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 15px;
  background: rgba(8, 12, 17, 0.88);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateX(-50%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.notice-action {
  display: none;
  min-height: 36px;
  margin-left: auto;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.72rem;
  white-space: nowrap;
}

.map-notice.can-use-center .notice-action {
  display: block;
}

.map-notice.is-hidden {
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -8px);
}

.map-notice strong,
.map-notice small {
  display: block;
}

.map-notice strong {
  font-size: 0.86rem;
}

.map-notice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.locator-ring {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 3px solid rgba(49, 92, 255, 0.25);
  border-top-color: #4b72ff;
  border-radius: 50%;
  animation: locator-spin 1.1s linear infinite;
}

@keyframes locator-spin {
  to { transform: rotate(360deg); }
}

.ledger {
  display: flex;
  flex-direction: column;
}

.ledger-drawer-handle {
  display: none;
}

.ledger h2 {
  font-size: 1.18rem;
}

.status {
  margin: 0;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.results {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  margin-top: 14px;
  color: var(--ink);
  font: 700 0.95rem/1.3 'Sora', sans-serif;
}

.empty-state p {
  max-width: 250px;
  margin: 7px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  font: 800 0.84rem/1 'Sora', sans-serif;
  letter-spacing: 0.08em;
}

.status-monogram {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.38));
}

.status-monogram-small {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.empty-state.is-loading .status-monogram,
.status-monogram-small.is-loading {
  animation:
    tc-fade-in 700ms ease-out both,
    tc-loading-breathe 2.2s 700ms ease-in-out infinite;
}

@keyframes tc-fade-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 0.82;
    transform: scale(1);
  }
}

@keyframes tc-loading-breathe {
  0%, 100% {
    opacity: 0.48;
    transform: scale(0.985);
  }
  50% {
    opacity: 1;
    transform: scale(1.015);
  }
}

.result-card {
  position: relative;
  margin: 0 0 6px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.04);
}

.result-card.marker-selected {
  border-color: rgba(104, 255, 173, 0.78);
  background: rgba(104, 255, 173, 0.08);
  box-shadow: 0 0 0 2px rgba(104, 255, 173, 0.16), 0 12px 30px rgba(0, 0, 0, 0.28);
}

.result-summary {
  display: block;
  padding: 8px 10px 8px 13px;
  cursor: pointer;
  list-style: none;
}

.result-summary::-webkit-details-marker {
  display: none;
}

.result-summary::marker {
  content: '';
}

.result-summary:hover,
.result-summary:focus-visible {
  background: rgba(255, 255, 255, 0.025);
  outline: none;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--line-strong);
}

.result-card.dem::before {
  background: var(--blue-bright);
}

.result-card.rep::before {
  background: var(--red);
}

.result-card.mixed::before {
  background: linear-gradient(to bottom, #0105b4 0 46%, #fff 46% 54%, #BE1E2D 54% 100%);
}

.result-card h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font: 700 0.82rem/1.2 'Sora', sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-primary-row,
.result-donation-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.result-primary-row {
  margin-bottom: 6px;
}

.result-distance {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.compact-donation-results {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.compact-party {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.compact-party strong {
  font-size: 0.7rem;
}

.compact-party.dem {
  color: #8399ff;
}

.compact-party.rep {
  color: #ff7380;
}

.meta {
  color: #bac6d4;
  font-size: 0.76rem;
  line-height: 1.46;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce3ec;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 8px;
}

.chip.dem {
  border-color: rgba(49, 92, 255, 0.5);
  background: rgba(1, 5, 180, 0.3);
  color: #e6ebff;
}

.chip.rep {
  border-color: rgba(190, 30, 45, 0.55);
  background: rgba(190, 30, 45, 0.28);
  color: #ffe8ea;
}

.evidence-row {
  margin-top: 8px;
}

.evidence-note {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.42;
}

.evidence-cta {
  display: flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  color: #8fa9ff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.evidence-cta i {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
}

.evidence-cta i::before,
.evidence-cta i::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 1px;
  width: 11px;
  height: 1.5px;
  background: currentColor;
  transition: transform 160ms ease;
}

.evidence-cta i::after {
  transform: rotate(90deg);
}

.result-card[open] .evidence-cta i::after {
  transform: rotate(0deg);
}

.result-evidence {
  padding: 12px 13px 14px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.expanded-overview {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.source-scope {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.source-scope span {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-scope strong {
  color: var(--ink);
  font-size: 0.66rem;
  line-height: 1.35;
  text-align: right;
}

.result-evidence h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font: 700 0.76rem/1.3 'Sora', sans-serif;
}

.result-evidence dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.result-evidence dl > div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
}

.result-evidence dt {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.result-evidence dd {
  margin: 0;
  color: #d8e1eb;
  font-size: 0.69rem;
  line-height: 1.4;
}

.source-actions {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.source-actions a {
  display: block;
  padding: 9px 10px;
  border: 1px solid rgba(49, 92, 255, 0.42);
  background: rgba(49, 92, 255, 0.1);
  color: #b8c6ff;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.3;
  text-decoration: none;
}

.source-actions a:hover,
.source-actions a:focus-visible {
  border-color: #6f8cff;
  color: #eef1ff;
}

.source-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.42;
}

.donor-marker-shell {
  background: transparent;
  border: 0;
}

.donor-map-dot {
  display: block;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 1.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
}

.donor-map-dot.dem {
  background: #0105b4;
}

.donor-map-dot.rep {
  background: #BE1E2D;
}

.donor-map-dot.mixed {
  background: linear-gradient(90deg, #0105b4 0 44%, #fff 44% 56%, #BE1E2D 56% 100%);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 0 0 var(--footer-height);
  min-height: var(--footer-height);
  margin: 0 12px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 19, 25, 0.72);
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.2;
  text-align: center;
}

html[data-theme='light'] .footer {
  background: rgba(255, 255, 255, 0.8);
}

.footer-link {
  min-height: 28px;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #b9c8ff;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: underline;
  text-decoration-color: rgba(185, 200, 255, 0.42);
  text-underline-offset: 3px;
}

.footer-link:hover,
.footer-link:focus-visible {
  transform: none;
  background: transparent;
  color: #eef1ff;
  filter: none;
}

.info-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(76dvh, 680px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
}

.info-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.info-dialog-shell {
  display: flex;
  max-height: min(76dvh, 680px);
  flex-direction: column;
}

.info-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.info-dialog-head h2 {
  margin: 3px 0 0;
  font: 700 1.05rem/1.2 'Sora', sans-serif;
}

.info-dialog-close {
  flex: 0 0 auto;
  width: 38px;
  min-height: 38px;
  padding: 0 0 3px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.info-dialog-body {
  display: grid;
  gap: 18px;
  overflow-y: auto;
  padding: 18px;
}

.info-dialog-body section {
  display: grid;
  gap: 6px;
}

.info-dialog-body h3 {
  margin: 0;
  color: var(--ink);
  font: 700 0.82rem/1.3 'Sora', sans-serif;
}

.info-dialog-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.55;
}

.info-source-links {
  display: grid;
  gap: 7px;
}

.info-source-links a {
  padding: 10px 11px;
  border: 1px solid rgba(49, 92, 255, 0.42);
  background: rgba(49, 92, 255, 0.1);
  color: #b9c8ff;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
}

.app-dock {
  position: fixed;
  right: 0;
  bottom: calc(var(--utility-strip-height) + var(--safe-bottom));
  left: 0;
  z-index: 2200;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: var(--dock-height);
  padding: 5px max(8px, env(safe-area-inset-right, 0px)) 5px max(8px, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--line-strong);
  background: rgba(7, 10, 14, 0.92);
  box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

html[data-theme='light'] .app-dock {
  background: rgba(248, 251, 251, 0.94);
  box-shadow: 0 -10px 30px rgba(28, 49, 58, 0.16);
}

.utility-strip {
  position: fixed;
  right: 0;
  bottom: var(--safe-bottom);
  left: 0;
  z-index: 2300;
  display: flex;
  height: var(--utility-strip-height);
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-top: 1px solid rgba(214, 228, 238, 0.14);
  background: #020304;
  color: rgba(170, 184, 200, 0.74);
  font-size: 0.5rem;
  line-height: 1;
}

.utility-strip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  height: var(--safe-bottom);
  background: #020304;
  pointer-events: none;
}

.utility-build,
.utility-divider,
.utility-faq {
  position: relative;
  top: 3px;
  white-space: nowrap;
}

.utility-faq {
  min-height: 0;
  padding: 2px 3px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #b9c8ff;
  font: 800 0.5rem/1 'Manrope', sans-serif;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.utility-faq:hover,
.utility-faq:focus-visible {
  transform: none;
  filter: none;
  color: #fff;
}

.utility-faq-preview {
  position: absolute;
  right: 8px;
  bottom: calc(100% + 6px);
  display: grid;
  width: min(310px, calc(100vw - 16px));
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: rgba(12, 16, 22, 0.98);
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.35;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.utility-faq-preview strong {
  color: var(--ink);
}

.utility-faq:hover + .utility-faq-preview,
.utility-faq:focus-visible + .utility-faq-preview {
  opacity: 1;
  transform: translateY(0);
}

.dock-action {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 56px;
  padding: 4px 2px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 0.62rem;
}

.dock-action:hover {
  transform: none;
  filter: none;
}

.dock-action[aria-pressed='true'],
.dock-action[aria-expanded='true'] {
  color: var(--ink);
  background: var(--surface-soft);
}

.dock-action-primary {
  color: var(--ink);
}

.dock-icon {
  width: 22px;
  height: 22px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-label {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-settings-icon {
  display: grid;
  gap: 4px;
  width: 24px;
  height: 22px;
  place-content: center;
}

.dock-settings-icon i {
  display: block;
  width: 24px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
}

.build-stamp {
  margin-left: 0;
  color: rgba(170, 184, 200, 0.72);
  white-space: nowrap;
}

.drawer-build {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  white-space: nowrap;
}

.visible-build {
  color: rgba(170, 184, 200, 0.82);
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.leaflet-container {
  font-family: 'Manrope', sans-serif;
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(var(--dock-height) + var(--utility-strip-height) + var(--safe-bottom));
  }

  .masthead {
    flex-basis: clamp(110px, 15vw, 150px);
    height: clamp(110px, 15vw, 150px);
    margin: 0 0 3px;
    border-radius: 0;
  }

  .masthead-stage {
    gap: clamp(8px, 1.8vw, 18px);
    padding: 3px 4px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 0;
    gap: 1px;
  }

  .map-panel {
    height: 100%;
    min-height: 0;
    border-radius: 0;
  }

  .ledger {
    position: fixed;
    top: var(--ledger-open-top);
    right: 0;
    bottom: calc(var(--dock-height) + var(--utility-strip-height) + var(--safe-bottom));
    left: 0;
    z-index: 2100;
    height: auto;
    max-height: none;
    border-width: 1px 0 0;
    border-radius: 0;
    background: #0e1319;
    transform: translateY(calc(100% - var(--ledger-peek-height)));
    transition: transform 240ms cubic-bezier(0.2, 0.75, 0.25, 1);
    will-change: transform;
  }

  html[data-theme='light'] .ledger {
    background: #f8fbfb;
  }

  .ledger.drawer-open {
    transform: translateY(0);
  }

  .ledger-drawer-handle {
    position: absolute;
    top: 0;
    left: 50%;
    z-index: 2;
    display: grid;
    width: 78px;
    min-height: 28px;
    padding: 0;
    place-items: center;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: translateX(-50%);
    touch-action: none;
  }

  .ledger-drawer-handle:hover,
  .ledger-drawer-handle:focus-visible {
    filter: none;
    transform: translateX(-50%);
  }

  .ledger-drawer-handle span {
    display: block;
    width: 34px;
    height: 4px;
    border-radius: 999px !important;
    background: rgba(213, 224, 233, 0.56);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28);
  }

  .ledger-head {
    padding-top: 22px;
  }

  .panel-bar {
    min-height: 30px;
    padding: 3px 10px;
  }

  .panel-bar h2,
  .ledger h2 {
    font-size: 1.05rem;
  }

  .footer {
    display: none;
  }

  .control-drawer {
    bottom: -76dvh;
  }

  .control-drawer.open {
    bottom: calc(var(--dock-height) + var(--utility-strip-height) + var(--safe-bottom));
  }

  .app-dock {
    height: var(--dock-height);
    bottom: calc(var(--utility-strip-height) + var(--safe-bottom));
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) 4px max(8px, env(safe-area-inset-left, 0px));
  }

  .masthead,
  .map-panel,
  .ledger,
  .panel-bar,
  .ledger-head,
  .map,
  .map-notice,
  .notice-action,
  .scope-summary,
  .party-key,
  .results,
  .empty-state,
  .empty-mark,
  .result-card,
  .chip,
  .footer,
  .info-dialog,
  .info-dialog-close,
  .control-drawer,
  .settings-group,
  .inline-check,
  .drawer-close,
  .dock-action,
  input,
  select,
  button {
    border-radius: 0 !important;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .controls > details,
  .controls > .inline-check {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .masthead {
    flex-basis: 92px;
    height: 92px;
  }

  .masthead-stage {
    gap: 7px;
    padding: 3px 2px;
  }

  .masthead-animal {
    top: auto;
    height: calc(100% - 6px);
    max-width: none;
  }

  .masthead-wordmark {
    width: auto;
    height: 70%;
    max-width: 57%;
  }

  .control-drawer {
    max-height: 76dvh;
    border-radius: 0;
  }

  .dock-action {
    font-size: 0.58rem;
  }
}

@media (max-width: 520px) {
  .panel-bar {
    min-height: 30px;
    padding: 3px 7px;
  }

  .panel-titleline {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    white-space: normal;
  }

  .title-separator {
    display: none;
  }

  .scope-summary {
    min-height: 24px;
    padding: 0;
    font-size: clamp(0.665rem, 2.95vw, 0.755rem);
    white-space: nowrap;
  }

  .panel-titleline h2 {
    justify-self: start;
    font-size: clamp(0.72rem, 3.4vw, 0.86rem);
  }

  .panel-titleline .eyebrow {
    justify-self: start;
    font-size: clamp(0.5rem, 2.25vw, 0.58rem);
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  .quick-radius-wrap {
    justify-self: center;
  }

  .panel-location-search {
    justify-self: end;
    width: min(222px, 100%);
  }

  .panel-location-search input {
    padding-right: 4px;
    padding-left: 5px;
    font-size: clamp(0.52rem, 2.25vw, 0.62rem);
  }

  .panel-location-search > button {
    width: 25px;
    min-width: 25px;
  }

  .party-key {
    display: none;
  }

  .map-notice {
    flex-wrap: wrap;
  }

  .notice-action {
    width: 100%;
    margin-left: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (display-mode: standalone) {
  html,
  body {
    min-height: 100vh;
    height: 100vh;
  }

  body {
    padding-top: 0;
  }

  .masthead {
    margin-top: env(safe-area-inset-top, 0px);
  }
}
