@font-face {
  font-family: "Kenney Future";
  src: url("../assets/fonts/Kenney Future.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Kenney Future Narrow";
  src: url("../assets/fonts/Kenney Future Narrow.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1a120c;
  --sand: #e8d5b5;
  --sand-dim: #c4a574;
  --ember: #e85d4c;
  --sky: #4c9be8;
  --gold: #f0c14b;
  --gold-deep: #b8892a;
  --panel: rgba(22, 16, 12, 0.92);
  --line: rgba(232, 213, 181, 0.22);
  /* Idle edge / pad-focus edge / activated fill — one language for all controls */
  --ui-edge: rgba(255, 232, 196, 0.28);
  --ui-edge-focus: rgba(240, 193, 75, 0.95);
  --ui-fill-active: rgba(240, 193, 75, 0.18);
  /* Readable UI: prefer dvh when available, fall back to vh */
  --ui-pad: max(12px, env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px));
  --ui-max-h: min(92dvh, 92vh, 100%);
  /* Main menu: optically centered. Options: higher, fixed-height shell. */
  --menu-anchor-h: min(500px, 66dvh, 66vh);
  --menu-top: max(28px, calc((min(100dvh, 100vh) - var(--menu-anchor-h)) / 2));
  --settings-top: max(22px, 4.5vh);
  --settings-h: min(720px, calc(min(100dvh, 100vh) - var(--settings-top) - max(16px, var(--ui-pad))));
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #120e0b;
  font-family: "Kenney Future Narrow", "Trebuchet MS", sans-serif;
  color: var(--sand);
}

/* Play entry: hide engine chrome (DevLab, Debug, cheats dock, audio folders). */
html[data-engine="0"] [data-engine-only] {
  display: none !important;
}

/* Engine Hub — utilitarian editor chrome (engine entry only). */
#engineHub {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  padding: var(--ui-pad);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(18, 14, 11, 0.92) 0%, rgba(12, 9, 7, 0.96) 100%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(232, 213, 181, 0.03) 11px,
      rgba(232, 213, 181, 0.03) 12px
    );
  pointer-events: auto;
}

#engineHub.hidden {
  display: none !important;
}

.engine-hub-card {
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 26px 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.engine-hub-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.05;
}

.engine-hub-brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(26px, 5.5vw, 38px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff8e8;
}

.engine-hub-brand-engine {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 3.4vw, 24px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

.engine-hub-lede {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--sand-dim);
  max-width: 34em;
}

.engine-hub-play {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  letter-spacing: 0.06em;
}

.engine-hub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.engine-hub-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(232, 213, 181, 0.1);
}

.engine-hub-link {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sand);
  cursor: pointer;
  text-align: left;
}

.engine-hub-link:hover,
.engine-hub-link:focus-visible {
  color: var(--gold);
  outline: none;
}

.engine-hub-link code {
  font-size: 0.92em;
  color: var(--sand-dim);
}

.engine-hub-meta {
  font-size: 12px;
  color: var(--sand-dim);
}

.engine-hub-detail {
  margin: 0;
  padding: 12px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--sand);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}

.engine-hub-foot {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(196, 165, 116, 0.75);
}

.engine-hub-foot code {
  font-size: 0.95em;
}

body.engine-hub-open #menuOverlay,
body.engine-hub-open #loadoutOverlay {
  visibility: hidden;
}


/* Overlay chrome is a fixed design rectangle, then scaled uniformly.
   Internals never wrap/reorder from viewport width. Canvas still fills the window. */
.ui-stage-slot {
  --ui-w: 400px;
  --ui-h: 640px;
  --ui-scale: 1;
  width: calc(var(--ui-w) * var(--ui-scale));
  height: calc(var(--ui-h) * var(--ui-scale));
  flex-shrink: 0;
  position: relative;
}

.ui-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--ui-w);
  height: var(--ui-h);
  transform: translate(-50%, -50%) scale(var(--ui-scale));
  transform-origin: center center;
}

/* Shared: panels that must never clip content — scroll instead. */
.ui-scroll {
  max-height: var(--ui-max-h);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

.phase-fade {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.5s ease;
}

.phase-fade.active {
  pointer-events: auto;
}

.phase-fade.in {
  opacity: 1;
}

/* ---- Boot / loading ---- */

#bootOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: safe center;
  justify-content: safe center;
  padding: var(--ui-pad);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(240, 193, 75, 0.18), transparent 55%),
    linear-gradient(160deg, #1a120c 0%, #0c0907 55%, #1c1410 100%);
  pointer-events: auto;
}

#bootOverlay.hidden {
  display: none !important;
}

.boot-card {
  width: min(420px, 88vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.boot-brand {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(28px, 6vw, 44px);
  letter-spacing: 0.14em;
  color: #fff8e8;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 0 40px rgba(240, 193, 75, 0.25);
}

.boot-bar {
  width: 100%;
  height: 14px;
  border: 3px solid rgba(255, 248, 232, 0.35);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

#bootFill {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: transform 0.12s ease-out;
}

.boot-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.7;
  text-transform: uppercase;
}

/* ─── Pad focus: border is part of every control (grey → yellow) ───────────
 * Idle: --ui-edge. Pad focus (.gui-focus): --ui-edge-focus.
 * Activated (tab.active / checked / selected): fill the field — never a 2nd frame.
 */
button:focus,
button:focus-visible,
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
label[tabindex]:focus,
label[tabindex]:focus-visible {
  outline: none;
}

body.menu-pad-nav *:focus,
body.menu-pad-nav *:focus-visible {
  outline: none !important;
}

/* One focus rule for every clickable control in overlays */
body.menu-pad-nav button.gui-focus,
body.menu-pad-nav .btn-secondary.gui-focus,
body.menu-pad-nav .btn-ghost.gui-focus,
body.menu-pad-nav .settings-tab.gui-focus,
body.menu-pad-nav .choice-btn.gui-focus,
body.menu-pad-nav .music-track-play.gui-focus,
body.menu-pad-nav .pad-status-chip.gui-focus,
body.menu-pad-nav select.gui-focus,
body.menu-pad-nav .settings-select.gui-focus,
body.menu-pad-nav input[type="range"].gui-focus,
body.menu-pad-nav input[type="checkbox"].gui-focus,
body.menu-pad-nav .devlab-check.gui-focus,
body.menu-pad-nav .debug-check.gui-focus {
  border-color: var(--ui-edge-focus) !important;
}

/* Gold buttons: keep the fill; focus = brighter / creamier yellow (no inset frame) */
body.menu-pad-nav .btn-primary.gui-focus,
body.menu-pad-nav #startBtn.gui-focus,
body.menu-pad-nav .choice-btn.selected.gui-focus,
body.menu-pad-nav .loadout-actions.menu-actions #loadoutConfirmBtn.gui-focus {
  border-color: rgba(255, 248, 220, 0.95) !important;
  background: linear-gradient(180deg, #fff3c4, #f0c14b) !important;
  color: #1a1008 !important;
  filter: brightness(1.06);
  box-shadow: none;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#hud {
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  padding: 16px 20px;
  gap: 24px;
  transform: scale(var(--hud-scale, 1));
  transform-origin: top center;
}

.panel {
  width: 280px;
  flex-shrink: 0;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

/* 1P vs bot — keep both fat bars; label P2 as the bot. */
body.vs-bot #hud .panel.right {
  display: block;
}
body.vs-bot #hud .panel.left,
body.vs-bot #hud .panel.right {
  width: 280px;
}

