/* ==========================================================================\
   SELECT SCREEN OVERHAUL\
   A compact, controller-first presentation layer. Core game/menu behavior\
   remains in js/hud.js; this file owns only the two selection screens.\
   ========================================================================== */

:root {
  --select-red: #ef3340;
  --select-red-dark: #9d111d;
  --select-gold: #ffd86a;
  --select-ink: #07080d;
  --select-panel: rgba(14, 17, 27, .94);
  --select-line: rgba(255, 255, 255, .16);
}

/* Saved individual audio controls; scrolling belongs to the list. */
#soundSelect[hidden]{display:none}
#soundSelect{position:fixed;inset:0;z-index:90;display:flex;align-items:center;justify-content:center;padding:18px;box-sizing:border-box;background:rgba(3,6,14,.96);color:#f2f5ff;font:15px Arial,sans-serif}
#soundSelect *{box-sizing:border-box}
#soundSelect .soundSheet{width:min(960px,100%);height:min(850px,100%);display:flex;flex-direction:column;gap:14px;min-height:0}
#soundSelect header small{color:#6de0cf;font-weight:800;letter-spacing:3px}
#soundSelect h2{margin:5px 0;font-size:clamp(27px,4vw,42px);font-style:italic;letter-spacing:2px}
#soundSelect p{margin:4px 0;color:#bdc8dc;line-height:1.4}
#soundSelect .soundFilters{display:grid;grid-template-columns:2fr 1fr;gap:12px}
#soundSelect label{font-size:12px;font-weight:700;display:grid;gap:6px}
#soundSelect input,#soundSelect select{width:100%;min-width:0;background:#151e31;border:1px solid #566681;color:white;border-radius:6px;padding:11px;font:inherit}
#soundSelect .soundListHead{display:flex;align-items:center;justify-content:space-between;color:#aebdd5;font-size:12px}
#soundSelect button{font:inherit;color:inherit;border:1px solid #52637c;background:#172137;border-radius:5px;cursor:pointer;padding:10px 14px;min-height:44px}
#soundSelect .soundListHead button{padding:4px 14px;margin-left:6px}
#soundSelect .soundList{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:4px;display:flex;flex-direction:column;gap:5px}
#soundSelect .soundRow{display:flex;align-items:center;justify-content:space-between;gap:16px;text-align:left;padding:12px 16px;flex-shrink:0}
#soundSelect .soundRow span{min-width:0}
#soundSelect .soundRow b{display:block;overflow-wrap:anywhere;font-size:14px}
#soundSelect .soundRow small{display:block;color:#aabbd5;margin-top:5px;font-size:11px;text-transform:uppercase;letter-spacing:.6px}
#soundSelect .soundRow strong{flex-shrink:0;min-width:42px;color:#94a8c5;text-align:right;font-size:13px}
#soundSelect .soundRow[aria-checked=true] strong{color:#6de0cf}
#soundSelect .soundRow.selected{background:#24364b;border-color:#78dcca}
#soundSelect :focus-visible{outline:2px solid #fff;outline-offset:2px}
#soundSelect .soundActions{display:flex;gap:8px;justify-content:flex-end;margin-top:10px}
#soundSelect [data-sound-action=toggle]{background:#246b61;border-color:#6de0cf}
#soundSelect button:disabled{opacity:.4;cursor:default}
#soundSelect footer p{font-size:12px;min-height:17px}
@media(max-width:540px){#soundSelect{padding:14px 10px}#soundSelect .soundFilters{grid-template-columns:1fr 1fr}#soundSelect .soundActions{display:grid;grid-template-columns:1fr 1fr}#soundSelect .soundSheet{gap:10px}#soundSelect .soundRow{padding:10px}#soundSelect header p{font-size:12px}}
@media(max-height:480px){#soundSelect{padding:8px 14px}#soundSelect .soundSheet{gap:6px}#soundSelect header{display:flex;align-items:center;gap:15px}#soundSelect header small,#soundSelect header p{display:none}#soundSelect h2{font-size:24px;margin:0}#soundSelect input,#soundSelect select{padding:6px}#soundSelect footer p{font-size:10px}#soundSelect .soundActions{margin-top:5px}#soundSelect .soundActions button{min-height:36px;padding:6px 10px}}

/* ---- main mode menu ---------------------------------------------------- */

/* Mode cards are directly tappable, so the gameplay touch pad only blocks
   content on this screen. Hiding it also leaves the bottom hint unobstructed. */
body.title-mode #touchControls { display: none !important; }

#titleScreen {
  box-sizing: border-box;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: clamp(10px, 1.8vh, 20px) !important;
  padding: max(22px, env(safe-area-inset-top)) clamp(22px, 7vw, 104px) max(18px, env(safe-area-inset-bottom)) !important;
  overflow: hidden !important;
}

#titleScreen .titleBrand {
  min-width: 0;
  align-self: start;
}

#titleScreen .gameTitle {
  position: static !important;
  inset: auto !important;
  max-width: 100% !important;
  margin: 0;
  color: #fff;
  font: 950 italic clamp(44px, 5.2vw, 74px)/.92 Arial, sans-serif !important;
  letter-spacing: clamp(1px, .3vw, 4px) !important;
  white-space: nowrap;
  transform: skewX(-10deg);
  text-shadow: 0 0 26px rgba(255, 120, 60, .65), 0 6px 0 #000;
}

#titleScreen .gameTitle > div {
  margin-top: 7px !important;
  color: #ffce7a;
  font: 900 clamp(10px, 1.1vw, 15px)/1 Arial, sans-serif !important;
  letter-spacing: clamp(3px, .5vw, 7px) !important;
  text-shadow: 0 2px 0 #000;
}

#titleScreen .titleMenu {
  min-height: 0;
  width: min(calc(46vw + 46px), 606px);
  max-width: 100%;
  margin-left: -6px;
  padding: 6px 40px 6px 6px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  justify-content: safe center;
  align-self: stretch;
  gap: clamp(7px, 1.25vh, 13px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .34) transparent;
}

#titleScreen .titleButton {
  appearance: none;
  flex: 0 0 auto;
  width: 100% !important;
  min-height: clamp(62px, 9vh, 88px);
  padding: clamp(10px, 1.45vh, 16px) clamp(22px, 2.6vw, 34px) !important;
  box-sizing: border-box;
  border: 0;
  border-left: 10px solid rgba(255, 255, 255, .88);
  border-radius: 6px;
  color: #fff;
  background: var(--title-color);
  background: linear-gradient(100deg, var(--title-color) 0%, color-mix(in srgb, var(--title-color) 76%, #111 24%) 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
  filter: brightness(.8) saturate(.8);
  text-align: left;
  cursor: pointer;
  transform: skewX(-10deg);
  transform-origin: 50% 50%;
  transition: transform .12s, box-shadow .12s, filter .12s;
}

#titleScreen .titleButton > span {
  display: block;
  color: #fff;
  font: 950 italic clamp(29px, 3.1vw, 42px)/.96 Arial, sans-serif !important;
  letter-spacing: clamp(1px, .24vw, 3px) !important;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .55);
}

#titleScreen .titleButton > small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, .88);
  font: 800 clamp(9px, .95vw, 13px)/1.15 Arial, sans-serif !important;
  letter-spacing: clamp(.6px, .16vw, 2px) !important;
}

#titleScreen .titleButton.is-selected {
  z-index: 1;
  filter: brightness(1.18) saturate(1.15);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55), 0 0 22px rgba(255, 255, 255, .22);
  transform: skewX(-10deg) translateX(clamp(8px, 1.5vw, 20px)) scale(1.025);
}

#titleScreen .titleButton:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

#titleScreen .titleHint {
  position: static !important;
  inset: auto !important;
  max-width: min(100%, 720px) !important;
  color: #cdd6e0;
  font: 800 clamp(10px, 1vw, 14px)/1.3 Arial, sans-serif !important;
  text-align: left !important;
}

#titleScreen .titleHint b { color: #fff; }

/* The old compact rule started at 500px, leaving the common 501-720px range
   exposed. Keep all mode counts compact through laptop-height viewports. */
@media (max-height: 780px) {
  #titleScreen {
    gap: 6px !important;
    padding: max(10px, env(safe-area-inset-top)) clamp(18px, 5vw, 68px) max(9px, env(safe-area-inset-bottom)) !important;
  }

  #titleScreen .gameTitle { font-size: clamp(34px, 7vh, 52px) !important; }
  #titleScreen .gameTitle > div { margin-top: 3px !important; font-size: 9px !important; letter-spacing: 3px !important; }
  #titleScreen .titleMenu { gap: 5px; padding-top: 4px; padding-bottom: 4px; }
  #titleScreen .titleButton { min-height: 0; padding: 6px 20px !important; }
  #titleScreen .titleButton > span { font-size: clamp(24px, 5vh, 32px) !important; }
  #titleScreen .titleButton > small { margin-top: 3px; font-size: 8px !important; letter-spacing: .8px !important; }
  #titleScreen .titleHint { font-size: 10px !important; }
}

@media (max-width: 640px) {
  #titleScreen {
    padding-right: max(12px, env(safe-area-inset-right)) !important;
    padding-left: max(12px, env(safe-area-inset-left)) !important;
  }

  #titleScreen .gameTitle {
    font-size: clamp(34px, 11vw, 52px) !important;
    letter-spacing: 1px !important;
  }

  #titleScreen .titleMenu {
    width: 100%;
    margin-left: 0;
    padding-right: 24px;
    padding-left: 4px;
  }

  #titleScreen .titleButton > span { font-size: clamp(25px, 8vw, 36px) !important; }
  #titleScreen .titleButton > small { white-space: normal; }
  #titleScreen .titleButton.is-selected { transform: skewX(-10deg) translateX(6px) scale(1.012); }
  #titleScreen .titleHint { max-width: 100% !important; text-align: center !important; }
}

/* Backdrop layers sit under the brand/menu/hint rows: a red slash and light
   streaks in the select screen's language, plus a faint brand watermark. */
#titleScreen {
  position: fixed;
  isolation: isolate;
}

#titleScreen::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(112deg, transparent 0 57%, rgba(239, 51, 64, .2) 57.1% 59.4%, transparent 59.5% 100%),
    linear-gradient(112deg, transparent 0 62.4%, rgba(239, 51, 64, .62) 62.5% 63%, transparent 63.1% 100%),
    radial-gradient(circle at 78% 30%, rgba(255, 255, 255, .06), transparent 26%),
    repeating-linear-gradient(118deg, transparent 0 64px, rgba(255, 255, 255, .028) 65px 67px, transparent 68px 132px);
}

#titleScreen::after {
  content: 'SUPER NOOB BROS';
  position: absolute;
  z-index: -1;
  right: -.08em;
  bottom: -.2em;
  color: rgba(255, 255, 255, .035);
  font: 950 italic clamp(120px, 17vw, 300px)/1 Arial, sans-serif;
  letter-spacing: -.04em;
  white-space: nowrap;
  transform: skewX(-10deg);
  pointer-events: none;
}

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

@keyframes select-grid-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes select-hand-idle {
  0%, 100% { transform: translate(-50%, -77%) rotate(-8deg) translateY(0); }
  50% { transform: translate(-50%, -77%) rotate(-5deg) translateY(-5px); }
}

@keyframes select-hand-lock {
  0% { transform: translate(-50%, -77%) rotate(-7deg) scale(1.2); }
  48% { transform: translate(-50%, -69%) rotate(3deg) scale(.86); }
  72% { transform: translate(-50%, -75%) rotate(-2deg) scale(1.06); }
  100% { transform: translate(-50%, -77%) rotate(0) scale(.98); }
}

@keyframes selected-edge-pulse {
  0%, 100% { opacity: .48; }
  50% { opacity: .9; }
}

/* Screen enters: one short composited fade. The fighter select fades opacity
   only, because its live-render lanes are measured from the DOM every layout
   revision and must not slide. */
@keyframes screen-enter-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes screen-enter-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

#select.screen-enter { animation: screen-enter-fade .22s ease-out both; }
#titleScreen.screen-enter { animation: screen-enter-fade .26s ease-out both; }
#stageSelect.screen-enter { animation: screen-enter-rise .24s cubic-bezier(.2, .8, .2, 1) both; }
#rulesModal.screen-enter .rulesSheet { animation: screen-enter-rise .18s cubic-bezier(.2, .8, .2, 1) both; }

/* The match curtain sits above every menu screen and below the runtime error
   box. Up before the synchronous stage rebuild, down on the countdown's first
   tick (js/hud.js startMatch), so a load stall reads as a cut, never a freeze. */
#matchCurtain {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .38s ease-out;
}

#matchCurtain.is-on {
  opacity: 1;
  pointer-events: auto;
  transition: opacity .22s ease-in;
}

/* Online has its own opaque VS/loading surface and timed cancel controls.
   The offline curtain otherwise hides them until the countdown advances. */
body.online-starting #matchCurtain {
  opacity: 0;
  pointer-events: none;
  transition: none;
}

/* ---- fighter select shell --------------------------------------------- */

#select {
  isolation: isolate;
  box-sizing: border-box;
  display: flex;
  min-height: 0;
  color: #fff;
  background:
    linear-gradient(112deg, rgba(0, 0, 0, .05) 0 66%, rgba(0, 0, 0, .46) 66.1% 100%),
    radial-gradient(circle at 84% 38%, rgba(255, 255, 255, .12), transparent 24%),
    linear-gradient(135deg, rgba(112, 9, 18, .88), rgba(20, 9, 16, .9) 38%, rgba(5, 7, 14, .96) 72%);
}

