/* ==========================================================================
   Meetgle start screen (lobby) — v1.9.0
   Colours come from Settings → Meetgle Settings via CSS variables:
   --button-color, --button-hover-color, --button-active-color,
   --extra-btn-color, --extra-btn-text-color
   Typography inherits the site's font so every site in the network matches.
   ========================================================================== */

/* While the lobby is up, the chat UI is kept in the DOM (so sockets, camera
   checks and the original script keep working) but not shown. */
#meetgle-video-container.is-lobby > .video-chat-layout {
  display: none !important;
}
#meetgle-video-container.meetgle-has-lobby {
  position: relative;
}

.meetgle-lobby {
  --ml-bg: #000;
  --ml-text: #fff;
  --ml-muted: rgba(255, 255, 255, 0.64);
  --ml-faint: rgba(255, 255, 255, 0.42);
  --ml-line: rgba(255, 255, 255, 0.14);
  --ml-live: #34d399;

  position: relative;
  flex: 1 1 100%;
  width: 100%;
  min-height: min(760px, calc(100vh - 90px));
  min-height: min(760px, calc(100svh - 90px));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background: var(--ml-bg);
  color: var(--ml-text);
  font-family: inherit;
  text-align: center;
  box-sizing: border-box;
}
.meetgle-lobby *,
.meetgle-lobby *::before,
.meetgle-lobby *::after {
  box-sizing: border-box;
}
.meetgle-lobby[hidden] {
  display: none !important;
}

/* ---- Background: a wall of faces, like a room of live cams ---- */
.meetgle-lobby__mosaic {
  position: absolute;
  inset: -2%;
  z-index: -2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
}
.meetgle-lobby__tile {
  position: relative;
  overflow: hidden;
  background: #0d0d0d;
}
.meetgle-lobby__tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: blur(3px) saturate(0.8) brightness(0.34);
  transform: scale(1.08);
  transition: filter 1.4s ease;
}
/* One tile "comes online" at a time (set by meetgle-lobby.js) */
.meetgle-lobby__tile.is-live img {
  filter: blur(1px) saturate(1) brightness(0.66);
}

.meetgle-lobby__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0.35) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.8) 100%);
}

/* ---- Content column ---- */
.meetgle-lobby__inner {
  position: relative;
  width: 100%;
  max-width: 980px;
  padding: 48px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.meetgle-lobby__live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.3;
  color: var(--ml-muted);
}
.meetgle-lobby__live[hidden] { display: none; }
.meetgle-lobby__live strong {
  color: var(--ml-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.meetgle-lobby__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ml-live);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

/* Headline: main line bright, second line recedes — matches the reference */
.meetgle-lobby .meetgle-lobby__title {
  margin: 0 0 32px;
  padding: 0;
  font-family: inherit;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.04;
  text-transform: none;
  color: var(--ml-text);
  border: 0;
}
.meetgle-lobby__title-main,
.meetgle-lobby__title-sub {
  display: block;
}
.meetgle-lobby__title-main {
  font-size: clamp(30px, 8.2vw, 64px);
}
.meetgle-lobby__title-sub {
  margin-top: 6px;
  font-size: clamp(21px, 5.8vw, 52px);
  color: rgba(255, 255, 255, 0.58);
}

/* ---- Primary action ---- */
.meetgle-lobby__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.meetgle-lobby .meetgle-lobby__start {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: min(100%, 460px);
  min-height: 72px;
  margin: 0;
  padding: 12px 36px 12px 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--button-color) 0%, var(--button-hover-color) 100%);
  background-size: 160% 100%;
  background-position: 0% 50%;
  color: #fff;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  text-transform: none;
  cursor: pointer;
  box-shadow: 0 14px 40px -12px var(--button-color);
  transition: background-position 0.35s ease, transform 0.15s ease, box-shadow 0.35s ease;
}
.meetgle-lobby .meetgle-lobby__start:hover {
  background-position: 100% 50%;
  box-shadow: 0 18px 48px -12px var(--button-hover-color);
}
.meetgle-lobby .meetgle-lobby__start:active {
  transform: scale(0.985);
  background: var(--button-active-color);
}
.meetgle-lobby .meetgle-lobby__start:focus-visible,
.meetgle-lobby .meetgle-lobby__filter:focus-visible,
.meetgle-lobby .meetgle-lobby__extra:focus-visible,
.meetgle-lobby .meetgle-lobby__chip:focus-visible,
.meetgle-lobby__legal a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Overlapping face stack */
.meetgle-lobby__start-label {
  white-space: nowrap;
}
.meetgle-lobby__faces {
  display: inline-flex;
  flex-shrink: 0;
}
.meetgle-lobby__faces img {
  width: 46px;
  height: 46px;
  margin: 0 0 0 -14px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: #222;
  display: block;
}
.meetgle-lobby__faces img:first-child { margin-left: 0; }
.meetgle-lobby__faces--sm img {
  width: 40px;
  height: 40px;
  margin-left: -12px;
  border-color: rgba(0, 0, 0, 0.9);
}