.settings-select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 28px 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--ui-edge);
  background-color: rgba(12, 10, 14, 0.92);
  color: #fff0d8;
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  box-sizing: border-box;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 236, 210, 0.75) 50%),
    linear-gradient(135deg, rgba(255, 236, 210, 0.75) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.settings-inline .settings-select {
  margin-top: 0;
}

.settings-select-open {
  position: relative;
  z-index: 8;
  height: auto;
  overflow: visible;
  border-color: var(--ui-edge-focus);
}

.fill.ammo {
  background: #b7b09a;
  transition: transform 0.05s linear;
}

.fill.ammo.reloading {
  background: var(--ember);
  animation: reloadPulse 0.5s ease-in-out infinite;
}

.fill.super {
  background: linear-gradient(90deg, #7a5a00, var(--gold));
}

@keyframes reloadPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* ---- Dual akimbo crosshairs (projected from each gun) ---- */

.crosshair-pair {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.15s ease;
}

body.playing .crosshair-pair {
  opacity: 1;
}

body.playing.vs-bot .crosshair-pair-p2 {
  display: none;
}

.crosshair-pair .ch {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.72);
}

.crosshair-pair .ch-l,
.crosshair-pair .ch-r {
  background: #fff;
}

/* Independent of sights — JS places these at each gun muzzle ± outward. */
.ch-ammo {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  width: 3px;
  height: 26px;
  margin-left: -1px;
  margin-top: -13px;
  border-radius: 99px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

/* Foe mass cue (per local viewport POV) — ~20% smaller than prior. */
.mass-mark {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -29px;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.9));
}
.mass-mark.hidden {
  display: none !important;
}
.mass-mark.mass-heavy {
  width: 0;
  height: 0;
  margin-left: -9px;
  margin-top: -27px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 14px solid #ff3b30;
  background: none;
}
.mass-mark.mass-light {
  width: 0;
  height: 0;
  margin-left: -9px;
  margin-top: -18px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 14px solid #34c759;
  background: none;
}
.mass-mark.mass-eq {
  width: 13px;
  height: 13px;
  margin-left: -6.5px;
  margin-top: -26px;
  border-radius: 50%;
  background: #ffd60a;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.75);
}

.ch-ammo-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  border-radius: 99px;
  background: #fff8e8;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.72);
  transform: scaleY(1);
  transform-origin: bottom center;
}

.ch-ammo.reloading .ch-ammo-fill {
  background: #f0c14b;
}

.status-text {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  min-height: 14px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}

.weight-tag-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--dash-charge, 0) * 100%);
  transform: none;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  color: transparent;
  font-size: 0;
}

.weight-tag {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, 0);
  pointer-events: none;
  z-index: 4;
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff8e8;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.75), 0 0 10px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  padding: 0;
  overflow: visible;
  border-radius: 0;
  background: transparent;
}

.weight-tag-label {
  position: relative;
  z-index: 1;
}

.weight-tag.is-charging .weight-tag-fill {
  opacity: 1;
}

.weight-tag.is-charging .weight-tag-label {
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85), 0 0 10px rgba(0, 0, 0, 0.5);
}

.weight-tag.hidden {
  display: none;
}

.weight-tag-overhead {
  transform: translate(-50%, -100%);
}

#banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(22px, 5vw, 56px);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 8px 32px rgba(0, 0, 0, 0.55);
  text-align: center;
  max-width: min(92vw, 900px);
  padding: 0 12px;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  line-height: 1.15;
  pointer-events: none;
}

#banner.hidden {
  display: none;
}

#banner.countdown-banner {
  top: 50%;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(40px, 9vw, 96px);
  letter-spacing: 0;
  margin: 0;
  padding: 0;
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  color: #fff8e8;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.5), 0 0 40px rgba(240, 193, 75, 0.45);
  animation: countdown-pop 0.18s ease-out;
}

#banner.countdown-banner .countdown-ink {
  display: inline-block;
  letter-spacing: 0;
  line-height: 1;
}

/* Multi-letter (AKIMBO): pad left by letter-spacing so trailing tracking doesn't skew center */
#banner.countdown-banner.countdown-word .countdown-ink {
  letter-spacing: 0.1em;
  padding-left: 0.1em;
}

@keyframes countdown-pop {
  from { transform: translateY(-50%) scale(1.35); opacity: 0.55; }
  to { transform: translateY(-50%) scale(1); opacity: 1; }
}

#banner.match-tip {
  top: 18%;
  font-size: clamp(14px, 2.4vw, 22px);
  letter-spacing: 0.06em;
  opacity: 0.92;
  max-width: 90vw;
  line-height: 1.35;
  pointer-events: none;
}

#banner.win-banner {
  top: 16%;
  left: 50%;
  transform: translate(-50%, 0);
  max-width: none;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  text-shadow: none;
  pointer-events: none;
}

#banner.win-banner .win-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(560px, 94vw);
  padding: 22px 26px 18px;
  gap: 8px;
}

#banner.win-banner .win-title {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(22px, 4.2vw, 44px);
  letter-spacing: 0.08em;
  line-height: 1.15;
  color: #fff8e8;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  white-space: normal;
  overflow: visible;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

#banner.win-banner .win-sub {
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: clamp(12px, 2vw, 18px);
  letter-spacing: 0.1em;
  color: #fff8e8;
  opacity: 0.82;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

#banner.win-banner .win-actions {
  margin-top: 0.55em;
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: clamp(13px, 2vw, 18px);
  letter-spacing: 0.06em;
  line-height: 1.6;
  opacity: 0.92;
}

#banner.win-banner .win-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.65em;
}

#banner.win-banner .win-label {
  min-width: 5.5em;
  text-align: right;
  opacity: 0.88;
}

#banner.win-banner .win-keys {
  min-width: 5.5em;
  text-align: left;
  opacity: 0.95;
}

body.match-ended .crosshair-pair {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

/* Per-viewport KO while others still fight (split / multi) */
.death-veil {
  position: absolute;
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  pointer-events: none;
  box-sizing: border-box;
}

.death-veil.hidden {
  display: none !important;
}

.death-veil-label {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(28px, 6vw, 64px);
  letter-spacing: 0.14em;
  color: #fff8e8;
  text-shadow: 0 4px 0 rgba(80, 0, 0, 0.45);
}

/* Brief black veil while collapsing split → full-screen winner cam */
body.match-end-veil::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  background: #000;
  pointer-events: none;
  animation: match-end-veil-in 0.32s ease-out forwards;
}

@keyframes match-end-veil-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Prefer soft wraps at spaces — never mid-word — across menu chrome */
.menu-card,
.settings-card,
.tracklist-card,
.loadout-card,
.debug-card,
.win-panel,
.choice-btn,
.settings-kicker,
.pad-status-text {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}


#nowPlaying {
  position: absolute;
  left: 50%;
  top: max(16px, env(safe-area-inset-top, 0px));
  right: auto;
  bottom: auto;
  transform: translateX(-50%) translateY(-6px);
  text-align: center;
  pointer-events: none;
  z-index: 30;
  padding: 7px 14px 8px;
  background: rgba(8, 10, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  width: min(280px, 72vw);
  min-height: 0;
  max-height: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    visibility 0s linear 0.45s;
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

body.playing #nowPlaying {
  display: none !important;
}

#nowPlaying.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    visibility 0s linear 0s;
}

#nowPlaying.hidden {
  display: none !important;
}

#nowPlaying .np-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
}

#nowPlaying .np-kicker {
  font-size: 8px;
  letter-spacing: 0.2em;
  color: rgba(255, 220, 160, 0.8);
  margin: 0;
  text-align: center;
  line-height: 1;
}

#nowPlaying .np-spectrum {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 11px;
  flex: 0 0 auto;
}

