* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #8fc7ff; font-family: -apple-system, Segoe UI, Roboto, sans-serif; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; }

#crosshair {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.8); font-size: 22px; font-weight: 300; pointer-events: none;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
}

#flash {
  position: fixed; inset: 0; background: #e74c3c; opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease; z-index: 5;
}

#prompt {
  position: fixed; left: 50%; bottom: 22%; transform: translateX(-50%);
  background: rgba(15, 20, 28, 0.82); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: 0.2px; pointer-events: none;
  opacity: 0; transition: opacity 0.15s ease; border: 1px solid rgba(255, 255, 255, 0.14);
}
#prompt.show { opacity: 1; }
#prompt b { color: #7ecbff; }

#presence {
  position: fixed; top: 14px; right: 14px; min-width: 180px;
  background: rgba(15, 20, 28, 0.7); color: #e7edf3; padding: 10px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.7; backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, 0.1);
}
#presence .phead { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.6; margin-bottom: 4px; }
#presence .floor { float: right; margin-left: 10px; font-size: 11px; opacity: 0.55; font-weight: 600; letter-spacing: 0.3px; }

#legend {
  position: fixed; left: 14px; bottom: 14px; color: #e7edf3;
  background: rgba(15, 20, 28, 0.62); padding: 9px 13px; border-radius: 10px;
  font-size: 12px; line-height: 1.6; border: 1px solid rgba(255, 255, 255, 0.1);
}
#legend b { color: #7ecbff; }

#status {
  position: fixed; top: 14px; left: 14px; color: #cfe0ee;
  background: rgba(15, 20, 28, 0.62); padding: 6px 12px; border-radius: 999px; font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Chat sits ABOVE the shortcut panel (legend) — bottom clears the legend's height
   and the height is capped so it never grows down over it. */
#chatlog {
  position: fixed; left: 14px; bottom: 138px; max-width: 46vw; max-height: 46vh; overflow: hidden;
  color: #eaf1f7; font-size: 26px; line-height: 1.35; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
#chatlog b { color: #ffd479; }
#chatlog b.me { opacity: 0.8; }
#chatlog .chatmsg { transition: opacity 0.7s ease; }
#chatlog .chatmsg.fading { opacity: 0; }
#chatbox {
  position: fixed; left: 14px; bottom: 100px; width: 46vw; display: none;
  background: rgba(15, 20, 28, 0.92); color: #fff; border: 1px solid #3a4a5a;
  padding: 11px 14px; border-radius: 8px; font-size: 20px; outline: none;
}

#present-btn {
  display: none; position: fixed; left: 50%; top: 62px; transform: translateX(-50%);
  background: #26de81; color: #12181f; border: none; padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 700; cursor: pointer; z-index: 9;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
#present-btn.show { display: block; }
#present-btn:hover { filter: brightness(1.06); }

#announce-btn {
  display: none; position: fixed; left: 50%; top: 104px; transform: translateX(-50%);
  background: #f1c40f; color: #4a3a00; border: none; padding: 9px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 700; cursor: pointer; z-index: 9;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
#announce-btn.show { display: block; }
#announce-btn:hover { filter: brightness(1.05); }

#break-btn {
  position: fixed; top: 50px; left: 14px; z-index: 9;
  background: rgba(20, 26, 34, 0.9); color: #ffd479; border: 1px solid rgba(255, 212, 121, 0.5);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; cursor: pointer;
}
#break-btn:hover { filter: brightness(1.1); }

#announce {
  display: none; position: fixed; left: 50%; top: 0; transform: translateX(-50%);
  max-width: 92vw; margin-top: -70px; transition: margin-top 0.35s ease;
  background: linear-gradient(90deg, #f1c40f, #f39c12); color: #2a2000;
  font-size: 17px; font-weight: 800; padding: 14px 28px; border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45); z-index: 40; text-align: center;
}
#announce.show { display: block; margin-top: 0; }

#fps {
  position: fixed; left: 12px; bottom: 104px; z-index: 20;
  font: 700 12px/1 ui-monospace, Menlo, monospace; color: #8fe08a;
  background: rgba(12, 16, 22, 0.62); padding: 4px 8px; border-radius: 6px;
  pointer-events: none; letter-spacing: 0.3px;
}

