/* Palette lifted from the town art: plum ink, mauve pavement, rose roofs, teal walls, olive grass. */
:root {
  --ink: #2a1b2e; --bg: #1d1322; --bg2: #271a2d; --card: #32223a; --card2: #3d2a46; --line: #4d3858;
  --text: #fbeef2; --muted: #b9a2bd; --mauve: #ae8296; --rose: #f26b7a; --coral: #f4846a; --pink: #ffc9d6;
  --teal: #6cc5bd; --olive: #b5a868; --gold: #ffd166; --good: #8fe0a8; --bad: #ff8a8a; --cloud: #fdeef0;
  --r: 14px; --font: 'Nunito', system-ui, sans-serif; --display: 'Fredoka', 'Nunito', sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
  --panel-w: 400px; --gap: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; opacity: .5; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
textarea { resize: vertical; width: 100%; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: .01em; }
h2 { font-size: 20px; } h3 { font-size: 16px; } h3 small, h2 small { font: 600 12px var(--font); color: var(--muted); margin-left: 4px; } h3.gap { margin: 16px 0 8px 2px; color: var(--pink); }
p { margin: 0; } code, pre { font-family: var(--mono); font-size: 12px; } a { color: var(--teal); }
.muted { color: var(--muted); } .sub { color: var(--muted); font-size: 13.5px; } .sub b { color: var(--text); }
.fine { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-top: 12px; } .fine.top { margin: 0 0 10px; }
.link { color: var(--teal); text-decoration: underline dotted; font-family: var(--mono); font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.up { color: var(--good); } .down { color: var(--bad); }

/* ---- the map: it is the page ---- */
body.townpage { position: fixed; inset: 0; overflow: hidden; background: var(--cloud); overscroll-behavior: none; }
.map { position: fixed; inset: 0; overflow: hidden; background: var(--cloud); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; outline-offset: -4px; }
.map.dragging { cursor: grabbing; } .map.dragging .actor, .map.dragging .tag, .map.dragging .ptag { cursor: grabbing; }
.scene { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.layer { position: absolute; user-select: none; pointer-events: none; transition: filter .2s; }
.layer.hot { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 14px rgba(255, 230, 150, .95)) brightness(1.08); }
.layer.cloud { animation: drift 50s ease-in-out infinite alternate; will-change: transform; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(var(--dx, 20px)); } }
.overcast .layer.cloud { filter: brightness(.86) saturate(.8); }
.tint { position: absolute; inset: 0; z-index: 15000; pointer-events: none; mix-blend-mode: multiply; transition: background 4s linear;
  background: linear-gradient(rgba(28, 30, 92, var(--dark, 0)), rgba(28, 30, 92, var(--dark, 0))), linear-gradient(rgba(255, 120, 70, var(--dusk, 0)), rgba(255, 120, 70, var(--dusk, 0))); }
.lamp { position: absolute; width: 220px; height: 150px; margin: -40px 0 0 -110px; z-index: 15001; pointer-events: none; opacity: 0; transition: opacity 3s; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 224, 150, .75), rgba(255, 224, 150, 0)); mix-blend-mode: screen; }
.lamps .lamp { opacity: 1; }
.rain { position: absolute; inset: -200px; z-index: 19000; pointer-events: none; opacity: 0; transition: opacity 2s;
  background-image: repeating-linear-gradient(105deg, rgba(220, 235, 255, 0) 0 22px, rgba(220, 235, 255, .42) 22px 24px, rgba(220, 235, 255, 0) 24px 60px); background-size: 240px 240px; }
.raining .rain { opacity: .5; animation: rain .5s linear infinite; } .pouring .rain { opacity: .85; animation-duration: .32s; }
@keyframes rain { to { background-position: -62px 240px; } }

/* Figures are depth-sorted against the art. Only a walker is promoted to its own layer: ninety permanent layers
   interleaved with the buildings would cost more than they save. */
