/* ============================================================
   09-multiplayer-lobby.css
   Safe-first extraction from style.css
   Owns: lobby shell, waiting room, host options, lobby search/comms sidecars
   ============================================================ */


/* ===== extracted: lobby-minibar-block ===== */

/* ========================================================================
   MP LOBBY MINIMIZED BAR (docked next to ToolbarHUD)
   Shown when a minigame launches from a lobby.
========================================================================= */

#lobby-minibar,
.lobby-minibar {
  position: fixed;
  z-index: 9999;
  width: 340px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 26, 0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color: #fff;
  user-select: none;
}

.lobby-minibar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.lobby-minibar-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.4px;
  opacity: 0.95;
  white-space: nowrap;
}

.lobby-minibar-status {
  flex: 1;
  font-size: 12px;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-minibar-btn {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.lobby-minibar-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}


/* ===== extracted: lobby-foundation-block ===== */

/* ============================================================
   MULTIPLAYER LOBBY PANEL (Supabase + WebRTC)
   ============================================================ */

#lobby-panel {
  width: 1160px;
  height: 740px;
  max-width: min(1160px, calc(var(--app-authored-width) - 24px));
  max-height: min(740px, calc(var(--app-authored-height) - 24px));
  min-width: 0;
  min-height: 0;
  z-index: 9000;
  overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */

.lp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #0d1c2b;
  border-bottom: 2px solid #2a3d57;
}

.lp-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-connline {
  font-size: 12px;
  opacity: 0.85;
  letter-spacing: 0.2px;
}

.lp-connsep {
  margin: 0 6px;
  opacity: 0.65;
}

.lp-title {
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 1px;
}

.lp-close,
#lp-close-btn {
  width: 30px;
  height: 30px;
  background: #2b3e55;
  border: 1px solid #3e587b;
  color: #eee;
  font-size: 18px;
  border-radius: 6px;
  cursor: pointer;
}

/* ============================================================
   BODY LAYOUT
   ============================================================ */

.lp-wrapper {
  display: flex;
  height: calc(100% - 50px);
}

/* ============================================================
   LEFT PANEL — Players + Waiting Room + Footer
   ============================================================ */

.lp-left {
  /* Give the game grid more horizontal space */
  width: 32%;
  padding: 12px;
  border-right: 2px solid #2d435f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lp-section-title {
  font-size: 20px;
  margin-bottom: 10px;
  font-weight: bold;
}

/* Scrollable player list */
#lp-player-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

/* Player row */
.lp-player-row {
  display: flex;
  align-items: center;
  background: #162636;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #2f4560;
}

.lp-player-name {
  font-size: 17px;
  font-weight: bold;
}

/* Chao dropdown */
.lobby-chao-select {
  padding: 3px 4px;
  background: #0e1a29;
  border: 1px solid #37506b;
  color: #fff;
  border-radius: 4px;
  margin-left: 10px;
}

/* ============================================================
   WAITING ROOM (NEW)
   ============================================================ */

.lp-waiting-room {
  margin-top: 12px;
}

.lp-wr-chat-row {
  margin-top: 12px;
  display: flex;
  gap: 12px;
}

.lp-waiting-room-embed {
  margin-top: 0;
  flex: 0 0 calc(60% + 25px);
}

/* When chat is moved to the right column, let Waiting Room take full row width.
   Same flex owner also applies to the live scroll/fill columns below. */
