/* ==========================================================================\
   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);
}

/* ---- 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;
}

/* ---- 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; bottom: -13px; }
.char .tagP4 { right: -5px; 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; }

.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;
  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; }

.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; }

/* ---- 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; }

  /* Party: roster on top, one full-body render panel per port across the bottom. */
  body.party-mode #select {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr) clamp(150px, 27vh, 330px) auto auto auto;
    background: linear-gradient(90deg, rgba(3, 4, 9, .5), rgba(3, 4, 9, 0) 12%, rgba(3, 4, 9, 0) 88%, rgba(3, 4, 9, .5));
  }

  body.party-mode .selectHeader {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 66px;
    padding-top: 8px;
    padding-bottom: 6px;
    background: linear-gradient(90deg, rgba(4, 5, 10, .92), rgba(4, 5, 10, .7));
  }

  body.party-mode #partyFormatBar { grid-column: 1 / -1; grid-row: 2; width: min(640px, 100%); margin: 6px auto 0; padding: 4px; }
  body.party-mode .partyFormatBtn { min-height: 34px; padding: 4px 12px; }
  body.party-mode .partyFormatBtn small { display: none; }

  body.party-mode #roster {
    grid-column: 1 / -1;
    grid-row: 3;
    width: auto;
    margin: 8px 10px 6px;
    padding: 10px 10px 14px;
    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 18px 50px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .07);
  }

  body.party-mode .selectLane { display: block; grid-row: 4; box-shadow: inset 0 -4px 0 var(--port); }
  body.party-mode .selectShowcase { display: grid; grid-row: 5; margin: 0 10px 2px; }
  body.party-mode #partyPlayers { display: contents; }
  body.party-mode #partyPlayers .partyPlayer { grid-row: 6; min-height: 46px; margin: 0 10px 6px; padding: 4px 7px 4px 6px; border-radius: 0 0 6px 6px; }

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

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

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

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

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

  body.party-mode .laneWatermark { right: auto; left: -.04em; font-size: clamp(90px, 9vw, 160px); }
  body.party-mode .showcaseName { font-size: clamp(19px, 1.7vw, 30px); }
  body.party-mode .showcasePort { min-width: 38px; height: 38px; font-size: 13px; }
  body.party-mode .showcaseSkin { margin-top: 6px; }
  body.party-mode .showcaseSkin .costumeChip { min-height: 30px; }
  body.party-mode .showcaseSkin .costumeChip button { width: 26px; height: 26px; }
  body.party-mode #partyPlayers .partyPort { width: 34px; height: 34px; }
  body.party-mode #partyPlayers .partyFighter { display: none; }
  body.party-mode #partyPlayers .partyState { color: #e3e9f4; font-size: 10px; letter-spacing: .9px; }
  body.party-mode #partyPlayers .partyPlayer.is-ready::before { display: none; }
  body.party-mode #partyPlayers .partyPlayer.has-cpu-difficulty { grid-template-columns: auto minmax(0, 1fr); }
  body.party-mode #partyPlayers .partyPlayer.has-cpu-difficulty .partyPort { grid-column: 1; grid-row: 1; }
  body.party-mode #partyPlayers .partyPlayer.has-cpu-difficulty .partyPlayerMain { grid-column: 2; grid-row: 1; }

  body.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 auto;
    width: 100%;
  }

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

  body.party-mode #selInfo {
    grid-column: 1 / -1;
    grid-row: 7;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 18px;
    padding: 4px clamp(14px, 1.8vw, 30px) max(6px, env(safe-area-inset-bottom));
  }

  body.party-mode .selectCommandBar { grid-column: 1; min-height: 30px; margin: 0; padding: 0; border: 0; background: none; justify-content: flex-start; }
  body.party-mode #costumeControls { display: none; }
  body.party-mode .setupBtns { grid-column: 2; margin: 0; justify-content: flex-end; flex-wrap: wrap; }
  body.party-mode #padStatus,
  body.party-mode #wizPrompt { grid-column: 1 / -1; }
  body.party-mode #padStatus { max-height: 26px; margin-top: 0; text-align: left; }

  /* Party on a short display (720p): every bottom row gives up height so the
     roster keeps three legible rows above the four panels. */
  @media (max-height: 800px) {
    body.party-mode #select { grid-template-rows: auto auto minmax(0, 1fr) clamp(130px, 22vh, 330px) auto auto auto; }
    body.party-mode .selectHeader { min-height: 56px; padding-top: 6px; padding-bottom: 5px; }
    body.party-mode #select .selectHeader h1 { font-size: clamp(22px, 2.6vw, 34px); }
    body.party-mode #partyFormatBar { margin-top: 4px; padding: 3px; }
    body.party-mode .partyFormatBtn { min-height: 28px; padding: 3px 10px; }
    body.party-mode .partyFormatBtn span { font-size: 11px; }
    body.party-mode #roster { margin: 6px 10px 4px; padding: 8px 8px 10px; }
    body.party-mode .selectShowcase { padding: 5px 10px 5px 0; }
    body.party-mode .showcasePort { min-width: 32px; height: 32px; font-size: 11px; }
    body.party-mode .showcaseEyebrow { font-size: 8px; letter-spacing: 2px; }
    body.party-mode .showcaseName { margin-top: 2px; font-size: clamp(16px, 1.5vw, 24px); }
    body.party-mode .showcaseMeta { margin-top: 3px; font-size: 9.5px; }
    body.party-mode .showcaseSkin { margin-top: 4px; }
    body.party-mode .showcaseSkin .costumeChip { min-height: 24px; padding-top: 1px; padding-bottom: 1px; }
    body.party-mode .showcaseSkin .costumeChip button { width: 20px; height: 20px; font-size: 15px; }
    body.party-mode .showcaseState { top: -10px; padding: 3px 8px; font-size: 8.5px; }
    body.party-mode #partyPlayers .partyPlayer { min-height: 40px; margin-bottom: 4px; padding: 3px 6px 3px 5px; }
    body.party-mode #partyPlayers .partyPort { width: 30px; height: 30px; }
    body.party-mode #partyPlayers .partyPlayer button { height: 28px; min-width: 32px; }
    body.party-mode .cpuDifficultyDock { padding: 2px 6px; }
    body.party-mode .cpuDifficultyDock input[type="range"] { height: 22px; }
    body.party-mode .cpuDifficultyDock output { font-size: 12px; }
    body.party-mode #selInfo { padding-top: 3px; }
    body.party-mode .selectCommandBar { min-height: 26px; }
    body.party-mode #selInfo .setupBtns button { min-height: 24px; padding: 4px 8px; }
    body.party-mode #padStatus { display: none; }
    /* Each pod's gear opens that port's controls, so the footer copies go. */
    body.party-mode #ctl0Btn,
    body.party-mode #ctl1Btn,
    body.party-mode #ctl2Btn,
    body.party-mode #ctl3Btn { display: none; }
  }
}