#select::before {
  content: '';
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .42;
  background:
    repeating-linear-gradient(118deg, transparent 0 64px, rgba(255, 255, 255, .025) 65px 67px, transparent 68px 132px),
    linear-gradient(105deg, rgba(239, 51, 64, .92) 0 8px, transparent 8px);
  mask-image: linear-gradient(90deg, #000, rgba(0, 0, 0, .72) 72%, transparent);
}

#select::after {
  content: '';
  position: fixed;
  z-index: -1;
  right: -12vw;
  bottom: -42vh;
  width: 62vw;
  aspect-ratio: 1;
  border: clamp(28px, 6vw, 90px) solid rgba(255, 255, 255, .026);
  border-radius: 50%;
  transform: rotate(-16deg);
  pointer-events: none;
}

.selectHeader {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  min-height: 90px;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 3.2vw, 52px) 10px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(90deg, rgba(4, 5, 10, .74), rgba(4, 5, 10, .28) 72%, transparent);
}

.selectHeadingLockup {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 13px;
  align-items: end;
}

.selectStep {
  grid-row: 1 / 3;
  align-self: stretch;
  display: grid;
  place-items: center;
  width: 52px;
  min-height: 58px;
  color: #fff;
  background: linear-gradient(145deg, #ff5963, var(--select-red-dark));
  border: 1px solid rgba(255, 255, 255, .6);
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
  font: 950 italic 25px/1 Arial, sans-serif;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .36);
}

.selectEyebrow {
  align-self: end;
  color: var(--select-gold);
  font: 900 11px/1 Arial, sans-serif;
  letter-spacing: 4px;
}

#select .selectHeader h1 {
  grid-column: 2;
  margin: 4px 0 0;
  color: #fff;
  font: 950 italic clamp(29px, 3.6vw, 55px)/.88 Arial, sans-serif;
  letter-spacing: clamp(1px, .22vw, 4px);
  text-align: left;
  transform: skewX(-8deg);
  text-shadow: 0 4px 0 #000, 0 0 24px rgba(239, 51, 64, .34);
}

.selectHeaderMeta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  padding-bottom: 2px;
}

#selectPhase {
  color: #fff;
  font: 950 italic 13px/1 Arial, sans-serif;
  letter-spacing: 1.8px;
}

.selectNavLegend {
  color: #9da6b8;
  font: 800 10px/1 Arial, sans-serif;
  letter-spacing: 1.3px;
  white-space: nowrap;
}

.selectNavLegend b {
  display: inline-grid;
  min-width: 19px;
  min-height: 19px;
  margin: 0 2px 0 8px;
  padding: 0 4px;
  place-items: center;
  box-sizing: border-box;
  border-radius: 4px;
  color: #12131a;
  background: #fff;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .45);
  font-size: 9px;
}

#partyFormatBar {
  z-index: 7;
  margin-top: 7px;
}

/* ---- roster ------------------------------------------------------------ */

#roster {
  position: relative;
  z-index: 4;
  flex: 1 1 auto;
  width: min(70vw, 990px);
  min-height: 0;
  margin: 0 auto 0 clamp(12px, 2.4vw, 40px);
  padding: clamp(14px, 2vh, 22px) clamp(12px, 1.5vw, 24px) 26px;
  display: grid;
  grid-template-columns: repeat(6, minmax(86px, 1fr));
  grid-auto-rows: minmax(108px, 1fr);
  gap: clamp(6px, .75vw, 11px);
  /* `center` places overflow above scrollTop=0 on compact screens, making the
     first roster rows impossible to reach. Start alignment keeps every card in
     the scroll range while the shell itself still centers the grid. */
  align-content: start;
  justify-content: stretch;
  overflow: auto;
  box-sizing: border-box;
  animation: select-grid-in .36s cubic-bezier(.18, .8, .22, 1) both;
}

.char {
  --fighter: #fff;
  position: relative;
  isolation: isolate;
  min-width: 0;
  width: 100%;
  min-height: 108px;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(41, 44, 55, .96), rgba(10, 11, 17, .98));
  box-shadow: 0 7px 16px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .09);
  cursor: pointer;
  transform: none;
  transition: transform .14s cubic-bezier(.2, .8, .2, 1), border-color .14s, filter .14s, box-shadow .14s;
}

.char::before {
  content: '';
  position: absolute;
  z-index: 4;
  inset: -3px;
  border: 3px solid transparent;
  border-radius: 6px;
  pointer-events: none;
  transition: border-color .12s, box-shadow .12s;
}

.char::after {
  content: '';
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--fighter);
  box-shadow: 0 0 12px color-mix(in srgb, var(--fighter) 72%, transparent);
  pointer-events: none;
}

.char:hover,
.char:focus-visible {
  z-index: 8;
  filter: brightness(1.13) saturate(1.08);
  transform: translateY(-3px) scale(1.025);
  outline: none;
}

.char:is(.cur1, .cur2, .cur3, .cur4) {
  z-index: 7;
  transform: translateY(-4px) scale(1.035);
  filter: brightness(1.14) saturate(1.12);
  border-color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .58), 0 0 0 2px rgba(255, 255, 255, .28);
}

.char:is(.cur1, .cur2, .cur3, .cur4)::before {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--fighter), 0 0 16px color-mix(in srgb, var(--fighter) 60%, transparent);
  animation: selected-edge-pulse 1.35s ease-in-out infinite;
}

.char .swatch {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
  border-radius: 3px;
  background-color: #171923;
  background-position: center 24%;
  background-size: cover;
  overflow: hidden;
  box-shadow: none !important;
  filter: contrast(1.04) saturate(.95);
}

.char .swatch::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 34%, rgba(5, 6, 10, .12) 52%, rgba(5, 6, 10, .94) 100%),
    linear-gradient(115deg, color-mix(in srgb, var(--fighter) 20%, transparent), transparent 50%);
  pointer-events: none;
}

.char .portraitFallback {
  z-index: 0;
  align-items: center;
  padding: 0 10px 22px;
  font-size: 12px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--fighter) 65%, #fff), #11131c 78%);
}

.char .portrait-instant .portraitFallback,
.char .portrait-ready .portraitFallback { opacity: 0; }

.char .portrait-loading::before,
.char .portrait-loading::after {
  opacity: .72;
  transform: translateX(50%);
}

.charNumber {
  position: absolute;
  z-index: 5;
  top: 5px;
  left: 6px;
  color: rgba(255, 255, 255, .72);
  font: 900 italic 10px/1 Arial, sans-serif;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px #000;
}

.charCaption {
  position: absolute;
  z-index: 4;
  left: 7px;
  right: 7px;
  bottom: 8px;
  min-width: 0;
  pointer-events: none;
  text-align: left;
  transform: skewX(-5deg);
}

.char .cname {
  overflow: hidden;
  color: #fff;
  font: 950 italic clamp(11px, 1vw, 15px)/.96 'Arial Narrow', Arial, sans-serif;
  letter-spacing: .15px;
  text-overflow: clip;
  text-shadow: 0 2px 2px #000, 0 0 8px #000;
  white-space: normal;
  overflow-wrap: anywhere;
}

.char .ctitle {
  display: none;
}

.char .bars,
.char .v2badge {
  display: none !important;
}

.char .tag {
  z-index: 12;
  top: -13px;
  min-width: 28px;
  padding: 4px 8px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 3px;
  font: 950 italic 10px/1 Arial, sans-serif;
  letter-spacing: .5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}

