/* Room map: one full-screen 3D view. Five styles via body[data-theme]; sized for a 1080p projector and phones. */
:root, body[data-theme="night"] {
  --bg: #121212; --bg-image: none; --panel: #1a1a1a; --line: #2c2c2c; --text: #f2f2f2; --text-soft: #d6d6d6;
  --muted: #8a8a8a; --faint: #5e5e5e; --tile: #121212;
  --accent: #b8466f; --accent-text: #ffd9e6; --mint: #7fe0bd; --amber: #f2c46d;
  --overlay: rgba(18, 18, 18, 0.88); --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --font: "IBM Plex Sans", system-ui, sans-serif; --mono: "IBM Plex Mono", monospace;
  --radius: 0; --border: 1px solid var(--line);
}
body[data-theme="white"] {
  --bg: #fafafa; --panel: #ffffff; --line: #e3e3e3; --text: #151515; --text-soft: #3a3a3a;
  --muted: #7a7a7a; --faint: #a8a8a8; --tile: #f4f4f4;
  --accent: #c2185b; --accent-text: #c2185b; --mint: #1f8a6b; --amber: #b87400;
  --overlay: rgba(250, 250, 250, 0.9); --shadow: 0 10px 30px rgba(0, 0, 0, 0.12); --radius: 12px;
  --border: 1px solid #e3e3e3;
}
body[data-theme="sketch"] {
  --bg: #f6f1e4;
  --bg-image: linear-gradient(rgba(60, 90, 140, 0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 90, 140, 0.08) 1px, transparent 1px);
  --panel: #fffdf6; --line: #2b2b2b; --text: #1d1d1d; --text-soft: #333; --muted: #6d6d6d; --faint: #8f8a7d; --tile: #f6f1e4;
  --accent: #d1495b; --accent-text: #d1495b; --mint: #2f6f5e; --amber: #c9822b;
  --overlay: rgba(246, 241, 228, 0.9); --shadow: 4px 5px 0 rgba(0, 0, 0, 0.75);
  --font: "Patrick Hand", "Comic Sans MS", cursive; --mono: "Patrick Hand", "Comic Sans MS", cursive;
  --radius: 255px 15px 225px 15px / 15px 225px 15px 255px; --border: 2px solid #2b2b2b;
}
body[data-theme="minimal"] {
  --bg: #ffffff; --panel: #ffffff; --line: #ececec; --text: #111111; --text-soft: #444; --muted: #9a9a9a; --faint: #c2c2c2;
  --tile: #ffffff; --accent: #111111; --accent-text: #111111; --mint: #111111; --amber: #111111;
  --overlay: rgba(255, 255, 255, 0.92); --shadow: 0 10px 34px rgba(0, 0, 0, 0.09); --radius: 18px; --border: 1px solid #ececec;
}
body[data-theme="blueprint"] {
  --bg: #123a6b;
  --bg-image: linear-gradient(rgba(207, 232, 255, 0.09) 1px, transparent 1px), linear-gradient(90deg, rgba(207, 232, 255, 0.09) 1px, transparent 1px);
  --panel: #0f3260; --line: rgba(207, 232, 255, 0.35); --text: #ffffff; --text-soft: #dcecff; --muted: #9cc4ec; --faint: #6f97c4;
  --tile: #123a6b; --accent: #ffd166; --accent-text: #ffd166; --mint: #e6f3ff; --amber: #ffd166;
  --overlay: rgba(18, 58, 107, 0.9); --shadow: none; --radius: 0; --border: 1px solid rgba(207, 232, 255, 0.5);
  --font: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); background-image: var(--bg-image); background-size: 28px 28px;
  color: var(--text); overflow: hidden; font: 18px/1.35 var(--font);
  transition: background-color 0.3s, color 0.3s;
}

/* plain cursors only: grab/grabbing are missing from many Linux cursor themes and show nothing */
#map3d { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }

.count { position: fixed; right: 28px; top: 18px; text-align: right; z-index: 2; }
.count b { display: block; font: 600 40px/1 var(--mono); font-variant-numeric: tabular-nums; }
.count span { color: var(--muted); display: block; }

