/* Virtual Office — base UI. Theme colours (--primary/--accent/--bg) are set on
   :root by main.js applyTheme(config); everything else derives from them. */

:root {
  --primary: #2563eb;
  --accent: #f59e0b;
  --bg: #0f172a;

  /* derived surfaces (fallbacks first, color-mix where supported) */
  --surface: #1e293b;
  --surface: color-mix(in srgb, var(--bg) 86%, white);
  --surface-2: #273548;
  --surface-2: color-mix(in srgb, var(--bg) 76%, white);
  --surface-3: #334155;
  --surface-3: color-mix(in srgb, var(--bg) 66%, white);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary-soft: rgba(37, 99, 235, 0.18);
  --primary-soft: color-mix(in srgb, var(--primary) 20%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 20%, transparent);
  --success: #22c55e;
  --warn: #f59e0b;
  --error: #ef4444;
  --info: #38bdf8;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-emoji: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  --topbar-h: 52px;
  --side-w: 340px;
}

/* ---- reset ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; font-weight: 650; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 10px; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: var(--primary); color: #fff; }

/* ---- scrollbars ------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- app frame -------------------------------------------------------- */
.app { display: flex; flex-direction: column; height: 100%; height: 100dvh; }
.main { flex: 1; display: flex; min-height: 0; position: relative; }

/* top bar */
.topbar {
  flex: none;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.company-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex: none;
  background: var(--surface-2);
}
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-initial {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  border-radius: 50%;
  text-transform: uppercase;
}
.logo-lg { width: 56px; height: 56px; font-size: 26px; border-radius: 14px; }
.logo-lg.logo-initial { border-radius: 50%; }
.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-pill { color: var(--text); }
/* outside the office (features/scenes.js): the pill is the way back in */
.room-pill.room-pill-link { cursor: pointer; }
.room-pill.room-pill-link:hover { filter: brightness(1.12); }
/* "E 🚪 Go outside" at a door to another map (features/scenes.js; phones use the Use button instead) */
.vo-door-hint { position: absolute; left: 50%; bottom: calc(72px + var(--safe-b, 0px)); transform: translateX(-50%); z-index: 9250; padding: 6px 12px; border-radius: 999px; background: rgba(15, 23, 42, 0.92); border: 1px solid var(--border-strong); color: var(--text); font-size: 13px; font-weight: 600; pointer-events: none; white-space: nowrap; }
.vo-door-hint kbd { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border-strong); font: inherit; font-size: 12px; text-align: center; }
.online-pill { color: var(--text-muted); }
.points-pill { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.points-pill:hover { border-color: var(--accent); }
.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.status-btn {
  max-width: 260px;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
}
.status-btn:hover { border-style: solid; background: var(--surface-2); }
.status-emoji { font-family: var(--font-emoji); font-size: 15px; line-height: 1; }
.status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.zoom { display: inline-flex; gap: 4px; }
/* the panel toggle collapses the side on desktop and opens the sheet on mobile */

/* stage */
.stage {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0a0f1c;
  background: color-mix(in srgb, var(--bg) 70%, black);
}
#canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}
.overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
  font-family: var(--font);
}

/* HUD strip (module slots) */
.hud {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100% - 24px);
  pointer-events: none;
  z-index: 3;
}
.hud-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
}

/* emote bar (no backdrop blur over the map: it is redrawn every frame, costly without a GPU) */
.emotes {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  z-index: 3;
}
.emote-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  font-family: var(--font-emoji);
  font-size: 20px;
  line-height: 1;
  transition: transform 0.12s ease, background 0.12s ease;
}
.emote-btn:hover { background: var(--surface-2); transform: scale(1.18); }
.emote-btn:active { transform: scale(0.95); }

/* side panel */
.side {
  flex: none;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 4;
}
body.side-collapsed .side { display: none; }
.tabs {
  flex: none;
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tab {
  flex: 1;
  position: relative;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-emoji);
  font-size: 19px;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active {
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
  background: var(--primary-soft);
}
.tab-badge {
  position: absolute;
  top: 6px; right: 50%;
  transform: translateX(16px);
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font: 700 10px/16px var(--font);
  text-align: center;
  pointer-events: none;
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  overscroll-behavior: contain;
}
.panel { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.panel-empty {
  height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  text-align: center;
  padding: 24px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { margin: 0; }

/* ---- components ------------------------------------------------------- */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 10px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; flex: 1; }
.card.placeholder { text-align: center; padding: 28px 16px; }
.placeholder .big { font-family: var(--font-emoji); font-size: 36px; margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease, opacity 0.12s ease;
}
.btn:hover { border-color: var(--text-dim); filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; transform: none; }
.btn-primary { background: var(--primary); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-accent { background: var(--accent); border-color: transparent; color: #111827; }
.btn-danger { background: var(--error); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 32px; height: 32px; padding: 0;
  font-size: 16px; font-weight: 700;
}
.btn.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.input {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, black);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: var(--text-dim); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input:disabled { opacity: 0.6; }
select.input { appearance: auto; }
select.input option, select.input optgroup { background: var(--surface); color: var(--text); }
textarea.input { resize: vertical; min-height: 64px; }
input[type="color"].input { padding: 2px; height: 32px; width: 44px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row-center { justify-content: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.grid-2 { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emoji { font-family: var(--font-emoji); }
hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }

.badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: rgba(34, 197, 94, 0.18); color: var(--success); }
.badge-warn { background: rgba(245, 158, 11, 0.18); color: var(--warn); }
.badge-error { background: rgba(239, 68, 68, 0.18); color: var(--error); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 12.5px;
  cursor: pointer;
}
.chip:hover { border-color: var(--text-dim); }
.chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.locked { opacity: 0.45; filter: grayscale(0.6); cursor: not-allowed; }

.list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.12s ease;
}
.list-item:hover, .list-item.active { background: var(--surface-3); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 600; }
.list-item .sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-title {
  margin: 10px 0 4px;
  padding: 0 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex; align-items: center; gap: 6px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-dim); }
.avatar-box {
  width: 40px; height: 48px;
  display: inline-flex; align-items: flex-end; justify-content: center;
  flex: none;
}
.avatar-box canvas { image-rendering: pixelated; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
tr:hover td { background: var(--surface-3); }

.error { color: var(--error); font-size: 13px; }
.success { color: var(--success); }
.kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  background: var(--surface-3);
  font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- toasts ----------------------------------------------------------- */
.toasts {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  right: 12px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 24px));
}
.toast {
  pointer-events: auto;
  padding: 10px 14px 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--info);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  word-break: break-word;
}
.toast.show { opacity: 1; transform: none; }
/* passive notices ("new #1"): clicks go through to whatever is underneath */
.toast.toast-passive { pointer-events: none; cursor: default; }
.toast.hide { opacity: 0; transform: translateX(16px); }
/* reduced motion: toasts fade in place, no slide */
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.hide { transform: none; }
}
.toast-info { border-left-color: var(--info); }
.toast-success { border-left-color: var(--success); }
.toast-warn { border-left-color: var(--warn); }
.toast-error { border-left-color: var(--error); }
/* desktop: toasts sit over the map, never over the side panel's tabs */
@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) {
  .toasts { right: calc(var(--side-w) + 12px); }
  body.side-collapsed .toasts { right: 12px; }
}

