:root {
  --bg: #0b0420;
  --panel: rgba(18, 8, 44, 0.78);
  --ink: #f6f0ff;
  --muted: #b3a6d9;
  --pink: #ff2e97;
  --cyan: #00e5ff;
  --lime: #b6ff3b;
  --violet: #9d5cff;
  --line: rgba(246, 240, 255, 0.16);
  --display: 'Bungee', system-ui, sans-serif;
  --body: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#scene.dragging { cursor: grabbing !important; }
#scene.hovering { cursor: pointer; }

/* ---------- top HUD ---------- */
.hud-top {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  pointer-events: none;
}

.brand h1 {
  position: relative;
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 5.5vw, 58px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 12px var(--pink), 0 0 32px rgba(255, 46, 151, 0.6), 3px 3px 0 var(--cyan);
}
.brand p {
  margin: 10px 0 0;
  font-weight: 700;
  color: var(--muted);
}
.wp-link {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 14px;
  font-family: var(--display);
  font-size: 13px;
  text-decoration: none;
  color: var(--bg);
  background: var(--lime);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--pink);
  pointer-events: auto;
  transform: rotate(-2deg);
  transition: transform 0.12s, box-shadow 0.12s;
}
.wp-link:hover { transform: rotate(0) translate(-2px, -2px); box-shadow: 5px 5px 0 var(--pink); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px 18px;
  margin: 0;
  padding: 10px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 0 24px rgba(157, 92, 255, 0.25);
  backdrop-filter: blur(8px);
}
.stats div.wide { grid-column: 1 / -1; }
.stats dt {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.stats dd {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}
.stats div.wide dd { color: var(--pink); text-shadow: 0 0 10px rgba(255, 46, 151, 0.6); }

.hint {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

.view-controls {
  position: fixed;
  left: 16px;
  bottom: 56px;
  display: flex;
  gap: 6px;
}
.view-controls button {
  width: 40px;
  height: 40px;
  font: inherit;
  font-size: 19px;
  line-height: 1;
  color: var(--cyan);
  background: var(--panel);
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
  cursor: pointer;
  transition: box-shadow 0.15s, background 0.15s;
}
.view-controls button:hover { background: rgba(0, 229, 255, 0.15); box-shadow: 0 0 18px rgba(0, 229, 255, 0.5); }
.view-controls button:active { transform: translateY(1px); }

.proto {
  position: fixed;
  right: 16px;
  bottom: 56px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--bg);
  background: var(--violet);
  border-radius: 999px;
  pointer-events: none;
}

/* ---------- tooltip ---------- */
#tooltip {
  position: fixed;
  z-index: 5;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(11, 4, 32, 0.92);
  border: 1px solid var(--pink);
  border-radius: 8px;
  box-shadow: 0 0 14px rgba(255, 46, 151, 0.45);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- passport card ---------- */
#card {
  position: fixed;
  z-index: 10;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding: 0 0 18px;
  background: rgba(14, 6, 36, 0.92);
  border: 1px solid rgba(255, 46, 151, 0.6);
  border-radius: 18px;
  box-shadow: 0 0 32px rgba(255, 46, 151, 0.35), 6px 6px 0 rgba(0, 229, 255, 0.5);
  backdrop-filter: blur(10px);
  animation: pop 0.25s ease-out;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-50%) scale(0.92); }
}

.card-head {
  /* Stays at the top while the card scrolls, so the × is always there. */
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--pink), var(--violet));
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #fff;
}
.card-head button {
  width: 28px;
  height: 28px;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  cursor: pointer;
}

