:root {
  --ink: #06110f;
  --paper: #f4ffe9;
  --mint: #7cffc4;
  --volt: #d7ff3f;
  --coral: #ff6f61;
  --aqua: #3be7ff;
  --orchid: #c67dff;
  --road: #17191b;
  --glass: rgba(6, 17, 15, 0.68);
  --line: rgba(244, 255, 233, 0.22);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  overflow: hidden;
  color: var(--paper);
  background: var(--ink);
  font-family: "Space Grotesk", Arial, sans-serif;
}

button,
a {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

.map-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(124, 255, 196, 0.24), transparent 30%),
    radial-gradient(circle at 78% 22%, rgba(255, 111, 97, 0.24), transparent 28%),
    linear-gradient(135deg, #071310 0%, #111a18 46%, #28142e 100%);
}

#map-scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.map-header,
.map-copy,
.map-controls,
.street-controls,
.world-hud,
.detail-panel,
.toast {
  position: absolute;
  z-index: 2;
}

.map-header {
  top: 20px;
  left: 50%;
  width: min(1180px, calc(100% - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transform: translateX(-50%);
}

.brand,
.map-header nav,
.map-controls,
.street-controls,
.detail-panel,
.toast {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 6px;
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 800;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: linear-gradient(135deg, var(--mint), var(--coral));
}

.map-header nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
}

.map-header nav a,
.map-header nav button,
.map-controls button,
.street-controls button,
.mint-button {
  min-height: 40px;
  border: 1px solid rgba(244, 255, 233, 0.18);
  background: rgba(244, 255, 233, 0.06);
  padding: 0 14px;
  font-weight: 800;
}

.map-header nav a:hover,
.map-header nav a:focus-visible,
.map-header nav button:hover,
.map-header nav button:focus-visible,
.map-controls button:hover,
.map-controls button:focus-visible,
.street-controls button:hover,
.street-controls button:focus-visible {
  outline: none;
  color: var(--ink);
  background: var(--volt);
}

.map-copy {
  left: max(20px, calc((100vw - 1180px) / 2));
  top: 118px;
  width: min(520px, calc(100% - 40px));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--volt);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Unbounded", system-ui, sans-serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 5.8rem);
  line-height: 0.92;
  text-shadow: 0 16px 44px rgba(0, 0, 0, 0.42);
  text-wrap: balance;
}

.map-copy p:last-child {
  max-width: 500px;
  margin: 18px 0 0;
  color: rgba(244, 255, 233, 0.86);
  font-size: 1rem;
  line-height: 1.65;
}

.map-controls {
  left: 50%;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  transform: translateX(-50%);
}

.street-controls {
  left: max(20px, calc((100vw - 1180px) / 2));
  bottom: 22px;
  display: grid;
  gap: 8px;
  width: 160px;
  padding: 10px;
}

.street-controls button {
  min-height: 38px;
}

#block-label {
  min-width: 145px;
  text-align: center;
  color: rgba(244, 255, 233, 0.82);
  font-weight: 800;
}

#street-label {
  color: rgba(244, 255, 233, 0.82);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.world-hud {
  left: 50%;
  top: 50%;
  display: grid;
  justify-items: center;
  gap: 16px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.crosshair {
  position: relative;
  width: 28px;
  height: 28px;
  opacity: 0.82;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(244, 255, 233, 0.9);
  box-shadow: 0 0 12px rgba(124, 255, 196, 0.75);
}

.crosshair::before {
  left: 13px;
  top: 0;
  width: 2px;
  height: 28px;
}

.crosshair::after {
  left: 0;
  top: 13px;
  width: 28px;
  height: 2px;
}

.control-help {
  position: fixed;
  left: 50%;
  bottom: 92px;
  width: max-content;
  max-width: calc(100vw - 32px);
  border: 1px solid rgba(244, 255, 233, 0.18);
  background: rgba(6, 17, 15, 0.72);
  padding: 8px 12px;
  color: rgba(244, 255, 233, 0.86);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.detail-panel {
  right: max(20px, calc((100vw - 1180px) / 2));
  top: 118px;
  width: min(360px, calc(100% - 40px));
  max-height: calc(100vh - 154px);
  overflow: auto;
  padding: 18px;
  transform: translateX(0);
  transition: transform 180ms ease, opacity 180ms ease;
}

.detail-panel.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(24px);
}

.panel-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#status-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  color: var(--ink);
  background: var(--mint);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

#close-panel {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(244, 255, 233, 0.18);
  background: rgba(244, 255, 233, 0.07);
}