.char .tagP1 { left: -5px; background: var(--port1, #d8383e); }
.char .tagP2 { right: -5px; background: var(--port2, #3a6fd8); }
.char .tagP3 { left: -5px; top: auto; bottom: -13px; }
.char .tagP4 { right: -5px; top: auto; bottom: -13px; }

.char .ready {
  z-index: 11;
  left: 50%;
  bottom: 4px;
  width: calc(100% - 10px);
  padding: 4px 2px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 2px;
  color: #081009;
  background: linear-gradient(90deg, #5ee47d, #baff85);
  box-shadow: 0 0 18px rgba(74, 238, 112, .7);
  font: 950 italic 10px/1 Arial, sans-serif;
  letter-spacing: 2px;
}

/* ---- floating glove cursors ------------------------------------------- */

.selectHandLayer {
  position: fixed;
  z-index: 21;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.selectHand {
  --hand-color: #ff5b62;
  --hand-x: -200px;
  --hand-y: -200px;
  position: fixed;
  left: 0;
  top: 0;
  width: var(--hand-width, clamp(52px, 4.5vw, 65px));
  aspect-ratio: 271 / 512;
  opacity: 0;
  filter: drop-shadow(0 7px 5px rgba(0, 0, 0, .7));
  /* Position is a translate, never left/top: a cursor move animates on the
     compositor and never dirties layout under the per-frame lane measurement. */
  transform: translate3d(var(--hand-x), var(--hand-y), 0);
  transition: transform .16s cubic-bezier(.16, .86, .22, 1), opacity .1s;
  will-change: auto;
}

.selectHand.is-visible { opacity: .8; will-change: transform; }
.selectHand.is-visible.is-active,
.selectHand.is-visible.is-locked { opacity: 1; }

.selectHandBody {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: 50% 65%;
  animation: select-hand-idle 1.05s ease-in-out infinite;
}

.selectHand.is-locked .selectHandBody { animation: select-hand-lock .28s cubic-bezier(.18, .82, .24, 1) both; }
.selectHand.is-locked .handPoint { opacity: 1; }

.selectHand svg,
.selectHandSprite {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  overflow: visible;
  user-select: none;
}

.selectHand .handPoint,
.selectHand .handGrab {
  transition: opacity .08s;
}

.selectHand .handGrab { opacity: 0; }
.selectHand .gloveOutline { fill: #171922; stroke: #06070a; stroke-width: 6; stroke-linejoin: round; }
.selectHand .gloveBody { fill: url(#selectGloveFill); stroke: rgba(255, 255, 255, .7); stroke-width: 1.4; }
.selectHand .glovePiece { stroke: #08090d; stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.selectHand .gloveShade { fill: none; stroke: rgba(87, 93, 111, .58); stroke-width: 4; stroke-linecap: round; }
.selectHand .gloveCuff { fill: var(--hand-color); stroke: #fff; stroke-width: 3; }

.handBadge {
  position: absolute;
  z-index: 3;
  right: -2px;
  top: 4px;
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 21px;
  padding: 0 5px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 4px;
  color: #fff;
  background: var(--hand-color);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .48);
  font: 950 italic 10px/1 Arial, sans-serif;
  letter-spacing: .5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

.selectHand[data-slot="2"] .handBadge { color: #221900; text-shadow: none; }
.selectHand[data-slot="1"] .selectHandSprite { filter: hue-rotate(218deg) saturate(1.08); }
.selectHand[data-slot="2"] .selectHandSprite { filter: hue-rotate(48deg) saturate(1.05); }
.selectHand[data-slot="3"] .selectHandSprite { filter: hue-rotate(118deg) saturate(1.05); }

/* ---- fighter lanes + showcase plates ---------------------------------- */
/* Only the wide singles layout (media query above) displays these; hud.js
   reads .selectLane's rectangle to place each live render inside it. */
.selectLane,
.selectShowcase { display: none; }

.selectLane {
  --port: #ff5b62;
  --fighter: var(--port);
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Vignette: a clear centre for the render, a dark frame at the edges. */
.selectLane::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 64% 62% at 50% 54%, rgba(3, 4, 9, 0) 0 44%, rgba(3, 4, 9, .34) 72%, rgba(3, 4, 9, .8) 100%),
    radial-gradient(ellipse 70% 40% at 50% 0%, color-mix(in srgb, var(--port) 20%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(3, 4, 9, .42), transparent 18%, transparent 84%, rgba(3, 4, 9, .3));
}

/* Port-coloured floor glow the fighter stands on. */
.selectLane::after {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 1.5%;
  height: 15%;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, color-mix(in srgb, var(--port) 62%, transparent), color-mix(in srgb, var(--port) 22%, transparent) 42%, transparent 70%);
  opacity: .85;
  transition: opacity .2s, filter .2s;
}

.selectLane.is-ready::after { opacity: 1; filter: brightness(1.25); animation: lane-floor-pulse .55s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes lane-floor-pulse {
  0% { transform: scale(1.7, 1.9); filter: brightness(2); }
  100% { transform: scale(1); filter: brightness(1.25); }
}
.selectLane[data-slot="0"] { box-shadow: inset 5px 0 0 var(--port); }
.selectLane[data-slot="1"] { box-shadow: inset -5px 0 0 var(--port); }

.laneWatermark {
  position: absolute;
  top: -.06em;
  color: rgba(255, 255, 255, .045);
  font: 950 italic clamp(150px, 15vw, 260px)/1 Arial, sans-serif;
  letter-spacing: -.05em;
  transform: skewX(-10deg);
  user-select: none;
}

.selectLane[data-slot="0"] .laneWatermark { left: -.04em; }
.selectLane[data-slot="1"] .laneWatermark { right: -.04em; }
.selectLane.is-random .laneWatermark { visibility: hidden; }

.selectShowcase {
  --port: #ff5b62;
  --fighter: var(--port);
  position: relative;
  z-index: 5;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: start;
  margin: 0 10px 2px;
  padding: 12px 12px 11px 0;
  border-left: 6px solid var(--port);
  border-bottom: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  background: linear-gradient(90deg, rgba(6, 7, 12, .98), rgba(6, 7, 12, .93));
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5);
  transition: border-color .15s, box-shadow .15s;
}

/* Fighter-colour sheen across the plate. */
.selectShowcase::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, color-mix(in srgb, var(--fighter) 26%, transparent), transparent 55%);
  pointer-events: none;
}

.selectShowcase.is-active {
  border-left-color: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 0 1px color-mix(in srgb, var(--port) 55%, transparent);
}

.selectShowcase.is-ready { border-bottom-color: #7cf0a0; }
.selectShowcase.is-cpu { filter: saturate(.85); }

.showcasePort {
  grid-row: 1;
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 46px;
  margin-left: 10px;
  padding: 0 9px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .7);
  color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--port) 82%, #fff 18%), var(--port));
  clip-path: polygon(13% 0, 100% 0, 87% 100%, 0 100%);
  font: 950 italic 16px/1 Arial, sans-serif;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
}

.selectShowcase[data-slot="2"] .showcasePort { color: #221900; text-shadow: none; }
.selectShowcase.is-cpu .showcasePort { background: linear-gradient(145deg, #9aa0b0, #5b6070); font-size: 13px; }
.showcaseBody { grid-row: 1; min-width: 0; position: relative; }

.showcaseEyebrow {
  display: block;
  overflow: hidden;
  color: var(--select-gold);
  font: 900 9px/1 Arial, sans-serif;
  letter-spacing: 2.6px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.showcaseName {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  margin-top: 4px;
  overflow: hidden;
  color: #fff;
  font: 950 italic clamp(25px, 2.45vw, 42px)/.9 Arial, sans-serif;
  letter-spacing: .6px;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow: 0 3px 0 #000, 0 0 22px color-mix(in srgb, var(--fighter) 55%, transparent);
  transform: skewX(-6deg);
  transform-origin: left;
}

.selectShowcase.is-random .showcaseName { color: #ffe08a; }
.showcaseName:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.showcaseName:hover { color: var(--select-gold); }
#partyPlayers .partyPlayer button.partyPort { min-width: 0; padding: 0; font-size: 0; }

.showcaseMeta {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: #b9c3d5;
  font: 800 10.5px/1.25 Arial, sans-serif;
  letter-spacing: .9px;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.showcaseSkin {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  min-width: 0;
  margin-top: 9px;
  padding-left: 10px;
}

.showcaseSkin:empty { display: none; }

.showcaseSkin .costumeChip {
  width: 100%;
  min-height: 34px;
  grid-template-columns: auto 32px minmax(0, 1fr) 32px;
  padding: 2px 4px 2px 9px;
  border-radius: 4px;
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .055);
  box-shadow: none;
}

.showcaseSkin .costumeChip:not(.is-visible) { display: none; }
.showcaseSkin .costumeChip button { width: 30px; height: 30px; border-radius: 3px; }
.showcaseSkin .costumeChip > small { font-size: 8.5px; }

.showcaseState {
  position: absolute;
  right: 10px;
  top: -12px;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 2px;
  color: #dde3ee;
  background: #20232d;
  font: 950 italic 9.5px/1 Arial, sans-serif;
  letter-spacing: 1.8px;
  transform: skewX(-8deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
}

.selectShowcase.is-active .showcaseState {
  border-color: #fff;
  color: #fff;
  background: var(--port);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}

.selectShowcase[data-slot="2"].is-active .showcaseState { color: #221900; text-shadow: none; }

.selectShowcase.is-ready .showcaseState {
  border-color: #fff;
  color: #081009;
  background: linear-gradient(90deg, #5ee47d, #baff85);
  text-shadow: none;
  box-shadow: 0 0 18px rgba(74, 238, 112, .7);
  animation: showcase-stamp .3s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes showcase-stamp {
  0% { opacity: 0; transform: skewX(-8deg) scale(1.7); }
  60% { opacity: 1; transform: skewX(-8deg) scale(.94); }
  100% { opacity: 1; transform: skewX(-8deg) scale(1); }
}

/* The old single hovering label: superseded by the plates, kept in the DOM for tooling. */
#fighterPreviewLabel { display: none !important; }
body.stage-select-open #select { visibility: hidden; }

/* ---- roster card polish ------------------------------------------------ */
/* Port-coloured selection rings in singles: red is P1, blue is P2, both split
   the ring when they hover the same fighter. Party keeps its swatch rings. */
body:not(.party-mode) .char.cur1::before {
  border-color: var(--port1);
  box-shadow: 0 0 0 2px rgba(255, 91, 98, .35), 0 0 18px color-mix(in srgb, var(--port1) 60%, transparent);
}

body:not(.party-mode) .char.cur2::before {
  border-color: var(--port2);
  box-shadow: 0 0 0 2px rgba(91, 139, 255, .35), 0 0 18px color-mix(in srgb, var(--port2) 60%, transparent);
}

body:not(.party-mode) .char.cur1.cur2::before {
  border-color: var(--port1) var(--port2) var(--port2) var(--port1);
  box-shadow: 0 0 0 2px rgba(200, 107, 255, .35), 0 0 18px rgba(200, 107, 255, .55);
}

.char:hover .swatch,
.char:focus-visible .swatch { filter: contrast(1.06) saturate(1.12) brightness(1.06); }

.setupBtns #gcStatus {
  max-width: 240px;
  overflow: hidden;
  color: #8393a9;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- footer / setup ---------------------------------------------------- */

#selInfo {
  position: relative;
  z-index: 23;
  flex: 0 0 auto;
  padding: 0 clamp(12px, 2.4vw, 36px) max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .16);
  color: #c7cfdd;
  background: linear-gradient(180deg, rgba(7, 8, 13, .84), rgba(2, 3, 7, .98));
  box-shadow: 0 -12px 32px rgba(0, 0, 0, .35);
  font-size: 11px;
  line-height: 1.3;
}

.selectCommandBar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vw, 30px);
  min-height: 35px;
  margin: 0 calc(clamp(12px, 2.4vw, 36px) * -1) 7px;
  padding: 4px 16px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .035);
}

.selectCommandBar > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.selectCommandBar kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 50%;
  color: #14151a;
  background: #f5f7fb;
  box-shadow: 0 2px 0 #747a88;
  font: 950 9px/1 Arial, sans-serif;
}

.selectCommandBar kbd:not(.keyA):not(.keyB) { border-radius: 5px; }
.selectCommandBar .keyA { color: #05210c; background: #76e990; }
.selectCommandBar .keyB { color: #29090a; background: #ff777d; }
.selectCommandBar .keyX { color: #1a1d2a; background: #d7dce8; }
.selectCommandBar strong { color: #dce2ec; font-size: 8px; letter-spacing: 1.2px; }
.selectCommandBar strong { font-size: 10px; }

.singlesSetup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 39px;
}

.cpuSetupBlock {
  display: flex;
  align-items: center;
  gap: 7px;
}

.setupLabel {
  color: #98a3b5;
  font: 900 10px/1 Arial, sans-serif;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.cpuControls {
  min-height: 32px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .045);
}

.cpuControls button {
  width: 28px;
  height: 28px;
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
  background: #20232d;
  cursor: pointer;
}

.cpuControls #cpulvl { min-width: 66px; color: var(--select-gold); font-size: 12px; }
#p1cpu { width: auto; min-width: 69px; padding: 0 10px; border-radius: 14px; font-size: 9px; }
.selectSetupCopy { max-width: 620px; margin: 0; color: #aab3c1; font-size: 11px; line-height: 1.35; text-align: left; }

#costumeControls { margin: 0 auto 4px; }
.costumeChip { min-height: 34px; border-radius: 4px; background: rgba(255, 255, 255, .05); }
.costumeChip button { width: 30px; height: 30px; border-radius: 3px; }

#padStatus:empty,
#wizPrompt:empty { display: none; }

#padStatus {
  max-height: 28px;
  margin-top: 3px;
  overflow: hidden;
  color: #8393a9 !important;
  font-size: 9px !important;
  line-height: 1.35 !important;
}

.setupBtns {
  gap: 5px;
  margin-top: 4px;
}

#selInfo .setupBtns button {
  min-height: 28px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 4px;
  color: #aeb7c7;
  background: rgba(255, 255, 255, .045);
  font: 850 10px/1 Arial, sans-serif;
  letter-spacing: .7px;
}

#selInfo .setupBtns button:hover,
#selInfo .setupBtns button:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, .62);
  background: rgba(255, 255, 255, .11);
}

#rulesBtn { color: var(--select-gold) !important; border-color: rgba(255, 216, 106, .5) !important; }

/* Singles mirrors Ultimate's two-player dock: both choices remain visible even
   while the floating hand is working elsewhere in the roster. */
#partyPlayers {
  position: relative;
  z-index: 22;
  flex: 0 0 auto;
  width: min(920px, calc(100% - 28px));
  margin: 0 auto 7px;
  padding: 0;
  gap: 10px;
}

body:not(.party-mode) #partyPlayers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body:not(.party-mode) #partyPlayers .partyPlayer:nth-child(n + 3) { display: none; }
body:not(.party-mode) .singlesSetup { display: none; }

#partyPlayers .partyPlayer {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  min-height: 66px;
  padding: 5px 8px 5px 5px;
  border-radius: 5px;
}

#partyPlayers .partyPort {
  position: relative;
  width: 54px;
  height: 54px;
  border: 2px solid var(--port);
  border-radius: 4px;
  background-color: #11131b;
  background-position: center 24%;
  background-size: cover;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .2);
  color: transparent;
  font-size: 0;
}

#partyPlayers .partyPort::after {
  content: attr(data-label);
  position: absolute;
  left: 3px;
  bottom: 3px;
  min-width: 25px;
  padding: 3px 4px;
  border: 1px solid #fff;
  border-radius: 2px;
  color: #fff;
  background: var(--port);
  font: 950 italic 9px/1 Arial, sans-serif;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .65);
}

#partyPlayers .partyPlayer[data-player-slot="2"] .partyPort::after { color: #211900; text-shadow: none; }

#partyPlayers .partyFighter { font-size: 15px; letter-spacing: .7px; }
#partyPlayers .partyState { font-size: 10px; line-height: 1.2; letter-spacing: .8px; }
#partyPlayers .partyPlayer button { min-width: 38px; height: 34px; font-size: 10px; }
#partyPlayers .partyPlayer .partyControls { width: 34px; font-size: 15px; }
#partyPlayers .partyPlayer.is-ready::before { top: 6px; font-size: 9px; letter-spacing: 1.5px; }
#partyPlayers .partyPlayer.is-open { opacity: .9; border-style: dashed; }

.cpuDifficultyDock {
  display: grid;
  grid-template-columns: minmax(92px, 130px) auto;
  align-items: center;
  gap: 2px 8px;
  min-width: 138px;
  padding: 4px 7px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 4px;
  background: rgba(0, 0, 0, .3);
}

.cpuDifficultyDock[hidden] { display: none; }
.cpuDifficultyDock span { grid-column: 1; color: #d7ddea; font: 900 11px/1 Arial, sans-serif; letter-spacing: 1.1px; }
.cpuDifficultyDock output { grid-column: 2; grid-row: 1 / 3; min-width: 39px; color: var(--select-gold); font: 950 italic 15px/1 Arial, sans-serif; text-align: center; }

.cpuDifficultyDock input[type="range"] {
  grid-column: 1;
  width: 100%;
  height: 30px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  touch-action: none;
  cursor: ew-resize;
  background: transparent;
}

.cpuDifficultyDock input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 2px;
  background: linear-gradient(90deg, #ef3340 0 var(--cpu-progress, 25%), #282c37 var(--cpu-progress, 25%) 100%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .55);
}

.cpuDifficultyDock input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #ef3340;
  box-shadow: 0 3px 7px rgba(0, 0, 0, .55);
}

.cpuDifficultyDock input[type="range"]::-moz-range-track { height: 7px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 2px; background: #282c37; }
.cpuDifficultyDock input[type="range"]::-moz-range-progress { height: 7px; background: #ef3340; }
.cpuDifficultyDock input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 2px solid #fff; border-radius: 50%; background: #ef3340; }
.cpuDifficultyDock input[type="range"]:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---- party select compatibility --------------------------------------- */

body.party-mode #roster {
  width: min(94vw, 1100px);
  margin-inline: auto;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  grid-auto-rows: minmax(96px, 1fr);
  padding-block: 11px 16px;
}

body.party-mode .char { min-height: 96px; }
body.party-mode .char:is(.cur1, .cur2, .cur3, .cur4) { transform: translateY(-3px) scale(1.025); }
body.party-mode .char:is(.cur1, .cur2, .cur3, .cur4) .swatch { box-shadow: none !important; }
body.party-mode #fighterPreviewLabel { display: none; }
body.party-mode .selectHeader { min-height: 73px; padding-top: 9px; }
body.party-mode #select .selectHeader h1 { font-size: clamp(26px, 3vw, 42px); }
body.party-mode #partyPlayers { margin-bottom: 5px; }

/* ---- stage select shell ------------------------------------------------ */

#stageSelect {
  --stage-accent: #ffd86a;
  isolation: isolate;
  box-sizing: border-box;
  justify-content: flex-start !important;
  padding: 0 !important;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 80% 16%, rgba(239, 51, 64, .24), transparent 30%),
    linear-gradient(145deg, rgba(39, 8, 14, .97), rgba(7, 8, 15, .985) 52%, rgba(8, 13, 24, .985));
}

#stageSelect::before {
  content: '';
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: .35;
  background: repeating-linear-gradient(120deg, transparent 0 70px, rgba(255, 255, 255, .035) 71px 73px, transparent 74px 144px);
  pointer-events: none;
}

.stageHeader {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(200px, 33vw);
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 82px;
  padding: max(12px, env(safe-area-inset-top)) clamp(16px, 3vw, 44px) 10px;
  box-sizing: border-box;
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  background: linear-gradient(90deg, rgba(4, 5, 10, .82), rgba(4, 5, 10, .25));
}

.stageStep {
  display: grid;
  place-items: center;
  width: 50px;
  height: 56px;
  color: #191108;
  background: linear-gradient(145deg, #fff2a1, #e5a632);
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
  font: 950 italic 24px/1 Arial, sans-serif;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .4);
}

.stageTitleLockup { min-width: 0; }
.stageEyebrow { color: var(--select-gold); font: 900 11px/1 Arial, sans-serif; letter-spacing: 3.2px; }

#stageSelect .stageTitle {
  margin: 4px 0 0;
  color: #fff;
  font: 950 italic clamp(28px, 3.6vw, 51px)/.88 Arial, sans-serif;
  letter-spacing: 2px;
  transform: skewX(-8deg);
  text-shadow: 0 4px 0 #000, 0 0 20px rgba(239, 51, 64, .32);
}

.stageCurrent {
  min-width: 0;
  padding: 9px 12px 9px 16px;
  border-left: 4px solid var(--stage-accent);
  background: linear-gradient(90deg, rgba(255, 255, 255, .08), transparent);
}

.stageCurrent small {
  display: block;
  color: #929daf;
  font: 900 10px/1 Arial, sans-serif;
  letter-spacing: 2px;
}

.stageCurrent b,
.stageCurrent span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stageCurrent b { margin-top: 4px; color: #fff; font: 950 italic 17px/1 Arial, sans-serif; letter-spacing: .8px; }
.stageCurrent span { margin-top: 3px; color: var(--stage-accent); font: 800 11px/1 Arial, sans-serif; letter-spacing: .8px; }

#stageSelect .partyMatchup { flex: 0 0 auto; margin: 7px auto 0; }

.stageGridShell {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  padding: 10px clamp(16px, 3.3vw, 52px) 8px;
  box-sizing: border-box;
}

.stageGridLabel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  min-height: 25px;
  color: #8791a2;
  font: 850 10px/1 Arial, sans-serif;
  letter-spacing: 1.6px;
}

.stageGridLabel strong { color: #e8edf5; font-size: 11px; }

.stageGridLabel .stageLegend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 1.2px;
}

.stageGridLabel .stageLegend b {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  margin-left: 6px;
  padding: 0 4px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 5px;
  color: #14151a;
  background: #f5f7fb;
  box-shadow: 0 2px 0 #747a88;
  font: 950 9px/1 Arial, sans-serif;
  letter-spacing: 0;
}

.stageGridLabel .stageLegend b:first-child { margin-left: 0; }
.stageGridLabel .stageLegend .keyA { border-radius: 50%; color: #05210c; background: #76e990; }
.stageGridLabel .stageLegend .keyB { border-radius: 50%; color: #29090a; background: #ff777d; }

#stageRow {
  flex: 1 1 auto;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  grid-auto-rows: minmax(132px, 1fr);
  gap: clamp(8px, 1vw, 15px) !important;
  width: 100%;
  max-width: 1320px;
  max-height: none;
  min-height: 0;
  margin: 0 auto;
  padding: 4px 5px 12px;
  overflow: auto;
  box-sizing: border-box;
  scroll-snap-type: none;
  animation: select-grid-in .3s ease-out both;
}

#stageRow > .stageCard {
  --stage-card-color: #ffd86a;
  position: relative;
  isolation: isolate;
  width: auto;
  min-width: 0;
  min-height: 132px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 5px;
  background: #0b0c12;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .52), inset 0 1px 0 rgba(255, 255, 255, .08);
  cursor: pointer;
  transform: none;
  transition: transform .14s cubic-bezier(.2, .8, .2, 1), border-color .14s, filter .14s, box-shadow .14s;
  scroll-snap-align: none;
}

#stageRow > .stageCard::before {
  content: '';
  position: absolute;
  z-index: 4;
  inset: -1px;
  border: 4px solid transparent;
  pointer-events: none;
}

#stageRow > .stageCard::after {
  content: '';
  position: absolute;
  z-index: 5;
  left: -32%;
  top: -80%;
  width: 35%;
  height: 260%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: rotate(22deg);
  transition: left .42s ease, opacity .12s;
  pointer-events: none;
}

#stageRow > .stageCard:hover,
#stageRow > .stageCard:focus-visible {
  z-index: 3;
  filter: brightness(1.12) saturate(1.08);
  transform: translateY(-3px) scale(1.015);
  outline: none;
}