#nowPlaying .np-spectrum span {
  display: block;
  width: 2.5px;
  height: 100%;
  border-radius: 1px;
  background: rgba(240, 193, 75, 0.9);
  transform: scaleY(0.28);
  transform-origin: bottom center;
  animation: np-bar 0.85s ease-in-out infinite alternate;
  opacity: 0.9;
}

#nowPlaying .np-spectrum span:nth-child(1) { animation-duration: 0.7s; animation-delay: 0s; }
#nowPlaying .np-spectrum span:nth-child(2) { animation-duration: 0.92s; animation-delay: 0.07s; }
#nowPlaying .np-spectrum span:nth-child(3) { animation-duration: 0.64s; animation-delay: 0.12s; }
#nowPlaying .np-spectrum span:nth-child(4) { animation-duration: 1.02s; animation-delay: 0.03s; }
#nowPlaying .np-spectrum span:nth-child(5) { animation-duration: 0.78s; animation-delay: 0.16s; }

@keyframes np-bar {
  0% { transform: scaleY(0.28); }
  100% { transform: scaleY(1); }
}

#nowPlaying .np-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

#nowPlaying .np-glyph {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  margin-left: 1px;
  margin-top: 2px;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent rgba(255, 232, 196, 0.88);
  pointer-events: none;
}

#nowPlaying .np-title-viewport {
  overflow: hidden;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 220px;
  text-align: center;
}

#nowPlaying .np-title {
  font-family: "Kenney Future", sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.15;
  white-space: nowrap;
  display: inline-block;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65);
}

#nowPlaying .np-title.np-scroll {
  min-width: 0;
  animation: np-title-marquee var(--np-scroll-dur, 4s) ease-in-out infinite alternate;
}

@keyframes np-title-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--np-scroll-dist, 0px))); }
}

/* Row of 1–4 portrait preview cards */
/* Portrait row: horizontal, all slots side by side */
.loadout-previews-row {
  display: flex;
  flex-direction: row;
  gap: 14px;
  width: 100%;
  justify-content: center;
  margin-bottom: 18px;
}

.loadout-portrait {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border: 2px solid var(--portrait-color, rgba(255,255,255,0.2));
  border-radius: 8px;
  background: rgba(0,0,0,0.35);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.loadout-portrait.active-slot {
  border-color: var(--portrait-color, rgba(255,255,255,0.6));
  box-shadow: 0 0 12px 2px color-mix(in srgb, var(--portrait-color) 50%, transparent);
}

.loadout-portrait:hover:not(.active-slot) {
  border-color: rgba(255,255,255,0.4);
}

.loadout-portrait-slot {
  font-family: "Kenney Future Narrow", monospace;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 4px 2px 2px;
  background: rgba(0,0,0,0.4);
}

.loadout-portrait canvas {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
}

.loadout-portrait-label {
  padding: 3px 6px;
  font-family: "Kenney Future Narrow", monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  background: rgba(0,0,0,0.55);
  color: var(--portrait-color, #fff);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Portrait slot colors matching pad-status-chip */
.loadout-portrait[data-slot="0"] { --portrait-color: #e85d4c; }
.loadout-portrait[data-slot="1"] { --portrait-color: #4cbe6c; }
.loadout-portrait[data-slot="2"] { --portrait-color: #4c9be8; }
.loadout-portrait[data-slot="3"] { --portrait-color: #f0c14b; }

.loadout-actions {
  margin-top: 0;
  width: 100%;
}

.loadout-actions.menu-actions .btn-primary,
.loadout-actions.menu-actions .btn-secondary,
.loadout-actions.menu-actions .btn-ghost {
  flex: none;
  min-height: 48px;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 16px;
  margin-top: 0;
  border-image: none;
  filter: none;
}

.loadout-actions.menu-actions #loadoutConfirmBtn {
  border: 1px solid rgba(240, 193, 75, 0.85);
  background: linear-gradient(180deg, #e8b84a, #c48928);
  color: #1a1008;
  font-family: "Kenney Future Narrow", sans-serif;
  letter-spacing: 0.08em;
  text-shadow: none;
  box-shadow: none;
  box-sizing: border-box;
}

.loadout-actions.menu-actions #loadoutConfirmBtn:hover {
  filter: brightness(1.06);
}

.loadout-preview-wrap {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  aspect-ratio: 4 / 3;
  height: auto;
  max-height: clamp(120px, 22dvh, 200px);
  background:
    radial-gradient(ellipse at 50% 28%, rgba(240, 193, 75, 0.2), transparent 52%),
    linear-gradient(180deg, rgba(30, 24, 20, 0.35), rgba(0, 0, 0, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

#loadoutPreview {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  display: block;
}

.loadout-picks {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

#sumoChoices.choice-row,
#weaponChoices.choice-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  width: 100%;
}

#sumoChoices .choice-btn,
#weaponChoices .choice-btn {
  flex: none;
  max-width: none;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
}

.loadout-preview-caption {
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 235, 200, 0.9);
}

#menuOverlay {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  padding: max(16px, var(--ui-pad));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(240, 193, 75, 0.08), transparent 50%),
    rgba(6, 8, 12, 0.18);
  opacity: 0;
  z-index: 6;
}

.menu-overlay-center {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: safe center;
  min-height: 0;
  overflow: hidden;
}

.player-join-bar {
  flex: 0 0 auto;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 10px 14px 6px;
  border-radius: 6px;
  background:
    linear-gradient(165deg, rgba(22, 14, 12, 0.52), rgba(10, 10, 14, 0.38));
  border: 1px solid rgba(240, 193, 75, 0.28);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}

.player-join-bar .pad-status-row {
  margin: 0;
}

.menu-session-bar {
  flex: 0 0 auto;
  width: min(960px, 100%);
  margin: 0 auto 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 6px;
  background:
    linear-gradient(165deg, rgba(22, 14, 12, 0.58), rgba(10, 10, 14, 0.42));
  border: 1px solid rgba(240, 193, 75, 0.22);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px) saturate(1.12);
  -webkit-backdrop-filter: blur(10px) saturate(1.12);
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.menu-actions .btn-primary,
.menu-actions .btn-secondary,
.menu-actions .btn-ghost {
  width: 100%;
}

#menuOverlay .menu-card .menu-actions button {
  width: 100%;
}

.session-debug-btn {
  display: none;
}

.menu-session-bar .menu-bot-row {
  margin: 0;
  padding: 10px 12px;
}

#settingsPanel .menu-bot-row {
  margin: 0;
  width: 100%;
}

#debugPanel {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: safe center;
  padding: max(12px, var(--ui-pad));
  background: rgba(8, 7, 6, 0.88);
}

#debugPanel.hidden {
  display: none;
}

.debug-card {
  width: min(520px, 96vw);
  max-height: min(92dvh, 92vh, 760px);
  overflow-y: auto;
  text-align: left;
  align-items: stretch;
}

.debug-title {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(22px, 5vw, 32px);
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-align: center;
}

.debug-lead {
  text-align: center;
  margin: 0 0 8px;
}

.debug-readout {
  margin: 0;
  padding: 10px 12px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #e8f4dc;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  max-height: 180px;
  overflow-y: auto;
}

.debug-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: rgba(255, 236, 210, 0.9);
  cursor: pointer;
  user-select: none;
}

.debug-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.debug-action-result {
  min-height: 1.2em;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-align: center;
  color: rgba(184, 245, 196, 0.9);
}

.debug-action-result[data-status="fail"] {
  color: #ffb4a8;
}

#debugHud {
  position: fixed;
  top: max(8px, env(safe-area-inset-top, 8px));
  right: max(8px, env(safe-area-inset-right, 8px));
  z-index: 12;
  max-width: min(42vw, 360px);
  pointer-events: none;
}