.card-body { position: relative; padding: 16px 18px 0; }
.card-body h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.5);
}
.card-body .job {
  margin: 6px 0 14px;
  font-weight: 700;
  color: var(--muted);
}
.card-body dl { margin: 0; }
.card-body dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
}
.card-body dt { color: var(--muted); }
.card-body dd { margin: 0; font-weight: 700; text-align: right; }
.card-body p.line { margin: 0 0 10px; line-height: 1.45; }
.card-body .fine {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.stamp {
  position: absolute;
  top: 14px;
  right: 16px;
  padding: 4px 10px;
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.06em;
  border: 2px solid currentColor;
  border-radius: 8px;
  transform: rotate(8deg);
  text-shadow: 0 0 10px currentColor;
  box-shadow: 0 0 10px currentColor inset;
}
.stamp.alive { color: #39ff88; }

/* ---------- news ticker ---------- */
.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  display: flex;
  align-items: center;
  color: var(--ink);
  background: rgba(11, 4, 32, 0.9);
  border-top: 1px solid rgba(255, 46, 151, 0.5);
  box-shadow: 0 -6px 24px rgba(255, 46, 151, 0.2);
  overflow: hidden;
}
.ticker-label {
  flex: none;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-family: var(--display);
  font-size: 13px;
  color: var(--bg);
  background: var(--pink);
}
.ticker-track { flex: 1; overflow: hidden; }
#ticker-inner {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker 70s linear infinite;
}
#ticker-inner span { padding: 0 32px; font-weight: 500; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  .hud-top { flex-direction: column; gap: 10px; }
  .stats { grid-template-columns: repeat(3, auto); padding: 8px 12px; }
  .stats dd { font-size: 15px; }
  .hint { display: none; }
  .ticker-label { font-size: 11px; padding: 0 10px; }
  #card {
    top: auto;
    right: 16px;
    left: 16px;
    bottom: 58px;
    width: auto;
    max-height: 42vh; /* the view moves up above it (updateViewShift) */
    padding-bottom: 10px;
    transform: none;
  }
  /* Compact on phones: more planet, less card. */
  .card-head { padding: 7px 12px; }
  .card-body { padding: 10px 14px 0; }
  .card-body h2 { font-size: 22px; }
  .card-body p.line { margin-bottom: 8px; font-size: 14px; line-height: 1.4; }
  .card-body .pay { margin-top: 8px; padding: 9px; font-size: 13px; }
  .card-body h3 { margin: 12px 0 6px; }
  @keyframes pop { from { opacity: 0; transform: translateY(20px); } }
}

@media (prefers-reduced-motion: reduce) {
  #ticker-inner { animation-duration: 240s; }
}

/* ---------- town clock ---------- */
#s-clock { color: var(--ink); text-shadow: none; font-size: 14px; }

