/* Main-screen lobby: a yellow join card on the left, who has joined on the right. No header bar.
   Sizes are stage pixels (1920 wide); the design's vh values use --gtf-stage-h (the stage's height).
   The tile sizes (--lf-*) are set by the lobby-fit Stimulus controller so every player fits on screen;
   the values below are the fallback when it has not run. */

.gtf-screen--lobby .gtf-screen__body {
  zoom: 1;
  inset: 0;
  padding: 32px;
}

.gtf-screen {
  --lf-stage-h: var(--gtf-stage-h, 1080px);
}

.gtf-mslobby {
  display: flex;
  flex-wrap: nowrap;
  gap: 32px;
  height: 100%;
}

/* ---------- The yellow card ---------- */

.gtf-mslobby__card {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 17px;
  width: min(768px, calc(var(--lf-stage-h) - 214px));
  height: 100%;
  min-width: 0;
  padding: 26px;
  overflow: hidden;
  border-radius: var(--gtf-radius-card);
  background: var(--gtf-yellow);
  color: var(--gtf-ink);
}

.gtf-mslobby__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.gtf-mslobby__mark {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: 14px;
  background: var(--gtf-ink);
}

.gtf-mslobby__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gtf-yellow);

  &:nth-child(1) { grid-column: 1; grid-row: 1; }
  &:nth-child(2) { grid-column: 2; grid-row: 2; }
  &:nth-child(3) { grid-column: 3; grid-row: 3; }
}

.gtf-mslobby__brand-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.gtf-mslobby__title {
  font-size: min(54px, calc(var(--lf-stage-h) * 0.05));
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.gtf-mslobby__note {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 700;
  opacity: 0.7;
}

.gtf-mslobby__qr {
  flex: none;
  align-self: center;
  width: min(100%, calc(var(--lf-stage-h) * 0.44));
  aspect-ratio: 1;
  padding: 24px;
  border-radius: 14px;
  background: #fff;
  line-height: 0;

  & svg {
    display: block;
    width: 100%;
    height: 100%;
  }
}

.gtf-mslobby__address {
  font-size: min(30px, calc(var(--lf-stage-h) * 0.03));
  line-height: 1.3;

  & strong { font-weight: 800; }
}

.gtf-mslobby__code {
  margin-top: 4px;
  font-family: var(--gtf-mono);
  font-size: min(113px, calc(var(--lf-stage-h) * 0.105));
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.04em;
}

/* The same card, smaller, for the side column of the up next / break / intermission screens. */
.gtf-mslobby__card--compact {
  width: 100%;
  height: auto;
  justify-content: flex-start;
  gap: 18px;
  padding: 24px;

  & .gtf-mslobby__title { font-size: 40px; }
  & .gtf-mslobby__qr { width: min(100%, 360px); }
  & .gtf-mslobby__address { font-size: 26px; }
  & .gtf-mslobby__code { font-size: 96px; }
}

/* ---------- Who has joined ---------- */

/* Row 1: "N players joined" and the waiting line; row 2: the tile grid takes everything that is left. */
.gtf-mslobby__players {
  --lf-av: 64px;
  --lf-pad: 13px;
  --lf-gap: 12px;
  --lf-cell: 375px;
  --lf-font: 29px;
  --lf-av-font: 23px;
  --lf-inner: 15px;
  flex: 1 1 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  column-gap: 20px;
  row-gap: 22px;
  align-items: baseline;
  min-width: 0;
  height: 100%;
  overflow: hidden;

  & > :first-child { grid-column: 1; grid-row: 1; }
  & > .gtf-mslobby__message { grid-column: 2; grid-row: 1; }
  & > .gtf-mslobby__list { grid-column: 1 / -1; grid-row: 2; align-self: stretch; }
}

.gtf-mslobby__count {
  font-size: min(65px, calc(var(--lf-stage-h) * 0.06));
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.gtf-mslobby__message {
  font-size: min(31px, calc(var(--lf-stage-h) * 0.03));
  font-weight: 400;
  color: var(--gtf-text-2);
}

.gtf-mslobby__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  min-width: 0;
}

.gtf-mslobby__empty {
  font-size: 40px;
  font-weight: 600;
  color: var(--gtf-text-2);
}

/* ---------- The tiles (also used by the night-nested "ready" screens) ---------- */

.gtf-screen-players {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--lf-cell, 375px), 1fr));
  gap: var(--lf-gap, 12px);
  align-content: start;
  min-height: 0;
  overflow: hidden;
}

/* Inside the lobby/ready blocks the grid fills the space under the count and the controller fits it. */
.gtf-mslobby__players .gtf-screen-players,
.gtf-ready__players .gtf-screen-players {
  flex: 1 1 0;
}

.gtf-screen-player {
  display: flex;
  align-items: center;
  gap: var(--lf-inner, 15px);
  min-width: 0;
  padding: var(--lf-pad, 13px) 12px var(--lf-pad, 13px) var(--lf-pad, 13px);
  border-radius: 10px;
  background: var(--gtf-surface-2);

  & .avatar-component {
    width: var(--lf-av, 64px);
    height: var(--lf-av, 64px);
    flex: none;
  }

  & .avatar-component__initials {
    font-size: var(--lf-av-font, 23px);
  }

  &.is-entering {
    animation: gtf-mslobby-in 0.35s ease-out both;
  }
}

.gtf-screen-player__name {
  min-width: 0;
  overflow: hidden;
  font-size: var(--lf-font, 29px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gtf-screen-players__more {
  flex: none;
  font-size: 28px;
  color: var(--gtf-text-2);
}

@keyframes gtf-mslobby-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gtf-screen-player.is-entering { animation: none; }
}

/* ---------- Night-nested "ready" screens: the same count + tiles, fitted beside the message ---------- */

.gtf-ready__players {
  align-self: stretch;
  height: 100%;

  & > .gtf-mslobby__list { flex: 1 1 0; }
}