/* ---- world overlay: name tags, status bubbles, emotes ------------------- */
.tag, .bubble, .emote, .nameplate {
  position: absolute;
  left: 0; top: 0;
  pointer-events: none;
  white-space: nowrap;
  will-change: transform;
}
.tag {
  transform: translate(-50%, 0);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag .dot { width: 7px; height: 7px; }
.tag.me { outline: 1px solid var(--primary); }
.tag.sitting, .nameplate {
  background: var(--primary);
  color: #fff;
}
.bubble {
  transform: translate(-50%, -100%);
  display: inline-flex; align-items: center; gap: 5px;
  max-width: 180px;
  padding: 4px 9px;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  text-overflow: ellipsis;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%; bottom: -5px;
  width: 10px; height: 10px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}
.bubble .emoji, .bubble .bubble-emoji { font-family: var(--font-emoji); font-size: 15px; line-height: 1; }
.bubble .text, .bubble .bubble-text { overflow: hidden; text-overflow: ellipsis; }
.bubble.me { pointer-events: auto; cursor: pointer; }
.bubble.me:hover { box-shadow: 0 0 0 2px var(--primary), 0 2px 8px rgba(0, 0, 0, 0.35); }
.bubble.typing, .typing-dots { color: var(--text-dim); font-weight: 700; letter-spacing: 2px; }
.typing-dots::after, .bubble.typing::after { content: none; }
.typing-dots { animation: vo-blink 1s steps(2, start) infinite; }
.emote {
  transform: translate(-50%, -100%);
  font-family: var(--font-emoji);
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
  animation: vo-emote-float 2s ease-out forwards;
}
/* Reduced motion (e.g. Windows with animations off): the float would end invisible at once,
   so show the emoji still; the script removes it after 2 s. */
@media (prefers-reduced-motion: reduce) {
  .emote { animation: none !important; opacity: 1; }
}
@keyframes vo-emote-float {
  0%   { opacity: 0; transform: translate(-50%, -80%) scale(0.6); }
  12%  { opacity: 1; transform: translate(-50%, -110%) scale(1.15); }
  30%  { transform: translate(-50%, -120%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -220%) scale(1); }
}
@keyframes vo-blink { to { visibility: hidden; } }

/* ---- full-screen overlays: login + reconnect --------------------------- */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--bg);
  background-image:
    radial-gradient(60% 50% at 20% 10%, var(--primary-soft), transparent 70%),
    radial-gradient(40% 40% at 85% 90%, var(--accent-soft), transparent 70%);
  z-index: 50;
}
.reconnect { background: rgba(2, 6, 23, 0.78); backdrop-filter: blur(4px); }
.login-card { width: min(380px, 100%); padding: 24px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-title { margin: 0; font-size: 20px; }
.login-card .btn-block { margin-top: 6px; }
.login-card .error { margin: -4px 0 10px; }
.login-card .login-help { margin: 12px 0 0; text-align: center; }
.login-logo-img { display: block; width: 100%; max-width: 300px; height: auto; margin: -6px auto 2px; }
.login-tabs { display: flex; gap: 4px; margin: 14px 0 6px; padding: 4px; border-radius: 10px; background: var(--surface-2, rgba(148,163,184,.15)); }
.login-tabs[hidden] { display: none; }
.login-tab { flex: 1; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; opacity: .75; }
.login-tab.on { background: var(--primary, #2563eb); color: #fff; opacity: 1; }
/* PIN fields: spaced dots; the placeholder text stays normal */
.login-pin { letter-spacing: 0.3em; font-variant-numeric: tabular-nums; }
.login-pin::placeholder { letter-spacing: normal; }
/* "Email me a PIN" (only while email PINs are on) */
.login-mailpin { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.login-or { margin: 0; text-align: center; }
.login-note { margin: 2px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--text); line-height: 1.4; }

/* "Choose your own PIN" (first sign-in, after an admin PIN reset): over the office,
   below the sign-in / reconnect screens (50) and toasts (60) */
.pin-setup {
  position: fixed; inset: 0; z-index: 48;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(3px);
}
.pin-setup-card { width: min(380px, 100%); margin: auto; padding: 24px; border-color: var(--border-strong); box-shadow: var(--shadow); }
.pin-setup-card h2 { margin: 0 0 6px; font-size: 19px; }
.pin-setup-icon { margin-bottom: 8px; font-family: var(--font-emoji); font-size: 30px; line-height: 1; }
.pin-setup-card .error { margin: -4px 0 10px; }
.pin-setup-card .btn-block { margin-top: 6px; }
.reconnect-card { width: min(360px, 100%); padding: 24px; text-align: center; }
.reconnect-card .row { margin-top: 12px; }
.spinner {
  width: 34px; height: 34px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary);
  animation: vo-spin 0.8s linear infinite;
}
@keyframes vo-spin { to { transform: rotate(360deg); } }

/* ---- mobile: side panel becomes a bottom sheet ------------------------- */
@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  :root { --side-w: 100%; }
  .company-name { max-width: 120px; }
  .status-btn .status-text { display: none; }
  .status-btn { padding: 4px 8px; }
  .room-pill { max-width: 140px; }
  .online-pill { display: none; }
  .zoom { display: none; }
  .side {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 70vh;
    height: 70dvh;
    border-left: 0;
    border-top: 1px solid var(--border-strong);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
    transform: translateY(100%);
    transition: transform 0.25s ease;
    display: flex;
  }
  body.side-collapsed .side { display: flex; }
  body.panel-open .side { transform: none; }
  .tabs { border-radius: 16px 16px 0 0; }
  .emotes { bottom: 10px; }
  body.panel-open .emotes, body.panel-open .hud { display: none; }
  .toasts { top: auto; bottom: 16px; left: 12px; right: 12px; max-width: none; }
}

/* ---- motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .emote { opacity: 1; }
}

/* ---- panel-specific styles are appended below by their panels ---- */

/* ==== user panels ==== */
/* Chat, People, Me, Decorate and Events (public/js/ui/{chat,people,me,decorate,events}.js) */
.panel-chat .card + .card, .panel-people .card + .card, .panel-me .card + .card,
.panel-decorate .card + .card, .panel-events .card + .card { margin-top: 0; }

/* ---- chat ---- */
.panel-chat { height: 100%; min-height: 0; gap: 6px; }
.chat-tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 4px; margin: -2px -2px 0; scrollbar-width: none; }
.chat-tabs::-webkit-scrollbar { display: none; }
.chat-tab {
  flex: none; position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 170px; height: 30px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text-muted);
  font-size: 12.5px; font-weight: 650; white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.chat-tab:hover { color: var(--text); border-color: var(--text-dim); }
.chat-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chat-tab.active { background: var(--primary); border-color: transparent; color: #fff; box-shadow: 0 2px 10px var(--primary-soft); }
.chat-tab-icon { font-family: var(--font-emoji); font-size: 13px; line-height: 1; }
.chat-tab-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-tab-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.chat-tab-dot.on { background: var(--success); }
.chat-unread {
  flex: none; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--error); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}