.lp-waiting-room-full,
.lp-chat-embed {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.lp-chat-log {
  flex: 1;
  height: 220px;
  background: #0c1a28;
  border: 2px solid #2f4560;
  border-radius: 10px;
  overflow-y: auto;
  padding: 8px;
}

.lp-chat-input-row {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

.lp-chat-input {
  flex: 1;
  padding: 6px 8px;
  background: #0e1a29;
  border: 1px solid #37506b;
  color: #fff;
  border-radius: 6px;
}

.lp-chat-send {
  padding: 6px 10px;
  background: #2b3e55;
  border: 1px solid #3e587b;
  color: #eee;
  border-radius: 6px;
  cursor: pointer;
}

.lpchat-row {
  border-bottom: 1px solid #2d435f;
  padding: 6px 0;
}

.lpchat-author {
  font-weight: bold;
  font-size: 14px;
}

.lpchat-content {
  font-size: 14px;
  margin-top: 2px;
  word-break: break-word;
}

.lpchat-time {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

.lp-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lp-joinable-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  opacity: 0.9;
  user-select: none;
}

.lp-joinable-wrap input {
  transform: scale(1.1);
  cursor: pointer;
}

.lp-header-btn {
  padding: 6px 10px;
  background: #2b3e55;
  border: 1px solid #3e587b;
  color: #eee;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.lp-header-btn:hover {
  filter: brightness(1.15);
}

.waiting-room-stage {
  position: relative;
  width: 100%;
  height: 220px;
  background: #0c1a28;
  border: 2px solid #2f4560;
  border-radius: 10px;
  overflow: hidden;
}

/* Render-only Chao inside Waiting Room */
.waiting-room-chao {
  position: absolute;
  pointer-events: none;
  image-rendering: pixelated;
}

.lp-waiting-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.lp-countdown {
  font-weight: bold;
  font-size: 18px;
  color: #ffd60a;
  min-width: 48px;
  text-align: right;
}

/* ============================================================
   LEFT FOOTER (ANCHOR BOTTOM-LEFT)
   ============================================================ */

.lp-left-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #2d435f;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================
   RIGHT PANEL — Game Selection
   ============================================================ */

.lp-right {
  width: 68%;
  padding: 12px;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.lp-game-list {
  display: grid;
  /* 6x4 (six columns, four rows) */
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, auto);
  grid-auto-flow: row;
  gap: 12px;
  align-items: start;
  /* keep the tile grid compact so chat can fill the remaining space */
  flex: 0 0 auto;
  margin-bottom: 10px;
}

/* Chat embedded in the right column should expand to fill remaining height */
.lp-chat-right {
  flex: 1 1 auto;
  min-height: 0;
}

.lp-chat-right .lp-chat-log {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}

/* ============================================================
   GAME BANNERS
   ============================================================ */

.lp-game-banner {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 72px;
  cursor: pointer;
  border: 2px solid #333;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
}

.lp-game-banner:hover {
  filter: brightness(1.15);
  border-color: #ffd45e;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  image-rendering: pixelated;
}

/* Vote pucks */
.vote-pucks {
  position: absolute;
  right: 8px;
  top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: calc(100% - 16px);
}

.vote-puck {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #eee;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* ============================================================
   TIE HIGHLIGHT
   ============================================================ */

.lp-game-banner.tied {
  animation: tiePulse 0.8s infinite alternate;
  border-color: #ffb347 !important;
}

/* ============================================================
   HOST OPTIONS (MP LOBBY)
   ============================================================ */

.lp-host-opts {
  border: 1px solid #2b2b2b;
  background: rgba(0,0,0,0.35);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.lp-host-opts-header {
  font-variant: all-small-caps;
  letter-spacing: 0.5px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.lp-host-opts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
}

.lp-host-opts-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  background: #151515;
  color: #fff;
  cursor: pointer;
}

.lp-host-opts-btn:hover {
  border-color: #ffd45e;
  filter: brightness(1.1);
}

.lp-host-opts-hint {
  font-size: 11px;
  opacity: 0.75;
}

.lp-host-opts-select {
  background: #151515;
  color: #fff;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 3px 6px;
}

.lp-host-opts-subheader {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 10px;
  margin-bottom: 6px;
}

.lp-host-opts-pool {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin-bottom: 8px;
}

.lp-host-opts-pool-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  opacity: 0.9;
}

/* MP Lobby host options compact/scrollable so chat remains visible */
#lobby-panel .lp-right {
  gap: 8px;
}

#lobby-panel .lp-host-opts {
  flex: 0 0 auto;
  max-height: 190px;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  margin-bottom: 0;
}

#lobby-panel .lp-host-opts-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(12, 22, 32, 0.96);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

#lobby-panel .lp-host-opts-row {
  margin: 4px 0;
  gap: 8px;
}

#lobby-panel .lp-host-opts-subheader {
  margin-top: 6px;
  margin-bottom: 4px;
}

#lobby-panel .lp-host-opts-hint {
  font-size: 10px;
  line-height: 1.25;
}

#lobby-panel .lp-host-opts-pool {
  max-height: 92px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 6px;
}

#lobby-panel .lp-chat-right {
  min-height: 220px;
}

#lobby-panel .lp-chat-right .lp-chat-log {
  min-height: 150px;
}

/* Voting disabled state */
.lp-game-banner.lp-voting-disabled {
  cursor: default;
  opacity: 0.95;
}

.lp-game-banner.lp-selected {
  border-color: #ffd45e !important;
  box-shadow: 0 0 10px rgba(255,212,94,0.25);
}

