/* =========================================================================
   Slash Battle — Boys vs Girls
   Cartoon / storybook chrome: gold-framed wooden plaques, thick dark strokes
   on every glyph, saturated fills. Nothing here is realistic on purpose.
   ========================================================================= */

/* Same pair as the bridge game: Luckiest Guy carries every headline and
   number, Inter carries menu copy. Both self-hosted so nothing depends on a
   CDN being reachable mid-stream. */
@font-face {
  font-family: 'Luckiest Guy';
  src: url('fonts/LuckiestGuy.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}

:root {
  --display: 'Luckiest Guy', 'Impact', system-ui, sans-serif;
  --ui: 'Inter', system-ui, -apple-system, sans-serif;

  /* Blue team */
  --b-deep:  #1352B8;
  --b-mid:   #2E86F0;
  --b-hi:    #6FD0FF;
  --b-pale:  #CDEEFF;

  /* Pink team */
  --g-deep:  #B4157A;
  --g-mid:   #ED3B99;
  --g-hi:    #FF87CE;
  --g-pale:  #FFD6EE;

  /* Frame */
  --wood-hi:  #C98A3C;
  --wood:     #8A5320;
  --wood-lo:  #55300F;
  --gold-hi:  #FFDE8A;
  --gold:     #F0B93F;
  --gold-lo:  #B27916;

  --ink:      #17121F;
  --paper:    #FFF6E3;

  --fit: 1;
  /* mostly vh-driven: a vertical capture has the room, a short editing window
     does not, so the floor keeps the tiles usable there too */
  --tileW: clamp(62px, 9vh, 118px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #7FD8E8;
  font-family: var(--ui);
  font-weight: 800;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* Every headline glyph gets a hard dark outline, drawn behind the fill. */
.stroke {
  -webkit-text-stroke: 0.085em var(--ink);
  paint-order: stroke fill;
}

/* ===================== HUD shell ===================== */
#hud {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10;
}
#hud button { pointer-events: auto; }

#topbar {
  position: absolute;
  top: var(--hud-y, 14px);
  left: 50%;
  transform: translateX(-50%) translate(var(--hud-dx, 0px), var(--hud-dy, 0px)) scale(var(--fit));
  transform-origin: top center;
  display: flex;
  align-items: flex-start;
  gap: clamp(8px, 1.2vw, 18px);
  /* Matches the play column, so a vertical crop keeps the whole scoreboard. */
  width: min(var(--stage-w, 820px), 94vw);
  justify-content: center;
}
#topbar.draggable { pointer-events: auto; cursor: grab; }
#topbar.dragging  { cursor: grabbing; }

/* ===================== Health bars ===================== */
.hpwrap { flex: 1 1 0; min-width: 0; }

.hpname {
  font-family: var(--display);
  font-size: clamp(15px, 2.1vw, 27px);
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 5px;
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.45));
}
.boys  .hpname { color: var(--b-hi); }
.girls .hpname { color: var(--g-hi); }

/* Outer gold frame, inner dark trough, glossy fill. */
.hpbar {
  position: relative;
  height: clamp(34px, 4.6vh, 54px);
  border-radius: 999px;
  padding: 5px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 42%, var(--gold-lo));
  border: 3px solid var(--ink);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.55),
    inset 0 -3px 0 rgba(0, 0, 0, 0.28),
    0 5px 0 rgba(0, 0, 0, 0.35),
    0 10px 22px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.hpbar::before {
  /* the dark trough the fill sits in */
  content: '';
  position: absolute; inset: 5px;
  border-radius: 999px;
  background: #24182B;
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.65);
}

/* left+right both pinned so the element sizes to the trough exactly;
   scaleX from the left edge is then a true 0-100% fill. */
.hpfill, .hpghost {
  position: absolute;
  left: 5px; right: 5px; top: 5px; bottom: 5px;
  border-radius: 999px;
  transform-origin: left center;
}
/* Ghost lags the real bar so you can see the chunk that just came off. */
.hpghost {
  background: rgba(255, 255, 255, 0.5);
  transition: transform 0.42s cubic-bezier(0.3, 0, 0.2, 1) 0.10s;
  z-index: 1;
}
.hpfill {
  z-index: 2;
  transition: transform 0.13s linear;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.42),
              inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}
