
:root {
  --flag-black: #000000;
  --flag-red: #CE1126;
  --flag-green: #339E35;
  --ink: #14110f;
  --ink-soft: #4b403c;
  --paper: #fff8e6;
  --paper-strong: #fff3cf;
  --panel: rgba(255, 248, 230, 0.96);
  --panel-solid: #fff8e6;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  --soft-shadow: 0 8px 28px rgba(0,0,0,0.18);
  --border: rgba(20,17,15,0.14);
  --map-z: 1;
  --header-z: 650;
  --control-z: 760;
  --sheet-z: 900;
  --modal-z: 1300;
  --header-h: 92px;
  color-scheme: light;
  font-family: "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: #191310;
  color: var(--ink);
  overflow: hidden;
}

body {
  min-height: 100dvh;
  overscroll-behavior: none;
}

a {
  color: #8d0716;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  transform: translateY(-140%);
  background: var(--paper-solid);
  color: var(--ink);
  z-index: calc(var(--modal-z) + 1);
  padding: 10px 12px;
  border-radius: 999px;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background:
    radial-gradient(circle at 50% 16%, rgba(206,17,38,0.14), transparent 45%),
    linear-gradient(180deg, rgba(255,248,230,0.98), rgba(255,248,230,0.92));
  box-shadow: 0 10px 32px rgba(0,0,0,0.22);
  z-index: var(--header-z);
  border-bottom: 1px solid rgba(0,0,0,0.16);
}

.flag-ribbon {
  position: absolute;
  inset: 0 0 auto 0;
  height: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  overflow: hidden;
}

.band-black { background: var(--flag-black); }
.band-red { background: var(--flag-red); }
.band-green { background: var(--flag-green); }

.rising-sun {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 106px;
  height: 48px;
  transform: translateX(-50%);
  opacity: 0.97;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.1));
}

.title-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px 14px 8px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a101d;
}

h1 {
  margin: 0;
  line-height: 0.96;
  font-size: clamp(1.08rem, 4.8vw, 2.0rem);
  letter-spacing: -0.045em;
  color: var(--ink);
}

h1 span {
  letter-spacing: -0.035em;
}

.title-info-trigger {
  display: block;
  width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.title-info-trigger:focus-visible {
  outline: 3px solid rgba(206,17,38,0.38);
  outline-offset: 4px;
  border-radius: 10px;
}

.title-text {
  display: block;
  margin: 0;
  line-height: 0.96;
  font-size: clamp(1.08rem, 4.8vw, 2.0rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  color: var(--ink);
}

.title-text span {
  letter-spacing: -0.035em;
}

.subtitle {
  margin: 4px auto 0;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: clamp(0.69rem, 2.25vw, 0.86rem);
  line-height: 1.18;
}

.map-shell {
  position: fixed;
  inset: 0;
  isolation: isolate;
}

#map {
  position: absolute;
  inset: 0;
  z-index: var(--map-z);
  background: #efe3c9;
}

.basemap-muted {
  filter: grayscale(32%) sepia(10%) saturate(0.72) brightness(1.04) contrast(0.92);
}

.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 248, 230, 0.78) !important;
  color: rgba(20,17,15,0.86) !important;
  max-width: min(78vw, 520px);
  line-height: 1.2;
  border-top-left-radius: 8px;
  padding: 2px 6px !important;
}

.leaflet-container {
  font-family: "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.leaflet-popup-pane {
  z-index: 520;
}

.leaflet-popup {
  margin-bottom: 18px;
}

.leaflet-popup-content-wrapper {
  border-radius: 18px;
  overflow: hidden;
  padding: 0;
  background: var(--panel-solid);
  border: 1px solid rgba(0,0,0,0.16);
  box-shadow: 0 18px 50px rgba(0,0,0,0.32);
}

.leaflet-popup-content {
  width: min(82vw, 330px) !important;
  margin: 0;
}

.leaflet-popup-tip {
  background: var(--panel-solid);
}

.popup-card {
  max-height: min(67dvh, 560px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  color: var(--ink);
}

.popup-head {
  background:
    linear-gradient(90deg, var(--flag-black) 0 33%, var(--flag-red) 33% 66%, var(--flag-green) 66% 100%);
  color: #fff8e6;
  padding: 12px 14px 10px;
  position: relative;
}

.popup-head::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 0;
  width: 54px;
  height: 24px;
  background:
    radial-gradient(circle at 50% 100%, var(--flag-red) 0 8px, transparent 8.5px),
    repeating-conic-gradient(from -90deg at 50% 100%, var(--flag-red) 0 6deg, transparent 6deg 12deg);
  opacity: 0.98;
}

.popup-head h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 1.07rem;
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: calc(100% - 62px);
}