.actor { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.actor.walking, .label.walking { will-change: transform; }
.actor .fig { position: absolute; left: 0; top: 0; transform: scale(var(--boost, 1)); transform-origin: 0 0; }
.actor .body { position: absolute; left: -24px; top: -60px; width: 48px; height: 58px; display: block; filter: drop-shadow(0 3px 0 rgba(42, 27, 46, .35)); transform-origin: 50% 100%; }
.actor .body svg { width: 100%; height: 100%; overflow: visible; display: block; }
.actor.visitor .body { width: 40px; height: 48px; left: -20px; top: -50px; }
.actor.flip .body { transform: scaleX(-1); }
.actor.walking .body { animation: bob .34s ease-in-out infinite; } .actor.walking.flip .body { animation-name: bobf; }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-3deg); } } @keyframes bobf { 0%, 100% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-4px) rotate(-3deg); } }
.actor.asleep .body { filter: brightness(.72) saturate(.7) drop-shadow(0 3px 0 rgba(42, 27, 46, .35)); }
.actor.selected .body { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 8px rgba(255, 209, 102, .95)); }
.actor.mine .fig::before { content: ''; position: absolute; left: -23px; top: -10px; width: 46px; height: 17px; border-radius: 50%; border: 3px solid var(--gold); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 1.5px var(--ink); }

/* Names, bubbles and place tags live above the art, the night and the clouds, and are counter-scaled by 1/zoom
   (--inv, set by the camera) so they are the same size on screen at any zoom. */
