:root {
  color-scheme: light;
  --ink: #082f2b;
  --ink-soft: #41625d;
  --cream: #f8eed4;
  --cream-2: #efe1be;
  --green: #1f6b55;
  --green-bright: #78aa68;
  --orange: #f47d43;
  --glass: rgba(249, 242, 220, 0.86);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: #c7e2dd;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 68% 38%, rgba(255,255,255,.68) 0, rgba(255,255,255,0) 37%),
    linear-gradient(145deg, #dceee8 0%, #b7d9d4 48%, #8fc2bd 100%);
}

#app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .22;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

#scene {
  position: absolute;
  inset: 0;
}

#scene canvas {
  display: block;
  outline: none;
  touch-action: none;
}

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(22px, 4vw, 64px);
  pointer-events: none;
}

.brand,
.counter {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--cream);
  background: var(--ink);
  border-radius: 13px 13px 10px 10px;
  box-shadow: 0 8px 20px rgba(5, 47, 43, .18);
}

.brand-mark svg {
  width: 25px;
}

.brand strong,
.brand small,
.counter strong,
.counter small {
  display: block;
}

.brand strong {
  font-family: "Manrope", sans-serif;
  font-size: 15px;
  letter-spacing: -.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: .025em;
}

.counter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
  padding: 10px 16px 10px 11px;
  color: var(--cream);
  background: rgba(8, 47, 43, .94);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 17px;
  box-shadow: 0 12px 30px rgba(5, 44, 40, .18);
  backdrop-filter: blur(12px);
}

.counter-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--cream);
  background: rgba(255,255,255,.09);
  border-radius: 10px;
}

.counter-icon svg {
  width: 21px;
}

.counter strong {
  font: 800 17px/1 "Manrope", sans-serif;
}

.counter small {
  margin-top: 3px;
  color: rgba(248, 238, 212, .67);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.hero-copy {
  position: absolute;
  z-index: 3;
  top: 20%;
  left: clamp(22px, 6vw, 92px);
  width: min(420px, 34vw);
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}

.close-view .hero-copy {
  opacity: 0;
  transform: translateY(-10px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 15px;
  color: #34625a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 21px;
  height: 2px;
  background: var(--orange);
}

.hero-copy h1 {
  margin: 0;
  font: 800 clamp(32px, 4.3vw, 64px)/.98 "Manrope", sans-serif;
  letter-spacing: -.065em;
}

.hero-copy > p:last-child {
  max-width: 330px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.search-panel {
  position: absolute;
  z-index: 6;
  bottom: 76px;
  left: clamp(22px, 6vw, 92px);
  width: min(390px, calc(100vw - 44px));
  padding: 8px;
  background: var(--glass);
  border: 1px solid rgba(255,255,255,.56);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(10, 66, 60, .16);
  backdrop-filter: blur(18px);
}

.search-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 5px 9px;
}

.search-heading strong {
  font: 800 11px "Manrope", sans-serif;
}

.search-heading span {
  color: #708681;
  font-size: 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

#search-form {
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(8,47,43,.08);
  border-radius: 13px;
}

.search-box > svg {
  flex: 0 0 auto;
  width: 18px;
  color: #54716b;
}

.search-box input {
  min-width: 0;
  flex: 1;
  padding: 9px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 12px;
}

.search-box input::placeholder {
  color: #849793;
}

.search-box button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--cream);
  background: var(--orange);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.search-box button:hover {
  background: #e96b32;
  transform: translateX(2px);
}

.search-box button svg {
  width: 18px;
}

.search-feedback {
  margin: 7px 4px 1px;
  color: #6f817d;
  font-size: 9px;
}

.search-feedback button {
  padding: 0;
  color: var(--green);
  background: transparent;
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

.suggestions {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  overflow: hidden;
  padding: 5px;
  background: rgba(252, 248, 237, .97);
  border: 1px solid rgba(8,47,43,.08);
  border-radius: 13px;
  box-shadow: 0 15px 35px rgba(8,47,43,.15);
}

.suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
}

.suggestion:hover {
  background: rgba(31,107,85,.08);
}

.suggestion strong {
  font-size: 11px;
}

.suggestion span {
  color: #738681;
  font-size: 9px;
}

.map-hint {
  position: absolute;
  z-index: 3;
  right: clamp(22px, 4vw, 64px);
  bottom: 75px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.25;
  pointer-events: none;
}

.map-hint small {
  color: #6d8882;
  font-size: 8px;
}

.zoom-stage {
  position: absolute;
  z-index: 4;
  right: clamp(22px, 4vw, 64px);
  bottom: 122px;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 122px;
  padding: 9px 12px;
  color: var(--cream);
  background: rgba(8, 47, 43, .88);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  box-shadow: 0 10px 28px rgba(8,47,43,.14);
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.zoom-stage i {
  width: 8px;
  height: 8px;
  background: #83cc89;
  border: 2px solid rgba(255,255,255,.32);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(131,204,137,.12);
}

.zoom-stage span,
.zoom-stage small,
.zoom-stage strong {
  display: block;
}

.zoom-controls {
  position: absolute;
  z-index: 6;
  right: clamp(22px, 4vw, 64px);
  top: 50%;
  display: grid;
  gap: 7px;
  transform: translateY(-50%);
}

.zoom-controls button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink);
  background: rgba(249,242,220,.92);
  border: 1px solid rgba(8,47,43,.13);
  border-radius: 13px;
  box-shadow: 0 9px 24px rgba(8,47,43,.15);
  font: 700 24px/1 "Manrope", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform .18s ease, background .18s ease;
}

