/* ==================== 17. ROOMS: JOIN SCREEN, PRESENCE CHIP, LIVE CURSORS ==================== */
#roomGate {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 12, 16, 0.62);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#gateCard {
  width: min(400px, 100%);
  padding: 26px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#gateCard h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.gate-sub {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--chrome-mute);
}

#gateCard label {
  margin: 6px 0 0;
}

#gateCard input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--chrome-border-strong);
  background: var(--input-bg);
  color: var(--chrome-text);
  font-size: 14px;
}

#gateCard input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

#gateCard .d {
  justify-content: center;
  min-height: 42px;
}

#gateCreate {
  margin-top: 6px;
}

.gate-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 2px;
  font-size: 11px;
  color: var(--chrome-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gate-or::before,
.gate-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--chrome-border-strong);
}

#gateForm {
  display: flex;
  gap: 8px;
}

#gateCode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#gateForm .d {
  background: var(--btn-bg);
  padding-inline: 18px;
}

#gateErr {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--danger);
}

#roomGate.busy #gateCard {
  opacity: 0.7;
}

/* presence chip (top-left) */
#roomChip {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 36;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.chip-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.06em;
}

#roomChip button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--chrome-mute);
}

#roomChip button:hover {
  background: var(--chrome-hover);
  color: var(--chrome-text);
}

.chip-sep {
  width: 1px;
  height: 16px;
  background: var(--chrome-border-strong);
}

#chipPeers {
  display: inline-flex;
}

#chipPeers i {
  width: 22px;
  height: 22px;
  margin-left: -6px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 10.5px var(--sans);
  font-style: normal;
  color: #fff;
  border: 2px solid var(--chrome-solid);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

#chipPeers i:first-child {
  margin-left: 0;
}

.chip-count {
  color: var(--chrome-mute);
  font-weight: 500;
  padding-right: 2px;
}

#netStatus {
  position: fixed;
  top: calc(58px + env(safe-area-inset-top, 0px));
  left: 14px;
  z-index: 36;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--chrome-mute);
}

/* other people's cursors (screen space, positioned from world coords every frame) */
#cursors {
  position: fixed;
  inset: 0;
  z-index: 34;
  pointer-events: none;
  overflow: hidden;
}

.rcursor {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  transition: opacity 0.4s ease;
}

.rcursor svg {
  display: block;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.rcursor span {
  position: absolute;
  left: 16px;
  top: 17px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  font: 600 11px/1.4 var(--sans);
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.rcursor.idle {
  opacity: 0.35;
}

@media (max-width: 760px) {
  .chip-count { display: none; }
}

.opt-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  opacity: 0.7;
}

.chip-id {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  max-width: 190px;
}

.chip-id b {
  font-size: 12.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-id .chip-code {
  font-size: 10px;
  font-weight: 500;
  color: var(--chrome-mute);
}