.labels { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 30000; pointer-events: none; }
.label { position: absolute; left: 0; top: 0; width: 0; height: 0; } .label:has(.bubble) { z-index: 2; } .ptag-at { z-index: 1; }
.lab { position: absolute; left: 0; top: 0; width: 0; height: 0; transform: scale(var(--inv, 1)); transform-origin: 0 0; }
.tag { position: absolute; left: 0; top: 5px; transform: translateX(-50%); pointer-events: auto; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font: 600 12px/1.2 var(--display); padding: 1px 8px 2px; border-radius: 99px; border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink); background: var(--pink); color: var(--ink); }
.tag.kuro { background: var(--gold); } .tag.vis { background: var(--teal); font-size: 11.5px; }
.tag.mine { box-shadow: 0 0 0 2.5px var(--gold), 0 0 0 4.5px var(--ink); } .tag.selected { outline: 2.5px solid #fff; outline-offset: 1px; }
.tag.asleep::after { content: 'z z'; font-size: 10px; opacity: .65; letter-spacing: .04em; }
.sash { background: var(--gold); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 6px; padding: 0 5px; font: 700 9.5px/1.35 var(--display); text-transform: uppercase; letter-spacing: .05em; margin-right: -4px; }
.bubble { position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - var(--head, 62px) - 8px)); width: max-content; max-width: 250px; font: 600 13.5px/1.3 var(--font); background: #fff; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 14px; padding: 5px 11px; box-shadow: 0 3px 0 var(--ink); text-align: left; white-space: normal; overflow-wrap: anywhere; pointer-events: none; animation: pop .22s ease-out; }
.bubble.think { background: #fff6d8; border-style: dashed; font-style: italic; }
@keyframes pop { from { opacity: 0; } }
.ptag { position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 3px; opacity: .92; }
.ptag:hover, .ptag.hot { opacity: 1; }
.ptag-top { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font: 600 13px/1.2 var(--display); background: var(--ink); color: var(--text); padding: 3px 5px 3px 11px; border-radius: 99px; border: 2px solid var(--ink); box-shadow: 0 2px 0 rgba(42, 27, 46, .5); }
.ptag.hot .ptag-top { background: var(--gold); color: var(--ink); }
.ptag-n { min-width: 20px; text-align: center; background: var(--card2); color: var(--muted); border-radius: 99px; padding: 0 6px; font-size: 12px; } .ptag.busy .ptag-n { background: var(--teal); color: var(--ink); }
.ptag-sign { font: 600 12px var(--font); background: #fff6d8; color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 0 8px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .ptag-sign[hidden] { display: none; }
.ptag.pulse::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; border: 4px solid var(--gold); animation: ring 1.4s ease-out 2; pointer-events: none; }
@keyframes ring { to { transform: scale(6); opacity: 0; } }

/* ---- HUD: overlays on the map. The frame ignores the pointer; only the pieces take clicks. ---- */
.hud { position: fixed; inset: 0 calc(var(--panel-w) + var(--gap)) 0 0; z-index: 40; pointer-events: none; transition: right .25s ease; container-type: inline-size; }
.panel-closed .hud { right: 0; }
.hud > div { position: absolute; display: flex; gap: 8px; pointer-events: none; } .hud-top > div { display: flex; gap: 8px; } .hud-top > div > *, .hud-bl > *, .hud-br > * { pointer-events: auto; }
/* the top row is one flex line (brand, payout card, pills) so the three can never sit on top of each other */
.hud-top { left: var(--gap); right: var(--gap); top: var(--gap); align-items: flex-start; justify-content: space-between; gap: 10px; }
.hud-tl { flex: none; } .hud-tc { flex: 0 1 auto; flex-direction: column; align-items: center; min-width: 0; } .hud-tr { flex: 1 1 0; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.hud-bl { left: var(--gap); bottom: var(--gap); max-width: calc(100% - 330px); } .hud-br { right: var(--gap); bottom: var(--gap); flex-direction: column; align-items: flex-end; }
.brandblock { background: var(--bg2); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 8px 12px 9px; display: grid; gap: 5px; width: 318px; }
.brand { display: flex; align-items: center; gap: 8px; font: 700 21px/1 var(--display); color: var(--pink); text-decoration: none; white-space: nowrap; }
.brand-cat { width: 34px; height: 30px; display: inline-block; flex: none; } .brand-cat svg { width: 100%; height: 100%; display: block; }
.brand-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; font: 500 13px var(--display); color: var(--muted); } .brand-meta b { color: var(--gold); font-weight: 600; } .intown { color: var(--text); }
.wx { color: var(--muted); border-bottom: 1px dotted var(--muted); font: inherit; } .wx.live { color: var(--teal); border-color: var(--teal); }
.demo { font: 600 11px var(--display); background: var(--olive); color: var(--ink); border: 2px solid var(--ink); border-radius: 99px; padding: 0 8px; }
.phase { display: grid; gap: 4px; }
.phase-bar { position: relative; display: flex; height: 8px; border-radius: 99px; overflow: hidden; border: 2px solid var(--ink); background: var(--bg); }
.seg.s1 { width: var(--lock, 80%); background: var(--teal); } .seg.s2 { flex: 1; background: var(--rose); }
.phase[data-phase='night'] .seg { background: #3b3f78; }
.cursor { position: absolute; top: -3px; bottom: -3px; width: 4px; margin-left: -2px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 2px var(--ink); transition: left .25s linear; }
.phase-text { display: grid; gap: 1px; font: 500 12.5px/1.3 var(--display); } .model { color: var(--teal); font-size: 11.5px; } .model.mock { color: var(--olive); }

.paycard { display: flex; align-items: stretch; background: var(--bg2); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); overflow: hidden; text-align: left; }
.paycard[hidden] { display: none; }
.paycard > span { display: grid; padding: 6px 13px 7px; border-right: 2px solid var(--ink); } .paycard > span:last-child { border-right: 0; }
.paycard small { font: 600 10.5px var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; } .paycard b { font: 600 16px/1.15 var(--display); white-space: nowrap; }
.pay-main { background: var(--gold); } .pay-main small { color: #6b4d12; } .pay-main b { color: var(--ink); font-size: 21px; font-variant-numeric: tabular-nums; } .paycard.short #payQual { color: var(--coral); }
.notice { display: flex; gap: 8px; align-items: center; max-width: min(560px, 90vw); background: #fff6d8; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 12px; padding: 4px 6px 4px 12px; font: 600 13px var(--font); box-shadow: 0 3px 0 var(--ink); } .notice[hidden] { display: none; } .notice button { font-size: 20px; line-height: 1; padding: 0 6px; }

.pill { border: 2.5px solid var(--ink); border-radius: 999px; padding: 6px 13px; font: 600 13.5px var(--display); background: var(--bg2); box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.pill:hover { background: var(--card2); } .pill:active, .ctl:active, .pchip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.pill.wallet { background: var(--teal); color: var(--ink); } .pill.wallet.on { background: var(--card2); color: var(--gold); max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.pill.primary { background: var(--rose); color: var(--ink); font-weight: 700; }
.placechips { display: flex; flex-wrap: wrap-reverse; gap: 5px; }
.pchip { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 99px; padding: 3px 5px 3px 10px; font: 600 12.5px var(--display); background: var(--bg2); color: var(--muted); box-shadow: 0 2px 0 var(--ink); white-space: nowrap; }
.pchip b { min-width: 20px; text-align: center; border-radius: 99px; padding: 0 6px; background: var(--card2); font-weight: 600; } .pchip.busy { color: var(--text); } .pchip.busy b { background: var(--teal); color: var(--ink); } .pchip:hover { background: var(--card2); }
.ctl { min-width: 38px; height: 38px; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--bg2); box-shadow: 0 3px 0 var(--ink); font: 700 20px/1 var(--display); } .ctl.wide { padding: 0 12px; font-size: 13px; font-weight: 600; } .ctl:hover:not(:disabled) { background: var(--card2); }
.zoomctl { display: flex; gap: 5px; align-items: center; } .zoomval { font: 600 12px var(--display); color: var(--ink); background: rgba(253, 238, 240, .85); border-radius: 8px; padding: 1px 6px; min-width: 44px; text-align: center; }

.toast { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--text); border: 2px solid var(--pink); border-radius: 12px; padding: 8px 14px; font: 600 14px var(--display); max-width: min(520px, 90vw); text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.toast[hidden] { display: none; } .toast.good { border-color: var(--good); } .toast.bad { border-color: var(--bad); }
.noscript { position: fixed; inset: auto 12px 12px; z-index: 70; background: var(--ink); padding: 12px; border-radius: 12px; }

/* ---- inspector ---- */
.inspector { position: fixed; left: var(--gap); top: 150px; z-index: 46; width: 330px; max-height: calc(100vh - 250px); overflow-y: auto; background: var(--bg2); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 12px; display: grid; gap: 10px; }
.inspector[hidden] { display: none; }
.ins-head { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.ins-pic { width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--ink); background: var(--pink); overflow: hidden; display: block; } .ins-pic.visitor { background: var(--teal); } .ins-pic.place { background: var(--mauve); } .ins-pic:empty { visibility: hidden; }
.ins-pic img, .ins-pic svg { width: 100%; height: 100%; object-fit: contain; display: block; } .ins-pic.resident img { object-fit: cover; }
.ins-title h2 { font-size: 18px; line-height: 1.15; overflow-wrap: anywhere; } .ins-title .sub { font-size: 12.5px; }
.ins-btns { display: flex; gap: 4px; align-items: flex-start; } .ins-x { font-size: 24px; line-height: 1; color: var(--muted); padding: 0 6px; }
.sashchip { background: var(--gold); color: var(--ink) !important; border-radius: 6px; padding: 0 6px; text-transform: uppercase; letter-spacing: .05em; font-size: 10px !important; vertical-align: 2px; }
.ins-body { display: grid; gap: 8px; } .ins-body h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ins-thought { font-style: italic; font-size: 13.5px; color: var(--pink); } .ins-desc { font-size: 13.5px; overflow-wrap: anywhere; }
.ins-tok { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; border-top: 2px dashed var(--line); font-size: 13.5px; } .ins-tok b { color: var(--gold); }
.ins-whisper { margin: 0; padding: 10px; } .ins-kv { grid-template-columns: 84px minmax(0, 1fr); font-size: 13px; }
.ins-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; } .ins-lines li { background: var(--card); border-radius: 9px; padding: 5px 8px; overflow-wrap: anywhere; } .ins-lines time { font: 500 11px var(--mono); color: var(--muted); }
.ins-foot .fine { margin: 0; } .herelist { display: flex; flex-wrap: wrap; gap: 4px; }
.herechip { border: 2px solid var(--ink); border-radius: 99px; padding: 0 8px; font: 600 12px var(--display); background: var(--pink); color: var(--ink); } .herechip.visitor { background: var(--teal); }

/* ---- panel: 400px on the right, a bottom sheet on phones ---- */
.panel { position: fixed; top: var(--gap); right: var(--gap); bottom: var(--gap); width: var(--panel-w); z-index: 44; display: flex; flex-direction: column; background: var(--bg2); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--ink); transition: transform .25s ease; }
.panel-closed .panel { transform: translateX(calc(100% + var(--gap) + 4px)); }
.panel-handle { position: absolute; left: -31px; top: 50%; margin-top: -30px; width: 30px; height: 60px; background: var(--bg2); border: 3px solid var(--ink); border-right: 0; border-radius: 12px 0 0 12px; font: 700 20px/1 var(--display); color: var(--pink); }
.panel-closed .panel-handle { left: -47px; }
.tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-bottom: 2px solid var(--ink); background: var(--bg); border-radius: 15px 15px 0 0; overflow: hidden; flex: none; }
.tabs button { padding: 11px 0; font: 600 12px var(--display); color: var(--muted); border-right: 2px solid var(--ink); white-space: nowrap; } .tabs button:last-child { border-right: 0; }
.tabs button[aria-selected='true'] { background: var(--bg2); color: var(--pink); box-shadow: inset 0 -3px 0 var(--rose); } .tabs button:focus-visible { outline-offset: -3px; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; border-radius: 0 0 15px 15px; overscroll-behavior: contain; }
.tab { padding: 12px; } .tab[hidden] { display: none; }

.feedbar { display: flex; gap: 6px; margin-bottom: 8px; align-items: stretch; } .feedbar select { padding: 4px 8px; font-size: 13px; min-width: 0; flex: 1; }
.seg3 { display: flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; flex: none; } .seg3 button { padding: 5px 9px; font: 600 12px var(--display); color: var(--muted); background: var(--bg); border-right: 2px solid var(--ink); } .seg3 button:last-child { border-right: 0; }
.seg3 button[aria-pressed='true'] { background: var(--teal); color: var(--ink); } .seg3 button:focus-visible { outline-offset: -3px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ev { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; padding: 6px 9px; border-radius: 10px; background: var(--card); font-size: 13.5px; overflow-wrap: anywhere; } .ev[hidden] { display: none; }
.ev.fresh { animation: slide .3s ease-out; } @keyframes slide { from { opacity: 0; transform: translateY(-6px); } }
.ev time { font: 500 12px var(--mono); color: var(--muted); padding-top: 1px; } .ev.star { box-shadow: inset 3px 0 0 var(--gold); }
.ev.whisper q { font-style: italic; color: var(--gold); } .ev.chat, .ev.visitor-say { box-shadow: inset 3px 0 0 var(--teal); } .ev em { color: var(--muted); font-style: normal; font-size: 12.5px; }
.ev.day, .ev.weather, .ev.system, .ev.question { color: var(--pink); } .ev.election, .ev.epoch { color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); } .ev.trade, .ev.poll, .ev.visitor, .ev.other { color: var(--muted); }
.vf { display: inline-block; width: 22px; height: 20px; vertical-align: -5px; margin-right: 4px; } .vf svg { width: 100%; height: 100%; } .who-link { font-weight: 800; color: var(--teal); }

.who { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-bottom: 12px; }
.face { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0 3px; border-radius: 12px; border: 2px solid transparent; font: 600 10.5px var(--display); color: var(--muted); }
.face svg { width: 100%; max-width: 40px; height: 34px; } .face.on { background: var(--card2); border-color: var(--ink); color: var(--text); box-shadow: 0 2px 0 var(--ink); } .face.star.on { color: var(--gold); }
.line-head { margin-bottom: 10px; display: grid; gap: 3px; } .line-head .meta { font-size: 12.5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--teal); } .dot.live { animation: blink 1.4s infinite; } .dot.final { background: var(--gold); }
@keyframes blink { 50% { opacity: .3; } }
.board { display: grid; gap: 4px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px; align-items: center; text-align: left; padding: 7px 10px; border-radius: 10px; background: var(--card); border: 2px solid transparent; width: 100%; font-size: 14px; }
.row.head { background: none; padding: 0 10px 2px; font: 600 11px var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
button.row:hover { background: var(--card2); border-color: var(--line); } .mini-board .row { padding: 4px 8px; font-size: 13px; }
.pl { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .pl em { font: 600 10.5px var(--display); font-style: normal; color: var(--ink); background: var(--mauve); border-radius: 6px; padding: 0 5px; margin-left: 6px; }
.pr { position: relative; height: 22px; border-radius: 7px; background: var(--bg); overflow: hidden; display: flex; align-items: center; gap: 5px; padding-left: 7px; }
.pr i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #b8506a, var(--rose)); border-radius: 7px; transition: width .7s cubic-bezier(.2, .8, .2, 1); min-width: 3px; }
.pr b { position: relative; font: 600 13px var(--display); text-shadow: 0 1px 2px rgba(0, 0, 0, .5); } .pr u { position: relative; text-decoration: none; font: 600 11px var(--display); }
.more { width: 100%; padding: 6px; color: var(--muted); font: 600 12.5px var(--display); }
.whisper { margin-top: 12px; padding: 12px; border-radius: var(--r); background: var(--card); border: 2px solid var(--ink); display: grid; gap: 8px; }
.slip-row { display: flex; gap: 6px; align-items: stretch; } .slip-row input { flex: 1; }
.go { background: var(--rose); color: var(--ink); border: 2px solid var(--ink); border-radius: 10px; padding: 8px 14px; font: 700 14px var(--display); box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.go:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); } .go.alt { background: var(--gold); }
.whisper label { font: 600 14px var(--display); } .whisper-now { display: flex; flex-wrap: wrap; gap: 5px; font-size: 13px; }
.thought { background: #fff6d8; color: var(--ink); border: 2px dashed var(--ink); border-radius: 10px; padding: 1px 8px; font-style: italic; overflow-wrap: anywhere; }
.last { margin-top: 12px; font-size: 13.5px; color: var(--muted); } .last b { color: var(--text); }
.resmore { margin-top: 12px; display: grid; gap: 8px; } .resmore h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
.rels { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; } .rel { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 6px; align-items: center; text-align: left; background: var(--bg); border-radius: 9px; padding: 2px 8px 2px 4px; font-size: 12.5px; font-weight: 700; }
.rel em { font: 600 11px var(--display); font-style: normal; color: var(--muted); } .rel.l0 em, .rel.l1 em { color: var(--bad); } .rel.l4 em, .rel.l5 em, .rel.l6 em { color: var(--good); } .rel:hover { background: var(--card2); }
.mems { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: grid; gap: 2px; }

.card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--r); padding: 12px; margin-bottom: 10px; display: block; } .card.mine { border-color: var(--gold); } .card.claim { border-color: var(--teal); border-style: dashed; }
.res-top { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.res-face { width: 64px; height: 64px; border-radius: 14px; border: 2px solid var(--ink); background: var(--pink); overflow: hidden; display: block; } .res-face img, .res-face svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; } .bars label { font: 600 10.5px var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: grid; gap: 2px; }
.bars i { display: block; height: 7px; border-radius: 9px; background: var(--bg); overflow: hidden; } .bars i b { display: block; height: 100%; width: 0; background: var(--good); border-radius: 9px; } .bars i.h b { background: var(--coral); }
.persona { font-size: 13px; color: var(--muted); } .diary { font-size: 13px; font-style: italic; color: var(--pink); }
.mini { display: inline-block; border: 2px solid var(--ink); border-radius: 9px; padding: 4px 10px; font: 600 12.5px var(--display); background: var(--teal); color: var(--ink); box-shadow: 0 2px 0 var(--ink); white-space: nowrap; text-decoration: none; } .mini.ghost { background: var(--card2); color: var(--text); }
.deeds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .deed { margin: 0; display: grid; gap: 4px; align-content: start; }
.deed-img { height: 92px; width: 100%; display: grid; place-items: center; background: radial-gradient(closest-side, rgba(174, 130, 150, .45), transparent); border-radius: 10px; } .deed-img img { max-width: 100%; max-height: 92px; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .3)); }
.signline { font-size: 12.5px; font-style: italic; color: var(--gold); overflow-wrap: anywhere; } .deed-act { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.rc { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 10px; background: var(--card); margin-bottom: 5px; font-size: 13px; } .rc:hover { background: var(--card2); }
.rc-id { font-family: var(--mono); font-size: 12px; color: var(--teal); } .rc-out { font-weight: 700; text-align: right; } .rc .muted { grid-column: 1 / -1; font-size: 11.5px; }
.seen { font: 600 10px var(--display); font-style: normal; background: var(--good); color: var(--ink); border-radius: 6px; padding: 0 5px; }

/* exchange, election, visiting agents, questions */
.xhead { display: grid; grid-template-columns: minmax(0, 1fr) 70px 96px; gap: 8px; padding: 0 12px 4px 60px; font: 600 11px var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; } .xhead span:nth-child(2) { text-align: right; }
.tok { padding: 10px 12px; margin-bottom: 6px; } .tok.open { border-color: var(--gold); } .tok.mayor { box-shadow: inset 3px 0 0 var(--gold); }
.tok-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 70px 96px; gap: 8px; align-items: center; width: 100%; text-align: left; }
.tok-face { width: 40px; height: 36px; border-radius: 11px; border: 2px solid var(--ink); background: var(--pink); overflow: hidden; display: block; flex: none; } .tok-face svg { width: 100%; height: 100%; display: block; }
.tok-name { display: grid; min-width: 0; } .tok-name b { font: 600 15px var(--display); } .tok-name small, .tok-price small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tok-price { display: grid; text-align: right; } .tok-price b { font: 600 16px var(--display); color: var(--gold); } .tok-price small.up { color: var(--good); } .tok-price small.down { color: var(--bad); }
.spark { width: 96px; height: 26px; display: block; } .spark path { fill: none; stroke: var(--muted); stroke-width: 1.8; vector-effect: non-scaling-stroke; stroke-linejoin: round; } .spark.up path { stroke: var(--good); } .spark.down path { stroke: var(--bad); }
.pos { font-size: 12.5px; color: var(--muted); margin: 6px 0 0 48px; } .pos b { color: var(--text); }
.tok-act { display: flex; gap: 4px; margin: 8px 0 0 48px; flex-wrap: wrap; } .tok-more { margin-top: 10px; padding-top: 10px; border-top: 2px dashed var(--line); display: grid; gap: 6px; }
.election { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 209, 102, .08), transparent 60%), var(--card); display: grid; gap: 8px; }
.poll { display: grid; gap: 3px; } .prow { display: grid; grid-template-columns: 30px 96px minmax(0, 1fr); gap: 6px; align-items: center; padding: 3px 6px; border-radius: 9px; background: var(--bg); font-size: 13px; }
.pf { width: 30px; height: 27px; display: block; } .rel .pf { width: 26px; height: 23px; } .pf svg { width: 100%; height: 100%; } .pn { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb { position: relative; height: 18px; border-radius: 6px; background: var(--bg2); overflow: hidden; display: flex; align-items: center; padding-left: 6px; } .pb i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #a8842c, var(--gold)); border-radius: 6px; opacity: .85; transition: width .6s; }
.pb b { position: relative; font: 600 11.5px var(--display); color: var(--text); text-shadow: 0 1px 2px rgba(0, 0, 0, .6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite { white-space: pre-wrap; user-select: all; font-size: 12.5px; border: 2px dashed var(--line); } .vlist { display: grid; gap: 6px; margin-bottom: 10px; }
.vis { display: grid; grid-template-columns: 20px 40px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin: 0; width: 100%; text-align: left; padding: 8px 10px; } button.vis:hover { background: var(--card2); }
.rank { font: 600 12px var(--display); color: var(--muted); text-align: center; } .vis-main { display: grid; min-width: 0; } .vis-main b { font: 600 14.5px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .vis-main small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis-pts { display: grid; text-align: right; } .vis-pts b { font: 600 16px var(--display); color: var(--gold); } .vis-pts small { font-size: 11px; color: var(--muted); white-space: nowrap; } .vis .tok-face { background: var(--teal); }
.vis-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: start; }
.question { border-color: var(--teal); display: grid; gap: 6px; } .qtext { font: 600 15px/1.35 var(--display); overflow-wrap: anywhere; }
.props { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; } .props li { background: var(--bg); border-radius: 10px; padding: 6px 8px; display: grid; gap: 3px; font-size: 13px; overflow-wrap: anywhere; } .props small { color: var(--muted); font-size: 11.5px; }
.answered { border-top: 2px dashed var(--line); padding-top: 8px; margin-top: 8px; display: grid; gap: 3px; } .answered .qtext { font-size: 13.5px; }
.reprows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 3px; font-size: 13px; } .reprows li { display: flex; justify-content: space-between; background: var(--bg); border-radius: 8px; padding: 3px 8px; } .reprows span { color: var(--gold); font: 600 13px var(--display); }

/* ---- modal ---- */
dialog { border: 3px solid var(--ink); border-radius: 18px; background: var(--bg2); color: var(--text); padding: 22px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 6px 0 var(--ink), 0 20px 60px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(20, 10, 24, .7); backdrop-filter: blur(3px); }
.modal-x { position: absolute; right: 12px; top: 8px; } .modal-x button { font-size: 26px; color: var(--muted); line-height: 1; padding: 4px 8px; }
#modalBody { display: grid; gap: 12px; } #modalBody a { color: var(--teal); }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 10px; margin: 0; font-size: 13.5px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.seen-good { color: var(--good); } .seen-bad { color: var(--bad); font-weight: 700; } .seen-none { color: var(--muted); }
.weights { width: 100%; border-collapse: collapse; font-size: 13.5px; } .weights th { text-align: left; color: var(--muted); font: 600 11px var(--display); text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; }
.weights td { padding: 4px 6px; border-top: 1px solid var(--line); } .weights td:nth-child(n + 2), .weights th:nth-child(n + 2) { text-align: right; font-family: var(--mono); font-size: 12.5px; } .weights tr.hit td { background: rgba(255, 209, 102, .16); color: var(--gold); font-weight: 700; }
.verify ol { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 13.5px; } .pass { color: var(--good); } .fail { color: var(--bad); } .note { color: var(--muted); } .sum { font: 600 15px var(--display); margin-top: 4px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13.5px; } pre { background: var(--bg); border-radius: 10px; padding: 10px; overflow: auto; max-height: 260px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.rules { padding-left: 20px; display: grid; gap: 8px; margin: 0; font-size: 14.5px; }
.deed-form { display: grid; gap: 12px; } .deed-form label { display: grid; gap: 4px; font: 600 13px var(--display); color: var(--muted); } .err { color: var(--bad); font-size: 13.5px; min-height: 1em; }
.wallets { display: grid; gap: 6px; } .wl { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 2px solid var(--ink); font: 600 15px var(--display); } .wl:hover { background: var(--card2); } .wl img { width: 26px; height: 26px; border-radius: 6px; }
.avrow { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; align-items: center; } .avprev { display: block; background: #ae8296; border: 2px solid var(--ink); border-radius: 14px; padding: 8px; } .avprev svg { width: 100%; height: auto; display: block; }
.avctl { display: grid; gap: 8px; } .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .cols input { padding: 2px; height: 34px; width: 100%; }
.lb { list-style: none; margin: 0; padding: 0; counter-reset: rank; } .lb li { counter-increment: rank; display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 5px 8px; border-radius: 10px; background: var(--card); font-size: 13.5px; }
.lb li::before { content: counter(rank); color: var(--muted); font: 600 12px var(--display); } .lb .tok-face { width: 34px; height: 30px; } .lb small { grid-column: 3 / -1; color: var(--muted); font-size: 11.5px; } .lb span:last-of-type { color: var(--gold); font: 600 13px var(--display); }

/* ---- narrower screens: the payout card drops its detail, then the panel becomes a bottom sheet ---- */
@container (max-width: 1180px) { .pay-cell:nth-child(3), .pay-cell:nth-child(4) { display: none; } }
@container (max-width: 900px) { .pay-cell { display: none; } }
@media (max-width: 760px) {
  :root { --gap: 8px; }
  .hud { inset: 0 0 var(--sheet, 46px) 0; }
  .hud-top { flex-direction: column; align-items: stretch; gap: 6px; }
  .brandblock { width: 100%; padding: 6px 10px 7px; } .brand { font-size: 18px; } .brand-cat { width: 28px; height: 25px; } .phase-text .model { display: none; }
  .hud-tr { order: 2; flex: none; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; scrollbar-width: none; } .hud-tr .pill { padding: 5px 11px; font-size: 12.5px; flex: none; }
  .hud-tc { order: 3; align-items: flex-start; } .paycard > span { padding: 3px 10px 4px; } .paycard { border-radius: 12px; border-width: 2.5px; } .pay-main { display: flex !important; gap: 8px; align-items: baseline; } .pay-main b { font-size: 16px; } .pay-cell:nth-child(2) { display: grid; }
  .hud-bl { left: 0; right: 0; bottom: var(--gap); max-width: none; margin: 0; padding: 0 var(--gap); overflow-x: auto; scrollbar-width: none; } .placechips { flex-wrap: nowrap; }
  .hud-br { bottom: 46px; } .zoomctl .ctl:not(.wide), .zoomval { display: none; }
  body:not(.panel-closed) .hud-bl, body:not(.panel-closed) .hud-br { display: none; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: min(58vh, 560px); border-radius: 18px 18px 0 0; border-bottom: 0; box-shadow: 0 -4px 0 rgba(42, 27, 46, .35); padding-bottom: env(safe-area-inset-bottom); }
  .panel-closed .panel { transform: translateY(calc(100% - 46px)); }
  .panel-handle, .panel-closed .panel-handle { left: 50%; top: -25px; margin: 0 0 0 -34px; width: 68px; height: 25px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; font-size: 16px; }
  .tabs { border-radius: 15px 15px 0 0; } .tabs button { font-size: 11.5px; padding: 12px 0; }
  .inspector { left: var(--gap); right: var(--gap); top: auto; bottom: 54px; width: auto; max-height: 52vh; }
  .toast { top: auto; bottom: 64px; } .deeds { grid-template-columns: 1fr 1fr; } dialog { padding: 16px; }
}
@media (max-height: 620px) and (min-width: 761px) { .inspector { max-height: calc(100vh - 162px); } .hud-bl { display: none; } }

/* ---- /town?embed=1: a picture of the town for the landing page. No HUD, no panel, no input. ---- */
body.embed .hud, body.embed .panel, body.embed .inspector, body.embed .toast, body.embed dialog { display: none !important; }
body.embed .map { cursor: default; pointer-events: none; touch-action: auto; }

/* ---- /cast: the sprite sheet ---- */
body.castpage { padding: 24px; } .castpage h2 { margin-bottom: 14px; }
.sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 900px; }
.cell { background: #ae8296; border: 3px solid var(--ink); border-radius: 16px; padding: 12px; text-align: center; font: 600 15px var(--display); color: var(--ink); } .cell svg { width: 120px; height: 140px; } .cell .f svg { width: 60px; height: 54px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