/* demo builds (no live server) say so in the top-right corner, for everyone */
body.demo .demo-tag { display: inline-block; position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 5; background: var(--panel); }
.demo-tag {
  display: none; font: 600 11px var(--mono); letter-spacing: 0.1em; color: var(--accent-text);
  border: 1px solid var(--accent); padding: 3px 6px; border-radius: 999px;
}
body.demo .demo-tag { display: inline-block; }

/* join messages: just text. Each line blurs in, the list eases open, then it drifts up and away. */
.toasts {
  position: fixed; left: 28px; top: 84px; z-index: 3; display: flex; flex-direction: column; pointer-events: none;
}
.toast {
  display: grid; grid-template-rows: 1fr; font-size: 17px; font-weight: 300; color: var(--muted);
  animation: toast-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: grid-template-rows 0.6s ease, opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}
.toast > span { overflow: hidden; padding: 2px 0; }
.toast b { color: var(--text); font-weight: 600; }
.toast.out { grid-template-rows: 0fr; opacity: 0; filter: blur(4px); transform: translateY(-8px); }
@keyframes toast-in {
  from { grid-template-rows: 0fr; opacity: 0; filter: blur(8px); transform: translateY(8px); }
  to { grid-template-rows: 1fr; opacity: 1; filter: none; transform: none; }
}
body[data-corner="avatar"] .toasts { top: 28px; }
body[data-corner="dock"] .toasts { left: 64px; top: 28px; }