.popup-meta {
  padding: 11px 14px 0;
  display: grid;
  gap: 7px;
  font-size: 0.84rem;
  line-height: 1.25;
}

.popup-meta strong {
  color: #251813;
}

.role-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 999px;
  padding: 4px 9px 4px 6px;
  background: #fffdf6;
  font-weight: 800;
}

.role-dot {
  width: 13px;
  height: 13px;
  display: inline-block;
  border-radius: 50%;
  border: 2px solid var(--role-stroke, #fff8e6);
  background: var(--role-color, #CE1126);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18);
}

.popup-photo {
  margin: 12px 14px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.15);
  background: #1c1715;
}

.popup-photo img {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  background: #111;
}

.popup-photo figcaption {
  padding: 5px 8px 7px;
  font-size: 0.62rem;
  line-height: 1.22;
  color: rgba(255, 248, 230, 0.82);
}

.popup-photo a {
  color: #ffe497;
}

.popup-body {
  padding: 11px 14px 14px;
  font-size: 0.84rem;
  line-height: 1.42;
}

.popup-body p {
  margin: 0 0 10px;
}

.popup-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(0,0,0,0.12);
}

.popup-list div {
  display: grid;
  grid-template-columns: 6.7rem minmax(0, 1fr);
  gap: 7px;
}

.popup-list dt {
  font-weight: 850;
  color: #39251e;
}

.popup-list dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

.offset-note {
  margin-top: 9px;
  padding: 8px 9px;
  border-radius: 11px;
  background: rgba(206,17,38,0.08);
  color: #5c1c21;
  font-size: 0.73rem;
  line-height: 1.25;
}

.loader {
  position: absolute;
  inset: 0;
  z-index: calc(var(--control-z) + 20);
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.08), rgba(0,0,0,0.15));
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-card {
  width: min(82vw, 340px);
  border-radius: 24px;
  padding: 22px 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--border);
}

.loader-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 1rem;
}

.loader-card span {
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.loader-sun {
  width: 44px;
  height: 22px;
  margin: 0 auto;
  background:
    radial-gradient(circle at 50% 100%, var(--flag-red) 0 9px, transparent 9.5px),
    repeating-conic-gradient(from -90deg at 50% 100%, var(--flag-red) 0 5deg, transparent 5deg 11deg);
}

.fab,
.legend-toggle,
.source-pill,
.unmapped-pill {
  position: absolute;
  z-index: var(--control-z);
  border: 0;
  box-shadow: var(--soft-shadow);
  cursor: pointer;
}

.menu-fab {
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-width: 132px;
  height: 54px;
  border-radius: 999px;
  background: #15100e;
  color: var(--paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 850;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255,255,255,0.14);
}

.menu-fab span[aria-hidden] {
  font-size: 1.17rem;
  line-height: 1;
}

.fab-label {
  font-size: 0.94rem;
}

.legend-toggle {
  left: 12px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  border-radius: 999px;
  padding: 11px 12px;
  min-height: 44px;
  background: rgba(255,248,230,0.96);
  color: var(--ink);
  font-weight: 850;
  border: 1px solid rgba(0,0,0,0.14);
}

.source-pill {
  right: 12px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  border-radius: 999px;
  padding: 11px 12px;
  min-height: 44px;
  background: rgba(255,248,230,0.96);
  color: var(--ink);
  font-weight: 850;
  border: 1px solid rgba(0,0,0,0.14);
}

.unmapped-pill {
  left: 12px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  border-radius: 999px;
  padding: 10px 12px;
  min-height: 44px;
  background: rgba(255,248,230,0.96);
  color: var(--ink);
  font-weight: 850;
  border: 1px solid rgba(0,0,0,0.14);
}

.unmapped-pill span {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  height: 1.5rem;
  margin-left: 5px;
  border-radius: 999px;
  background: rgba(206,17,38,0.12);
  color: var(--flag-red);
  font-size: 0.76rem;
}

.unmapped-pill.has-records span {
  background: var(--flag-red);
  color: #fff8e6;
}

.legend-card {
  position: absolute;
  z-index: calc(var(--control-z) + 8);
  left: 12px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  width: min(78vw, 310px);
  max-height: 42dvh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 18px;
  padding: 12px;
  transform: translateY(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.legend-card.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.legend-header,
.sheet-header,
.filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.legend-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.legend-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.83rem;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid var(--stroke);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18);
}

.legend-count {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 800;
}

.icon-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.58);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.filter-sheet {
  position: absolute;
  z-index: var(--sheet-z);
  left: 0;
  right: 0;
  bottom: 0;
  height: min(82dvh, 760px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 24% 0%, rgba(206,17,38,0.12), transparent 34%),
    var(--panel-solid);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  box-shadow: 0 -22px 60px rgba(0,0,0,0.32);
  border: 1px solid rgba(0,0,0,0.14);
  transform: translateY(105%);
  transition: transform 240ms cubic-bezier(.2,.8,.2,1);
  padding-bottom: env(safe-area-inset-bottom);
}