@keyframes tiePulse {
  from { box-shadow: 0 0 6px #ffb347; }
  to   { box-shadow: 0 0 14px #ffce7d; }
}

/* ============================================================
   START BUTTON (INLINE, HOST ONLY)
   ============================================================ */

.lp-start-btn,
#lp-start-btn {
  font-size: 14px;
  padding: 6px 12px;
  background: #3d79ff;
  color: #fff;
  border-radius: 6px;
  border: 1px solid #2c62dd;
  cursor: pointer;
  width: auto;
}

#lp-start-btn:hover,
#mpip-accept:hover,
.mpc-btn:hover {
  background: #538aff;
}

/* ============================================================
   GUEST MESSAGE
   ============================================================ */

.lp-guest-msg,
#lp-guest-msg {
  margin-top: 12px;
  color: #d0e1ff;
  font-size: 16px;
  text-align: center;
}

/* ============================================================
   FOOTER BUTTONS
   ============================================================ */

.lp-invite-btn,
#lp-invite-btn {
  width: 100%;
  padding: 8px;
  background: #2f3338;
  border: 1px solid #4a4f55;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
}

.lp-invite-btn:hover {
  background: #3d4248;
}

.lobby-secondary-btn,
#lp-invite-url-btn {
  width: 100%;
  padding: 8px 10px;
  background: #1c2f45;
  border: 1px solid #335070;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  text-align: center;
  transition: 0.13s;
}

#lp-invite-url-btn:hover {
  background: #244564;
}

/* ============================================================
   FRIEND ICON
   ============================================================ */

.lobby-friend-btn {
  width: 16px;
  height: 16px;
  margin-left: 10px;
  image-rendering: pixelated;
  cursor: pointer;
  vertical-align: middle;
}


/* ===== extracted: lobby-fit-cleanup-patch29 ===== */

/* Lobby */
#lobby-panel > .panel-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 10px;
  gap: 10px;
  overflow: hidden;
}

#lobby-panel .lp-topbar,
#matchmake-panel > .panel-header > .panel-header-controls,
#lobby-search-panel > .panel-header > .panel-header-controls,
#mp-connect-modal > .panel-header > .panel-header-controls,
#mp-chat-panel > .panel-header > .panel-header-controls,
#dm-panel > .panel-header > .panel-header-controls,
#music-tracklist-panel > .panel-header > .panel-header-controls,
#music-tracklist-footer,
#mp-chat-panel .mpchat-input-row,
#dm-panel .dm-input-row,
#lobby-panel #lp-copy-url-btn,
#lobby-panel #lp-host-options-btn,

#lobby-panel .lp-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#lobby-panel .lp-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
}

#lobby-panel .lp-game-list {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

#lobby-panel .waiting-room-stage,
#lobby-panel #lp-waiting-room-stage {
  min-height: 180px;
  height: 100%;
}


/* ===== extracted: lobby-search-size-patch33 ===== */

#lobby-search-panel.panel {
  width: 940px;
  height: 540px;
  max-width: min(940px, calc(var(--app-authored-width) - 24px));
  max-height: min(540px, calc(var(--app-authored-height) - 24px));
}

/* ===== extracted: multiplayer-root-z-and-invite-popup ===== */


#matchmake-panel.panel,
#lobby-search-panel.panel,
#shared-garden-panel,
#mp-connect-modal { z-index: 9050; }


#lobby-panel { z-index: 9000; }

#mp-invite-popup { 
  display: none;
  z-index: 99999;
  position: absolute;
  background: rgba(20,28,40,0.97);
  border: 3px solid #3a4f69;
  border-radius: 12px;
  padding: 0;
}


/* ===== extracted: multiplayer-comms-search-authority ===== */

/* ============================================================
   Display pass patch51 — comms/search/help sidecard authority cleanup
   Purpose: prune duplicated lobby-search leftovers and pin the remaining
   communication/search/help/music utility panels under one late contract.
   ============================================================ */

#matchmake-panel.panel,
#lobby-search-panel.panel,
#mp-connect-modal,
#mp-chat-panel,
#music-tracklist-panel.panel {
  min-width: 0;
}

#matchmake-panel > .panel-header,
#lobby-search-panel > .panel-header,
#mp-connect-modal > .panel-header,
#mp-chat-panel > .panel-header,
#dm-panel > .panel-header,
#music-tracklist-panel > .panel-header {
  min-width: 0;
  flex: 0 0 auto;
}

