/* Private Game panel - SA-2026.08.23.38 */
.private-game-dialog,
.private-host-dialog {
  position: fixed !important;
  inset: 50% auto auto 50% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translate(-50%, -50%) !important;
  border: 1px solid rgba(66, 221, 232, .3);
  border-radius: 22px;
  color: #eefcff;
  background:
    radial-gradient(circle at 90% 0, rgba(198, 255, 65, .12), transparent 30%),
    #081324;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .68);
  overflow: hidden !important;
  overscroll-behavior: contain;
}

.private-game-dialog {
  width: min(980px, calc(100dvw - 32px)) !important;
  max-width: calc(100dvw - 32px) !important;
  height: min(760px, calc(100dvh - 32px)) !important;
  max-height: calc(100dvh - 32px) !important;
}

.private-host-dialog {
  width: min(680px, calc(100dvw - 32px)) !important;
  max-width: calc(100dvw - 32px) !important;
  max-height: calc(100dvh - 32px) !important;
}

.private-game-dialog *,
.private-game-dialog *::before,
.private-game-dialog *::after,
.private-host-dialog *,
.private-host-dialog *::before,
.private-host-dialog *::after {
  box-sizing: border-box !important;
  min-width: 0;
}

.private-game-dialog::backdrop,
.private-host-dialog::backdrop {
  background: rgba(2, 7, 16, .82);
  backdrop-filter: blur(8px);
}

.private-game-dialog[open] form {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  contain: none !important;
}

.private-game-close {
  position: absolute;
  z-index: 4;
  top: 15px;
  right: 15px;
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  color: #efffff;
  background: #0b192b;
  cursor: pointer;
}

.private-game-header {
  width: 100% !important;
  padding: 28px 68px 20px 28px;
  border-bottom: 1px solid rgba(91, 217, 230, .14);
  overflow: hidden;
}

.private-game-header .eyebrow {
  color: #60e8ed;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.private-game-header h2 {
  margin: 8px 0 5px;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  overflow-wrap: anywhere;
}

.private-game-header p {
  margin: 0;
  color: #91aabd;
  overflow-wrap: anywhere;
}

.private-game-content {
  display: grid !important;
  grid-template-rows: auto auto minmax(150px, 1fr) auto;
  align-content: stretch;
  gap: 18px;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 22px 28px;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  contain: none !important;
}

.private-game-section,
.private-game-settings,
.private-game-friends-section {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.private-game-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 18px;
  width: 100%;
  margin: 0 0 10px;
  overflow: hidden;
}

.private-game-section-heading strong {
  flex: 0 1 auto;
  max-width: 100%;
  font-size: .7rem;
  letter-spacing: .12em;
  overflow-wrap: anywhere;
}

.private-game-section-heading small {
  flex: 1 1 260px;
  max-width: 100%;
  color: #7893a8;
  text-align: right;
  overflow-wrap: anywhere;
}

#private-game-mode-list.private-game-mode-list {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
}

#private-game-mode-list > .private-game-mode-card {
  position: relative;
  display: block;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: 1px solid rgba(94, 165, 190, .25);
  border-radius: 13px;
  background: rgba(11, 27, 46, .8);
  cursor: pointer;
}

.private-game-mode-card input {
  position: absolute;
  opacity: 0;
}

.private-game-mode-card span {
  display: block;
  width: 100%;
  padding: 15px;
  overflow: hidden;
}

.private-game-mode-card strong,
.private-game-mode-card small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.private-game-mode-card small {
  margin-top: 4px;
  color: #789eb0;
  font-size: .62rem;
}

.private-game-mode-card:has(input:checked) {
  border-color: #c9ff48;
  background: linear-gradient(120deg, rgba(52, 97, 70, .72), rgba(12, 35, 54, .9));
  box-shadow: inset 3px 0 #c9ff48;
}

#private-game-dialog .private-game-settings {
  display: grid !important;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) !important;
  gap: 12px !important;
}

#private-game-dialog .private-game-settings > label {
  width: auto !important;
  max-width: 100% !important;
  padding: 12px;
  overflow: hidden !important;
  border: 1px solid rgba(85, 164, 189, .2);
  border-radius: 12px;
  background: rgba(6, 20, 36, .72);
}

.private-game-settings label > span:first-child {
  display: block;
  margin-bottom: 7px;
  font-size: .65rem;
  font-weight: 900;
  letter-spacing: .1em;
  overflow-wrap: anywhere;
}

.private-game-settings input[type=number] {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(91, 203, 219, .24);
  border-radius: 9px;
  color: #fff;
  background: #071326;
}