.filter-sheet.is-open {
  transform: translateY(0);
}

.sheet-handle {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: rgba(20,17,15,0.26);
  margin: 9px auto 4px;
  flex: 0 0 auto;
}

.sheet-header {
  flex: 0 0 auto;
  padding: 4px 16px 10px 18px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.sheet-header h2 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.025em;
}

.result-count {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.sheet-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 22px;
  overscroll-behavior: contain;
}

.search-label,
.filter-heading span:first-child,
.people-list-wrap h3 {
  font-weight: 900;
  color: #241914;
}

.search-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.83rem;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 16px;
  background: #fffdf6;
  padding: 12px 46px 12px 13px;
  color: var(--ink);
  outline: none;
}

.search-box input:focus {
  border-color: var(--flag-red);
  box-shadow: 0 0 0 4px rgba(206,17,38,0.14);
}

.small-clear {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(20,17,15,0.08);
  color: var(--ink-soft);
  font-weight: 900;
  cursor: pointer;
}

.filter-block {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.filter-heading {
  margin-bottom: 7px;
  font-size: 0.83rem;
}

.filter-heading output,
.hint {
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 750;
}

.range-grid {
  display: grid;
  gap: 8px;
}

.range-grid label {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 800;
}

input[type="range"] {
  --p: 0%;
  --range-track: rgba(20,17,15,0.18);
  --range-thumb: var(--flag-red);
  width: 100%;
  height: 34px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

input[type="range"].range-from {
  background: linear-gradient(to right, var(--range-track) 0 var(--p), var(--flag-red) var(--p) 100%);
  background-size: 100% 8px;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 999px;
}

input[type="range"].range-to {
  background: linear-gradient(to right, var(--flag-red) 0 var(--p), var(--range-track) var(--p) 100%);
  background-size: 100% 8px;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 27px;
  height: 27px;
  margin-top: -9.5px;
  border-radius: 50%;
  background: var(--range-thumb);
  border: 2px solid var(--flag-red);
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
}

input[type="range"]::-moz-range-thumb {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--range-thumb);
  border: 2px solid var(--flag-red);
  box-shadow: 0 2px 10px rgba(0,0,0,0.22);
}

input[type="range"]:focus-visible {
  outline: 3px solid rgba(206,17,38,0.28);
  outline-offset: 3px;
}

.location-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.location-chip {
  min-height: 50px;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 9px;
  border-radius: 15px;
  border: 1px solid rgba(0,0,0,0.14);
  padding: 9px 11px;
  background: #fffdf6;
  cursor: pointer;
  touch-action: manipulation;
}

.location-chip input {
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: var(--flag-red);
}

.location-chip strong {
  display: block;
  font-size: 0.84rem;
  line-height: 1.1;
}

.location-chip small {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
}

.location-chip:has(input:checked) {
  border-color: rgba(206,17,38,0.72);
  background: linear-gradient(90deg, rgba(206,17,38,0.08), rgba(51,158,53,0.07));
  box-shadow: inset 0 0 0 1px rgba(206,17,38,0.18);
}

@supports not selector(:has(*)) {
  .location-chip {
    background: #fffdf6;
  }
}

.role-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.role-chip {
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px 18px 1fr auto;
  align-items: center;
  gap: 8px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.14);
  padding: 8px 10px;
  background: #fffdf6;
  cursor: pointer;
}

.role-chip input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--flag-red);
}

.role-chip .name {
  font-size: 0.82rem;
  font-weight: 850;
}

.role-chip .count {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 15px;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  border-radius: 15px;
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

.primary-action {
  background: var(--flag-red);
  color: #fff8e6;
}

.secondary-action {
  background: #15100e;
  color: #fff8e6;
}

.data-note {
  margin-top: 13px;
  padding: 10px 11px;
  border-radius: 14px;
  background: rgba(51,158,53,0.11);
  color: #25361e;
  font-size: 0.76rem;
  line-height: 1.35;
}

.people-list-wrap {
  margin-top: 18px;
}

.people-list-wrap h3 {
  font-size: 0.88rem;
  margin: 0 0 8px;
}

.people-list {
  display: grid;
  gap: 8px;
}

.person-row {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.58);
  border-radius: 15px;
  padding: 10px 11px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 8px;
  align-items: start;
  cursor: pointer;
}

.person-row .marker-mini {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--swatch);
  border: 2px solid var(--stroke);
  margin-top: 3px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.18);
}

.person-row strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.12;
}

