/*
 * The lobby on a phone: a fixed row of tabs (Players, You, Invite), one panel
 * at a time, the player list in pages, and Start pinned below or, sideways,
 * in a column at the right. Nothing scrolls. Plan: docs/plans/13-phone-play.md.
 */

/* ---- The lobby on a phone: head, tabs, one panel, and Start pinned below ---- */
.lobby__tabs {
  display: none;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby {
  height: 100dvh;
  overflow: hidden;
  padding: max(var(--space-3), env(safe-area-inset-top))
    max(var(--space-3), env(safe-area-inset-right)) max(var(--space-3), env(safe-area-inset-bottom))
    max(var(--space-3), env(safe-area-inset-left));
  align-content: stretch;
  grid-template-rows: minmax(0, 1fr);
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__frame {
  width: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: var(--space-2);
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__head {
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__head .eyebrow,
:root:is([data-phone='true'], [data-tight='true']) .lobby__notice {
  display: none;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__title {
  font-size: var(--text-lg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__head .row {
  flex-wrap: nowrap;
  gap: 0;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__head .button {
  min-height: var(--target);
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  white-space: nowrap;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__head .row {
  flex: none;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-1);
}

.lobby__tab {
  min-height: var(--target);
  border: 0;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  font: 600 var(--text-sm) / 1 var(--font-mono);
  cursor: pointer;
}

.lobby__tab[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* One panel at a time, filling the room between the tabs and the footer. */
:root:is([data-phone='true'], [data-tight='true']) .lobby__grid,
:root:is([data-phone='true'], [data-tight='true']) .lobby__grid > .stack {
  display: contents;
}

:root:is([data-phone='true'], [data-tight='true']) [data-lobby-panel] {
  grid-row: 3;
  min-height: 0;
  overflow: hidden;
  align-self: stretch;
  align-content: start;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__pager {
  grid-row: 4;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__pager .pager {
  padding: 0;
  background: none;
  box-shadow: none;
}

:root:is([data-phone='true'], [data-tight='true']) [data-lobby-panel][data-active='false'] {
  display: none;
}

:root:is([data-phone='true'], [data-tight='true']) .lobby__foot {
  grid-row: 5;
  gap: var(--space-2);
}

/* Colors six to a row, so each swatch is a full finger wide. */
:root:is([data-phone='true'], [data-tight='true']) .swatches__row {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .swatches__row {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

/* The lobby sideways: Start and its line in a column of their own at the right. */
:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__frame {
  grid-template-columns: minmax(0, 1fr) 14rem;
  column-gap: var(--space-4);
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__frame {
  grid-template-rows: 0 auto minmax(0, 1fr) auto auto;
}

/* Sideways the title gives its row to the panel; the footer line says the same.
   How to play, Settings and Leave sit at the top of the right column. */
:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__head {
  display: contents;
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape']
  .lobby__head
  > div:first-child {
  display: none;
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__head .row {
  grid-column: 2;
  grid-row: 2;
  justify-content: space-between;
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .bots__hint {
  display: none;
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__tabs,
:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] [data-lobby-panel],
:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__pager {
  grid-column: 1;
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .lobby__foot {
  grid-column: 2;
  grid-row: 3 / 6;
  align-self: end;
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] [data-lobby-panel] {
  padding: var(--space-3);
}

:root:is([data-phone='true'], [data-tight='true'])[data-orient='landscape'] .players {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