.private-game-toggle {
  display: flex !important;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.private-game-toggle input {
  flex: 0 0 20px;
  width: 20px;
  min-width: 20px;
  height: 20px;
  accent-color: #c9ff48;
}

.private-game-toggle span,
.private-game-toggle strong,
.private-game-toggle small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.private-game-toggle small {
  margin-top: 4px;
  color: #809bad;
}

.private-game-friends-section {
  display: grid !important;
  grid-template-rows: auto auto minmax(96px, 1fr);
  align-content: stretch;
  gap: 10px;
  min-height: 150px;
}

.private-game-selected {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  width: 100%;
  min-height: 36px;
  max-height: 72px;
  margin: 0;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

.private-game-selected-empty {
  max-width: 100%;
  color: #6f899d;
  font-size: .75rem;
  overflow-wrap: anywhere;
}

.private-game-chip {
  max-width: 100%;
  padding: 7px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(199, 255, 70, .35);
  border-radius: 999px;
  color: #dfff9d;
  background: rgba(68, 97, 45, .35);
  cursor: pointer;
}

#private-game-friends.private-game-friends {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-content: start;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 96px;
  max-height: 220px;
  padding: 0 4px 0 0;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

#private-game-friends > .private-game-friend {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: auto !important;
  max-width: 100% !important;
  margin: 0;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(78, 146, 171, .2);
  border-radius: 10px;
  background: rgba(6, 17, 32, .72);
  cursor: pointer;
}

.private-game-friend input {
  accent-color: #c9ff48;
}

.private-game-friend i {
  width: 7px;
  min-width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #526273;
}

.private-game-friend i.online {
  background: #61efce;
  box-shadow: 0 0 8px #61efce;
}

.private-game-friend span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-game-friend small {
  color: #718a9d;
  font-size: .57rem;
}

.private-game-message {
  min-height: 18px;
  margin: 0;
  color: #ff8fb7;
  font-size: .76rem;
  overflow-wrap: anywhere;
}

.private-game-footer {
  display: flex !important;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100% !important;
  padding: 15px 28px;
  border-top: 1px solid rgba(91, 217, 230, .14);
  overflow: hidden !important;
}

.private-game-footer button,
.private-host-dialog footer button {
  min-height: 42px;
  max-width: 100%;
  padding: 0 18px;
  border: 1px solid rgba(105, 172, 192, .25);
  border-radius: 10px;
  color: #dff8ff;
  background: #102139;
  font-weight: 900;
  cursor: pointer;
  overflow-wrap: anywhere;
}

#private-game-create,
#private-host-restart {
  border-color: #c9ff48;
  color: #102000;
  background: #c9ff48;
}

.private-host-menu-button {
  border-color: rgba(201, 255, 72, .42) !important;
  color: #dfff9d !important;
}

.private-host-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.private-host-dialog > header {
  padding: 27px 64px 18px 27px;
  border-bottom: 1px solid rgba(91, 217, 230, .14);
}

.private-host-dialog > header span {
  color: #60e8ed;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .16em;
}

.private-host-dialog > header h2 {
  margin: 7px 0 4px;
}

.private-host-dialog > header p {
  margin: 0;
  color: #809bad;
}

.private-host-players {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 20px 27px;
  overflow-x: hidden;
  overflow-y: auto;
}

.private-host-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(83, 155, 180, .2);
  border-radius: 11px;
  background: rgba(5, 18, 33, .72);
}

.private-host-player small {
  color: #78a0b2;
}

.private-host-player button {
  padding: 7px 10px;
  border: 1px solid rgba(255, 100, 145, .35);
  border-radius: 8px;
  color: #ff8fb7;
  background: rgba(83, 20, 45, .35);
  cursor: pointer;
}

.private-host-dialog footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  padding: 15px 28px;
  border-top: 1px solid rgba(91, 217, 230, .14);
}

@media (max-width: 760px) {
  .private-game-dialog {
    width: calc(100dvw - 16px) !important;
    max-width: calc(100dvw - 16px) !important;
    height: calc(100dvh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 16px;
  }

  .private-host-dialog {
    width: calc(100dvw - 16px) !important;
    max-width: calc(100dvw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 16px;
  }

  .private-game-header {
    padding: 20px 54px 15px 16px;
  }

  .private-game-header h2 {
    font-size: clamp(1.3rem, 7vw, 1.65rem);
  }

  .private-game-content {
    display: block !important;
    padding: 14px 16px;
  }

  .private-game-content > * + * {
    margin-top: 14px !important;
  }

  .private-game-section-heading {
    display: block;
  }

  .private-game-section-heading small {
    display: block;
    margin-top: 4px;
    text-align: left;
  }

  #private-game-mode-list.private-game-mode-list,
  #private-game-dialog .private-game-settings,
  #private-game-friends.private-game-friends {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .private-game-friends-section {
    display: block !important;
    min-height: 0;
  }

  .private-game-selected {
    margin: 9px 0 !important;
  }

  #private-game-friends.private-game-friends {
    max-height: min(220px, 30dvh);
  }

  .private-game-footer {
    padding: 11px max(16px, env(safe-area-inset-right))
      max(11px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .private-game-footer > button {
    flex: 1 1 130px;
    padding-inline: 10px;
  }

  .private-host-player {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .private-host-player button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .private-game-dialog {
    width: calc(100dvw - 12px) !important;
    max-width: calc(100dvw - 12px) !important;
    height: calc(100dvh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    border-radius: 14px;
  }

  .private-game-header {
    padding-block: 12px;
  }

  .private-game-header p {
    display: none;
  }

  .private-game-content {
    padding-block: 10px;
  }

  #private-game-friends.private-game-friends {
    max-height: 110px;
  }

  .private-game-footer {
    padding-block: 8px;
  }
}

/* Stable action sizing */
#private-game-cancel {
  min-width: 118px;
}

#private-game-create {
  min-width: 210px;
}

@media (max-width: 520px) {
  .private-game-footer {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .private-game-footer > button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px;
    margin: 0 !important;
    padding: 8px 12px;
    line-height: 1.15;
    text-align: center;
  }

  #private-game-create {
    order: 1;
  }

  #private-game-cancel {
    order: 2;
  }
}
