/* NEON CHINATOWN — overlay UI. The city is the page; everything else floats above it. */
:root {
  --bg: #07050d;
  --panel: rgba(13, 9, 24, 0.76);
  --panel-strong: rgba(10, 7, 19, 0.94);
  --line: rgba(255, 70, 220, 0.18);
  --line-strong: rgba(255, 90, 230, 0.36);
  --ink: #f4efff;
  --muted: #c6bbe0;
  --dim: #8d82a9;
  --magenta: #ff2bd6;
  --magenta-ink: #2b0022;
  --cyan: #19f0ff;
  --jade: #3fd6a4;
  --gold: #ffd23a;
  --red: #ff3b5c;
  --radius: 6px;
  --cut: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --blur: saturate(150%) blur(14px);
  --font-display: "Orbitron", "Rajdhani", "Segoe UI", sans-serif;
  --font-ui: "Chakra Petch", "Rajdhani", system-ui, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  --font-cjk: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", "Hiragino Sans", sans-serif;
  --gutter: clamp(12px, 2.2vw, 22px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(5, 2, 10, 0.55) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
}

button {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

a {
  color: var(--cyan);
}

.cn {
  font-family: var(--font-cjk);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--magenta);
}
.eyebrow .cn {
  color: var(--cyan);
  margin-right: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, opacity 0.2s, box-shadow 0.2s;
}
.btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.btn:hover {
  background: rgba(255, 43, 214, 0.14);
  border-color: var(--magenta);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible,
.icon-btn:focus-visible,
.label:focus-visible,
.moon:focus-visible,
.place-item:focus-visible,
.chip-btn:focus-visible,
.chip:focus-visible,
.street button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.btn.accent {
  background: var(--magenta);
  border-color: var(--magenta);
  color: var(--magenta-ink);
  box-shadow: 0 0 24px rgba(255, 43, 214, 0.45);
}
.btn.accent:hover {
  background: #ff5ae0;
}
.btn.small {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  --cut: 7px;
}
.btn.big {
  height: 50px;
  padding: 0 34px;
  font-size: 16px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.btn.block {
  width: 100%;
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.busy {
  opacity: 0.75;
  cursor: progress;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  color: var(--ink);
  transition: background 0.2s;
}
.icon-btn:hover {
  background: rgba(255, 43, 214, 0.16);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn.social {
  text-decoration: none;
  color: inherit;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  background: var(--panel);
}
.icon-btn.social svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: none;
}

/* ── Loader ── */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(70% 50% at 50% 30%, rgba(255, 43, 214, 0.14), transparent 70%),
    radial-gradient(60% 50% at 50% 100%, rgba(25, 240, 255, 0.12), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    #06040c;
  transition: opacity 1s ease, visibility 1s;
}
#loader.gone {
  opacity: 0;
  visibility: hidden;
}
.loader-inner {
  width: min(520px, 100%);
  text-align: center;
}
.crest {
  width: 78px;
  height: 78px;
  margin: 0 auto 16px;
  color: var(--magenta);
  filter: drop-shadow(0 0 18px rgba(255, 43, 214, 0.7));
}
.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 9vw, 72px);
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 43, 214, 0.9), 0 0 28px rgba(255, 43, 214, 0.6), 0 0 60px rgba(25, 240, 255, 0.35);
  animation: flicker 6s infinite;
}
@keyframes flicker {
  0%, 92%, 96%, 100% { opacity: 1; }
  93%, 95% { opacity: 0.55; }
}
.sub {
  margin: 12px 0 30px;
  color: var(--muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 12px;
}
.sub .cn {
  color: var(--cyan);
  font-size: 15px;
  margin-right: 8px;
  text-shadow: 0 0 10px rgba(25, 240, 255, 0.7);
}
.progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
#progress-bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  box-shadow: 0 0 12px var(--magenta);
  transition: width 0.35s ease;
}
.progress-text {
  min-height: 22px;
  margin: 12px 0 26px;
  color: var(--dim);
  font-size: 13px;
  font-family: var(--font-mono);
}
#loader.error .progress-text {
  color: #ff9a8a;
}
.fineprint {
  margin: 28px auto 0;
  max-width: 380px;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.55;
}

/* ── HUD visibility ── */
.hud {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s ease 0.6s, transform 0.8s ease 0.6s;
}
body.entered .hud {
  opacity: 1;
  transform: none;
}
body:not(.entered) .hud {
  pointer-events: none;
}
body.instant .hud,
body.instant #loader {
  transition: none;
}
body.touring .dock,
body.touring .hint,
body.touring .panel,
body.touring .wire {
  opacity: 0;
  pointer-events: none;
}
body.photo .hud,
body.photo #labels,
body.photo .vignette {
  display: none;
}

