/*
 * Online lobby: a paper sheet centred on the page. Private rooms only:
 * create or join by code, share the invite, ready up, start. Copy comes from
 * src/ui/strings.ts.
 */

.lobby-screen {
  position: absolute;
  inset: 0;
  z-index: 75;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: max(20px, var(--safe-top)) max(16px, var(--safe-right))
    max(20px, var(--safe-bottom)) max(16px, var(--safe-left));
  background: var(--pattern), var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

.lobby-screen.is-visible .lobby-panel {
  animation: lobby-in 0.22s var(--ease-out) both;
}

.lobby-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(520px, 100%);
  padding: 30px 32px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--modal);
  box-shadow: var(--shadow-paper);
}

.lobby-title {
  margin: 0;
  font: 400 clamp(30px, 5vw, 40px) / 1 var(--font-display);
}

.lobby-subtitle {
  margin: -4px 0 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.lobby-entry,
.lobby-room {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lobby-entry[hidden],
.lobby-room[hidden],
.lobby-row[hidden],
.lobby-actions[hidden],
.lobby-button[hidden] {
  display: none;
}

.lobby-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lobby-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  color: var(--text);
  font: 400 16px / 1 var(--font-ui);
  letter-spacing: 0.02em;
  text-transform: none;
}

.lobby-input:focus-visible {
  border-color: var(--text);
  outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent);
  outline-offset: 0;
}

.lobby-input::placeholder {
  color: var(--muted);
}

.lobby-input--code {
  font: 400 24px / 1 var(--font-display);
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

.lobby-input[readonly].lobby-input--code {
  border-color: var(--text);
}

.lobby-input--invite {
  color: var(--muted);
  font-size: 13px;
}

.lobby-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.lobby-row .lobby-label {
  flex: 1 1 auto;
  min-width: 0;
}

/* Buttons share the global .btn look; these only size them. */
.lobby-button {
  height: 44px;
  min-width: 96px;
}

.lobby-button--primary {
  background: var(--p-bg);
  box-shadow: none;
  color: var(--p-ink);
}

.lobby-button--danger {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--accent);
  color: var(--accent);
}

.lobby-button--ghost {
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.lobby-choice {
  flex-direction: column;
}

.lobby-choice .lobby-button {
  width: 100%;
  height: 50px;
  font-size: 15px;
}

.lobby-note {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- room */

.lobby-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.lobby-code {
  font: 400 clamp(36px, 7vw, 48px) / 1 var(--font-display);
  letter-spacing: 0.18em;
}

.lobby-role {
  padding: 4px 9px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

.lobby-seats-label {
  margin-top: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lobby-seats {
  display: flex;
  flex-direction: column;
  margin-top: -6px;
}

.lobby-seat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.lobby-seat--you .lobby-seat-name {
  color: var(--accent);
}

.lobby-seat--empty {
  opacity: 0.6;
}

.lobby-initial {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--av3);
  color: var(--av3-ink);
  font: 400 18px / 1 var(--font-display);
}

.lobby-seat:nth-child(2) .lobby-initial {
  background: var(--av1);
  color: #fffdf8;
}

.lobby-seat:nth-child(3) .lobby-initial {
  background: var(--av2);
  color: #fffdf8;
}

.lobby-seat-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lobby-seat-name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-seat-tag {
  color: var(--muted);
  font-size: 12px;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lobby-actions .lobby-button {
  flex: 1 1 auto;
}

/* --------------------------------------------------------------- shared */

.lobby-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.lobby-status:empty {
  display: none;
}

.lobby-error {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.lobby-error:not(.is-visible) {
  display: none;
}

.lobby-footer {
  display: flex;
  justify-content: flex-start;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.lobby-footer .lobby-button {
  min-width: 0;
  padding-left: 0;
}

@keyframes lobby-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .lobby-panel {
    padding: 24px 20px 18px;
  }

  .lobby-row {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lobby-screen.is-visible .lobby-panel {
    animation: none;
  }
}