/* Interest button */
.meetgle-lobby .meetgle-lobby__filter {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--ml-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ml-text);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.meetgle-lobby .meetgle-lobby__filter:hover,
.meetgle-lobby .meetgle-lobby__filter[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}
.meetgle-lobby__filter-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--button-color);
  border: 2px solid #000;
  display: none;
}
.meetgle-lobby__filter.has-interest .meetgle-lobby__filter-dot { display: block; }

/* Interest panel */
.meetgle-lobby__interests {
  width: 100%;
  max-width: 560px;
  margin: 18px 0 0;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--ml-line);
  background: rgba(12, 12, 12, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  text-align: left;
}
.meetgle-lobby__interests[hidden] { display: none; }
.meetgle-lobby__interests-head {
  margin: 0 0 12px 4px;
  font-size: 14px;
  color: var(--ml-muted);
}
.meetgle-lobby__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 176px;
  overflow-y: auto;
  padding: 2px;
}
.meetgle-lobby .meetgle-lobby__chip {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ml-line);
  background: transparent;
  color: var(--ml-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.meetgle-lobby .meetgle-lobby__chip:hover {
  border-color: rgba(255, 255, 255, 0.4);
}
.meetgle-lobby .meetgle-lobby__chip[aria-pressed="true"] {
  background: var(--button-color);
  border-color: var(--button-color);
  color: #fff;
}

/* ---- Extra (custom link) card ---- */
.meetgle-lobby .meetgle-lobby__extra {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 640px;
  margin: 56px 0 0;
  padding: 14px 14px 14px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border: 1px solid color-mix(in srgb, var(--extra-btn-color) 45%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--extra-btn-color) 16%, transparent), rgba(0, 0, 0, 0.35));
  background-color: rgba(10, 10, 10, 0.72);
  color: var(--ml-text);
  text-decoration: none;
  text-align: left;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.meetgle-lobby .meetgle-lobby__extra:hover {
  border-color: var(--extra-btn-color);
  color: var(--ml-text);
  text-decoration: none;
}
.meetgle-lobby .meetgle-lobby__extra:active { transform: scale(0.99); }
.meetgle-lobby__extra-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.meetgle-lobby__extra-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}
.meetgle-lobby__extra-sub {
  font-size: 14px;
  line-height: 1.3;
  color: var(--ml-muted);
}
.meetgle-lobby__extra-cta {
  flex-shrink: 0;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--extra-btn-color);
  color: var(--extra-btn-text-color);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 28px -10px var(--extra-btn-color);
}

.meetgle-lobby__legal {
  max-width: 460px;
  margin: 28px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ml-faint);
}
.meetgle-lobby .meetgle-lobby__legal a {
  color: var(--ml-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Leaving the lobby ---- */
.meetgle-lobby.is-leaving {
  opacity: 0;
  transition: opacity 0.22s ease;
}

/* ---- Mobile ---- */
@media (max-width: 640px) {
  .meetgle-lobby {
    min-height: calc(100vh - 64px);
    min-height: calc(100svh - 64px);
  }
  .meetgle-lobby__mosaic {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 3px;
  }
  .meetgle-lobby__tile:nth-child(n+13) { display: none; }
  .meetgle-lobby__inner { padding: 36px 16px 24px; }
  .meetgle-lobby .meetgle-lobby__title { margin-bottom: 26px; }
  .meetgle-lobby__actions { gap: 10px; }
  .meetgle-lobby .meetgle-lobby__start {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 62px;
    gap: 12px;
    padding: 10px 22px 10px 10px;
    font-size: 18px;
  }
  .meetgle-lobby__faces img { width: 40px; height: 40px; margin-left: -13px; }
  .meetgle-lobby__start .meetgle-lobby__faces img:nth-child(3) { display: none; }
  .meetgle-lobby .meetgle-lobby__filter { width: 62px; height: 62px; }
  .meetgle-lobby__filter-dot { top: 11px; right: 11px; }
  .meetgle-lobby .meetgle-lobby__extra {
    margin-top: 36px;
    gap: 12px;
    padding: 12px;
    border-radius: 18px;
  }
  .meetgle-lobby__faces--sm img { width: 34px; height: 34px; margin-left: -11px; }
  .meetgle-lobby__extra-title { font-size: 16px; }
  .meetgle-lobby__extra-sub { font-size: 12.5px; }
  .meetgle-lobby__extra-cta { padding: 12px 16px; font-size: 15px; }
}
@media (max-width: 380px) {
  .meetgle-lobby__faces--sm { display: none; }
  .meetgle-lobby__start .meetgle-lobby__faces { display: none; }
  .meetgle-lobby .meetgle-lobby__start { padding-left: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .meetgle-lobby *,
  .meetgle-lobby.is-leaving {
    transition: none !important;
  }
}
