*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

html {
  box-sizing: border-box;
  font-size: 62.5%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.5;
  background-color: #10131a;
  color: #e7eaf0;
  height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 7rem;
  padding: 0 2.4rem;
  background-color: #161b24;
  border-bottom: 1px solid #242b38;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-dot {
  width: 1rem;
  height: 1rem;
  margin-right: 0.9rem;
  border-radius: 50%;
  background-color: #5b8def;
}

.brand-name {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f2f4f8;
}

.topbar-right {
  display: flex;
  align-items: center;
}

.online {
  display: flex;
  align-items: center;
  margin-right: 1.6rem;
  font-size: 1.3rem;
  font-weight: 500;
  color: #8b93a5;
}

.online-dot {
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.7rem;
  border-radius: 50%;
  background-color: #4cc38a;
  box-shadow: 0 0 0 0 rgba(76, 195, 138, 0.5);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 195, 138, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(76, 195, 138, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 195, 138, 0);
  }
}

/* ---- Mobile background-disconnect notice ---- */
/* Same amber warning palette as .moderation-banner/.modal-notice. Sits in
   normal document flow right below the topbar — fine on both the fixed-
   height desktop layout and the auto-height mobile one, since this is only
   ever shown on mobile in the first place (see script.js), where .main
   already grows/scrolls naturally rather than fighting a fixed viewport
   height. */
.mobile-bg-notice {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.9rem 2.4rem;
  background-color: #1f1710;
  border-bottom: 1px solid #4a2f1f;
  color: #e2a05c;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.4;
}

.mobile-bg-notice-text {
  flex: 1;
}

.mobile-bg-notice-dismiss {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0.6rem;
  color: #e2a05c;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.mobile-bg-notice-dismiss:hover {
  background-color: rgba(226, 160, 92, 0.15);
}

/* ---- Main layout ---- */
/* Desktop: cams + whiteboard on the left ("stage"), a narrow chat column on
   the right. Both are flex row-items of .main, so they default to
   stretching to its full height — which is what lets the whiteboard grow
   to fill whatever vertical space the cams don't use. */
.main {
  max-width: 130rem;
  margin: 0 auto;
  padding: 2rem 2.4rem;
  display: flex;
  flex-direction: row;
  height: calc(100% - 7rem);
}

.stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin-right: 1.6rem;
  display: flex;
  flex-direction: column;
}

.chat-col {
  width: 38rem;
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---- Video panel ---- */
.video-panel {
  flex-shrink: 0;
  margin-bottom: 1.4rem;
  display: flex;
}

.video-box {
  position: relative;
  flex: 1;
  min-width: 0;
  max-height: 32rem;
  background-color: #0b0d12;
  border: 1px solid #242b38;
  border-radius: 14px;
  overflow: hidden;
}

/* Classic padding-percentage aspect-ratio technique (16:9) — works in
   every browser, unlike the CSS aspect-ratio property. */
.video-box::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

.video-box video,
.video-box .video-placeholder {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.video-box.remote {
  margin-right: 1.2rem;
}

/* Sits below the webcam boxes (a sibling of .video-panel, not nested inside
   it) rather than floating on top of the picture — it used to cover part
   of the video itself. Pulled up slightly to sit close under the boxes
   above, with its own bottom margin before the whiteboard. Off by default
   (the "hide" class in the markup) — script.js only reveals it once the
   "Show connection stats" setting is turned on. */
.connection-quality {
  display: inline-block;
  margin: -0.8rem 0 1rem;
  padding: 0.3rem 0.7rem;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.1rem;
  color: #8b93a5;
  pointer-events: none;
}

.connection-quality.relay { color: #e2a05c; }
.connection-quality.rough { color: #e15b5b; }

.video-box video {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-box.live video {
  display: block;
}

.video-box.live .video-placeholder {
  display: none;
}

.video-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #3d4453;
}

.video-off-icon {
  margin-bottom: 0.8rem;
}

.audio-icon {
  display: none;
  margin-bottom: 0.8rem;
  color: #5b8def;
}

.video-box.audio-only .video-off-icon {
  display: none;
}

.video-box.audio-only .audio-icon {
  display: block;
}

.video-label {
  font-size: 1.3rem;
  font-weight: 500;
  color: #5b6272;
}

/* ---- Shared whiteboard ---- */
/* Fills whatever vertical space is left in .stage after the cams, rather
   than a fixed height — so it grows on a tall window and shrinks on a
   short one instead of clipping or leaving dead space. */
.whiteboard-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 14px;
  overflow: hidden;
}

.whiteboard-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background-color: #10131a;
  border-bottom: 1px solid #242b38;
}

.wb-color {
  width: 3rem;
  height: 3rem;
  margin-right: 1.2rem;
  padding: 0;
  border: 1px solid #2a3140;
  border-radius: 0.6rem;
  background: none;
  cursor: pointer;
}

.wb-color::-webkit-color-swatch-wrapper {
  padding: 0.2rem;
}

.wb-color::-webkit-color-swatch {
  border: none;
  border-radius: 0.4rem;
}

.wb-size {
  width: 10rem;
  margin-right: 1.2rem;
  accent-color: #5b8def;
}

.wb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 3.4rem;
  height: 3.4rem;
  border: 1px solid #2a3140;
  border-radius: 0.7rem;
  background-color: #161b24;
  color: #8b93a5;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease,
    background-color 0.15s ease;
}

.wb-btn:hover {
  border-color: #5b8def;
  color: #5b8def;
}

.wb-btn.active {
  border-color: #5b8def;
  color: #5b8def;
  background-color: #1c2333;
}

.wb-btn:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.wb-spacer {
  flex: 1;
}

/* Same padding-percentage aspect-ratio technique used for .video-box, and
   the SAME ratio (16:9) as the admin dashboard's own fixed 800x450 review
   canvas. Strokes are relayed as points normalized to [0,1] per axis (see
   normalizedPoint()/strokeSegment() in script.js) rather than raw pixels,
   so they land in the right *relative* spot on any differently-sized
   canvas automatically — but only an undistorted *shape* (a circle stays a
   circle, not an ellipse) if every canvas that ever draws or replays a
   stroke shares the same aspect ratio. Before this, the board's height was
   just whatever flex space happened to be left over — different on every
   window size, and never matching the admin's fixed-ratio canvas — so the
   same stroke could look stretched differently on the other participant's
   screen and stretched differently again in the admin's review. Locking
   every wb-canvas box to 16:9 makes a drawing look the same everywhere,
   just scaled up or down. */
.wb-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 100rem;
  margin: 0 auto;
  flex-shrink: 0;
}