#matchmake-panel > .panel-header > .panel-title,
#lobby-search-panel > .panel-header > .panel-title,
#mp-connect-modal > .panel-header > .panel-title,
#mp-chat-panel > .panel-header > .panel-title,
#dm-panel > .panel-header > .panel-title,
#music-tracklist-panel > .panel-header > .panel-title {
  min-width: 0;
}


#matchmake-panel > .panel-body.matchmake-body,
#lobby-search-panel > .panel-body.lsp-body,
#mp-connect-modal > .panel-body.mpc-body,
#mp-chat-panel > .panel-body.mpchat-panel-body,
#dm-panel > .panel-body.dm-body,
#music-tracklist-panel > .panel-body {
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  padding: 12px;
}

#matchmake-panel > .panel-body.matchmake-body,
#lobby-search-panel > .panel-body.lsp-body,
#mp-chat-panel > .panel-body.mpchat-panel-body,
#dm-panel > .panel-body.dm-body,
#music-tracklist-panel > .panel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

#lobby-search-panel > .panel-body.lsp-body {
  height: auto !important;
  overflow: hidden;
}

#matchmake-panel .matchmake-topbar,
#matchmake-panel .matchmake-grid,
#matchmake-panel .matchmake-left,
#matchmake-panel .matchmake-right,
#lobby-search-panel .lsp-results,
#lobby-search-panel .lsp-grid,
#lobby-search-panel .lsp-filters,
#mp-chat-panel .mpchat-log,
#mp-chat-panel .mpchat-input-row,
#dm-panel .dm-input-row,
#music-tracklist-body,
#music-tracklist-footer {
  min-width: 0;
  min-height: 0;
}

#music-tracklist-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#matchmake-panel .matchmake-right,
#lobby-search-panel .lsp-grid,
#mp-connect-modal > .panel-body.mpc-body,
#mp-chat-panel .mpchat-log,
#music-tracklist-body {
  overflow: auto;
  scrollbar-gutter: stable;
  padding-right: 4px;
}

#lobby-search-panel .lsp-results,
#lobby-search-panel .lsp-filters,
#mp-chat-panel .mpchat-log,
#music-tracklist-body {
  flex: 1 1 auto;
}



/* ===== extracted: lobby-host-options-stage-restyle ===== */

#lobby-panel .lp-waiting-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#lobby-panel .lp-waiting-room-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#lobby-panel .lp-waiting-room-titlebar .lp-section-title {
  margin-bottom: 0;
}


#host-options-panel {
  width: 980px;
  height: 700px;
  max-width: min(980px, calc(var(--app-authored-width) - 24px));
  max-height: min(700px, calc(var(--app-authored-height) - 24px));
}

#host-options-panel > .panel-header {
  flex: 0 0 auto;
}

#host-options-panel > .panel-header > .panel-header-controls {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex !important;
  align-items: center;
  gap: 12px;
  z-index: 2;
  pointer-events: auto;
}

#host-options-panel > .panel-header > .panel-header-controls .panel-pin-btn,
#host-options-panel > .panel-header > .panel-header-controls .panel-close-x {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

#host-options-panel > .panel-body.host-options-panel-body {
  width: 100%;
  height: calc(100% - var(--panel-header-h, 34px));
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

#host-options-panel #lp-host-opts {
  display: flex !important;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

#host-options-panel #lp-joinable-wrap {
  display: flex;
}

#host-options-panel .lp-host-opts {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  border-radius: 18px;
  border: 1px solid rgba(110, 149, 190, 0.24);
  background: linear-gradient(180deg, rgba(17, 26, 40, 0.96), rgba(10, 15, 24, 0.97));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
}

#host-options-panel .lp-host-opts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 10px;
  flex: 0 0 auto;
  align-items: start;
  width: 100%;
}

#host-options-panel .lp-host-opts-section {
  border-radius: 16px;
  border: 1px solid rgba(110, 149, 190, 0.18);
  background: linear-gradient(180deg, rgba(23, 35, 53, 0.92), rgba(12, 20, 31, 0.94));
  padding: 10px;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

#host-options-panel .lp-host-opts-section-pool {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

#host-options-panel .lp-host-opts-subheader {
  margin: 0 0 10px 0;
  color: #dceafb;
  font-size: 12px;
  letter-spacing: 1.15px;
  text-transform: uppercase;
}

#host-options-panel .lp-host-opts-row {
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#host-options-panel .lp-host-opts-row:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

#host-options-panel .lp-host-opts-row-stack-sm {
  align-items: flex-start;
  flex-direction: column;
}

