* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --card: rgba(14, 19, 26, 0.92);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e9edf3;
  --muted: #8a94a3;
  --accent: #a855f7;
  --accent-2: #38bdf8;
}

html, body { height: 100%; overflow: hidden; }

body {
  overscroll-behavior: none;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: #eef0f2;
  -webkit-font-smoothing: antialiased;
}

#app, #app canvas { position: fixed; inset: 0; }
.label-layer { position: fixed !important; inset: 0; }
/* Browser pinch-zoom on the page is what makes the isometric view look like it
   is shifting; let the canvas own every touch gesture instead. */
#app, #app canvas, .label-layer { touch-action: none; }

/* --- Map labels ------------------------------------------------------------- */
/* The map carries no name badges — hovering gives you the tooltip instead. The
   only label is the price on the crown plot. */

.crown-label {
  font-size: 13px;
  font-weight: 800;
  color: #fdf6e3;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(60, 30, 90, 0.55);
}

/* --- Top bar ---------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: #0b0f14;
  border-bottom: 1px solid var(--line);
  z-index: 40;
}

.logo {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 0%, #cbd5e1 60%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pill {
  margin: 0 auto;
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
}
.pill b { color: #4ade80; font-weight: 700; }

.btn {
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 9px;
  padding: 9px 15px;
  white-space: nowrap;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}
.btn-primary:hover { filter: brightness(1.12); }

/* --- Cards ------------------------------------------------------------------ */

.card {
  position: fixed;
  width: 232px;
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  z-index: 30;
  box-shadow: 0 10px 30px rgba(11, 15, 20, 0.22);
}

.card h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #aeb8c6;
  margin-bottom: 10px;
}
.card h3 .hint-sm {
  float: right;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.card .foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

.card-residents { top: 76px; left: 18px; }
/* Keep a long resident list from growing over the map. */
#residents { max-height: min(38vh, 320px); overflow-y: auto; margin: -3px; padding: 3px; }
#residents::-webkit-scrollbar { width: 6px; }
#residents::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
.card-availability { bottom: 18px; left: 18px; width: 258px; }
.card-zones { top: 76px; right: 18px; width: 186px; }

.row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 0;
  font-size: 12.5px;
  color: #d5dce5;
}
.row i {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
}
.row .nm { flex: 1; }
.row .ct { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.row .pr { color: #6ee7b7; font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

.resident {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.resident:hover { background: rgba(255, 255, 255, 0.06); }
.resident .nm { display: block; font-size: 13px; font-weight: 700; }
.resident .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.muted { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* --- Zoom controls ---------------------------------------------------------- */

.zoomer {
  position: fixed;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  z-index: 30;
}
.zoomer button {
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: #cbd5e1;
  font-size: 17px;
  cursor: pointer;
}
.zoomer button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.hint {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #5c6675;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 5px 14px;
  pointer-events: none;
  z-index: 25;
}

/* --- Tooltip ---------------------------------------------------------------- */

#tooltip {
  position: fixed;
  z-index: 50;
  background: #0d1117;
  border: 1px solid var(--line);
  color: #fff;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  pointer-events: none;
  max-width: 230px;
}
#tooltip strong { display: block; font-size: 13px; }
.tt-tag { display: block; margin-top: 3px; color: var(--muted); }
.tt-locked { color: #fcd34d !important; }
.tt-sold { color: #6ee7b7 !important; }

/* --- Detail panel ---------------------------------------------------------- */

#panel {
  position: fixed;
  top: 76px;
  right: 18px;
  width: 316px;
  max-width: calc(100vw - 36px);
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(11, 15, 20, 0.35);
  transform: translateX(calc(100% + 40px));
  transition: transform 0.24s ease;
  z-index: 45;
}
#panel.open { transform: translateX(0); }

#panel-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: none;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
#panel-close:hover { color: #fff; }

#panel h2 { font-size: 24px; margin: 9px 0; letter-spacing: -0.01em; }
#panel h2 .per { font-size: 13px; font-weight: 500; color: var(--muted); }
#panel p { font-size: 13px; line-height: 1.55; margin-bottom: 10px; color: #c8d1dc; }
#panel .muted { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-locked { background: #475569; }
.badge-sold { background: #15803d; }

.cta {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  border-radius: 10px;
  padding: 12px;
  margin: 4px 0 10px;
}
.cta:hover { filter: brightness(1.12); }

.ext { color: #7dd3fc; font-weight: 600; text-decoration: none; }
.ext:hover { text-decoration: underline; }

/* --- Small screens ---------------------------------------------------------- */

@media (max-width: 820px) {
  .card-residents, .card-zones, .hint { display: none; }
  .card-availability { width: calc(100vw - 36px); max-width: 300px; }
  /* Keep the zoomer off the availability card. */
  .zoomer { top: 76px; bottom: auto; transform: none; flex-direction: column; }
  .pill { display: none; }
  .logo { font-size: 18px; }
}

/* --- Claim form -------------------------------------------------------------- */

#claim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#claim.open { display: flex; }

#claim-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 16, 0.62);
  backdrop-filter: blur(3px);
}

.claim-dialog {
  position: relative;
  width: 400px;
  max-width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #0f141b;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(6, 9, 13, 0.6);
}

#claim-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
#claim-close:hover { color: #fff; }

.claim-head { margin-bottom: 18px; }
.claim-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #0f141b;
  background: #f6c945;
  border-radius: 999px;
  padding: 3px 10px;
}
.claim-head h2 { font-size: 23px; margin: 10px 0 4px; letter-spacing: -0.01em; }
.claim-sub { font-size: 13px; color: var(--muted); }
.claim-sub b { color: #6ee7b7; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #b6c0cd;
  margin-bottom: 6px;
}
.field .counter { float: right; font-weight: 500; color: #6b7684; }

.field input[type="text"],
.field textarea {
  width: 100%;
  background: #161d26;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.22);
}
.field .err { display: none; font-size: 11.5px; color: #fca5a5; margin-top: 5px; }
.field.invalid input, .field.invalid textarea { border-color: #ef4444; }
.field.invalid .err { display: block; }

.field-inline { display: flex; align-items: center; gap: 10px; }
.field-inline label { margin: 0; flex: none; }
.field-inline input[type="color"] {
  width: 40px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background: none;
  cursor: pointer;
}
.hint-inline { font-size: 11.5px; color: var(--muted); }

.claim-status {
  font-size: 12.5px;
  line-height: 1.5;
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 14px;
  border: 1px solid;
}
.claim-status.info { color: #bae6fd; background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.3); }
.claim-status.warn { color: #fde68a; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.32); }
.claim-status.error { color: #fca5a5; background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.32); }
.status-cta {
  display: inline-block;
  margin-top: 8px;
  font-weight: 700;
  color: #fff;
  text-decoration: underline;
}

.claim-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  cursor: pointer;
}
.claim-pay:hover { filter: brightness(1.12); }
.claim-pay:disabled { opacity: 0.6; cursor: progress; }
.claim-pay svg { width: 19px; height: 19px; }

.claim-foot {
  margin-top: 11px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.row-crown .nm { color: #f6c945; font-weight: 700; }

button.cta { width: 100%; border: 0; font: inherit; cursor: pointer; }
