:root {
  color-scheme: dark;
  --page: #070b14;
  --panel: rgba(15, 23, 42, 0.88);
  --panel-solid: #0f172a;
  --panel-soft: #131d31;
  --border: rgba(148, 163, 184, 0.2);
  --text: #f8fafc;
  --muted: #9eabc1;
  --accent: #38bdf8;
  --robbery: #fb7185;
  --assault: #c084fc;
  --homicide: #ef4444;
  --shootings: #fb923c;
  --firebombing: #ea580c;
  --drugs: #34d399;
  --fraud: #38bdf8;
  --vehicle: #fbbf24;
  --other: #94a3b8;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(14, 116, 144, 0.18), transparent 32rem),
    radial-gradient(circle at 90% 12%, rgba(109, 40, 217, 0.16), transparent 30rem),
    var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 0 1.25rem;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hero h1 {
  margin-bottom: 0.55rem;
  font-family: "Special Elite", sans-serif;
  font-weight: 400;
  font-size: clamp(2.2rem, 4.6vw, 4rem);
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.hero__summary {
  max-width: 670px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.status-badge,
.count-badge,
.incident-type,
.incident-id,
.popup-type,
.popup-id {
  white-space: nowrap;
}

.status-badge {
  margin-top: 0.4rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 999px;
  color: #fecdd3;
  background: rgba(190, 18, 60, 0.14);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 0.5rem;
}

.stat {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 0.8rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.07);
}

.stat strong {
  font-size: 1.4rem;
  line-height: 1;
}

.stat span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-group {
  display: inline-flex;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 0.3rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: rgba(2, 6, 23, 0.52);
}

.filter-button,
.secondary-button {
  min-height: 2.45rem;
  padding: 0.6rem 0.65rem;
  border: 1px solid transparent;
  border-radius: 0.6rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.filter-button:hover,
.filter-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--text);
  outline: none;
}

.filter-button.is-active {
  border-color: rgba(56, 189, 248, 0.5);
  color: #e0f2fe;
  background: rgba(14, 116, 144, 0.3);
}

.secondary-button {
  border-color: var(--border);
  background: rgba(148, 163, 184, 0.08);
}

.map-status {
  min-height: 1.2rem;
  margin: 0.85rem 0 0.55rem 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.map-status--error {
  color: #fda4af;
}

.map-card {
  display: grid;
  height: min(76vh, 760px);
  min-height: 620px;
  grid-template-columns: minmax(0, 1fr) 380px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 620px;
  background: #090f1c;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-zoom a,
.leaflet-popup-close-button {
  color: #e2e8f0 !important;
  background: rgba(15, 23, 42, 0.94) !important;
}

.leaflet-control-zoom a {
  border-color: rgba(148, 163, 184, 0.22) !important;
}

.leaflet-control-zoom a:hover {
  background: #1e293b !important;
}

.leaflet-control-attribution {
  color: #94a3b8 !important;
  background: rgba(2, 6, 23, 0.78) !important;
}

.leaflet-control-attribution a {
  color: #bae6fd !important;
}

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

.crime-marker {
  display: grid;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  transition: transform 140ms ease, box-shadow 140ms ease;
  background: linear-gradient(145deg, var(--other), #475569);
}

.crime-marker:hover {
  transform: scale(1.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
}

.crime-marker--robbery {
  background: linear-gradient(145deg, #fb7185, #be123c);
}

.crime-marker--assault {
  background: linear-gradient(145deg, #c084fc, #7e22ce);
}

.crime-marker--vehicle {
  background: linear-gradient(145deg, #fbbf24, #b45309);
}

.crime-marker--homicide {
  background: linear-gradient(145deg, #f87171, #7f1d1d);
}

.crime-marker--shootings {
  background: linear-gradient(145deg, #fb923c, #9a3412);
}

.crime-marker--firebombing {
  background: linear-gradient(145deg, #fde047, #dc2626);
}

.crime-marker--drugs {
  background: linear-gradient(145deg, #34d399, #065f46);
}

.crime-marker--fraud {
  background: linear-gradient(145deg, #38bdf8, #0c4a6e);
}

.crime-marker--other {
  background: linear-gradient(145deg, #94a3b8, #475569);
}

.crime-popup .leaflet-popup-content-wrapper,
.crime-popup .leaflet-popup-tip {
  color: var(--text);
  background: rgba(15, 23, 42, 0.98);
}

.crime-popup .leaflet-popup-content-wrapper {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 0.9rem;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.55);
  cursor: grab;
}
.crime-popup .leaflet-popup-content-wrapper:active {
  cursor: grabbing;
}

.crime-popup .leaflet-popup-content {
  margin: 1rem;
}

.popup-content__topline,
.incident-card__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.popup-type,
.incident-type {
  display: inline-flex;
  padding: 0.25rem 0.48rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.popup-type--robbery,
.incident-type--robbery {
  color: #fecdd3;
  background: rgba(225, 29, 72, 0.2);
}

.popup-type--assault,
.incident-type--assault {
  color: #e9d5ff;
  background: rgba(147, 51, 234, 0.23);
}

.popup-type--vehicle,
.incident-type--vehicle {
  color: #fef3c7;
  background: rgba(180, 83, 9, 0.28);
}

.popup-type--homicide,
.incident-type--homicide {
  color: #fecaca;
  background: rgba(153, 27, 27, 0.32);
}

.popup-type--shootings,
.incident-type--shootings {
  color: #ffedd5;
  background: rgba(154, 52, 18, 0.3);
}

.popup-type--firebombing,
.incident-type--firebombing {
  color: #ffedd5;
  background: rgba(194, 65, 12, 0.34);
}

.popup-type--drugs,
.incident-type--drugs {
  color: #a7f3d0;
  background: rgba(5, 150, 105, 0.26);
}

.popup-type--fraud,
.incident-type--fraud {
  color: #bae6fd;
  background: rgba(2, 132, 199, 0.26);
}

.popup-type--other,
.incident-type--other {
  color: #e2e8f0;
  background: rgba(100, 116, 139, 0.3);
}

.popup-id,
.incident-id {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
}

.popup-title {
  margin-bottom: 0.25rem;
  font-size: 1.05rem;
}

.popup-time {
  margin-bottom: 0.5rem;
  color: #7dd3fc;
  font-size: 0.8rem;
  font-weight: 700;
}

.popup-location {
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  font-weight: 750;
}

.popup-description {
  color: #cbd5e1;
  font-size: 0.86rem;
  line-height: 1.55;
}

.popup-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.75rem;
  margin: 0.85rem 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
}

.popup-details dt {
  color: var(--muted);
}

.popup-details dd {
  margin: 0;
}

.popup-status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.incident-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: rgba(10, 16, 29, 0.96);
}

.incident-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.incident-panel__header h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
}

.count-badge {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.incident-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  scrollbar-color: #334155 transparent;
  scrollbar-width: thin;
}

.incident-card {
  margin-bottom: 0.7rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: rgba(148, 163, 184, 0.055);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.incident-card:hover,
.incident-card.is-highlighted {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 116, 144, 0.12);
  transform: translateY(-1px);
}

.incident-card__title {
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
  line-height: 1.35;
}

.incident-card__time {
  margin-bottom: 0.45rem;
  color: #7dd3fc;
  font-size: 0.72rem;
  font-weight: 750;
}

.incident-card__location {
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  font-weight: 750;
}

.incident-card__description {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.incident-card__button {
  padding: 0;
  border: 0;
  color: #7dd3fc;
  background: transparent;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
}

.incident-card__button:hover,
.incident-card__button:focus-visible {
  color: #e0f2fe;
  text-decoration: underline;
  outline: none;
}

.empty-state {
  margin: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.map-key {
  padding: 0.85rem 1rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.map-key h2 {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-dot {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.legend-dot--robbery {
  background: var(--robbery);
}

.legend-dot--assault {
  background: var(--assault);
}

.legend-dot--vehicle {
  background: var(--vehicle);
}

.legend-dot--homicide {
  background: var(--homicide);
}

.legend-dot--shootings {
  background: var(--shootings);
}

.legend-dot--firebombing {
  background: var(--firebombing);
}

.legend-dot--drugs {
  background: var(--drugs);
}

.legend-dot--fraud {
  background: var(--fraud);
}

.legend-dot--other {
  background: var(--other);
}

@media (max-width: 1000px) {
  .controls {
    grid-template-columns: 1fr auto;
  }

  .stats {
    grid-column: 1 / -1;
  }

  .map-card {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  #map {
    height: 62vh;
    min-height: 500px;
  }

  .incident-panel {
    max-height: 560px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1rem 0.75rem 2rem;
  }

  .hero {
    flex-direction: column;
    gap: 0.8rem;
  }

  .hero h1 {
    font-size: 2.45rem;
  }

  .status-badge {
    margin-top: 0;
  }

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

  .stats,
  .filter-group,
  .secondary-button {
    width: 100%;
  }

  .filter-group {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .filter-button {
    padding-inline: 0.35rem;
  }

  #map {
    height: 58vh;
    min-height: 430px;
  }

  .incident-panel {
    max-height: 520px;
  }
}


.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
#fit-incidents,
#fullscreen-map {
  align-self: flex-start;
}