.wb-canvas-wrap::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

#wb-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  touch-action: none; /* stop touch scrolling from hijacking the drag */
  cursor: crosshair;
}

.conversation-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-bottom: 1.4rem;
}

.conversation-box {
  height: 100%;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 14px;
  /* The Draw/Report buttons float top-right of this card; the chat column
     is narrow enough now (even on desktop) that a centered system message
     needs this room reserved above it, not just on mobile. This lives on
     the outer box (not the scrollable list below) so it's reserved
     exactly once, whether or not the moderation banner is also showing —
     the banner just occupies the top of that same reserved space instead
     of needing its own separate clearance. */
  padding-top: 4.6rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.conversation-box .moderation-banner {
  margin: 0 1.6rem 1rem;
}

.conversation {
  flex: 1;
  min-height: 0;
  padding: 0 1.6rem 1.6rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.conversation > * {
  margin-bottom: 1rem;
}

.empty-state {
  margin: auto;
  color: #5b6272;
  font-size: 1.5rem;
  text-align: center;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  background-color: transparent;
  border: 1px solid transparent;
  color: #8b93a5;
  cursor: pointer;
  font-family: inherit;
}

.conversation-actions {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  z-index: 3;
  display: flex;
}

.icon-btn.report,
.icon-btn.wb-toggle {
  margin-left: 0.8rem;
  border: 1px solid #2a3140;
  border-radius: 999px;
  padding: 0.6rem 1.3rem;
  font-size: 1.3rem;
  font-weight: 600;
  background-color: #161b24;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.icon-btn.report svg,
.icon-btn.wb-toggle svg {
  margin-right: 0.5rem;
}

.icon-btn.report:hover {
  border-color: #e2685c;
  color: #e2685c;
}

.icon-btn.wb-toggle:hover,
.icon-btn.wb-toggle.active {
  border-color: #5b8def;
  color: #5b8def;
}

.icon-btn.report:focus-visible,
.icon-btn.wb-toggle:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.icon-btn.switch-view {
  display: none;
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 2;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  background-color: rgba(11, 13, 18, 0.75);
  border: 1px solid #2a3140;
  justify-content: center;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.icon-btn.switch-view:hover {
  border-color: #5b8def;
  color: #5b8def;
}

.icon-btn.switch-view:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.icon-btn.settings {
  width: 3.4rem;
  height: 3.4rem;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease,
    background-color 0.15s ease;
}

.icon-btn.settings:hover,
.icon-btn.settings[aria-expanded="true"] {
  border-color: #2a3140;
  background-color: #1c222e;
  color: #e7eaf0;
}

.icon-btn.settings:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

/* ---- Device settings dropdown ---- */
.device-settings {
  position: absolute;
  top: 5.6rem;
  right: 2.4rem;
  z-index: 5;
  width: 26rem;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 1.2rem;
  padding: 1.6rem;
  box-shadow: 0 1.2rem 2.8rem rgba(0, 0, 0, 0.45);
}

.device-field {
  display: block;
  margin-bottom: 1.2rem;
}

.device-field:last-of-type {
  margin-bottom: 0;
}

.device-field span {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #8b93a5;
}

.device-field select {
  width: 100%;
  background-color: #10131a;
  color: #e7eaf0;
  border: 1px solid #2a3140;
  border-radius: 0.7rem;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 1.4rem;
}

.device-field select:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 1px;
}

.device-hint {
  margin-top: 1.2rem;
  font-size: 1.2rem;
  color: #5b6272;
}

.device-field-checkbox {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.2rem;
  cursor: pointer;
}

.device-field-checkbox span {
  margin-bottom: 0;
  font-size: 1.3rem;
  font-weight: 500;
  color: #c5cad4;
}

.device-field-checkbox input[type="checkbox"] {
  width: 1.6rem;
  height: 1.6rem;
  accent-color: #5b8def;
  cursor: pointer;
}

/* ---- System messages ---- */
.system-message {
  align-self: center;
  color: #5b6272;
  font-size: 1.4rem;
  font-weight: 500;
  text-align: center;
  padding: 0.3rem 0;
}

/* ---- Moderator messages ----
   Same amber accent as .moderation-banner for a plain message, and a red
   variant for an explicit warning — both distinct from an ordinary chat
   bubble on purpose, so nobody could mistake this for something their
   chat partner said. */
.moderator-message {
  align-self: center;
  max-width: 85%;
  margin: 0.4rem 0;
  padding: 0.6rem 1.1rem;
  border-radius: 0.9rem;
  font-size: 1.3rem;
  text-align: center;
  background-color: #1f1710;
  border: 1px solid #4a2f1f;
  color: #f2c894;
}

.moderator-message.warn {
  background-color: #2a1414;
  border-color: #6b2020;
  color: #ff9c9c;
}

.moderator-message-label {
  font-weight: 700;
}

/* ---- Chat bubbles ---- */
.chat-row {
  display: flex;
  max-width: 100%;
}

.chat-row.you {
  justify-content: flex-end;
}

.chat-row.stranger {
  justify-content: flex-start;
}

.bubble {
  max-width: 68%;
  padding: 1.1rem 1.5rem;
  border-radius: 16px;
  font-size: 1.6rem;
  word-break: break-word;
  line-height: 1.4;
}

.bubble.you {
  background-color: #5b8def;
  color: #0c1220;
  border-bottom-right-radius: 4px;
}

.bubble.stranger {
  background-color: #232a38;
  color: #e7eaf0;
  border-bottom-left-radius: 4px;
}

.typing-row {
  display: flex;
  justify-content: flex-start;
}

/* Group Lobbies only (see #lobby-typing-indicator-row in lobby.html) — a
   fixed row between the conversation and the composer rather than one
   appended inside #lobby-conversation, so it never scrolls away with the
   message history or grows that box's height. The 1:1 chat's typing dots
   (.typing-row above) stay inside the conversation, unchanged. */
.typing-indicator-row {
  display: flex;
  justify-content: flex-start;
  padding: 0 0.4rem 0.6rem;
}

.typing-bubble {
  background-color: #232a38;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 1.2rem 1.6rem;
  display: flex;
}

.typing-bubble span {
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background-color: #6b7385;
  animation: bounce 1.2s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 0.3s;
  margin-right: 0;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* ---- Idle composer: mode picker + call to action ---- */
.composer-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0;
}

.mode-select {
  display: inline-flex;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 999px;
  padding: 0.4rem;
  margin-bottom: 1.4rem;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  background-color: transparent;
  color: #8b93a5;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.6rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mode-btn svg {
  margin-right: 0.6rem;
}

.mode-btn.active {
  background-color: #5b8def;
  color: #0c1220;
}

.mode-btn:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.media-error {
  margin-top: 1.2rem;
  color: #e2685c;
  font-size: 1.3rem;
  text-align: center;
  max-width: 40rem;
}

.btn-primary {
  background-color: #5b8def;
  color: #0c1220;
  font-size: 1.6rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 1.3rem 3.6rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background-color: #75a1f5;
  transform: translateY(-1px);
}

.btn-primary:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 3px;
}

/* ---- Active composer bar ----
   Two stacked rows on every screen size: the message box + send button on
   top, call controls underneath. On mobile the controls row additionally
   pins to the bottom of the screen and the text row becomes collapsible
   (see the mobile media query further down). */
.composer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 14px;
  padding: 0.8rem 1rem;
}

.composer-text-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.composer-controls-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* The gap above handles spacing between every child uniformly — the
   individual buttons/input below used their own margin-right, which
   doubled up with a pill-shaped container's asymmetric padding and made
   the gaps between them look uneven. */
.composer-text-row > *,
.composer-controls-row > * {
  margin-right: 0;
}

/* Mobile-only controls (e.g. the text-row collapse toggle) stay out of the
   way on desktop, where there's no need to hide the message box. */
.mobile-only-btn {
  display: none;
}

.composer-input {
  flex: 1;
  min-width: 0;
  max-height: 8rem;
  resize: none;
  border: none;
  background: transparent;
  color: #e7eaf0;
  font-family: inherit;
  font-size: 1.5rem;
  padding: 1.1rem 0;
}

.composer-input::placeholder {
  color: #5b6272;
}

.composer-input:focus {
  outline: none;
}

.pill-btn {
  flex-shrink: 0;
  margin-right: 0.5rem;
  background-color: #232a38;
  color: #c5cad4;
  font-size: 1.4rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.3rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.pill-btn:hover {
  background-color: #2c3444;
}

.pill-btn:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.pill-btn.danger {
  background-color: #3a2325;
  color: #e2685c;
}

.pill-btn.danger:hover {
  background-color: #472a2c;
}

.pill-btn:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.icon-btn.send {
  flex-shrink: 0;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background-color: #5b8def;
  color: #0c1220;
  border: none;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.icon-btn.send:hover {
  background-color: #75a1f5;
}

.icon-btn.send:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.icon-btn.toggle {
  flex-shrink: 0;
  width: 3.2rem;
  height: 3.2rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background-color: #232a38;
  color: #c5cad4;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn.toggle:hover {
  background-color: #2c3444;
}

.icon-btn.toggle.off {
  background-color: #3a2325;
  color: #e2685c;
}

.icon-btn.toggle:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

/* Lobby mic button locked by a host mute — visually distinct from a plain
   self-mute so it's clear this one isn't under the person's own control. */
.icon-btn.toggle.locked {
  background-color: #3a2325;
  color: #e2685c;
  cursor: not-allowed;
  opacity: 0.75;
}

.hide {
  display: none !important;
}

/* ---- Report modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: rgba(6, 8, 12, 0.7);
}

.modal {
  width: 100%;
  max-width: 48rem;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 14px;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.5);
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.8rem 2rem;
  border-bottom: 1px solid #242b38;
}

.modal-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f2f4f8;
}

.modal-close {
  width: 3.2rem;
  height: 3.2rem;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background-color: #232a38;
  color: #e7eaf0;
}

.modal-close:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2rem;
}

.modal-subtitle {
  margin-bottom: 1.6rem;
  font-size: 1.4rem;
  color: #8b93a5;
}

.report-reasons {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.6rem;
}

.report-reason {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin-bottom: 0.8rem;
  padding: 1.2rem 1.4rem;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 0.9rem;
  color: #e7eaf0;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.report-reason:last-child {
  margin-bottom: 0;
}

.report-reason:hover {
  border-color: #3a4356;
}

.report-reason.selected {
  border-color: #5b8def;
  background-color: #161d2c;
}

.report-reason:focus-visible {
  outline: 2px solid #5b8def;
  outline-offset: 2px;
}

.report-reason-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.report-reason-desc {
  margin-top: 0.3rem;
  font-size: 1.2rem;
  color: #8b93a5;
}

/* The most severe category gets a visual flag of its own, so it doesn't
   read as just another item in the list. */
.report-reason[data-category="underage"] {
  border-color: #4a2f1f;
  background-color: #1f1710;
}

.report-reason[data-category="underage"] .report-reason-title {
  color: #e2a05c;
}

.report-reason[data-category="underage"]:hover,
.report-reason[data-category="underage"].selected {
  border-color: #e2a05c;
  background-color: #241a10;
}

.modal-notice {
  margin-bottom: 1.6rem;
  padding: 1.2rem 1.4rem;
  background-color: #1f1710;
  border: 1px solid #4a2f1f;
  border-radius: 0.9rem;
  font-size: 1.3rem;
  line-height: 1.5;
  color: #e2a05c;
}

.moderation-banner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  /* Lives inside .conversation-box, as a sibling of the scrollable
     #conversation list rather than nested inside it (see the HTML
     comment above this element) — that way the Draw/Report buttons,
     which float position:absolute over .conversation-wrap, always
     overlay the exact same outer box whether or not this banner is
     showing, instead of the buttons visibly "belonging" to a different
     box depending on moderation state. .conversation-box's own
     padding-top already reserves the room the buttons need; the
     .conversation-box .moderation-banner rule below just adds the
     matching left/right/bottom spacing this element would otherwise get
     from .conversation's own padding, since it now sits outside that. */
  padding: 0.9rem 1.2rem;
  background-color: #1f1710;
  border: 1px solid #4a2f1f;
  border-radius: 0.9rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: #e2a05c;
  flex-shrink: 0;
}

.moderation-banner svg {
  flex-shrink: 0;
}

.modal-notice a {
  color: inherit;
  font-weight: 600;
}

.modal-field {
  display: block;
}

.modal-field span {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: #8b93a5;
}

.modal-field textarea {
  width: 100%;
  min-height: 8rem;
  padding: 1.1rem 1.3rem;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 0.9rem;
  color: #e7eaf0;
  font-family: inherit;
  font-size: 1.4rem;
  resize: vertical;
}

.modal-field textarea::placeholder {
  color: #5b6272;
}

.modal-field textarea:focus {
  outline: none;
  border-color: #5b8def;
}

.modal-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 1.6rem 2rem;
  border-top: 1px solid #242b38;
}

/* ---- Banned modal ----
   A stronger variant of the ordinary modal-overlay: everything behind it
   is blurred (not just dimmed) and, unlike the report modal, nothing here
   ever adds a "hide" listener for it — see the markup comment in
   index.html for why it's deliberately undismissable. */
.modal-overlay-blocking {
  background-color: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-danger {
  border-color: #4a2a2c;
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(226, 104, 92, 0.15);
}

.modal-danger .modal-header {
  border-bottom-color: #3a2325;
}

.modal-danger .modal-header h2 {
  color: #e2685c;
}

.banned-reason {
  padding: 1.2rem 1.4rem;
  background-color: #1c1315;
  border: 1px solid #3a2325;
  border-radius: 0.9rem;
  color: #e7eaf0;
  font-size: 1.4rem;
  line-height: 1.5;
}

.banned-reason:empty {
  display: none;
}

/* ---- "Finding someone new" countdown overlay ----
   Same blurred full-screen treatment as .modal-overlay-blocking (the banned
   modal), but self-dismissing rather than a permanent block: it fades in,
   plays the 3-2-1 beat, then fades back out on its own once
   runNextCountdown reaches zero. Lower z-index than the modal overlays
   above (fixed at 50) so a ban landing mid-countdown still surfaces on top
   of it rather than getting hidden underneath. */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background-color: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.countdown-overlay.visible {
  opacity: 1;
}

.countdown-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.countdown-lead {
  max-width: 42rem;
  margin-bottom: 2rem;
  font-size: 1.6rem;
  font-weight: 500;
  color: #b7bdc9;
}

.countdown-lead:empty {
  display: none;
}

.countdown-number {
  font-size: 13rem;
  font-weight: 800;
  line-height: 1;
  color: #f2f4f8;
  text-shadow: 0 0 6rem rgba(91, 141, 239, 0.55);
}

/* Re-added (removed, then re-added) on every tick by script.js so the pop
   plays fresh for each digit, not just the first one. */
.countdown-number.pop {
  animation: countdown-pop 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes countdown-pop {
  0% {
    transform: scale(0.35);
    opacity: 0;
  }
  45% {
    transform: scale(1.18);
    opacity: 1;
  }
  70% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.countdown-caption {
  margin-top: 2rem;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5b8def;
}

/* Lets someone bail out of matchmaking (a fresh Start, a Next, or an
   auto-rematch after the other side left) without waiting for a match —
   the same "pill" look as the in-chat Stop button, just re-centered here
   since it's not sitting in a horizontal composer bar. */
.countdown-stop-btn {
  margin-right: 0;
  margin-top: 2.4rem;
}

/* Swapped in for .countdown-number once the 3-2-1 count finishes without a
   match yet — a calmer, indefinite "still working on it" signal (the
   overlay just stays up) rather than a frozen "0" or an empty gap where
   the number used to be. Same pulse shape as .online-dot, scaled up and in
   the overlay's accent blue instead of the topbar's green. */
.countdown-searching-dot {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  background-color: #5b8def;
  box-shadow: 0 0 0 0 rgba(91, 141, 239, 0.5);
  animation: search-pulse 1.8s infinite;
}

@keyframes search-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(91, 141, 239, 0.45);
  }
  70% {
    box-shadow: 0 0 0 1.6rem rgba(91, 141, 239, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(91, 141, 239, 0);
  }
}

/* ---- Responsive ---- */
@media only screen and (max-width: 56.25em) {
  /* 900px */
  .brand-name {
    font-size: 1.7rem;
  }
}

@media only screen and (max-width: 48.125em) {
  /* 770px */
  .online-count {
    display: none;
  }
}

@media only screen and (max-width: 31.25em) {
  /* 500px */

  /* Desktop locks body/.main to exactly the viewport height and relies on
     flexbox to divide that fixed budget between .stage and .chat-col. On a
     phone there usually isn't enough room for both the camera view and a
     comfortable chat/composer area within one screen's height, and forcing
     it to fit anyway is what was squeezing .chat-col toward zero height
     (and, since the Draw/Report buttons float position:absolute over it,
     made them visually land on the composer bar instead of their own box).
     So on mobile we let the page grow to its natural (taller-than-viewport)
     height and scroll normally instead — everything below sizes to its own
     content rather than fighting for a fixed budget. */
  html,
  body {
    height: auto;
    min-height: 100vh;
  }

  /* Only matters once installed to the home screen (see the apple-mobile-
     web-app-capable tag in index.html) — a normal Safari/Chrome tab already
     has its own browser chrome covering the notch/status-bar area, but a
     standalone installed app draws edge-to-edge (that's what
     viewport-fit=cover asks for), so without this the topbar's content
     would sit underneath an iPhone's notch/Dynamic Island. Harmless no-op
     everywhere else: env(safe-area-inset-top) is 0 on any device without a
     safe-area-inset to report (Android, older iPhones, plain browser tabs).
     Switched from a fixed height to min-height so the extra inset makes the
     bar taller instead of squeezing its own content. */
  .topbar {
    height: auto;
    min-height: 7rem;
    padding-top: calc(env(safe-area-inset-top) + 1.2rem);
  }

  .mobile-bg-notice {
    padding-left: calc(2.4rem + env(safe-area-inset-left));
    padding-right: calc(2.4rem + env(safe-area-inset-right));
  }

  .main {
    height: auto;
    padding: 1.4rem;
    flex-direction: column;
  }

  /* The side-by-side stage/chat columns are a desktop layout — too narrow
     a screen to split, so both go back to stacking full-width. Both are
     "flex: none" now (sized to their own content) since .main no longer
     hands out a fixed height for them to share. */
  .stage {
    flex: none;
    margin-right: 0;
    margin-bottom: 1rem;
  }

  .chat-col {
    flex: none;
    min-height: 0;
    width: auto;
    /* Reserve room at the bottom of the page so content never sits behind
       the now fixed-position composer (see .composer/.composer-idle below,
       which are taken out of normal flow and can no longer push .chat-col's
       own height out to make room for themselves). Sized generously for the
       two-row composer at its tallest (expanded text row + wrapped controls
       row + safe-area padding) — a little extra blank scroll space at the
       bottom beats content being covered. */
    padding-bottom: 13rem;
  }

  .whiteboard-panel {
    flex: none;
  }

  /* No mobile-specific canvas sizing needed any more — .wb-canvas-wrap's
     own 16:9 aspect ratio (see the desktop rule above) already sizes it
     correctly at any width, mobile included, without a separate override. */

  .video-panel {
    position: relative;
    display: block;
    margin-bottom: 1rem;
  }

  /* .conversation-wrap/.conversation-box normally stretch to fill whatever
     height .chat-col is handed (height:100%, flex:1) — fine on desktop
     where that height is real, but with .chat-col now sized to its own
     content there's no height to fill, so those percentages would resolve
     to ~0. Give the message list its own bounded, independently-scrolling
     height instead, like a normal mobile chat UI. */
  .conversation-wrap {
    flex: none;
    margin-bottom: 1rem;
  }

  .conversation-box {
    height: auto;
  }

  /* Fixed height, not min/max — a range let the box visibly grow taller as
     messages arrived (from 12rem up toward 28rem) before it finally started
     scrolling internally instead of expanding. A flat height means it's
     already a fixed, independently-scrolling box from the very first
     message, exactly like desktop's real flex:1 height already is. */
  .conversation {
    flex: none;
    height: 28rem;
    overflow-y: auto;
  }

  /* The composer (and the idle mode-picker/Start screen before a call) are
     what the person needs to reach without hunting for it. Fixed (not just
     sticky) to the bottom of the viewport, like a native app's toolbar, so
     it's always docked at the very bottom of the screen instead of trailing
     wherever the page's natural content height happens to end — sticky left
     a gap below it whenever the video/whiteboard/message history didn't
     fill the screen. .chat-col's padding-bottom above reserves the room.
     Scoped to the #composer ID rather than the shared .composer class: the
     Group Lobbies page's composer (#lobby-composer, same class) already
     sits pinned to the bottom of its own bounded .lobby-room card via
     ordinary flexbox (.lobby-conversation-wrap is flex:1, the composer is
     the trailing fixed-size child), so it doesn't have this page's
     "content shorter than viewport" gap problem and shouldn't be pulled
     out to the screen edge. */
  .composer-idle,
  #composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #10131a;
    padding-top: 0.8rem;
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom, 0px));
    padding-left: calc(1.4rem + env(safe-area-inset-left));
    padding-right: calc(1.4rem + env(safe-area-inset-right));
    z-index: 24;
  }

  /* Edge-to-edge app toolbar look now that it's pinned to the screen edges
     rather than floating as a rounded card. */
  #composer {
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
  }

  .icon-btn.switch-view {
    display: flex;
  }

  .video-box.remote {
    margin-right: 0;
  }

  /* Portrait ratio for the large view — a landscape 16:9 box is the
     wrong shape for a phone camera and crops most of the frame away.
     Capped well below the old 46rem: at that height the video alone could
     eat almost an entire phone screen, leaving no room for the whiteboard,
     chat and composer below without excessive scrolling. */
  .video-box.primary {
    width: 100%;
    max-height: 28rem;
  }

  .video-box.primary::before {
    padding-top: 133.33%; /* 3:4 */
  }

  /* An audio-only call has no camera frame to preserve that portrait ratio
     for — just a centered mic icon, a label and the connection-quality
     badge — so keeping the same tall box as a real video call only steals
     height the whiteboard and chat need. Shrink it to a short banner. */
  .video-box.primary.audio-only {
    max-height: none;
  }

  .video-box.primary.audio-only::before {
    padding-top: 32%;
  }

  .video-box.secondary {
    position: absolute;
    z-index: 1;
    right: 0.8rem;
    bottom: 0.8rem;
    width: 6rem;
    height: 4.5rem;
    border-color: #2e3543;
  }

  .video-box.secondary .video-off-icon,
  .video-box.secondary .audio-icon {
    width: 1.6rem;
    height: 1.6rem;
    margin-bottom: 0;
  }

  .video-box.secondary .video-label {
    display: none;
  }

  .video-label {
    font-size: 1.1rem;
  }

  .icon-btn.report,
  .icon-btn.wb-toggle {
    padding: 0.6rem 0.9rem;
  }

  .icon-btn.report svg,
  .icon-btn.wb-toggle svg {
    margin-right: 0;
  }

  .btn-label {
    display: none;
  }

  .whiteboard-toolbar {
    padding: 0.6rem 0.8rem;
  }

  .wb-color {
    width: 2.6rem;
    height: 2.6rem;
    margin-right: 0.8rem;
  }

  .wb-size {
    width: 6rem;
    margin-right: 0.8rem;
  }

  .wb-btn {
    width: 3rem;
    height: 3rem;
  }

  .bubble {
    max-width: 80%;
  }

  .mode-btn {
    padding: 0.8rem 1.2rem;
    font-size: 1.2rem;
  }

  .mode-select {
    flex-wrap: wrap;
    justify-content: center;
  }

  .mode-btn svg {
    margin-right: 0.4rem;
  }
}

