@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("/fonts/silkscreen.woff2") format("woff2"); font-weight: 400; font-display: block; }

:root {
  --bg: #05070f; --panel: #0b0e1d; --panel-2: #10142a; --line: #1c2146; --line-2: #2a3166;
  --ink: #ece9f6; --ink-2: #a8abc9; --ink-3: #6d7197;
  --amber: #ffb04a; --sodium: #ff9a3c; --neon: #ff4fa3; --cyan: #5cf2d8; --gold: #f3c34b; --red: #ff5a52; --green: #6ee7a0;
  --f: "Geist", system-ui, sans-serif; --m: "Geist Mono", ui-monospace, monospace; --px: "Silkscreen", "Geist Mono", monospace;
  --bar: 58px; --wire: 34px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 400 14px/1.4 var(--f); overflow: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.is-hidden { display: none !important; }

/* scrollbars: thin, themed, no arrows */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-corner { background: transparent; }
@supports (-moz-appearance: none) { * { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; } }

/* ---------- header ---------- */
.bar { position: fixed; inset: 0 0 auto 0; height: var(--bar); z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px;
  padding: 0 18px; background: linear-gradient(180deg, #0a0d1b 0%, #070915 100%); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand .logo { width: 34px; height: 34px; border-radius: 7px; image-rendering: auto; box-shadow: 0 0 0 1px var(--line-2); }
.brand .word { font: 400 21px/1 var(--px); letter-spacing: 0.02em; text-transform: uppercase; color: #fff4e2;
  text-shadow: 0 0 14px rgba(255, 160, 70, 0.45), 0 0 2px rgba(255, 190, 120, 0.6); white-space: nowrap; }
.brand .tick { font: 600 11.5px/1 var(--m); color: var(--amber); padding: 5px 7px; border: 1px solid rgba(255, 176, 74, 0.35); border-radius: 4px; background: rgba(255, 176, 74, 0.07); }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, max-content)); gap: 0; justify-content: center; min-width: 0; }
.st { display: grid; grid-template-rows: 13px 20px 13px; padding: 0 20px; border-left: 1px solid var(--line); min-width: 104px; }
.st:first-child { border-left: 0; }
.st i { font: 500 10.5px/13px var(--f); font-style: normal; color: var(--ink-3); letter-spacing: 0.02em; }
.st b { font: 600 16.5px/20px var(--m); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.st b.cut { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-family: var(--f); }
.st em { font: 400 10.5px/13px var(--f); font-style: normal; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.st.hot b { color: var(--amber); }
.side { display: flex; align-items: center; gap: 12px; }
.links { display: flex; gap: 2px; }
.links a { font: 500 12.5px/1 var(--f); color: var(--ink-2); padding: 9px 10px; border-radius: 5px; }
.links a:hover { color: var(--ink); background: var(--panel-2); }
.xbtn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); }
.xbtn:hover { border-color: var(--ink-3); }
.clock { display: flex; align-items: baseline; gap: 4px; padding-left: 12px; border-left: 1px solid var(--line); }
.clock b { font: 700 24px/1 var(--m); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.clock i { font: 500 10px/1 var(--f); font-style: normal; color: var(--ink-3); }
/* the CA slot (kit ids) */
.ca-pill { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 4px 0 11px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); max-width: 430px; }
.ca-pill.is-live { border-color: rgba(255, 176, 74, 0.55); }
.ca-lab { font: 600 11px/1 var(--m); color: var(--amber); }
.ca-addr { display: flex; align-items: center; gap: 8px; min-width: 0; height: 26px; font: 500 12px/1 var(--m); color: var(--ink); cursor: copy; }
.ca-addr > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ca-copy { flex: none; font: 600 11px/1 var(--f); font-style: normal; padding: 6px 9px; border-radius: 4px; background: var(--amber); color: #1a0f02; }
.ca-link { flex: none; font: 600 11px/1 var(--f); padding: 7px 8px; border-radius: 4px; color: var(--ink-2); background: #171c38; }
.ca-link:hover { color: var(--ink); }

/* ---------- the stage ---------- */
#stage { position: fixed; left: 0; right: 0; top: var(--bar); bottom: var(--wire); overflow: hidden; background: #04050b; touch-action: none; }
#town { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; image-rendering: pixelated; opacity: 0; transition: opacity 0.6s ease; }
#town.ready { opacity: 1; }
#town.drag { cursor: grabbing; }
#poster, #poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: none; object-position: 50% 50%; image-rendering: pixelated; display: block; }   /* unscaled + centred = the canvas's own first frame */
#bubbles, #labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bub { position: absolute; left: 0; top: 0; max-width: 230px; padding: 6px 9px 7px; background: #f6f0e1; color: #1b1630; font: 500 12px/1.3 var(--f);
  border: 2px solid #1b1630; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55); border-radius: 2px; transform-origin: 50% 100%; will-change: transform; }
.bub b { display: block; font: 400 9px/1 var(--px); color: #6b4b10; margin-bottom: 3px; text-transform: uppercase; }
.bub::after { content: ""; position: absolute; left: 50%; bottom: -8px; margin-left: -4px; border: 4px solid transparent; border-top: 4px solid #1b1630; }
.bub.to { background: #e3f6ff; }
.bub.out { opacity: 0; transition: opacity 0.5s ease; }
.tag { position: absolute; left: 0; top: 0; font: 400 9px/1 var(--px); color: #fff7e8; padding: 3px 4px 2px; background: rgba(8, 9, 20, 0.86); border: 1px solid rgba(255, 176, 74, 0.5); white-space: nowrap; will-change: transform; }
.tag.mayor { color: var(--gold); border-color: var(--gold); }
.tag.bus { color: #ffd2cc; border-color: rgba(255, 90, 82, 0.7); background: rgba(30, 8, 10, 0.9); font-size: 10px; padding: 4px 6px 3px; }
.tag.hover { font: 500 12px/1 var(--f); padding: 6px 8px; color: var(--ink); background: rgba(8, 9, 20, 0.94); border-color: var(--line-2); border-radius: 4px; text-transform: none; }

.find { position: absolute; left: 16px; top: 14px; width: 330px; height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px 0 12px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; color: var(--ink-3); z-index: 5; }
.find input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--ink); font: 400 13px/1 var(--f); }
.find input::placeholder { color: var(--ink-3); }
.find kbd { font: 500 10.5px/1 var(--m); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 3px; padding: 3px 5px; }
.find ul { position: absolute; left: -1px; right: -1px; top: 40px; margin: 0; padding: 4px; list-style: none; background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; max-height: 300px; overflow: auto; }
.find li { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 8px 9px; border-radius: 4px; cursor: pointer; color: var(--ink); }
.find li span { color: var(--ink-3); font: 400 11.5px/1.3 var(--m); }
.find li:hover, .find li.on { background: var(--panel-2); }
.where { position: absolute; left: 16px; top: 60px; display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; background: rgba(9, 11, 23, 0.82); border: 1px solid var(--line); border-radius: 5px; z-index: 4; pointer-events: none; }
.where b { font: 400 11px/1 var(--px); color: #fff3df; text-transform: uppercase; }
.where span { font: 400 11px/1 var(--f); color: var(--ink-3); }

.zoom { position: absolute; right: 16px; bottom: 166px; display: grid; gap: 6px; z-index: 5; }
.zoom button { width: 34px; height: 34px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line-2); font: 500 18px/1 var(--f); color: var(--ink-2); }
.zoom button:hover { color: var(--ink); border-color: var(--ink-3); }
.zoom button.on { color: var(--amber); border-color: rgba(255, 176, 74, 0.5); font-size: 11px; }
#minimap { position: absolute; right: 16px; bottom: 16px; width: 200px; height: 138px; border: 1px solid var(--line-2); border-radius: 6px; background: #070914; z-index: 5; cursor: pointer; image-rendering: pixelated; }

/* ---------- resident card ---------- */
.card { position: absolute; right: 16px; top: 14px; width: 372px; max-height: calc(100% - 196px); overflow: auto; z-index: 6; padding: 16px;
  background: linear-gradient(180deg, #0d1124, #0a0d1c); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); }
.card .x { position: absolute; right: 8px; top: 6px; width: 28px; height: 28px; font-size: 20px; color: var(--ink-3); }
.card .x:hover { color: var(--ink); }
.who { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
#card-pic { width: 96px; height: 120px; border-radius: 6px; background: #080a16; border: 1px solid var(--line); image-rendering: pixelated; }
.id { display: grid; gap: 6px; min-width: 0; }
.id b { font: 600 19px/1.15 var(--f); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job { justify-self: start; font: 400 10px/1 var(--px); text-transform: uppercase; color: #1a0f02; background: var(--amber); padding: 5px 7px 4px; border-radius: 3px; }
.job.visitor { background: #8fa0ff; }
.job.jailed { background: var(--red); color: #fff; }
.addr { font: 400 11.5px/1 var(--m); color: var(--ink-3); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 14px 0 12px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.facts div { background: #0b0e1e; padding: 9px 10px; display: grid; gap: 3px; min-width: 0; }
.facts i { font: 500 10.5px/1 var(--f); font-style: normal; color: var(--ink-3); }
.facts b { font: 600 12.5px/1.25 var(--f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.traits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.traits li { padding: 10px 11px; border: 1px solid var(--line); border-radius: 6px; background: #0b0e1e; }
.traits .tl { font: 400 10px/1 var(--px); text-transform: uppercase; color: var(--amber); }
.traits p { margin: 6px 0 7px; font: 400 13px/1.35 var(--f); color: var(--ink); }
.traits .nums { display: flex; flex-wrap: wrap; gap: 5px; }
.traits .nums span { font: 500 11px/1 var(--m); color: var(--ink-2); padding: 4px 6px; background: #12162d; border-radius: 3px; }
.traits .nums a { font: 500 11px/1 var(--f); color: var(--cyan); padding: 4px 2px; }
.traits .empty { color: var(--ink-3); font-size: 12.5px; }
.traits li.rel { border-left: 2px solid #b44; }
.traits li.rel.friends { border-left-color: var(--cyan); } .traits li.rel.devcoin { border-left-color: var(--gold); } .traits li.rel.known { border-left-color: #a58bff; }
.traits li.rel .tl { color: var(--ink-2); }
.acts { display: flex; gap: 8px; margin-top: 14px; }
.btn { flex: 1; display: grid; place-items: center; height: 36px; border-radius: 6px; background: var(--amber); color: #1a0f02; font: 600 13px/1 var(--f); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn.ghost.on { color: var(--amber); border-color: rgba(255, 176, 74, 0.5); }

/* ---------- the wire ---------- */
.wire { position: fixed; left: 0; right: 0; bottom: 0; height: var(--wire); display: flex; align-items: center; background: #070914; border-top: 1px solid var(--line); z-index: 20; }
.wire-tag { flex: none; display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 14px; font: 400 10.5px/1 var(--px); text-transform: uppercase; color: var(--amber); border-right: 1px solid var(--line); background: #0a0c1b; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1.6s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.wire-win { flex: 1; min-width: 0; overflow: hidden; height: 100%; position: relative; }
.wire-track { position: absolute; left: 0; top: 0; height: 100%; display: flex; align-items: center; white-space: nowrap; will-change: transform; }
.wi { display: inline-flex; align-items: center; gap: 8px; padding: 0 22px 0 0; font: 400 12.5px/1 var(--m); color: var(--ink-2); }
.wi .n { color: var(--ink-3); }
.wi .k { font: 600 10.5px/1 var(--m); padding: 3px 5px; border-radius: 3px; background: #151a36; color: var(--ink); }
.wi .k.movein { background: rgba(110, 231, 160, 0.15); color: var(--green); }
.wi .k.bus { background: rgba(255, 90, 82, 0.15); color: var(--red); }
.wi .k.festival, .wi .k.burn { background: rgba(255, 176, 74, 0.16); color: var(--amber); }
.wi .k.gossip, .wi .k.talk { background: rgba(92, 242, 216, 0.12); color: var(--cyan); }
.wi .k.grudge { background: rgba(255, 79, 163, 0.14); color: var(--neon); }
.wi .k.jail { background: rgba(255, 90, 82, 0.2); color: #ffb3ae; }
.wi .k.election { background: rgba(243, 195, 75, 0.18); color: var(--gold); }
.wi a { color: var(--cyan); }
.wi b { color: var(--ink); font-weight: 500; }

/* ---------- smaller screens ---------- */
@media (max-width: 1500px) { .st:nth-child(5) { display: none; } .links { display: none; } }
@media (max-width: 1240px) { .st:nth-child(4) { display: none; } .st { padding: 0 14px; min-width: 92px; } .bar { gap: 16px; } }
@media (max-width: 980px) { .st:nth-child(2) { display: none; } .clock { display: none; } }
@media (max-width: 820px) {
  :root { --bar: 52px; --wire: 30px; }
  .bar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 0 10px; }
  .brand .word { font-size: 15px; }
  .brand .tick { display: none; }
  .brand .logo { width: 28px; height: 28px; }
  .stats { justify-content: end; }
  .st { min-width: 0; padding: 0 9px; grid-template-rows: 12px 18px 0; }
  .st em { display: none; }
  .st b { font-size: 14px; line-height: 18px; }
  .st i { font-size: 9.5px; line-height: 12px; }
  .st:nth-child(2), .st:nth-child(4), .st:nth-child(5) { display: none; }
  .side { gap: 6px; }
  .side .ca-pill { position: fixed; left: 10px; right: 10px; top: calc(var(--bar) + 8px); max-width: none; z-index: 21; }
  .side .ca-addr { flex: 1; }
  .xbtn { width: 30px; height: 30px; }
  .find { left: 10px; right: 10px; width: auto; top: 10px; height: 36px; }
  .find kbd { display: none; }
  body.has-ca .find { top: 52px; }
  .where { top: 54px; bottom: auto; left: 10px; }
  body.has-ca .where { top: 96px; }
  #minimap { display: none; }
  .zoom { right: 10px; bottom: 12px; grid-auto-flow: column; }
  .card { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 62%; padding: 14px; }
  .wi { font-size: 11.5px; }
  .bub { max-width: 172px; padding: 4px 7px 5px; font-size: 11px; line-height: 1.25; border-width: 1.5px; }
  .bub b { font-size: 8px; margin-bottom: 2px; }
  .wire-tag { padding: 0 10px; font-size: 9.5px; }
}

/* embedded in the resident page: only the town */
body.embed .bar, body.embed .wire, body.embed .find, body.embed .where, body.embed .zoom, body.embed #minimap, body.embed .card { display: none !important; }
body.embed #stage { top: 0; bottom: 0; }

/* the header with the CA filled: tiles step down by importance so nothing overlaps (owner rule: CA + X at every width) */
.st { overflow: hidden; }
@media (max-width: 2100px) { body.has-ca .links { display: none; } }
@media (max-width: 1760px) { body.has-ca .st:nth-child(5) { display: none; } }
@media (max-width: 1560px) { body.has-ca .st:nth-child(4) { display: none; } }
@media (max-width: 1420px) { body.has-ca .st:nth-child(2) { display: none; } body.has-ca .ca-pill { max-width: 390px; } }
@media (max-width: 1100px) { body.has-ca .clock { display: none; } }

/* film frames (loopback ?film=…): the town and its wordmark, nothing else */
body.film .bar, body.film .wire, body.film .find, body.film .where, body.film .zoom, body.film #minimap, body.film .card, body.film #poster { display: none !important; }
body.film #bubbles { display: none; }
body.film.film-bubbles #bubbles { display: block; }
body.film #labels .tag:not(.bus) { display: none; }
body.film #stage { top: 0; bottom: 0; }
body.film #town { cursor: default; }
.film-mark { position: absolute; left: 28px; bottom: 24px; display: flex; align-items: center; gap: 12px; z-index: 6; pointer-events: none; }
.film-mark b { font: 400 30px/1 var(--px); text-transform: uppercase; letter-spacing: 0.02em; color: #fff4e2; text-shadow: 0 0 18px rgba(255, 160, 70, 0.5), 0 2px 0 rgba(0, 0, 0, 0.6); }
.film-mark span { font: 600 14px/1 var(--m); color: var(--amber); padding: 6px 8px; border: 1px solid rgba(255, 176, 74, 0.45); border-radius: 4px; background: rgba(10, 8, 20, 0.7); }

/* the bus clip: the label reads at phone size in an X video; the end card */
body.film-bus .tag.bus { font-size: 26px; padding: 9px 13px 7px; border-width: 2px; letter-spacing: 0.02em; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); }
.film-end { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: #05060d; opacity: 0; transition: opacity 0.45s ease; }
.film-end.on { opacity: 1; }
.film-end img { grid-area: 1 / 1; max-width: 86%; max-height: 80%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); transition: opacity 0.45s ease; }
.film-end .fe-mark { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 16px; opacity: 0; transition: opacity 0.5s ease 0.2s; }
.film-end.mark img { opacity: 0; }
.film-end.mark .fe-mark { opacity: 1; }
.film-end .fe-mark b { font: 400 clamp(40px, 7vw, 96px)/1 var(--px); text-transform: uppercase; color: #fff4e2; text-shadow: 0 0 30px rgba(255, 160, 70, 0.55); }
.film-end .fe-mark span { font: 600 clamp(16px, 2vw, 26px)/1 var(--m); color: var(--amber); padding: 8px 12px; border: 1px solid rgba(255, 176, 74, 0.5); border-radius: 5px; }
body.film-bus .film-mark { opacity: 1; }