.zoom-controls button:hover {
  background: white;
  transform: translateY(-1px);
}

.zoom-controls svg {
  width: 18px;
}

.zoom-stage small {
  color: rgba(248,238,212,.55);
  font-size: 7px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.zoom-stage strong {
  margin-top: 2px;
  font: 700 11px "Manrope", sans-serif;
}

.city-summary {
  position: absolute;
  z-index: 5;
  top: 108px;
  left: clamp(22px, 4vw, 64px);
  width: min(330px, calc(100vw - 36px));
  padding: 14px;
  color: var(--cream);
  background: linear-gradient(145deg, rgba(8,47,43,.96), rgba(20,78,65,.92));
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(8,47,43,.23);
  backdrop-filter: blur(16px);
  animation: cityIn .32s ease both;
}

.city-summary[hidden] {
  display: none;
}

.city-summary-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.city-rank {
  flex: 0 0 auto;
  padding: 8px 9px;
  color: var(--ink);
  background: #ffd86a;
  border-radius: 10px;
  font: 800 10px "Manrope", sans-serif;
  text-transform: uppercase;
}

.city-summary-heading small,
.city-summary-heading h2,
.city-summary-heading em {
  display: block;
}

.city-summary-heading small {
  color: rgba(248,238,212,.55);
  font-size: 7px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.city-summary-heading h2 {
  margin: 2px 0 0;
  font: 800 18px/1.05 "Manrope", sans-serif;
  letter-spacing: -.035em;
}

.city-summary-heading em {
  display: inline;
  color: #a8d192;
  font-size: 10px;
  font-style: normal;
  letter-spacing: .08em;
}

.city-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.city-metrics > span {
  padding: 8px 9px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
}

.city-metrics strong,
.city-metrics small {
  display: block;
}

.city-metrics strong {
  font: 800 14px "Manrope", sans-serif;
}

.city-metrics small {
  margin-top: 1px;
  color: rgba(248,238,212,.58);
  font-size: 7px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.city-progress {
  margin-top: 10px;
}

.city-progress-track {
  height: 6px;
  overflow: hidden;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
}

.city-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #ffb649, #ffd86a);
  border-radius: inherit;
  transition: width .55s ease;
}

.city-progress > small {
  display: block;
  margin-top: 5px;
  color: rgba(248,238,212,.68);
  font-size: 8px;
}

.mouse-icon {
  position: relative;
  width: 21px;
  height: 30px;
  border: 1.5px solid currentColor;
  border-radius: 10px;
}

.mouse-icon::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 2px;
  height: 6px;
  background: currentColor;
  border-radius: 2px;
  transform: translateX(-50%);
  animation: scrollHint 1.8s ease-in-out infinite;
}

.resident-card {
  position: absolute;
  z-index: 7;
  right: clamp(22px, 4vw, 64px);
  top: 120px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  min-width: 260px;
  padding: 15px 44px 14px 15px;
  background: rgba(8,47,43,.95);
  color: var(--cream);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(8,47,43,.25);
  backdrop-filter: blur(12px);
  animation: cardIn .28s ease both;
}

.resident-card[hidden] {
  display: none;
}

.resident-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: white;
  background: var(--orange);
  border-radius: 13px;
  font: 800 16px "Manrope", sans-serif;
}

