/* A compact waiting-room board, sized by the people actually in the room. */
@media (min-width: 851px) and (min-height: 521px) {
  .menu-screen:has(#room-panel:not([hidden])) { --menu-card-width: clamp(360px, 25vw, 400px); }
}
.menu-screen .sidebar:has(#room-panel:not([hidden])) {
  height: auto; max-height: calc(100dvh - var(--menu-card-top) - 82px - env(safe-area-inset-bottom, 0px));
  border: 2px solid #183e34; border-radius: 5px; box-shadow: none;
  background: #f5ebd5; overflow: hidden;
}
.menu-screen #room-panel:not([hidden]) {
  height: auto; max-height: inherit; padding: 0; display: flex; flex-direction: column;
  color: #183e34;
}
.menu-screen #room-panel .lobby-heading {
  position: relative; padding: 18px 22px 19px;
  background: #183e34; color: #f5ebd5; border-bottom: 3px solid #c9a66a;
}
.menu-screen #room-panel .room-topline { position: static; min-height: 24px; gap: 12px; }
.menu-screen #room-panel #room-mode { display: block; margin: 0; font-size: 12px; letter-spacing: .4px; color: #d5d9be; }
.menu-screen #room-panel #leave-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 5px 0 5px 8px; min-height: 32px; color: #f5ebd5; font-size: 12px;
}
.menu-screen #room-panel #leave-button svg { width: 15px; height: 15px; }
.menu-screen #room-panel #room-title {
  margin: 10px 0 11px; padding: 0; color: #fff4d9;
  font-size: 29px; line-height: 1.25; letter-spacing: -.8px; font-weight: 900;
  overflow-wrap: anywhere; text-wrap: pretty;
}
.menu-screen #room-panel #room-rules {
  display: block; margin: 0; padding: 0; border: 0; border-radius: 0; background: none;
  color: #d6d9c2; font-size: 12px; line-height: 1.6; word-break: keep-all;
}
.menu-screen #room-panel .roster-heading {
  width: auto; margin: 0; padding: 20px 22px 12px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 15px; line-height: 20px;
}
.menu-screen #room-panel .roster-heading strong { font-weight: 850; }
.menu-screen #room-panel #player-count { color: #667359; font-size: 12px; font-variant-numeric: tabular-nums; }
.menu-screen #room-panel #player-list {
  display: block; flex: 0 1 auto; min-height: 46px; max-height: 322px;
  margin: 0 14px 14px; padding: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #6f8167 #e8dfc7; touch-action: pan-y;
}
.menu-screen #room-panel #player-list:focus-visible { outline: 2px solid #976a35; outline-offset: -2px; }
.lobby-player-row {
  display: flex; align-items: center; gap: 10px; min-height: 46px;
  padding: 9px 8px; border-bottom: 1px solid #183e3426; font-size: 14px; line-height: 22px;
}
.lobby-player-row:last-child { border-bottom: 0; }
.lobby-player-row.is-self { background: #eadbb4; }
.lobby-player-seat { flex: 0 0 25px; color: #8a7b5d; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lobby-player-name { display: flex; align-items: baseline; gap: 5px; flex: 1; min-width: 0; }
.lobby-player-nickname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #286596; font-weight: 800; }
.lobby-player-name small { flex-shrink: 0; color: #76674c; font-size: 10px; }
.lobby-player-state { flex-shrink: 0; color: #7c7969; font-size: 11px; font-weight: 650; white-space: nowrap; }
.lobby-player-state.is-ready { color: #315e46; }
.lobby-player-state.is-ready::before { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 5px 1px 0; background: #54754e; border-radius: 50%; }
.lobby-player-row.is-offline .lobby-player-nickname { color: #7c8275; }
.menu-screen #room-panel .lobby-invite {
  margin: 0 22px; padding: 13px 0; border-top: 1px solid #bfb99f;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.menu-screen #room-panel .lobby-invite-copy { min-width: 0; }
.menu-screen #room-panel #room-code-label { display: block; margin: 0; color: #52644f; font-size: 11px; font-weight: 750; }
.menu-screen #room-panel #room-hint { display: block; margin: 4px 0 0; max-width: 145px; color: #77806b; font-size: 10px; line-height: 1.5; word-break: keep-all; }
.menu-screen #room-panel #copy-code {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex: 0 0 auto;
  width: auto; min-height: 44px; margin: 0; padding: 4px 0 4px 8px; color: #183e34;
}
.menu-screen #room-panel #copy-code strong { font-size: 20px; line-height: 1; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.menu-screen #room-panel #copy-code svg { width: 15px; height: 15px; }
.menu-screen #room-panel .lobby-copy-label { font-size: 10px; color: #63735b; }
.menu-screen #room-panel .room-bottom { margin: 0; padding: 4px 22px 21px; }
.menu-screen #room-panel #ready-hint { display: block; margin: 0 0 10px; color: #63705a; font-size: 12px; line-height: 1.5; }
.menu-screen #room-panel .room-bottom > .button {
  margin: 0; min-height: 48px; padding: 10px 16px; border: 1px solid #183e34;
  border-radius: 3px; box-shadow: none; font-size: 16px; font-weight: 850;
}
.menu-screen #room-panel .primary { background: #db6645; color: #fff7e5; }
.menu-screen #room-panel .primary:hover:enabled { background: #c55536; }
.menu-screen #room-panel .button:disabled { background: #e1dac6; color: #73806b; border-color: #aab299; opacity: 1; }
.menu-screen #room-panel .button.active-ready { background: #183e34; color: #f5ebd5; }
.menu-screen #room-panel .lobby-heading :focus-visible { outline-color: #f5d488; }

/* On a short landscape screen, code and action share the bottom row. */
@media (max-width: 850px), (max-height: 520px) and (orientation: landscape) {
  .menu-screen .sidebar:has(#room-panel:not([hidden])) {
    max-height: calc(100dvh - var(--menu-card-top) - 16px - env(safe-area-inset-bottom, 0px));
  }
  .menu-screen #room-panel:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1fr) 112px;
    grid-template-rows: auto auto minmax(38px, 1fr) auto; gap: 0;
  }
  .menu-screen #room-panel > * { grid-column: 1 / -1; grid-row: auto; min-width: 0; }
  .menu-screen #room-panel .lobby-heading { padding: 8px 12px 9px; border-bottom-width: 2px; }
  .menu-screen #room-panel .room-topline { min-height: 17px; }
  .menu-screen #room-panel #room-mode { font-size: 10px; line-height: 17px; }
  .menu-screen #room-panel #leave-button { position: absolute; right: 6px; top: 4px; min-height: 44px; min-width: 44px; padding: 0 4px; font-size: 10px; gap: 4px; }
  .menu-screen #room-panel #leave-button svg { width: 13px; height: 13px; }
  .menu-screen #room-panel #room-title {
    font-size: 21px; line-height: 26px; margin: 3px 55px 4px 0; letter-spacing: -.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .menu-screen #room-panel #room-rules { font-size: 10px; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-screen #room-panel .roster-heading { padding: 8px 12px 5px; line-height: 18px; font-size: 12px; }
  .menu-screen #room-panel #player-count { font-size: 10px; }
  .menu-screen #room-panel #player-list { grid-row: 3; margin: 0 6px; min-height: 38px; max-height: 228px; }
  .lobby-player-row { min-height: 38px; padding: 6px; gap: 6px; font-size: 12px; line-height: 25px; }
  .lobby-player-seat { flex-basis: 19px; font-size: 10px; }
  .lobby-player-state { font-size: 10px; }
  .lobby-player-state.is-ready::before { width: 4px; height: 4px; margin-right: 4px; }
  .menu-screen #room-panel .lobby-invite {
    grid-column: 1; grid-row: 4; margin: 0; padding: 8px 6px 8px 12px;
    display: block; border-top: 1px solid #bfb99f;
  }
  .menu-screen #room-panel #room-code-label { font-size: 9px; line-height: 12px; }
  .menu-screen #room-panel #room-hint { display: none; }
  .menu-screen #room-panel #copy-code { min-height: 44px; width: 100%; justify-content: flex-start; gap: 6px; padding: 0; margin-top: -8px; margin-bottom: -5px; }
  .menu-screen #room-panel #copy-code strong { font-size: 17px; letter-spacing: .5px; }
  .menu-screen #room-panel #copy-code svg { width: 13px; height: 13px; }
  .menu-screen #room-panel .lobby-copy-label { display: none; }
  .menu-screen #room-panel .room-bottom { grid-column: 2; grid-row: 4; margin: 0; padding: 8px 8px 8px 0; border-top: 1px solid #bfb99f; }
  .menu-screen #room-panel #ready-hint { display: none; }
  .menu-screen #room-panel .room-bottom > .button { min-height: 44px; height: 44px; justify-content: center; font-size: 12px; line-height: 16px; padding: 5px 7px; }
  .menu-screen #room-panel .room-bottom > .button svg { display: none; }
}
@media (max-height: 350px) and (orientation: landscape) {
  .menu-screen #room-panel .lobby-heading { padding-top: 6px; padding-bottom: 6px; }
  .menu-screen #room-panel .room-topline { min-height: 13px; }
  .menu-screen #room-panel #room-mode { font-size: 9px; line-height: 13px; }
  .menu-screen #room-panel #room-title { font-size: 19px; line-height: 23px; margin-top: 1px; margin-bottom: 2px; }
  .menu-screen #room-panel #room-rules { font-size: 9px; line-height: 13px; }
  .menu-screen #room-panel .roster-heading { padding-top: 4px; padding-bottom: 2px; }
  .menu-screen #room-panel .lobby-player-row { min-height: 32px; padding-top: 4px; padding-bottom: 4px; line-height: 23px; }
  .menu-screen #room-panel .lobby-invite, .menu-screen #room-panel .room-bottom { padding-top: 4px; padding-bottom: 4px; }
}