#stageRow > .stageCard.is-selected {
  z-index: 4;
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--stage-accent), 0 12px 28px rgba(0, 0, 0, .66), 0 0 22px color-mix(in srgb, var(--stage-accent) 45%, transparent);
  transform: translateY(-5px) scale(1.02);
  filter: brightness(1.13) saturate(1.1);
}

#stageRow > .stageCard.is-selected::before { border-color: rgba(255, 255, 255, .72); }
#stageRow > .stageCard.is-selected::after { left: 120%; opacity: .8; }

.stageThumb {
  position: absolute;
  z-index: 0;
  inset: 0;
  height: auto !important;
  background-position: center;
  background-size: cover;
  filter: saturate(.9) contrast(1.05);
  transition: transform .35s ease, filter .15s;
}

.stageCard:hover .stageThumb,
.stageCard.is-selected .stageThumb { transform: scale(1.045); filter: saturate(1.08) contrast(1.06); }

.stageThumbImage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

.stageThumbImage.is-missing { display: none; }

.stageThumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 5, 9, .02) 20%, rgba(4, 5, 9, .18) 48%, rgba(4, 5, 9, .97) 100%);
}

.stageInfo {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 12px 10px;
  box-sizing: border-box;
  text-align: left;
  background: none !important;
  transform: skewX(-4deg);
}

.stageIndex {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 18px;
  margin-right: 6px;
  padding: 0 4px;
  border: 1px solid rgba(255, 255, 255, .62);
  color: #11131a;
  background: var(--stage-accent);
  font: 950 10px/1 Arial, sans-serif;
  vertical-align: 3px;
}

.stageName {
  display: inline;
  color: #fff;
  font: 950 italic clamp(15px, 1.45vw, 21px)/1 Arial, sans-serif;
  letter-spacing: .7px;
  text-shadow: 0 2px 2px #000;
}

.stageSubtitle {
  margin: 4px 0 0 32px;
  overflow: hidden;
  color: var(--stage-accent);
  font: 800 11px/1 Arial, sans-serif;
  letter-spacing: .8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stageBottom {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vw, 42px);
  width: 100%;
  min-height: 68px;
  padding: 7px clamp(14px, 3vw, 42px) max(8px, env(safe-area-inset-bottom));
  box-sizing: border-box;
  border-top: 1px solid rgba(255, 255, 255, .12);
  background: linear-gradient(180deg, rgba(8, 9, 15, .82), rgba(2, 3, 7, .98));
  box-shadow: 0 -10px 26px rgba(0, 0, 0, .26);
}

#stageSelect .rulesBar { flex: 0 1 auto; margin: 0; gap: 8px; }
#stageSelect .ruleChip { padding: 4px 6px 4px 11px; border-radius: 5px; background: rgba(255, 255, 255, .055); }
#stageSelect .ruleChip .ruleLbl { font-size: 9px; letter-spacing: 1.3px; }
#stageSelect .ruleChip .ruleLbl { font-size: 11px; }
#stageSelect .ruleChip b { min-width: 57px; font-size: 17px; }
#stageSelect .ruleStep { width: 29px; height: 29px; border-radius: 3px; font-size: 16px; }

#stageSelect .stageActions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 480px);
  margin: 0;
}

#stageSelect .stageActions span {
  color: #929bad;
  font: 850 10px/1.2 Arial, sans-serif;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

#stageSelect .stageActions button {
  min-width: 105px;
  min-height: 42px;
  padding: 7px 15px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 4px;
  font: 950 italic 14px/1 Arial, sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  transform: skewX(-6deg);
  transition: transform .1s, filter .1s, box-shadow .1s;
}

#stageSelect .stageActions button:hover,
#stageSelect .stageActions button:focus-visible { filter: brightness(1.16); transform: skewX(-6deg) translateY(-2px); outline: 2px solid #fff; outline-offset: 2px; }
#stageSelect #stageBack { color: #d8deea; background: #232734; border-color: rgba(255, 255, 255, .36); }
#stageSelect #stageFight { min-width: 132px; color: #220e09; background: linear-gradient(135deg, #ff745f, #ef3340); border-color: #fff; box-shadow: 0 6px 18px rgba(239, 51, 64, .35); }
#stageSelect #stageFight:disabled { filter: grayscale(.75); opacity: .5; cursor: not-allowed; }
#stageSelect.is-loading .stageCard,
#stageSelect.is-loading .ruleStep,
#stageSelect.is-loading #stageBack { pointer-events: none; filter: grayscale(.55) brightness(.72); }

/* ---- responsive fighter select ---------------------------------------- */

@media (max-width: 1099px) {
  #roster {
    width: calc(100% - 28px);
    margin-inline: auto;
    grid-template-columns: repeat(6, minmax(78px, 1fr));
  }

  #fighterPreviewLabel { display: none; }
}

@media (max-width: 820px) {
  .selectHeader { min-height: 74px; padding: max(9px, env(safe-area-inset-top)) 15px 8px; }
  .selectStep { width: 42px; min-height: 49px; font-size: 20px; }
  .selectEyebrow { font-size: 10px; letter-spacing: 2.5px; }
  #select .selectHeader h1 { font-size: clamp(25px, 6.2vw, 38px); }
  .selectHeaderMeta { display: none; }
  #roster { grid-template-columns: repeat(4, minmax(76px, 1fr)); grid-auto-rows: minmax(100px, 1fr); padding: 12px 9px 22px; }
  .char { min-height: 100px; }
  body.party-mode #roster { grid-template-columns: repeat(4, minmax(72px, 1fr)); }
  .selectCommandBar { gap: 9px; }
  .selectCommandBar strong { display: inline; font-size: 10px; letter-spacing: .6px; }
  .singlesSetup { gap: 8px; }
  .selectSetupCopy { display: none; }
  .setupBtns { max-height: 33px; overflow: auto; flex-wrap: nowrap; justify-content: flex-start; scrollbar-width: none; }
  .setupBtns::-webkit-scrollbar { display: none; }

  .stageHeader { grid-template-columns: auto minmax(0, 1fr); min-height: 70px; padding: max(9px, env(safe-area-inset-top)) 15px 8px; }
  .stageStep { width: 42px; height: 48px; font-size: 20px; }
  .stageCurrent { display: none; }
  #stageRow { grid-template-columns: repeat(2, minmax(140px, 1fr)); grid-auto-rows: minmax(128px, 1fr); }
  .stageBottom { gap: 8px; padding-inline: 10px; }
  #stageSelect .rulesBar { display: none; }
  #stageSelect .stageActions { width: min(100%, 500px); }
}

@media (max-width: 700px) {
  body:not(.party-mode) #partyPlayers { grid-template-columns: 1fr; width: calc(100% - 18px); gap: 5px; }
  body:not(.party-mode) #partyPlayers .partyPlayer { min-height: 58px; }
  body:not(.party-mode) #partyPlayers .partyPort { width: 48px; height: 48px; }
  body:not(.party-mode) #partyPlayers .partyPlayer { grid-template-columns: 52px minmax(0, 1fr) auto; }
}

/* Compact landscape still has two side-by-side player pods. Put the shared CPU
   rail on a full row so fighter names never collapse to a single letter. */