.house-preview {
  min-height: 236px;
  margin: 16px 0;
  color: #21180d;
}

.detail-panel h2 {
  font-size: 1.36rem;
  line-height: 1.12;
}

.deed-card {
  position: relative;
  min-height: 236px;
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(74, 48, 20, 0.55);
  background:
    linear-gradient(135deg, rgba(255, 246, 206, 0.92), rgba(238, 218, 165, 0.94)),
    repeating-linear-gradient(0deg, rgba(76, 49, 22, 0.05) 0 1px, transparent 1px 5px);
  box-shadow:
    inset 0 0 0 4px rgba(78, 45, 18, 0.12),
    inset 0 0 0 8px rgba(244, 255, 233, 0.32),
    0 18px 38px rgba(0, 0, 0, 0.24);
}

.deed-card::before,
.deed-card::after {
  content: "";
  position: absolute;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(90, 54, 18, 0.28);
  transform: rotate(45deg);
}

.deed-card::before {
  top: -44px;
  left: -44px;
}

.deed-card::after {
  right: -44px;
  bottom: -44px;
}

.deed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px double rgba(78, 45, 18, 0.42);
}

.deed-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #241303;
  border: 1px solid rgba(78, 45, 18, 0.62);
  background:
    radial-gradient(circle, #d7ff3f 0 28%, #7cffc4 29% 55%, #ff6f61 56%);
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
}

.deed-kicker {
  margin: 0 0 3px;
  color: rgba(33, 24, 13, 0.68);
  font-size: 0.63rem;
  font-weight: 900;
  text-transform: uppercase;
}

.deed-title {
  margin: 0;
  color: #21180d;
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 0.98rem;
  line-height: 1.1;
}

.deed-token {
  margin: 0;
  color: rgba(33, 24, 13, 0.78);
  font-weight: 900;
  text-align: right;
}

.deed-body {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.deed-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.deed-row span:first-child {
  color: rgba(33, 24, 13, 0.62);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.deed-row span:last-child {
  color: #21180d;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.deed-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(78, 45, 18, 0.28);
}

.deed-signature {
  color: rgba(33, 24, 13, 0.66);
  font-family: Georgia, serif;
  font-size: 0.9rem;
  font-style: italic;
}

.deed-seal {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #21180d;
  border: 2px solid rgba(78, 45, 18, 0.48);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 111, 97, 0.95), rgba(215, 255, 63, 0.86));
  font-size: 0.58rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

dl {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
}

dl div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(244, 255, 233, 0.12);
}

dt {
  color: var(--aqua);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(244, 255, 233, 0.86);
}

.mint-button {
  width: 100%;
  margin-top: 18px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--volt), var(--mint));
}

.mint-button:disabled {
  cursor: not-allowed;
  color: rgba(244, 255, 233, 0.62);
  background: rgba(244, 255, 233, 0.08);
}

.panel-note {
  margin: 12px 0 0;
  color: rgba(244, 255, 233, 0.68);
  font-size: 0.88rem;
  line-height: 1.5;
}

.toast {
  left: 50%;
  bottom: 90px;
  min-width: min(420px, calc(100% - 32px));
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 940px) {
  body {
    overflow: auto;
  }

  .map-shell {
    min-height: 100vh;
    height: auto;
    overflow: hidden;
  }

  #map-scene {
    position: fixed;
  }

  .map-header,
  .map-copy,
  .map-controls,
  .street-controls,
  .world-hud,
  .detail-panel {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: calc(100% - 32px);
    margin: 0 auto;
    transform: none;
  }

  .map-header {
    padding-top: 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .map-header nav {
    justify-content: space-between;
  }

  .map-header nav a,
  .map-header nav button {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .map-copy {
    margin-top: 52px;
    pointer-events: auto;
  }

  .map-controls {
    justify-content: center;
    margin-top: 320px;
  }

  .street-controls {
    grid-template-columns: 1fr 1fr;
    width: calc(100% - 32px);
    margin-top: 12px;
  }

  .world-hud {
    position: fixed;
    top: 270px;
    transform: translateX(-50%);
  }

  .control-help {
    bottom: 18px;
  }

  #street-label {
    grid-column: 1 / -1;
    order: -1;
  }

  .detail-panel {
    max-height: none;
    margin-top: 16px;
    margin-bottom: 24px;
  }
}

@media (max-width: 520px) {
  .brand {
    justify-content: center;
  }

  .map-controls {
    flex-wrap: wrap;
  }

  #block-label {
    width: 100%;
    order: -1;
  }

  .map-controls button {
    flex: 1;
  }

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