/* 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 — sound test / per-destination playlist picker (js/music-select.js)
   Opens over the stage select (Y) and from the home menu. Same Ultimate-derived
   language as the two screens it sits on: skewed italic lockups, a gold rule,
   dark glass panels, and one destination accent driving every highlight.
   ========================================================================== */

#musicSelect {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.2vh, 28px) clamp(10px, 2.4vw, 40px);
  box-sizing: border-box;
  background: radial-gradient(ellipse 80% 70% at 62% 12%, rgba(24, 12, 34, .72), rgba(2, 3, 6, .93) 62%),
              rgba(3, 4, 8, .9);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: music-fade-in .18s ease-out both;
  --music-accent: #ffd86a;
}

@keyframes music-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes music-sheet-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

/* The gameplay touch pad would sit on top of the list and eat every tap. */
body.music-open #touchControls { display: none !important; }

.musicSheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1240px, 100%);
  height: min(824px, 100%);
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 8px;
  background: linear-gradient(168deg, rgba(19, 21, 33, .97), rgba(9, 10, 17, .98));
  box-shadow: 0 34px 90px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .07);
  animation: music-sheet-in .24s cubic-bezier(.2, .8, .2, 1) both;
}

.musicSheet:focus { outline: none; }

/* Accent hairline across the top — the destination's colour, at a glance. */
.musicSheet::before {
  content: '';
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--music-accent), transparent 72%);
}