@media (max-width: 900px), (max-height: 590px) {
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPort { grid-column: 1; grid-row: 1; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPlayerMain { grid-column: 2; grid-row: 1; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPodActions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .selectHeader { min-height: 67px; }
  .selectStep { width: 38px; min-height: 44px; }
  #select .selectHeader h1 { font-size: clamp(22px, 7.5vw, 32px); letter-spacing: .5px; }
  #partyFormatBar { width: calc(100% - 12px); }
  .partyFormatLead { display: none; }
  .partyFormatBtn { min-height: 37px; padding: 5px 8px; }
  .partyFormatBtn span { font-size: 10px; }
  .partyFormatBtn small { display: none; }
  #roster,
  body.party-mode #roster {
    width: 100%;
    grid-template-columns: repeat(3, minmax(82px, 1fr));
    grid-auto-rows: minmax(98px, 1fr);
    gap: 6px;
    padding: 12px 9px 24px;
  }
  .char,
  body.party-mode .char { min-height: 98px; }
  .char .cname { font-size: 12px; }
  .selectHand { width: var(--hand-width, 52px); }
  #selInfo { padding-inline: 7px; }
  .selectCommandBar { justify-content: space-around; margin-inline: -7px; padding-inline: 5px; }
  .selectCommandBar > span:nth-child(3) { display: none; }
  .singlesSetup { min-height: 36px; }
  .setupLabel { display: none; }
  .cpuSetupBlock { gap: 4px; }
  .cpuControls #cpulvl { min-width: 56px; }
  #costumeControls { max-height: none; overflow: visible; flex-wrap: wrap; justify-content: center; gap: 5px; }
  .costumeChip { flex: 1 1 min(285px, 94vw); }
  .setupBtns { max-height: none; overflow: visible; flex-wrap: wrap; justify-content: center; }
  #selInfo .setupBtns button { min-height: 38px; font-size: 11px; }
  #padStatus { display: none; }
  #partyPlayers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:not(.party-mode) #partyPlayers { grid-template-columns: 1fr; width: calc(100% - 14px); gap: 5px; }
  body:not(.party-mode) #partyPlayers .partyPlayer { min-height: 58px; }
  /* Give the draggable CPU rail its own row instead of squeezing the fighter
     name between a portrait and three controls on phone-width screens. */
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPort { grid-column: 1; grid-row: 1; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPlayerMain { grid-column: 2; grid-row: 1; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPodActions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    width: 100%;
  }
  .cpuDifficultyDock { grid-template-columns: minmax(82px, 1fr) auto; width: 100%; min-width: 0; }

  .stageGridShell { padding: 7px 9px 5px; }
  .stageGridLabel { padding-inline: 4px; }
  #stageRow { grid-template-columns: repeat(2, minmax(125px, 1fr)); gap: 8px !important; padding-bottom: 10px; }
  #stageRow > .stageCard { min-height: 120px; }
  .stageInfo { padding: 20px 8px 8px; }
  .stageIndex { display: none; }
  .stageName { font-size: 14px; }
  .stageSubtitle { margin-left: 0; font-size: 10px; }
  #stageSelect .stageActions { grid-template-columns: auto 1fr auto; min-width: 0; }
  #stageSelect .stageActions button { min-width: 84px; min-height: 42px; padding-inline: 9px; }
  #stageSelect #stageFight { min-width: 104px; }
  #stageSelect .stageActions span { font-size: 9px; }
}

/* The legacy party compact-height rule hides pod actions at 590px. Singles
   must retain the CPU slider at every height; the scrolling roster absorbs the
   reduced space without making the setting unreachable. */
@media (max-height: 590px) {
  body:not(.party-mode) .partyPodActions { display: flex; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPodActions { display: grid; }
  #stageSelect .rulesBar { display: none; }
  #stageSelect .stageBottom { justify-content: center; }
  #stageSelect .stageActions { grid-template-columns: auto auto; justify-content: center; width: auto; }
  #stageSelect .stageActions span { display: none; }
  #stageSelect #stageFight { grid-column: 2; }
}

/* Low-height desktop: protect gameplay setup controls without reverting to the
   old oversized two-row cards. */
@media (max-height: 720px) and (min-width: 821px) {
  .selectHeader { min-height: 67px; padding-top: 7px; padding-bottom: 6px; }
  .selectStep { min-height: 47px; width: 43px; font-size: 20px; }
  #select .selectHeader h1 { font-size: clamp(27px, 3.2vw, 40px); }
  #roster { grid-auto-rows: minmax(82px, 1fr); padding-block: 8px 14px; gap: 7px; }
  .char { min-height: 82px; }
  body.party-mode #roster { grid-auto-rows: minmax(76px, 1fr); }
  body.party-mode .char { min-height: 76px; }
  #fighterPreviewLabel { top: 76px; bottom: auto; }
  .selectCommandBar { min-height: 28px; margin-bottom: 3px; }
  .selectCommandBar kbd { min-width: 20px; height: 20px; }
  .singlesSetup { min-height: 32px; }
  .cpuControls { min-height: 27px; }
  .cpuControls button { width: 24px; height: 24px; }
  #p1cpu { width: auto; }
  #selInfo .setupBtns button { min-height: 24px; padding-block: 4px; }
  .stageHeader { min-height: 66px; padding-top: 7px; padding-bottom: 6px; }
  .stageStep { height: 45px; width: 42px; }
  #stageSelect .stageTitle { font-size: clamp(27px, 3vw, 40px); }
  .stageGridShell { padding-top: 6px; }
  #stageRow { grid-auto-rows: minmax(100px, 1fr); gap: 8px !important; }
  #stageRow > .stageCard { min-height: 100px; }
  .stageBottom { min-height: 58px; padding-block: 5px; }
}

@media (max-height: 500px) {
  .selectHeader { min-height: 55px; }
  #select .selectHeader h1 { font-size: 25px; }
  .selectStep { min-height: 38px; width: 35px; font-size: 17px; }
  #roster,
  body.party-mode #roster { grid-auto-rows: minmax(68px, 1fr); padding-block: 6px 10px; }
  .char,
  body.party-mode .char { min-height: 68px; }
  .charCaption { bottom: 5px; }
  .selectCommandBar { display: none; }
  .singlesSetup { min-height: 29px; }
  #padStatus { display: none; }
  .setupBtns { margin-top: 2px; }
  .stageHeader { min-height: 50px; }
  .stageStep { height: 36px; width: 34px; font-size: 16px; }
  #stageSelect .stageTitle { font-size: 25px; }
  .stageGridLabel { display: none; }
  #stageRow { grid-auto-rows: minmax(84px, 1fr); padding-top: 3px; }
  #stageRow > .stageCard { min-height: 84px; }
  .stageBottom { min-height: 47px; }
  #stageSelect .stageActions button { min-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  #roster,
  #stageRow,
  .selectHandBody,
  .screen-enter { animation: none !important; }
  .selectHandBody { transform: translate(-50%, -77%); }
  .char,
  .stageCard,
  .selectHand,
  #matchCurtain { transition-duration: .01ms !important; }
}

/* On a wide screen the roster sits between two live fighter lanes: P1's pick on
   the left, P2's on the right. The lanes stay transparent so the Three.js
   renders read bright, and the roster becomes a dark glass panel between them.
   hud.js measures .selectLane to place each model, so this query is the single
   source of truth for when the lanes exist. */
@media (min-width: 1100px) and (min-height: 540px) and (min-aspect-ratio: 3 / 2) {
  body:not(.party-mode) #select {
    --lane-w: clamp(250px, 24vw, 500px);
    display: grid;
    grid-template-columns: var(--lane-w) minmax(0, 1fr) var(--lane-w);
    /* The pod row keeps the CPU pod's two-row height even when both pods are
       human, so the lanes above never resize (and re-fit the renders) when a
       second player joins. */
    grid-template-rows: auto minmax(0, 1fr) auto minmax(112px, auto) auto;
    background:
      linear-gradient(180deg, rgba(4, 5, 10, .5), rgba(4, 5, 10, .08) 22%, rgba(4, 5, 10, .06) calc(100% - 360px), rgba(3, 4, 8, .93) calc(100% - 330px), rgba(2, 3, 7, .98) 100%),
      linear-gradient(90deg, rgba(3, 4, 9, .6), rgba(3, 4, 9, .12) 9%, rgba(3, 4, 9, 0) 20%, rgba(3, 4, 9, 0) 80%, rgba(3, 4, 9, .12) 91%, rgba(3, 4, 9, .6));
  }

  body:not(.party-mode) .selectHeader {
    grid-column: 1 / -1;
    grid-row: 1;
    background: linear-gradient(90deg, rgba(4, 5, 10, .88), rgba(4, 5, 10, .46) 28%, rgba(4, 5, 10, .46) 72%, rgba(4, 5, 10, .88));
  }

  body:not(.party-mode) #partyFormatBar { display: none; }

  body:not(.party-mode) #roster {
    grid-column: 2;
    grid-row: 2 / 5;
    width: auto;
    margin: 10px 4px 10px;
    padding: clamp(12px, 1.6vh, 18px) clamp(10px, 1.1vw, 16px) 24px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(8, 9, 15, .9), rgba(5, 6, 11, .95));
    box-shadow: 0 22px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
  }

  body:not(.party-mode) .selectLane { display: block; grid-row: 2; }
  body:not(.party-mode) .selectShowcase { display: grid; grid-row: 3; }

  body:not(.party-mode) .selectLane[data-slot="0"],
  body:not(.party-mode) .selectShowcase[data-slot="0"],
  body:not(.party-mode) #partyPlayers .partyPlayer[data-player-slot="0"] { grid-column: 1; }

  body:not(.party-mode) .selectLane[data-slot="1"],
  body:not(.party-mode) .selectShowcase[data-slot="1"],
  body:not(.party-mode) #partyPlayers .partyPlayer[data-player-slot="1"] { grid-column: 3; }

  body:not(.party-mode) .selectLane.is-off,
  body:not(.party-mode) .selectShowcase.is-off { display: none; }

  /* Player pods drop under their own lane: who drives the port, CPU level, controls. */
  body:not(.party-mode) #partyPlayers { display: contents; }

  body:not(.party-mode) #partyPlayers .partyPlayer {
    grid-row: 4;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 50px;
    margin: 0 10px 8px;
    padding: 5px 7px 5px 6px;
    border-radius: 0 0 6px 6px;
  }

  body:not(.party-mode) #partyPlayers .partyPort { width: 38px; height: 38px; }
  body:not(.party-mode) #partyPlayers .partyPort::after { min-width: 21px; padding: 2px 3px; font-size: 8px; }
  body:not(.party-mode) #partyPlayers .partyFighter { display: none; }
  body:not(.party-mode) #partyPlayers .partyState { color: #e3e9f4; font-size: 11px; letter-spacing: 1px; }
  body:not(.party-mode) #partyPlayers .partyPlayer.is-ready::before { display: none; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty { grid-template-columns: auto minmax(0, 1fr); }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPort { grid-column: 1; grid-row: 1; }
  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPlayerMain { grid-column: 2; grid-row: 1; }

  body:not(.party-mode) #partyPlayers .partyPlayer.has-cpu-difficulty .partyPodActions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    width: 100%;
  }

  body:not(.party-mode) .cpuDifficultyDock { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr) auto; }

  /* Footer: one strip. Commands left, setup buttons right, pad/wizard lines below. */
  body:not(.party-mode) #selInfo {
    grid-column: 1 / -1;
    grid-row: 5;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 18px;
    padding: 5px clamp(14px, 1.8vw, 30px) max(7px, env(safe-area-inset-bottom));
  }

  body:not(.party-mode) .selectCommandBar {
    grid-column: 1;
    min-height: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    justify-content: flex-start;
  }

  body:not(.party-mode) #costumeControls { display: none; }
  body:not(.party-mode) .setupBtns { grid-column: 2; margin: 0; justify-content: flex-end; flex-wrap: wrap; }
  body:not(.party-mode) .setupBtns button,
  body.party-mode .setupBtns button { white-space: nowrap; }
  body:not(.party-mode) #padStatus,
  body:not(.party-mode) #wizPrompt { grid-column: 1 / -1; }
  body:not(.party-mode) #padStatus { max-height: 26px; margin-top: 0; text-align: left; }

  /* Narrower lanes (720p, laptops): the hero name steps down before it truncates. */
  @media (max-width: 1500px) {
    body:not(.party-mode) .showcaseName { font-size: clamp(18px, 2vw, 42px); }
    body:not(.party-mode) .showcasePort { min-width: 40px; height: 40px; font-size: 14px; }
  }

  /* Online quick play: the picker owns only P1's seat. The second panel holds
     the opponent's place until matchmaking fills it. */
  body.online-pick .selectLane.is-opponent .laneWatermark {
    left: 50%;
    right: auto;
    top: 50%;
    color: rgba(255, 255, 255, .12);
    font-size: clamp(170px, 20vw, 360px);
    transform: translate(-50%, -54%) skewX(-10deg);
  }
  body.online-pick .selectLane.is-opponent::after { opacity: .45; }
  body.online-pick .selectShowcase.is-opponent .showcaseName { color: #b7c4dc; }
  body.online-pick .selectShowcase.is-opponent .showcasePort { font-size: 20px; }

}

/* Fitted roster (set by hud.js whenever the tiles can stay legible): every
   tile is on screen, so tiles shrink to their cell instead of forcing a scroll. */
body.roster-fitted #roster,
body.roster-fitted.party-mode #roster { overflow: hidden; align-content: stretch; }
body.roster-fitted .char,
body.roster-fitted.party-mode .char { min-height: 0; }
body.roster-fitted .char .cname { font-size: clamp(9px, calc(var(--roster-cell, 120px) * .12), 15px); }
body.roster-fitted .charNumber { font-size: clamp(7px, calc(var(--roster-cell, 120px) * .085), 10px); }
body.roster-fitted .charCaption { left: 6px; right: 6px; bottom: 6px; }