/* ── Top bar ── */
.topbar {
  position: fixed;
  top: max(var(--gutter), env(safe-area-inset-top));
  left: var(--gutter);
  right: var(--gutter);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}
.topbar > * {
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  cursor: pointer;
}
.brand svg {
  width: 32px;
  height: 32px;
  color: var(--magenta);
  filter: drop-shadow(0 0 8px rgba(255, 43, 214, 0.8));
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.brand-text b {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-shadow: 0 0 10px rgba(255, 43, 214, 0.7);
}
.brand-text small {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand-text small .cn {
  color: var(--cyan);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-actions .btn {
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.top-actions .btn.ghost {
  background: var(--panel);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  font-size: 13px;
  color: var(--muted);
}
.chip b {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  font-size: 12.5px;
}
button.chip {
  appearance: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.law-chip b:first-of-type {
  color: #7dffba;
}
.law-chip b:last-of-type {
  color: #ff6f8f;
}
.law-chip .sep {
  color: var(--dim);
}
.law-chip.pending {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(25, 240, 255, 0.35);
}
.chip .pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
}
.chip.live .pulse {
  background: var(--jade);
  box-shadow: 0 0 10px var(--jade);
}
.chip.beat .pulse {
  animation: beat 1.2s ease-out;
}
@keyframes beat {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(63, 214, 164, 0.7); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); box-shadow: 0 0 0 14px rgba(63, 214, 164, 0); }
}

/* ── Panels ── */
.panel {
  position: fixed;
  z-index: 30;
  top: calc(max(var(--gutter), env(safe-area-inset-top)) + 58px);
  right: var(--gutter);
  width: min(400px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100vh - 200px);
  overflow: auto;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(25, 240, 255, 0.04);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 43, 214, 0.35) transparent;
  animation: panel-in 0.35s ease;
}
.panel.wide {
  width: min(440px, calc(100vw - 2 * var(--gutter)));
}
.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 40%;
  height: 2px;
  background: linear-gradient(90deg, var(--magenta), transparent);
}
.panel[hidden] {
  display: none;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-6px); }
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.panel h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-shadow: 0 0 14px rgba(255, 43, 214, 0.45);
}
.panel h2 .cn {
  margin-left: 8px;
  font-size: 17px;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(25, 240, 255, 0.6);
}
.panel-intro,
.lore-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.62;
}
.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.mini-title {
  margin: 18px 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.fine {
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.55;
}
.empty {
  color: var(--dim);
  font-size: 13px;
  margin: 4px 0;
}

.places {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.place-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.place-item:hover {
  background: rgba(255, 43, 214, 0.08);
}
.place-item b {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.place-item b .cn {
  margin-left: 6px;
  font-size: 12px;
  color: var(--cyan);
}
.place-item small {
  display: block;
  color: var(--dim);
  font-size: 12px;
}
.place-item .dot {
  flex: none;
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  border: 2px solid var(--magenta);
}
.place-item .dot.major {
  background: var(--magenta);
  box-shadow: 0 0 10px var(--magenta);
}

.lore-action:empty,
.lore-agents:empty {
  display: none;
}
.lore-action {
  margin: 4px 0 8px;
}
.lore-agents {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--dim);
}
.lore-agents button {
  border: 0;
  background: none;
  color: var(--cyan);
  cursor: pointer;
  padding: 0;
  font-size: 12.5px;
}

/* ── Council ── */
.mode {
  color: var(--gold);
}
.mode.live {
  color: var(--jade);
}
.law-now {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 6px 0 10px;
}
.tax {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.tax span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.tax b {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 900;
  line-height: 1.1;
}
.tax.buy b {
  color: #7dffba;
  text-shadow: 0 0 14px rgba(61, 255, 154, 0.5);
}
.tax.sell b {
  color: #ff6f8f;
  text-shadow: 0 0 14px rgba(255, 59, 92, 0.5);
}
.boss-line {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 210, 58, 0.25);
  background: linear-gradient(90deg, rgba(255, 210, 58, 0.08), transparent);
}
.boss-line .eyebrow {
  color: var(--gold);
}
.boss-line a {
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--gold);
  text-decoration: none;
}
.boss-line small {
  color: var(--dim);
  font-size: 12px;
}
.pending {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(25, 240, 255, 0.4);
  background: linear-gradient(160deg, rgba(25, 240, 255, 0.12), rgba(25, 240, 255, 0.02));
}
.pending[hidden] {
  display: none;
}
.pending .eyebrow {
  color: var(--cyan);
}
.pending p {
  margin: 4px 0 0;
  font-size: 13.5px;
}
.pending a {
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.countdown b {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--cyan);
}
.heat {
  margin-bottom: 12px;
}
.heat-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.heat-head .eyebrow {
  color: #ff8a1f;
}
.heat-head b {
  font-family: var(--font-mono);
  font-size: 14px;
}
.heat-head small {
  margin-left: auto;
  color: var(--dim);
  font-size: 12px;
}
.heat-bar {
  height: 6px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.heat-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #ffd23a, #ff8a1f, #ff3b30);
  box-shadow: 0 0 10px #ff3b30;
  transition: width 0.6s ease;
}
.bribe {
  padding: 12px 14px 14px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, rgba(255, 43, 214, 0.1), rgba(255, 43, 214, 0.02));
}
.bribe .mini-title {
  margin-top: 0;
  color: var(--magenta);
}
.slider {
  display: grid;
  grid-template-columns: 64px 1fr 58px;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  font-size: 13px;
  color: var(--muted);
}
.slider input {
  width: 100%;
  accent-color: var(--magenta);
  cursor: pointer;
}
.slider output {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
}
.slider output .d {
  display: block;
  font-size: 10.5px;
  color: var(--dim);
}
.cost {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 12px 0;
}
.cost span {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.cost b {
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--gold);
}
.cost small {
  flex-basis: 100%;
  color: var(--dim);
  font-size: 12px;
}
.wallet-line {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 1em;
}
.wallet-line:empty {
  display: none;
}
.wallet-line code {
  font-family: var(--font-mono);
  color: var(--cyan);
}
.rules {
  margin: 12px 0 0;
  border: 1px solid var(--line);
  padding: 8px 12px;
}
.rules summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.rules ul {
  margin: 8px 0 2px;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
}
.rules li {
  margin: 4px 0;
}
.laws {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12.5px;
}
.laws li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
}
.laws li b {
  font-family: var(--font-mono);
  color: var(--ink);
}
.laws li a {
  font-family: var(--font-mono);
}