.h-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* table sub-server: channels | conversation | members (one column on phones) */
.sv-shade { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, 0.25); animation: fade 0.2s ease-out; }
.sv-window {
  width: min(1040px, 100%); height: min(680px, 100%); display: grid;
  grid-template-columns: 190px 1fr 0; grid-template-rows: auto 1fr; overflow: hidden;
  background: var(--panel); color: var(--text); border: var(--border); border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2); animation: pop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); font-size: 15px;
}
.members-open .sv-window { grid-template-columns: 190px 1fr 220px; }
.sv-head { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 18px 12px; border-bottom: var(--border); }
.sv-title { display: flex; align-items: center; gap: 10px; }
.sv-title h2 { font-size: 20px; }
.sv-mode { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.sv-mode.open { color: #16a35a; border-color: #16a35a; }
.sv-sub { grid-column: 1; color: var(--muted); font-size: 13px; }
.sv-tools { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 6px; align-items: start; }
.sv-icon { min-height: 34px; padding: 0 12px; border: var(--border); border-radius: 999px; background: transparent; color: var(--text); font: 600 13px var(--font); cursor: pointer; }
.sv-icon[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.sv-x { width: 34px; padding: 0; font-size: 20px; }
.sv-channels { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: var(--border); overflow-y: auto; }
.sv-label { font: 600 11px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 10px 8px 4px; }
.sv-channels button {
  display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font: 15px var(--font); text-align: left; cursor: pointer;
}
.sv-channels button:hover { background: var(--tile); color: var(--text); }
.sv-channels button.on { background: var(--tile); color: var(--text); font-weight: 600; }
body[data-theme="minimal"] .sv-channels button.on, body[data-theme="minimal"] .sv-channels button:hover { background: #f2f2f2; }
.sv-hash { color: var(--faint); }
.sv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.sv-need { margin: 2px 8px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; width: fit-content; }
.sv-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.sv-topic { display: flex; gap: 10px; align-items: baseline; padding: 10px 18px; border-bottom: var(--border); color: var(--muted); font-size: 13px; }
.sv-topic b { color: var(--text); font-size: 15px; }
.sv-log { flex: 1; overflow-y: auto; padding: 12px 18px 6px; display: flex; flex-direction: column; }
.sv-pin { display: flex; gap: 8px; padding: 8px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--tile); font-size: 13px; }
body[data-theme="minimal"] .sv-pin { background: #f6f6f6; }
.sv-pin b { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding-top: 1px; }
.sv-msg { display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 10px; padding: 6px 6px 2px; border-radius: 10px; }
.sv-msg:hover { background: var(--tile); }
body[data-theme="minimal"] .sv-msg:hover { background: #fafafa; }
.sv-msg.cont { padding-top: 0; }
.sv-msg > :not(.sv-av) { grid-column: 2; }
.sv-av { width: 38px; height: 38px; border-radius: 50%; grid-row: span 3; }
.sv-av.sm { width: 30px; height: 30px; }
.sv-meta { display: flex; gap: 8px; align-items: baseline; }
.sv-meta b { font-size: 14px; }
.sv-meta time { font: 11px var(--mono); color: var(--faint); }
.sv-text { line-height: 1.4; overflow-wrap: anywhere; }
.sv-re { display: flex; gap: 4px; margin: 3px 0 2px; }
.sv-re button {
  min-height: 24px; padding: 0 8px; border: 1px solid transparent; border-radius: 999px; background: transparent;
  color: var(--faint); font: 12px var(--font); cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.sv-msg:hover .sv-re button, .sv-re button.has, .sv-re button:focus-visible { opacity: 1; }
.sv-re button.has { border-color: var(--line); color: var(--text); }
.sv-re button.mine { border-color: var(--text); }
.sv-sys { align-self: center; margin: 6px 0; padding: 3px 12px; border-radius: 999px; background: var(--tile); color: var(--muted); font-size: 12px; }
.sv-typing { min-height: 18px; padding: 0 18px; color: var(--muted); font-size: 12px; font-style: italic; }
.sv-send { display: flex; gap: 8px; padding: 6px 18px 4px; }
.sv-send input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 16px; font: 15px var(--font); color: var(--text); background: var(--bg); border: var(--border); border-radius: 999px; }
.sv-send input:focus { outline: 2px solid var(--text); outline-offset: 0; }
.sv-send button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font: 600 14px var(--font); cursor: pointer; }
.sv-foot { padding: 2px 18px 10px; font: 11px var(--mono); color: var(--faint); }
.sv-members { display: none; flex-direction: column; gap: 2px; padding: 10px; border-left: var(--border); overflow-y: auto; }
.members-open .sv-members { display: flex; }
.sv-member { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: 15px var(--font); text-align: left; cursor: pointer; }
.sv-member:hover, .sv-member:focus-visible { background: var(--tile); outline: none; }
.sv-member.away { color: var(--muted); }
.sv-member small { margin-left: auto; font: 11px var(--mono); color: var(--amber); text-transform: uppercase; }
.sv-av-wrap { position: relative; display: grid; }
.sv-online { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); border: 2px solid var(--panel); }
.sv-online.on { background: #16a35a; }
@media (max-width: 700px) {
  .sv-shade { padding: 0; }
  .sv-window, .members-open .sv-window { width: 100%; height: 100%; border-radius: 0; border: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .sv-head { padding: 12px 12px 10px; }
  .sv-title { flex-wrap: wrap; gap: 6px; }
  .sv-title h2 { font-size: 18px; }
  .sv-tools { gap: 4px; }
  .sv-icon { padding: 0 10px; font-size: 12px; }
  .sv-log, .sv-topic { padding-left: 12px; padding-right: 12px; }
  .sv-send { padding: 6px 12px 4px; }
  .sv-send button { padding: 0 14px; }
  .sv-channels { flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: var(--border); padding: 8px 12px; }
  .sv-channels .sv-label, .sv-need { display: none; }
  .sv-channels button { flex: none; }
  .members-open .sv-main { display: none; }
  .sv-members { border-left: 0; }
}

/* table card (corner): just the name, a short description and Join table */
.profile.hub.compact { width: 300px; }
.tc-card h2 { font-size: 21px; padding-right: 32px; }
.tc-desc { margin-top: 4px; color: var(--text-soft); font-size: 15px; }
.tc-meta { margin-top: 6px; color: var(--muted); font-size: 13px; }
.tc-join {
  margin-top: 14px; width: 100%; min-height: 42px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--text); color: var(--bg); font: 600 15px var(--font);
}
.tc-join:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sv-mode.private { color: var(--text); border-color: var(--text); }
.sv-settings { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; overflow-y: auto; max-width: 560px; }
.sv-h { font-size: 18px; }
.sv-field { display: flex; flex-direction: column; gap: 4px; font: 600 12px var(--font); color: var(--muted); }
.sv-field input { min-height: 40px; padding: 6px 12px; font: 15px var(--font); color: var(--text); background: var(--bg); border: var(--border); border-radius: 12px; }
.sv-field input:focus { outline: 2px solid var(--text); outline-offset: 0; }
.sv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sv-chips button { min-height: 32px; padding: 0 12px; border: var(--border); border-radius: 999px; background: transparent; color: var(--text); font: 13px var(--font); cursor: pointer; }
.sv-chips button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.sv-chips button:disabled { opacity: 0.35; cursor: default; }
.sv-toggle { gap: 12px; padding: 6px 0; border-top: var(--border); }
.sv-toggle b { display: block; font-size: 15px; }
.sv-toggle small { display: block; color: var(--muted); font-size: 12.5px; max-width: 420px; }


.set-profile { display: grid; gap: 8px; }
.set-profile label { display: grid; gap: 4px; font: 600 12px var(--font); color: var(--muted); }
.set-profile input {
  min-height: 38px; padding: 6px 12px; font: 15px var(--font); color: var(--text); background: var(--bg);
  border: var(--border); border-radius: 12px;
}
.set-profile input:focus { outline: 2px solid var(--text); outline-offset: 0; }
.set-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-actions .room-join { margin-top: 4px; }
.set-more { color: var(--muted); font-size: 13px; }
.set-more:hover, .set-more:focus-visible { color: var(--text); }
.set-saved { color: #16a35a; font-size: 13px; }
.leave { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.leave:disabled { opacity: 0.5; cursor: default; }
.leave-icon { display: grid; }

/* you + settings: one tab in the corner */
.me { position: fixed; z-index: 6; left: 20px; top: 18px; }
.me-tab {
  display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font: 600 15px var(--font);
  background: var(--panel); border: var(--border); border-radius: 999px; padding: 4px 12px 4px 4px; box-shadow: var(--shadow);
}
.me-tab:hover .me-gear, .me-tab[aria-expanded="true"] .me-gear { color: var(--text); transform: rotate(60deg); }
.me-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.me-pic { width: 36px; height: 36px; border-radius: 50%; display: block; }
.me-gear { display: grid; color: var(--muted); transition: transform 0.4s, color 0.2s; }
.me-panel {
  position: absolute; left: 0; top: 54px; width: 340px; max-height: calc(100vh - 110px); overflow-y: auto;
  background: var(--panel); border: var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 16px 16px; font-size: 15px; animation: rise 0.25s ease-out;
}
.me-panel[hidden] { display: none; }
.me-tabs {
  position: sticky; top: -10px; display: flex; gap: 4px; padding: 6px 0 10px; margin-bottom: 4px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.me-tabs button {
  flex: 1; min-height: 34px; font: 600 14px var(--font); color: var(--muted); background: transparent;
  border: 0; border-radius: 999px; cursor: pointer;
}
.me-tabs button.on { color: var(--text); background: var(--tile); }
body[data-theme="minimal"] .me-tabs button.on { background: #f2f2f2; }
.me-note { font: 12px var(--mono); color: var(--faint); margin: 6px 0 12px; }
.me-room { display: inline-block; margin: 6px 0 4px; padding: 4px 12px; border-radius: 999px; background: #eaf7ef; color: #11713f; font: 600 13px var(--font); }
.me-edit {
  display: inline-block; margin: -4px 0 14px; padding: 6px 14px; border: var(--border); border-radius: 999px;
  font: 600 13px var(--font); color: var(--text); text-decoration: none;
}
.me-edit:hover, .me-edit:focus-visible { border-color: var(--text); outline: none; }
.set-h { font: 600 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.set-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.set-style {
  display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 4px 10px; cursor: pointer; text-align: left;
  font: 14px var(--font); color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 999px;
}
.set-style.on { border-color: var(--text); font-weight: 600; }
.set-style .sw { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1px solid rgba(128, 128, 128, 0.5); }
.set-row { display: flex; align-items: center; min-height: 40px; cursor: pointer; }
.set-row > span:first-child { flex: 1; }
.set-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.2s; flex: none; }
.switch::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.set-row input:checked + .switch { background: var(--text); }
.set-row input:checked + .switch::after { transform: translateX(16px); }
.set-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* avatar: round face with a gear badge, bottom-left; the panel opens upward */
body[data-corner="avatar"] .me { top: auto; bottom: 20px; }
body[data-corner="avatar"] .me-tab { position: relative; padding: 0; border-radius: 50%; width: 56px; height: 56px; justify-content: center; }
body[data-corner="avatar"] .me-pic { width: 52px; height: 52px; }
body[data-corner="avatar"] .me-name { display: none; }
body[data-corner="avatar"] .me-gear {
  position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; place-items: center;
  background: var(--panel); border: var(--border); border-radius: 50%;
}
body[data-corner="avatar"] .me-gear svg { width: 14px; height: 14px; }
body[data-corner="avatar"] .me-panel { top: auto; bottom: 68px; }

/* dock: slim tab on the left edge; the panel is a drawer */
/* no transform here: it would make .me the containing block and trap the fixed drawer */
body[data-corner="dock"] .me { left: 0; top: calc(50% - 60px); }
body[data-corner="dock"] .me-tab { flex-direction: column; padding: 8px 6px; border-radius: 0 16px 16px 0; border-left: 0; gap: 8px; }
body[data-corner="dock"] .me-name { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 13px; }
body[data-corner="dock"] .me-pic { width: 32px; height: 32px; }
body[data-corner="dock"] .me-panel {
  position: fixed; left: 0; top: 0; bottom: 0; max-height: none; width: 360px; border-radius: 0 var(--radius) var(--radius) 0;
  animation: drawer 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes drawer { from { transform: translateX(-100%); } to { transform: none; } }

/* profile: compact card in the bottom-right corner */
.profile {
  position: fixed; z-index: 4; bottom: 24px; right: 24px; width: 330px; max-height: calc(100% - 120px); overflow-y: auto;
  background: var(--panel); border: var(--border); border-top: 3px solid var(--accent); border-radius: var(--radius);
  padding: 18px 18px 14px; font-size: 15px; animation: rise 0.25s ease-out; box-shadow: var(--shadow);
}
.profile[hidden] { display: none; }
.profile-close {
  position: absolute; top: 6px; right: 6px; width: 40px; height: 40px; border: 0; background: transparent;
  color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer;
}
.profile-close:hover, .profile-close:focus-visible { color: var(--text); outline: none; }
.p-head { display: flex; gap: 14px; align-items: center; padding-right: 28px; }
.p-pic { width: 72px; height: 72px; border-radius: 50%; flex: none; border: 2px solid var(--line); }
.p-head h2 { font-size: 24px; line-height: 1.15; }
.p-tags { display: flex; gap: 6px; margin: 4px 0 2px; }
.p-role, .p-state {
  font: 600 11px var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px; border: 1px solid var(--line); color: var(--muted);
}
.p-role.mentor, .p-role.staff { color: var(--amber); border-color: var(--amber); }
.p-state.here { color: var(--mint); border-color: var(--mint); }
.p-sub { color: var(--muted); font-size: 14px; }
.p-bio { margin: 14px 0 0; color: var(--text-soft); }
.p-socials { display: flex; gap: 8px; margin-top: 12px; }
.p-social {
  width: 36px; height: 36px; border: 0; border-radius: 8px; display: grid; place-items: center; cursor: default; padding: 0;
}
.p-social:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
body[data-theme="minimal"] .profile { border-top: var(--border); }
body[data-theme="minimal"] .p-role, body[data-theme="minimal"] .p-state, body[data-theme="minimal"] .p-chip { border-radius: 999px; }
body[data-theme="minimal"] .p-social { border-radius: 10px; }
body[data-theme="sketch"] .p-social { border: 2px solid #2b2b2b; border-radius: var(--radius); }
body[data-theme="blueprint"] .p-social { background: transparent !important; border: 1px solid var(--line); border-radius: 0; }
.p-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 4px; }
.p-stats div { background: var(--tile); padding: 8px 10px; border-radius: calc(var(--radius) / 2); }
body[data-theme="minimal"] .p-stats div { border: 1px solid var(--line); }
body[data-theme="sketch"] .p-stats div { border: 1.5px solid #2b2b2b; border-radius: var(--radius); }
.p-stats b { display: block; font: 600 22px var(--mono); }
.p-stats span { color: var(--muted); font-size: 12px; }
.p-sec { margin-top: 14px; }
.p-sec h3 { font: 600 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
body[data-theme="sketch"] .p-sec h3 { font-size: 15px; letter-spacing: 0.02em; }
.p-strong { font-weight: 600; }
.p-need { color: var(--mint); font-size: 14px; }
.p-muted { color: var(--muted); }
.p-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.p-chip { font-size: 13px; padding: 3px 9px; background: var(--tile); border: 1px solid var(--line); }
body[data-theme="white"] .p-chip { border-radius: 999px; }
body[data-theme="sketch"] .p-chip { font-size: 15px; border: 1.5px solid #2b2b2b; border-radius: var(--radius); }
.p-chip.want { border-color: var(--mint); color: var(--mint); }
.p-chip.person { color: var(--text-soft); }
.p-foot { margin-top: 16px; font: 11px var(--mono); color: var(--faint); }


@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* phones */
@media (max-width: 700px) {
  body { font-size: 16px; }
  .count { right: 16px; top: 12px; }
  .count b { font-size: 28px; }
  .count span { font-size: 13px; }
  .toasts { left: 16px; top: 66px; }
  .toast { font-size: 15px; }
  .me { left: 12px; top: 12px; }
  .me-panel { width: calc(100vw - 24px); max-height: calc(100vh - 90px); }
  body[data-corner="avatar"] .me-panel { width: calc(100vw - 24px); }
  body[data-corner="dock"] .me-panel { width: 86vw; }
  .profile { right: 12px; bottom: 12px; width: min(330px, calc(100vw - 24px)); max-height: 58%; padding: 16px 14px 12px; }
  .p-pic { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Live room metrics share the selected map theme. */
.room-insights {
  position: fixed; z-index: 3; right: 0; top: 0; bottom: 0;
  width: clamp(250px, 21vw, 380px); overflow: auto;
  background: var(--panel); color: var(--text); border-left: var(--border);
  padding: 16px 20px;
}
.room-insights summary { cursor: pointer; font-weight: 600; }
.room-insights:not([open]) { width: auto; bottom: auto; }
.room-insights h2 { font-size: .95em; }
.room-insights section { border-top: var(--border); margin-top: 14px; padding-top: 12px; }
.room-insights ul, .room-insights ol { list-style: none; padding: 0; }
.room-insights li { padding-top: 4px; color: var(--text-soft); font-size: .86em; overflow-wrap: anywhere; }
#room-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
#room-stats dt { color: var(--text-soft); font-size: .76em; }
#room-stats dd { font-weight: 600; }
#scan-chart { display: flex; height: 52px; align-items: end; gap: 4px; padding-top: 8px; }
#scan-chart span { flex: 1; background: var(--mint); }
#scan-chart p { font-size: .82em; color: var(--text-soft); }
.wall-icebreaker {
  position: fixed; z-index: 3; left: 20px; bottom: 20px; max-width: min(55vw, 850px);
  padding: 10px 16px; color: var(--text); background: var(--overlay);
  border: var(--border); border-radius: var(--radius);
}
.wall-icebreaker[hidden] { display: none; }
@media (min-width: 801px) {
  body:has(.room-insights[open]) #map3d { width: calc(100% - clamp(250px, 21vw, 380px)); }
  body:has(.room-insights[open]) .count,
  body:has(.room-insights[open]) .profile { right: calc(clamp(250px, 21vw, 380px) + 24px); }
  body:has(.room-insights:not([open])) .count { top: 68px; }
}
@media (max-width: 800px) {
  .room-insights { top: auto; right: 12px; bottom: 12px; max-height: 62vh; max-width: calc(100vw - 24px); }
  .room-insights:not([open]) { bottom: 12px; }
  .wall-icebreaker { bottom: 66px; max-width: calc(100vw - 40px); }
}

/* The head count and Room activity are for hosts and the projector only. */
body:not(.host):not(.kiosk) .count,
body:not(.host):not(.kiosk) #room-insights { display: none; }
@media (min-width: 801px) {
  body:not(.host):not(.kiosk) #map3d { width: 100%; }
  body:not(.host):not(.kiosk) .profile { right: 24px; }
}
@media (max-width: 700px) { body.demo .demo-tag { bottom: 8px; font-size: 10px; } }