/* ---- App-like mobile treatment ----
   Shared by both the 1:1 chat and Group Lobbies pages (they share this
   stylesheet, and the elements below — .topbar, .btn-primary, .pill-btn,
   .composer-input, .icon-btn.send — are literally the same classes on
   both). Everything here is purely cosmetic/tactile, layered on top of the
   function-focused mobile rules above/below rather than replacing them: a
   sticky/blurred app bar instead of one that scrolls away, :active press
   feedback instead of relying on :hover (which a touchscreen never fires),
   touch targets sized to the ~44px both platforms' guidelines call for, and
   a couple of small platform quirks (iOS auto-zooming the page when a
   <16px input gets focus; the lingering gray tap-highlight rectangle
   Android/iOS draw over anything clickable). Desktop is completely
   untouched — none of this fires above 720px. */
@media (max-width: 720px) {
  a,
  button,
  input[type="checkbox"],
  .lobby-participant-menu-btn {
    -webkit-tap-highlight-color: transparent;
  }

  /* A touchscreen never hovers, so :hover's transform/background-color
     transitions just never happen there — swap in an immediate :active
     "press" instead, the same instant tactile feedback a native button
     gives. */
  .btn-primary:active,
  .pill-btn:active,
  .mode-btn:active,
  .icon-btn.send:active,
  .lobby-pending-btn:active {
    transform: scale(0.96);
  }

  .btn-primary,
  .pill-btn,
  .icon-btn.send {
    transition: background-color 0.15s ease, transform 0.08s ease;
  }

  /* Pinned + translucent + blurred, like a native app's navigation bar,
     instead of a plain opaque strip that scrolls away with the page (both
     pages let the page itself scroll on mobile — see the fixed-vs-auto
     height rules elsewhere in this file). */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: rgba(17, 21, 29, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  /* Every primary tap target grows to the ~44px both platforms' guidelines
     call for — .btn-primary already clears this on its own via its
     existing padding/font-size. */
  .pill-btn {
    min-height: 4.2rem;
    padding: 0.9rem 1.5rem;
  }

  .icon-btn.send {
    width: 4.2rem;
    height: 4.2rem;
  }

  .lobby-participant-menu-btn {
    width: 3.2rem;
    height: 3.2rem;
  }

  /* Below 16px, iOS Safari auto-zooms the whole page in when this gets
     focused — jarring and not how any native app behaves — so every text
     entry field grows to exactly the threshold that avoids it. */
  .composer-input,
  .lobby-name-input,
  .lobby-code-input,
  .lobby-passcode-input,
  .lobby-maxmembers-input,
  input[type="text"],
  input[type="number"],
  textarea {
    font-size: 1.6rem;
  }

  /* Scrolling one of these shouldn't also rubber-band the whole page once
     it hits its own end — same "contained" scroll behavior a native list
     or sheet has. */
  .conversation,
  .lobby-sidebar {
    overscroll-behavior: contain;
  }

  /* Message box becomes optional real estate on a small screen — show the
     collapse toggle and let .text-collapsed (set by script.js/lobby.js)
     hide the text row entirely, leaving just the slim controls bar. Sized
     and shaped to match the mic/cam toggle buttons it sits next to. */
  .mobile-only-btn {
    display: inline-flex;
    flex-shrink: 0;
    width: 3.2rem;
    height: 3.2rem;
    justify-content: center;
    border-radius: 50%;
    background-color: #232a38;
    color: #c5cad4;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.08s ease;
  }

  .mobile-only-btn:active {
    transform: scale(0.96);
  }

  .mobile-only-btn.expanded {
    background-color: #5b8def;
    color: #0c1220;
  }

  .composer.text-collapsed .composer-text-row {
    display: none;
  }
}

/* ---- Group Lobbies (public/lobby.html + lobby.js) ----
   A separate page from the 1:1 chat above, but sharing this same
   stylesheet so it stays visually consistent — same dark palette, same
   pill/primary button and chat-bubble/system-message look, just its own
   layout for the create/join entry screen and the multi-person room. */

.brand-subtitle {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 1px solid #242b38;
  font-size: 1.3rem;
  font-weight: 500;
  color: #8b93a5;
}

.lobby-back-link {
  font-size: 1.4rem;
  font-weight: 600;
  color: #8b93a5;
  text-decoration: none;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.lobby-back-link:hover {
  background-color: #1c222e;
  color: #e7eaf0;
}

.lobby-link {
  font-size: 1.3rem;
  font-weight: 600;
  color: #c5cad4;
  text-decoration: none;
  padding: 0.8rem 1.4rem;
  margin-right: 1.2rem;
  border-radius: 999px;
  background-color: #1c222e;
  border: 1px solid #242b38;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lobby-link:hover {
  background-color: #232a38;
  border-color: #2c3444;
}

.lobby-main {
  flex-direction: column;
  align-items: center;
  /* Wide enough to never clip .lobby-room's own (wider) max-width below —
     each screen inside sets its own actual cap (48rem for the entry cards,
     140rem for the room), this is just an outer ceiling so the room can
     actually use a large desktop display instead of being squeezed down to
     whatever the entry screen wants. */
  max-width: 150rem;
  width: 100%;
  padding-top: 3.2rem;
}

/* ---- Disabled state ---- */
.lobby-disabled {
  margin: auto;
  max-width: 44rem;
  text-align: center;
  color: #8b93a5;
}

.lobby-disabled h2 {
  color: #e7eaf0;
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.lobby-disabled p {
  font-size: 1.5rem;
  line-height: 1.5;
}

/* ---- Waiting-for-approval screen (lobby:approvalRequired) ---- */
.lobby-waiting {
  margin: auto;
  width: 100%;
  max-width: 44rem;
}

.lobby-waiting .lobby-card h2 {
  margin-bottom: 0.8rem;
}

.lobby-waiting #lobby-waiting-cancel-btn {
  margin-right: 0;
}

/* ---- Entry screen (create / join) ---- */
.lobby-entry {
  width: 100%;
  max-width: 48rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.lobby-card {
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 14px;
  padding: 2.4rem;
  text-align: center;
}

.lobby-card h2 {
  font-size: 1.9rem;
  color: #f2f4f8;
  margin-bottom: 0.8rem;
}

.lobby-hint {
  font-size: 1.4rem;
  line-height: 1.5;
  color: #8b93a5;
  margin-bottom: 1.8rem;
}

.lobby-divider {
  display: flex;
  align-items: center;
  margin: 2rem 0;
  color: #5b6272;
  font-size: 1.3rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lobby-divider::before,
.lobby-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: #242b38;
}

.lobby-divider span {
  padding: 0 1.4rem;
}

.lobby-join-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.lobby-code-input {
  flex: 1;
  min-width: 0;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 999px;
  color: #e7eaf0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  padding: 1.1rem 1.4rem;
}

.lobby-code-input::placeholder {
  color: #5b6272;
  letter-spacing: 0.1em;
}

.lobby-code-input:focus {
  outline: none;
  border-color: #5b8def;
}

/* Optional second field, only relevant for a lobby that has the passcode
   gate turned on — forced onto its own full-width line below the code
   input + Join button via flex-wrap on .lobby-join-form, rather than
   competing with them for space on one row. */
.lobby-passcode-input {
  flex-basis: 100%;
  min-width: 0;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 10px;
  color: #e7eaf0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.2rem;
  padding: 0.9rem 1.1rem;
}

.lobby-passcode-input::placeholder {
  color: #5b6272;
}

.lobby-passcode-input:focus {
  outline: none;
  border-color: #5b8def;
}

.lobby-entry .lobby-hint {
  margin-bottom: 1.4rem;
}

#lobby-entry-error {
  margin-top: 1.8rem;
  text-align: center;
}

/* ---- Name field (entry screen, shared by Create and Join) ---- */
.lobby-name-card {
  text-align: left;
  padding: 1.6rem 2rem;
}

.lobby-name-label {
  display: block;
  font-size: 1.3rem;
  font-weight: 600;
  color: #8b93a5;
  margin-bottom: 0.8rem;
}

.lobby-name-input {
  width: 100%;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 10px;
  color: #e7eaf0;
  font-size: 1.5rem;
  padding: 1rem 1.2rem;
}

.lobby-name-input::placeholder {
  color: #5b6272;
}

.lobby-name-input:focus {
  outline: none;
  border-color: #5b8def;
}

.lobby-prejoin-mute-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.2rem;
  font-size: 1.3rem;
  color: #c7cddb;
  cursor: pointer;
}

.lobby-prejoin-mute-label input[type="checkbox"] {
  width: 1.6rem;
  height: 1.6rem;
  accent-color: #5b8def;
  cursor: pointer;
}

/* ---- Active lobby room ---- */
.lobby-room {
  width: 100%;
  max-width: 140rem;
  height: calc(100vh - 12rem);
  display: flex;
  flex-direction: column;
}

.lobby-room-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1.6rem;
}