#host-options-panel .lp-host-opts-row-label {
  font-size: 12px;
  opacity: 0.9;
  min-width: 0;
  color: #d0e1f4;
}

#host-options-panel .lp-host-opts-inline-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

#host-options-panel .lp-host-opts-select-sm {
  width: 110px;
}

#host-options-panel .lp-host-opts-hint-block {
  margin-top: 2px;
  line-height: 1.3;
  color: #d0e1f4;
}

#host-options-panel .lp-host-opts-hint {
  color: #d0e1f4;
}

#host-options-panel button,
#host-options-panel select,
#host-options-panel input[type="text"],
#host-options-panel input[type="number"],
#lobby-panel button,
#lobby-panel select,
#lobby-panel input[type="text"] {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(117, 156, 198, 0.26);
  background: linear-gradient(180deg, rgba(35, 50, 72, 0.94), rgba(17, 26, 40, 0.96));
  color: #dceafb;
}

#host-options-panel .lp-host-opts-hint {
  display: block;
  line-height: 1.3;
}

#host-options-panel .lp-host-opts-pool {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding: 2px 2px 6px 0;
}

#host-options-panel .lp-host-opts-pool-row {
  gap: 5px;
  font-size: 11px;
  line-height: 1.15;
  min-height: 20px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.04);
}

#host-options-panel .lp-host-opts-pool-row input {
  transform: scale(0.95);
  margin: 0;
}

@media (max-width: 900px) {
  #host-options-panel .lp-host-opts-grid {
    grid-template-columns: 1fr;
  }

  #host-options-panel .lp-host-opts-pool {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ============================================================
   MP Lobby merged waiting-room restyle + sliding game drawer
   ============================================================ */
#lobby-panel {
  width: 1260px;
  height: 780px;
  max-width: min(1260px, calc(var(--app-authored-width) - 24px));
  max-height: min(780px, calc(var(--app-authored-height) - 24px));
}

#lobby-panel > .panel-body {
  padding: 10px;
  overflow: hidden;
}

#lobby-panel .lp-wrapper-stage {
  position: relative;
  display: block;
  height: 100%;
  min-height: 0;
}

#lobby-panel .lp-stage-shell {
  position: relative;
  height: 100%;
  padding-right: 46px;
  min-height: 0;
}

#lobby-panel .lp-waiting-room-stage-full,
#lobby-panel #lp-waiting-room-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 18px;
  border: 2px solid #35506b;
  background:
    linear-gradient(180deg, rgba(10,24,40,0.88), rgba(9,18,30,0.94)),
    linear-gradient(180deg, #1b3a57 0%, #11263b 48%, #0d1827 100%);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

#lobby-panel #lp-waiting-room-chao-container {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#lobby-panel .lp-stage-topbar {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 12px;
  bottom: 72px;
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(260px, 1fr) minmax(300px, 1.1fr);
  align-items: start;
  gap: 12px;
  z-index: 5;
  pointer-events: none;
}

#lobby-panel .lp-stage-controls,
#lobby-panel .lp-stage-choice,
#lobby-panel .lp-player-dock,
#lobby-panel .lp-chat-overlay-left,
#lobby-panel .lp-bottom-chat-strip {
  pointer-events: auto;
}

#lobby-panel .lp-stage-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 18, 30, 0.62);
  border: 1px solid rgba(111, 154, 196, 0.3);
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
  backdrop-filter: blur(2px);
}

#lobby-panel .lp-stage-controls .lp-section-title,
#lobby-panel .lp-player-dock-header {
  margin: 0;
  font-size: 18px;
  line-height: 1;
}

#lobby-panel .lp-stage-choice {
  justify-self: center;
  min-width: 320px;
  max-width: 460px;
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(8, 18, 30, 0.72);
  border: 1px solid rgba(255, 215, 130, 0.28);
  box-shadow: 0 10px 24px rgba(0,0,0,0.34);
  opacity: 0.96;
  appearance: none;
  text-align: left;
  cursor: pointer;
}

#lobby-panel .lp-stage-choice:hover {
  background: rgba(12, 24, 40, 0.82);
}

#lobby-panel .lp-stage-choice:focus-visible {
  outline: 2px solid rgba(255, 214, 86, 0.9);
  outline-offset: 2px;
}

#lobby-panel .lp-stage-choice-banner {
  width: 132px;
  height: 52px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(246,210,140,0.32), rgba(82,47,17,0.52));
  background-size: cover;
  background-position: center;
}