.resident-label {
  color: rgba(248,238,212,.55);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.resident-card h2 {
  margin: 2px 0 1px;
  font: 700 14px "Manrope", sans-serif;
}

.resident-card p {
  margin: 0;
  color: rgba(248,238,212,.7);
  font-size: 9px;
}

.resident-number {
  grid-column: 1 / -1;
  width: max-content;
  padding: 4px 7px;
  color: #18473f;
  background: #a8d192;
  border-radius: 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.share-resident {
  grid-column: 1 / -1;
  width: 100%;
  padding: 8px 10px;
  color: var(--ink);
  background: #ffd86a;
  border: 0;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 800;
  cursor: pointer;
}

.close-card {
  position: absolute;
  top: 8px;
  right: 10px;
  color: rgba(248,238,212,.6);
  background: transparent;
  border: 0;
  font-size: 21px;
  cursor: pointer;
}

.loading-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  color: var(--cream);
  background: #073a34;
  transition: opacity .65s ease, visibility .65s;
}

.loading-screen.done {
  opacity: 0;
  visibility: hidden;
}

.loading-screen p {
  margin: 0;
  color: rgba(248,238,212,.72);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.loading-house {
  position: relative;
  width: 44px;
  height: 38px;
  background: var(--cream);
  border-radius: 3px;
  animation: houseBounce 1.2s ease-in-out infinite;
}

.loading-house::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -16px;
  width: 34px;
  height: 34px;
  background: var(--orange);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 4px;
}

.loading-house::after {
  content: "";
  position: absolute;
  left: 17px;
  bottom: 0;
  width: 12px;
  height: 19px;
  background: #1f6b55;
}

.toast {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 38px;
  padding: 9px 14px;
  color: var(--cream);
  background: rgba(8,47,43,.92);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(8,47,43,.2);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

footer {
  position: absolute;
  z-index: 3;
  left: clamp(22px, 4vw, 64px);
  right: clamp(22px, 4vw, 64px);
  bottom: 22px;
  display: flex;
  justify-content: space-between;
  color: rgba(8,47,43,.48);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
  pointer-events: none;
}

.live-dot {
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot i {
  width: 6px;
  height: 6px;
  background: #36a66f;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(54,166,111,.13);
}

@keyframes scrollHint {
  0%, 100% { transform: translate(-50%, 0); opacity: .3; }
  50% { transform: translate(-50%, 5px); opacity: 1; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@keyframes cityIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: none; }
}

@keyframes houseBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (max-width: 860px) {
  .topbar {
    padding: 17px;
  }

  .brand small {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .counter {
    min-width: auto;
    padding: 8px 11px;
    border-radius: 14px;
  }

  .counter-icon {
    display: none;
  }

  .counter strong {
    font-size: 14px;
  }

  .counter small {
    font-size: 7px;
  }

  .hero-copy {
    top: 88px;
    left: 20px;
    width: calc(100vw - 40px);
  }

  .hero-copy h1 {
    font-size: clamp(30px, 9vw, 43px);
    line-height: .98;
  }

  .hero-copy > p:last-child {
    display: none;
  }

  .eyebrow {
    margin-bottom: 9px;
    font-size: 8px;
  }

  .search-panel {
    left: 14px;
    bottom: calc(38px + env(safe-area-inset-bottom));
    width: calc(100vw - 28px);
  }

  .map-hint {
    display: none;
  }

  .zoom-stage {
    top: 72px;
    right: 16px;
    bottom: auto;
    min-width: 104px;
    padding: 7px 9px;
  }

  .zoom-controls {
    top: auto;
    right: 14px;
    bottom: calc(205px + env(safe-area-inset-bottom));
    transform: none;
  }

  .zoom-controls button {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .zoom-stage small {
    font-size: 6px;
  }

  .zoom-stage strong {
    font-size: 9px;
  }

  .resident-card {
    top: auto;
    right: 14px;
    bottom: calc(205px + env(safe-area-inset-bottom));
    min-width: 240px;
  }

  .city-summary {
    top: 120px;
    left: 14px;
    width: calc(100vw - 28px);
    padding: 11px;
  }

  .city-summary-heading h2 {
    font-size: 16px;
  }

  .city-metrics {
    margin-top: 9px;
  }

  footer {
    left: 16px;
    right: 16px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  footer > span:first-child {
    display: none;
  }

  footer {
    justify-content: flex-end;
  }
}

@media (max-height: 650px) and (max-width: 860px) {
  .hero-copy h1 { font-size: 28px; }
  .eyebrow { display: none; }
  .hero-copy { top: 74px; }
  .search-feedback { display: none; }
}

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