.lobby-main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---- Participant sidebar ---- */
.lobby-sidebar {
  flex-shrink: 0;
  width: 21rem;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 14px;
  padding: 1.6rem;
  overflow-y: auto;
}

.lobby-sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.lobby-sidebar-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #8b93a5;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Both mobile-only (see the "App-like mobile treatment" media query and
   the bottom-sheet .lobby-sidebar rules further down) — the sidebar is
   just always visible in its own column on desktop, nothing to toggle. */
.lobby-sidebar-toggle-btn,
.lobby-sidebar-close-btn {
  display: none;
}

.lobby-sidebar-backdrop {
  display: none;
}

/* Owner-only passcode gate panel — sits above the mute-all button (which a
   Host can also see) and gets its own bottom border to visually separate
   "settings only the Owner controls" from moderation any moderator can
   use. */
.lobby-passcode-panel {
  margin: 0 0 1.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #242b38;
}

.lobby-passcode-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.3rem;
  color: #c7cddb;
  cursor: pointer;
}

.lobby-passcode-toggle-label input[type="checkbox"] {
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
}

/* The sidebar is only 21rem wide — nowhere near enough for a 128-character
   value plus two buttons on one line — so this stacks: the (ellipsis-
   truncated, full value always in the Copy button either way) value on its
   own row, then Copy/New passcode sharing the row below it. */