.boys  .hpfill { background: linear-gradient(180deg, var(--b-hi), var(--b-mid) 52%, var(--b-deep)); }
.girls .hpfill { background: linear-gradient(180deg, var(--g-hi), var(--g-mid) 52%, var(--g-deep)); }

/* the moving highlight strip along the top of the fill */
.hpfill::after {
  content: '';
  position: absolute; left: 8px; right: 8px; top: 4px; height: 26%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.hpnum {
  font-family: var(--display);
  position: absolute; inset: 0;
  z-index: 3;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: clamp(15px, 2.0vw, 26px);
  color: #fff;
  -webkit-text-stroke: 0.10em var(--ink);
  paint-order: stroke fill;
  font-variant-numeric: tabular-nums;
}
.hpnum em { font-style: normal; font-size: 0.66em; opacity: 0.8; }

.hpdps {
  font-family: var(--display);
  text-align: center;
  margin-top: 4px;
  font-size: clamp(11px, 1.25vw, 17px);
  letter-spacing: 0.05em;
  color: var(--paper);
  opacity: 0.92;
  -webkit-text-stroke: 0.10em var(--ink);
  paint-order: stroke fill;
}

/* a quick pop whenever a big chunk lands */
.hpbar.pop { animation: hpPop 0.22s ease-out; }
@keyframes hpPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.035, 1.10); }
  100% { transform: scale(1); }
}

.hprow {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 4px; min-height: 22px;
}

/* Stacking damage multiplier badge. Hidden until a boost is live. */
.mult {
  display: none;
  position: relative;
  font-family: var(--display);
  font-size: clamp(11px, 1.3vw, 18px);
  padding: 2px 9px 3px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  color: #2A1A05;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, var(--gold-lo));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 3px 0 rgba(0, 0, 0, 0.4);
  overflow: hidden;
  white-space: nowrap;
}
.mult.on { display: inline-block; }
.mult .mx { position: relative; z-index: 2; }
/* Drains left-to-right as the boost times out. */
.mult .mbar {
  position: absolute; left: 0; top: 0; bottom: 0; right: 0;
  background: rgba(0, 0, 0, 0.34);
  transform-origin: right center;
  transform: scaleX(0);
  z-index: 1;
}
.mult.bump { animation: multBump 0.42s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes multBump {
  0%   { transform: scale(1); }
  38%  { transform: scale(1.34); }
  100% { transform: scale(1); }
}

/* ===================== Gift rails ===================== */
#rails { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.rail {
  position: absolute; top: 26%; left: 50%;
  display: flex; flex-direction: column;
  gap: clamp(6px, 1.4vh, 15px);
}
.rail.left  { transform: translate(-100%, 0) scale(var(--fit)); transform-origin: right top; }
.rail.right { transform: translate(0, 0) scale(var(--fit)); transform-origin: left top; }

.slot {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(2px, 0.5vh, 5px);
  width: var(--tileW, 104px);
}
.tile {
  pointer-events: auto; position: relative; padding: 0;
  width: var(--tileW, 104px); aspect-ratio: 1;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.34);
  display: grid; place-items: center; cursor: pointer;
  font-size: clamp(24px, 4vh, 46px); line-height: 1;
  transition: transform 150ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