#debugHud pre {
  margin: 0;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(240, 193, 75, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1.4;
  color: #e8f4dc;
  white-space: pre-wrap;
}

body.debug-hud-on #nowPlaying {
  top: auto;
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  left: max(12px, env(safe-area-inset-left, 12px));
}

#menuOverlay.menu-reveal {
  animation: menuReveal 0.4s ease forwards;
}

#menuOverlay.menu-instant {
  animation: none;
  opacity: 1;
}

#menuOverlay.hidden {
  display: none;
  animation: none;
}

#menuOverlay.is-paused {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(240, 193, 75, 0.06), transparent 50%),
    rgba(6, 8, 12, 0.45);
}

/* Pause mode: hide main-menu-only elements, show pause-only ones */
#menuOverlay.is-paused #playerJoinBar {
  display: none !important;
}
#menuOverlay.is-paused .pause-only {
  display: block !important;
}
/* Main menu mode: hide pause-only elements */
#menuOverlay:not(.is-paused) .pause-only {
  display: none !important;
}

@keyframes menuReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.menu-card,
.menu-glass {
  width: min(420px, 92vw);
  max-height: var(--ui-max-h);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 28px 26px 22px;
  border-radius: 4px;
  background:
    linear-gradient(165deg, rgba(22, 14, 12, 0.42), rgba(10, 10, 14, 0.28));
  border: 1px solid rgba(240, 193, 75, 0.4);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.2),
    0 16px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.settings-card {
  width: min(480px, 94vw);
  overflow: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
}

.settings-card .settings-title,
.settings-card .settings-tabs,
.settings-card .menu-footer {
  flex: 0 0 auto;
}

.settings-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  position: relative;
  align-self: stretch;
}

.settings-card .settings-pane.active {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Inset from clip edges so scrollbar track caps aren’t chopped flat */
  padding: 8px 10px 10px 4px;
}

.menu-footer {
  flex: 0 0 auto;
  width: 100%;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 232, 196, 0.2);
}

.menu-footer .btn-primary,
.menu-footer .btn-secondary,
.menu-footer .btn-ghost {
  width: 100%;
}

#settingsCloseBtn {
  flex: 0 0 auto;
  margin-top: 0;
}

.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--gold);
  opacity: 0.9;
  margin-bottom: -4px;
}

#menuOverlay h1 {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(28px, 7vw, 58px);
  letter-spacing: 0.1em;
  color: #fff8e8;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  line-height: 1.05;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  max-width: 100%;
}

.controls-hint {
  font-size: 11.5px;
  opacity: 0.6;
  text-align: center;
  line-height: 1.6;
}

.sub {
  opacity: 0.85;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.lobby-status {
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
  color: #b8f5c4;
}

.pad-status-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.pad-status-row--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 720px) {
  .pad-status-row--4 {
    grid-template-columns: 1fr 1fr;
  }
}

.pad-status-chip .pad-status-text {
  font-size: 10px;
  line-height: 1.3;
  white-space: normal;
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* P1 colors: red | P2: green | P3: blue | P4: yellow */
.pad-status-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 8px 10px 6px;
  color: #fff8e8;
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
}

.pad-status-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pad-status-meter {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.pad-status-chip.bot-active .pad-status-meter,
.pad-status-chip.slot-addable:not(.waiting):not(.connected):not(.joining) .pad-status-meter {
  display: none;
}

.pad-status-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--chip-color, #f0c14b) 75%, #fff8e8);
  transition: width 0.05s linear;
}

.pad-status-chip.joining {
  opacity: 1;
  animation: none;
  border-color: color-mix(in srgb, var(--chip-color, #f0c14b) 55%, transparent);
}

.menu-split-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 10px;
  font-size: 13px;
  color: #fff0d0;
  cursor: pointer;
  user-select: none;
}

.menu-split-toggle.hidden {
  display: none;
}

.menu-split-toggle .settings-check {
  flex-shrink: 0;
}

.pad-status-chip.slot-locked {
  opacity: 0.5;
  pointer-events: none;
}

.pad-status-chip.waiting {
  opacity: 0.72;
  animation: joinPulse 1.4s ease-in-out infinite;
}

.pad-status-chip.connected {
  color: #b8f5c4;
  border-color: rgba(140, 245, 170, 0.5);
  background: rgba(60, 160, 90, 0.15);
  opacity: 1;
  animation: none;
}

/* Addable bot slot — dimmer, plus-sign style */
.pad-status-chip.slot-addable {
  opacity: 0.42;
  border-style: dashed;
  font-size: 11px;
  animation: none;
}
.pad-status-chip.slot-addable:hover {
  opacity: 0.75;
}
/* Bot slot active */
.pad-status-chip.bot-active {
  color: #a8d8ff;
  border-color: rgba(120, 190, 255, 0.5);
  background: rgba(40, 100, 180, 0.18);
  border-style: solid;
  opacity: 1;
  animation: none;
}

/* Per-player tint on the border */
.pad-status-chip:nth-child(1) { --chip-color: #e85d4c; }
.pad-status-chip:nth-child(2) { --chip-color: #4cbe6c; }
.pad-status-chip:nth-child(3) { --chip-color: #4c9be8; }
.pad-status-chip:nth-child(4) { --chip-color: #f0c14b; }
.pad-status-chip.connected,
.pad-status-chip.bot-active {
  border-color: color-mix(in srgb, var(--chip-color) 60%, transparent);
  color: color-mix(in srgb, var(--chip-color) 30%, #fff8e8);
  background: color-mix(in srgb, var(--chip-color) 10%, transparent);
}

@keyframes joinPulse {
  0%,
  100% { box-shadow: 0 0 0 0 rgba(240, 193, 75, 0.0); }
  50% { box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.35); }
}

.menu-secondary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.bot-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.menu-bot-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-bot-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  text-align: left;
}

.menu-bot-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.78;
  text-transform: uppercase;
}

.menu-bot-selects {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.menu-bot-check {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

.menu-bot-check .settings-check {
  justify-self: start;
  flex-shrink: 0;
}

.menu-weight-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-weight-row.hidden {
  display: none;
}

.menu-weight-row input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #f0c14b;
}

.menu-weight-row #weightValueLabel {
  float: right;
  letter-spacing: 0.04em;
  opacity: 1;
  text-transform: none;
}

.music-now-playing {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(240, 193, 75, 0.28);
  text-align: left;
}

.music-np-kicker {
  font-size: 9px;
  letter-spacing: 0.18em;
  opacity: 0.75;
  margin-bottom: 4px;
}

.music-np-title {
  font-family: "Kenney Future", sans-serif;
  font-size: clamp(14px, 2.2vw, 18px);
  letter-spacing: 0.04em;
  line-height: 1.25;
  margin-bottom: 10px;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.music-np-controls {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 6px;
  width: 100%;
}

.music-np-controls .music-ctrl-btn {
  width: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  height: 38px;
  flex: 0 0 38px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px !important;
  line-height: 1;
}

.music-np-controls .music-play-btn {
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  height: 46px;
  flex: 0 0 46px;
  font-size: 18px !important;
  border: 2px solid rgba(240, 193, 75, 0.55) !important;
}

/* Rounded trough via shell ::after — WebKit's native track cannot round top/bottom. */
.music-library-shell {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border: 1px solid rgba(255, 232, 196, 0.14);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
  box-sizing: border-box;
}

.music-library-shell::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  right: 5px;
  width: 8px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 1;
}

.music-library {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 8px 2px 8px 8px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  scrollbar-gutter: stable;
}

.music-library::-webkit-scrollbar {
  width: 14px;
  background: transparent;
}

.music-library::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.music-library::-webkit-scrollbar-thumb {
  background: rgba(240, 193, 75, 0.55);
  border-radius: 3px;
  /* Inset so thumb sits inside the fake trough */
  border: 3px solid transparent;
  background-clip: padding-box;
}

.music-library::-webkit-scrollbar-track {
  background: transparent !important;
  border: none !important;
  margin: 0;
  box-shadow: none;
}

/* Other panels — same mild thumb, no flat dark track strip */
.settings-card .settings-pane.active,
.loadout-card .loadout-picks,
.debug-body,
.menu-card.menu-glass,
.tracklist-card .tracklist-body,
.music-library {
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 193, 75, 0.55) transparent;
}

.settings-card .settings-pane.active::-webkit-scrollbar,
.loadout-card .loadout-picks::-webkit-scrollbar,
.debug-body::-webkit-scrollbar,
.menu-card.menu-glass::-webkit-scrollbar,
.tracklist-card .tracklist-body::-webkit-scrollbar {
  width: 10px;
  background: transparent;
}

.settings-card .settings-pane.active::-webkit-scrollbar-button,
.loadout-card .loadout-picks::-webkit-scrollbar-button,
.debug-body::-webkit-scrollbar-button,
.menu-card.menu-glass::-webkit-scrollbar-button,
.tracklist-card .tracklist-body::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.settings-card .settings-pane.active::-webkit-scrollbar-thumb,
.loadout-card .loadout-picks::-webkit-scrollbar-thumb,
.debug-body::-webkit-scrollbar-thumb,
.menu-card.menu-glass::-webkit-scrollbar-thumb,
.tracklist-card .tracklist-body::-webkit-scrollbar-thumb {
  background: rgba(240, 193, 75, 0.5);
  border-radius: 3px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.settings-card .settings-pane.active::-webkit-scrollbar-track,
.loadout-card .loadout-picks::-webkit-scrollbar-track,
.debug-body::-webkit-scrollbar-track,
.menu-card.menu-glass::-webkit-scrollbar-track,
.tracklist-card .tracklist-body::-webkit-scrollbar-track {
  background: transparent;
  border: none;
  margin: 0;
}

#tracklistPanel {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: safe center;
  padding: max(12px, var(--ui-pad));
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(8, 7, 6, 0.82);
}

#tracklistPanel.hidden {
  display: none;
}

#audioDebugPanel {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: safe center;
  padding: max(12px, var(--ui-pad));
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(8, 7, 6, 0.82);
}

