:root {
  --ink: #e8e2d4;
  --muted: #9a927f;
  --gold: #c4a574;
  --line: rgba(232, 226, 212, 0.16);
  --paper: #14120e;
  --void: #05060a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--void); color: var(--ink); }
body {
  font-family: Outfit, system-ui, sans-serif;
  letter-spacing: 0.01em;
}
canvas#c { display: block; width: 100%; height: 100%; }
.label-layer { position: fixed; inset: 0; pointer-events: none; }
.globe-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #efe6d4;
  text-shadow: 0 1px 8px #000;
  white-space: nowrap;
  opacity: 0.9;
}
.globe-label.dim { opacity: 0; visibility: hidden; }
.planet-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #efe6d4;
  text-shadow: 0 1px 10px #000;
  white-space: nowrap;
  pointer-events: none;
}
.planet-label.sun { color: #ffd27a; }
.planet-label.dim { opacity: 0; visibility: hidden; }

#door {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 70% 20%, rgba(80,90,120,.18), transparent 55%),
              linear-gradient(180deg, rgba(5,6,10,.2), rgba(5,6,10,.72) 70%, #05060a);
  transition: opacity .9s ease, visibility .9s ease;
}
#door.out, #door[hidden] { opacity: 0; visibility: hidden; pointer-events: none; display: none; }
.door-card { width: min(560px, calc(100vw - 40px)); text-align: left; }
.kicker {
  font-size: 11px; letter-spacing: 0.38em; text-transform: uppercase; color: var(--gold);
  margin: 0 0 18px;
}
h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: clamp(56px, 10vw, 92px);
  line-height: 0.88;
  margin: 0 0 12px;
}
.sub { font-size: 18px; color: var(--muted); margin: 0 0 28px; max-width: 28em; }
.legal-mini { font-size: 12px; line-height: 1.5; color: #7d7668; max-width: 36em; }

.btn {
  appearance: none; border: 1px solid var(--gold); background: transparent;
  color: var(--ink); padding: 12px 22px; letter-spacing: 0.18em;
  text-transform: uppercase; font-size: 11px; cursor: pointer;
  font-family: inherit;
}
.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.2);
}
.btn:hover { background: rgba(196,165,116,.12); }
.btn.solid { background: var(--gold); color: #16130e; }
.btn.solid:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--line); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0; }

#hud {
  position: fixed; inset: 0; pointer-events: none; z-index: 30;
}
#hud > * { pointer-events: auto; }
.topbar {
  position: absolute; top: 18px; left: 22px; right: 22px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.brand { font-family: "Cormorant Garamond", serif; font-size: 28px; line-height: 1; }
.brand small { display: block; font-family: Outfit, sans-serif; font-size: 10px; letter-spacing: 0.28em; color: var(--gold); text-transform: uppercase; margin-top: 4px; }
.chips { display: flex; gap: 8px; pointer-events: auto; }
.chip {
  border: 1px solid var(--line); padding: 6px 10px; font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted);
  background: rgba(5,6,10,.35); backdrop-filter: blur(8px);
}
#hudCoord { position: absolute; left: 22px; bottom: 22px; font-size: 12px; color: var(--muted); letter-spacing: 0.12em; pointer-events: none; }
#surfaceHint { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); font-size: 12px; color: var(--muted); letter-spacing: 0.12em; }

#panel, #checkout, #deedView {
  position: fixed; z-index: 12;
  background: rgba(12,11,9,.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  color: var(--ink);
}
#panel {
  top: 78px; right: 18px; width: min(380px, calc(100vw - 28px));
  padding: 22px; max-height: calc(100vh - 110px); overflow: auto;
  transform: translateX(120%); opacity: 0; pointer-events: none;
  transition: transform .45s ease, opacity .45s ease;
}
#panel.on { transform: none; opacity: 1; pointer-events: auto; }
#pType { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); margin: 0 0 6px; }
#pName { font-family: "Cormorant Garamond", serif; font-size: 28px; margin: 0; font-weight: 500; line-height: 1.1; }
#pLat { color: var(--muted); font-size: 12px; margin: 4px 0 14px; }
#pBlurb { font-size: 14px; line-height: 1.5; color: #d5cebe; margin: 0 0 10px; }
#pCoord { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
#pParcels { display: grid; gap: 8px; margin: 12px 0 16px; }
.plot {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; text-align: left; background: transparent; color: inherit;
  border: 1px solid var(--line); padding: 9px 10px; cursor: pointer; font-family: inherit;
}
.plot b { font-weight: 500; letter-spacing: 0.08em; }
.plot span { font-size: 12px; color: var(--muted); }
.plot.open:hover { border-color: var(--gold); }
.plot.sold { opacity: 0.9; }
.plot.heritage { opacity: 0.55; }
.holder { font-family: "Cormorant Garamond", serif; font-size: 28px; margin: 4px 0 8px; font-weight: 500; }

#checkout, #deedView {
  inset: 0; margin: auto; width: min(460px, calc(100vw - 28px)); height: fit-content;
  padding: 28px; display: none;
}
#checkout.on, #deedView.on { display: block; }
#deedView { width: min(1100px, calc(100vw - 24px)); height: min(90vh, 760px); }
#deedFrame { width: 100%; height: calc(100% - 56px); border: 0; background: #f7f1e4; }
label { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
input {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--line);
  color: var(--ink); padding: 8px 0; font-size: 16px; font-family: inherit; outline: none;
}
.fine { font-size: 12px; color: #8a8273; line-height: 1.5; }
.price { font-family: "Cormorant Garamond", serif; font-size: 36px; margin: 8px 0 4px; }
.order-links { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.order-links .btn { text-decoration: none; text-align: center; display: block; }
.close {
  float: right; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px;
}

#ledgerBox {
  position: absolute; left: 22px; top: 86px; width: min(280px, 42vw);
  pointer-events: none; max-height: calc(100vh - 160px); overflow: auto;
}
#atlas, #planetAtlas { pointer-events: auto; margin: 0 0 16px; max-height: 28vh; overflow: auto; }
.atlas-item {
  display: flex; gap: 8px; align-items: center; width: 100%;
  background: none; border: 0; color: var(--ink); font: inherit;
  font-size: 12px; padding: 4px 0; cursor: pointer; text-align: left; opacity: 0.78;
}
.atlas-item:hover { opacity: 1; color: var(--gold); }
.atlas-item i { width: 7px; height: 7px; border-radius: 50%; display: block; flex: none; }
#ledgerBox h3 { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold); font-weight: 400; }
#ledger { margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
#ledger li { margin: 6px 0; }

#touchPad {
  position: fixed; left: 0; right: 0; bottom: 18px; z-index: 9;
  display: flex; justify-content: space-between; padding: 0 18px; pointer-events: none;
}
#touchPad[hidden] { display: none !important; }
.stick, #btnJump {
  pointer-events: auto; width: 96px; height: 96px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(8,8,10,.35);
}
#btnJump { width: 72px; height: 72px; align-self: flex-end; color: var(--ink); letter-spacing: 0.12em; font-size: 10px; }

#debug {
  position: fixed; left: 12px; bottom: 52px; z-index: 15;
  font: 11px/1.4 ui-monospace, monospace; color: #cde; background: #000a; padding: 10px;
  max-width: 360px; white-space: pre-wrap;
}
body[data-mode="intro"] #hud { opacity: 0; pointer-events: none; }
body[data-mode="surface"] .globe-label { display: none; }

@media (max-width: 720px) {
  #panel { top: auto; bottom: 0; right: 0; width: 100%; max-height: 48vh; }
  #ledgerBox { display: none; }
  h1 { font-size: 56px; }
}