.tile.blue {
  background: linear-gradient(180deg, #5EA1FF 0%, #2563EB 52%, #173A96 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -14px 22px rgba(0, 0, 0, 0.30),
              0 8px 20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.tile.pink {
  background: linear-gradient(180deg, #FF8FD0 0%, #E0369A 52%, #8E0E55 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), inset 0 -14px 22px rgba(0, 0, 0, 0.30),
              0 8px 20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.6);
}
.tile:hover  { transform: translateY(-3px); }
.tile:active { transform: translateY(1px) scale(0.96); }
.tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.tile.fire { animation: tileFire 0.42s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes tileFire {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.22) rotate(-5deg); box-shadow: 0 0 0 4px var(--gold-hi), 0 0 30px var(--gold); }
  100% { transform: scale(1); }
}
.tile .ico {
  display: grid; place-items: center; width: 78%; height: 78%;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}
.tile .ico img { width: 100%; height: 100%; object-fit: contain; border-radius: 13px; }
.tile .key {
  position: absolute; top: 4px; right: 7px;
  font-family: var(--ui); font-size: 10px; font-weight: 900;
  color: rgba(255, 255, 255, 0.75); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.cap {
  font-family: var(--display); line-height: 1.04; text-align: center;
  width: 100%; white-space: nowrap;
  font-size: clamp(10px, 1.7vh, 17px);
  color: #FFE9A8;
  -webkit-text-stroke: 0.11em #08080A; paint-order: stroke fill;
  background: rgba(6, 8, 12, 0.66);
  border-radius: 7px; padding: 0.1em 0.1em 0.16em;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.rail.left  .cap { color: #CFE9FF; }
.rail.right .cap { color: #FFD3E9; }

/* ===================== Wins plaque ===================== */
.plaque {
  flex: 0 0 auto;
  display: flex; align-items: stretch; gap: clamp(8px, 0.9vw, 16px);
  padding: 8px clamp(12px, 1.3vw, 20px) 9px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--wood-hi), var(--wood) 44%, var(--wood-lo));
  border: 3px solid var(--ink);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.30),
    inset 0 -4px 0 rgba(0, 0, 0, 0.34),
    0 6px 0 rgba(0, 0, 0, 0.35),
    0 12px 26px rgba(0, 0, 0, 0.30);
}
.pside { text-align: center; min-width: clamp(56px, 5vw, 84px); }
.pwins {
  font-family: var(--display);
  font-size: clamp(24px, 3.4vw, 46px);
  line-height: 0.95;
  -webkit-text-stroke: 0.085em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.4));
  font-variant-numeric: tabular-nums;
}
.pside.boys  .pwins { color: var(--b-hi); }
.pside.girls .pwins { color: var(--g-hi); }
.plbl {
  font-family: var(--display);
  font-size: clamp(9px, 0.85vw, 13px);
  letter-spacing: 0.16em;
  color: var(--gold-hi);
  -webkit-text-stroke: 0.11em var(--ink);
  paint-order: stroke fill;
}
.pmid {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 clamp(4px, 0.6vw, 10px);
  border-left: 2px solid rgba(0, 0, 0, 0.35);
  border-right: 2px solid rgba(0, 0, 0, 0.35);
}
.pround {
  font-family: var(--display);
  font-size: clamp(9px, 0.9vw, 13px);
  letter-spacing: 0.12em;
  color: var(--gold-hi);
  -webkit-text-stroke: 0.11em var(--ink);
  paint-order: stroke fill;
  white-space: nowrap;
}
.pvs {
  font-family: var(--display);
  font-size: clamp(16px, 2vw, 28px);
  color: var(--paper);
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
  line-height: 1.05;
}

.pwins.bump { animation: winBump 0.5s cubic-bezier(0.2, 1.5, 0.4, 1); }
@keyframes winBump {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ===================== Misc HUD ===================== */
#centerMsg {
  font-family: var(--display);
  position: absolute;
  top: 26%; left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-size: clamp(26px, 5vw, 66px);
  color: #fff;
  -webkit-text-stroke: 0.075em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.42));
  opacity: 0;
  text-align: center;
  white-space: nowrap;
}
#centerMsg.show { animation: msgIn 1.5s ease-out forwards; }
@keyframes msgIn {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
  14%  { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  24%  { transform: translate(-50%, -50%) scale(1); }
  74%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(1.02); }
}

#pausedTag {
  font-family: var(--display);
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(28px, 5vw, 62px);
  color: #fff;
  -webkit-text-stroke: 0.075em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 7px 0 rgba(0, 0, 0, 0.45));
  letter-spacing: 0.06em;
  display: none;
}
#pausedTag.on { display: block; }

#fps {
  font-family: var(--display);
  position: absolute; left: 12px; bottom: 10px;
  font-size: 13px; letter-spacing: 0.08em;
  color: var(--paper); opacity: 0.55;
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
  display: none;
}
#fps.on { display: block; }