#audioDebugPanel.hidden {
  display: none;
}

.audio-debug-lead {
  margin: 0;
  opacity: 0.75;
}

.audio-debug-help {
  margin: 0 0 8px;
  padding: 10px 12px;
  line-height: 1.35;
  color: rgba(255, 248, 232, 0.88);
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  min-height: 3.2em;
}

.audio-debug-section {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 248, 232, 0.12);
}

.audio-debug-section-title {
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: #f0c14b;
  margin-bottom: 4px;
}

.audio-debug-section-blurb {
  margin: 0 0 8px;
  opacity: 0.7;
  line-height: 1.3;
}

.audio-debug-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
  overflow-y: auto;
  max-height: 100%;
}

.audio-debug-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.audio-debug-val {
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.tracklist-card {
  width: min(480px, 94vw);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: stretch;
  gap: 12px;
}

.tracklist-card .settings-title,
.tracklist-card .menu-footer {
  flex: 0 0 auto;
}

.tracklist-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.settings-pane[data-pane="music"] {
  display: none;
}

.settings-card .settings-pane.active[data-pane="music"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-pane[data-pane="music"] .music-now-playing,
.settings-pane[data-pane="music"] .settings-hint {
  flex-shrink: 0;
}

.music-toggle-btn.active {
  border-color: rgba(240, 193, 75, 0.65) !important;
  background: rgba(240, 193, 75, 0.14) !important;
  color: #fff4dc !important;
}

.music-library-empty {
  text-align: left;
  margin: 0 0 8px;
}

.music-cat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(240, 193, 75, 0.88);
  padding: 10px 4px 2px;
}

.music-cat-label:first-child {
  padding-top: 2px;
}

.music-track-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.music-track-play {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--ui-edge);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.22);
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

body.menu-pad-nav .music-track-play.gui-focus {
  border-color: var(--ui-edge-focus);
}

.music-track-enable {
  width: 22px;
  height: 22px;
  margin: 0 4px 0 0;
  justify-self: end;
  align-self: center;
}

.music-track-row.is-playing .music-track-play {
  background: var(--ui-fill-active);
  border-color: rgba(255, 232, 196, 0.4);
}

.music-track-row.is-disabled .music-track-play {
  opacity: 0.42;
}

.music-track-row.is-disabled .music-track-title {
  text-decoration: line-through;
  opacity: 0.75;
}

.music-track-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0.7;
  text-align: center;
}

.music-track-title {
  font-size: 12.5px;
  letter-spacing: 0.03em;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

/* ---- Loadout select ---- */

#loadoutOverlay {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: safe center;
  padding: max(12px, var(--ui-pad));
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(8, 7, 6, 0.88);
}

#loadoutOverlay.hidden {
  display: none;
}

.loadout-card {
  width: min(920px, 96vw);
  max-height: none;
  overflow: hidden;
  overscroll-behavior: contain;
  flex-shrink: 0;
}

.loadout-card .sub {
  color: rgba(255, 240, 216, 0.88);
  opacity: 1;
}

.choice-name {
  display: block;
  line-height: 1.2;
  font-weight: 600;
}

.loadout-section {
  width: 100%;
  margin: 16px 0 8px;
}

.loadout-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 240, 216, 0.72);
  margin-bottom: 12px;
  text-align: left;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.choice-btn {
  flex: 1 1 140px;
  min-width: 110px;
  max-width: 200px;
  box-sizing: border-box;
  pointer-events: auto;
  border: 1px solid var(--ui-edge);
  border-radius: 4px;
  background: rgba(14, 11, 9, 0.84);
  color: #fff0d8;
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 8px 12px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.choice-btn:hover:not(.taken):not(:disabled) {
  border-color: rgba(240, 193, 75, 0.48);
  background: rgba(32, 24, 18, 0.94);
  color: #fff8e8;
}

.sumo-portrait {
  position: relative;
  width: 52px;
  height: 58px;
  margin: 0 auto 4px;
  display: block;
  pointer-events: none;
}

.sumo-portrait-face {
  position: absolute;
  left: 50%;
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--skin, #f0c9a0);
  transform: translateX(-50%);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.08);
  z-index: 1;
}