/* MY MUSIC — deliberate playback, collection browser and listening panel. */
#musicSelect {
  --music-accent: #ffd86a;
  position: fixed; z-index: 70; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box; color: #f1f4fa; font-family: Arial, sans-serif;
  background: radial-gradient(ellipse at 75% 12%, #29202bdd, #07090ff5 65%); backdrop-filter: blur(12px);
  animation: music-fade-in .18s ease-out both;
}
#musicSelect *, #musicSelect *::before, #musicSelect *::after { box-sizing: border-box; }
#musicSelect [hidden] { display: none !important; }
#musicSelect button, #musicSelect input { font-family: inherit; }
#musicSelect button { touch-action: manipulation; }
#musicSelect button:focus-visible, #musicSelect input:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#musicSelect button:disabled { opacity: .4; cursor: default; }
#musicSelect svg { display: block; width: 24px; height: 24px; }
body.music-open #touchControls, body.music-open #seatStrip { display: none !important; }
.musicSrOnly { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.musicSheet {
  display: flex; flex-direction: column; position: relative; width: min(1320px, 100%); height: min(860px, 100%);
  min-height: 0; overflow: hidden; border: 1px solid #ffffff24; border-radius: 20px;
  background: #10131b; box-shadow: 0 30px 100px #0009; animation: music-sheet-in .25s ease-out both;
}
.musicSheet:focus { outline: none; }
@keyframes music-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes music-sheet-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.musicHeader {
  position: relative; flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px;
  padding: 22px 28px 24px; border-bottom: 1px solid #ffffff13;
  background: radial-gradient(ellipse at 85% 0, color-mix(in srgb, var(--music-accent) 12%, transparent), transparent 62%), #151820;
}
.musicBrand { display: flex; align-items: center; gap: 9px; }
.musicGlyph { display: grid; place-items: center; width: 30px; height: 30px; color: var(--music-accent); }
.musicGlyph svg, .musicPlayerIcon svg, .musicRecordLabel svg { fill: none; stroke: currentColor; stroke-width: 1.8; }
.musicEyebrow { color: var(--music-accent); font-size: 12px; font-weight: 800; letter-spacing: 2.5px; }
.musicClose { align-self: start; width: 36px; height: 36px; border: 1px solid #ffffff21; border-radius: 50%; color: #bac4d4; background: #ffffff05; cursor: pointer; font-size: 16px; }
.musicClose:hover { color: #fff; background: #ffffff12; }
.musicTitleLockup { min-width: 0; }
.musicTitleLockup > small { color: #a5adbc; font-size: 9px; font-weight: 700; letter-spacing: 2px; }
#musicSelect .musicTitle { margin: 5px 0 7px; color: #fff; font-size: clamp(25px, 3vw, 39px); font-weight: 900; line-height: 1.05; letter-spacing: -.7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.musicTitleLockup p { margin: 0; color: #aab2c2; font-size: 13px; line-height: 1.4; }
.musicDestinationInfo { align-self: end; text-align: right; padding-bottom: 3px; }
.musicSaved { display: inline-flex; gap: 7px; align-items: center; padding: 6px 10px; border: 1px solid #90d5a324; border-radius: 6px; background: #90d5a309; color: #a1dcb3; font-size: 9px; letter-spacing: 1.2px; font-weight: 700; }
.musicSaved i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.musicSummary { margin-top: 10px; color: #b6bece; font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.musicBody { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr) 280px; }
.musicRailShell { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #ffffff12; background: #0c0f16; }
.musicRailLabel { padding: 23px 20px 14px; color: #9aa6b9; font-size: 9px; font-weight: 700; letter-spacing: 2px; }
.musicRail { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 3px; padding: 0 10px 14px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; overscroll-behavior: contain; }
.musicRailItem { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #aab3c4; text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .45px; cursor: pointer; transition: background .15s, color .15s; }
.musicRailItem i { flex: 0 0 auto; width: 5px; height: 5px; background: var(--rail-color); border-radius: 50%; opacity: .6; }
.musicRailItem span { flex: 1; min-width: 0; }
.musicRailItem small { flex: 0 0 auto; color: #a5aec0; font-size: 10px; font-variant-numeric: tabular-nums; }
.musicRailItem:hover { background: #ffffff07; color: #fff; }
.musicRailItem.is-selected { color: #fff; border-color: color-mix(in srgb, var(--rail-color) 22%, transparent); background: color-mix(in srgb, var(--rail-color) 10%, transparent); }
.musicRailItem.is-selected i { opacity: 1; }
.musicRailItem.is-selected small { color: var(--rail-color); }
.musicListShell { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #10131b; }
.musicLibraryTools { padding: 20px 20px 16px; flex: 0 0 auto; }
.musicSearch { display: flex; align-items: center; gap: 10px; padding: 0 13px; min-height: 44px; border: 1px solid #ffffff20; border-radius: 9px; color: #9ca6b9; background: #080a1050; }
.musicSearch:focus-within { border-color: var(--music-accent); }
.musicSearch svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; }
.musicSearch input { width: 100%; min-width: 0; padding: 10px 0; border: 0; outline: 0; color: #eff3fb; background: transparent; font-size: 12px; }
.musicSearch input::placeholder { color: #9ca5b6; }
.musicListHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 24px 13px; border-bottom: 1px solid #ffffff10; }
.musicListHead > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.musicListHead [data-list-label] { color: #dae0ec; font-size: 10px; font-weight: 700; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.musicListHead strong { flex: 0 0 auto; font-size: 10px; font-weight: 400; color: #9ea9bd; }
.musicRotationLabel { color: #a1abbd; font-size: 8px; font-weight: 700; letter-spacing: 1px; }
.musicList { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 10px 10px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #ffffff30 transparent; }
.musicRow { display: grid; grid-template-columns: 24px 36px minmax(0, 1fr) 40px 54px; align-items: center; gap: 9px; min-height: 66px; padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; transition: background .12s; }
.musicRow + .musicRow { margin-top: 2px; }
.musicRow:hover { background: #ffffff05; }
.musicRow.is-selected { border-color: color-mix(in srgb, var(--music-accent) 20%, transparent); background: color-mix(in srgb, var(--music-accent) 7%, transparent); }
.musicRow.is-playing { background: color-mix(in srgb, var(--music-accent) 12%, transparent); }
.musicRowNum { color: #9aa5b9; font-size: 10px; font-variant-numeric: tabular-nums; text-align: center; }
.musicRowPlay { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #ffffff22; border-radius: 50%; background: #ffffff04; color: #bbc5d7; cursor: pointer; }
.musicRowPlay svg { width: 17px; height: 17px; fill: currentColor; }
.musicRowPlay:hover, .musicRow.is-playing .musicRowPlay { color: #14151a; background: var(--music-accent); border-color: var(--music-accent); }
.musicRowMain { display: block; min-width: 0; padding: 6px 0; border: 0; text-align: left; background: none; cursor: pointer; }
.musicRowMain b { display: block; overflow: hidden; color: #eef1f8; font-size: 13px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.musicRowMain small { display: block; margin-top: 4px; overflow: hidden; color: #a3aec1; font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.musicRow.is-playing .musicRowMain b { color: var(--music-accent); }
.musicRowTime { color: #a7b1c4; font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.musicRowPill { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 0 7px; border: 1px solid #ffffff24; border-radius: 6px; background: transparent; color: #a6b0c2; font-size: 9px; font-weight: 700; cursor: pointer; }
.musicRowPill i, .musicRowPill em { font-style: normal; }
.musicRowPill i { font-size: 12px; }
.musicRow.is-on .musicRowPill { color: var(--music-accent); border-color: color-mix(in srgb, var(--music-accent) 30%, transparent); background: color-mix(in srgb, var(--music-accent) 9%, transparent); }
.musicRowPill:hover { border-color: #fff; }
.musicEmpty { padding: 35px 25px; text-align: center; }
.musicEmpty > span { display: grid; place-items: center; width: 52px; height: 52px; margin: auto; border-radius: 50%; background: #ffffff06; color: #b0bbce; }
.musicEmpty svg { fill: none; stroke: currentColor; stroke-width: 1.5; }
.musicEmpty h3 { margin: 15px 0 8px; font-size: 17px; }
.musicEmpty p { color: #abb6c9; font-size: 12px; line-height: 1.6; }
.musicEmpty button { padding: 11px 18px; border: 1px solid #ffffff25; border-radius: 7px; background: #ffffff08; color: #fff; cursor: pointer; }
.musicListening { min-height: 0; padding: 20px; border-left: 1px solid #ffffff12; background: linear-gradient(170deg, #181d28, #12151e 65%); overflow-y: auto; scrollbar-width: thin; }
.musicArtwork { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid #ffffff1c; border-radius: 12px; background: radial-gradient(ellipse at 100% 0, color-mix(in srgb, var(--cover-accent) 40%, #17202e), #18222b 58%, #0b101a); box-shadow: 0 10px 22px #0004; }
.musicArtwork::after { position: absolute; content: ''; inset: 0; background: linear-gradient(120deg, #ffffff09, transparent 50%); pointer-events: none; }
.musicArtLabel { position: absolute; top: 15px; left: 15px; font-size: 7px; font-weight: 700; letter-spacing: 1.2px; color: #ffffffb3; }
.musicArtCategory { position: absolute; bottom: 15px; left: 15px; right: 15px; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
.musicRecord { display: grid; place-items: center; position: absolute; width: 76%; aspect-ratio: 1; top: 15%; left: 18%; border-radius: 50%; background: repeating-radial-gradient(circle, #151820 0 2px, #242832 3px, #11151c 4px 6px); box-shadow: 5px 9px 18px #0008; }
.musicRecord::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(transparent 15%, #ffffff13, transparent 45%, #ffffff12, transparent 90%); }
.musicRecordLabel { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 40%; aspect-ratio: 1; border-radius: 50%; color: #192126; background: var(--cover-accent); }
.musicRecordLabel span { font-size: 7px; font-weight: 800; letter-spacing: 1px; }
.musicArtwork.is-playing .musicRecord { animation: music-record-spin 14s linear infinite; }
@keyframes music-record-spin { to { transform: rotate(360deg); } }
.musicSelectionText { padding: 20px 0 15px; }
.musicSelectionText > small { color: #a4b0c5; font-size: 8px; font-weight: 700; letter-spacing: 1.7px; }
.musicSelectionText h3 { margin: 7px 0; color: #fff; font-size: 20px; line-height: 1.2; letter-spacing: -.4px; overflow-wrap: anywhere; }
.musicSelectionText p { margin: 0; color: #b8c2d4; font-size: 12px; line-height: 1.5; }
.musicSelectionText > span { display: block; margin-top: 3px; color: #a3aec2; font-size: 10px; line-height: 1.5; }
.musicTrackFacts { display: flex; justify-content: space-between; gap: 8px; margin-top: 13px; padding-top: 11px; border-top: 1px solid #ffffff15; color: #abb8cb; font-size: 8px; letter-spacing: .8px; line-height: 1.3; }
.musicTrackFacts span:last-child { font-variant-numeric: tabular-nums; }
.musicPreviewBtn { width: 100%; display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 46px; padding: 10px; border: 0; border-radius: 8px; background: var(--music-accent); color: #14161b; font-size: 12px; font-weight: 800; cursor: pointer; transition: filter .12s; }
.musicPreviewBtn:hover { filter: brightness(1.1); }
.musicPreviewBtn svg { width: 17px; height: 17px; fill: currentColor; }
.musicPreviewBtn kbd { margin-left: auto; border: 1px solid #14161b50; background: #ffffff20; }
.musicSelectionToggle { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 8px; min-height: 44px; margin-top: 9px; padding: 8px 11px; border: 1px solid #ffffff25; border-radius: 8px; color: #b4bfd3; background: #ffffff03; font-size: 11px; font-weight: 700; cursor: pointer; }
.musicSelectionToggle.is-on { color: #e4eaf5; }
.musicSwitch { width: 28px; height: 16px; padding: 3px; border-radius: 9px; background: #515968; }
.musicSwitch i { display: block; width: 10px; height: 10px; border-radius: 50%; background: #eef1f8; transition: transform .15s; }
.musicSelectionToggle.is-on .musicSwitch { background: var(--music-accent); }
.musicSelectionToggle.is-on .musicSwitch i { background: #171920; transform: translateX(12px); }
.musicListenHint { margin: 12px 3px 0; color: #a5b1c6; font-size: 10px; line-height: 1.5; text-align: center; }
.musicNoSelection { padding: 35px 5px; color: #abb6c9; font-size: 13px; line-height: 1.6; }
.musicPlayer { flex: 0 0 auto; display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(140px, 25%) 36px; gap: 15px; align-items: center; padding: 15px 25px; border-top: 1px solid #ffffff18; background: #191e29; }
.musicPlayerIcon { display: grid; place-items: center; width: 40px; height: 40px; color: #a3b0c5; background: #ffffff06; border: 1px solid #ffffff1a; border-radius: 9px; }
.musicPlayer.is-live .musicPlayerIcon { color: var(--music-accent); }
.musicNow { min-width: 0; }
.musicNow small { display: block; margin-bottom: 4px; color: #adbacf; font-size: 8px; font-weight: 700; letter-spacing: 1.6px; }
.musicPlayer.is-live .musicNow small { color: var(--music-accent); }
.musicNow b, .musicNow > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.musicNow b { color: #f1f4fa; font-size: 12px; line-height: 1.4; }
.musicNow > span { color: #acb7ca; font-size: 10px; line-height: 1.4; margin-top: 2px; }
.musicProgress { height: 4px; border-radius: 3px; overflow: hidden; background: #ffffff1a; }
.musicProgress i { display: block; height: 100%; background: var(--music-accent); transform: scaleX(0); transform-origin: left; }
.musicTimeline > span { display: block; margin-top: 8px; color: #afbacd; font-size: 9px; text-align: right; font-variant-numeric: tabular-nums; }
.musicPlayerStop { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #ffffff20; border-radius: 50%; color: #c4cdde; background: transparent; cursor: pointer; }
.musicPlayerStop svg { fill: currentColor; width: 16px; height: 16px; }
.musicFooter { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 18px; padding: 13px 25px 12px; border-top: 1px solid #ffffff12; background: #0c1018; }
.musicHint { color: #b0bace; font-size: 11px; line-height: 1.5; }
.musicHint[data-tone="good"] { color: #a1dcb3; }
.musicHint[data-tone="warn"] { color: #ffd86a; }
.musicActions { display: flex; gap: 8px; }
.musicActions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 11px; border: 1px solid #ffffff24; border-radius: 7px; background: #ffffff05; color: #d2dbeb; font-size: 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.musicActions button:hover { background: #ffffff10; color: #fff; }
#musicSelect kbd { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid #ffffff33; border-radius: 4px; color: inherit; font: 700 9px/1 Arial, sans-serif; }
.musicKeyHelp { grid-column: 1 / -1; display: flex; gap: 14px; color: #9faabf; font-size: 8px; letter-spacing: .4px; }
@media (max-width: 1120px) {
  .musicBody { grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: auto minmax(0, 1fr); }
  .musicRailShell { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid #ffffff12; }
  .musicRailLabel { display: none; }
  .musicRail { flex-direction: row; padding: 8px 16px; overflow-x: auto; overflow-y: hidden; }
  .musicRailItem { white-space: nowrap; min-height: 36px; }
  .musicListening { padding: 17px; }
  .musicHeader { padding: 17px 24px 20px; gap: 10px; }
}
@media (max-width: 760px) {
  #musicSelect { padding: 10px; }
  .musicSheet { border-radius: 14px; }
  .musicHeader { padding: 14px 16px; gap: 7px; }
  .musicEyebrow { font-size: 10px; }
  .musicTitleLockup { grid-column: 1 / -1; }
  .musicTitleLockup > small, .musicTitleLockup p { display: none; }
  #musicSelect .musicTitle { font-size: 26px; margin: 0; }
  .musicDestinationInfo { grid-column: 1 / -1; text-align: left; display: flex; gap: 10px; align-items: center; }
  .musicSaved { padding: 4px 6px; font-size: 7px; }
  .musicSummary { margin: 0; font-size: 8px; letter-spacing: .3px; }
  .musicBody { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .musicRail { padding: 7px 10px; }
  .musicLibraryTools { padding: 12px 12px 10px; }
  .musicListHead { padding: 0 15px 10px; }
  .musicList { padding: 4px 5px 8px; }
  .musicRow { grid-template-columns: 36px minmax(0, 1fr) 32px 48px; gap: 7px; padding: 7px; min-height: 60px; }
  .musicRowNum { display: none; }
  .musicRowPlay { width: 36px; height: 44px; border-radius: 8px; }
  .musicRowMain { min-height: 44px; }
  .musicRowMain b { font-size: 12px; }
  .musicRowMain small { font-size: 9px; }
  .musicRowPill { min-height: 44px; padding: 0 5px; }
  .musicRowPill i { display: none; }
  .musicListening { padding: 10px 14px; border-left: 0; border-top: 1px solid #ffffff14; overflow: visible; }
  [data-music-selection] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .musicArtwork, .musicSelectionText > small, .musicTrackFacts, .musicListenHint { display: none; }
  .musicSelectionText { grid-column: 1 / -1; min-width: 0; padding: 0; }
  .musicSelectionText h3 { display: inline; font-size: 14px; margin: 0; }
  .musicSelectionText p { display: inline; margin-left: 8px; font-size: 10px; }
  .musicSelectionText > span { display: none; }
  .musicSelectionToggle { margin-top: 0; min-height: 44px; padding: 8px; font-size: 10px; }
  .musicPreviewBtn { min-height: 44px; font-size: 11px; }
  .musicPreviewBtn kbd { display: none !important; }
  .musicPlayer { grid-template-columns: minmax(0, 1fr) 85px 36px; gap: 10px; padding: 11px 14px; }
  .musicPlayerIcon { display: none; }
  .musicNow > span { display: none; }
  .musicPlayerStop { height: 44px; }
  .musicFooter { grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 9px 12px max(10px, env(safe-area-inset-bottom)); }
  .musicHint { font-size: 10px; }
  .musicActions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .musicActions button { min-height: 44px; padding: 7px 5px; font-size: 9px; gap: 4px; }
  .musicKeyHelp { display: none; }
}
@media (max-height: 660px) and (min-width: 761px) {
  #musicSelect { padding: 10px; }
  .musicHeader { padding: 12px 20px; gap: 6px; }
  .musicTitleLockup p { display: none; }
  #musicSelect .musicTitle { font-size: 26px; margin: 4px 0 0; }
  .musicArtwork { display: none; }
  .musicSelectionText { padding: 2px 0 16px; }
  .musicPlayer { padding: 10px 20px; }
  .musicFooter { padding: 8px 20px; }
  .musicKeyHelp { display: none; }
}
@media (max-height: 530px) {
  .musicListening { display: none; }
  .musicBody { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .musicRailShell { grid-column: 1; }
  .musicRailLabel { display: none; }
  .musicRail { flex-direction: row; padding: 4px 10px; overflow-x: auto; overflow-y: hidden; }
  .musicHeader { padding: 9px 16px; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .musicTitleLockup { grid-column: 2; grid-row: 1; }
  #musicSelect .musicTitle { font-size: 21px; margin: 0; }
  .musicTitleLockup > small, .musicTitleLockup p, .musicDestinationInfo { display: none; }
  .musicClose { grid-column: 3; grid-row: 1; width: 32px; height: 32px; }
  .musicLibraryTools { padding: 7px 12px; }
  .musicSearch { min-height: 36px; }
  .musicListHead { padding-bottom: 6px; }
  .musicPlayer { padding-block: 8px; }
  .musicFooter { padding-block: 7px; }
  .musicHint, .musicKeyHelp { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #musicSelect, .musicSheet, .musicArtwork.is-playing .musicRecord { animation: none !important; }
  #musicSelect * { transition: none !important; }
}


/* ---- the stage-select entry chips --------------------------------------- */
#stageSelect .stageRulesBtn,
#stageSelect .stageMusicBtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid color-mix(in srgb, var(--stage-accent) 62%, transparent);
  border-radius: 18px;
  background: rgba(8, 10, 20, .82);
  color: var(--stage-accent);
  font: 900 10.5px/1 Arial, sans-serif;
  letter-spacing: 1.5px;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter .12s, transform .1s;
}

#stageSelect .stageRulesBtn:hover,
#stageSelect .stageMusicBtn:hover { filter: brightness(1.25); }
#stageSelect .stageRulesBtn:active,
#stageSelect .stageMusicBtn:active { transform: scale(.96); }
#stageSelect .stageRulesBtn:focus-visible,
#stageSelect .stageMusicBtn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
#stageSelect .stageRulesBtn b,
#stageSelect .stageMusicBtn b { color: #fff; font: 950 italic 11px/1 Arial, sans-serif; }

/* The button prompt is a keycap, not more label text. */
#stageSelect .stageRulesBtn small,
#stageSelect .stageMusicBtn small {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border: 1px solid rgba(255, 255, 255, .38);
  border-radius: 4px;
  color: #fff;
  font: 900 9.5px/1 Arial, sans-serif;
  letter-spacing: 0;
}

#stageSelect .stageMusicBtn:disabled { border-color: rgba(255, 255, 255, .16); color: #6b7488; cursor: default; }
#stageSelect .stageMusicBtn:disabled b { color: #8b94a6; }
#stageSelect .stageMusicBtn:disabled small { border-color: rgba(255, 255, 255, .16); color: #8b94a6; }

/* ---- controller seats (js/seat-ui.js): who is playing, who is waiting, join/leave toasts ---- */
#seatStrip {
  position: fixed; z-index: 58; display: none; flex-direction: column; align-items: flex-end; gap: 5px;
  right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom));
  pointer-events: none; font-family: Arial, sans-serif; user-select: none;
}
#seatStrip.is-visible { display: flex; }
#seatStrip .seatRow { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(8, 10, 24, .82);
  border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 6px 18px rgba(0, 0, 0, .5); backdrop-filter: blur(4px); }
#seatStrip .seatChip { --seat: #fff; display: flex; align-items: center; gap: 5px; min-width: 0; padding: 3px 8px 3px 4px;
  border-radius: 9px; border: 1px solid transparent; background: rgba(255, 255, 255, .05); color: #8c97ad;
  font: 900 9px/1 Arial, sans-serif; letter-spacing: .8px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
#seatStrip .seatChip[hidden] { display: none; }
#seatStrip .seatChip b { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%;
  background: color-mix(in srgb, var(--seat) 38%, #1b2038); color: #fff; font-size: 9px; letter-spacing: 0; }
#seatStrip .seatChip[data-slot="2"] b { color: #fff6cf; }
#seatStrip .seatChip[data-state="playing"] { color: #fff; border-color: color-mix(in srgb, var(--seat) 70%, transparent);
  background: color-mix(in srgb, var(--seat) 16%, rgba(255, 255, 255, .04)); }
#seatStrip .seatChip[data-state="playing"] b { background: var(--seat); color: #101426; }
#seatStrip .seatChip[data-state="waiting"] { color: #cfd7e8; border-style: dashed; border-color: rgba(255, 255, 255, .34); }
#seatStrip .seatChip[data-state="open"] { color: #ffd257; border-style: dashed; border-color: rgba(255, 210, 87, .55); animation: seat-open-pulse 1.4s ease-in-out infinite; }
#seatStrip .seatMore { max-width: min(380px, 80vw); text-align: right; color: #ffd257; font: 900 9px/1.3 Arial, sans-serif;
  letter-spacing: 1.2px; text-shadow: 0 1px 3px #000; }
#seatStrip .seatMore[hidden] { display: none; }
@keyframes seat-open-pulse { 50% { background: rgba(255, 210, 87, .14); } }
#seatToasts { position: fixed; z-index: 62; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.seatToast { padding: 9px 16px; border-radius: 999px; background: rgba(10, 12, 28, .94); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; font: 900 italic 12px/1.2 Arial, sans-serif; letter-spacing: 1.4px; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
  animation: seat-toast-in .22s cubic-bezier(.2, .9, .3, 1.2) both; }
.seatToast.join { border-color: #6fe86f; box-shadow: 0 8px 24px rgba(0, 0, 0, .55), 0 0 0 3px rgba(111, 232, 111, .18); }
.seatToast.leave { border-color: #ff7a7a; box-shadow: 0 8px 24px rgba(0, 0, 0, .55), 0 0 0 3px rgba(255, 122, 122, .18); }
.seatToast.wait { border-color: #ffd257; }
.seatToast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }
@keyframes seat-toast-in { from { opacity: 0; transform: translateY(-10px) scale(.96); } }
/* On the select screens the bottom bar is busy: the strip rides the top-right, names collapse to the port bubbles. */
#seatStrip[data-screen="select"] { bottom: auto; top: calc(max(8px, env(safe-area-inset-top)) + 72px); flex-direction: row-reverse; align-items: center; }
#seatStrip[data-screen="select"] .seatChip span { display: none; }
#seatStrip[data-screen="select"] .seatChip { padding-right: 4px; }
#seatStrip[data-screen="select"] .seatChip[data-state="open"]::after { content: 'OPEN'; font-size: 8px; }
#seatStrip[data-screen="select"] .seatMore { max-width: 250px; font-size: 8px; text-align: right; }
#pauseMenu.seat-vacant .pauseEyebrow { color: #ff9a9a; }
@media (max-width: 720px) { #seatStrip .seatChip span { display: none; } #seatStrip .seatChip { padding-right: 4px; } .seatToast { font-size: 11px; padding: 8px 12px; } }
@media (prefers-reduced-motion: reduce) { #seatStrip .seatChip[data-state="open"], .seatToast { animation: none; } }

/* Party selection: the roster gets the space; each seat keeps its own dock.
   Team columns are projected from sel.teamSlots, never from player numbers. */
body.party-mode #select {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: auto minmax(0, 1.65fr) minmax(90px, 1fr) auto 86px auto;
  gap: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(5, 8, 17, .97), rgba(5, 8, 17, .7) 47%, rgba(5, 8, 17, .08) 65%, rgba(5, 8, 17, .98));
}
body.party-mode .selectHeader {
  grid-column: 1 / -1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 76px;
  gap: 20px;
  padding: max(10px, env(safe-area-inset-top)) 24px 10px;
  background: #0b101c;
  border-bottom: 1px solid rgba(255,255,255,.14);
}
body.party-mode .selectStep { display: none; }
body.party-mode .selectHeadingLockup { padding-left: 0; display: block; }
body.party-mode .selectEyebrow { color: #a7b5cb; font-size: 10px; letter-spacing: 3px; }
body.party-mode #select .selectHeader h1 { margin-top: 5px; font-size: clamp(23px, 2.5vw, 38px); letter-spacing: 1px; transform: none; }
body.party-mode .selectHeaderMeta { grid-column: 3; grid-row: 1; gap: 8px; }
body.party-mode #selectPhase { font-size: 11px; letter-spacing: .9px; text-align: right; }
body.party-mode .selectNavLegend { font-size: 9px; letter-spacing: .5px; }
body.party-mode .selectNavLegend b { margin-left: 4px; }
body.party-mode #partyFormatBar {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  margin: 0;
  padding: 4px;
  gap: 4px;
  border-radius: 8px;
  background: #141d2e;
  box-shadow: none;
}
body.party-mode .partyFormatBtn { flex: initial; min-height: 38px; padding: 8px 16px; border-radius: 5px; font-style: normal; letter-spacing: .6px; }
body.party-mode .partyFormatBtn span { font-size: 11px; }
body.party-mode .partyFormatBtn small { display: none; }
body.party-mode .partyFormatBtn[aria-pressed="true"] { transform: none; background: #e63d4e; box-shadow: 0 2px 8px #0005; }
body.party-mode .partyFormatBtn[data-party-format="teams"][aria-pressed="true"] { background: #596de6; }
body.party-mode #roster {
  grid-column: 1 / -1;
  grid-row: 2;
  width: auto;
  margin: 10px 16px 8px;
  padding: 9px;
  gap: 7px;
  border: 1px solid #3c4659;
  border-radius: 8px;
  background: #0c111c;
  box-shadow: inset 0 1px 0 #ffffff0a;
  animation: none;
}
body.party-mode .char { border-radius: 5px; box-shadow: none; }
body.party-mode .char:is(.cur1,.cur2,.cur3,.cur4), body.party-mode .char:hover, body.party-mode .char:focus-visible { transform: none; }
body.party-mode .char::after { height: 3px; box-shadow: none; }
body.party-mode .char .cname { font-style: normal; font-weight: 900; line-height: 1.1; overflow-wrap: normal; text-shadow: 0 1px 3px #000; }
body.party-mode .char .tag { min-width: 21px; height: auto; padding: 2px 4px; font-size: 8px; }
body.party-mode .char .tagP1 { left: 2px; top: 2px; }
body.party-mode .char .tagP2 { right: 2px; top: 2px; }
body.party-mode .char .tagP3 { left: 2px; top: auto; bottom: 2px; }
body.party-mode .char .tagP4 { right: 2px; top: auto; bottom: 2px; }
body.party-mode .selectLane {
  display: block;
  grid-row: 3;
  grid-column: var(--select-column);
  min-height: 0;
  margin-inline: 8px;
  box-shadow: none;
  border-top: 2px solid var(--port);
  background: linear-gradient(180deg, color-mix(in srgb, var(--port) 9%, transparent), transparent 70%);
}
body.party-mode .selectLane::before { opacity: .3; }
body.party-mode .selectLane .laneWatermark { left: 12px; right: auto; font-size: clamp(65px, 8vw, 135px); opacity: .55; }
body.party-mode .selectShowcase {
  display: grid;
  grid-row: 4;
  grid-column: var(--select-column);
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0 8px;
  padding: 10px 12px 8px;
  column-gap: 8px;
  border: 1px solid #ffffff25;
  border-top: 3px solid var(--port);
  border-radius: 7px 7px 0 0;
  box-shadow: none;
  background: #0c111df5;
}
body.party-mode .selectShowcase::before { opacity: .45; }
body.party-mode .showcasePort { display: none; }
body.party-mode .showcaseEyebrow { color: var(--port); font-size: 9px; letter-spacing: 1px; }
body.party-mode .showcaseName { margin-top: 4px; font-size: clamp(17px, 1.55vw, 28px); line-height: 1.1; transform: none; text-shadow: none; }
body.party-mode .showcaseMeta { display: none; }
body.party-mode .showcaseState { position: static; align-self: start; grid-column: 2; grid-row: 1; padding: 5px 6px; max-width: 100px; font: 800 9px/1.2 Arial,sans-serif; letter-spacing: .3px; transform: none; box-shadow: none; text-align: center; }
body.party-mode .showcaseSkin { margin-top: 7px; padding: 0; }
body.party-mode .showcaseSkin .costumeChip { min-height: 32px; padding: 0; grid-template-columns: 32px minmax(0, 1fr) 32px; border: 0; background: #ffffff08; }
body.party-mode .showcaseSkin .costumeChip > small { display: none; }
body.party-mode .showcaseSkin .costumeChip button { width: 32px; height: 32px; font-size: 22px; }
body.party-mode .costumeName { font-size: 10px; }
body.party-mode #partyPlayers { display: contents; }
body.party-mode #partyPlayers .partyPlayer {
  grid-column: var(--select-column);
  grid-row: 5;
  min-width: 0;
  min-height: 0;
  margin: 0 8px 6px;
  padding: 7px 10px;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: 28px 30px;
  gap: 5px 7px;
  border-radius: 0 0 7px 7px;
  border-color: #ffffff25;
  border-top: 0;
  box-shadow: none;
  background: #111927;
  transform: none;
}
body.party-mode #partyPlayers .partyPlayer.is-active { border-color: var(--port); background: #182337; }
body.party-mode #partyPlayers .partyPlayer.is-ready { border-color: #80ee9a; }
body.party-mode #partyPlayers .partyPlayer.is-ready::before { display: none; }
body.party-mode #partyPlayers .partyPlayer.is-open { border-style: solid; opacity: 1; }
body.party-mode #partyPlayers .partyPlayer.is-cpu { filter: none; }
body.party-mode #partyPlayers .partyPlayer button.partyPort { grid-column: 1; grid-row: 1; width: 28px; height: 28px; border: 0; border-radius: 4px; }
body.party-mode #partyPlayers .partyPort::after { left: 0; bottom: 0; padding: 2px; min-width: 18px; font-size: 8px; }
body.party-mode #partyPlayers .partyPlayerMain { grid-column: 2; grid-row: 1; align-self: center; white-space: normal; }
body.party-mode #partyPlayers .partyFighter { display: none; }
body.party-mode #partyPlayers .partyState { font-size: 10px; line-height: 1.3; letter-spacing: .3px; color: #c6d2e6; }
body.party-mode #partyPlayers .partyPodActions,
body.party-mode #partyPlayers .partyPlayer.has-cpu-difficulty .partyPodActions {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  width: 100%;
}
body.party-mode #partyPlayers .partyPlayer button { min-width: 34px; height: 30px; padding: 0 6px; border-radius: 4px; font-size: 10px; }
body.party-mode .cpuDifficultyDock { flex: 1; min-width: 0; width: auto; grid-template-columns: minmax(0, 1fr) auto; gap: 0 5px; padding: 2px 5px; border: 0; background: #070e19; }
body.party-mode .cpuDifficultyDock span { grid-column: 1 / -1; font-size: 8px; letter-spacing: .5px; white-space: nowrap; }
body.party-mode .cpuDifficultyDock input[type="range"] { height: 15px; }
body.party-mode .cpuDifficultyDock input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; margin-top: -6px; }
body.party-mode .cpuDifficultyDock output { grid-row: 2; min-width: 24px; font-size: 10px; }
body.party-mode #selInfo {
  grid-row: 6;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0 12px;
  min-height: 44px;
  padding: 4px 16px max(4px, env(safe-area-inset-bottom));
  background: #090f1b;
  border-top: 1px solid #ffffff20;
}
body.party-mode .selectCommandBar { flex: 1; justify-content: flex-start; min-height: 30px; margin: 0; padding: 0; border: 0; background: none; gap: 12px; }
body.party-mode .selectCommandBar span:nth-last-child(-n+2) { display: none; }
body.party-mode #costumeControls, body.party-mode #padStatus,
body.party-mode #ctl0Btn, body.party-mode #ctl1Btn, body.party-mode #ctl2Btn, body.party-mode #ctl3Btn,
body.party-mode #onlineBtn, body.party-mode #gcStatus { display: none; }
body.party-mode #wizPrompt:empty { display: none; }
body.party-mode #wizPrompt:not(:empty) { order: 3; width: 100%; min-height: 0 !important; font-size: 13px !important; }
body.party-mode .setupBtns { margin: 0; flex-wrap: nowrap; gap: 5px; }
body.party-mode #selInfo .setupBtns button { min-height: 30px; padding: 5px 9px; font-size: 9px; }
/* Matching halves, with text as well as colour. P1-P4 identities stay fixed. */
body.team-mode .selectLane[data-team="red"], body.team-mode .selectShowcase[data-team="red"] { --port: var(--team-red) !important; }
body.team-mode .selectLane[data-team="blue"], body.team-mode .selectShowcase[data-team="blue"] { --port: var(--team-blue) !important; }
body.team-mode .selectLane[data-team="red"] { background: linear-gradient(180deg,#ff4f581c,transparent); }
body.team-mode .selectLane[data-team="blue"] { background: linear-gradient(180deg,#4d83ff1c,transparent); }

@media (max-height: 800px) and (min-width: 760px) {
  body.party-mode .selectHeader { min-height: 58px; padding: 7px 16px; gap: 10px; }
  body.party-mode #select .selectHeader h1 { font-size: 25px; }
  body.party-mode .selectEyebrow { font-size: 8px; }
  body.party-mode #roster { margin: 7px 10px; padding: 7px; gap: 6px; }
  body.party-mode .selectShowcase { padding: 7px 8px 6px; }
  body.party-mode .showcaseName { font-size: 17px; }
  body.party-mode .showcaseEyebrow { font-size: 8px; }
  body.party-mode .showcaseState { max-width: 76px; padding: 3px 4px; font-size: 8px; }
  body.party-mode .showcaseSkin { margin-top: 5px; }
  body.party-mode .selectNavLegend { display: none; }
  body.party-mode #selInfo .setupBtns button { min-height: 28px; }
  body.party-mode #mapBtn { display: none; }
}
/* Short landscapes use the portrait docks and devote the rest to the roster. */
@media (max-height: 560px), (max-width: 759px), (max-height: 640px) and (max-width: 1099px) {
  body.party-mode #select { grid-template-rows: auto minmax(0, 1fr) 88px auto; }
  body.party-mode .selectLane, body.party-mode .selectShowcase { display: none; }
  body.party-mode #select .selectHeader { min-height: 52px; padding: 7px 10px; gap: 8px; grid-template-columns: minmax(0,1fr) auto; }
  body.party-mode #select .selectHeader h1 { font-size: 20px; }
  body.party-mode .selectHeaderMeta { display: none; }
  body.party-mode #partyFormatBar { grid-column: 2; padding: 3px; }
  body.party-mode .partyFormatBtn { min-height: 32px; padding: 6px 9px; }
  body.party-mode .partyFormatBtn span { font-size: 9px; }
  body.party-mode #roster { margin: 6px 8px; padding: 6px; gap: 5px; }
  body.party-mode .charCaption { left: 4px; right: 4px; transform: none; }
  body.party-mode .char .cname { white-space: nowrap; text-overflow: ellipsis; }
  body.party-mode #partyPlayers .partyPlayer { grid-row: 3; margin: 0 4px 4px; padding: 5px; grid-template-columns: 25px minmax(0,1fr); grid-template-rows: 37px 29px; gap: 3px 5px; }
  body.party-mode #partyPlayers .partyPlayer button.partyPort { width: 25px; height: 31px; }
  body.party-mode #partyPlayers .partyFighter { display: block; font-size: 10px; letter-spacing: 0; white-space: normal; line-height: 1.15; }
  body.party-mode #partyPlayers .partyState { font-size: 8px; line-height: 1.15; }
  body.party-mode #partyPlayers .partyPlayer button { min-width: 28px; height: 28px; padding: 0 4px; font-size: 8px; }
  body.party-mode #selInfo { grid-row: 4; min-height: 36px; padding: 3px 8px; }
  body.party-mode .selectCommandBar { display: flex; gap: 7px; }
  body.party-mode .selectCommandBar kbd { min-width: 18px; height: 18px; font-size: 8px; }
  body.party-mode .selectCommandBar strong { font-size: 8px; }
  body.party-mode #costumeControls { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); width: 100%; gap: 4px; order: -1; margin: 0 0 3px; }
  body.party-mode #costumeControls .costumeChip { width: 100%; min-width: 0; min-height: 28px; padding: 0; grid-template-columns: 27px minmax(0,1fr) 27px; }
  body.party-mode #costumeControls .costumeChip > small { display: none; }
  body.party-mode #costumeControls .costumeChip button { width: 27px; height: 27px; }
  body.party-mode #costumeControls .costumeName { font-size: 8px; }
  body.party-mode #mapBtn { display: none; }
}
@media (max-height: 460px) {
  body.party-mode #select .selectHeader { min-height: 40px; padding-block: 2px; }
  body.party-mode .selectHeadingLockup { display: none; }
  body.party-mode #partyFormatBar { grid-column: 1 / -1; justify-self: center; width: min(320px,100%); }
  body.party-mode #partyFormatBar { padding: 2px; }
  body.party-mode .partyFormatBtn { flex: 1; min-height: 28px; }
  body.party-mode #roster { padding: 4px; margin-block: 4px; }
  body.party-mode .selectEyebrow { display: none; }
  body.party-mode #select .selectHeader h1 { margin: 0; }
  body.party-mode #selInfo { min-height: 30px; padding-block: 2px; }
  body.party-mode #selInfo .setupBtns button { min-height: 24px; padding-block: 3px; }
  body.party-mode .selectCommandBar { min-height: 23px; }
  body.party-mode #costumeControls { margin-bottom: 0; }
}
@media (max-width: 759px) and (min-height: 561px) {
  body.party-mode #select { grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: auto minmax(0,1fr) 86px 86px auto; }
  body.party-mode #select .selectHeader { grid-template-columns: 1fr; min-height: 82px; padding-block: 4px; }
  body.party-mode #partyFormatBar { grid-column: 1; grid-row: 2; width: 100%; }
  body.party-mode .partyFormatBtn { flex: 1; }
  body.party-mode #partyPlayers .partyPlayer { grid-column: var(--compact-column); grid-row: var(--compact-row); margin-inline: 6px; }
  body.party-mode #selInfo { grid-row: 5; }
  body.party-mode #costumeControls { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.party-mode .selectCommandBar span:nth-child(3), body.party-mode .selectCommandBar span:nth-child(4) { display: none; }
}
/* A connected-controller strip participates in the footer's layout, so it
   cannot cover a player's skin, difficulty slider or join controls. */
body.party-mode #selInfo #seatStrip[data-screen="select"] {
  position: static;
  flex: 0 0 auto;
  order: 2;
  max-width: 100%;
  gap: 6px;
  align-items: center;
}
body.party-mode #selInfo #seatStrip .seatRow { flex-shrink: 0; padding: 2px; }
body.party-mode #selInfo #seatStrip .seatMore { max-width: 140px; text-align: left; }
@media (max-width: 759px) {
  body.party-mode #selInfo #seatStrip { width: 100%; justify-content: flex-start; padding-top: 4px; }
}
@media (max-height: 460px) {
  body.party-mode #selInfo:has(#seatStrip.is-visible) .selectCommandBar { display: none; }
}
