:root {
  --void: #0b0f14;
  --ink: #e8eef6;
  --muted: #8b98a8;
  --line: rgba(232, 238, 246, 0.12);
  --blue: #2f6fed;
  --blue-deep: #1a3f9c;
  --blue-soft: #7eb0ff;
  --panel: #121821;
  --panel-2: #182131;
  --warn: #e8a87c;
  --good: #5dcaa5;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Sora", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(47, 111, 237, 0.28), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(93, 202, 165, 0.12), transparent 50%),
    var(--void);
  color: var(--ink);
  font-family: var(--font-body);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
}

.hero {
  padding: 28px 28px 8px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--blue-soft);
}

.hero h1 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(40px, 6vw, 64px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.lede {
  margin: 10px 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.audience {
  display: inline-flex;
  margin-top: 14px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(18, 24, 33, 0.65);
}

.audience-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 7px 16px;
  cursor: pointer;
}

.audience-btn.is-active {
  background: rgba(47, 111, 237, 0.28);
  color: var(--ink);
}

.audience-btn:hover:not(.is-active) {
  color: var(--ink);
}

.stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: min(72vh, 820px);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 16px 16px;
  transition: grid-template-columns 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.stage[data-mode="state"],
.stage[data-mode="city"] {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

.stage[data-mode="state"],
.stage[data-mode="city"] {
  height: min(88vh, 980px);
  min-height: 640px;
}

.map-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(18, 24, 33, 0.92), rgba(11, 15, 20, 0.98));
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  min-height: 520px;
  min-width: 0;
}

.stage[data-mode="state"] .map-pane,
.stage[data-mode="city"] .map-pane {
  height: 100%;
  min-height: 0;
}

.map-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 420px;
}

.stage[data-mode="state"] .map-stack {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.stage[data-mode="city"] .map-stack {
  flex: 1 1 58%;
  min-height: 240px;
  max-height: none;
  height: auto;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 520px;
  display: block;
}

.street-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #0d1218;
  /* Keep wheel/pinch gestures on the map while hovering */
  touch-action: none;
  overscroll-behavior: contain;
}

.street-map[hidden] {
  display: none !important;
}

.stage[data-mode="state"] #map,
.stage[data-mode="city"] #map {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.listings-panel {
  flex: 0 0 280px;
  height: 280px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.92);
  z-index: 2;
  min-height: 0;
}

.stage[data-mode="city"] .listings-panel {
  flex: 0 0 clamp(220px, 38%, 320px);
  height: clamp(220px, 38%, 320px);
  max-height: clamp(220px, 38%, 320px);
}

.listings-panel[hidden] {
  display: none !important;
}

.listings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 8px;
}

.listings-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.listings-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.listings-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 0 14px 10px;
  align-items: flex-end;
}

.listings-filters[hidden] {
  display: none !important;
}

.listings-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.listings-filters input,
.listings-filters select {
  font: inherit;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 88px;
}

.listing-skel {
  height: 88px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    rgba(24, 33, 49, 0.5) 0%,
    rgba(47, 111, 237, 0.12) 45%,
    rgba(24, 33, 49, 0.5) 100%
  );
  background-size: 200% 100%;
  animation: skel-shine 1.1s ease-in-out infinite;
}

@keyframes skel-shine {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.ghost {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
}

.ghost:hover:not(:disabled) {
  border-color: var(--blue-soft);
}

.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
  overflow: auto;
}

.listing-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 12px;
  cursor: pointer;
  font: inherit;
  transition: border-color 140ms ease, transform 140ms ease;
}

.listing-card:hover,
.listing-card.is-active {
  border-color: var(--blue-soft);
  transform: translateY(-1px);
}

.listing-card .price {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.listing-card .addr {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink);
}