/* ── Agents ── */
.recruit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(61, 255, 154, 0.35);
  background: linear-gradient(170deg, rgba(61, 255, 154, 0.1), rgba(61, 255, 154, 0.02));
}
.recruit .eyebrow {
  color: #3dff9a;
}
.recruit b {
  display: block;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--ink);
}
.recruit small {
  color: var(--dim);
  font-size: 12px;
}
.perk {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.cards figure {
  margin: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.cards img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}
.cards figcaption {
  padding: 4px 6px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.classes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.classes li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.classes .g {
  font-family: var(--font-cjk);
  font-weight: 900;
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.classes small {
  margin-left: auto;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
}
.street {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
}
.street button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}
.street button:hover {
  background: rgba(255, 43, 214, 0.08);
}
.street .g {
  font-family: var(--font-cjk);
  font-weight: 900;
  width: 20px;
  text-align: center;
}
.street small {
  display: block;
  color: var(--dim);
  font-size: 11.5px;
}
.street .mine {
  color: var(--gold);
  font-size: 10.5px;
  margin-left: auto;
  letter-spacing: 0.1em;
}
.agent-card {
  display: flex;
  gap: 14px;
  align-items: center;
}
.agent-card .glyph {
  flex: none;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-family: var(--font-cjk);
  font-weight: 900;
  font-size: 44px;
  border: 1px solid currentColor;
  text-shadow: 0 0 16px currentColor;
}
.agent-card .doing {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}
.agent-card .owner {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--dim);
  font-family: var(--font-mono);
}
.stats {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.stats li {
  display: grid;
  grid-template-columns: 80px 1fr 28px;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.stats i {
  display: block;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
}
.stats i span {
  display: block;
  height: 100%;
  background: currentColor;
}
.stats b {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--ink);
}

/* ── Token ── */
.ca-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.ca-box .eyebrow {
  grid-column: 1 / -1;
  color: var(--dim);
}
.ca-box code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
  color: var(--ink);
}
.ca-box code.pending {
  color: var(--gold);
}
.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.facts div {
  padding: 9px 11px;
  border: 1px solid var(--line);
}
.facts dt {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.facts dd {
  margin: 2px 0 0;
  font-weight: 600;
  font-size: 13.5px;
  font-family: var(--font-mono);
}
.link-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.link-grid .btn.accent {
  grid-column: 1 / -1;
}
.howto {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13.5px;
}
.howto li {
  margin: 4px 0;
}
.disclaimer {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.55;
}

/* ── Left column: the Wire above the weather dock ── */
.left-col {
  position: fixed;
  z-index: 20;
  left: var(--gutter);
  bottom: max(var(--gutter), env(safe-area-inset-bottom));
  width: min(420px, calc(100vw - 2 * var(--gutter)));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.left-col > * {
  pointer-events: auto;
}

/* ── The Wire ── */
.wire {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}
.wire-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.wire-live {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.wire-live.live {
  color: var(--jade);
}
#wire-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 8px;
  max-height: 132px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wire.open #wire-list {
  max-height: 46vh;
  overflow: auto;
}
#wire-list li {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
  animation: wire-in 0.5s ease;
}
#wire-list li .tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
  vertical-align: 1px;
}
#wire-list li.w-chain .tag {
  color: var(--jade);
}
#wire-list li.w-street .tag {
  color: var(--dim);
}
#wire-list li.w-sim .tag {
  color: var(--gold);
}
#wire-list li b {
  color: var(--ink);
  font-weight: 600;
}
#wire-list li a {
  color: var(--cyan);
  text-decoration: none;
}
#wire-list li button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--cyan);
  cursor: pointer;
  font-size: 12.5px;
}
@keyframes wire-in {
  from { opacity: 0; transform: translateX(-8px); }
}