#lobby-panel .lp-stage-choice-text {
  font-size: 18px;
  font-weight: 800;
  color: #ffecbf;
  text-shadow: 0 2px 2px rgba(0,0,0,0.55);
}

#lobby-panel .lp-stage-choice .lp-countdown {
  grid-column: 2;
  text-align: left;
  min-width: 0;
  font-size: 24px;
}

#lobby-panel .lp-player-dock {
  justify-self: end;
  align-self: stretch;
  width: 340px;
  max-width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(8, 18, 30, 0.62);
  border: 1px solid rgba(111, 154, 196, 0.3);
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}

#lobby-panel #lp-player-list {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

#lobby-panel .lp-player-list-footer {
  margin-top: auto;
  padding-top: 8px;
}

#lobby-panel .lp-player-list-footer .lp-invite-btn {
  width: 100%;
}

#lobby-panel .lobby-player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(18, 37, 56, 0.88);
  border: 3px solid rgba(70, 102, 136, 0.95);
  border-radius: 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

#lobby-panel .lobby-player-name {
  min-width: 0;
  font-size: 14px;
}

#lobby-panel .lobby-ready-indicator {
  font-size: 11px;
  font-weight: 800;
}

#lobby-panel .lobby-chao-select,
#lobby-panel .lobby-ready-btn,
#lobby-panel #lp-start-btn {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
}

#lobby-panel .lobby-friend-btn {
  justify-self: end;
  margin-left: 0;
}

#lobby-panel .lp-chat-overlay-left {
  position: absolute;
  left: 14px;
  top: 84px;
  bottom: 72px;
  width: min(350px, calc(100% - 420px));
  z-index: 4;
  display: flex;
}

#lobby-panel .lp-chat-log {
  width: 100%;
  height: 100%;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(5,10,18,0.08), rgba(5,10,18,0.16));
  border: 1px solid rgba(111, 154, 196, 0.22);
  border-radius: 12px;
  overflow-y: auto;
  backdrop-filter: blur(0.5px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#lobby-panel .lpchat-row {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(101, 135, 172, 0.16);
  background: rgba(6, 12, 20, 0.16);
  border-radius: 6px;
  margin-bottom: 4px;
}

#lobby-panel .lp-bottom-chat-strip {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  align-items: center;
}

#lobby-panel .lp-left-footer {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

#lobby-panel .lp-chat-input-row {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 8px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(8, 18, 30, 0.82);
  border: 1px solid rgba(111, 154, 196, 0.3);
  box-shadow: 0 8px 20px rgba(0,0,0,0.26);
}

#lobby-panel .lp-chat-input,
#lobby-panel .lp-chat-send,
#lobby-panel .lp-header-btn,
#lobby-panel .lp-invite-btn {
  min-height: 40px;
}

#lobby-panel .lp-game-drawer {
  position: absolute;
  left: 50%;
  top: 86px;
  width: min(860px, calc(100% - 180px));
  max-height: calc(100% - 172px);
  transform: translate(-50%, -8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  z-index: 7;
  pointer-events: none;
}

#lobby-panel .lp-game-drawer.open {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#lobby-panel .lp-game-drawer.collapsed {
  pointer-events: none;
}

#lobby-panel .lp-game-drawer-tab {
  display: none;
}

#lobby-panel .lp-game-drawer-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10,18,30,0.98), rgba(7,12,20,0.98));
  border: 1px solid rgba(111, 154, 196, 0.3);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  max-height: calc(100% - 4px);
}

#lobby-panel .lp-game-drawer-header {
  font-size: 18px;
  font-weight: 800;
  color: #f3f6fb;
}

#lobby-panel .lp-game-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

#lobby-panel .lp-game-banner {
  min-height: 72px;
}

#lobby-panel .lp-game-banner .banner-img {
  width: 100%;
  height: 72px;
  object-fit: cover;
}

@media (max-width: 1400px) {
  #lobby-panel .lp-stage-topbar {
    grid-template-columns: 1fr 1fr;
  }
  #lobby-panel .lp-stage-choice {
    grid-column: 1 / -1;
    justify-self: center;
  }
  #lobby-panel .lp-player-dock {
    width: 320px;
  }
  #lobby-panel .lp-game-drawer {
    width: min(760px, calc(100% - 120px));
  }
  #lobby-panel .lp-game-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  #lobby-panel .lp-chat-overlay-left {
    width: 280px;
  }
  #lobby-panel .lp-bottom-chat-strip {
    grid-template-columns: 1fr;
  }
  #lobby-panel .lp-left-footer {
    order: 2;
  }
  #lobby-panel .lp-chat-input-row {
    grid-template-columns: 1fr 100px;
  }
}