/* watch mode: the presentation fills the screen, the 3D office shrinks to a corner */
#present-full {
  display: none; position: fixed; inset: 0; width: 100vw; height: 100vh;
  object-fit: contain; background: #000; z-index: 50;
}
#present-full.show { display: block; }
#scene.pip {
  inset: auto; right: 16px; bottom: 16px;
  border: 2px solid rgba(255, 255, 255, 0.55); border-radius: 10px; z-index: 60;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); cursor: default;
}
/* laser-pointer dots drawn over the fullscreen presentation */
.ptr-dot {
  position: fixed; width: 20px; height: 20px; margin: -10px 0 0 -10px; z-index: 55;
  border-radius: 50%; background: var(--pc, #ffd166); border: 2px solid #fff;
  box-shadow: 0 0 12px var(--pc, #ffd166), 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none; font: 700 12px/1 Arial; color: transparent;
}
.ptr-dot::after {
  content: attr(data-name); position: absolute; left: 16px; top: -2px; white-space: nowrap;
  color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); font-size: 12px;
}
/* expanding ring so a ping draws the eye (esp. on the presenter's own screen) */
.ptr-dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px;
  margin: -10px 0 0 -10px; border-radius: 50%; border: 2px solid var(--pc, #ffd166);
  animation: ptr-ping 1.1s ease-out infinite; pointer-events: none;
}
@keyframes ptr-ping {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(3.2); opacity: 0; }
}

/* Rendered off-screen (NOT display:none) so Safari keeps decoding it into the
   Three.js VideoTexture — a hidden video shows as a black box on Safari/macOS. */
#share-preview {
  position: fixed; left: 2px; bottom: 2px; width: 2px; height: 2px; opacity: 0.01;
  pointer-events: none; z-index: -1;
}
#share-preview.live {
  left: auto; right: 14px; bottom: 74px; width: 260px; height: auto; max-width: 42vw; opacity: 1;
  border: 2px solid #26de81; border-radius: 8px; background: #000; z-index: 8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

#voicebadge {
  position: fixed; right: 14px; bottom: 14px; color: #cfe0ee;
  background: rgba(15, 20, 28, 0.62); padding: 7px 13px; border-radius: 999px; font-size: 12px;
  font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.1);
}
#voicebadge.on { color: #12181f; background: #26de81; border-color: #26de81; }

/* "you are still presenting" badge — visible while you share, even after you walk
   out of the room where the projection lives */
#sharing-badge {
  display: none; position: fixed; right: 14px; bottom: 48px; z-index: 9;
  background: rgba(20, 26, 34, 0.9); color: #ff6b6b; font-weight: 700; font-size: 12px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(255, 107, 107, 0.5);
}
#sharing-badge.on { display: block; }

#cam-badge {
  display: none; position: fixed; right: 14px; bottom: 82px; z-index: 9;
  background: rgba(20, 26, 34, 0.9); color: #7ecbff; font-weight: 700; font-size: 12px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(126, 203, 255, 0.5);
}
#cam-badge.on { display: block; }

#hp-badge {
  display: none; position: fixed; left: 14px; top: 120px; z-index: 9; cursor: pointer;
  background: rgba(20, 26, 34, 0.9); color: #a0e0ff; font-weight: 700; font-size: 12px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(160, 224, 255, 0.5);
}
#hp-badge.on { display: block; }

/* muted-by-a-manager indicator */
#mute-badge {
  display: none; position: fixed; left: 14px; top: 152px; z-index: 9;
  background: rgba(60, 16, 16, 0.92); color: #ff8080; font-weight: 700; font-size: 12px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(255, 96, 96, 0.6);
}
#mute-badge.on { display: block; }

/* guest (not-yet-approved) indicator */
#guest-badge {
  display: none; position: fixed; left: 14px; top: 186px; z-index: 9; max-width: 260px;
  background: rgba(60, 48, 16, 0.92); color: #ffd479; font-weight: 700; font-size: 12px;
  padding: 7px 13px; border-radius: 999px; border: 1px solid rgba(255, 212, 121, 0.6);
}
#guest-badge.on { display: block; }

/* Presence tier — ALWAYS visible so attendance logging is transparent. */
#pr-badge {
  position: fixed; left: 14px; top: 88px; z-index: 9; font-weight: 700; font-size: 12px;
  padding: 7px 13px; border-radius: 999px; background: rgba(20, 26, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25); cursor: default;
}
#pr-badge.engaged { color: #26de81; border-color: rgba(38, 222, 129, 0.6); }
#pr-badge.present { color: #7ecbff; border-color: rgba(126, 203, 255, 0.5); }
#pr-badge.away    { color: #9aa7b4; border-color: rgba(154, 167, 180, 0.4); }

/* Your own webcam self-view. Off-screen (NOT display:none) when idle so Safari
   keeps decoding; .show brings it to the corner, mirrored like a video call. */
#cam-self {
  position: fixed; left: 2px; bottom: 2px; width: 2px; height: 2px; opacity: 0.01;
  pointer-events: none; z-index: -1; transform: scaleX(-1);
}
#cam-self.show {
  left: auto; right: 14px; bottom: 116px; width: 180px; height: auto; opacity: 1;
  border: 2px solid #7ecbff; border-radius: 10px; background: #000; z-index: 8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* Corner FACE preview — what others see on your tablet head when they're out of
   your camera range. Sits in the same corner as the camera self-view. */