/* ---- header ------------------------------------------------------------- */
.musicHeader {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(210px, 30%);
  align-items: center;
  gap: clamp(11px, 1.5vw, 20px);
  padding: clamp(12px, 1.9vh, 20px) clamp(15px, 2vw, 26px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(100deg, color-mix(in srgb, var(--music-accent) 13%, transparent), transparent 58%);
}

.musicGlyph {
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  color: #14100a;
  background: linear-gradient(145deg, #fff3ab, var(--music-accent));
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
  font: 950 27px/1 Arial, sans-serif;
  box-shadow: 0 7px 18px rgba(0, 0, 0, .45);
}

/* Breathes only while something is actually audible. */
.musicGlyph.is-live { animation: music-pulse 1.6s ease-in-out infinite; }
@keyframes music-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.28); }
}

.musicTitleLockup { min-width: 0; }

.musicEyebrow {
  color: var(--music-accent);
  font: 900 11px/1 Arial, sans-serif;
  letter-spacing: 3.2px;
}

#musicSelect .musicTitle {
  margin: 5px 0 0;
  overflow: hidden;
  color: #fff;
  font: 950 italic clamp(24px, 2.9vw, 40px)/.9 Arial, sans-serif;
  letter-spacing: 1.6px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transform: skewX(-8deg);
  transform-origin: left;
  text-shadow: 0 4px 0 #000;
}

.musicSummary {
  margin-top: 6px;
  color: #8d97a9;
  font: 850 10.5px/1 Arial, sans-serif;
  letter-spacing: 1.9px;
}

.musicSummary.is-custom { color: var(--music-accent); }

.musicNow {
  min-width: 0;
  padding: 9px 13px;
  border-left: 3px solid var(--music-accent);
  background: linear-gradient(90deg, rgba(255, 255, 255, .07), transparent);
}

.musicNow small {
  display: block;
  color: #808b9d;
  font: 900 9.5px/1 Arial, sans-serif;
  letter-spacing: 2.2px;
}

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

.musicNow b { margin-top: 5px; color: #fff; font: 950 italic 15px/1.05 Arial, sans-serif; }
.musicNow span { margin-top: 3px; color: #a9b4c6; font: 800 10.5px/1.15 Arial, sans-serif; letter-spacing: .7px; }

.musicProgress {
  margin-top: 8px;
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, .13);
}

.musicProgress i {
  display: block;
  height: 100%;
  background: var(--music-accent);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---- body: category rail + track list ----------------------------------- */
.musicBody {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(168px, 210px) minmax(0, 1fr);
  min-height: 0;
}

.musicRail {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  padding: 11px 9px 11px 11px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .26);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .26) transparent;
}

.musicRailItem {
  --rail-color: #cfd8e8;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #98a2b4;
  font: 900 11px/1.15 Arial, sans-serif;
  letter-spacing: 1.15px;
  text-align: left;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s, transform .12s;
}

.musicRailItem > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.musicRailItem > small {
  flex: 0 0 auto;
  color: #6b7487;
  font: 800 10px/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

.musicRailItem:hover { color: #e6ecf6; background: rgba(255, 255, 255, .05); }

.musicRailItem.is-selected {
  border-left-color: var(--rail-color);
  background: linear-gradient(90deg, color-mix(in srgb, var(--rail-color) 22%, transparent), transparent 88%);
  color: #fff;
  transform: translateX(2px);
}

.musicRailItem.is-selected > small { color: var(--rail-color); }
.musicRailItem:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

.musicListShell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.musicListHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 11px clamp(14px, 1.7vw, 22px) 8px;
  color: #fff;
  font: 950 italic 13px/1 Arial, sans-serif;
  letter-spacing: 1.6px;
}

.musicListHead strong {
  color: #7a8497;
  font: 850 10px/1 Arial, sans-serif;
  letter-spacing: 1.7px;
}

.musicList {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 clamp(9px, 1.3vw, 16px) 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .26) transparent;
}