.sumo-portrait-hair {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 36px;
  height: 20px;
  border-radius: 18px 18px 8px 8px;
  background: var(--hair, #3a2418);
  transform: translateX(-50%);
  z-index: 0;
}

.sumo-portrait.hair-buzz .sumo-portrait-hair {
  height: 10px;
  top: 10px;
  width: 34px;
  border-radius: 10px 10px 4px 4px;
}

.sumo-portrait.hair-parted .sumo-portrait-hair {
  width: 38px;
  clip-path: polygon(0 40%, 48% 0, 52% 0, 100% 40%, 100% 100%, 0 100%);
}

.sumo-portrait-eye {
  position: absolute;
  top: 13px;
  width: 8px;
  height: 6px;
  border-radius: 50%;
  background: var(--eye, #fff6ea);
  box-shadow: 0 0 0 2px var(--iris, #1a1410) inset;
}

.sumo-portrait-eye.left { left: 8px; }
.sumo-portrait-eye.right { right: 8px; }

.sumo-portrait-brow {
  position: absolute;
  top: 8px;
  width: 10px;
  height: 3px;
  border-radius: 2px;
  background: var(--brow, #2a1810);
}

.sumo-portrait-brow.left { left: 7px; transform: rotate(-18deg); }
.sumo-portrait-brow.right { right: 7px; transform: rotate(18deg); }

.sumo-portrait-mouth {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 12px;
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: #a05050;
  transform: translateX(-50%);
}

.sumo-portrait-mawashi {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 48px;
  height: 9px;
  border-radius: 3px;
  background: var(--mawashi, #3d7fd4);
  transform: translateX(-50%);
}

.choice-akimbo {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 6px;
  pointer-events: none;
}

.gun-icon {
  position: relative;
  width: 34px;
  height: 18px;
  display: inline-block;
}

.gun-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 3px;
  width: 22px;
  height: 8px;
  border-radius: 1px;
  background: var(--gun, #c4cad2);
  box-shadow: 14px 1px 0 -2px #1a1816;
}

.gun-icon::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 9px;
  width: 8px;
  height: 9px;
  border-radius: 1px;
  background: #1e1e24;
}

.gun-icon.gun-smg::before {
  width: 26px;
  height: 9px;
  box-shadow: 18px 2px 0 -3px #1a1816;
}

.gun-icon.gun-smg::after {
  height: 12px;
  top: 10px;
}

.gun-icon.gun-lmg::before {
  left: 2px;
  width: 28px;
  height: 10px;
  box-shadow: 20px 2px 0 -2px #1a1816, 8px 8px 0 -3px #2a2a30;
}

.gun-icon.gun-lmg::after {
  left: 8px;
  top: 11px;
  width: 10px;
  height: 7px;
}

.gun-icon.gun-shotgun::before {
  width: 28px;
  height: 7px;
  border-radius: 2px;
  box-shadow: 16px 0 0 -2px #1a1816;
}

.gun-icon.gun-shotgun::after {
  left: 5px;
  top: 8px;
  width: 7px;
  height: 10px;
}

.gun-icon.gun-rocket::before {
  left: 2px;
  top: 4px;
  width: 26px;
  height: 10px;
  border-radius: 4px 2px 2px 4px;
  box-shadow: none;
}

.gun-icon.gun-rocket::after {
  left: 22px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c45a3a;
}

.gun-icon.gun-star::before {
  left: 8px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: none;
}

.gun-icon.gun-star::after {
  display: none;
}

.gun-icon.gun-katana::before {
  left: 6px;
  top: 1px;
  width: 4px;
  height: 16px;
  border-radius: 1px;
  background: linear-gradient(180deg, #e8eef4 0%, var(--gun, #c4cad2) 55%, #1a1816 100%);
  box-shadow: 8px 4px 0 -1px #5a4030;
}

.gun-icon.gun-katana::after {
  left: 4px;
  top: 14px;
  width: 8px;
  height: 4px;
  border-radius: 1px;
  background: #5a4030;
}

.gun-icon.gun-bottle::before {
  left: 11px;
  top: 1px;
  width: 10px;
  height: 14px;
  border-radius: 2px 2px 3px 3px;
  box-shadow: inset 0 -3px 0 #2a6a40;
}

.gun-icon.gun-bottle::after {
  left: 13px;
  top: 0;
  width: 6px;
  height: 4px;
  border-radius: 1px;
  background: #7ad0a0;
}

.gun-icon.gun-boomerang::before {
  left: 4px;
  top: 4px;
  width: 24px;
  height: 10px;
  border-radius: 10px 2px 10px 2px;
  box-shadow: none;
  transform: rotate(-18deg);
}

.gun-icon.gun-boomerang::after {
  display: none;
}

.gun-icon.gun-water::before {
  left: 6px;
  top: 3px;
  width: 18px;
  height: 10px;
  border-radius: 3px;
  box-shadow: 12px 1px 0 -3px #7ad0ff;
}

.gun-icon.gun-water::after {
  left: 8px;
  top: 10px;
  width: 7px;
  height: 7px;
  background: #2a6a90;
}

.gun-icon.gun-snow::before {
  left: 10px;
  top: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: none;
}

.gun-icon.gun-snow::after {
  left: 13px;
  top: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.55;
}

.gun-icon.gun-fireball::before {
  left: 10px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50% 40% 50% 40%;
  box-shadow: 0 0 0 2px #ff8a3a;
}

.gun-icon.gun-fireball::after {
  display: none;
}

.gun-icon.gun-phone::before {
  left: 11px;
  top: 1px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  box-shadow: inset 0 2px 0 #1a1816;
}

.gun-icon.gun-phone::after {
  left: 13px;
  top: 14px;
  width: 6px;
  height: 2px;
  border-radius: 1px;
  background: #3a3a42;
}

.gun-icon.gun-car::before {
  left: 4px;
  top: 5px;
  width: 24px;
  height: 8px;
  border-radius: 2px;
  box-shadow: 4px -4px 0 -2px var(--gun, #c4cad2);
}

.gun-icon.gun-car::after {
  left: 8px;
  top: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #1a1816;
  box-shadow: 12px 0 0 #1a1816;
}

.choice-btn .choice-blurb {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.02em;
  opacity: 1;
  font-family: system-ui, sans-serif;
  text-transform: none;
  color: rgba(255, 236, 210, 0.72);
  text-shadow: none;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
  line-height: 1.25;
}

.choice-btn.selected {
  border-color: rgba(255, 232, 196, 0.55);
  background: linear-gradient(180deg, #e8b84a 0%, #c48928 100%);
  color: #1a1008;
  text-shadow: none;
  box-shadow: none;
}

.choice-btn.selected .choice-blurb {
  color: rgba(26, 16, 8, 0.78);
  opacity: 1;
  text-shadow: none;
}

.choice-btn.taken {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 8, 0.55);
  color: rgba(255, 240, 216, 0.55);
}

.menu-secondary-btn {
  pointer-events: auto;
  border: 12px solid transparent;
  border-image: url("../assets/ui/btn-grey.png") 18 fill;
  background: transparent;
  color: #fff8e8;
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border-radius: 0;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.menu-secondary-btn:hover {
  filter: brightness(1.08);
  color: #0c0907;
}

#menuOverlay .menu-card button {
  width: 100%;
}

.hint-small {
  opacity: 0.6;
  font-size: 12px;
  text-align: center;
}

/* ---- Settings panel ---- */

#settingsPanel {
  pointer-events: auto;
  position: fixed;
  inset: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: safe center;
  padding: max(12px, var(--ui-pad));
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(8, 7, 6, 0.82);
}

#settingsPanel.hidden {
  display: none;
}

.settings-card {
  width: min(480px, 94vw);
  height: var(--settings-h);
  max-height: var(--settings-h);
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.settings-row {
  width: 100%;
  text-align: left;
}

.settings-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 42%);
  gap: 10px 14px;
  align-items: center;
  width: 100%;
  text-align: left;
}

.settings-toggle-row {
  grid-template-columns: minmax(0, 1fr) auto;
  cursor: pointer;
  min-height: 44px;
  padding: 4px 0;
  box-sizing: border-box;
}

.settings-kicker {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
  line-height: 1.3;
  white-space: nowrap;
}

.settings-inline .settings-select,
.settings-inline .settings-control {
  width: 100%;
  margin: 0;
  justify-self: stretch;
}

.settings-inline input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  accent-color: #f0c14b;
  cursor: pointer;
}

.settings-inline input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 232, 196, 0.22);
}

.settings-inline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f5d078, #c48928);
  border: 2px solid #fff8e8;
  box-shadow: 0 0 0 1px rgba(10, 8, 6, 0.9);
  cursor: pointer;
}

