/* Keep the squad and its launch controls together, including narrow touch screens. */
html[data-lobby-launcher=true] #lobby .lobby-grid {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 900px);
  margin-inline: auto;
  gap: 0;
}
html[data-lobby-launcher=true] #lobby .hangar {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
html[data-lobby-launcher=true] #lobby .hangar-caption {
  position: relative;
  order: 0;
  inset: auto;
  display: flex;
  justify-content: space-between;
  padding: 10px 16px 0;
  font-size: 9px;
  letter-spacing: 1.3px;
}
html[data-lobby-launcher=true] #lobby .hangar-title {
  position: relative;
  order: 1;
  inset: auto;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 16px 11px;
  background: linear-gradient(120deg, #172229, #10191f);
  border-bottom: 1px solid #52606566;
}
html[data-lobby-launcher=true] #lobby .hangar-title .eyebrow,
html[data-lobby-launcher=true] #lobby .hangar-title h2 br { display: none; }
html[data-lobby-launcher=true] #lobby .hangar-title h2 {
  margin: 0;
  font: 650 clamp(14px, 1.4vw, 19px)/1.3 "Segoe UI", "Malgun Gothic", sans-serif;
  letter-spacing: -.4px;
  white-space: nowrap;
  text-shadow: none;
}
html[data-lobby-launcher=true] #lobby .hangar-title button {
  flex: none;
  min-height: 36px;
  padding: 7px 10px;
  font-size: 11px;
  white-space: nowrap;
}
html[data-lobby-launcher=true] #lobby .hangar-viewport {
  position: relative;
  order: 2;
  width: 100%;
  min-width: 0;
  isolation: isolate;
}
html[data-lobby-launcher=true] #lobby .hangar-viewport #hangar {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
}
html[data-lobby-launcher=true] #lobby #loadout-strip {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  background: none;
  border: 0;
  backdrop-filter: none;
  pointer-events: none;
}
html[data-lobby-launcher=true] #lobby #loadout-strip button {
  position: absolute;
  left: var(--slot-x);
  top: var(--slot-y-desktop);
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: center;
  column-gap: 5px;
  row-gap: 2px;
  width: 24%;
  max-width: 150px;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 5px 7px;
  color: #f0f5f4;
  background: linear-gradient(120deg, #0a191fea, #152127e8);
  border: 1px solid #879d9c85;
  border-left: 2px solid #b6db99;
  border-radius: 3px;
  box-shadow: 0 3px 9px #0008;
  text-align: left;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
html[data-lobby-launcher=true] #lobby #loadout-strip button[data-depth=front] { width: 29%; }
html[data-lobby-launcher=true] #lobby #loadout-strip button:hover {
  background: #203738f2;
  border-color: #bbefad;
}
html[data-lobby-launcher=true] #lobby #loadout-strip button:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}
html[data-lobby-launcher=true] #lobby #loadout-strip button span {
  font-size: 10px;
  line-height: 1.2;
  font-weight: 700;
  color: #cff6ae;
}
html[data-lobby-launcher=true] #lobby #loadout-strip button b {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}
html[data-lobby-launcher=true] #lobby #loadout-strip button small {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
  font-size: 11px;
  line-height: 1.25;
  color: #c3cfce;
}
html[data-lobby-launcher=true] #lobby .lobby-launcher {
  order: 3;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, #142125, #101a20 75%);
  border-top: 1px solid #71888570;
}
html[data-lobby-launcher=true] #lobby .lobby-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
html[data-lobby-launcher=true] #lobby .lobby-primary-actions button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  margin: 0;
  padding: 9px 13px;
  border: 1px solid #8cbd66;
  background: linear-gradient(115deg, #c9ed91, #a6d676);
  color: #1a2b22;
  text-align: left;
}
html[data-lobby-launcher=true] #lobby .lobby-primary-actions button[data-launch-mode=coop] {
  color: #e5f7f5;
  border-color: #599b9d;
  background: linear-gradient(110deg, #1d474a, #18353d);
}
html[data-lobby-launcher=true] #lobby .lobby-primary-actions button:hover { filter: brightness(1.1); }
html[data-lobby-launcher=true] #lobby .lobby-primary-actions strong {
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}
html[data-lobby-launcher=true] #lobby .lobby-primary-actions small {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  color: inherit;
  opacity: .85;
}
html[data-lobby-launcher=true] #lobby .lobby-secondary-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}
html[data-lobby-launcher=true] #lobby .lobby-secondary-actions button {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin: 0;
  padding: 7px 3px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  color: #c9d7d9;
  background: #111e25;
  border-color: #43565e;
}
html[data-lobby-launcher=true] #lobby .lobby-secondary-actions button:hover { background: #22363b; }
html[data-lobby-launcher=true] #lobby .lobby-queue-indicator {
  display: block;
  width: 100%;
  min-height: 40px;
  margin: 8px 0 0;
  padding: 8px;
  color: var(--cyan);
  border-color: #528c8e;
  font-size: 12px;
}
html[data-lobby-launcher=true] #lobby .lobby-queue-indicator[hidden] { display: none; }