.person-row span {
  display: block;
  color: var(--ink-soft);
  margin-top: 3px;
  font-size: 0.74rem;
  line-height: 1.2;
}

.empty-state {
  padding: 18px 12px;
  border-radius: 16px;
  background: rgba(20,17,15,0.06);
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.84rem;
}

.modal-backdrop {
  position: absolute;
  z-index: var(--modal-z);
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.42);
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-card {
  position: relative;
  width: min(92vw, 600px);
  max-height: min(82dvh, 720px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 24px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.16);
}

.modal-card h2 {
  margin: 0;
  padding: 20px 62px 12px 18px;
  font-size: 1.18rem;
  letter-spacing: -0.03em;
  background:
    linear-gradient(90deg, var(--flag-black) 0 33%, var(--flag-red) 33% 66%, var(--flag-green) 66% 100%);
  color: #fff8e6;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,248,230,0.92);
  z-index: 2;
}

.modal-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 20px;
  line-height: 1.45;
  font-size: 0.88rem;
}

.modal-content h3 {
  margin: 15px 0 4px;
  font-size: 0.95rem;
}

.modal-content p {
  margin: 0 0 10px;
}

.modal-content code {
  font-size: 0.76rem;
  background: rgba(0,0,0,0.07);
  border-radius: 6px;
  padding: 2px 4px;
  word-break: break-all;
}

.download-links {
  display: grid;
  gap: 8px;
}

.download-links a {
  display: block;
  min-height: 42px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(206,17,38,0.08);
  border: 1px solid rgba(206,17,38,0.18);
  font-weight: 850;
}

.compact-modal {
  max-width: min(92vw, 500px);
}

.made-with {
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.12);
}

.noscript {
  position: fixed;
  z-index: calc(var(--modal-z) + 1);
  left: 12px;
  right: 12px;
  top: 12px;
  margin: 0;
  background: var(--paper-solid);
  padding: 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}



.unmapped-card {
  width: min(94vw, 720px);
}

.unmapped-intro {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(20,17,15,0.06);
  color: var(--ink-soft);
}

.unmapped-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  max-height: 34dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.unmapped-detail {
  margin-top: 12px;
  border: 1px solid rgba(0,0,0,0.13);
  border-radius: 18px;
  overflow: hidden;
  background: #fffdf6;
}

.unmapped-detail .popup-card {
  max-height: none;
}

.estimated-dot {
  stroke-linecap: round;
}

@media (min-width: 760px) and (orientation: landscape), (min-width: 920px) {
  .unmapped-modal .modal-content {
    display: grid;
    grid-template-columns: minmax(230px, 0.85fr) minmax(320px, 1.15fr);
    gap: 12px;
    align-items: start;
  }

  .unmapped-intro {
    grid-column: 1 / -1;
  }

  .unmapped-list {
    max-height: min(54dvh, 480px);
    margin: 0;
  }

  .unmapped-detail {
    margin-top: 0;
  }
}


@media (max-width: 759px), (orientation: portrait) {
  .legend-toggle,
  .legend-card {
    display: none !important;
  }
}

/* Desktop and landscape: keep mobile affordances but give the filters a stable side-panel feel. */
@media (min-width: 760px) and (orientation: landscape), (min-width: 920px) {
  :root {
    --header-h: 88px;
  }

  .app-header {
    left: 0;
    right: 0;
  }

  .title-wrap {
    padding-top: 23px;
  }

  .subtitle {
    max-width: 58rem;
  }

  .menu-fab {
    left: auto;
    right: 22px;
    transform: none;
    bottom: 80px;
  }

  .legend-toggle {
    bottom: 24px;
    left: 22px;
  }

  .source-pill {
    right: 22px;
    bottom: 24px;
  }

  .unmapped-pill {
    right: 22px;
    left: auto;
    bottom: 136px;
  }

  .legend-card {
    left: 22px;
    bottom: 80px;
    width: 330px;
    max-height: 52dvh;
  }

  .filter-sheet {
    left: auto;
    right: 18px;
    bottom: 18px;
    top: calc(var(--header-h) + 18px);
    width: min(390px, calc(100vw - 36px));
    height: auto;
    border-radius: 28px;
    transform: translateX(calc(100% + 36px));
    box-shadow: var(--shadow);
    padding-bottom: 0;
  }

  .filter-sheet.is-open {
    transform: translateX(0);
  }

  .sheet-handle {
    display: none;
  }

  .sheet-header {
    padding-top: 14px;
  }

  .leaflet-popup-content {
    width: min(360px, 36vw) !important;
  }
}

@media (max-height: 670px) {
  :root {
    --header-h: 86px;
  }

  .subtitle {
    display: none;
  }

  .title-wrap {
    padding-top: 22px;
  }

  .popup-card {
    max-height: 61dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
