:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body.lg {
  margin: 0;
  min-height: 100%;
  background: #0a0a0c;
  color: #f4f1ea;
  font-family: "Space Grotesk", system-ui, sans-serif;
}
#lg-webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.lg-floats {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.lg-floats img {
  position: absolute;
  opacity: 0.28;
  animation: lg-drift 16s ease-in-out infinite;
}
.lg-floats img:nth-child(1) { width: 140px; top: 8%; left: 6%; animation-duration: 18s; }
.lg-floats img:nth-child(2) { width: 90px; top: 18%; right: 10%; animation-duration: 14s; animation-delay: -3s; }
.lg-floats img:nth-child(3) { width: 220px; bottom: -4%; right: -3%; opacity: 0.16; animation-duration: 22s; }
.lg-floats img:nth-child(4) { width: 110px; bottom: 18%; left: 8%; animation-duration: 15s; animation-delay: -6s; }
.lg-floats img:nth-child(5) { width: 70px; top: 42%; right: 22%; animation-duration: 12s; animation-delay: -2s; }
.lg-floats img:nth-child(6) {
  width: 280px;
  top: 8%;
  right: -40px;
  opacity: 0.12;
  transform: rotate(12deg);
  animation: none;
  mask-image: linear-gradient(90deg, transparent, #000 40%);
}
@keyframes lg-drift {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-18px) rotate(8deg); }
}
.lg-stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem 3rem;
}
.lg-logo {
  width: min(72vw, 320px);
  height: min(72vw, 320px);
  margin-bottom: 0.15rem;
}
.lg-logo img,
.lg-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.lg-kicker {
  margin: 0.35rem 0 0;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #ed2024;
}
.lg-stage h1 {
  margin: 0.2rem 0 1.5rem;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  letter-spacing: -0.05em;
  line-height: 0.92;
}
.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(92vw, 22rem);
  background: #ed2024;
  color: #fff;
  text-decoration: none;
  padding: 1rem 1.4rem;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 18px 40px rgba(237,32,36,.28);
  transition: transform .15s ease, filter .15s ease;
}
.lg-btn:hover { filter: brightness(1.08); transform: translateY(-2px); }
.lg-note {
  margin: 1rem 0 0;
  color: #8a8f98;
  font-size: 0.8rem;
  max-width: 22rem;
}
.lg-err {
  background: rgba(237,32,36,.14);
  border: 1px solid rgba(237,32,36,.45);
  color: #fca5a5;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
  max-width: 26rem;
  font-size: 0.85rem;
  text-align: left;
}
@media (max-width: 700px) {
  .lg-floats img:nth-child(3),
  .lg-floats img:nth-child(6) { display: none; }
  .lg-btn {
    min-height: 3.25rem;
    width: min(92vw, 22rem);
  }
  .lg-stage { padding: 1.25rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
}

/* ── Lobby (room picker) ─────────────────────────────────────────── */
.lg-logo--sm { width: min(28vw, 118px); height: min(28vw, 118px); margin-bottom: 0.2rem; }
.lg-stage--lobby { justify-content: center; }
.lg-rooms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
  width: min(92vw, 44rem);
  margin: 0.75rem 0 1.75rem;
}
.lg-room {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 1.4rem 1.4rem 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #f4f1ea;
  text-decoration: none;
  overflow: hidden;
  text-align: left;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.lg-room:hover {
  transform: translateY(-4px);
  border-color: rgba(237, 32, 36, 0.6);
  box-shadow: 0 22px 48px rgba(237, 32, 36, 0.28);
  background: rgba(237, 32, 36, 0.08);
}
.lg-room-badge {
  position: absolute;
  right: -14px; bottom: -14px;
  width: 96px; height: auto;
  opacity: 0.16;
  pointer-events: none;
  transition: opacity .18s ease, transform .25s ease;
}
.lg-room:hover .lg-room-badge { opacity: 0.34; transform: rotate(-8deg) scale(1.1); }
.lg-room-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.lg-room-sub {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase; color: #8a8f98;
}
.lg-room-go {
  margin-top: 0.65rem;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: #ed2024;
}
.lg-room.is-locked { opacity: 0.5; cursor: not-allowed; }
.lg-room.is-locked:hover {
  transform: none; border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none; background: rgba(255, 255, 255, 0.04);
}
.lg-signout { margin-top: 0.25rem; }
.lg-signout button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #8a8f98;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
}
.lg-signout button:hover { color: #fff; border-color: #fff; }

/* Warp-into-the-room transition */
.lg-warp {
  position: fixed;
  left: var(--wx, 50%); top: var(--wy, 50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: radial-gradient(circle, #ed2024 0%, #b3161a 34%, #0a0a0c 72%);
  z-index: 60; pointer-events: none; opacity: 0;
  transition: transform .72s cubic-bezier(.7, 0, .25, 1), opacity .72s ease;
}
.lg-warp.is-on { transform: translate(-50%, -50%) scale(240); opacity: 1; }
.lg.is-warping .lg-stage {
  transition: transform .72s cubic-bezier(.7, 0, .25, 1), opacity .5s ease;
  transform: scale(1.35);
  opacity: 0;
}
.lg.is-warping .lg-floats { opacity: 0; transition: opacity .4s ease; }
.lg-room.is-launching {
  border-color: rgba(237, 32, 36, 0.9);
  box-shadow: 0 0 60px rgba(237, 32, 36, 0.6);
}
@media (prefers-reduced-motion: reduce) {
  .lg-warp, .lg.is-warping .lg-stage, .lg.is-warping .lg-floats { transition: none; }
}

/* ── Who's in each room (lobby presence) ─────────────────────────── */
.lg-here {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.75rem;
  min-height: 28px;
  flex-wrap: wrap;
}
.lg-here-avs { display: inline-flex; }
.lg-here-av {
  width: 28px; height: 28px;
  border-radius: 50%;
  overflow: hidden;
  margin-left: -8px;
  border: 2px solid #14141a;
  background: #2a2a30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.lg-here-av:first-child { margin-left: 0; }
.lg-here-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lg-here-av b {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.66rem; color: #f4f1ea;
}
.lg-here-av.is-talking {
  border-color: #3ddc84;
  box-shadow: 0 0 0 2px rgba(61, 220, 132, 0.4);
}
.lg-here-more {
  margin-left: 5px;
  align-self: center;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.72rem; color: #8a8f98;
}
.lg-here-label {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.64rem; letter-spacing: 0.05em; text-transform: uppercase; color: #8a8f98;
}
.lg-here-empty {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.64rem; letter-spacing: 0.05em; text-transform: uppercase; color: #6a6f78;
}