#face-self { position: fixed; left: 2px; bottom: 2px; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; z-index: -1; }
#face-self.show {
  left: auto; right: 14px; bottom: 116px; width: 180px; height: auto; opacity: 1;
  border: 2px solid #7ecbff; border-radius: 10px; background: #eaf2fb; z-index: 8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* face-to-face webcam — a row of tiles up top, one per person looking at you,
   ordered left→right by where they stand, sized down as more appear */
#cam-strip {
  display: none; position: fixed; left: 50%; top: 12%; transform: translateX(-50%);
  z-index: 45; gap: 10px; align-items: flex-start; justify-content: center;
  max-width: 94vw; pointer-events: none;
}
#cam-strip.show { display: flex; }
.cam-tile {
  position: relative; border-radius: 14px; overflow: hidden; background: #0b0f16;
  border: 2px solid rgba(255, 255, 255, 0.7); box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}
.cam-tile video { display: block; width: 100%; height: auto; background: #0b0f16; }
.cam-tile .cam-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72)); color: #fff;
  font-size: 13px; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#toasts { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 6; }
.toast {
  background: rgba(20, 26, 34, 0.92); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 600; border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); transition: opacity 0.4s ease; max-width: 80vw; text-align: center;
}

#lockhint {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(10, 14, 20, 0.35); color: #fff; font-size: 20px; font-weight: 600; z-index: 7;
  pointer-events: none;
}
#lockhint div { background: rgba(15, 20, 28, 0.8); padding: 14px 26px; border-radius: 12px; }

#start {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #2c5a8f, #101826);
}
.card {
  background: rgba(18, 24, 33, 0.96); color: #e7edf3; width: min(440px, 90vw);
  padding: 30px 30px 26px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.card h1 { font-size: 30px; margin-bottom: 10px; }
.card p { font-size: 14px; line-height: 1.6; opacity: 0.85; margin-bottom: 20px; }
.card label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.6; margin-bottom: 6px; }
.card input {
  width: 100%; background: #0e141c; color: #fff; border: 1px solid #3a4a5a; border-radius: 9px;
  padding: 12px 14px; font-size: 16px; outline: none; margin-bottom: 16px;
}
.card input:focus { border-color: #2e86de; }
.card button {
  width: 100%; background: linear-gradient(180deg, #3aa0ff, #2e86de); color: #fff; border: none;
  padding: 13px; border-radius: 9px; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.card button:hover { filter: brightness(1.08); }
.card button:active { transform: scale(0.98); }
.card .hint { font-size: 12px; opacity: 0.55; margin-top: 14px; text-align: center; line-height: 1.5; }

/* ── in-world office builder panel (build mode) ─────────────────────────────── */
#buildpanel {
  position: fixed; left: 14px; top: 50%; transform: translateY(-50%);
  width: 240px; max-height: 82vh; overflow-y: auto; display: none; z-index: 9;
  background: rgba(18, 24, 33, 0.94); color: #e7edf3; border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  font-size: 13px;
}
#buildpanel.show { display: block; }
#buildpanel .bp-h { font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; }
#buildpanel .bp-x { font-size: 11px; opacity: 0.55; font-weight: 400; }
#buildpanel .bp-pal { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
#buildpanel .bp-pal button { background: #0e141c; color: #cdd7e2; border: 1px solid #3a4a5a; border-radius: 7px; padding: 7px 4px; cursor: pointer; font-size: 12px; }
#buildpanel .bp-pal button.sel { background: linear-gradient(180deg,#3aa0ff,#2e86de); color: #fff; border-color: #2e86de; }
#buildpanel .bp-help { font-size: 11px; opacity: 0.6; line-height: 1.5; margin-bottom: 10px; }
#buildpanel .bp-save { display: flex; gap: 6px; margin-bottom: 8px; }
#buildpanel .bp-save input { flex: 1; min-width: 0; background: #0e141c; color: #fff; border: 1px solid #3a4a5a; border-radius: 7px; padding: 7px 9px; font-size: 13px; outline: none; }
#buildpanel .bp-save button { background: #2e86de; color: #fff; border: none; border-radius: 7px; padding: 7px 12px; font-weight: 700; cursor: pointer; }
#buildpanel .bp-list { display: flex; flex-direction: column; gap: 4px; }
#buildpanel .bp-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: #0e141c; border-radius: 7px; padding: 6px 8px; }
#buildpanel .bp-row span { cursor: pointer; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#buildpanel .bp-row span:hover { color: #7ecbff; }
#buildpanel .bp-row button { background: transparent; color: #e07a7a; border: none; cursor: pointer; font-size: 13px; }
#buildpanel .bp-empty { opacity: 0.5; font-size: 12px; padding: 4px 2px; }