.hint {
  font-family: var(--display);
  position: absolute; left: 50%; bottom: 12px;
  transform: translateX(-50%);
  font-size: clamp(10px, 1vw, 14px);
  letter-spacing: 0.07em;
  color: var(--paper); opacity: 0.62;
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
  display: flex; gap: 6px; align-items: center;
  white-space: nowrap;
}
.hint.off { display: none; }
kbd {
  font-family: var(--ui);
  font-weight: 900;
  background: rgba(0, 0, 0, 0.42);
  border: 2px solid rgba(255, 255, 255, 0.30);
  border-radius: 6px;
  padding: 1px 6px;
  -webkit-text-stroke: 0;
  font-size: 0.92em;
}

#gear {
  position: absolute; right: 14px; top: 14px;
  width: 52px; height: 52px;
  display: grid; place-items: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--wood-lo);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 48%, var(--gold-lo));
  border: 3px solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55),
              0 5px 0 rgba(0, 0, 0, 0.35),
              0 10px 20px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s ease-out;
}
#gear:hover  { transform: translateY(-2px) rotate(28deg); }
#gear:active { transform: translateY(2px); }
#gear:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }

/* ===================== Drag bar ===================== */
#dragBar {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(150%);
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, #241A2E, #140E1C);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  z-index: 40;
  font-family: var(--display);
  letter-spacing: 0.09em;
  font-size: 14px;
  color: var(--gold-hi);
  transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
}
#dragBar.on { transform: translateX(-50%) translateY(0); }

/* ===================== Buttons ===================== */
.btn {
  font-family: var(--display);
  font-size: clamp(16px, 1.9vw, 24px);
  letter-spacing: 0.05em;
  cursor: pointer;
  color: #4A2C10;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 46%, var(--gold-lo));
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 11px 30px 13px;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.6),
              inset 0 -4px 0 rgba(0, 0, 0, 0.22),
              0 6px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.14s ease-out, box-shadow 0.14s ease-out;
}
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 3px 0 rgba(255,255,255,.6), inset 0 -4px 0 rgba(0,0,0,.22), 0 8px 0 rgba(0,0,0,.4); }
.btn:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255,255,255,.6), 0 2px 0 rgba(0,0,0,.4); }
.btn:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.btn.sm { font-size: 15px; padding: 8px 18px 10px; border-radius: 11px; }
.btn.ghost {
  color: var(--paper);
  background: linear-gradient(180deg, #3A2C4A, #221831);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.16), 0 5px 0 rgba(0, 0, 0, 0.42);
}

/* ===================== Overlays ===================== */
.overlay {
  position: fixed; inset: 0;
  /* Flex, not grid: a percentage max-height on a centred GRID item resolves
     against the auto-sized row, so it never actually constrains the panel and
     the scroll area never appears. Flex + a viewport max-height is reliable. */
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 10, 0.80);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease-out;
  padding: 20px;
}
.overlay.on { opacity: 1; pointer-events: auto; }
.overlay .inner { text-align: center; }

#title {
  font-family: var(--display);
  font-size: clamp(48px, 12vw, 148px);
  line-height: 0.9;
  -webkit-text-stroke: 0.07em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.5));
}
#title .b { color: var(--b-hi); }
#title .g { color: var(--g-hi); }

#subtitle, #winSub {
  font-family: var(--display);
  font-size: clamp(13px, 2vw, 22px);
  letter-spacing: 0.09em;
  margin: 14px 0 26px;
  color: var(--paper); opacity: 0.9;
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
}
.row2 { margin-top: 14px; }