/* ---------- billboard shop ---------- */
.shop { margin-top: 10px; }
.shop-meta { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--display);
  font-size: 11px;
  color: var(--bg);
  background: var(--cyan);
  border-radius: 6px;
}
.shop .shop-step { margin: 16px 0 8px; font-size: 13px; color: var(--cyan); letter-spacing: 0.04em; }
.shop .field { display: grid; gap: 4px; margin-bottom: 10px; }
.shop .field > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.shop .field small { font-size: 11px; color: var(--muted); }
.shop .field.row { grid-template-columns: auto 70px 1fr; align-items: center; gap: 10px; }
.shop input {
  width: 100%;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.shop select { width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; }
.shop select option { color: #12052e; }
.shop input[hidden] { display: none; }
.shop input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 10px rgba(0, 229, 255, 0.35); }
.shop .total { text-align: right; color: var(--muted); }
.shop .total strong { color: var(--lime); font-family: var(--display); font-weight: 400; }
.swatches { display: flex; gap: 8px; }
.swatch {
  width: 28px;
  height: 28px;
  background: var(--c);
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: 0 0 10px var(--c);
  cursor: pointer;
}
.swatch[aria-checked="true"] { border-color: #fff; transform: scale(1.12); }
/* Picking one of a few (the giant inflatables): pills, the chosen one lit. */
.swatches:has(.pick) { flex-wrap: wrap; gap: 6px; }
.pick {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pick[aria-checked="true"] { border-color: var(--cyan); background: rgba(0, 229, 255, 0.16); box-shadow: 0 0 10px rgba(0, 229, 255, 0.35); }
.pay {
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  font-family: var(--display);
  font-size: 14px;
  color: var(--bg);
  background: var(--lime);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--pink);
  cursor: pointer;
}
.pay:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.plain-link { display: inline-block; margin-top: 10px; color: var(--cyan); font-size: 13px; word-break: break-all; }
.stage-status { color: var(--lime); font-weight: 700; min-height: 1em; }
.stage-error { color: #ff8a8a; }
.stage-box .field input { width: 100%; box-sizing: border-box; }
.stage-box .field select { width: 100%; box-sizing: border-box; padding: 6px 8px; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; }
.stage-box .field select option { color: #12052e; }
.stage-box h4 { margin: 14px 0 6px; }
a.pay { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
.shop-status { min-height: 1em; margin: 8px 0 0; font-size: 13px; color: var(--cyan); overflow-wrap: anywhere; }

/* ---------- pole builder ---------- */
.builder .slider > span { display: flex; justify-content: space-between; }
.builder .slider output { color: var(--cyan); font-weight: 700; letter-spacing: 0; text-transform: none; }
.builder input[type="range"] { width: 100%; accent-color: var(--pink); padding: 0; background: none; border: 0; }
.builder input[type="file"] { padding: 6px; font-size: 12px; }
.builder .editor {
  display: block;
  max-width: 100%;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  background: repeating-conic-gradient(#1a1233 0% 25%, #120b26 0% 50%) 50% / 16px 16px;
}
.builder .editor:active { cursor: grabbing; }
.price-line { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.price-line strong { color: var(--lime); font-family: var(--display); font-weight: 400; font-size: 15px; }
.card-body .pay { margin-top: 10px; }
.visit {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--display);
  font-size: 13px;
  color: var(--cyan);
  text-decoration: none;
}
.visit:hover { text-shadow: 0 0 10px var(--cyan); }

/* ---------- wall boards & owner share ---------- */
.wall-offer { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.share {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink);
  background: rgba(57, 255, 136, 0.1);
  border: 1px solid rgba(57, 255, 136, 0.4);
  border-radius: 8px;
}

.founders { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.founders li { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; }
.card-body > .pay + .pay { margin-top: 8px; }

/* ---------- plot choice, edit, toggles ---------- */
.choice { display: grid; gap: 8px; }
.pay.alt { background: var(--cyan); }
.edit-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  font-family: var(--display);
  font-size: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.edit-btn:hover { border-color: var(--cyan); box-shadow: 0 0 10px rgba(0, 229, 255, 0.35); }
.toggle { display: flex; gap: 6px; }
.toggle button {
  flex: 1;
  padding: 7px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.toggle button[aria-pressed="true"] { border-color: var(--pink); background: rgba(255, 46, 151, 0.2); }
.builder input[type="range"]:disabled { opacity: 0.45; }
.price-line .discount { color: var(--lime); font-weight: 700; }
.pay.alt2 { background: var(--violet); color: #fff; }

/* ---------- mail and link questions ---------- */
.hud-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; pointer-events: auto; }
.hud-buttons .mail-btn { margin-top: 0; }
.mail-btn[hidden] { display: none; } /* only for people who own something */
.reply-form textarea { width: 100%; min-height: 70px; margin: 6px 0; padding: 8px 10px; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.proposal { margin: 0 0 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.proposal p { margin: 4px 0; }
.proposal .choice { grid-template-columns: 1fr 1fr; }
.mail-btn {
  display: block;
  margin-top: 10px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: rgba(18, 5, 46, 0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.mail-btn.unread { color: #12052e; background: var(--lime); border-color: var(--ink); font-weight: 700; animation: mail-bounce 1.6s ease-in-out infinite; }
@keyframes mail-bounce { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .mail-btn.unread { animation: none; } }
.ask-link {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 1, 18, 0.6);
}
.ask-link[hidden] { display: none; }
.ask-link .box {
  width: min(420px, 100%);
  padding: 18px;
  color: var(--ink);
  background: #12052e;
  border: 2px solid var(--pink);
  border-radius: 14px;
  box-shadow: 0 0 30px rgba(255, 46, 151, 0.35);
}
.ask-link h2 { margin: 0 0 8px; font-size: 18px; }
.ask-link .url { margin: 0 0 8px; padding: 8px 10px; font-family: monospace; font-size: 13px; word-break: break-all; background: rgba(255, 255, 255, 0.06); border-radius: 8px; }
.ask-link .choice { margin-top: 12px; }
.letter-form textarea {
  width: 100%;
  min-height: 90px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.letter-form select { width: 100%; margin: 6px 0; padding: 6px 8px; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; }
.letter-form select option { color: #12052e; }
.letter-form summary { cursor: pointer; font-weight: 700; margin: 10px 0 6px; }
.letters li .when { color: var(--muted); font-size: 12px; }
.letters li.unread { border-color: var(--lime); }
.letters li p { margin: 4px 0; white-space: pre-wrap; }

/* ---------- Town Hall registry, Café board ---------- */
.card-body h3 { margin: 16px 0 8px; font-size: 14px; letter-spacing: 0.04em; color: var(--cyan); }
.finder { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 6px; }
.finder select { grid-column: 1 / -1; }
.finder input, .finder select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.finder select option { color: #12052e; }
.finder input:focus, .finder select:focus { outline: none; border-color: var(--cyan); }
.finder .pay { width: auto; margin: 0; padding: 8px 14px; }
.link-btn { all: unset; cursor: pointer; display: block; width: 100%; }
.link-btn:hover, .link-btn:focus-visible { color: var(--cyan); }
.registry { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.registry li { padding: 0; }
.registry .link-btn { padding: 6px 10px; box-sizing: border-box; }
.registry small { color: var(--muted); }
.registry .registry-letter { border: 0; padding: 6px 2px 0; color: var(--cyan); font-weight: 700; }
.move-to { margin-bottom: 12px; }
.share.warn { background: rgba(255, 228, 92, 0.12); border-color: rgba(255, 228, 92, 0.55); }
.share[hidden] { display: none; }
button.visit { padding: 0; background: none; border: 0; cursor: pointer; }
.finder[hidden] { display: none; }
.tg-link { display: inline-block; margin-top: 8px; pointer-events: auto; font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: none; opacity: 0.85; }
.tg-link:hover { opacity: 1; text-decoration: underline; }

/* ---------- places on the left ---------- */
.places-nav {
  position: fixed;
  left: 14px;
  top: 50%;
  transform: translateY(-40%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.places-nav button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 9px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  background: rgba(18, 5, 46, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.places-nav button[hidden] { display: none; }
.places-nav button:hover, .places-nav button:focus-visible { border-color: var(--cyan); box-shadow: 0 0 14px rgba(0, 229, 255, 0.35); }
.places-nav b { font-weight: 700; }
@media (max-width: 720px) {
  .places-nav { top: auto; bottom: 104px; transform: none; left: 8px; right: 8px; flex-direction: row; flex-wrap: wrap; }
  .places-nav b { display: none; }
  .places-nav button { padding: 7px 9px; font-size: 16px; }
}

/* ---------- walking the streets ---------- */
.walk-hint {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 5;
  margin: 0;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--ink);
  background: rgba(18, 5, 46, 0.82);
  border: 1px solid var(--cyan);
  border-radius: 999px;
  display: none;
  max-width: calc(100vw - 32px);
  text-align: center;
}
body.walking .walk-hint { display: block; }

/* the shop category picker: its buttons wrap onto more lines */
.toggle.wrap { flex-wrap: wrap; }
.toggle.wrap button { flex: 1 1 45%; }

/* ---------- phones: a small stats strip instead of a big panel over the planet ---------- */
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(4, auto); gap: 0 12px; padding: 5px 10px; border-radius: 10px; }
  .stats dt { font-size: 8px; letter-spacing: 0.08em; }
  .stats dd { font-size: 13px; }
  .stats div.wide { grid-column: auto; }
  .brand p { display: none; }
}

/* ---------- phones: a slim top bar with a menu, and the controls centred at the bottom ---------- */
.menu-btn { display: none; }
@media (max-width: 720px) {
  .hud-top { top: calc(10px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; gap: 8px; }
  .brand { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; pointer-events: auto; }
  .brand h1 { font-size: 24px; text-shadow: 0 0 8px var(--pink), 2px 2px 0 var(--cyan); }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center; position: relative;
    width: 36px; height: 32px; padding: 0; font-size: 18px; color: var(--ink); cursor: pointer;
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  }
  /* Post waiting: a pink dot on the menu button. */
  .brand:has(.mail-btn.unread:not([hidden])) .menu-btn::after {
    content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%;
    background: var(--pink); box-shadow: 0 0 8px var(--pink);
  }
  /* Everything else up top only shows when the menu is open. */
  .wp-link, .tg-link, .hud-buttons, .stats { display: none; }
  body.menu-open .brand { padding: 10px 12px 12px; background: rgba(11, 4, 32, 0.92); border: 1px solid var(--line); border-radius: 14px; }
  body.menu-open .wp-link, body.menu-open .tg-link { display: inline-block; flex-basis: 100%; margin-top: 2px; width: max-content; }
  body.menu-open .hud-buttons { display: flex; flex-basis: 100%; }
  body.menu-open .stats { display: grid; }
  .proto { top: calc(50px + env(safe-area-inset-top, 0px)); bottom: auto; left: 12px; right: auto; font-size: 8px; padding: 2px 8px; } /* under the title, clear of the menu button */
  body.menu-open .proto { display: none; }

  /* The news ticker: lower. */
  .ticker { height: 30px; }
  .ticker-label { font-size: 10px; padding: 0 8px; }
  #ticker-inner span { padding: 0 20px; font-size: 13px; }

  /* Bottom: places, then the view buttons, both centred in a glassy tray. */
  .places-nav, .view-controls {
    left: 50%; right: auto; transform: translateX(-50%); justify-content: center; flex-wrap: nowrap;
    padding: 5px 6px; gap: 5px; background: rgba(11, 4, 32, 0.55); border: 1px solid var(--line); border-radius: 16px;
    backdrop-filter: blur(6px); max-width: calc(100vw - 16px);
  }
  .places-nav { top: auto; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
  .places-nav button { width: 40px; height: 40px; padding: 0; justify-content: center; font-size: 18px; }
  .view-controls { bottom: calc(38px + env(safe-area-inset-bottom, 0px)); }
  .view-controls button { width: 38px; height: 38px; font-size: 17px; }
  .walk-hint { bottom: calc(138px + env(safe-area-inset-bottom, 0px)); font-size: 12px; }
  #card { bottom: 36px; }
}

/* ---- The Gallery, inside: clinical white, black type ---- */
body.in-gallery > *:not(.gallery-root) { visibility: hidden; }
.gallery-root { position: fixed; inset: 0; z-index: 200; background: #d8d4cc; color: #0b0b0d; font-family: "Space Grotesk", system-ui, sans-serif; visibility: visible; }
.gallery-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.gallery-canvas:active { cursor: grabbing; }
.gallery-hud { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; pointer-events: none; }
.gallery-where { font-weight: 700; letter-spacing: 0.18em; font-size: 12px; background: rgba(247, 245, 241, 0.86); padding: 8px 12px; border-radius: 2px; }
.gallery-buttons { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.gallery-root button { font: inherit; font-size: 13px; padding: 8px 12px; border: 1px solid #0b0b0d; background: #0b0b0d; color: #f7f5f1; border-radius: 2px; cursor: pointer; }
.gallery-root button.ghost { background: rgba(247, 245, 241, 0.9); color: #0b0b0d; }
.gallery-root button.out { background: #f7f5f1; color: #0b0b0d; }
.gallery-root button.small { padding: 4px 8px; }
.gallery-root button:hover { filter: brightness(1.15); }
.gallery-hint { position: absolute; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); margin: 0; font-size: 12px; color: #3a3833; background: rgba(247, 245, 241, 0.8); padding: 6px 10px; border-radius: 2px; max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
.gallery-panel { position: absolute; top: calc(64px + env(safe-area-inset-top, 0px)); right: 12px; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 120px); overflow: auto; background: #f7f5f1; border: 1px solid #0b0b0d; padding: 18px 18px 14px; box-sizing: border-box; }
.gallery-panel h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: 0.08em; }
.gallery-panel h3 { margin: 16px 0 6px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: #555; }
.gallery-panel .lead { margin: 0 0 8px; line-height: 1.45; }
.gallery-panel .pre { white-space: pre-line; }
.gallery-panel .fine { font-size: 12px; color: #555; }
.gallery-panel input[type=text], .gallery-panel input[type=search], .gallery-panel input[type=url], .gallery-panel input[type=number], .gallery-panel textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid #0b0b0d; background: #fff; color: #0b0b0d; border-radius: 0; }
.gallery-panel .field { display: grid; gap: 4px; margin: 8px 0; }
.gallery-panel .field > span { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #555; }
.gallery-panel .inline { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-size: 14px; }
.gallery-panel .gallery-close { position: sticky; top: 0; float: right; background: #f7f5f1; color: #0b0b0d; }
.gallery-list { list-style: none; margin: 6px 0; padding: 0; }
.gallery-list.top { list-style: decimal inside; }
.gallery-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #e2ded6; }
.gallery-list li button { background: none; color: #0b0b0d; border: none; padding: 4px 0; text-align: left; text-decoration: underline; }
.gallery-list li span { font-size: 12px; color: #555; }
.gallery-list li.none { color: #555; font-size: 13px; border: none; }
.gallery-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gallery-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-root .swatch { width: 28px; height: 28px; padding: 0; background: var(--c); border: 1px solid #999; }
.gallery-root .swatch[aria-pressed=true] { outline: 2px solid #0b0b0d; outline-offset: 2px; }
.gallery-work-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid #e2ded6; }
.gallery-work-row img, .gallery-work-row .noimg { width: 64px; height: 64px; object-fit: cover; background: #ddd; display: grid; place-items: center; }
.gallery-work-row input[type=color] { width: 36px; height: 24px; padding: 0; border: 1px solid #999; }
.gallery-work { width: 100%; max-height: 50vh; object-fit: contain; background: #eee; margin-bottom: 8px; }
.gallery-modal { position: absolute; inset: 0; background: rgba(11, 11, 13, 0.45); display: grid; place-items: center; padding: 16px; }
.gallery-modal-box { background: #f7f5f1; border: 1px solid #0b0b0d; padding: 20px; max-width: 420px; }
.gallery-modal-box h3 { margin: 0 0 8px; }
.gallery-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gallery-root [hidden] { display: none !important; }
.gallery-panel select { width: 100%; box-sizing: border-box; font: inherit; padding: 7px 8px; border: 1px solid #0b0b0d; background: #fff; color: #0b0b0d; border-radius: 0; }
.gallery-panel input[type=range] { width: 100%; accent-color: #0b0b0d; }
.gallery-plan { width: 100%; aspect-ratio: 1; background: #efece6; border: 1px solid #0b0b0d; touch-action: none; cursor: crosshair; display: block; }
.gallery-tools { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.gallery-root .gallery-tools button[aria-pressed=true] { background: #0b0b0d; color: #f7f5f1; }
.gallery-screens { display: grid; gap: 4px; margin-top: 6px; }
.gallery-screens select { width: auto; flex: 1; }
.gallery-light { display: grid; grid-template-columns: auto 36px auto 36px; gap: 6px; align-items: center; margin: 6px 0; font-size: 12px; }
.gallery-light label { grid-column: 1 / -1; display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 6px; }
.gallery-light input[type=color] { width: 36px; height: 24px; padding: 0; border: 1px solid #999; }
.gallery-chat { position: absolute; left: 12px; bottom: calc(44px + env(safe-area-inset-bottom, 0px)); width: min(340px, calc(100% - 24px)); max-height: 46%; display: flex; flex-direction: column; gap: 6px; background: #f7f5f1; border: 1px solid #0b0b0d; padding: 10px; box-sizing: border-box; }
.gallery-chat-head { display: flex; justify-content: space-between; align-items: center; }
.gallery-chat-status { margin: 0; font-size: 12px; color: #6b665e; }
.gallery-chat-status.here { color: #0a7a3d; }
.gallery-chat-list { flex: 1; overflow: auto; min-height: 60px; font-size: 14px; display: grid; gap: 4px; align-content: start; }
.gallery-chat-line.artist { color: #0a7a3d; }
.gallery-chat input[type=text] { width: 100%; box-sizing: border-box; font: inherit; padding: 7px 8px; border: 1px solid #0b0b0d; background: #fff; color: #0b0b0d; }
.gallery-chat-send { display: flex; gap: 6px; }
.gallery-chat .fine { margin: 0; font-size: 11px; color: #6b665e; }

/* ---- The top left, tidier: the name, one row of links, one row of your buttons ---- */
.links-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 10px; pointer-events: auto; }
.links-row .wp-link { margin-top: 0; font-size: 13px; padding: 7px 12px; }
.links-row .tg-link { margin-top: 0; }
/* The clock: your own time, big; day or night in the town under it. */
.stats div.wide dd#s-clock { color: var(--ink); text-shadow: none; font-size: 20px; letter-spacing: 0.04em; }
.stats #s-daynight { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
/* The places: at the bottom left, above the view buttons (no longer in the middle, under the buttons up top). */
@media (min-width: 721px) {
  .places-nav { top: auto; bottom: 108px; transform: none; }
  .places-nav::before { content: 'PLACES'; font-size: 10px; letter-spacing: 0.16em; color: var(--muted); padding-left: 10px; }
}
/* Low screens: just the icons (the name shows when you point at one). */
@media (min-width: 721px) and (max-height: 760px) {
  .places-nav { flex-direction: row; flex-wrap: nowrap; bottom: 104px; } /* all the icons in one row */
  .places-nav::before { display: none; }
  .places-nav b { display: none; }
  .places-nav button { width: 40px; height: 40px; padding: 0; justify-content: center; font-size: 18px; }
}
/* News you can click (it opens after a question, like every link). */
#ticker-inner span.news-link { cursor: pointer; text-decoration: underline dotted rgba(255, 255, 255, 0.4); text-underline-offset: 4px; }
.gallery-host { display: grid; gap: 4px; padding: 6px 0; border-bottom: 1px solid #e2ded6; }
.gallery-host .inline { margin: 0; }
.gallery-host select { flex: 1; }

/* No stray selections: dragging over the town (or a double click) used to select every label and picture on
   the page. Text you type stays selectable, and so do the whitepaper and long texts in cards. */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable], .card-body .line, .selectable { -webkit-user-select: text; user-select: text; }
canvas, img { -webkit-user-drag: none; }
/* Walking on a touch screen: a thumbstick bottom left (instead of the places, which hide while you walk). */
.walk-stick { display: none; position: fixed; left: calc(18px + env(safe-area-inset-left, 0px)); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 6;
  width: 116px; height: 116px; border-radius: 50%; background: rgba(18, 5, 46, 0.45); border: 2px solid rgba(0, 229, 255, 0.5);
  backdrop-filter: blur(4px); touch-action: none; }
.walk-stick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(0, 229, 255, 0.55); box-shadow: 0 0 16px rgba(0, 229, 255, 0.5); pointer-events: none; }
@media (pointer: coarse) {
  body.walking .walk-stick { display: block; }
  body.walking .places-nav { display: none; }
  body.walking .walk-hint { bottom: calc(220px + env(safe-area-inset-bottom, 0px)); }
}
@media (pointer: coarse) {
  body.walking .walk-hint { animation: walk-hint-fade 8s forwards; pointer-events: none; } /* the tips, then out of the way */
}
/* Walking: a badge at the top, a soft glow round the screen, the walk button lit. */
.walk-badge { display: none; position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 7;
  align-items: center; gap: 10px; padding: 5px 5px 5px 14px; max-width: min(360px, calc(100vw - 32px)); border-radius: 18px;
  background: rgba(18, 5, 46, 0.82); border: 2px solid var(--cyan); box-shadow: 0 0 18px rgba(0, 229, 255, 0.45); color: var(--ink); }
.walk-badge-text { display: flex; flex-direction: column; line-height: 1.15; }
.walk-badge b { color: var(--cyan); font-weight: 800; font-size: 15px; letter-spacing: 0.02em; }
.walk-badge .walk-keys { color: var(--muted); font-size: 11px; white-space: nowrap; }
.walk-badge button { border: 0; border-radius: 999px; padding: 7px 12px; background: var(--cyan); color: #12052e; font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
body.walking .walk-badge { display: flex; }
@media (max-width: 1060px) { .walk-badge { top: calc(96px + env(safe-area-inset-top, 0px)); left: auto; right: 16px; transform: none; } } /* (narrower: under the counters, clear of the title) */
body.walking::after { content: ''; position: fixed; inset: 0; z-index: 4; pointer-events: none;
  box-shadow: inset 0 0 0 3px rgba(0, 229, 255, 0.55), inset 0 0 60px rgba(0, 229, 255, 0.28); }
body.walking [data-view="walk"] { background: var(--cyan); color: #12052e; box-shadow: 0 0 16px rgba(0, 229, 255, 0.6); }
@media (hover: none), (max-width: 720px) {
  .walk-badge .walk-keys { display: none; } /* (on a phone: the thumbstick says it) */
}
/* Throwing things while walking: a button with what you throw, and one for the next thing. */
.throw-bar { display: none; position: fixed; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(110px + env(safe-area-inset-bottom, 0px)); z-index: 6; gap: 8px; align-items: center; }
body.walking .throw-bar { display: flex; }
.throw-bar button { border-radius: 50%; border: 2px solid rgba(0, 229, 255, 0.6); background: rgba(18, 5, 46, 0.6); color: var(--ink); cursor: pointer; backdrop-filter: blur(4px); touch-action: manipulation; }
.throw-go { width: 64px; height: 64px; font-size: 32px; line-height: 1; }
.throw-next { width: 40px; height: 40px; font-size: 18px; }
.throw-bar button:active { transform: scale(0.92); }
@keyframes walk-hint-fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
details.gallery-host { display: block; }
details.gallery-host > summary { cursor: pointer; padding: 4px 0; list-style: revert; }
details.gallery-host[open] > summary { color: #e0338f; }
details.gallery-host > label, .gallery-led { margin-top: 6px; }
.gallery-led { display: grid; gap: 6px; }
.gallery-led-seg { display: grid; gap: 4px; padding: 6px 8px; border-left: 3px solid #2d6cdf; background: rgba(0, 0, 0, 0.03); }
.gallery-led-seg input[type=range] { flex: 1; }
/* The loading screen: there from the first moment, fading out when the town is drawn. */
#loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(circle at 50% 40%, #2a0b4f, #0b0420 70%); color: #f3eeff; font: 700 15px/1.3 "Space Grotesk", system-ui, sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase; transition: opacity 0.6s ease; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-planet { width: 92px; height: 92px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #6fe3a0, #2f7d5a 55%, #173d36); box-shadow: 0 0 40px rgba(177, 74, 255, 0.55); }
.loading-planet::after { content: ''; position: absolute; inset: -18px; border-radius: 50%; border: 3px solid transparent;
  border-top-color: #ff2e97; border-right-color: #00e5ff; animation: loading-orbit 1.1s linear infinite; }
@keyframes loading-orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-planet::after { animation: none; } }
/* The builder pass (beta) in "My place", and short messages at the bottom of the screen. */
.builder-pass { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.builder-pass h3 { margin: 0 0 6px; font-size: 15px; }
.builder-pass textarea { width: 100%; box-sizing: border-box; min-height: 60px; padding: 8px 10px; font: inherit; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.toast { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 60; max-width: min(90vw, 420px); padding: 10px 14px;
  color: var(--ink); background: rgba(18, 5, 46, 0.94); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; transition: opacity 0.6s ease; }
.toast.gone { opacity: 0; }
.builder-pass .have-code { margin-top: 12px; }
.builder-pass .have-code summary { cursor: pointer; color: var(--cyan); font-size: 13px; }
.account-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.account-box h3 { margin: 0 0 6px; font-size: 15px; }
.account-box .login-way { margin-top: 10px; }
.account-box .login-way[hidden], .account-box .pw-panel[hidden], .account-box .pw-panel > div[hidden] { display: none; }
.account-box .pw-panel { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.account-box .pw-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.account-box .pw-tab { flex: 1; padding: 7px; font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.account-box .pw-tab.on { color: var(--ink); border-color: var(--cyan); }
.account-box .have-code { margin-top: 10px; }
.account-box .have-code summary { cursor: pointer; color: var(--cyan); font-size: 13px; }
.card-body > .account-box:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
/* Graffiti: the cut-out editor (a checkerboard shows what's see-through) and the bar while spraying. */
.graffiti-canvas { display: block; width: 100%; max-height: 46vh; object-fit: contain; margin: 10px 0; border-radius: 10px; touch-action: none;
  background: repeating-conic-gradient(#3a3352 0% 25%, #2a2440 0% 50%) 50% / 18px 18px; }
.graffiti-canvas.erasing { cursor: crosshair; }
.graffiti-tools { display: grid; gap: 6px; }
.graffiti-tools input[type=range] { width: 100%; }
.graffiti-owner { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.graffiti-owner h3 { margin: 0 0 6px; font-size: 15px; }
.shop .check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 13px; color: var(--ink); }
.graffiti-owner .check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 13px; color: var(--ink); }
.spray-bar { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 55; width: min(94vw, 520px); padding: 10px 12px;
  background: rgba(18, 5, 46, 0.94); border: 1px solid var(--line); border-radius: 14px; }
.spray-status { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.spray-status.bad { color: #ff8a8a; }
.spray-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.spray-row input[type=range] { flex: 1; min-width: 60px; }
.spray-row .pay { width: auto; margin: 0; padding: 8px 12px; }
.graffiti-choice { flex-wrap: wrap; }
.craft-choice { flex-wrap: wrap; }
