:root {
  --ink: #1a2230;
  --paper: #f6f1e6;
  --red: #c8102e;
  --lake: #1b6f8a;
  --shadow: rgba(12, 18, 28, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #7ec4e0;
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
}

#city {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#city.dragging {
  cursor: grabbing;
}

#city.over-lot {
  cursor: pointer;
}

.hud {
  position: fixed;
  z-index: 2;
}

.top {
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.brand,
.search,
.zoom,
.cta,
.account,
.help,
.legend,
.minimap,
.ticker,
.sheet,
.modal-card,
.toast {
  pointer-events: auto;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--paper);
  border: 3px solid var(--ink);
  padding: 8px 12px;
  box-shadow: 4px 4px 0 var(--ink);
}

.brand strong,
.sheet h2,
.modal-card h2 {
  font-family: "Pixelify Sans", sans-serif;
  letter-spacing: 0.02em;
}

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.brand small {
  color: #4b5563;
}

.flag {
  width: 28px;
  height: 28px;
  background: var(--red);
  border: 2px solid var(--ink);
  position: relative;
}

.flag::before,
.flag::after {
  content: "";
  position: absolute;
  background: #fff;
}

.flag::before {
  width: 14px;
  height: 4px;
  left: 5px;
  top: 10px;
}

.flag::after {
  width: 4px;
  height: 14px;
  left: 10px;
  top: 5px;
}

.search {
  position: relative;
  min-width: min(320px, 52vw);
}

.search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.search input {
  width: 100%;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  box-shadow: 4px 4px 0 var(--ink);
}

.search ul {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  background: var(--paper);
  border: 3px solid var(--ink);
  max-height: 240px;
  overflow: auto;
}

.search li {
  padding: 8px 12px;
  cursor: pointer;
}

.search li:hover,
.search li.active {
  background: #ffe08a;
}

.help,
.legend {
  left: 16px;
  background: rgba(246, 241, 230, 0.92);
  border: 2px solid var(--ink);
  padding: 6px 10px;
  font-size: 13px;
}

.help {
  bottom: 16px;
  left: 312px;
}

.legend {
  bottom: 48px;
  left: 312px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 600;
}

.minimap {
  left: 16px;
  bottom: 16px;
  padding: 5px;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.minimap canvas {
  display: block;
  width: 280px;
  height: 196px;
}

.minimap small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ticker {
  left: 50%;
  transform: translateX(-50%);
  top: 88px;
  max-width: min(640px, calc(100vw - 32px));
  background: #ffe08a;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 14px;
  font-weight: 700;
  text-align: center;
}

.toast {
  left: 50%;
  transform: translateX(-50%);
  bottom: 88px;
  background: var(--paper);
  border: 3px solid var(--ink);
  padding: 8px 14px;
  font-weight: 600;
}

.toast[hidden] {
  display: none;
}

.legend .swatch {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}

.legend .swatch.hatch {
  width: 18px;
  background: repeating-linear-gradient(
    -45deg,
    #f4d06f,
    #f4d06f 3px,
    #c8102e 3px,
    #c8102e 6px
  );
}

.legend .swatch.pin {
  border-radius: 50%;
  background: #e02020;
}

.legend .swatch.lake {
  border-radius: 50%;
  background: #4a90e2;
}

.legend .swatch.star {
  background: #f8e71c;
  transform: rotate(45deg);
}

.sheet button#sheet-buy {
  margin-top: 8px;
  padding: 8px 12px;
  background: #ffe08a;
}

.sheet button#sheet-buy[hidden],
.sheet button#sheet-share[hidden],
.sheet button#sheet-invite[hidden],
.sheet button#sheet-manage[hidden] {
  display: none;
}

.sheet button#sheet-share,
.sheet button#sheet-invite {
  margin-top: 8px;
  padding: 8px 12px;
}

.zoom {
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.zoom button,
.cta,
.sheet .close,
.modal-card button,
.sheet a {
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: 700 18px/1 "Pixelify Sans", sans-serif;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
}

.zoom button {
  width: 44px;
  height: 44px;
}

.cta,
.account {
  right: 16px;
  padding: 10px 14px;
}

.cta {
  top: 88px;
  background: #ffe08a;
}

.account {
  top: 140px;
  background: var(--paper);
}

.sheet.owner {
  top: 88px;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.sheet.owner form label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #4b5563;
}

.sheet.owner input[type="text"],
.sheet.owner input[type="url"] {
  width: 100%;
  margin-top: 4px;
  border: 2px solid var(--ink);
  padding: 8px 10px;
  font: inherit;
}

.sheet.owner button[type="submit"],
.sheet.owner .grow button,
#owner-share,
#owner-logout {
  margin-top: 10px;
  padding: 8px 12px;
}

.sheet.owner .ghost {
  background: #fff;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grow {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid var(--ink);
}

.logo-preview {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
  margin-top: 8px;
  border: 3px solid var(--ink);
  background: #fff;
}

.logo-preview[hidden] {
  display: none;
}

.sheet {
  right: 16px;
  top: 148px;
  width: min(320px, calc(100vw - 32px));
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 16px 16px 18px;
}

.sheet .close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
}

.sheet-color {
  width: 48px;
  height: 48px;
  border: 3px solid var(--ink);
  margin-bottom: 10px;
}

.prestige {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--lake);
}

.sheet h2 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.floors {
  margin: 0;
  font-weight: 600;
}

.meta {
  color: #4b5563;
  font-size: 14px;
}

.sheet a {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  text-decoration: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 28, 0.45);
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal[hidden],
.sheet[hidden],
.search ul[hidden] {
  display: none;
}

.modal-card {
  max-width: 420px;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 22px;
}

.soon {
  background: #ffe08a;
  border: 2px solid var(--ink);
  padding: 8px 10px;
}

.modal-card label {
  display: block;
  margin: 10px 0 0;
  font-size: 13px;
  color: #4b5563;
}

.modal-card input[type="text"],
.modal-card input[type="url"],
.modal-card input[type="email"] {
  width: 100%;
  margin-top: 4px;
  border: 2px solid var(--ink);
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}

.modal-card .row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.err {
  color: #c8102e;
  font-weight: 600;
}

@media (max-width: 720px) {
  .top {
    flex-direction: column;
  }

  .search {
    min-width: 100%;
  }

  .ticker {
    top: auto;
    bottom: 56px;
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
  }

  .cta {
    top: auto;
    bottom: 156px;
  }

  .account {
    top: auto;
    bottom: 112px;
  }

  .sheet.owner {
    top: auto;
    bottom: 200px;
    left: 16px;
    right: 16px;
    width: auto;
  }

  .sheet {
    top: auto;
    bottom: 128px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .help {
    display: none;
  }

  .legend {
    display: none;
  }

  .minimap {
    left: 12px;
    bottom: auto;
    top: 88px;
    padding: 4px;
  }

  .minimap canvas {
    width: 176px;
    height: 123px;
  }

  .minimap small {
    display: none;
  }
}