.chat-tab-close {
  flex: none; width: 18px; height: 18px; margin: 0 -6px 0 -2px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 15px; line-height: 1; opacity: 0.6;
}
.chat-tab-close:hover { opacity: 1; background: rgba(255, 255, 255, 0.16); }
.chat-tab-add { width: 30px; padding: 0; justify-content: center; font-size: 17px; font-weight: 500; border-style: dashed; }
.chat-scope { flex: none; padding: 0 4px; font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list-wrap {
  position: relative; flex: 1; min-height: 140px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg); background: color-mix(in srgb, var(--bg) 55%, var(--surface));
}
.chat-list { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 6px 8px 12px; overflow-y: auto; overscroll-behavior: contain; }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; margin-top: 10px; }
.chat-msg.cont { margin-top: 3px; }
.chat-msg.mine { align-items: flex-end; }
.chat-msg.new { animation: vo-chat-in 0.18s ease-out; }
.chat-meta { display: flex; align-items: baseline; gap: 6px; max-width: 100%; margin: 0 4px 3px; font-size: 11.5px; }
.chat-from { font-weight: 700; color: var(--from, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-msg.mine .chat-from { color: var(--text-muted); }
.chat-time { flex: none; font-size: 10.5px; color: var(--text-dim); white-space: nowrap; }
.chat-bubble {
  max-width: 88%; padding: 6px 11px;
  border-radius: 16px; background: var(--surface-3); color: var(--text);
  line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg:not(.mine):not(.cont):not(.system) .chat-bubble { border-top-left-radius: 5px; }
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; }
.chat-msg.mine:not(.cont) .chat-bubble { border-top-right-radius: 5px; }
.chat-msg.mention .chat-bubble { background: color-mix(in srgb, var(--accent) 18%, var(--surface-3)); box-shadow: inset 0 0 0 1.5px var(--accent); }
.chat-msg.system { align-items: center; margin: 10px 0 2px; }
.chat-msg.system .chat-bubble { max-width: 100%; padding: 2px 6px; background: transparent; color: var(--text-muted); font-size: 12px; font-style: italic; text-align: center; }
.chat-msg.system .chat-time { font-style: normal; }
.chat-sys-icon { font-family: var(--font-emoji); font-style: normal; }
.chat-day {
  align-self: center; margin: 12px 0 0; padding: 2px 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-dim); font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.chat-day:first-child { margin-top: 2px; }
.chat-empty { max-width: 260px; margin: auto; padding: 24px 12px; text-align: center; color: var(--text-muted); }
.chat-empty .big { margin-bottom: 6px; font-family: var(--font-emoji); font-size: 34px; line-height: 1.2; }
.chat-empty-title { margin-bottom: 4px; font-weight: 650; color: var(--text); }
.chat-jump {
  position: absolute; left: 50%; bottom: 10px; z-index: 1; transform: translateX(-50%);
  padding: 5px 12px; border: 0; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.chat-typing {
  flex: none; min-height: 16px; padding: 0 6px;
  font-size: 11.5px; font-style: italic; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity 0.15s ease;
}
.chat-typing.on { opacity: 1; }
.chat-note { flex: none; padding: 6px 10px; border-radius: var(--radius-sm); background: rgba(245, 158, 11, 0.14); color: var(--warn); font-size: 12px; }
.chat-compose { flex: none; display: flex; align-items: flex-end; gap: 6px; }
textarea.input.chat-input { flex: 1; min-height: 40px; max-height: 132px; padding: 9px 12px; border-radius: 12px; line-height: 1.35; resize: none; overflow-y: auto; }
.chat-send { height: 40px; padding: 0 14px; border-radius: 12px; }
.chat-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; font-size: 11px; color: var(--text-dim); }
.chat-foot .kbd { padding: 0 4px; font-size: 10px; }
.chat-count.warn { color: var(--warn); font-weight: 700; }
@keyframes vo-chat-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- people ---- */
.panel-people { gap: 6px; }
.pp-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 8px;
  margin: -12px -12px 0; padding: 12px 12px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.pp-head h2 { margin: 0; }
.pp-summary { font-size: 12px; color: var(--text-muted); }
.pp-list { display: flex; flex-direction: column; gap: 1px; }
.pp-section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 2px 2px; padding: 0; border: 0; background: none;
  color: var(--text); font-size: 12px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; text-align: left;
}
button.pp-section-title { width: calc(100% - 4px); cursor: pointer; }
button.pp-section-title:hover { color: var(--primary); }
.pp-caret { margin-left: auto; color: var(--text-dim); font-size: 12px; }
.pp-live { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.pp-off { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.pp-dept { display: flex; align-items: center; gap: 7px; margin: 8px 4px 2px; font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.pp-dept .dot { width: 8px; height: 8px; }
.pp-dept-n { font-weight: 600; color: var(--text-dim); }
.pp-row { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius); transition: background 0.12s ease; }
.pp-row:hover { background: var(--surface-2); }
.pp-row.me { background: var(--primary-soft); }
.pp-av {
  position: relative; flex: none; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 12px; background: var(--surface-3);
  background: color-mix(in srgb, var(--dept, #64748b) 30%, var(--surface-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.pp-av canvas { flex: none; image-rendering: pixelated; }
.pp-row.offline .pp-av { background: var(--surface-2); }
.pp-row.offline .pp-av canvas { filter: grayscale(1); opacity: 0.55; }
.pp-online { position: absolute; right: 3px; bottom: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2px var(--surface); }
.pp-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pp-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 650; }
.pp-name-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-name .badge { flex: none; }
.pp-row.offline .pp-name { color: var(--text-muted); }
/* admins only: the full name under the nickname */
.pp-full { margin-top: -1px; font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-status { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12.5px; color: var(--text); }
.pp-status .emoji { flex: none; font-size: 14px; line-height: 1; }
.pp-status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-sub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-where.off { color: var(--text-dim); }
.pp-actions { flex: none; display: flex; flex-direction: column; gap: 4px; }
.pp-actions .btn { justify-content: flex-start; }
.pp-empty { padding: 30px 10px; text-align: center; color: var(--text-muted); }
.pp-empty .big { margin-bottom: 6px; font-family: var(--font-emoji); font-size: 30px; }

/* ---- me ---- */
.me-card { display: flex; flex-direction: column; gap: 8px; }
.me-card .card-head { margin-bottom: 0; }
.me-label { margin-top: 2px; font-size: 11.5px; font-weight: 700; color: var(--text-dim); letter-spacing: 0.05em; text-transform: uppercase; }
.me-status-preview {
  display: flex; justify-content: center; padding: 12px 6px 16px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: radial-gradient(120% 120% at 50% 0%, var(--primary-soft), transparent 70%), var(--surface);
}
.me-bubble {
  position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 6px 12px; border-radius: 12px; background: #fff; color: #0f172a;
  font-size: 13px; font-weight: 650; line-height: 1.3; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.me-bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; border-radius: 2px; background: inherit; transform: translateX(-50%) rotate(45deg); }
.me-bubble-emoji { font-size: 17px; line-height: 1; }
.me-bubble-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-bubble.empty { background: var(--surface-3); color: var(--text-muted); font-style: italic; font-weight: 600; box-shadow: none; }
.me-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.me-preset .emoji { font-size: 14px; line-height: 1; }
.me-status-row { display: flex; gap: 6px; }
.me-emoji-btn { flex: none; width: 44px; height: 38px; padding: 0; font-family: var(--font-emoji); font-size: 20px; line-height: 1; }
.me-emoji-btn.placeholder { filter: grayscale(1); opacity: 0.6; }
.me-emoji-btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.me-status-text { flex: 1; min-width: 0; }
.me-emoji-pop {
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); box-shadow: var(--shadow-sm);
}
.me-emoji-free { display: flex; align-items: center; gap: 6px; }
.me-emoji-input { flex: 1; min-width: 0; }
.me-react-slots { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.me-react-slot { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); font-family: var(--font-emoji); font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.me-react-slot.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.me-react-img { width: 28px; height: 28px; object-fit: contain; display: block; }
.me-react-grid { margin-top: 4px; }
.me-react-cell { position: relative; }
.me-react-cell .me-emoji { width: 100%; }
.me-react-del { position: absolute; top: -4px; right: -4px; width: 16px; height: 16px; border-radius: 50%; border: 0; padding: 0; background: #ef4444; color: #fff; font-size: 9px; line-height: 16px; cursor: pointer; }
.me-react-upwrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 4px 2px; }
.emote-img { width: 26px; height: 26px; object-fit: contain; display: block; }
.emote-btn.emote-edit { font-size: 16px; opacity: 0.7; }
/* a hero skin's ⚡ power (main.js buildEmoteBar): a gold ring, dimmed while it recharges */
.emote-btn.emote-power { box-shadow: inset 0 0 0 2px #f2b632; }
.emote-btn.emote-power:disabled { opacity: 0.4; transform: none; cursor: default; }
.me-emoji-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.me-emoji-tab { flex: none; width: 34px; height: 30px; border: 0; border-radius: 8px; background: transparent; font-family: var(--font-emoji); font-size: 17px; line-height: 1; opacity: 0.6; cursor: pointer; }
.me-emoji-tab:hover, .me-emoji-tab:focus-visible { opacity: 1; background: var(--surface-3); outline: none; }
.me-emoji-tab.active { opacity: 1; background: var(--primary-soft); box-shadow: inset 0 -2px 0 var(--primary); }
.me-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px; max-height: 196px; overflow-y: auto; overscroll-behavior: contain; }
.me-emoji {
  height: 34px; border: 0; border-radius: 8px; background: transparent;
  font-family: var(--font-emoji); font-size: 19px; line-height: 1;
  transition: transform 0.1s ease, background 0.1s ease;
}
.me-emoji:hover, .me-emoji:focus-visible { background: var(--surface-3); transform: scale(1.15); outline: none; }
.me-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.me-count { font-size: 11px; color: var(--text-dim); }
.me-msg { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text); font-size: 12.5px; }
.me-msg.success { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.me-msg.error { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.me-msg.info { background: var(--primary-soft); }
.me-wardrobe-top { display: flex; align-items: center; gap: 12px; }
.me-preview {
  position: relative; flex: none; width: 140px; height: 140px; padding: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 16px; border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--primary-soft) 0%, transparent 72%), var(--surface);
  cursor: pointer; transition: border-color 0.12s ease;
}
.me-preview:hover, .me-preview:focus-visible { border-color: var(--primary); outline: none; }
.me-preview canvas { image-rendering: pixelated; }
.me-preview-hint { position: absolute; top: 6px; left: 0; right: 0; font-size: 10px; color: var(--text-dim); text-align: center; opacity: 0; transition: opacity 0.15s ease; }
.me-preview:hover .me-preview-hint { opacity: 1; }
.me-preview-title { position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); padding: 1px 7px; border-radius: 999px; color: #fff; font-size: 10.5px; font-weight: 700; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.me-wardrobe-side { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.me-wardrobe-side p { margin: 0 0 2px; }
.me-slot { padding-top: 8px; border-top: 1px solid var(--border); }
.me-slot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.me-slot-label { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.me-slot-label .emoji { font-size: 13px; }
.me-color-wrap { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
input[type="color"].me-color { width: 36px; height: 24px; padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: none; cursor: pointer; }
input[type="color"].me-color::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"].me-color::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type="color"].me-color::-moz-color-swatch { border: 0; border-radius: 4px; }
.me-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.me-chip { padding: 4px 10px; font-size: 12px; }
.me-chip .emoji { font-size: 11px; }
.me-chip.special:not(.active) { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.me-chip.buyable { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.me-price { font-size: 11px; font-weight: 600; color: var(--accent); }
.me-price.ok { color: #22c55e; }
.me-price.short { color: var(--text-dim); }
.me-chip.too-dear { opacity: 0.75; }
.me-wallet { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: rgba(250, 204, 21, 0.14); border: 1px solid rgba(250, 204, 21, 0.45); font-size: 13px; }
.me-wallet b { font-size: 15px; font-variant-numeric: tabular-nums; }
.me-wallet .emoji { font-size: 15px; }
.me-skins { gap: 8px; }
.me-swatch {
  width: 28px; height: 28px; padding: 0; border-radius: 50%;
  border: 2px solid var(--surface-2); box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer; transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.me-swatch:hover { transform: scale(1.1); }
.me-swatch.active { box-shadow: 0 0 0 2px var(--primary); transform: scale(1.12); }
.me-points { display: flex; align-items: baseline; gap: 6px; }
.me-points .emoji { font-size: 20px; }
.me-points-n { font-size: 26px; font-weight: 800; line-height: 1; }
.me-points-label { font-weight: 600; color: var(--text-muted); }
.me-vc { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.me-vc .emoji { font-size: 16px; }
.me-vc-n { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }
.me-vc-hint { margin: 2px 0 6px; }
.me-unlocks { display: flex; flex-wrap: wrap; gap: 6px; }
.me-unlock { cursor: default; }
.me-unlock .emoji { font-size: 14px; }
.me-who { font-size: 13px; }
.me-pin .field { margin-bottom: 8px; }
.me-pin .me-msg { margin-bottom: 8px; }
.me-nick { margin: 10px 0 12px; }
.me-nick .field { margin-bottom: 4px; }
.me-nick-row { display: flex; gap: 8px; align-items: center; }
.me-nick-row .input { flex: 1; min-width: 0; }
.me-nick-row .btn { flex: none; }
.me-hint { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-muted); }
.pin-setup-card .me-hint { margin-top: -4px; margin-bottom: 10px; }

/* ---- decorate ---- */
.dec-card { display: flex; flex-direction: column; gap: 8px; }
.dec-card .card-head { margin-bottom: 0; }
.dec-card > p { margin: 0; }
.dec-desk-box { display: flex; flex-direction: column; gap: 10px; }
.dec-desk {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 12px 12px 20px; border-radius: 10px;
  background: linear-gradient(180deg, #dbb783 0, #c89f6a 6px, #c89f6a calc(100% - 12px), #9c7446 calc(100% - 12px));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22), var(--shadow-sm);
}
.dec-slot {
  aspect-ratio: 1; min-height: 48px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 2px dashed rgba(60, 35, 10, 0.45); background: rgba(60, 35, 10, 0.12);
  color: rgba(60, 35, 10, 0.7); font-family: var(--font-emoji); font-size: 28px; line-height: 1;
  cursor: pointer; transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}
.dec-slot:hover { transform: translateY(-2px); border-color: rgba(60, 35, 10, 0.8); }
.dec-slot.filled { border-style: solid; border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.28); }
.dec-slot.active { border-style: solid; border-color: var(--primary); background: rgba(255, 255, 255, 0.4); box-shadow: 0 0 0 3px var(--primary-soft); }
.dec-plus { font-family: var(--font); font-size: 24px; font-weight: 400; }
.dec-picker { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.dec-label { font-size: 11.5px; font-weight: 700; color: var(--text-dim); letter-spacing: 0.05em; text-transform: uppercase; }
.dec-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; }
.dec-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 6px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); font-size: 11px; line-height: 1.2;
  cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}
.dec-item:hover { border-color: var(--text-dim); color: var(--text); transform: translateY(-1px); }
.dec-item.active { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.dec-item.locked:hover { transform: none; }
.dec-item-emoji { font-size: 24px; line-height: 1.1; }
.dec-item-name { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dec-empty { padding: 14px 8px; text-align: center; color: var(--text-muted); }
.dec-empty .big { margin-bottom: 4px; font-family: var(--font-emoji); font-size: 30px; }
.dec-place-btn.active { background: var(--accent); border-color: transparent; color: #111827; }
.dec-hint { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent-soft); font-size: 12.5px; line-height: 1.45; }
.dec-hint .emoji { font-size: 14px; }
.dec-placed { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.dec-placed-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius-sm); }
.dec-placed-row:hover { background: var(--surface-3); }
.dec-placed-row .btn-icon { width: 28px; height: 28px; font-size: 14px; }
.dec-placed-emoji { flex: none; width: 26px; font-size: 20px; text-align: center; }
.dec-placed-name { font-size: 13px; font-weight: 600; }
.dec-remove:hover { color: var(--error); }
.dec-none { padding: 4px 2px; }
#canvas.dec-placing { cursor: cell; }

/* ---- events ---- */
.ev-head h2 { margin: 0 0 2px; }
.ev-head p { margin: 0; }
.ev-card { display: flex; flex-direction: column; gap: 8px; }
.ev-card .card-head { margin-bottom: 0; }
.ev-active { display: flex; flex-direction: column; gap: 8px; }
.ev-mod { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.ev-mod-icon { flex: none; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--accent-soft); font-family: var(--font-emoji); font-size: 24px; line-height: 1; }
.ev-mod-body { flex: 1; min-width: 0; }
.ev-mod-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ev-mod-name { font-weight: 700; }
.ev-mod-desc { margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }
.ev-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; text-align: center; color: var(--text-muted); }
.ev-empty .big { font-family: var(--font-emoji); font-size: 32px; line-height: 1.1; }
.ev-empty-title { font-weight: 600; color: var(--text); }
.events-cards:empty { display: none; }
.events-cards > .card + .card { margin-top: 0; }
.ev-error .error { margin: 0 0 6px; }
/* ==== end user panels ==== */

/* ==== admin + editor ==== */
/* admin panel (ui/admin.js): .adm-* ; floor plan editor (ui/editor.js): .ed-* */

/* the side panel is wider while the admin panel is open (desktop only) */
@media (min-width: 768px) and (min-height: 501px), (min-width: 768px) and (pointer: fine) {
  body.vo-wide-side { --side-w: min(540px, 46vw); }
}

.adm, .ed { gap: 12px; }
.adm-head, .ed-head { display: flex; align-items: flex-start; gap: 10px; }
.adm-head h2, .ed-head h2 { margin: 0 0 2px; font-size: 17px; }
.adm-nav {
  display: flex; gap: 4px; padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: sticky; top: -12px; z-index: 2;
}
.adm-nav-btn {
  flex: 1; border: 0; background: transparent; color: var(--text-muted);
  padding: 7px 10px; border-radius: 999px; font-weight: 650; font-size: 13px; white-space: nowrap;
}
.adm-nav-btn:hover { color: var(--text); background: var(--surface-3); }
.adm-nav-btn.active { background: var(--primary); color: #fff; }
.adm-sec { display: flex; flex-direction: column; gap: 10px; }
.adm-sec > .card + .card, .adm-mods > .card + .card { margin-top: 0; }
.adm-news-list { display: flex; flex-direction: column; gap: 8px; }
.adm-news-row { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.adm-news-row.editing { border-color: var(--primary); }
.adm-news-tools { flex-wrap: wrap; gap: 6px; }
.adm-card .field:last-child { margin-bottom: 0; }
.adm-dirty { color: var(--warn); font-size: 12px; font-weight: 700; white-space: nowrap; }
.adm-toolbar { flex-wrap: nowrap; align-items: center; }
.adm-sec-title { margin: 0 0 2px; }

/* branding */
.adm-color-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.adm-color-row:last-child { border-bottom: 0; }
.adm-color-label { font-weight: 650; }
.adm-color { flex: none; }
.adm-hex { width: 92px; flex: none; }
.input.adm-invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }
.adm-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-3);
  font-size: 12px; font-weight: 600;
}
.adm-quick-btn:hover { border-color: var(--text-dim); }
.adm-quick-sw { width: 20px; height: 20px; border-radius: 50%; border: 3px solid; flex: none; }
.adm-logo-row { align-items: center; margin-bottom: 8px; flex-wrap: nowrap; }
.adm-logo-box {
  width: 64px; height: 64px; flex: none; border-radius: 12px; overflow: hidden;
  background: var(--surface-3); border: 1px dashed var(--border-strong);
  display: flex; align-items: center; justify-content: center;
}
.adm-logo-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.adm-logo-initial {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.adm-file { display: none; }
.adm-presets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.adm-preset { display: flex; align-items: center; gap: 4px; }
.adm-preset > .input { flex: 1; min-width: 0; }
.adm-preset > .btn { padding: 4px 7px; }
.adm-emoji-cell { display: flex; align-items: center; flex: none; }
.adm-emoji-input { width: 48px; text-align: center; font-family: var(--font-emoji); font-size: 16px; padding: 6px 4px; }
.adm-emoji-pick { padding: 4px 6px; }
.adm-emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 2px;
  padding: 6px; max-height: 180px; overflow: auto;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border-strong);
}
.adm-emoji-opt { border: 0; background: transparent; font-family: var(--font-emoji); font-size: 19px; line-height: 1; padding: 6px 0; border-radius: 6px; }
.adm-emoji-opt:hover { background: var(--surface-3); }
.adm-empty-line { padding: 6px 2px; }

/* staff */
.adm-table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.adm-staff { table-layout: fixed; }
.adm-staff th, .adm-staff td { padding: 6px; }
.adm-staff .adm-c-dot { width: 24px; padding-right: 0; text-align: center; }
.adm-staff .adm-c-dept { width: 27%; }
.adm-staff .adm-c-role { width: 86px; }
.adm-staff .adm-c-desk { width: 56px; }
.adm-staff .adm-c-act { width: 40px; text-align: right; padding-left: 0; }
.adm-staff .adm-c-act .btn { padding: 3px 6px; }
.adm-row { cursor: pointer; }
.adm-row.open > td { background: var(--primary-soft); }
.adm-c-name, .adm-c-dept { overflow: hidden; }
.adm-c-dept { white-space: nowrap; text-overflow: ellipsis; font-size: 12.5px; }
.adm-c-dept .dot { width: 8px; height: 8px; margin-right: 6px; }
.adm-name { font-weight: 650; }
.adm-fullname { font-weight: 500; color: var(--text-muted); }
.adm-hint { font-size: 11px; color: var(--text-muted); }
.adm-key-row { margin: -4px 0 10px; }
.adm-edit .grid-2 .adm-wide { grid-column: 1 / -1; }
.adm-danger-row { row-gap: 6px; }
/* Admin -> Email: "Require emailed PINs" preview */
.adm-retire { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.adm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.adm-stat { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-3); font-size: 11.5px; color: var(--text-muted); line-height: 1.3; }
.adm-stat strong { font-size: 20px; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.adm-stat.ok strong { color: var(--success); }
.adm-stat.warn strong { color: var(--warn); }
.adm-missing > summary { cursor: pointer; font-size: 12.5px; font-weight: 650; }
.adm-missing ul { margin: 6px 0 0; padding-left: 18px; max-height: 180px; overflow: auto; font-size: 12.5px; }
.warn-text { color: var(--warn); margin: 0; }
/* Admin -> Staff: email addresses people typed on the sign-in page ("self-added") */
.adm-selfadded { border-color: var(--warn); }
.adm-selfadded-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.adm-selfadded-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-3); }
.adm-selfadded-row .mono { word-break: break-all; }
.adm-selfadded-act { flex: none; flex-wrap: wrap; justify-content: flex-end; }
.adm-name-row { display: flex; align-items: center; min-width: 0; }
.adm-name-row > .ellipsis { min-width: 0; }
.adm-selfadded-badge { flex: none; margin-left: 6px; font-size: 10.5px; padding: 1px 6px; vertical-align: 1px; }
@media (max-width: 480px) { .adm-selfadded-row { flex-direction: column; align-items: stretch; } .adm-selfadded-act { justify-content: flex-start; } }
.login-mailpin-email { margin-bottom: 4px; }
.login-mailpin-email small { font-weight: 400; }
.adm-online { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); vertical-align: middle; }
.adm-online.on { background: var(--success); border-color: transparent; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.adm-flash > td { animation: adm-flash 1.6s ease-out; }
@keyframes adm-flash { 0%, 35% { background: var(--accent-soft); } 100% { background: transparent; } }
.adm-staff tr.adm-edit-row > td, .adm-staff tr.adm-edit-row:hover > td { padding: 0; background: var(--surface); border-bottom: 2px solid var(--primary); }
.adm-edit { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.adm-edit .field { margin-bottom: 0; }
.adm-edit .grid-2 { gap: 8px 10px; }
.adm-edit hr { margin: 2px 0; }
.adm-edit-head { flex-wrap: nowrap; }
.adm-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
.adm-seen { font-family: var(--font); }
.adm-ws-hint:empty { display: none; }
.adm-unlocks-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; background: var(--surface-2); }
.adm-unlocks-box > summary { cursor: pointer; font-weight: 650; padding: 2px 0; }
.adm-unlocks-box p { margin: 6px 0 0; }
.adm-unlock-group { margin-top: 6px; }
.adm-unlock-title { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin: 2px 0 4px; }
.adm-unlocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 8px; }
.adm-unlock { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 6px; cursor: pointer; font-size: 12.5px; }
.adm-unlock:hover { background: var(--surface-3); }
.adm-pin { width: 110px; flex: none; }
.adm-confirm {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--error); background: rgba(239, 68, 68, 0.12); font-size: 13px;
}
.adm-add .field { margin-bottom: 6px; }
.adm-empty { text-align: center; padding: 18px 12px; }
.adm-empty p { margin: 6px 0 10px; }
.adm-empty-icon { font-family: var(--font-emoji); font-size: 34px; line-height: 1.2; margin-bottom: 6px; }

/* events & modules */
.adm-mods { gap: 10px; }
.adm-mod { display: flex; flex-direction: column; gap: 8px; }
.adm-mod-head { display: flex; align-items: flex-start; gap: 10px; }
.adm-mod-icon {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); font-family: var(--font-emoji); font-size: 24px; line-height: 1;
}
.adm-mod-name { font-weight: 700; font-size: 14.5px; }
.adm-mod-desc { margin: 0; color: var(--text-muted); }
.adm-status { flex: none; margin-top: 2px; }
.adm-mod-detail { word-break: break-word; }
.adm-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; line-height: 1.35; }
.adm-check input { margin-top: 1px; flex: none; }
.adm-switch { padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-3); }
.adm-sched, .adm-settings { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.adm-settings .field { margin-bottom: 2px; }
.adm-set-group { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.adm-set-group > summary { cursor: pointer; padding: 7px 10px; font-weight: 700; font-size: 13.5px; }
.adm-set-group[open] > summary { border-bottom: 1px solid var(--border); }
.adm-set-body { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; }
.adm-set-sub { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-weight: 700; font-size: 12.5px; color: var(--text-muted); }
.adm-set-sub:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
/* Admin -> Points: the points log */
.adm-plog { width: 100%; font-size: 12.5px; }
.adm-plog th, .adm-plog td { padding: 5px 6px; text-align: left; vertical-align: top; }
.adm-plog .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.adm-plog .plus { color: var(--success); }
.adm-plog .minus { color: var(--error); }
.adm-plog-bar input[type="date"] { flex: none; width: 170px; }
.adm-plog-bar .grow { min-width: 140px; }
.adm-dates, .adm-sched-hint { padding-left: 23px; }
.adm-dates { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-mmdd { display: inline-flex; gap: 4px; }
.adm-mmdd .input { padding: 5px 6px; }
.adm-mm { width: 74px; }
.adm-dd { width: 62px; }
.adm-mod-actions { gap: 6px; }
.adm-tech > summary { cursor: pointer; color: var(--text-dim); }
.adm-perms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* floor plan editor */
.ed-status { color: var(--text-muted); min-height: 18px; }
.ed-status[data-kind="warn"] { color: var(--warn); }
.ed-status[data-kind="ok"] { color: var(--success); }
.ed-banner, .ed-prompt {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--warn); background: rgba(245, 158, 11, 0.12);
}
.ed-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ed-tool {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-size: 11.5px; font-weight: 650;
}
.ed-tool:hover { border-color: var(--text-dim); background: var(--surface-3); }
.ed-tool.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.ed-tool:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ed-tool-icon { font-family: var(--font-emoji); font-size: 19px; line-height: 1.1; }
.ed-key { position: absolute; top: 3px; right: 5px; font: 700 9.5px/1 ui-monospace, Consolas, monospace; color: var(--text-dim); }
.ed-actions { gap: 6px; flex-wrap: nowrap; }
.ed-pulse { animation: ed-pulse 1.8s ease-in-out infinite; }
@keyframes ed-pulse { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 4px var(--primary-soft); } }
.ed-hover {
  padding: 6px 10px; min-height: 30px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ed-options h3 { margin-bottom: 6px; }
.ed-options p { margin: 6px 0 0; }
.ed-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 6px; margin-top: 6px; }
.ed-swatch {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  min-height: 62px; padding: 6px 4px 5px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-3);
  color: var(--text); font-size: 11px; font-weight: 600; line-height: 1.15;
}
.ed-swatch:hover { border-color: var(--text-dim); }
.ed-swatch.active { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.ed-sw-canvas { display: block; image-rendering: pixelated; border-radius: 3px; }
.ed-sw-art { flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.ed-sw-label { max-width: 100%; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-inspect { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-3); font-size: 12.5px; }
.ed-inspect .row { margin-top: 6px; }
.ed-inspect-title { font-weight: 700; margin-bottom: 2px; }
.ed-kv { display: flex; gap: 8px; font-size: 12.5px; }
.ed-kv > span:first-child { width: 92px; flex: none; }
.ed-form {
  display: flex; flex-direction: column; gap: 6px;
  margin: 8px 0; padding: 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--primary); background: var(--primary-soft);
}
.ed-form .field { margin-bottom: 0; }
.ed-form-title { font-weight: 700; font-size: 12.5px; }
.ed-form-row { flex-wrap: nowrap; align-items: flex-end; }
.ed-form input[type="color"].input { width: 52px; }
.ed-list-title { margin: 10px 0 4px; font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.ed-list { display: flex; flex-direction: column; gap: 2px; }
.ed-list-scroll { max-height: 260px; overflow: auto; }
.ed-list-item { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: var(--radius-sm); font-size: 13px; }
.ed-list-item:hover, .ed-list-item.active { background: var(--surface-3); }
.ed-list-item .btn { padding: 2px 6px; }
.ed-ws-id { width: 46px; flex: none; color: var(--text-muted); }
.ed-steps { margin: 4px 0 6px; padding-left: 20px; color: var(--text-muted); }
.ed-steps li { margin: 2px 0; }
.ed-steps li.now { color: var(--text); font-weight: 650; }
.ed-steps li.done { color: var(--success); }
.ed-results[data-kind="error"] { border-color: var(--error); }
.ed-results[data-kind="warn"] { border-color: var(--warn); }
.ed-results[data-kind="ok"] { border-color: var(--success); }
.ed-results h3 { font-size: 13.5px; }
.ed-results .card-head { margin-bottom: 4px; }
.ed-msgs { margin: 0; padding-left: 18px; font-size: 12.5px; max-height: 220px; overflow: auto; }
.ed-msgs li { margin: 2px 0; word-break: break-word; }
.ed-errors li { color: #fca5a5; }
.ed-warnings li { color: #fcd34d; }
.ed-warn-text { color: var(--warn); }
.ed-mapcard > summary, .ed-help > summary { cursor: pointer; font-weight: 650; }
.ed-mapcard[open] > summary, .ed-help[open] > summary { margin-bottom: 8px; }
.ed-size-row { display: flex; align-items: flex-end; gap: 6px; }
.ed-size-row .field { margin-bottom: 6px; }
.ed-size { width: 76px; }
.ed-times { padding-bottom: 14px; color: var(--text-dim); }
.ed-help ul { margin: 0; padding-left: 18px; color: var(--text-muted); }
.ed-help li { margin: 3px 0; }

@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  .adm-staff th:nth-child(3), .adm-staff td.adm-c-dept { display: none; }
  .adm-nav-btn { padding: 7px 6px; }
}
/* ==== end admin + editor ==== */

/* ==== user panels (follow-up) ==== */
/* chat channel tabs wrap instead of scrolling sideways; readable key hints */
.chat-tabs { flex-wrap: wrap; overflow: visible; }
.chat-foot .kbd { color: var(--text-muted); }
/* selected wardrobe pieces / status preset: solid primary, not tinted text */
.me-chip.active, .me-preset.active { background: var(--primary); border-color: transparent; color: #fff; }
/* people: the 68px avatar preview is cropped to a head-and-shoulders portrait */
.pp-av canvas { position: absolute; left: -12px; top: -12px; }
/* ==== end user panels (follow-up) ==== */

/* ==== user panels (mobile sheet fix) ==== */
/* name tags / bubbles use inline z-index 1000+; keep them inside the stage so
   the mobile bottom sheet (.side, z-index 4) covers them */
.stage { isolation: isolate; }
/* ==== end user panels (mobile sheet fix) ==== */

/* ==== user panels (chat tab pills) ==== */
/* a channel tab is a pill holding the tab button (+ a separate close button for DMs) */
.chat-tab:not(.chat-tab-add) { padding: 0; }
.chat-tab-main {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; max-width: 100%; height: 100%; padding: 0 11px;
  border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; cursor: pointer;
}
.chat-tab-main:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chat-tab.dm .chat-tab-main { padding-right: 3px; }
.chat-tab .chat-tab-close { margin: 0 7px 0 0; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.chat-tab .chat-tab-close:focus-visible { outline: 2px solid var(--primary); opacity: 1; }
/* ==== end user panels (chat tab pills) ==== */

/* ==== user panels (close hover) ==== */
.chat-tab .chat-tab-close:hover { background: rgba(255, 255, 255, 0.16); opacity: 1; }
/* ==== end user panels (close hover) ==== */

/* ==== v0.2 room access ==== */
/* door prompt + knock cards (public/js/features/access.js): centred over the
   map, above the mobile bottom sheet (.side z 4), below screens (50) + toasts (60) */
.acc-stack {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: calc((100vw - var(--side-w)) / 2);
  transform: translateX(-50%);
  z-index: 45;
  width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
body.side-collapsed .acc-stack { left: 50%; }
.acc-stack > * { pointer-events: auto; }
.acc-stack .card + .card { margin-top: 0; }
.acc-card, .acc-pop { background: var(--surface-2); border-color: var(--border-strong); box-shadow: var(--shadow); }
.acc-card { animation: acc-in 0.18s ease-out; }
.acc-head { display: flex; align-items: flex-start; gap: 10px; }
.acc-icon { flex: none; font-family: var(--font-emoji); font-size: 22px; line-height: 1.15; }
.acc-title { font-weight: 700; line-height: 1.3; }
.acc-sub { font-size: 12px; color: var(--text-muted); }
.acc-close { flex: none; margin: -4px -6px 0 0; padding: 2px 7px; }
.acc-pin-row { display: flex; gap: 6px; margin-top: 10px; }
.acc-pin-row .input { flex: 1; min-width: 0; }
.acc-pin { letter-spacing: 0.25em; font-variant-numeric: tabular-nums; }
.acc-pin::placeholder { letter-spacing: normal; }
.acc-msg { margin-top: 8px; font-size: 12.5px; color: var(--text-muted); }
.acc-msg.error { color: var(--error); font-weight: 600; }
.acc-actions { margin-top: 10px; gap: 6px; }
.acc-wait { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.acc-knock-card { border-left: 4px solid var(--accent); }
.acc-timer { flex: none; font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.acc-bar { height: 3px; margin-top: 10px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.acc-bar > span { display: block; width: 100%; height: 100%; background: var(--accent); transition: width 1s linear; }
@keyframes acc-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* lock button next to the room pill + the host controls popover */
.acc-lock { flex: none; width: 30px; height: 30px; font-family: var(--font-emoji); font-size: 15px; font-weight: 400; }
.acc-lock.locked { border-color: var(--accent); background: var(--accent-soft); }
.acc-pop { position: fixed; z-index: 46; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; }
.acc-label { font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.acc-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.acc-mode {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  font-size: 12px; font-weight: 650; text-align: center;
  cursor: pointer;
}
.acc-mode:hover { border-color: var(--text-dim); }
.acc-mode.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.acc-mode:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.acc-mode input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.acc-mode-icon { font-family: var(--font-emoji); font-size: 18px; line-height: 1.1; }
.acc-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.acc-pop .field { margin-bottom: 0; }
.acc-field { display: flex; flex-direction: column; gap: 6px; }
.acc-people { max-height: 190px; padding: 4px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.acc-person { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.acc-person:hover { background: var(--surface-3); }
.acc-person .ellipsis { min-width: 0; }
.acc-dept { flex: none; max-width: 45%; margin-left: auto; padding-left: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--text-dim); }
.acc-empty { padding: 8px; text-align: center; }

/* editor: room access + voice (public/js/ui/editor.js) */
.ed-access { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--border-strong); }
.ed-access .field { margin-bottom: 0; }
.ed-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  .acc-stack { left: 50%; top: calc(var(--topbar-h) + 8px); }
  .acc-lock { width: 28px; height: 28px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .acc-card { animation: none; }
}
/* ==== end v0.2 room access ==== */

/* ==== v0.2 tables + seat view ==== */
/* seat view (ui/seatview.js): covers the map stage while seated or watching;
   the top bar, the side panel and the toasts stay usable above/next to it.
   z-index is inside the stage's own stacking context (name tags use 1000-9000). */
.sv {
  position: absolute; inset: 0; z-index: 9500;
  display: flex; flex-direction: column;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, black);
  background-image: radial-gradient(70% 45% at 50% 0%, var(--primary-soft), transparent 70%);
}
.sv-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sv-icon {
  flex: none; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f8fafc; font-family: var(--font-emoji); font-size: 22px; line-height: 1;
}
.sv-titles { min-width: 0; }
.sv-title { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-pill {
  flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong);
  font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sv-timer.low { background: rgba(239, 68, 68, 0.18); border-color: var(--error); color: var(--error); }
.sv-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 14px; }
.sv-foot { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.sv-controls { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.sv-controls:empty { display: none; }
.sv-esc { white-space: nowrap; }
.sv-stand { min-width: 128px; }

/* table layout: the game (or the table, public/css/table.css) on the left, seats + log on the right */
.sv-table { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); max-width: 1120px; margin: 0 auto; }
@media (min-width: 1000px) { .sv-table { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; } }
.sv-main { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; }
.sv-note { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--text); font-size: 13px; text-align: center; }
.sv-game { display: flex; justify-content: center; min-width: 0; }
.sv-side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sv-label { margin-top: 2px; font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.sv-seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
@media (min-width: 1000px) { .sv-seats { grid-template-columns: minmax(0, 1fr); } }
.sv-seat { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.sv-seat.me { border-color: var(--primary); background: var(--primary-soft); }
.sv-seat.turn { box-shadow: 0 0 0 2px var(--accent); }
.sv-seat.empty { border-style: dashed; background: transparent; color: var(--text-muted); }
.sv-av { position: relative; flex: none; width: 40px; height: 40px; overflow: hidden; border-radius: 10px; background: var(--surface-3); }
.sv-av canvas { position: absolute; left: -14px; top: -10px; image-rendering: pixelated; }
.sv-av-initial { display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text-muted); }
.sv-seat-info { flex: 1; min-width: 0; }
.sv-seat-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-seat-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.sv-sit { flex: none; }
.sv-watchers { grid-column: 1 / -1; padding: 2px 4px; }
.sv-log {
  margin: 0; padding: 6px 8px 6px 24px; max-height: 180px; overflow: auto;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-muted); overscroll-behavior: contain;
}
.sv-log:empty { padding-left: 8px; list-style: none; }
.sv-log:empty::before { content: "Moves and results show up here."; color: var(--text-dim); }
.sv-log li { margin: 2px 0; overflow-wrap: anywhere; }
.sv-log .sv-log-success { color: var(--success); font-weight: 650; }
.sv-log .sv-log-warn { color: var(--warn); }
.sv-log .sv-log-info { color: var(--text); }

.sv-invite { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sv-invite-btn { align-self: stretch; }
.sv-invite-list { display: flex; flex-direction: column; gap: 3px; max-height: 220px; overflow-y: auto; padding: 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.sv-invite-who { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.sv-invite-who:hover:not(:disabled) { background: var(--primary-soft); }
.sv-invite-who:disabled { opacity: 0.6; cursor: default; }
.sv-invite-who .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-stack { position: fixed; right: 16px; bottom: 90px; z-index: 9600; display: flex; flex-direction: column; gap: 8px; max-width: min(340px, calc(100vw - 32px)); }
.inv-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; padding: 12px; border-radius: var(--radius); border: 1px solid var(--primary); background: var(--surface); color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.inv-icon { font-family: var(--font-emoji); font-size: 26px; line-height: 1; grid-row: span 2; }
.inv-text { font-size: 13.5px; }
.inv-actions { display: flex; gap: 6px; }
.sv-gsettings { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.sv-gsetting { flex: 0 1 200px; margin: 0; }

/* the meeting's wall screen (#seat-wall, the stage of the meeting layout below) */
.sv-wall-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text-dim); font-weight: 650; text-align: center; }
.sv-wall-icon { font-family: var(--font-emoji); font-size: 40px; line-height: 1.1; opacity: 0.75; }

@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  .sv-head, .sv-foot { padding: 8px 10px; }
  .sv-icon { width: 32px; height: 32px; font-size: 19px; }
  .sv-body { padding: 10px; }
  .sv-esc { display: none; }
  .sv-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sv-seat { gap: 6px; padding: 5px 6px; }
  .sv-av { width: 32px; height: 32px; }
  .sv-av canvas { left: -18px; top: -14px; }
  .sv-sit { padding: 3px 6px; }
  .sv-stand { min-width: 0; }
}
/* ==== end v0.2 tables + seat view ==== */

/* ==== v0.2 room access (follow-up) ==== */
/* the global .locked class greys out locked wardrobe items, so the lock button uses .acc-locked */
.acc-lock.acc-locked { border-color: var(--accent); background: var(--accent-soft); }
/* the picked access mode: solid primary like the other selected chips */
.acc-mode.active { background: var(--primary); border-color: transparent; color: #fff; box-shadow: none; }
/* ==== end v0.2 room access (follow-up) ==== */

/* ==== v0.2 tables + seat view (layout by stage width) ==== */
/* two columns only when the stage itself is wide (the side panel takes room) */
.sv-body { container-type: inline-size; }
@media (min-width: 1000px) {
  .sv-table { grid-template-columns: minmax(0, 1fr); }
  .sv-seats { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
@container (min-width: 900px) {
  .sv-table { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .sv-seats { grid-template-columns: minmax(0, 1fr); }
}
.sv-esc { color: var(--text-muted); }
.sv-esc .kbd { color: var(--text); }
.sv-log { list-style: none; padding-left: 8px; }
/* ==== end v0.2 tables + seat view (layout by stage width) ==== */

/* ==== v0.2 voice + screen share ==== */
/* voice bar (public/js/ui/voice.js): top left of the map stage while in a voice room; over a
   table seat view it sits at the footer's empty left end; the meeting seat view shows the
   same controls in #seat-controls instead. z-index is inside the stage (seat view 9500). */
.rtc-bar { position: absolute; top: 10px; left: 10px; z-index: 9600; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: calc(100% - 20px); pointer-events: none; }
.rtc-bar > * { pointer-events: auto; }
/* drag the bar by its pill to move it out of the way (voice.js dragBar); the grip says it moves */
.rtc-row { cursor: grab; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.btn.rtc-hide { padding-left: 8px; padding-right: 8px; font-size: 16px; line-height: 1; }
/* one line on a phone too: long names end in "…" (the pill's title has them all) */
.rtc-bar .rtc-row { flex-wrap: nowrap; max-width: 100%; }
.rtc-bar .rtc-row > * { flex: none; }
.rtc-bar .rtc-row > .rtc-pill { display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* tucked away at a side of the map (voice.js tuck): a tab with the call's state; tap it, or swipe
   it toward the map, to bring the bar back (a short slide in, none in low graphics) */
.rtc-tab {
  position: absolute; top: 10px; left: var(--safe-l, 0px); z-index: 9600; display: inline-flex; align-items: center; gap: 2px;
  height: 40px; min-width: 44px; padding: 0 6px 0 8px; margin: 0; color: var(--text); font: inherit; font-size: 18px; line-height: 1;
  border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 999px 999px 0; box-shadow: var(--shadow-sm);
  background: rgba(15, 23, 42, 0.92); background: color-mix(in srgb, var(--bg) 92%, transparent);
  cursor: pointer; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
}
.rtc-tab.right { left: auto; right: var(--safe-r, 0px); flex-direction: row-reverse; padding: 0 8px 0 6px; border-left: 1px solid var(--border-strong); border-right: 0; border-radius: 999px 0 0 999px; }
.rtc-tab-arrow { font-size: 15px; font-weight: 700; opacity: 0.75; }
.rtc-tab.live { background: var(--success); border-color: transparent; color: #052e16; }
.rtc-tab.warn { border-color: #f9ab00; }
.rtc-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.rtc-bar.slide-left { animation: rtc-in-left 0.18s ease-out; }
.rtc-bar.slide-right { animation: rtc-in-right 0.18s ease-out; }
@keyframes rtc-in-left { from { transform: translateX(-48px); opacity: 0; } }
@keyframes rtc-in-right { from { transform: translateX(48px); opacity: 0; } }
.rtc-row::before { content: "⠿"; padding-left: 6px; color: var(--text); opacity: 0.7; font-size: 16px; line-height: 1; }
.rtc-row .btn { cursor: pointer; }
.rtc-bar.on-seat { top: auto; bottom: 10px; }
.rtc-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 4px;
  border-radius: 999px; border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
  background: rgba(15, 23, 42, 0.92); background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.rtc-row .btn { border-radius: 999px; }
.rtc-pill { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 12.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.btn.rtc-mic.live { background: var(--success); border-color: transparent; color: #052e16; }
.rtc-hint {
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-sm);
  border: 1px solid var(--accent); background: rgba(15, 23, 42, 0.9); background: color-mix(in srgb, var(--bg) 78%, var(--accent));
}
.sv-controls { flex-wrap: wrap; }
.sv-controls .rtc-pill { padding-left: 2px; }
/* the wall screen: the presenter's screen, letterboxed */
.rtc-screen { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* speaking: name tags on the map (the ring at the feet is the engine layer 'rtc-speaking') */
.overlay .vo-bub.speaking .vo-tag { background: #15803d; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6), 0 1px 2px rgba(0, 0, 0, 0.35); }
@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  .rtc-bar { top: auto; bottom: 62px; left: 8px; }
  .rtc-tab { top: auto; bottom: 62px; }
  .rtc-bar.on-seat { bottom: 8px; }
  body.panel-open .rtc-bar, body.panel-open .rtc-tab { display: none; }
  .rtc-label { display: none; } /* icons only; aria-label and title keep the words */
  .rtc-unblock .rtc-label { display: inline; }
  .sv-foot { flex-wrap: wrap; }
}
/* ==== end v0.2 voice + screen share ==== */

/* ==== v0.2 meeting view: the parts needed without the seat view (the rest is css/meet.css) ==== */
.rtc-hint.warn { border-color: #f9ab00; }
/* raised hands on the map: a hand after the name on the tag */
.overlay .vo-bub.hand .vo-tag::after { content: "✋"; margin-left: 2px; font-family: var(--font-emoji); }
/* ==== end v0.2 meeting view ==== */

/* ==== phones and touch (SPEC 11, "Phones and touch") ==== */
/* --kb: how much of the page the on-screen keyboard covers (ui/touch.js, 0px when closed);
   the safe areas keep things off an iPhone's notch and home bar (viewport-fit=cover) */
:root {
  --kb: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* the app frame never scrolls (a focused field or scrollIntoView must not shift the whole office) */
.app, .main { overflow: clip; }
/* no double-tap zoom delay on controls; no long-press callouts or text selection on the map and bars */
button, a, input, select, textarea, label, summary, [role="button"] { touch-action: manipulation; }
#canvas, .overlay, .emotes, .tabs, .topbar, .act-row, .map-ctl, .sheet-grip { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.topbar { height: calc(var(--topbar-h) + var(--safe-t)); padding-top: var(--safe-t); padding-left: max(12px, var(--safe-l)); padding-right: max(12px, var(--safe-r)); }
.toasts { top: calc(var(--topbar-h) + var(--safe-t) + 10px); }
.acc-stack { top: calc(var(--topbar-h) + var(--safe-t) + 10px); }
.screen, .pin-setup { padding: max(16px, var(--safe-t)) max(16px, var(--safe-r)) max(16px, var(--safe-b)) max(16px, var(--safe-l)); }
/* sign-in and reconnect cards taller than the screen (a phone on its side) scroll instead of being cut off */
.screen { overflow-y: auto; overscroll-behavior: contain; }
.screen > .card { margin: auto; }

/* the page never zooms (pinch, double tap): the map has its own zoom; panels still scroll */
html, body { touch-action: pan-x pan-y; }
/* the sheet's grip is phone-only */
.sheet-grip { display: none; }

/* the Use button (ui/touch.js): what E does here, by the right thumb, on touch screens only; 👉 Nudge
   to its left when a colleague stands right next to me (.tight: the two would reach the mini-map,
   so the nudge is just 👉 and a long Use label is cut) */
.act-row {
  position: absolute; right: calc(12px + var(--safe-r)); bottom: calc(76px + var(--safe-b)); z-index: 9400;
  display: flex; flex-direction: row-reverse; align-items: center; gap: 10px; pointer-events: none;
}
.act-row > .act-btn { pointer-events: auto; }
.act-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 64px; min-height: 56px; padding: 0 20px 0 16px;
  border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.4);
  background: var(--primary); color: #fff; font: 750 16px/1 var(--font);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.act-btn:active { transform: scale(0.96); }
.act-btn:disabled { background: var(--surface-3); color: var(--text-muted); border-color: var(--border-strong); cursor: default; transform: none; }
.act-icon { font-family: var(--font-emoji); font-size: 24px; line-height: 1; }
.act-row.tight .act-nudge { padding: 0; width: 56px; justify-content: center; }
.act-row.tight .act-nudge .act-text { display: none; }
.act-row.tight .act-btn:not(.act-nudge) .act-text { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* map buttons (ui/touch.js): the whole office, find me; + and − on phones only (desktop has them in the top bar) */
.map-ctl { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(14px + var(--safe-b)); z-index: 9400; display: flex; flex-direction: column; gap: 8px; }
.map-ctl .btn { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; background: rgba(15, 23, 42, 0.92); background: color-mix(in srgb, var(--bg) 92%, transparent); box-shadow: var(--shadow-sm); }
.map-ctl .btn.active { background: var(--primary); border-color: transparent; color: #fff; }
.map-ctl .mc-zoom { display: none; }

/* touch screens: 44 px targets, 16 px fields (iOS zooms into smaller ones), no keyboard-only hints */
@media (pointer: coarse) {
  .btn { min-height: 44px; min-width: 44px; }
  .adm-nav-btn { min-height: 44px; }
  .btn-sm { padding: 6px 12px; font-size: 13px; }
  .btn-icon { width: 44px; height: 44px; }
  .tab { height: 50px; }
  .emote-btn { width: 44px; height: 44px; }
  .chat-tab { height: 44px; }
  .chat-tab .chat-tab-close { width: 30px; height: 30px; }
  .chat-tab-add { width: 44px; }
  .chip, .me-chip { min-height: 44px; }
  .me-swatch { width: 36px; height: 36px; }
  .me-emoji { height: 44px; }
  .pp-section-title { min-height: 44px; }
  .status-btn { min-height: 40px; }
  .acc-lock { width: 40px; height: 40px; }
  input.input, select.input, textarea.input { min-height: 44px; font-size: 16px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .adm-unlock, .acc-person, .acc-check, .adm-check, .ed-check { min-height: 40px; }
  .chat-foot > span:first-child, .sv-esc, .ed-key { display: none; }
  .chat-count { margin-left: auto; }
  .chat-foot { font-size: 12px; }
  .badge { font-size: 12px; }
  .overlay .vo-bub .vo-tag, .overlay .vo-bub .vo-status { font-size: 12px; }
  .me-preview-hint { opacity: 1; }
  .rtc-pill, .sv-key-label { font-size: 12px; }
  .sv .sv-screen-key { width: 44px; height: 44px; }
}
@media (pointer: coarse) and (max-width: 767px), (pointer: coarse) and (max-height: 500px) {
  /* above the Use button, by the right thumb (the top is where toasts and the door prompt show) */
  .map-ctl { right: calc(12px + var(--safe-r)); bottom: calc(144px + var(--safe-b)); }
  .map-ctl .btn { width: 44px; height: 44px; font-size: 22px; }
  .map-ctl .mc-zoom { display: inline-flex; }
  body.panel-open .map-ctl, body.panel-open .act-row { display: none; }
  .rtc-bar { max-width: calc(100% - 120px); }
}

/* phones: the side panel is a sheet over the map with a grip; toasts sit at the top and let taps through */
@media (max-width: 767px), (max-height: 500px) and (pointer: coarse) {
  .sheet-grip {
    display: block; position: relative; flex: none; width: 100%; height: 24px; padding: 0; margin: 0;
    border: 0; background: transparent; cursor: grab; touch-action: none;
  }
  .sheet-grip::before {
    content: ""; position: absolute; left: 50%; top: 9px; width: 44px; height: 5px;
    border-radius: 3px; background: var(--text-dim); transform: translateX(-50%);
  }
  .sheet-grip:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
  .side {
    bottom: var(--kb);
    height: min(70vh, calc(100vh - var(--topbar-h) - var(--kb)));
    height: min(70dvh, calc(100dvh - var(--topbar-h) - var(--safe-t) - var(--kb)));
    padding-bottom: var(--safe-b);
  }
  body.sheet-tall .side { height: calc(100vh - var(--topbar-h) - var(--kb)); height: calc(100dvh - var(--topbar-h) - var(--safe-t) - var(--kb)); }
  body.kb-open .side { padding-bottom: 0; }
  .tabs { border-radius: 0; }
  .emotes { bottom: calc(10px + var(--safe-b)); }
  .toasts { top: calc(var(--topbar-h) + var(--safe-t) + 8px); bottom: auto; left: max(12px, var(--safe-l)); right: max(12px, var(--safe-r)); max-width: none; align-items: center; gap: 6px; }
  .toast { width: 100%; max-width: 480px; padding: 8px 12px; pointer-events: none; cursor: default; box-shadow: var(--shadow-sm); }
  .toast.toast-action { pointer-events: auto; cursor: pointer; }
  /* the voice bar a row above the Use / Nudge buttons and the folded mini-map (bottom 76px), never over them */
  .rtc-bar, .rtc-tab { bottom: calc(144px + var(--safe-b)); }
  /* the quick reactions from the left, narrowing to leave the bottom right corner to the 🛍️ Shop button */
  .emotes { left: max(8px, var(--safe-l)); transform: none; max-width: calc(100% - 68px - var(--safe-l) - var(--safe-r)); }
  .emotes .emote-btn { flex-shrink: 1; min-width: 32px; }
  /* seat view: smaller head and foot, room for the game */
  .sv-head { padding: 6px max(10px, var(--safe-r)) 6px max(10px, var(--safe-l)); gap: 8px; }
  .sv-title { font-size: 15px; }
  .sv-foot { padding: 6px max(10px, var(--safe-r)) calc(6px + var(--safe-b)) max(10px, var(--safe-l)); }
  /* Admin -> Staff: one card per person, the whole nickname and full name readable */
  .adm-staff, .adm-staff tbody { display: block; }
  .adm-staff thead { display: none; }
  .adm-staff tr.adm-row {
    display: grid; grid-template-columns: 18px auto minmax(0, 1fr) 44px;
    grid-template-areas: "dot name name act" "dot role desk act";
    align-items: center; column-gap: 8px; row-gap: 4px; padding: 10px 6px 10px 10px; border-bottom: 1px solid var(--border);
  }
  .adm-staff tr.adm-row > td { display: block; width: auto; padding: 0; border: 0; background: none; }
  .adm-staff tr.adm-row.open { background: var(--primary-soft); }
  .adm-staff tr.adm-row > td.adm-c-dot { grid-area: dot; align-self: start; padding-top: 5px; text-align: left; }
  .adm-staff tr.adm-row > td.adm-c-name { grid-area: name; }
  .adm-staff tr.adm-row > td.adm-c-role { grid-area: role; }
  .adm-staff tr.adm-row > td.adm-c-desk { grid-area: desk; color: var(--text-muted); }
  .adm-staff tr.adm-row > td.adm-c-act { grid-area: act; padding: 0; text-align: right; }
  .adm-staff tr.adm-row > td.adm-c-dept { display: none; }
  .adm-staff .adm-c-name .ellipsis { white-space: normal; overflow-wrap: anywhere; }
  .adm-staff .adm-name-row { flex-wrap: wrap; row-gap: 2px; }
  .adm-staff tr.adm-edit-row, .adm-staff tr.adm-edit-row > td { display: block; }
  .adm-staff .adm-edit .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
/* a phone on its side: the side panel is a drawer from the right, the map stays wide */
@media (max-height: 500px) and (pointer: coarse) and (orientation: landscape) {
  .side {
    top: 0; right: 0; bottom: var(--kb); left: auto; width: min(400px, 62vw); height: auto;
    border-top: 0; border-left: 1px solid var(--border-strong); border-radius: 16px 0 0 16px;
    padding-right: var(--safe-r); padding-bottom: 0;
    transform: translateX(100%);
  }
  body.sheet-tall .side { height: auto; }
  .sheet-grip { height: 16px; }
  .sheet-grip::before { top: 5px; }
  .tab { height: 42px; }
  .panel-body { padding: 8px 10px; }
  .chat-list-wrap { min-height: 60px; }
  body.panel-open .toasts { right: calc(min(400px, 62vw) + 12px); }
  .company-name { max-width: 180px; }
}
/* the keyboard is up on a phone on its side: only the conversation and the box being typed in */
@media (max-height: 260px) and (pointer: coarse) {
  .topbar, .sheet-grip, .tabs, .chat-scope, .chat-foot, .chat-tabs { display: none; }
}
@media (max-height: 500px) and (pointer: coarse) and (orientation: landscape) {
  body.kb-open .topbar, body.kb-open .sheet-grip, body.kb-open .tabs, body.kb-open .chat-scope, body.kb-open .chat-foot, body.kb-open .chat-tabs { display: none; }
}
@media (pointer: coarse) {
  .status-btn { min-width: 44px; justify-content: center; }
  .panel-toggle, .zoom, .acc-lock { flex: none; }
  .pp-sub, .pp-dept, .pp-full, .me-label, .me-count, .dec-item-name, .dec-label, .chat-scope, .chat-time, .adm-hint, .me-preview-hint, .list-title, .sv-label { font-size: 12px; }
}
/* ==== end phones and touch ==== */

/* Phones and tablets: a long press anywhere selects nothing and opens no copy / paste
   menu or image callout; typing fields still select and paste as usual. */
@media (pointer: coarse) {
  html, body { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  img, canvas { -webkit-user-drag: none; }
  input, textarea, select, [contenteditable="true"] { -webkit-touch-callout: default; -webkit-user-select: text; user-select: text; }
}

/* Admin > Events: category filter and collapsible module cards */
.adm-filter { position: sticky; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 8px; padding: 8px 0 10px; background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.adm-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-filter-chip { padding: 4px 10px; font-size: 12.5px; }
.adm-filter-chip.active { background: var(--primary); border-color: transparent; color: #fff; }
.adm-filter-n { opacity: .75; font-variant-numeric: tabular-nums; }
.adm-filter-row { gap: 8px; align-items: center; flex-wrap: wrap; }
.adm-filter-q { flex: 1; min-width: 160px; }
.adm-filter-run { white-space: nowrap; }
.adm-mod .adm-mod-head { cursor: pointer; border-radius: 8px; align-items: center; }
.adm-mod .adm-mod-head:hover .adm-mod-name { text-decoration: underline; }
.adm-mod .adm-mod-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.adm-mod-caret { width: 12px; flex: none; color: var(--text-muted); font-size: 12px; }
.adm-mod-body { display: flex; flex-direction: column; gap: 8px; }
.adm-mod-body[hidden] { display: none; }
.adm-mod:not(.open) { padding-top: 10px; padding-bottom: 10px; }
.adm-mod-none { margin: 12px 4px; }

/* Wardrobe: the preview stays pinned while the pieces scroll; locked pieces can be tried on */
.me-wardrobe-pin { position: sticky; top: -12px; z-index: 3; background: var(--surface-2); margin: 0 -12px; padding: 8px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.me-trybar { display: flex; flex-direction: column; gap: 4px; }
.me-trybar[hidden] { display: none; }
.me-try { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: var(--accent-soft, rgba(245,158,11,.14)); border: 1px dashed var(--accent); font-size: 12.5px; }
.me-try .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-try .me-try-hint { display: block; white-space: normal; }
/* the Shop button in Points & unlocks: the panel's width, its long label wraps instead of running out */
.me-shop { margin: 6px 0 10px; white-space: normal; text-align: center; }
.me-chip.locked.trial { opacity: 0.75; filter: none; cursor: pointer; }
.me-chip.trying { box-shadow: 0 0 0 2px var(--accent); opacity: 1; }

/* Admin -> Branding: the quick reaction size preview */
.adm-react-prev { display: flex; gap: 0.35em; align-items: flex-end; min-height: 1.2em; line-height: 1; font-family: var(--font-emoji); }

/* 👉 nudges (public/js/ui/nudge.js): the button over a tapped colleague, and the half-second shake
   of the whole screen (low graphics or reduced motion: ten jumps instead of a smooth slide) */
.overlay .nudge-pop { position: absolute; left: 0; top: 0; z-index: 9500; pointer-events: auto; white-space: nowrap; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
@keyframes vo-nudge-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-9px, 2px); }
  20% { transform: translate(9px, -2px); }
  30% { transform: translate(-7px, -1px); }
  40% { transform: translate(7px, 1px); }
  50% { transform: translate(-5px, 2px); }
  60% { transform: translate(5px, -1px); }
  70% { transform: translate(-3px, 1px); }
  80% { transform: translate(3px, 0); }
  90% { transform: translate(-1px, 0); }
}
.vo-nudged { animation: vo-nudge-shake 0.55s linear 1; }
.vo-nudged.vo-nudged-steps { animation-timing-function: steps(1, end); }
/* the reduced-motion rule above cuts every animation to 0.01ms; the nudge shake keeps its half second */
@media (prefers-reduced-motion: reduce) { .vo-nudged { animation-duration: 0.55s !important; } }

/* 🤖 features/fairplay.js: walking is off because a robot drives this browser */
.fair-note { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9450; max-width: min(560px, calc(100% - 24px)); padding: 8px 14px; border-radius: 10px; border: 1px solid var(--warn); background: var(--surface); color: var(--text); font-size: 13px; line-height: 1.4; box-shadow: var(--shadow-sm); text-align: center; }

/* 🌐 Monster Valley online: the sign-in page as a game screen (body.mv-login, main.js loadLoginOptions):
   the title poster behind, a wooden signboard with a parchment inside, the logo on top, green and gold like the game */
body.mv-login #login { background: #3a8f3f url(/modules/monsters/assets/title-poster.webp) center / cover no-repeat; }
body.mv-login #login::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(20, 12, 4, .55)); pointer-events: none; }
body.mv-login .login-card { position: relative; width: min(410px, 100%); margin-top: 90px; background: repeating-linear-gradient(0deg, rgba(160, 110, 40, .05) 0 2px, transparent 2px 6px), #fdf3d7; color: #3b2412;
  border: 10px solid #8b5a2b; border-radius: 18px; box-shadow: inset 0 0 0 3px #c9954f, inset 0 0 24px rgba(120, 70, 20, .25), 0 0 0 3px #4a2c12, 0 10px 0 #4a2c12, 0 18px 30px rgba(0, 0, 0, .45); padding: 14px 22px 64px; overflow: visible; }
body.mv-login .login-brand { display: block; margin: 0; }
body.mv-login .login-logo-img { max-width: 330px; margin: -96px auto 4px; filter: drop-shadow(0 5px 0 rgba(40, 20, 5, .55)); }
body.mv-login .login-card .muted, body.mv-login .login-card .dim, body.mv-login .login-card p { color: #6b4423; text-align: center; font-weight: 600; }
body.mv-login .login-card .field > span { color: #5a3410; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
body.mv-login .login-card .input { background: #fffaf0; color: #3b2412; border: 3px solid #c9954f; border-radius: 12px; font-weight: 800; font-size: 16px; }
body.mv-login .login-card .input:focus { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .3); outline: none; }
body.mv-login .login-card .input::placeholder { color: #b08a5a; font-weight: 600; }
body.mv-login .login-tabs { background: #e8d3a3; border: 3px solid #c9954f; border-radius: 999px; padding: 4px; }
body.mv-login .login-tab { border-radius: 999px; color: #6b4423; font-weight: 900; opacity: 1; }
body.mv-login .login-tab.on { background: linear-gradient(#ffd54a, #f5a623); color: #4a2c12; box-shadow: 0 3px 0 #a0620f, inset 0 1px 0 #fff3b0; }
body.mv-login .login-card .btn-primary { font: 900 21px/1.2 system-ui, sans-serif; letter-spacing: .02em; color: #fff; background: linear-gradient(#22c55e, #15803d); border: 3px solid #0b3b2a; border-radius: 999px; box-shadow: 0 5px 0 #0b3b2a, inset 0 2px 0 rgba(255, 255, 255, .35); padding: 11px 20px; margin-top: 12px; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
body.mv-login .login-card .btn-primary:hover { filter: brightness(1.06); }
body.mv-login .login-card .btn-primary:active { transform: translateY(4px); box-shadow: 0 1px 0 #0b3b2a; }
body.mv-login .login-card .error { color: #b91c1c; font-weight: 800; text-align: center; }
body.mv-login .login-card select { background: #fffaf0; color: #3b2412; border: 3px solid #c9954f; border-radius: 12px; font-weight: 700; }
/* the three starter monsters peeking over the bottom of the board */
.mv-login-mons { position: absolute; left: 0; right: 0; bottom: -40px; display: flex; justify-content: space-between; padding: 0 2px; pointer-events: none; }
.mv-login-mons img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 4px 0 rgba(40, 20, 5, .45)); }
.mv-login-mons img:nth-child(2) { margin-top: 18px; }
body.mv-login .login-card { margin-bottom: 60px; }