/* ============================================================
   MP Lobby layout hardening
   Keep the merged interior stable without forcing the panel open.
   ============================================================ */
#lobby-panel.hidden,
#host-options-panel.hidden {
  display: none !important;
}

#lobby-panel:not(.hidden) {
  display: flex !important;
  flex-direction: column !important;
}

#lobby-panel > .panel-header {
  flex: 0 0 auto !important;
}

#lobby-panel > .panel-body {
  display: flex !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
}

#lobby-panel .lp-wrapper-stage {
  position: relative !important;
  display: flex !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
}

#lobby-panel .lp-stage-shell {
  position: relative !important;
  display: block !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: hidden !important;
}

#lobby-panel .lp-waiting-room-stage-full,
#lobby-panel #lp-waiting-room-stage {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 620px !important;
}

#lobby-panel #lp-waiting-room-chao-container {
  position: absolute !important;
  inset: 0 !important;
}


/* ===== extracted: lobby-layered-card-polish ===== */

/* Lobby — stronger layered cards for waiting room UI */
#lobby-panel > .panel-body {
  padding: 12px;
}

#lobby-panel .lp-waiting-room-stage-full,
#lobby-panel #lp-waiting-room-stage {
  border-radius: 22px;
  border-color: rgba(105, 148, 192, 0.45);
  box-shadow:
    0 14px 36px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.02);
}

#lobby-panel .lp-stage-controls,
#lobby-panel .lp-player-dock,
#lobby-panel .lp-chat-input-row,
#lobby-panel .lp-stage-choice,
#lobby-panel .lp-game-drawer-panel {
  border-radius: 18px;
  border: 1px solid rgba(122, 164, 206, 0.28);
  background: linear-gradient(180deg, rgba(16, 27, 41, 0.8), rgba(9, 16, 27, 0.84));
  box-shadow: 0 10px 24px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(3px);
}

#lobby-panel .lp-player-dock-header,
#lobby-panel .lp-stage-controls .lp-section-title,
#lobby-panel .lp-stage-choice-text,
#lobby-panel .lp-game-drawer-header {
  color: #eef5ff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}

#lobby-panel .lobby-player-row {
  border-width: 2px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 39, 58, 0.94), rgba(14, 24, 37, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

#lobby-panel .lp-chat-log {
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(8, 14, 23, 0.2), rgba(7, 12, 20, 0.32));
}

#lobby-panel .lpchat-row {
  border-radius: 10px;
  background: rgba(8, 14, 24, 0.24);
}

#lobby-panel .lp-stage-choice-banner {
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ========================================================================
   MP LOBBY MINIMIZED BAR (docked next to ToolbarHUD)
   Shown when a minigame launches from a lobby.
========================================================================= */

/* moved from 03-panel-contract.css in pass26: mp invite popup */

/* ============================================================
   MP INVITE POPUP (Guest receives invite)
   ============================================================ */

#mp-invite-popup {
  width: 420px;
  height: 200px;
}

.mpip-header {
  background: #0d1c2b;
  padding: 10px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  border-bottom: 2px solid #2a3d57;
  color: #fff;
}

.mpip-body {
  padding: 14px;
  font-size: 16px;
  color: #fff;
  min-height: 80px;
}

.mpip-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-bottom: 14px;
}

#mpip-accept,
#mpip-decline {
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
  color: #fff;
}

/* Accept */
#mpip-accept {
  background: #3d79ff;
  border: 1px solid #2c62dd;
}


/* Decline */
#mpip-decline {
  background: #8c2f2f;
  border: 1px solid #b44646;
}

#mpip-decline:hover {
  background: #a83b3b;
}


/* extracted from 03-panel-contract.css — pass27 lobby/matchmake fit spill */
/* Lobby */

/* Matchmake */
#matchmake-panel > .panel-body.matchmake-body {
  padding: 12px;
  overflow: hidden;
}

#matchmake-panel .matchmake-status-row {
  flex: 0 0 auto;
  gap: 12px;
}

#matchmake-panel .matchmake-slot {
  min-height: 0;
  min-width: 0;
}

#matchmake-panel .matchmake-right {
  overflow: hidden;
}

#matchmake-panel #mm-waiting-room-slot {
  height: 100%;
  overflow: hidden;
}


/* extracted from 03-panel-contract.css — pass27 lobby-search canonical layer */
/* ============================================================
   Display pass patch33 — remaining setup/results/sidecard canonical layer
   Purpose: neutralize final raw ID-era size leftovers for panels that
   already carry panel-size tokens in index.html.
   ============================================================ */

