/* One deliberate world: a night-time toy town. The page stays dark on either
   host theme, so every colour is painted explicitly. */
:root {
  --sky: #0f1522;
  --ink: #e9edf6;
  --muted: #97a3bd;
  --faint: #5f6b85;
  --glass: rgba(16, 22, 36, .74);
  --line: rgba(206, 218, 255, .10);
  --gold: #f5c451;
  --gold-soft: #ffe6a3;
  --mint: #6fe3c1;
  --coral: #ff9a76;
  --shop: #8fb4ff;
  --pad: #ff7a8a;
  --gallery: #c49bff;
  --house: #ffcf7a;
  --display: "Bricolage Grotesque", "Noto Sans SC", system-ui, sans-serif;
  --body: "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); color: var(--ink); font: 14px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--gold-soft); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
#labels { position: fixed; inset: 0; pointer-events: none; }

.panel { position: fixed; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); z-index: 5; }

.brand { top: 16px; left: 16px; width: 330px; padding: 14px 16px 12px; }
.brand h1 { margin: 0; font: 800 30px/1 var(--display); letter-spacing: -.01em; }
.brand h1 span { font-family: var(--body); font-weight: 700; font-size: 26px; color: var(--gold); margin-left: 4px; }
.brand-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lang { display: flex; padding: 2px; border-radius: 8px; background: rgba(255,255,255,.06); }
.lang button { border: 0; background: transparent; color: var(--muted); font: 600 11.5px var(--mono); padding: 3px 8px; border-radius: 6px; }
.lang button[aria-pressed="true"] { background: rgba(245,196,81,.18); color: var(--gold-soft); }
.brand p { margin: 8px 0 10px; color: var(--muted); font-size: 13px; }
.live { display: flex; align-items: center; gap: 8px; font: 12px var(--mono); color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.live.on i { background: var(--mint); box-shadow: 0 0 0 0 rgba(111,227,193,.6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(111,227,193,0); } 100% { box-shadow: 0 0 0 0 rgba(111,227,193,0); } }

.stats { top: 16px; right: 16px; display: grid; grid-template-columns: repeat(3, auto); gap: 10px 22px; padding: 12px 18px; }
.stats div { display: flex; flex-direction: column; min-width: 0; }
.stats b { font: 800 22px/1.1 var(--display); font-variant-numeric: tabular-nums; }
.stats span { font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.guide { left: 16px; top: 170px; width: 330px; padding: 0; overflow: hidden; }
.guide-toggle { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; width: 100%; padding: 12px 16px; font-weight: 700; }
.guide-toggle em { font-style: normal; font-weight: 400; color: var(--faint); font-size: 12px; }
.guide-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.guide.closed .guide-body { display: none; }
.guide-body { padding: 0 16px 14px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.legend li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; font-size: 12.5px; color: var(--muted); }
.legend b { display: block; color: var(--ink); font-size: 13px; }
.sw { width: 12px; height: 12px; border-radius: 3px; margin-top: 4px; }
.sw.tower { background: var(--gold); }
.sw.shop { background: var(--shop); }
.sw.pad { background: var(--pad); }
.sw.gallery { background: var(--gallery); }
.sw.house { background: var(--house); }
.sw.people { background: linear-gradient(135deg, var(--mint) 50%, var(--coral) 50%); border-radius: 50%; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 3px 0 2px; vertical-align: 1px; }
.dot.codex { background: var(--mint); }
.dot.claude { background: var(--coral); }
.cta { width: 100%; margin-top: 14px; padding: 10px 12px; border: 0; border-radius: 10px; background: var(--gold); color: #231a02; font-weight: 700; }
.cta:hover { background: var(--gold-soft); }
.cta:disabled { opacity: .5; cursor: default; }
.hint { margin: 10px 0 0; font-size: 11.5px; color: var(--faint); text-align: center; }

.finder { right: 16px; top: 140px; display: flex; padding: 4px; gap: 4px; width: 280px; }
.finder input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink); font: 13px var(--mono); padding: 6px 10px; }
.finder input::placeholder { color: var(--faint); font-family: var(--body); }
.finder input:focus { outline: none; }
.finder button { border: 0; border-radius: 9px; background: rgba(255,255,255,.08); padding: 6px 14px; }
.finder button:hover { background: rgba(255,255,255,.14); }

.feed { left: 16px; bottom: 34px; width: 330px; padding: 12px 16px; max-height: 30vh; overflow: hidden; }
.feed h2 { margin: 0 0 6px; font-size: 12px; font-weight: 500; color: var(--faint); letter-spacing: .08em; }
.feed ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.feed li { font-size: 12.5px; color: var(--muted); display: grid; grid-template-columns: 52px 1fr; gap: 8px; animation: slide .5s ease; }
.feed li time { font: 11px var(--mono); color: var(--faint); padding-top: 2px; }
.feed li b { color: var(--ink); font-weight: 500; }
.feed li .k-oracle { color: var(--gold-soft); }
.feed li .k-join { color: var(--mint); }
@keyframes slide { from { opacity: 0; transform: translateY(-4px); } }

.drawer { right: 16px; top: 196px; bottom: 34px; width: 360px; padding: 18px 18px 14px; overflow-y: auto; }
.drawer .close { position: absolute; right: 10px; top: 8px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; font-size: 22px; color: var(--muted); }
.drawer .close:hover { background: rgba(255,255,255,.08); }
.drawer h3 { margin: 0 32px 2px 0; font: 700 20px/1.25 var(--body); }
.drawer .kicker { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.drawer .lede { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 13px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; margin: 2px 0 14px; }
.bar i { display: block; height: 100%; background: var(--mint); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.list li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.list li:first-child { border-top: 0; }
.list .q { color: var(--ink); display: block; }
.list .meta { color: var(--faint); font: 11.5px var(--mono); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.list .ans { color: var(--gold-soft); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font: 11px var(--mono); background: rgba(255,255,255,.07); color: var(--muted); }
.pill.ok { background: rgba(111,227,193,.14); color: var(--mint); }
.pill.warn { background: rgba(255,122,138,.14); color: var(--pad); }
.pill.gold { background: rgba(245,196,81,.16); color: var(--gold-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips button { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 3px 9px; font: 12px var(--mono); color: var(--muted); }
.chips button:hover { color: var(--ink); border-color: rgba(255,255,255,.25); }
.linkish { all: unset; cursor: pointer; color: var(--gold-soft); border-bottom: 1px dashed rgba(255,230,163,.4); }
.linkish:focus-visible { outline: 2px solid var(--gold); }
.drawer .out { display: inline-block; margin-top: 6px; font-size: 13px; }
.empty { color: var(--faint); font-size: 13px; }

.caption { left: 50%; transform: translateX(-50%); bottom: 34px; width: min(560px, calc(100vw - 32px)); padding: 14px 18px; text-align: center; border-color: rgba(245,196,81,.35); }
.steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.steps span { font: 11px var(--mono); padding: 2px 9px; border-radius: 99px; background: rgba(255,255,255,.06); color: var(--faint); transition: .3s; }
.steps span.on { background: var(--gold); color: #231a02; }
.steps span.done { color: var(--gold-soft); }
.caption p { margin: 0 0 8px; font-size: 14.5px; text-wrap: balance; }
.caption p b { color: var(--gold-soft); }
.caption button { border: 0; background: transparent; color: var(--faint); font-size: 12px; text-decoration: underline; }

/* 3D-anchored labels */
.lbl { font: 600 12px var(--body); color: var(--ink); background: rgba(12,17,28,.78); border: 1px solid var(--line); padding: 3px 9px 3px 8px; border-radius: 8px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.lbl i { width: 8px; height: 8px; border-radius: 2px; }
.lbl small { font: 11px var(--mono); color: var(--muted); }
.lbl.house { font-weight: 500; font-size: 11px; opacity: .85; padding: 2px 7px; }
.lbl.house.mine { border-color: var(--gold); opacity: 1; }
.bubble { font: 12px var(--body); background: #fff7df; color: #2a2006; padding: 6px 10px; border-radius: 10px; max-width: 260px; white-space: normal; text-align: center; box-shadow: 0 6px 24px rgba(0,0,0,.35); line-height: 1.4; }
.bubble b { font: 800 18px var(--display); display: block; }
.bubble small { color: #6b5a2a; display: block; }
.tag { font: 600 10.5px var(--mono); color: #231a02; background: var(--gold-soft); padding: 1px 5px; border-radius: 5px; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--sky); z-index: 20; transition: opacity .8s; font: 800 28px var(--display); text-align: center; }
.boot small { display: block; font: 13px var(--body); color: var(--muted); margin-top: 8px; }
.boot.gone { opacity: 0; pointer-events: none; }

.credit { position: fixed; bottom: 8px; left: 16px; right: 16px; font-size: 11px; color: var(--faint); z-index: 4; }
.credit a { color: var(--muted); }

@media (max-width: 820px) {
  .brand { width: auto; right: 16px; padding: 10px 14px; }
  .brand p { display: none; }
  .brand h1 { font-size: 24px; }
  .brand h1 span { font-size: 20px; }
  .brand .live { margin-top: 6px; }
  .stats { top: 92px; left: 16px; right: 16px; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; padding: 8px 12px; }
  .stats b { font-size: 16px; }
  .stats span { font-size: 10.5px; }
  .finder { top: auto; bottom: 34px; right: 16px; left: auto; width: 180px; }
  .guide { top: auto; bottom: 80px; right: 16px; width: auto; max-height: 52vh; overflow-y: auto; }
  .guide:not(.closed) { z-index: 7; }
  .feed { display: none; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; border-radius: 16px 16px 0 0; z-index: 8; }
  .caption { bottom: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