/* ── Dock: weather and time ── */
.dock {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.dock-row {
  display: grid;
  gap: 8px;
}
.moons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.moon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}
.moon:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.moon.on {
  color: var(--ink);
  border-color: var(--magenta);
  background: rgba(255, 43, 214, 0.14);
}
.moon-dot {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
}
.moon-dot.acid { background: #7dffba; }
.moon-dot.neon { background: #ff5ad8; }
.moon-dot.clear { background: #bfe9ff; }
.moon-dot.monsoon { background: #6a8cff; }
.moon-dot.blood { background: #ff3b30; }
.moon-note {
  margin: 8px 0 10px;
  min-height: 36px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.45;
}
.time-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--muted);
}
.time-label b {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
}
#time {
  width: 100%;
  margin: 8px 0 6px;
  accent-color: var(--magenta);
  cursor: pointer;
  height: 22px;
}
.time-quick {
  display: flex;
  gap: 6px;
}
.chip-btn {
  flex: 1;
  height: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.chip-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ── Actions ── */
.actions {
  position: fixed;
  z-index: 20;
  right: var(--gutter);
  bottom: max(var(--gutter), env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
}
.actions .btn {
  height: 44px;
  padding: 0 20px;
}
.actions .icon-btn {
  width: 44px;
  height: 44px;
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.hint {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(max(var(--gutter), env(safe-area-inset-bottom)) + 12px);
  translate: -50% 0;
  margin: 0;
  padding: 6px 14px;
  background: rgba(8, 5, 14, 0.55);
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Floating labels (places and agents) ── */
#labels {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}
.label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 7px;
  margin: 0;
  border: 1px solid rgba(255, 43, 214, 0.35);
  background: rgba(10, 6, 18, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  translate: -50% calc(-100% - 14px);
  transition: background 0.2s, border-color 0.2s;
  will-change: transform, opacity;
}
.label .pin {
  width: 11px;
  height: 11px;
  transform: rotate(45deg);
  border: 2px solid var(--magenta);
  background: rgba(255, 43, 214, 0.25);
}
.label .cn {
  color: var(--cyan);
  font-size: 11px;
}
.label.major {
  font-size: 13px;
  font-weight: 600;
  padding: 5px 13px 5px 8px;
}
.label.major .pin {
  background: var(--magenta);
  box-shadow: 0 0 12px rgba(255, 43, 214, 0.8);
}
.label:hover,
.label.active {
  background: rgba(10, 6, 18, 0.94);
  border-color: var(--cyan);
}
.label::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 14px;
  background: linear-gradient(rgba(255, 43, 214, 0.7), transparent);
}
.label.agent {
  font-size: 11px;
  padding: 2px 8px 2px 5px;
  border-color: color-mix(in srgb, var(--c, #19f0ff) 55%, transparent);
  translate: -50% calc(-100% - 6px);
}
.label.agent .g {
  font-family: var(--font-cjk);
  font-weight: 900;
  color: var(--c, var(--cyan));
  text-shadow: 0 0 8px var(--c, var(--cyan));
}
.label.agent.mine {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(255, 210, 58, 0.4);
}
.label.agent::after {
  height: 6px;
}

/* ── Tour ── */
#tour {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}
#tour[hidden] {
  display: none;
}
#tour .bars i {
  position: absolute;
  left: 0;
  right: 0;
  height: 7vh;
  background: #030206;
  animation: bars-in 0.8s ease both;
}
#tour .bars i:first-child { top: 0; }
#tour .bars i:last-child { bottom: 0; }
@keyframes bars-in {
  from { height: 0; }
}
.tour-card {
  position: absolute;
  left: 50%;
  bottom: calc(7vh + 22px);
  translate: -50% 0;
  width: min(640px, calc(100vw - 2 * var(--gutter)));
  padding: 18px 22px 16px;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  pointer-events: auto;
}
.tour-card.in {
  animation: caption 0.7s ease;
}
@keyframes caption {
  from { opacity: 0; transform: translateY(10px); }
}
.tour-card h3 {
  margin: 6px 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 0 14px rgba(255, 43, 214, 0.5);
}
.tour-card p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}
.tour-ctrl {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
body.touring .topbar,
body.touring .actions .icon-btn,
body.touring #btn-tour {
  opacity: 0;
  pointer-events: none;
}

/* ── Toast ── */
#toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: calc(max(var(--gutter), env(safe-area-inset-top)) + 64px);
  translate: -50% -8px;
  max-width: min(560px, calc(100vw - 2 * var(--gutter)));
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  background: var(--panel-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  font-size: 13.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, translate 0.3s;
}
#toast.show {
  opacity: 1;
  translate: -50% 0;
}
#toast.bad {
  border-color: var(--red);
}
#toast.good {
  border-color: var(--jade);
}

/* Title card for the social preview image (?og) */
.og-title {
  display: none;
}
body.og .og-title {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 64px 56px;
  background: linear-gradient(180deg, transparent 45%, rgba(6, 3, 12, 0.78) 100%);
}
body.og .og-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 92px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 43, 214, 0.9), 0 0 40px rgba(255, 43, 214, 0.6);
}
body.og .og-title p {
  margin: 10px 0;
  font-size: 26px;
  color: var(--muted);
}
body.og .og-title p:first-child {
  color: var(--cyan);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 20px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--bg);
  color: var(--muted);
}

