:root {
  --bg: #08080a; --panel: #0d0d10; --panel2: #101014;
  --line: #17171d; --line2: #22222a; --line3: #2b2b34;
  --text: #f0ede8; --dim: #86837e; --faint: #56534f; --ghost: #46443f;
  --gold: #d4a24c; --blue: #3b8bff; --green: #3ecf68; --red: #ef4d4d;
  --sans: 'Instrument Sans', 'Helvetica Neue', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
  overflow: hidden; user-select: none;
}
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#stage.dragging { cursor: grabbing; }
#stage.over-room { cursor: pointer; }
.spacer { flex-grow: 1; }
.micro { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--faint); }
.mono { font-family: var(--mono); }
.hidden { opacity: 0 !important; pointer-events: none !important; }

/* ── top bar ─────────────────────────────────────────── */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 50px;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: rgba(13,13,16,.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); z-index: 20;
}
.brand { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.rule { width: 1px; height: 18px; background: var(--line2); }
.crumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: #9b9893; }
.crumb .code {
  font-family: var(--mono); font-size: 10.5px; color: var(--gold);
  background: #241c0e; border: 1px solid #3c2f16; border-radius: 4px; padding: 2px 6px;
}
.search {
  width: 340px; height: 30px; border: 1px solid var(--line2); border-radius: 8px;
  background: var(--panel2); display: flex; align-items: center; gap: 9px; padding: 0 11px;
  color: var(--faint); transition: border-color .15s;
}
.search:focus-within { border-color: #33333f; }
.search input {
  flex-grow: 1; background: none; border: 0; outline: 0;
  font-family: var(--sans); font-size: 12.5px; color: var(--text);
}
.search input::placeholder { color: var(--faint); }
.kbd { font-family: var(--mono); font-size: 10px; color: var(--ghost); }
.pill {
  height: 27px; padding: 0 13px; border: 0; border-radius: 7px; background: #16161b;
  display: flex; align-items: center; gap: 7px; font-family: var(--sans);
  font-size: 12.5px; color: #c5c1bc; cursor: pointer; transition: background .15s;
}
.pill:hover { background: #1e1e25; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* ── elevator rail ───────────────────────────────────── */
#rail {
  position: absolute; top: 50px; right: 0; bottom: 54px; width: 268px;
  background: rgba(12,12,15,.9); backdrop-filter: blur(14px);
  border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 18;
}
.rail-head { padding: 15px 16px 11px; display: flex; align-items: center; justify-content: space-between; }
.rail-count { font-size: 11.5px; color: var(--faint); }
#rail-list { overflow-y: auto; }
.floorcard {
  margin: 0 12px 8px; padding: 9px 10px 7px; border-radius: 9px;
  background: var(--panel2); border: 1px solid #1b1b22; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.floorcard:hover { background: #15151b; border-color: #2a2a34; }
.floorcard.on { background: #12161f; border-color: #28426b; }
.fc-head { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.fc-name { font-size: 12.5px; color: #8d8a85; }
.floorcard.on .fc-name { color: var(--text); font-weight: 600; }
.fc-code { font-family: var(--mono); font-size: 9.5px; color: #4d4a46; }
.floorcard.on .fc-code { color: var(--blue); }
.fc-n { font-family: var(--mono); font-size: 9.5px; color: var(--faint); margin-left: auto; }
.rail-foot { margin-top: auto; padding: 13px 16px 16px; border-top: 1px solid var(--line); }
#nearby { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.near { display: flex; align-items: center; gap: 9px; }
.near .who { font-size: 12.5px; color: #c5c1bc; }
.near .dist { margin-left: auto; font-size: 11px; color: var(--faint); }

/* ── faces ───────────────────────────────────────────── */
.face {
  width: 26px; height: 26px; border-radius: 50%; background: #2a2a33;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 9px; color: #97948f; flex-shrink: 0;
}
.face.blue { width: 30px; height: 30px; font-size: 10px; border: 2px solid var(--blue); }
.face.gold { width: 32px; height: 32px; font-size: 10.5px; border: 2px solid var(--gold); }
.face.lg { width: 22px; height: 22px; font-size: 8.5px; }
.face.speaking { border: 1.5px solid var(--green); }

/* ── room labels in 3D ───────────────────────────────── */
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
.rlabel {
  position: absolute; transform: translate(-50%, -100%);
  white-space: nowrap; transition: opacity .18s;
}
.rlabel .tick { width: 1px; background: #3c3c47; margin: 4px auto 0; opacity: .55; }
.rlabel .rl-name { font-size: 13px; font-weight: 600; color: #efece7; }
.rlabel .rl-sub { font-family: var(--mono); font-size: 9.5px; color: #75726e; letter-spacing: .3px; margin-top: 2px; }
.rlabel.live .rl-name, .rlabel.live .rl-sub { color: var(--gold); }
.rlabel.live .tick { background: var(--gold); }
.rlabel.you .tick { background: var(--blue); }
.rlabel.you .rl-name, .rlabel.you .rl-sub { color: var(--blue); }
.rlabel.dim { opacity: .34; }
.flabel { position: absolute; text-align: right; white-space: nowrap; transition: opacity .2s; }
.flabel .fl-name { font-size: 14px; font-weight: 600; color: #5d5a56; }
.flabel .fl-sub { font-family: var(--mono); font-size: 9.5px; color: #4a4844; letter-spacing: .3px; margin-top: 3px; }
.flabel.on .fl-name { color: #f2efea; }
.flabel.on .fl-sub { color: var(--blue); }

/* ── cards ───────────────────────────────────────────── */
.card {
  position: absolute; z-index: 24; border: 1px solid var(--line3); border-radius: 10px;
  background: rgba(16,16,20,.96); backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px rgba(0,0,0,.66); transition: opacity .18s;
}
#roomcard { left: 22px; top: 72px; width: 226px; overflow: hidden; }
#roomcard.live { border-color: #3a2e16; background: rgba(20,18,14,.96); }
.card-body { padding: 11px 13px 10px; display: flex; flex-direction: column; gap: 8px; }
.card-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
#roomcard.live .live-dot { background: var(--gold); }
#roomcard.live #rc-time { color: var(--gold); }
#rc-time { font-size: 10.5px; color: var(--faint); }
.card-sub { font-size: 11.5px; color: var(--dim); line-height: 1.45; }
.card-faces { display: flex; gap: 6px; flex-wrap: wrap; }
.card-actions { display: flex; border-top: 1px solid var(--line2); }
#roomcard.live .card-actions { border-top-color: #23201a; }
.ca {
  flex-grow: 1; height: 32px; border: 0; background: none; cursor: pointer;
  font-family: var(--sans); font-size: 12px; color: var(--dim); transition: background .15s;
}
.ca:hover { background: rgba(255,255,255,.04); }
.ca + .ca { border-left: 1px solid var(--line2); }
.ca.primary { color: var(--gold); font-weight: 500; }

#shelfcard { left: 22px; top: 72px; width: 252px; overflow: hidden; border-color: #3a3323; background: rgba(19,17,13,.96); }
.shelf-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
#shelfcard .card-actions { border-top-color: #2a2418; }
#shelfcard .ca + .ca { border-left-color: #2a2418; }
.chip {
  align-self: flex-start; height: 27px; padding: 0 12px; border: 1px solid var(--line2);
  border-radius: 7px; background: var(--panel2); color: #c5c1bc; cursor: pointer;
  font-family: var(--sans); font-size: 12px; transition: background .15s, opacity .18s;
}
.chip:hover { background: #1b1b22; }
.chip.hidden { display: none; }
#knock { right: 290px; bottom: 76px; width: 250px; padding: 13px; border-color: #3a2e16; }
.knock-row { display: flex; align-items: center; gap: 10px; }
.knock-title { font-size: 13px; font-weight: 600; }
.knock-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.knock-actions { display: flex; gap: 8px; margin-top: 12px; }
.ca.wide { border-radius: 7px; background: var(--gold); color: #14120d; font-weight: 600; height: 30px; font-size: 12.5px; }
.ca.wide:hover { background: #e0b25c; }
.knock-actions .ca:not(.wide) {
  flex-grow: 0; padding: 0 13px; height: 30px; border-radius: 7px; background: #191920;
  color: #a5a29d; border-left: 0;
}

/* ── camera hint ─────────────────────────────────────── */
#camhint { position: absolute; left: 20px; bottom: 76px; display: flex; flex-direction: column; gap: 9px; z-index: 20; }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: var(--panel2); }
.seg button {
  height: 28px; padding: 0 12px; border: 0; background: none; cursor: pointer;
  font-family: var(--sans); font-size: 12px; color: var(--dim); transition: background .15s;
}
.seg button + button { border-left: 1px solid var(--line2); }
.seg button:hover { background: rgba(255,255,255,.04); }
.seg button.on { background: var(--gold); color: #14120d; font-weight: 600; }

/* ── bottom bar ──────────────────────────────────────── */
#bottombar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 54px;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: rgba(13,13,16,.82); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); z-index: 20;
}
.me-name { font-size: 12.5px; font-weight: 500; }
.me-where { font-size: 11px; color: var(--dim); margin-top: 1px; }
.tools { display: flex; gap: 9px; }
.tool {
  width: 34px; height: 30px; border: 0; border-radius: 8px; background: #191920;
  color: #c5c1bc; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.tool:hover { background: #22222b; }
.tool.off { color: #5b5854; background: #141419; }
.tool.on { background: #22303f; color: #9cc4f5; }
.zoom { display: flex; align-items: center; gap: 11px; }
#zoom { -webkit-appearance: none; appearance: none; width: 108px; height: 3px; border-radius: 2px; background: var(--line2); outline: 0; }
#zoom::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: #c5c1bc; cursor: pointer; }
#zoom::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: #c5c1bc; cursor: pointer; }

/* ── toast ───────────────────────────────────────────── */
#toast {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%);
  padding: 9px 15px; border-radius: 8px; background: rgba(16,16,20,.96);
  border: 1px solid var(--line3); font-size: 12.5px; color: #d6d2cc;
  z-index: 30; transition: opacity .2s;
}