/* extracted from 03-panel-contract.css — pass27 lobby root spill */
#mp-chat-panel {
  z-index: 9200;
  background: rgba(16, 28, 40, 0.98);
  border: 3px solid #3a4f69;
  border-radius: 12px;
}


/* extracted from styles/03-panel-contract.css — Lobby modal + lobby base family */
/* ============================================================
   MP CONNECT MODAL
   ============================================================ */

#mp-connect-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #0d1c2b;
  border: 2px solid #3a4f69;
  border-radius: 12px;
  padding: 0;
  color: #fff;
  display: none;
  flex-direction: column;
}

.mpc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #122130;
  padding: 10px 14px;
  border-bottom: 1px solid #2a3d57;
}

.mpc-title {
  font-size: 22px;
  font-weight: bold;
}

.mpc-close {
  background: #2b3e55;
  border: 1px solid #3e587b;
  color: #eee;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.mpc-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mpc-btn {
  width: 100%;
  padding: 10px;
  background: #3d79ff;
  border: 1px solid #2c62dd;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
}

.mpc-join-wrap {
  display: flex;
  gap: 8px;
}

.mpc-input {
  flex-grow: 1;
  padding: 8px;
  border: 1px solid #39526d;
  background: #0e1a29;
  color: #fff;
  border-radius: 6px;
}

/* ============================================================
   MULTIPLAYER LOBBY PANEL (Supabase + WebRTC)
   ============================================================ */

/* ============================================================
   HEADER
   ============================================================ */


/* ============================================================
   START BUTTON (INLINE, HOST ONLY)
   ============================================================ */

/* ============================================================
   GUEST MESSAGE
   ============================================================ */

/* ============================================================
   FOOTER BUTTONS
   ============================================================ */

/* ============================================================
   FRIEND ICON
   ============================================================ */

/* extracted from styles/03-panel-contract.css — Lobby search panel family */
/* ============================================================
   LOBBY SEARCH PANEL
============================================================ */
.lsp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: rgba(16,28,40,0.98);
  border-bottom: 2px solid #3a4f69;
}

.lsp-title {
  font-weight: 800;
  font-size: 18px;
}

.lsp-close {
  background: #253a52;
  border: 1px solid #3e587b;
  color: #eee;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}

.lsp-body {
  height: calc(100% - 44px);
  display: flex;
  gap: 10px;
  padding: 10px;
  box-sizing: border-box;
}

.lsp-results {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lsp-results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.lsp-status {
  opacity: 0.75;
  font-size: 12px;
}

.lsp-grid {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-right: 4px;
}

.lsp-card {
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.2);
  padding: 10px;
  box-sizing: border-box;
}

.lsp-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.lsp-host {
  font-weight: 800;
}

.lsp-slots {
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

.lsp-clients {
  margin-top: 8px;
  opacity: 0.9;
  font-size: 12px;
  line-height: 1.3;
  word-break: break-word;
}

.lsp-card-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.lsp-filters {
  flex: 1;
  min-width: 260px;
  border-left: 1px solid rgba(255,255,255,0.12);
  padding-left: 10px;
  box-sizing: border-box;
}

.lsp-field {
  margin-bottom: 10px;
}

.lsp-field label {
  display: block;
  margin-bottom: 4px;
  opacity: 0.9;
  font-size: 12px;
}

.lsp-input {
  width: 100%;
  box-sizing: border-box;
}

.lsp-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.lsp-hint {
  opacity: 0.75;
  font-size: 12px;
  margin-bottom: 10px;
}

.lsp-btn {
  padding: 8px 10px;
  background: #2b3e55;
  border: 1px solid #3e587b;
  color: #eee;
  border-radius: 10px;
  cursor: pointer;
  flex: 1;
}

.lsp-btn.primary {
  background: #2f5a87;
}

.lsp-btn.small {
  padding: 6px 10px;
  flex: 0 0 auto;
}

.lsp-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================
   DEV / TEST PANEL


/* pass12: responsive ownership migrated from 19-panel-fit-helpers.css */
@media (max-width: 1360px), (max-height: 860px) {
  #lobby-panel .lp-wrapper {
    flex-direction: column;
  }

  #matchmake-panel .matchmake-topbar {
    grid-template-columns: 1fr 1fr;
  }

  #matchmake-panel .matchmake-grid {
    grid-template-columns: 1fr;
  }
}