.lobby-passcode-value-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.lobby-passcode-value-buttons {
  display: flex;
  gap: 0.5rem;
}

.lobby-passcode-value-buttons .pill-btn {
  flex: 1;
  margin-right: 0;
  text-align: center;
}

/* Never meant to be read character-by-character (it's 128 random
   characters, copy-pasted or not at all) — ellipsis-truncated so it doesn't
   blow out the sidebar's width, with the full value always available via
   the Copy button right below it. */
.lobby-passcode-value {
  width: 100%;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 8px;
  color: #8b93a5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.1rem;
  padding: 0.6rem 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Owner-only max-participants panel — same "settings only the Owner
   controls" treatment as the passcode panel above (bottom border
   separator), but a plain number input + "Set" button fits on one row
   fine even in the 21rem sidebar, unlike the 128-char passcode value. */
.lobby-maxmembers-panel {
  margin: 0 0 1.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #242b38;
}

.lobby-maxmembers-label {
  display: block;
  font-size: 1.3rem;
  color: #c7cddb;
  margin-bottom: 0.7rem;
}

.lobby-maxmembers-row {
  display: flex;
  gap: 0.5rem;
}

.lobby-maxmembers-input {
  flex: 1;
  min-width: 0;
  background-color: #10131a;
  border: 1px solid #242b38;
  border-radius: 8px;
  color: #e7eaf2;
  font-size: 1.1rem;
  padding: 0.6rem 0.8rem;
}

