:root {
  --paper: #efe7d2;
  --paper-strong: #e7dcc2;
  --ink: #101d24;
  --muted: #536368;
  --signal: #c7522a;
  --signal-dark: #983714;
  --track: #21545a;
  --track-soft: rgba(33, 84, 90, 0.14);
  --line: rgba(16, 29, 36, 0.12);
  --panel-shadow: 0 24px 70px rgba(16, 29, 36, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(199, 82, 42, 0.16), transparent 24rem),
    linear-gradient(135deg, #f6f0df 0%, #e8dcc1 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 29, 36, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 29, 36, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr);
  min-height: 100vh;
  gap: 1rem;
  padding: 1rem;
}

.panel,
.map-shell {
  min-height: calc(100vh - 2rem);
  border: 1px solid rgba(16, 29, 36, 0.08);
  border-radius: 1.6rem;
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.5)),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-strong) 100%);
}

.panel-copy h1,
.results-head h2 {
  margin: 0;
}

.eyebrow,
.results-label,
.map-label,
.meta-note,
.status,
.stat-chip small {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

.eyebrow,
.results-label,
.map-label {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--track);
}

.lede {
  max-width: 30ch;
  color: var(--muted);
  line-height: 1.45;
}

.search-card,
.results-card {
  border: 1px solid rgba(16, 29, 36, 0.08);
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.68);
}

.search-card {
  position: relative;
  padding: 1rem;
}

.input-label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.input-wrap input,
.input-wrap button {
  appearance: none;
  border: 1px solid rgba(16, 29, 36, 0.14);
  border-radius: 0.95rem;
  font: inherit;
}

.input-wrap input {
  width: 100%;
  padding: 0.95rem 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.input-wrap input:focus {
  outline: 2px solid rgba(33, 84, 90, 0.25);
  outline-offset: 0;
  border-color: rgba(33, 84, 90, 0.5);
}

.input-wrap button {
  padding: 0.95rem 1.05rem;
  font-weight: 700;
  color: #fff9f1;
  background: linear-gradient(180deg, var(--signal) 0%, var(--signal-dark) 100%);
  cursor: pointer;
}

.input-wrap button:hover {
  filter: brightness(1.02);
}

.suggestions {
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: 5.95rem;
  z-index: 10;
  display: none;
  padding: 0.4rem;
  border: 1px solid rgba(16, 29, 36, 0.1);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(16, 29, 36, 0.12);
}

.suggestions.visible {
  display: block;
}

.suggestion {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 0;
  border-radius: 0.8rem;
  color: inherit;
  font: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.suggestion strong {
  display: block;
}

.suggestion span {
  color: var(--muted);
  font-size: 0.9rem;
}

.suggestion:hover,
.suggestion.is-active {
  background: rgba(33, 84, 90, 0.08);
}

.status {
  min-height: 1.4rem;
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.results-card {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  padding: 1rem;
}

.results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.stat-chip {
  display: inline-flex;
  min-width: 5.6rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.85rem;
  border-radius: 999px;
  color: #fff9f1;
  background: linear-gradient(160deg, var(--track), #133338);
}

.stat-chip span {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.meta-note {
  margin: 0.85rem 0 0.95rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.results-list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  display: grid;
  gap: 0.55rem;
}

.result-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  width: 100%;
  padding: 0.82rem 0.9rem;
  border: 1px solid rgba(16, 29, 36, 0.08);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.result-item:hover {
  transform: translateY(-1px);
  border-color: rgba(33, 84, 90, 0.24);
  background: rgba(33, 84, 90, 0.08);
}

.result-item.is-selected {
  border-color: rgba(199, 82, 42, 0.4);
  background: rgba(199, 82, 42, 0.1);
}

.result-item strong,
.result-item span {
  display: block;
}

.result-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.result-code {
  align-self: center;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--track);
}

.map-shell {
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.28)),
    linear-gradient(180deg, #f2ebd5 0%, #dfd2b0 100%);
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid rgba(16, 29, 36, 0.08);
  background: rgba(255, 255, 255, 0.55);
}

.map-button {
  appearance: none;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(16, 29, 36, 0.12);
  border-radius: 999px;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.map-button:hover {
  background: rgba(255, 255, 255, 0.95);
}

.map-caption {
  margin: 0;
  color: var(--muted);
}

.map-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.map-note.is-error {
  color: var(--signal-dark);
}

.map {
  flex: 1;
  min-height: 60vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, rgba(33, 84, 90, 0.08), transparent 20rem),
    linear-gradient(180deg, #f3ecd9 0%, #e2d4b2 100%);
}

.leaflet-container {
  width: 100%;
  height: 100%;
  color: var(--ink);
  font: inherit;
  background: #dfe7e9;
}

.leaflet-container a {
  color: var(--track);
}

.leaflet-control-zoom a,
.leaflet-control-zoom a:hover {
  border-bottom-color: rgba(16, 29, 36, 0.12);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
}

.leaflet-control-attribution {
  border-radius: 0.55rem 0 0 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.82);
}

.leaflet-control-attribution a {
  font-weight: 600;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 252, 245, 0.96);
  color: var(--ink);
}

.leaflet-popup-content {
  margin: 0.75rem 0.85rem;
  line-height: 1.4;
}

.map-popup strong {
  display: block;
}

.map-popup span {
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 940px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .panel,
  .map-shell {
    min-height: auto;
  }

  .panel {
    order: 1;
  }

  .map-shell {
    order: 2;
    min-height: 70vh;
  }

  .map-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .shell {
    gap: 0.8rem;
    padding: 0.8rem;
  }

  .panel,
  .map-shell {
    border-radius: 1.2rem;
  }

  .panel {
    padding: 1rem;
  }

  .input-wrap {
    grid-template-columns: 1fr;
  }

  .results-head {
    flex-direction: column;
  }
}