.settings-inline input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 232, 196, 0.22);
  border: none;
}

.settings-inline input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(180deg, #f5d078, #c48928);
  border: 2px solid #fff8e8;
  box-shadow: 0 0 0 1px rgba(10, 8, 6, 0.9);
  cursor: pointer;
}

/* Pad focus: only the thumb lights up — no outer box */
body.menu-pad-nav .settings-inline input[type="range"].gui-focus {
  border: none !important;
  background: transparent;
  box-shadow: none;
}

body.menu-pad-nav .settings-inline input[type="range"].gui-focus::-webkit-slider-thumb {
  border-color: #fff8e8;
  box-shadow: 0 0 0 2px var(--ui-edge-focus), 0 0 0 4px rgba(10, 8, 6, 0.95);
  transform: scale(1.12);
}

body.menu-pad-nav .settings-inline input[type="range"].gui-focus::-moz-range-thumb {
  box-shadow: 0 0 0 2px var(--ui-edge-focus), 0 0 0 4px rgba(10, 8, 6, 0.95);
}

.settings-check,
input[type="checkbox"].settings-check,
.music-track-enable,
.debug-check input[type="checkbox"],
.devlab-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  box-sizing: border-box;
  flex-shrink: 0;
  border: 1px solid var(--ui-edge);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  vertical-align: middle;
  position: relative;
}

.settings-check:checked,
input[type="checkbox"].settings-check:checked,
.music-track-enable:checked,
.debug-check input[type="checkbox"]:checked,
.devlab-check input[type="checkbox"]:checked {
  background: rgba(255, 240, 216, 0.12);
  border-color: rgba(255, 232, 196, 0.45);
}

.settings-check:checked::after,
input[type="checkbox"].settings-check:checked::after,
.music-track-enable:checked::after,
.debug-check input[type="checkbox"]:checked::after,
.devlab-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid rgba(255, 240, 216, 0.92);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.settings-check {
  justify-self: end;
}

.settings-row label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
  margin-bottom: 4px;
}

.settings-row input[type="range"] {
  width: 100%;
  accent-color: #f0c14b;
}

.music-status {
  width: 100%;
  text-align: left;
  opacity: 0.8;
}

.binds-section {
  width: 100%;
  margin-bottom: 14px;
}

.binds-section:last-child {
  margin-bottom: 0;
}

.binds-heading {
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin: 0 0 8px;
  text-transform: uppercase;
}

.binds-table {
  margin: 0;
  border: 1px solid rgba(255, 232, 196, 0.16);
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
}

.binds-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 232, 196, 0.1);
}

.binds-row:last-child {
  border-bottom: none;
}

.binds-row dt {
  margin: 0;
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff4dc;
}

.binds-row dd {
  margin: 0;
  text-align: right;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(255, 236, 210, 0.78);
}

.music-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.settings-hint {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.5;
}

.settings-section-break {
  height: 1px;
  margin: 10px 0 2px;
  background: rgba(255, 232, 196, 0.18);
}

.settings-pane[data-pane="audio"] > .settings-label {
  margin-top: 4px;
}

.settings-pane[data-pane="audio"] > .settings-hint {
  margin: 0 0 6px;
  padding-top: 0;
  border-top: none;
  font-size: 11px;
  opacity: 0.75;
  color: #d8c8b0;
}

.gfx-apply-btn {
  margin-top: 6px;
}

.gfx-apply-btn:disabled {
  opacity: 0.45;
  cursor: default;
  filter: none;
}

#gfxApplyOverlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 7, 6, 0.72);
  pointer-events: auto;
}

#gfxApplyOverlay.hidden {
  display: none !important;
}

.gfx-apply-card {
  font-family: "Kenney Future Narrow", sans-serif;
  letter-spacing: 0.12em;
  color: #fff4dc;
  font-size: 15px;
  padding: 16px 22px;
  border: 1px solid rgba(240, 193, 75, 0.55);
  background: rgba(18, 14, 12, 0.92);
}

/* Main CTA — same gold primary as Options BACK; focus brightens the fill. */
#startBtn {
  pointer-events: auto;
  width: 100%;
  border: 1px solid rgba(240, 193, 75, 0.85);
  border-image: none;
  background: linear-gradient(180deg, #e8b84a, #c48928);
  color: #1a1008;
  font-family: "Kenney Future Narrow", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 15px;
  padding: 12px 18px;
  border-radius: 3px;
  cursor: pointer;
  opacity: 1;
  transform: none;
  text-shadow: none;
  box-shadow: none;
  box-sizing: border-box;
  transition: filter 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

#startBtn:hover {
  filter: brightness(1.06);
}

#resumeBtn {
  pointer-events: auto;
  border: 14px solid transparent;
  border-image: url("../assets/ui/btn-blue.png") 18 fill;
  background: transparent;
  color: #fff8e8;
  font-family: "Kenney Future", sans-serif;
  font-size: 16px;
  letter-spacing: 0.1em;
  padding: 10px 24px;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

#startBtn:disabled {
  opacity: 0.42;
  filter: grayscale(0.25);
  cursor: default;
  transform: none;
  animation: none;
}

#startBtn.gp-focus {
  opacity: 1;
}

.menu-mode-soon {
  opacity: 0.72;
}

.menu-mode-soon:hover {
  opacity: 0.85;
}

@keyframes gpPulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(240, 193, 75, 0.85), 0 0 16px rgba(240, 193, 75, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(240, 193, 75, 1), 0 0 32px rgba(240, 193, 75, 0.9);
  }
}

.rematch-hint {
  display: inline-block;
  animation: gpPulse 1.1s ease-in-out infinite;
  border-radius: 4px;
  padding: 4px 10px;
}


/* ---- Dojo glass buttons (readable on cinematic bg) ---- */
.btn-primary,
.btn-secondary,
.btn-ghost,
.settings-tab {
  pointer-events: auto;
  font-family: "Kenney Future Narrow", sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 3px;
  transition: filter 0.12s ease, background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-primary {
  width: 100%;
  border: 1px solid rgba(240, 193, 75, 0.85);
  background: linear-gradient(180deg, #e8b84a, #c48928);
  color: #1a1008;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 18px;
  text-shadow: none;
  box-sizing: border-box;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  width: 100%;
  border: 1px solid var(--ui-edge);
  background: rgba(18, 14, 12, 0.72);
  color: #fff0d8;
  font-size: 13px;
  padding: 10px 16px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.btn-secondary:hover {
  border-color: rgba(240, 193, 75, 0.65);
  background: rgba(36, 24, 16, 0.85);
  color: #fff8e8;
}

.btn-ghost {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.28);
  color: #e8dcc8;
  font-size: 12px;
  padding: 8px 14px;
}

.btn-ghost:hover {
  border-color: rgba(240, 193, 75, 0.45);
  color: #fff8e8;
}

.import-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#menuOverlay .menu-card button,
#settingsPanel .menu-card button.btn-primary,
#settingsPanel .menu-card button.btn-secondary,
#settingsPanel .menu-card button.btn-ghost:not(.music-ctrl-btn) {
  width: 100%;
}

#settingsPanel .menu-card button.btn-secondary.active {
  border-color: #f0c14b;
  background: linear-gradient(180deg, rgba(232, 184, 74, 0.95), rgba(180, 120, 32, 0.95));
  color: #1a1008;
}