.lobby-maxmembers-input:focus {
  outline: none;
  border-color: #4a7dff;
}

.lobby-maxmembers-row .pill-btn {
  margin-right: 0;
  white-space: nowrap;
}

/* Owner-only "require host approval" toggle — same bordered-section
   treatment as the passcode/max-participants panels above it, and reuses
   their checkbox-label styling as-is (.lobby-passcode-toggle-label). */
.lobby-approval-panel {
  margin: 0 0 1.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #242b38;
}

#lobby-muteall-btn {
  width: 100%;
  margin: 0 0 1.2rem;
  border-radius: 8px;
  text-align: center;
}

.lobby-muteall-banner {
  color: #f2b84b;
  background-color: #241d10;
  border: 1px solid #4a3c1f;
  border-radius: 8px;
  font-size: 1.2rem;
  padding: 0.8rem 1rem;
  margin: 0 0 1.2rem;
}

.lobby-participant-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.lobby-participant-group-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #5b6272;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
}

.lobby-participant-group-label:first-child {
  margin-top: 0;
}

.lobby-participant {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.4rem;
  color: #e7eaf0;
}

.lobby-participant-name {
  flex: 1;
  min-width: 4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-mic-badge {
  flex-shrink: 0;
  color: #5b8def;
  font-size: 1.1rem;
}

.lobby-camera-badge {
  flex-shrink: 0;
  color: #5fd88a;
  font-size: 1rem;
}

.lobby-host-badge {
  flex-shrink: 0;
  color: #f2b84b;
  border: 1px solid #4a3c1f;
  background-color: #241d10;
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lobby-muted-badge {
  flex-shrink: 0;
  color: #f27272;
  border: 1px solid #4a2222;
  background-color: #241313;
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* A row with moderator actions available (right-click for a menu) gets a
   context-menu cursor as an extra hint on top of the "..." button below. */
.lobby-participant-actionable {
  cursor: context-menu;
}

/* Tappable "..." affordance for a row's action menu — the only way to
   reach it on a touchscreen (no right-click there), and a clearer, more
   discoverable trigger than right-click alone on desktop too. */
.lobby-participant-menu-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  margin: -0.4rem -0.3rem -0.4rem 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #8a91a3;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lobby-participant-menu-btn:hover,
.lobby-participant-menu-btn:focus-visible {
  background-color: #2c3444;
  color: #e7eaf0;
  outline: none;
}

/* A row in the "Join requests" group at the top of the sidebar (see
   renderSidebar()/buildPendingJoinRow() in lobby.js) — visible only to the
   Owner/Host the server actually sent pendingJoinRequests to, everyone else
   just never has anything in that list. Plain inline Allow/Deny rather than
   the right-click/"..." context menu the real participant rows use below —
   this isn't a menu of several actions on an existing member, just two
   direct choices on someone not in the lobby yet. */
.lobby-pending-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
}

.lobby-pending-btn {
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lobby-pending-allow-btn {
  background-color: #16301f;
  color: #5fd88a;
}

.lobby-pending-allow-btn:hover {
  background-color: #1c3e28;
}

.lobby-pending-deny-btn {
  background-color: #3a2325;
  color: #e2685c;
}

.lobby-pending-deny-btn:hover {
  background-color: #472a2c;
}

.lobby-pending-btn:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

/* Right-click menu for a participant row — see showContextMenu() in
   lobby.js. Positioned with inline top/left, clamped to the viewport. */
.lobby-context-menu {
  position: fixed;
  z-index: 50;
  list-style: none;
  min-width: 14rem;
  background-color: #1c2230;
  border: 1px solid #2e3644;
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.lobby-context-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #e7eaf0;
  font-size: 1.3rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
}

.lobby-context-menu-item:hover,
.lobby-context-menu-item:focus-visible {
  background-color: #2c3444;
  outline: none;
}

.lobby-context-menu-item:disabled {
  opacity: 0.5;
  cursor: default;
  background: transparent;
}

.lobby-context-menu-item.danger {
  color: #e2685c;
}

/* ---- Mic/cam mesh video grid ---- */
.lobby-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.lobby-video-grid.hide {
  display: none;
}

.lobby-video-tile {
  position: relative;
  background-color: #05070a;
  border: 1px solid #242b38;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.lobby-video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lobby-video-label {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  background-color: rgba(5, 7, 10, 0.7);
  color: #f2f4f8;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
}

/* "Hide this video" per-tile menu — same "..." pattern as the sidebar's
   per-participant menu button, just sitting over a video tile instead of a
   list row. See buildVideoTileActions()/MAIN_VIDEO_CAP in lobby.js. */
.lobby-video-menu-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  background-color: rgba(5, 7, 10, 0.55);
  border: none;
  border-radius: 6px;
  color: #f2f4f8;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.lobby-video-menu-btn:hover,
.lobby-video-menu-btn:focus-visible {
  background-color: rgba(5, 7, 10, 0.85);
  outline: none;
}

/* The "+N more" tile standing in for everyone past MAIN_VIDEO_CAP — same
   size/shape as a real video tile so it slots into the grid without
   reflowing anything, but dashed and centered instead of showing video. */
.lobby-video-overflow-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0b0e14;
  border: 1px dashed #3a4254;
  border-radius: 10px;
  color: #c7cbd6;
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.lobby-video-overflow-tile:hover,
.lobby-video-overflow-tile:focus-visible {
  border-color: #5a6478;
  color: #f2f4f8;
  outline: none;
}

#lobby-room-error {
  margin-bottom: 1.4rem;
}

.lobby-room-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.4rem;
}

.lobby-room-code {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: #161b24;
  border: 1px solid #242b38;
  border-radius: 999px;
  padding: 0.6rem 0.6rem 0.6rem 1.6rem;
}

.lobby-room-code-label {
  font-size: 1.2rem;
  font-weight: 600;
  color: #8b93a5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lobby-room-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #f2f4f8;
}

.lobby-room-count {
  flex-shrink: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: #8b93a5;
}

.lobby-room-header .lobby-leave-btn,
.lobby-room-header #lobby-leave-btn {
  margin-left: auto;
  margin-right: 0;
}

