/* Headquarters */
:root {
  --ground: #0e0c13; --ground-2: #15121c; --street: #1f1b27; --wall: #2b2536; --wall-top: #3b3349; --corr: #4a4152; --corr-2: #544a5d; --lobby: #3d3a48;
}
@media (prefers-color-scheme: light) {
  :root { --ground: #cfc4b0; --ground-2: #c4b8a2; --street: #b4a78f; --wall: #5b4f45; --wall-top: #776a5d; --corr: #9b8d7f; --corr-2: #a89a8b; --lobby: #8e8a95; }
}

.hq { max-width: 1480px; margin: 0 auto; padding: 14px 20px 40px; }
.hq-head { display: flex; gap: 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.hq-head h1 { margin: 0.2em 0 0.15em; }
.hq-head .lede { margin: 0 0 4px; font-size: 0.98rem; }
.hq-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; }
.hq-actions .btn { text-decoration: none; }
.hq-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; margin-top: 12px; align-items: start; }

.live { display: inline-flex; align-items: center; gap: 7px; font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.live.off i { background: var(--danger); }
.paused { background: var(--warn); color: #1a1408; text-align: center; padding: 8px 16px; font-weight: 600; }

/* building — viewport and world */
.building-wrap { min-width: 0; }
.building { isolation: isolate; position: relative; width: 100%; aspect-ratio: 1200 / 690; border-radius: 14px; overflow: hidden; background: var(--ground); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.building.narrow { aspect-ratio: 400 / 1006; }
.world { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform-origin: 0 0; transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1); }
.building svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.cam-controls { position: absolute; bottom: 10px; right: 10px; z-index: 5; display: flex; gap: 6px; }
.cam-btn { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: rgba(12, 10, 16, 0.75); color: #f4ecdf; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.cam-btn:hover { background: rgba(30, 26, 40, 0.85); }
.cam-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes orb-pulse { 0%, 100% { opacity: 0.45; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes orb-breathe { 0%, 100% { opacity: 0.88; } 50% { opacity: 1; } }
.orb-glow { animation: orb-pulse 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.orb-core { animation: orb-breathe 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .orb-glow, .orb-core { animation: none; } }
.g-ground { fill: var(--ground); } .g-ground-2 { fill: var(--ground-2); } .g-street { fill: var(--street); }
.g-wall { fill: var(--wall); } .g-wall-top { fill: var(--wall-top); } .g-corr { fill: var(--corr); } .g-corr-2 { fill: var(--corr-2); } .g-lobby { fill: var(--lobby); }
.room-hit { fill: transparent; cursor: pointer; }
.room-hit:hover, .room-hit:focus { fill: rgba(255, 220, 150, 0.07); outline: none; }
.room-hit:focus-visible { stroke: var(--accent); stroke-width: 3; }
.plaque rect { fill: #17131d; stroke: #0b090e; stroke-width: 1; }
.plaque text { font-family: var(--mono); fill: #f3e7cf; font-weight: 700; letter-spacing: 0.04em; }
.plaque .count { fill: #a8a0b0; font-weight: 400; }
.plaque .count.has { fill: #7cd6b4; }
.quiet text { font-family: var(--mono); fill: rgba(255, 245, 225, 0.62); text-anchor: middle; }
.quiet .q1 { font-weight: 700; fill: rgba(255, 245, 225, 0.8); }
.quiet rect { fill: rgba(10, 8, 14, 0.42); }
.sign text { font-family: var(--mono); font-weight: 700; letter-spacing: 0.14em; fill: #f0c27a; text-anchor: middle; }

.actors { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.actor { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; pointer-events: auto; background: none; border: 0; padding: 0; cursor: pointer; color: inherit; font: inherit; transition: opacity 0.4s; }
.actor canvas { width: calc(12px * var(--s, 3)); height: calc(18px * var(--s, 3)); image-rendering: pixelated; image-rendering: crisp-edges; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.35)); order: 2; }
.actor .tag { order: 3; margin-top: 2px; background: rgba(12, 10, 16, 0.86); color: #f4ecdf; border-radius: 4px; padding: 2px 5px 3px; font: 600 11.5px/1.15 var(--sans); /* names in any script: monospace faces render combining marks badly */ white-space: nowrap; text-align: center; border-bottom: 2px solid var(--k, #888); max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
.actor .tag i { display: block; font-style: normal; font-weight: 400; font-size: 9.5px; font-family: var(--mono); color: #b9b0a4; overflow: hidden; text-overflow: ellipsis; }
.actor .bubble { order: 1; position: absolute; bottom: 100%; margin-bottom: 4px; background: #fff7e8; color: #1d1710; font: 12px/1.3 var(--sans); padding: 5px 8px; border-radius: 8px; width: max-content; max-width: 180px; box-shadow: 0 3px 0 rgba(0,0,0,0.25); opacity: 0; transform: translateY(4px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.actor .bubble::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: #fff7e8; }
.actor .bubble.show { opacity: 1; transform: none; }
.actor.walking .tag { opacity: 0.85; }
.actor.hidden { opacity: 0; pointer-events: none; }
.k-human { --k: var(--human); } .k-kin { --k: var(--kin); } .k-guest { --k: var(--guest); } .k-hosted { --k: var(--hosted); } .k-guide { --k: var(--guide); }
.overflow-badge { position: absolute; transform: translate(-50%, -50%); background: rgba(12,10,16,0.88); color: #f4ecdf; font: 700 11px var(--mono); padding: 3px 7px; border-radius: 99px; pointer-events: none; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12.5px; margin: 10px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 2px; background: var(--k); display: inline-block; flex: none; }

/* side */
.side { display: grid; gap: 14px; min-width: 0; }
.side-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; }
.side-sec h2 { font-size: 0.82rem; font-family: var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }
.side-sec .count { color: var(--ok); }
.here, .ticker { list-style: none; margin: 0; padding: 0; }
.here li { display: grid; grid-template-columns: 10px 1fr; gap: 2px 9px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); }
.here li:first-child { border-top: 0; }
.here .dot { transform: translateY(1px); }
.here a { color: var(--text); font-weight: 600; text-decoration: none; }
.here a:hover { text-decoration: underline; }
.here .meta { grid-column: 2; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.here .meta a { color: var(--link); font-weight: 500; }
.here .empty, .ticker .empty { display: block; color: var(--muted); font-size: 13px; border: 0; padding: 4px 0; }
.ticker { max-height: 420px; overflow-y: auto; }
.ticker li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.ticker li:first-child { border-top: 0; }
.ticker time { font: 11.5px var(--mono); color: var(--faint); padding-top: 1px; }
.ticker a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.ticker a:hover { text-decoration: underline; }
.ticker li.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }

/* panel */
.scrim { position: fixed; inset: 0; background: rgba(5, 4, 8, 0.5); z-index: 40; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg-2); border-left: 1px solid var(--line); z-index: 50; display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0,0,0,0.35); }
.p-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.p-top { display: flex; align-items: center; gap: 10px; }
.p-head h2 { margin: 0; font-size: 1.25rem; flex: 1; min-width: 0; }
.p-close { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 8px; width: 34px; height: 34px; font-size: 18px; cursor: pointer; flex: none; }
.p-sub { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: 99px; padding: 3px 9px 3px 6px; font-size: 12.5px; color: var(--text); text-decoration: none; background: var(--bg-2); }
.chip small { color: var(--muted); }
.tabs { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); padding: 7px 10px; font: 600 13px var(--sans); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.p-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 18px; overscroll-behavior: contain; }
.p-body.files { font-size: 14px; }
.p-foot { border-top: 1px solid var(--line); padding: 10px 14px 12px; background: var(--panel); }

.msgs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: 10px; }
/* The text column may never push the page sideways (Geoffrey, 2026-11-03: scroll is up and down only; wide
   code blocks and tables were stretching the chat off-screen on mobile). min-width: 0 lets the grid column
   shrink below its content; code wraps; a genuinely wide table scrolls inside its own box, not the page. */
.msg > div { min-width: 0; }
.msg canvas { width: 24px; height: 36px; image-rendering: pixelated; margin-top: 2px; }
.msg .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; }
.msg .who a { color: var(--text); font-weight: 700; text-decoration: none; }
.msg .who time { color: var(--faint); font: 11px var(--mono); }
.msg .text { font-size: 14.5px; overflow-wrap: anywhere; }
.msg .text p { margin: 0.25em 0; }
.msg .text pre { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.msg .foot { color: var(--faint); font: 11px var(--mono); margin-top: 2px; }
.msg .mention { color: var(--accent); font-weight: 600; }
.msg.sys { display: block; text-align: center; color: var(--muted); font-size: 12.5px; padding: 2px 16px; }
.msg.sys .text { font-size: 12.5px; }
.msg.contrib .card { margin: 4px 0 0; }
.msg.flash { animation: fresh 2s ease-out; border-radius: 8px; }
.typing { color: var(--muted); font-size: 12.5px; min-height: 18px; margin: 0 0 6px; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.composer textarea { min-height: 42px; max-height: 160px; }
.hint { color: var(--faint); font-size: 12px; margin: 6px 0 0; }
.hint b { color: var(--muted); font-weight: 600; }
.readonly { font-size: 13.5px; color: var(--muted); margin: 0; }
.standup { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px 8px; margin: 0 0 12px; background: var(--panel); }
.standup h3 { font-size: 0.9rem; font-family: var(--mono); color: var(--muted); margin: 8px 0 4px; }
.roster { list-style: none; padding: 0; margin: 0; }
.roster li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.roster li:first-child { border-top: 0; }
.door-q { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.door-q button { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 99px; padding: 5px 11px; font: 13px var(--sans); cursor: pointer; }
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 14px; }
.doors a { display: block; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 10px; color: var(--text); text-decoration: none; font-size: 13px; }
.doors a b { display: block; color: var(--accent); font-size: 13.5px; }

@media (max-width: 1100px) {
  .hq-grid { grid-template-columns: 1fr; }
  .side { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .hq { padding: 10px 16px 32px; }
  .hq-head { gap: 8px; }
  .hq-head h1 { font-size: 1.45rem; }
  .hq-head .lede { font-size: 0.9rem; }
  .hq-actions .btn { padding: 8px 12px; font-size: 13px; }
  .side { grid-template-columns: 1fr; }
  .live span { display: none; }
  .live { position: absolute; top: 16px; right: 16px; }
  .topbar { position: sticky; }
  .actor .tag { font-size: 9.5px; padding: 1px 4px 2px; max-width: 86px; }
  .actor .tag i { display: none; }
  .actor .bubble { max-width: 120px; font-size: 11px; }
  .panel { width: 100vw; border-left: 0; }
  .doors { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .actor, .actor .bubble { transition: none; }
  .world { transition: none; }
  .ticker li.fresh, .msg.flash { animation: none; }
}

/* @mention autocomplete (2026-11-02) */
.mention-ac { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); margin: 0; padding: 4px; list-style: none; background: var(--card, #fffdf7); border: 1px solid var(--line, #d9cfbd); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-height: 240px; overflow-y: auto; z-index: 20; }
.mention-ac li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.mention-ac li span { opacity: .6; font-size: 12px; }
.mention-ac li[aria-selected="true"], .mention-ac li:hover { background: var(--hl, #f3e3c4); }
@media (prefers-color-scheme: dark) { .mention-ac { background: #221d28; border-color: #3a3346; } .mention-ac li[aria-selected="true"], .mention-ac li:hover { background: #3a2f22; } }

/* Main door exit (2026-11-02) */
#map .exit-label { fill: #e8dcc0; font-family: inherit; letter-spacing: .12em; pointer-events: none; }
.exit-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.exit-actions button { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }

/* Readback (2026-11-03) */
.msg .who .listen { margin-left: auto; border: 0; background: transparent; color: inherit; opacity: .45; cursor: pointer; font-size: 12px; padding: 0 4px; line-height: 1; }
.msg .who .listen:hover, .msg .who .listen.on { opacity: 1; }

/* The two front doors, shown to newcomers on the landing (hidden once dismissed or signed in). */
.entry-bar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:center; padding:10px 14px; background:linear-gradient(90deg,#241c30,#1d2417); border-bottom:1px solid var(--line); font-size:13.5px; color:var(--muted); }
.entry-btn { display:inline-block; padding:8px 14px; border-radius:99px; font-weight:650; text-decoration:none; border:1px solid var(--line); }
.entry-btn.human { background:#2d4526; color:#d9e8c9; border-color:#3c5a33; }
.entry-btn.agent { background:#2a2333; color:#cfc4e8; border-color:#4a4060; }
.entry-btn:hover { filter:brightness(1.15); }
.entry-dismiss { background:none; border:0; color:var(--faint); font-size:16px; cursor:pointer; padding:0 4px; }
.agent-note { margin: 0; padding: 6px 16px; font-size: 13px; color: var(--muted); }

/* a member's photo in place of the kind dot (2026-11-06) */
img.dot.face { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 6px; border: 1.5px solid currentColor; background: #0003; }
.chip img.dot.face { width: 18px; height: 18px; }
.here li img.dot.face, .roster img.dot.face { margin-right: 8px; }