.settings-title {
  font-size: clamp(22px, 4vw, 32px) !important;
  margin: 0;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.settings-tab {
  border: 1px solid var(--ui-edge);
  background: rgba(0, 0, 0, 0.35);
  color: #c8b8a0;
  font-size: clamp(7px, 1.8vw, 9px);
  letter-spacing: 0.03em;
  padding: 8px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.settings-tab.active {
  border-color: rgba(255, 232, 196, 0.4);
  background: var(--ui-fill-active);
  color: #fff4dc;
}

.settings-pane {
  display: none;
  width: 100%;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.settings-pane.active {
  display: flex;
  align-items: flex-start;
}

.settings-card .settings-pane.active[data-pane="gameplay"],
.settings-card .settings-pane.active[data-pane="audio"] {
  justify-content: flex-start;
}

.settings-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #f0c14b;
  margin: 0;
}

#settingsPanel {
  background: rgba(6, 8, 12, 0.35);
  backdrop-filter: blur(4px);
}

.settings-pane.active .settings-inline {
  overflow: visible;
}

.pad-status-chip {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 232, 196, 0.25);
}

.menu-secondary-btn {
  /* legacy alias — keep readable if any remain */
  border: 1px solid rgba(255, 232, 196, 0.35) !important;
  border-image: none !important;
  background: rgba(18, 14, 12, 0.75) !important;
  color: #fff0d8 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75) !important;
}

.menu-secondary-btn:hover {
  color: #fff8e8 !important;
  filter: none;
}

/* ---- Dev Lab (AI / designer sandbox) ---- */

#devLabOverlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  background: rgba(6, 8, 12, 0.92);
}

#devLabOverlay.hidden {
  display: none;
}

.devlab-shell {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  width: 100%;
  height: 100%;
  gap: 0;
  overflow: hidden;
}

.devlab-panel.menu-glass {
  width: 100%;
  max-width: none;
  max-height: none;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  text-align: left;
  border-radius: 0;
  padding: 18px 20px 32px 28px;
  overflow-x: visible;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  min-width: 0;
  flex-shrink: 1;
  border-right: 1px solid rgba(255, 232, 196, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.devlab-panel > * {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.devlab-panel .brand-kicker,
.devlab-panel .devlab-title,
.devlab-panel .hint-small {
  text-align: left;
}

.devlab-panel input[type="range"] {
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  min-width: 0;
  accent-color: #e8b84a;
}

.devlab-title {
  margin: 0;
  font-size: clamp(20px, 3.5vw, 28px);
  letter-spacing: 0.06em;
}

.devlab-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  opacity: 0.9;
}

.devlab-label select,
.devlab-label input[type="range"] {
  width: 100%;
  font-family: inherit;
}

.devlab-label select {
  background: rgba(0, 0, 0, 0.45);
  color: #fff8e8;
  border: 1px solid rgba(255, 232, 196, 0.3);
  padding: 8px;
}

.devlab-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
}

.devlab-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.devlab-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 232, 196, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.devlab-section-title {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: rgba(255, 232, 196, 0.7);
}

.devlab-section .devlab-presets {
  grid-template-columns: 1fr;
}

.devlab-readout {
  margin-top: 4px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 232, 196, 0.15);
  font-size: 12px;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

.devlab-viewport {
  position: relative;
  min-height: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(240, 193, 75, 0.08), transparent 55%),
    #12151a;
}

#devLabCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

#devAuditGridOverlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.72);
  padding: 24px;
}

#devAuditGridOverlay.hidden {
  display: none;
}

.dev-audit-shell {
  max-width: min(1280px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dev-audit-shell header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dev-audit-shell img {
  width: 100%;
  height: auto;
  border: 1px solid rgba(255, 232, 196, 0.2);
}

.dev-audit-json {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
}

@media (max-width: 800px) {
  .devlab-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 50vh) minmax(0, 1fr);
  }
  .devlab-panel {
    max-height: 50vh;
    border-right: none;
    border-bottom: 1px solid rgba(255, 232, 196, 0.18);
  }
}

/* Cards inside a ui-stage fill the design rectangle. Viewport min() widths must not win. */
.ui-stage > .menu-card,
.ui-stage > .menu-glass,
.ui-stage > .settings-card,
.ui-stage > .tracklist-card,
.ui-stage > .loadout-card,
.ui-stage > .debug-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.ui-stage > .settings-card,
.ui-stage > .tracklist-card,
.ui-stage > .loadout-card,
.ui-stage > .debug-card {
  height: 100%;
  max-height: none;
  overflow: hidden;
}

.ui-stage > .menu-card:not(.settings-card):not(.tracklist-card):not(.loadout-card):not(.debug-card) {
  height: auto;
  max-height: min(92dvh, 92vh);
}

.debug-body {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.loadout-card .loadout-picks {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  width: 100%;
}

.ui-stage .loadout-preview-wrap {
  max-height: 240px;
}

.settings-ghost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 4px 2px;
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.22;
  color: #fff0d8;
  cursor: pointer;
}

.settings-ghost-row:hover,
.settings-ghost-row:focus-within {
  opacity: 0.8;
}

.settings-ghost-row .settings-check {
  width: 16px;
  height: 16px;
  justify-self: auto;
}

/* ─── Split loadout (2–4 human seats, side-by-side) ──────────────────────── */
.split-loadout-root {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  margin: 4px 0 8px;
}

.split-loadout-root.hidden {
  display: none;
}

.split-loadout-cols {
  display: grid;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.split-loadout-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px 10px 12px;
  border: 2px solid color-mix(in srgb, var(--panel-color, #fff) 55%, transparent);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.38);
}

.split-loadout-panel.is-ready {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--panel-color) 70%, transparent),
    0 0 14px color-mix(in srgb, var(--panel-color) 35%, transparent);
  background: color-mix(in srgb, var(--panel-color) 12%, rgba(0, 0, 0, 0.42));
}

.split-loadout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Kenney Future Narrow", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(255, 240, 216, 0.88);
}

.split-loadout-badge {
  background: var(--panel-color, var(--ember));
  color: #1a1008;
  font-family: "Kenney Future", monospace;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 7px;
}

.split-loadout-title {
  opacity: 0.85;
}

.split-loadout-portrait {
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.split-loadout-portrait canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  max-height: 96px;
}

.split-loadout-caption {
  padding: 3px 6px;
  font-family: "Kenney Future Narrow", monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--panel-color, #fff);
  background: rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.split-loadout-section {
  width: 100%;
}

.split-loadout-section .loadout-label {
  margin-bottom: 6px;
}

.split-loadout-choices {
  gap: 6px;
}

.split-loadout-choices[data-kind="sumo"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.split-loadout-choices[data-kind="weapon"] {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.split-loadout-choices .choice-btn {
  flex: none;
  min-width: 0;
  max-width: none;
  padding: 6px 4px 8px;
  font-size: 10px;
  gap: 2px;
}

.split-loadout-choices .sumo-portrait {
  width: 34px;
  height: 38px;
}

.split-loadout-choices .choice-akimbo {
  transform: scale(0.92);
  transform-origin: center top;
  margin-bottom: 2px;
}

.split-loadout-choices .choice-name {
  font-size: 9px;
  letter-spacing: 0.02em;
}

.split-loadout-choices .choice-blurb {
  font-size: 9px;
}

.split-loadout-ready {
  width: 100%;
  margin-top: 4px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.loadout-card.is-split-mode {
  width: 100%;
}

#loadoutOverlay.is-split-loadout #loadoutClassic {
  display: none;
}

#loadoutOverlay.is-split-loadout #loadoutConfirmBtn {
  display: none;
}

/* Tab chat-shot toast */
.chat-shot-toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(8px);
  z-index: 80;
  pointer-events: none;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(8, 10, 16, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 232, 196, 0.95);
  font-family: "Kenney Future Narrow", sans-serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-shot-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0s;
}