.lobby-conversation-wrap {
  flex: 1;
  min-height: 0;
  margin-bottom: 1.4rem;
}

.lobby-bubble-label {
  font-size: 1.2rem;
  font-weight: 700;
  color: #5b8def;
  margin-bottom: 0.3rem;
}

/* ---- Lobby typing indicator ----
   A group lobby can have several people typing at once, unlike the 1:1
   chat's single bouncing-dots bubble (.typing-bubble above) — this is an
   actual name-based line instead (see renderTypingIndicator() in lobby.js).
   #lobby-typing-indicator-row is its own fixed row (.typing-indicator-row,
   styled above) between the conversation and the composer, not a row
   appended inside the scrolling conversation, so this just adds the
   caption-like text treatment on top of that shared layout. */
#lobby-typing-indicator-row {
  max-width: 100%;
  color: #6b7385;
  font-size: 1.3rem;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row.other {
  justify-content: flex-start;
}

.bubble.other {
  background-color: #232a38;
  color: #e7eaf0;
  border-bottom-left-radius: 4px;
}

/* ---- Banned state (full-page replacement, see lobby.js) ---- */
.lobby-banned {
  max-width: 44rem;
  margin: 12rem auto 0;
  text-align: center;
  color: #8b93a5;
  padding: 0 2rem;
}