.kick {
  font-family: var(--display);
  font-size: clamp(11px, 1.5vw, 17px);
  letter-spacing: 0.24em;
  color: var(--gold-hi);
  -webkit-text-stroke: 0.10em var(--ink);
  paint-order: stroke fill;
  margin-bottom: 6px;
}
#winTitle {
  font-family: var(--display);
  font-size: clamp(42px, 10vw, 126px);
  line-height: 0.9;
  color: #fff;
  -webkit-text-stroke: 0.07em var(--ink);
  paint-order: stroke fill;
  filter: drop-shadow(0 9px 0 rgba(0, 0, 0, 0.5));
}
#winTitle.boys  { color: var(--b-hi); }
#winTitle.girls { color: var(--g-hi); }
#nextIn {
  font-family: var(--display);
  font-size: clamp(12px, 1.5vw, 18px);
  letter-spacing: 0.14em;
  color: var(--gold-hi); opacity: 0.85;
  -webkit-text-stroke: 0.10em var(--ink);
  paint-order: stroke fill;
  margin-bottom: 18px;
}
#nextIn.off { display: none; }
#winActions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===================== Control menu ===================== */
.panel {
  width: min(700px, 95vw);
  max-height: calc(100dvh - 40px);
  overflow: hidden;                 /* keeps the scrolling body inside the radius */
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #151C28, #0A0E14);
  border: 1px solid rgba(233, 196, 106, 0.28);
  border-radius: 18px;
  padding: 22px clamp(18px, 3vw, 28px) 18px;
  box-shadow: 0 44px 110px rgba(0, 0, 0, 0.75);
}
.panel h2 {
  font-family: var(--display);
  font-size: clamp(20px, 3.2vh, 30px);
  letter-spacing: 0.06em;
  color: var(--gold-hi);
  -webkit-text-stroke: 0.07em var(--ink);
  paint-order: stroke fill;
  font-weight: 400;
}
.panel .lead { font-size: 13px; opacity: 0.5; margin: 3px 0 16px; letter-spacing: 0.03em; }

.panel-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 185, 63, 0.35) transparent;
  padding-right: 4px;
}
.panel-body::-webkit-scrollbar { width: 9px; }
.panel-body::-webkit-scrollbar-thumb { background: rgba(240, 185, 63, 0.32); border-radius: 99px; }

.grp { margin-bottom: 18px; }
.grp h3 {
  font-family: var(--display);
  font-size: 14px; letter-spacing: 0.14em;
  color: #FFC46B; margin-bottom: 8px; font-weight: 400;
}
.set {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 7px;
  font-size: 14px; letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 11px;
  padding: 9px 13px;
}
.set label { flex: 1 1 auto; }
.set label small {
  display: block; opacity: 0.42; font-size: 12px; margin-top: 1px; letter-spacing: 0.01em;
}
.set .sp { flex: 1 1 auto; }
.set input[type=range] {
  flex: 0 0 min(200px, 38%);
  accent-color: var(--gold);
  height: 4px; cursor: pointer;
}
.set input[type=range]:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
.set output {
  flex: 0 0 auto; width: 66px; text-align: right;
  font-weight: 900;
  font-variant-numeric: tabular-nums; color: var(--gold-hi);
}
.set input[type=text], .set select {
  flex: 0 0 min(200px, 46%);
  background: #0D0912;
  border: 2px solid rgba(255, 255, 255, 0.16);
  color: var(--paper);
  border-radius: 9px; padding: 7px 10px;
  font-family: var(--ui); font-weight: 800; font-size: 14px; letter-spacing: 0.02em;
}
.set input[type=text]:focus-visible, .set select:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 1px;
}

.sw {
  position: relative; flex: 0 0 auto;
  width: 50px; height: 28px; border-radius: 99px; cursor: pointer;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(0, 0, 0, 0.6);
  transition: background 0.16s ease-out;
}
.sw::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper);
  transition: transform 0.16s cubic-bezier(0.2, 0.8, 0.3, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.sw[aria-checked=true] { background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo)); }
.sw[aria-checked=true]::after { transform: translateX(22px); }
.sw:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--ui); font-weight: 900; font-size: 13px; letter-spacing: 0.04em; cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.18);
  color: var(--paper);
  border-radius: 9px; padding: 7px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.14s ease-out, transform 0.1s ease-out;
}
.chip:hover  { background: rgba(255, 255, 255, 0.14); }
.chip:active { transform: translateY(2px); }
.chip:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.chip.b { border-color: rgba(111, 208, 255, 0.55); color: var(--b-pale); }
.chip.r { border-color: rgba(255, 135, 206, 0.55); color: var(--g-pale); }
.chip kbd { font-size: 11px; padding: 0 5px; }

.acts {
  flex: 0 0 auto;
  display: flex; gap: 9px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px;
  border-top: 2px solid rgba(255, 255, 255, 0.09);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition-duration: 1ms !important; }
}