.listing-card .meta {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.listings-empty {
  grid-column: 1 / -1;
  padding: 22px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.listings-empty strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.listings-empty p {
  margin: 0;
}

.leaflet-container {
  background: #0d1218;
  font: inherit;
}

.leaflet-control-attribution {
  background: rgba(11, 15, 20, 0.75) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--blue-soft) !important;
}

.zip-label {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #e8eef6;
  font-weight: 600;
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.map-toolbar {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.map-toolbar[hidden] {
  display: none !important;
}

.back,
.metric select,
.chat-compose button,
.breadcrumb button {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(24, 33, 49, 0.92);
  color: var(--ink);
  padding: 8px 14px;
  cursor: pointer;
}

.back:hover,
.chat-compose button:hover:not(:disabled),
.breadcrumb button:hover {
  border-color: var(--blue-soft);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.breadcrumb .sep {
  opacity: 0.5;
}

.breadcrumb span {
  color: var(--ink);
}

.metric {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.metric select {
  border-radius: 10px;
  padding: 7px 10px;
}

.legend {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.metric-help {
  flex: 1 1 100%;
  margin: 0;
  max-width: 42rem;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.metric-help:empty {
  display: none;
}

.overlay-btn {
  font-size: 12px;
  white-space: nowrap;
}

.overlay-btn[aria-pressed="false"] {
  border-color: var(--blue-soft);
  color: var(--blue-soft);
}

.hint:empty {
  display: none;
}

.legend-bar {
  width: 160px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 238, 246, 0.35);
  background: linear-gradient(
    90deg,
    rgb(0, 210, 255),
    rgb(40, 230, 120),
    rgb(255, 220, 40),
    rgb(255, 130, 30),
    rgb(255, 70, 70),
    rgb(255, 40, 160)
  );
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.25);
}

.state {
  stroke: rgba(11, 15, 20, 0.85);
  stroke-width: 1;
  cursor: default;
  transition: fill 220ms ease, opacity 220ms ease, stroke-width 160ms ease;
}

.state.available {
  fill: var(--blue);
  cursor: pointer;
}

.state.available:hover {
  fill: var(--blue-soft);
}

.state.unavailable {
  fill: #05070a;
}

.city-zip,
.zip {
  stroke: rgba(232, 238, 246, 0.22);
  stroke-width: 0.7;
  cursor: pointer;
  transition: opacity 160ms ease, stroke-width 120ms ease, stroke 120ms ease;
}

.city-zip:hover,
.zip:hover,
.zip.is-selected {
  stroke: #fff;
  stroke-width: 1.3;
  opacity: 1;
}

.hint {
  position: absolute;
  left: 16px;
  bottom: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  z-index: 3;
}

.stage[data-mode="state"] .hint,
.stage[data-mode="city"] .hint {
  bottom: auto;
  top: 58px;
  right: 16px;
  left: auto;
  max-width: 240px;
  text-align: right;
  background: rgba(11, 15, 20, 0.72);
  padding: 6px 10px;
  border-radius: 8px;
}

.leaflet-bottom.leaflet-right {
  margin-right: 10px;
  margin-bottom: 10px;
}

.leaflet-control-zoom a {
  background: rgba(18, 24, 33, 0.92) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(24, 33, 49, 0.98) !important;
  color: #fff !important;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-left: 12px;
  overflow: hidden;
  animation: slide-in 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-pane[hidden] {
  display: none !important;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.chat-head {
  padding: 18px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
}

.chat-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-log {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.bubble.system {
  background: var(--panel-2);
  color: var(--muted);
}

.bubble.user {
  align-self: flex-end;
  background: rgba(47, 111, 237, 0.28);
  color: var(--ink);
}

.bubble.assistant {
  background: rgba(93, 202, 165, 0.12);
  border: 1px solid rgba(93, 202, 165, 0.22);
  color: var(--ink);
}

.detail-card {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  max-height: min(58vh, 560px);
  overflow: auto;
}

.detail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.detail-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.detail-close,
.detail-pin {
  min-width: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.detail-pin.is-pinned {
  border-color: #e8b84a;
  color: #e8b84a;
}

.pins-panel {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.pins-panel[hidden] {
  display: none !important;
}

.pins-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pins-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
}

#pins-count {
  font-size: 11px;
  color: var(--muted);
}

.pins-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.pin-row {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(11, 15, 20, 0.45);
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}

.pin-row:hover {
  border-color: #e8b84a;
}

.pin-row .price {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
}

.pin-row .addr {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.listing-media {
  margin: 10px 0 12px;
}

.media-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.media-tab {
  font: inherit;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.55);
  color: var(--muted);
  padding: 5px 10px;
  cursor: pointer;
}

.media-tab.is-active,
.media-tab:hover {
  color: var(--ink);
  border-color: var(--blue-soft);
}

.media-stage {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #070a0e;
  aspect-ratio: 16 / 10;
}

.media-frame {
  display: none;
  position: absolute;
  inset: 0;
}

.media-frame.is-active {
  display: block;
}

.media-frame img,
.media-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  background: #070a0e;
}

.media-more {
  display: inline-block;
  margin-top: 8px;
  color: var(--blue-soft);
  font-size: 12px;
}

.street-launch {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: #fff;
}

.street-launch img {
  filter: brightness(0.55);
}

.street-launch span {
  position: relative;
  z-index: 1;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(11, 15, 20, 0.78);
  border: 1px solid rgba(232, 238, 246, 0.25);
  font-size: 12px;
}

.listing-media-empty {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.detail-card[hidden] {
  display: none !important;
}

.detail-card strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
}

.detail-card .detail-sub,
.detail-card .cite {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.detail-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  margin: 10px 0 0;
}

.detail-card dt {
  color: var(--muted);
}

.detail-card dd {
  margin: 0;
  text-align: right;
}

.chat-compose {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
}

.chat-compose input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 10px 14px;
  font: inherit;
}

.chat-compose input:disabled,
.chat-compose button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.foot {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 28px 22px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.foot-links {
  display: flex;
  gap: 14px;
  align-items: center;
}

.foot a,
.linkish {
  color: var(--blue-soft);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.linkish:hover,
.foot a:hover {
  text-decoration: underline;
}

.feedback-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  padding: 0;
  max-width: min(440px, calc(100vw - 32px));
  width: 100%;
}

.feedback-dialog::backdrop {
  background: rgba(5, 8, 12, 0.72);
}

.feedback-dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}

.feedback-dialog header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
}

.feedback-dialog header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.feedback-dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.feedback-dialog input,
.feedback-dialog select,
.feedback-dialog textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}

.feedback-dialog textarea {
  resize: vertical;
  min-height: 96px;
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.feedback-actions button[value="submit"] {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--blue-soft);
  background: rgba(47, 111, 237, 0.28);
  color: var(--ink);
  padding: 8px 16px;
  cursor: pointer;
}

.feedback-status {
  margin: 0;
  font-size: 12px;
  color: var(--good);
}

.feedback-status[hidden] {
  display: none !important;
}

.tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  background: rgba(18, 24, 33, 0.96);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  max-width: 240px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.tooltip[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .stage[data-mode="state"],
  .stage[data-mode="city"] {
    grid-template-columns: 1fr;
  }

  .chat-pane {
    margin-left: 0;
    margin-top: 12px;
    min-height: 360px;
  }

  .hero {
    padding: 20px 16px 4px;
  }

  .foot {
    flex-direction: column;
    padding: 8px 16px 18px;
  }
}