.lobby-banned h2 {
  color: #e2685c;
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.lobby-banned p {
  font-size: 1.5rem;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .lobby-main {
    padding: 2rem 1.6rem;
  }

  .lobby-card {
    padding: 1.8rem;
  }

  .lobby-join-form {
    flex-direction: column;
  }

  .lobby-room {
    height: calc(100vh - 14rem);
  }

  .lobby-room-header {
    flex-wrap: wrap;
  }

  .lobby-room-body {
    flex-direction: column;
  }

  /* Participants as a native-style bottom sheet instead of a permanent
     slice of screen — see lobby-sidebar-toggle-btn/lobby-sidebar-close-btn
     above and openSidebarSheet()/closeSidebarSheet() in lobby.js. Hidden by
     translateY(100%) (not display:none/.hide) so the slide transition has
     something to animate between; JS toggles the "open" class. */
  .lobby-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* Below the context menu / confirm modal (both z-index: 50) on purpose
       — kicking or muting someone is done via the "..." menu on a row
       INSIDE this sheet, so that menu (and the confirm modal a Kick opens)
       both need to land on top of the sheet, not under it. */
    z-index: 45;
    width: auto;
    max-height: 75vh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    padding: 1.6rem 1.6rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }

  .lobby-sidebar.open {
    transform: translateY(0);
  }

  .lobby-sidebar-toggle-btn,
  .lobby-sidebar-close-btn {
    display: inline-flex;
  }

  .lobby-sidebar-close-btn {
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #8a91a3;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
  }

  .lobby-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background-color: rgba(6, 8, 12, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .lobby-sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .lobby-video-grid {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  }

  .brand-subtitle {
    display: none;
  }
}