.musicList:focus { outline: none; }

.musicEmpty {
  margin: 0;
  padding: 26px 20px;
  color: #7b8496;
  font: 850 11px/1.5 Arial, sans-serif;
  letter-spacing: 1.5px;
  text-align: center;
}

/* ---- one song ----------------------------------------------------------- */
.musicRow {
  position: relative;
  display: grid;
  grid-template-columns: 30px 16px minmax(0, 1fr) minmax(0, 118px) 46px 58px;
  align-items: center;
  gap: clamp(7px, .9vw, 13px);
  padding: 8px 11px;
  border-left: 3px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: background .11s, border-color .11s, transform .11s;
}

/* Single-group views drop the redundant destination tag, so the title column
   takes the space back instead of leaving a gap where the tag used to be. */
.musicList:not(.is-mixed) .musicRow { grid-template-columns: 30px 16px minmax(0, 1fr) 46px 58px; }

.musicRow + .musicRow { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.musicRow:hover { background: rgba(255, 255, 255, .05); }

.musicRow.is-selected {
  z-index: 1;
  border-left-color: var(--music-accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--music-accent) 20%, transparent), rgba(255, 255, 255, .04) 62%, transparent);
  transform: translateX(3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}

.musicRowNum {
  color: #667089;
  font: 900 11px/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.musicRow.is-selected .musicRowNum { color: var(--music-accent); }

/* Four bars that only dance for the track you can currently hear. */
.musicEq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  opacity: 0;
  transition: opacity .16s;
}

.musicEq i {
  width: 2px;
  height: 3px;
  border-radius: 1px;
  background: var(--music-accent);
}

.musicRow.is-playing .musicEq { opacity: 1; }
.musicRow.is-playing .musicEq i { animation: music-eq .84s ease-in-out infinite; }
.musicRow.is-playing .musicEq i:nth-child(2) { animation-delay: .16s; animation-duration: .68s; }
.musicRow.is-playing .musicEq i:nth-child(3) { animation-delay: .32s; animation-duration: .95s; }
.musicRow.is-playing .musicEq i:nth-child(4) { animation-delay: .08s; animation-duration: .76s; }

@keyframes music-eq {
  0%, 100% { height: 3px; }
  50% { height: 14px; }
}

.musicRowMain { min-width: 0; }