/* Existing mode forms retain their controls, now inside one focused dialog. */
@media(min-width:761px) and (max-width:1050px){
  html[data-lobby-launcher=true] #lobby > .section-heading{margin-bottom:12px}
}
dialog.lobby-launch-dialog {
  width: min(500px, calc(100vw - 28px));
  max-width: none;
  max-height: 85dvh;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #101c23;
  border: 1px solid #5b7379;
  border-radius: 8px;
  clip-path: none;
  box-shadow: 0 24px 100px #000c;
}
dialog.lobby-launch-dialog::backdrop { background: #02090de0; backdrop-filter: blur(4px); }
.lobby-launch-dialog > header,
.lobby-launch-dialog > .lobby-launch-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #192830;
  border-bottom: 1px solid #42555e;
}
.lobby-launch-dialog #lobby-launch-title {
  min-width: 0;
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
  color: #e7f2ef;
}
.lobby-launch-dialog .lobby-launch-close {
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 8px;
  font-size: 21px;
  line-height: 1;
  background: #111e25;
  border-color: #5a7079;
  border-radius: 4px;
}
.lobby-launch-dialog .deployment.panel {
  display: block;
  padding: 18px;
  border: 0;
  border-radius: 0;
  clip-path: none;
  background: none;
  box-shadow: none;
}
.lobby-launch-dialog .deployment > .operation-disclosure {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
.lobby-launch-dialog .operation-disclosure[hidden] { display: none !important; }
.lobby-launch-dialog:not([data-mode=more]) .operation-disclosure > summary { display: none; }
.lobby-launch-dialog[data-mode=more] .deployment > .operation-disclosure + .operation-disclosure {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid #3b4e56;
}
.lobby-launch-dialog .deployment p {
  margin: 0 0 14px;
  line-height: 1.65;
  font-size: 13px;
  color: #b4c5cd;
}
.lobby-launch-dialog .deployment p.mode-hint {
  margin-bottom: 16px;
  color: #b9e8ae;
  font-size: 13px;
}
.lobby-launch-dialog .deployment label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: #d2dee1;
}
.lobby-launch-dialog .deployment select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0 0 12px;
  padding: 10px;
  font-size: 14px;
  background: #0b171e;
  border-color: #536c74;
}
.lobby-launch-dialog .deployment button {
  min-height: 44px;
  margin: 8px 0 0;
  font-size: 14px;
}
.lobby-launch-dialog .deployment .row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}
.lobby-launch-dialog .deployment .row > button {
  flex: 1 1 130px;
  width: auto;
  margin: 0;
  padding-inline: 8px;
  white-space: nowrap;
}
.lobby-launch-dialog .deployment #practice { min-height: 44px; font-size: 13px; }
.lobby-launch-dialog .deployment #queue-status { margin: 16px 0 10px; }
.lobby-launch-dialog .deployment > .fine { margin: 12px 0 0; font-size: 12px; }

@media (max-width: 760px) {
  html[data-lobby-launcher=true] #lobby > .menu-purpose { margin: 5px 0 8px; font-size: 12px; }
  html[data-lobby-launcher=true] #lobby > .section-heading {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    margin-bottom: 10px;
  }
  html[data-lobby-launcher=true] #lobby > .section-heading h1 { margin: 0; font-size: 23px; }
  html[data-lobby-launcher=true] #lobby > .section-heading .eyebrow { display: none; }
  html[data-lobby-launcher=true] #lobby > .section-heading .pilot { width: auto; max-width: 48%; }
  html[data-lobby-launcher=true] #lobby .hangar-caption { padding: 8px 10px 0; font-size: 8px; }
  html[data-lobby-launcher=true] #lobby .hangar-title { padding: 7px 10px 8px; }
  html[data-lobby-launcher=true] #lobby .hangar-title h2 { font-size: 14px; }
  html[data-lobby-launcher=true] #lobby .hangar-title button { min-height: 32px; padding: 6px 7px; font-size: 10px; }
  html[data-lobby-launcher=true] #lobby #loadout-strip button {
    top: var(--slot-y-mobile, var(--slot-y-desktop));
    min-height: 36px;
    padding: 4px 5px;
    column-gap: 4px;
    row-gap: 1px;
  }
  html[data-lobby-launcher=true] #lobby #loadout-strip button b { font-size: 11px; }
  html[data-lobby-launcher=true] #lobby #loadout-strip button span { font-size: 9px; }
  html[data-lobby-launcher=true] #lobby #loadout-strip button small { font-size: 10px; }
  html[data-lobby-launcher=true] #lobby .lobby-launcher { padding: 10px 10px 9px; }
  html[data-lobby-launcher=true] #lobby .lobby-primary-actions { gap: 7px; }
  html[data-lobby-launcher=true] #lobby .lobby-primary-actions button { padding: 8px 10px; }
  html[data-lobby-launcher=true] #lobby .lobby-primary-actions strong { font-size: 15px; }
  html[data-lobby-launcher=true] #lobby .lobby-primary-actions small { font-size: 10px; }
  html[data-lobby-launcher=true] #lobby .lobby-secondary-actions { gap: 5px; }
  html[data-lobby-launcher=true] #lobby .lobby-secondary-actions button { font-size: 11px; }
  dialog.lobby-launch-dialog {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-height: 85dvh;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
  }
  .lobby-launch-dialog > header,
  .lobby-launch-dialog > .lobby-launch-header { padding: 10px 14px; }
  .lobby-launch-dialog #lobby-launch-title { font-size: 19px; }
  .lobby-launch-dialog .deployment.panel { padding: 16px; }
}
@media (max-width: 360px) {
  html[data-lobby-launcher=true] #lobby .lobby-primary-actions strong { font-size: 14px; }
  html[data-lobby-launcher=true] #lobby .lobby-secondary-actions button { font-size: 10px; }
  html[data-lobby-launcher=true] #lobby .hangar-title h2 { font-size: 13px; }
}