#tally {
  position: fixed;
  left: 8px;
  top: 64px;
  z-index: 90;
  margin: 0;
  padding: 6px 8px;
  max-width: 60vw;
  white-space: pre-wrap;
  font: 11px var(--font-mono);
  color: #9f9;
  background: rgba(0, 0, 0, 0.6);
}

/* ── Small screens ── */
.only-m,
.btn .short {
  display: none;
}
@media (max-width: 1180px) {
  .chip-label {
    display: none;
  }
  .btn .long {
    display: none;
  }
  .btn .short {
    display: inline;
  }
}
@media (max-width: 860px) {
  body {
    font-size: 14px;
  }
  .brand {
    padding: 5px 12px 5px 7px;
  }
  .brand svg {
    width: 28px;
    height: 28px;
  }
  .brand-text small,
  .hint,
  #btn-places,
  #block-chip,
  #link-x-top {
    display: none;
  }
  .only-m {
    display: inline-grid;
  }
  .chip {
    padding: 0 10px;
  }
  .top-actions .btn {
    padding: 0 12px;
  }
  .panel,
  .panel.wide {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 74vh;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    clip-path: none;
    animation: sheet-in 0.35s ease;
  }
  @keyframes sheet-in {
    from { transform: translateY(30px); opacity: 0; }
  }
  body.panel-open .left-col,
  body.panel-open .actions {
    opacity: 0;
    pointer-events: none;
  }
  .left-col {
    bottom: calc(max(var(--gutter), env(safe-area-inset-bottom)) + 56px);
  }
  .dock {
    padding: 10px 12px;
  }
  .moons {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .moon {
    flex: none;
  }
  .moon-note {
    display: none;
  }
  #wire-list {
    max-height: 38px;
  }
  .actions {
    left: var(--gutter);
    right: var(--gutter);
  }
  .actions #btn-tour {
    flex: 1;
  }
  .tour-card {
    bottom: calc(7vh + 12px);
    padding: 14px 16px;
  }
  .tour-card h3 {
    font-size: 17px;
  }
}

@media (max-width: 560px) {
  .brand-text {
    display: none;
  }
  .brand {
    padding: 5px 7px;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions .btn,
  .chip {
    height: 36px;
    padding: 0 10px;
    font-size: 12.5px;
    --cut: 7px;
  }
  .time-quick .chip-btn {
    height: 26px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .classes {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