.musicRowMain b {
  display: block;
  overflow: hidden;
  color: #dfe6f2;
  font: 900 14px/1.15 Arial, sans-serif;
  letter-spacing: .2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.musicRow.is-on .musicRowMain b,
.musicRow.is-selected .musicRowMain b { color: #fff; }

.musicRowMain small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #838ea1;
  font: 800 10.5px/1.1 Arial, sans-serif;
  letter-spacing: .5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.musicRowMain small.is-quiet { color: #5d6577; font-style: italic; }

/* Soundfont / arrangement note — the "how it was made" chip. A filled tint reads
   as a chip at 9px where a hairline border just reads as two stray pipes. */
.musicRowMain small em {
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .08);
  color: #9aa5b8;
  font: 800 9px/1.35 Arial, sans-serif;
  font-style: normal;
  letter-spacing: .9px;
  text-transform: uppercase;
}

.musicRowGroup {
  overflow: hidden;
  color: #6d7689;
  font: 850 9.5px/1 Arial, sans-serif;
  letter-spacing: 1.3px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.musicRowTime {
  color: #8b94a6;
  font: 800 11px/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.musicRowPill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 13px;
  color: #79839a;
  background: transparent;
  font: 900 10px/1 Arial, sans-serif;
  letter-spacing: 1.3px;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.musicRowPill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
}

.musicRowPill em { font-style: normal; }

.musicRow.is-on .musicRowPill {
  border-color: color-mix(in srgb, var(--music-accent) 70%, transparent);
  background: color-mix(in srgb, var(--music-accent) 20%, transparent);
  color: var(--music-accent);
}

.musicRow.is-on .musicRowPill i { opacity: 1; box-shadow: 0 0 7px var(--music-accent); }

/* ---- footer ------------------------------------------------------------- */
.musicFooter {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px clamp(13px, 1.7vw, 22px) max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .1);
  background: rgba(0, 0, 0, .3);
}

.musicHint {
  min-width: 0;
  overflow: hidden;
  color: #8d97a9;
  font: 850 10.5px/1.3 Arial, sans-serif;
  letter-spacing: 1.4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.musicHint[data-tone="good"] { color: #9ff3ae; }
.musicHint[data-tone="warn"] { color: #ffd06a; }

.musicActions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.musicActions button {
  min-height: 38px;
  padding: 0 15px;
  border: 2px solid rgba(255, 255, 255, .28);
  border-radius: 20px;
  background: rgba(10, 12, 24, .9);
  color: #fff;
  font: 900 11.5px/1 Arial, sans-serif;
  letter-spacing: 1.1px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .1s, filter .1s, border-color .1s;
}

.musicActions button:hover { filter: brightness(1.2); }
.musicActions button:active { transform: scale(.95); }
.musicActions button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.musicActions .musicBtnBack { border-color: rgba(103, 167, 255, .6); color: #9fcaff; }

.musicActions .musicBtnGo {
  border-color: color-mix(in srgb, var(--music-accent) 78%, #fff 22%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--music-accent) 92%, #fff 8%), color-mix(in srgb, var(--music-accent) 62%, #7a4c00 38%));
  color: #201500;
}

/* ---- 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; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 940px) {
  .musicHeader { grid-template-columns: auto minmax(0, 1fr); }
  .musicNow { grid-column: 1 / -1; }
  .musicBody { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .musicRail {
    flex-direction: row;
    padding: 9px 11px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
  }
  .musicRailItem { border-left: 0; border-bottom: 3px solid transparent; border-radius: 3px 3px 0 0; white-space: nowrap; }
  .musicRailItem.is-selected { border-bottom-color: var(--rail-color); transform: none; }
  .musicRow { grid-template-columns: 26px 14px minmax(0, 1fr) 42px 54px; }
  .musicRowGroup { display: none; }
  .musicFooter { flex-wrap: wrap; }
  .musicHint { flex: 1 0 100%; order: 2; white-space: normal; }
  .musicActions { flex: 1 1 auto; }
  .musicActions button { flex: 1 1 auto; padding: 0 9px; }
}

@media (max-width: 620px) {
  #musicSelect { padding: 0; }
  .musicSheet { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .musicGlyph { width: 40px; height: 45px; font-size: 21px; }
  .musicRow { grid-template-columns: 22px 12px minmax(0, 1fr) 50px; padding: 9px 8px; }
  .musicRowTime { display: none; }
  .musicRowMain small em { display: none; }
  .musicActions button { min-height: 44px; font-size: 10.5px; letter-spacing: .6px; }
}

@media (max-height: 620px) {
  .musicHeader { padding-block: 8px; }
  #musicSelect .musicTitle { font-size: clamp(20px, 2.4vw, 30px); }
  .musicGlyph { width: 42px; height: 46px; font-size: 22px; }
  .musicRow { padding-block: 6px; }
  .musicFooter { padding-block: 7px; }
  .musicActions button { min-height: 33px; }
}

@media (prefers-reduced-motion: reduce) {
  #musicSelect,
  .musicSheet { animation: none !important; }
  .musicGlyph.is-live,
  .musicRow.is-playing .musicEq i { animation: none !important; }
  .musicRow.is-playing .musicEq i { height: 9px; }
  .musicRow,
  .musicRailItem,
  .musicRowPill { transition-duration: .01ms !important; }
}
