:root {
  color-scheme: light;
  --bg: #0b0b10;
  --fg: #f3f3f3;
  --muted: #b7b7c2;
  --accent: #ff9f1c;
  --panel: rgba(12, 12, 18, 0.85);
  --scrollbar-track: rgba(20, 14, 7, 0.6);
  --scrollbar-thumb: linear-gradient(180deg, rgba(255, 214, 143, 0.85), rgba(255, 154, 44, 0.85));
  --scrollbar-thumb-hover: linear-gradient(180deg, rgba(255, 227, 173, 0.95), rgba(255, 170, 73, 0.95));
  --scrollbar-thumb-color: rgba(255, 186, 82, 0.65);
  --panel-elastic-ease: linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
  background: var(--scrollbar-thumb);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(1200px 800px at 20% 10%, #1b1b28, #09090d 60%, #050508 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--fg);
}

html.builder-playtest-boot,
html.builder-playtest-boot body {
  background: #000;
}

html.builder-playtest-boot body::before {
  content: "Preparing Playtest";
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  z-index: 9999;
  pointer-events: none;
}

body.gameplay-active {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#hud-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 6;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#nuke-orange-filter {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background: #ff8f2f;
  opacity: 0;
}

#nuke-white-filter {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: #ffffff;
  opacity: 0;
}

.touch-controls {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  --joystick-scale: 1;
}

.touch-controls.active {
  pointer-events: auto;
}

.touch-controls.preview {
  inset: auto;
  left: 16px;
  bottom: 16px;
  width: min(46vw, 240px);
  height: min(46vw, 240px);
  pointer-events: auto;
  z-index: 11;
}

.touch-controls.hidden {
  display: none;
}

.touch-controls .joystick {
  position: absolute;
  width: 140px;
  height: 140px;
  transform: translate(-50%, -50%) scale(var(--joystick-scale));
  pointer-events: none;
}

.touch-controls .joystick.hidden {
  display: none;
}

.touch-controls.preview .joystick {
  left: 50%;
  top: 50%;
  pointer-events: auto;
}

.touch-controls .joystick-base {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

.touch-controls .joystick-handle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(255, 159, 28, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.stage-fade {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 333ms linear;
  z-index: 8;
}

.wormhole-warp {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 100ms ease-out;
}

.wormhole-warp.active {
  opacity: 1;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  z-index: 10;
  padding: 16px;
}

.overlay.hidden {
  display: none;
}

.smb-logo {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 11;
  pointer-events: none;
}

.smb-logo img {
  width: 240px;
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

.overlay:has(#mp-lobby-view:not(.hidden)) .smb-logo {
  display: none !important;
}

.overlay:has(#mp-level-editor-view:not(.hidden)) .smb-logo {
  display: none !important;
}

#host-pause-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 15;
  pointer-events: auto;
  padding: 20px;
  box-sizing: border-box;
}

#host-pause-overlay.hidden {
  display: none;
}

.pause-text {
  font-size: 4rem;
  font-weight: bold;
  color: var(--fg);
  text-shadow: 0 0 20px rgba(255, 159, 28, 0.8), 0 0 40px rgba(255, 159, 28, 0.4);
  animation: pulse 2s ease-in-out infinite;
  pointer-events: none;
  /* Prevent text from blocking clicks */
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.host-pause-buttons {
  display: flex;
  gap: 20px;
  margin-top: 40px;
  z-index: 16;
}

.host-resume-button,
.host-end-game-button {
  flex: 0 !important;
  position: relative;
  background: #FFC107;
  color: #000;
  border: none;
  padding: 12px 24px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  align-self: center;
  width: auto;
  min-width: 150px;
  white-space: nowrap;
}

.host-resume-button {
  background: #4CAF50;
  color: #fff;
}

.host-resume-button:hover {
  background: #66BB6A;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.host-end-game-button:hover {
  background: #FFD54F;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.host-resume-button:active,
.host-end-game-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 20;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(460px, 92vw);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.modal-content {
  width: min(400px, 90vw);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.level-change-modal-content {
  border-color: rgba(255, 200, 0, 0.4);
  animation: level-change-modal-in 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.modal-content h3 {
  margin: 0 0 16px;
  font-size: 24px;
  color: var(--fg);
}

.modal-content p {
  margin: 0 0 24px;
  font-size: 16px;
  color: var(--fg);
  opacity: 0.9;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  white-space: nowrap;
}

.modal-button-confirm {
  background: #FFC107;
  color: #000;
}

.modal-button-confirm:hover {
  background: #FFD54F;
  transform: translateY(-2px);
}

.modal-button-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg);
}

.modal-button-cancel:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.modal-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.stage-export-modal-content {
  width: min(460px, 92vw);
  text-align: left;
}

.stage-export-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 8px;
}

.stage-export-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4fc3f7 0%, #81c784 100%);
  transition: width 0.25s ease;
}

.stage-export-status-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 18px;
}

.stage-export-progress-label {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.stage-export-spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  animation: stage-export-spin 0.8s linear infinite;
}

.stage-export-spinner.hidden {
  display: none;
}

.stage-export-modal-content.error .stage-export-progress-fill {
  background: linear-gradient(90deg, #ef5350 0%, #ff8a65 100%);
}

.stage-export-modal-content.error .stage-export-progress-label {
  color: #ffb3ae;
}

@keyframes stage-export-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes level-change-modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.item-shop-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1300;
}

.item-shop-modal.hidden {
  display: none;
}

.item-shop-card {
  width: min(940px, 96vw);
  max-height: min(86vh, 760px);
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(12, 12, 18, 0.96), rgba(8, 8, 14, 0.96));
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.item-shop-modal.is-controller-layout .item-shop-card {
  max-height: none;
}

.item-shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-shop-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.item-shop-banana-hud {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 204, 64, 0.12);
  border: 1px solid rgba(255, 204, 64, 0.45);
  border-radius: 999px;
  padding: 5px 12px;
}

.item-shop-banana-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.item-shop-banana-value {
  color: #ffe66e;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.item-shop-section-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}

.item-shop-owned-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-left: 6px;
  padding-right: 6px;
  padding-top: 6px;
  padding-bottom: 4px;
  min-height: 92px;
  scrollbar-gutter: stable;
}

.item-shop-empty-owned {
  width: 100%;
  min-height: 70px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
}

.item-shop-owned-item {
  appearance: none;
  position: relative;
  min-width: 88px;
  max-width: 88px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.item-shop-owned-item:hover {
  border-color: rgba(255, 204, 64, 0.65);
  background: rgba(255, 255, 255, 0.08);
}

.item-shop-owned-item.is-controller-focus {
  border-color: rgba(93, 208, 255, 0.9);
  background: rgba(93, 208, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(93, 208, 255, 0.6), 0 0 0 2px rgba(93, 208, 255, 0.25);
}

.item-shop-owned-item.is-primary {
  border-color: rgba(255, 204, 64, 0.9);
  background: rgba(255, 204, 64, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 64, 0.6);
}

.item-shop-owned-item.is-primary.is-controller-focus {
  border-color: rgba(93, 208, 255, 0.94);
  background: rgba(93, 208, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(93, 208, 255, 0.65), 0 0 0 2px rgba(93, 208, 255, 0.24);
}

.item-shop-owned-icon {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.item-shop-owned-name {
  width: 100%;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.9);
}

.item-shop-owned-count {
  position: absolute;
  right: 6px;
  bottom: 20px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.82);
  color: #ffe66e;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}

.item-shop-purchase {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.item-shop-purchase-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.item-shop-purchase-list.item-shop-purchase-list-controller {
  overflow: visible;
  padding-right: 0;
}

.item-shop-modal:not(.is-controller-layout) .item-shop-purchase-list {
  overflow: visible;
}

.item-shop-controller-layout {
  position: relative;
  width: 100%;
  min-height: 520px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.2));
  overflow: visible;
  padding: 14px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-shop-modal:not(.is-controller-layout) .item-shop-controller-layout {
  min-height: 420px;
  margin-bottom: 12px;
  z-index: 0;
}

.item-shop-controller-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.item-shop-entry-grid {
  position: relative;
  width: 100%;
  min-height: 110px;
}

.item-shop-modal:not(.is-controller-layout) .item-shop-entry-grid {
  min-height: 64px;
}

.item-shop-modal:not(.is-controller-layout) .item-shop-entry-grid .item-shop-entry-icon-wrap {
  height: 60px;
}

.item-shop-modal:not(.is-controller-layout) .item-shop-entry-grid .item-shop-entry-icon {
  width: 42px;
  height: 42px;
}

.item-shop-entry-grid .item-shop-entry-icon-wrap {
  width: 100%;
  height: 68px;
}

.item-shop-entry-grid .item-shop-entry-icon {
  width: 46px;
  height: 46px;
}

.item-shop-entry-grid .item-shop-entry-cost {
  min-height: 22px;
  padding: 2px 6px;
}

.item-shop-entry-coming-soon {
  display: grid;
  place-items: center;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.52);
  text-align: center;
  padding: 0 6px;
}

.item-shop-entry {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 12px;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.item-shop-entry-compact {
  position: absolute;
  width: 132px;
  min-height: 142px;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
}

.item-shop-entry-compact .item-shop-entry-icon-wrap {
  width: 96px;
  height: 82px;
}

.item-shop-entry-compact .item-shop-entry-icon {
  width: 58px;
  height: 58px;
}

.item-shop-entry-compact .item-shop-entry-cost {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  min-height: 22px;
}

.item-shop-entry-grid.item-shop-entry-compact {
  position: relative;
  width: 100%;
  min-height: 110px;
}

.item-shop-entry-empty {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}

.item-shop-controller-slot-up {
  left: 50%;
  top: 52px;
  transform: translateX(-50%);
}

.item-shop-controller-slot-right {
  right: 54px;
  top: 50%;
  transform: translateY(-50%);
}

.item-shop-controller-slot-down {
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
}

.item-shop-controller-slot-left {
  left: 54px;
  top: 50%;
  transform: translateY(-50%);
}

.item-shop-entry:hover {
  border-color: rgba(255, 204, 64, 0.9);
  background: rgba(255, 204, 64, 0.12);
}

.item-shop-entry.is-controller-focus {
  border-color: rgba(255, 204, 64, 0.9);
  background: rgba(255, 204, 64, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 64, 0.6), 0 0 0 2px rgba(255, 204, 64, 0.28);
}


.item-shop-entry.is-unaffordable {
  opacity: 0.58;
  border-color: rgba(255, 255, 255, 0.12);
}

.item-shop-entry.is-disabled {
  opacity: 0.7;
  border-color: rgba(255, 96, 96, 0.55);
  background: rgba(255, 96, 96, 0.08);
}

.item-shop-entry.is-disabled:hover,
.item-shop-entry.is-disabled.is-controller-focus {
  border-color: rgba(255, 96, 96, 0.72);
  background: rgba(255, 96, 96, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 96, 96, 0.36), 0 0 0 2px rgba(255, 96, 96, 0.16);
}

.item-shop-controller-detail {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.38);
  padding: 10px 12px;
  min-height: 104px;
  display: none;
}

.item-shop-modal.is-controller-layout .item-shop-controller-detail {
  display: block;
}

.item-shop-modal:not(.is-controller-layout) .item-shop-controller-detail {
  display: block;
  position: relative;
  z-index: 1;
}

.item-shop-controller-detail-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.item-shop-controller-detail-body {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.35;
}


@keyframes item-shop-purchase-success-blink {
  0% {
    border-color: rgba(255, 159, 28, 0.96);
    background: rgba(255, 159, 28, 0.3);
    box-shadow: inset 0 0 0 1px rgba(255, 159, 28, 0.7), 0 0 0 2px rgba(255, 159, 28, 0.28);
  }
  50% {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: none;
  }
  100% {
    border-color: rgba(255, 159, 28, 0.96);
    background: rgba(255, 159, 28, 0.3);
    box-shadow: inset 0 0 0 1px rgba(255, 159, 28, 0.7), 0 0 0 2px rgba(255, 159, 28, 0.28);
  }
}

.item-shop-entry.is-purchase-success {
  animation: item-shop-purchase-success-blink 0.18s step-end 4;
}

.item-shop-entry-icon-wrap {
  position: relative;
  width: 92px;
  height: 70px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.38);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.item-shop-entry-icon {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.item-shop-entry-icon-cancel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 2px solid rgba(255, 92, 92, 0.98);
  background: rgba(0, 0, 0, 0.62);
  display: none;
  pointer-events: none;
}

.item-shop-entry-icon-cancel::before {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 2px;
  background: rgba(255, 92, 92, 0.98);
  transform: translateY(-50%) rotate(-35deg);
  transform-origin: center;
}

.item-shop-entry.is-disabled .item-shop-entry-icon-cancel {
  display: block;
}

.item-shop-entry-cost {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.74);
}

.item-shop-entry-cost-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

.item-shop-entry-cost-value {
  color: #ffe66e;
  font-size: 12px;
  font-weight: 700;
}

.item-shop-entry-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.item-shop-entry-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.item-shop-entry-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.35;
}

.item-shop-entry-owned {
  align-self: center;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.item-shop-entry-owned-count {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
}

.item-shop-entry-owned-budget {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.66);
  white-space: nowrap;
}

.item-shop-footer {
  display: flex;
  justify-content: flex-end;
}

.item-shop-close {
  appearance: none;
  border: 1px solid rgba(255, 159, 28, 0.7);
  background: rgba(255, 159, 28, 0.16);
  color: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

.item-shop-close:hover {
  background: rgba(255, 159, 28, 0.28);
}

.item-shop-close.is-controller-focus {
  border-color: rgba(93, 208, 255, 0.92);
  background: rgba(93, 208, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(93, 208, 255, 0.62), 0 0 0 2px rgba(93, 208, 255, 0.22);
}

#gamepad-calibration-map {
  width: 100%;
  max-width: 260px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 12, 0.6);
  display: block;
  margin: 0 auto 12px;
}

.hidden {
  display: none !important;
}

.panel {
  width: min(560px, 94vw);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: width 420ms cubic-bezier(0.34, 1.56, 0.64, 1), min-height 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: width 620ms var(--panel-elastic-ease), min-height 620ms var(--panel-elastic-ease);
}

.panel:has(#mp-lobby-view:not(.hidden)) {
  width: min(1180px, 96vw);
  min-height: min(780px, calc(100vh - 32px));
}

.panel:has(#mp-pause-view:not(.hidden)) {
  width: min(1120px, 96vw);
  min-height: 0;
}

.panel:has(#mp-level-editor-embedded-view:not(.hidden)) {
  width: min(1180px, 96vw);
}

.panel:has(#mp-level-editor-load-stage-view:not(.hidden)),
.panel:has(#mp-level-editor-pack-list-view:not(.hidden)),
.panel:has(#mp-level-editor-pack-editor-view:not(.hidden)) {
  width: min(1120px, 96vw);
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: 0.3px;
}

.panel p {
  margin: 0 0 16px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}

.control-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.control-mode-row select {
  flex: 1 1 200px;
}

.control-mode-row .compact {
  flex: 0 0 auto;
  padding: 8px 12px;
  font-size: 12px;
}

.gyro-helper {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gyro-helper-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 12, 0.6);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
  perspective: 220px;
  --gyro-x: 0deg;
  --gyro-y: 0deg;
}

.gyro-helper-ghost,
.gyro-helper-device {
  position: absolute;
  inset: 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform-style: preserve-3d;
}

.gyro-helper-ghost {
  background: rgba(255, 255, 255, 0.06);
  transform: rotateX(60deg);
}

.gyro-helper-device {
  background: rgba(255, 159, 28, 0.2);
  border-color: rgba(255, 159, 28, 0.65);
  transform: rotateX(calc(60deg + var(--gyro-x))) rotateY(var(--gyro-y));
  transition: transform 80ms linear;
}

.gyro-helper-device.at-limit {
  background: rgba(255, 77, 61, 0.35);
  border-color: rgba(255, 77, 61, 0.85);
}

.checkbox-field {
  margin-top: 4px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-group {
  margin-bottom: 16px;
}

.control-mode-settings {
  margin: 0 0 16px;
}

.control-mode-block {
  margin-bottom: 12px;
}

.control-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 6px;
}

.response-curve {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 12, 0.6);
  display: grid;
  place-items: center;
}

.response-curve svg {
  width: 100%;
  height: 100%;
}

.response-curve path {
  fill: none;
  stroke: rgba(255, 159, 28, 0.85);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-falloff-visuals {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.input-preview {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 12, 0.6);
  overflow: hidden;
}

.input-preview-grid {
  position: absolute;
  inset: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.input-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
}

.input-dot.raw {
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

.input-dot.processed {
  background: rgba(255, 77, 61, 0.95);
  box-shadow: 0 0 6px rgba(255, 77, 61, 0.75);
}

.slider-field span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

output {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.slider-field output {
  transform-origin: center;
}

.slider-field output.is-controller-adjusted {
  animation: sliderValueBounce 0.22s ease-in-out;
}

@keyframes sliderValueBounce {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

input[type="text"],
input[type="password"],
textarea,
select {
  padding: 14px 18px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #f3f3f3;
  color: #1b1200;
  color-scheme: light;
  -webkit-text-fill-color: #1b1200;
  transition: all 0.2s ease;
  outline: none;
}

select {
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}

select:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

select:hover:not(:disabled) {
  border-color: rgba(255, 204, 64, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

select:disabled {
  cursor: default;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(255, 159, 28, 0.3);
}

@keyframes menuFocusExpand {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.04);
  }
}

.mp-username-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.mp-initial-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.mp-welcome-text {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: #fff3c0;
}

.mp-controls-button {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 10px 14px;
}

.mp-controls-button-overlay {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 11;
}

.mp-submenu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.mp-cog-button {
  flex: 0 0 auto;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
}

.mp-cog-button-menu {
  width: 36px;
  min-width: 36px;
  height: 36px;
  font-size: 19px;
}

.mp-cog-button-inline {
  width: 28px;
  min-width: 28px;
  height: 28px;
  font-size: 15px;
}

.slider-field {
  padding: 10px 12px;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: border-color 0.135s ease-in-out, box-shadow 0.135s ease-in-out, transform 0.135s ease-in-out;
}

.slider-field:hover {
  border-color: rgba(255, 204, 64, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.18), 0 0 14px rgba(255, 204, 64, 0.18);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

.slider-field.mp-controller-focus,
.slider-field.is-controller-focus {
  border-color: rgba(255, 204, 64, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32) !important;
}

.mp-initial-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mp-primary-action {
  font-size: 22px;
}

.mp-create-lobby-title {
  margin: 0;
}

.mp-create-lobby-title,
.mp-submenu-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: #fff3c0;
}

.mp-submenu-title {
  margin: 0;
}

.mp-create-lobby-actions,
.mp-lobby-browser-actions {
  flex-direction: column;
}

.mp-level-editor-title-wrap {
  display: grid;
  gap: 8px;
}

.mp-level-editor-subtitle {
  margin: 0;
  color: rgba(255, 247, 210, 0.78);
  font-size: 14px;
  line-height: 1.4;
}

.mp-level-editor-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.mp-level-editor-action {
  flex: 0 0 auto;
  min-height: 176px;
  padding: 22px 20px 20px;
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 12px;
  text-align: left;
  white-space: normal;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 245, 204, 0.06), rgba(255, 255, 255, 0.03)),
    rgba(22, 15, 6, 0.38);
  color: var(--fg);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
  transition:
    transform 0.135s ease-in-out,
    box-shadow 0.135s ease-in-out,
    border-color 0.135s ease-in-out,
    background 0.135s ease-in-out;
}

#mp-level-editor-edit-packs {
  grid-column: 1 / -1;
}

.mp-level-editor-action svg {
  color: #ffe39b;
  opacity: 0.92;
}

.mp-level-editor-action:hover,
.mp-level-editor-action.mp-controller-focus,
.mp-level-editor-action.is-controller-focus {
  border-color: rgba(255, 214, 102, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 236, 166, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(36, 24, 8, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.14), 0 20px 38px rgba(0, 0, 0, 0.28);
}

.mp-level-editor-action-label {
  font-size: 20px;
  font-weight: 700;
  color: #fff3c0;
  line-height: 1.1;
}

.mp-level-editor-action-copy {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 247, 210, 0.76);
}

.mp-level-editor-back-row {
  margin-top: 16px;
  flex-direction: column;
}

.mp-level-editor-embed-shell {
  margin-top: 18px;
  min-height: 62vh;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 245, 204, 0.04), rgba(255, 255, 255, 0.02)),
    rgba(10, 8, 5, 0.34);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 34px rgba(0, 0, 0, 0.2);
}

.mp-level-editor-embed-frame {
  display: block;
  width: 100%;
  height: min(72vh, 980px);
  min-height: 620px;
  border: 0;
  background: transparent;
}

.mp-level-editor-search-field {
  margin-top: 16px;
}

.mp-level-editor-collection {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

.mp-level-editor-inline-status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.mp-level-editor-inline-status.hidden {
  display: none;
}

.mp-level-editor-inline-status.info {
  color: rgba(255, 247, 210, 0.88);
}

.mp-level-editor-inline-status.success {
  color: #dfffd8;
  border-color: rgba(116, 224, 142, 0.32);
  background: rgba(45, 99, 49, 0.32);
}

.mp-level-editor-inline-status.error {
  color: #ffd9d0;
  border-color: rgba(255, 116, 116, 0.34);
  background: rgba(105, 36, 36, 0.36);
}

.mp-level-editor-list-row,
.mp-level-editor-pack-level-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 245, 204, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(22, 15, 6, 0.34);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.mp-level-editor-list-main,
.mp-level-editor-pack-level-main {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 6px;
}

.mp-level-editor-list-title,
.mp-level-editor-pack-level-title {
  color: #fff3c0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.mp-level-editor-list-meta,
.mp-level-editor-pack-level-meta {
  color: rgba(255, 247, 210, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.mp-level-editor-list-actions,
.mp-level-editor-pack-level-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.mp-level-editor-list-actions button,
.mp-level-editor-pack-level-actions button {
  min-width: 96px;
  flex: 0 0 auto;
}

.mp-level-editor-pack-list-actions,
.mp-level-editor-pack-editor-actions {
  margin-top: 16px;
}

.mp-level-editor-pack-list-actions button,
.mp-level-editor-pack-editor-actions button {
  min-height: 50px;
}

.mp-level-editor-pack-editor-header {
  align-items: flex-start;
}

.mp-level-editor-pack-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mp-level-editor-pack-publish {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
}

.mp-level-editor-pack-publish input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mp-level-editor-pack-publish-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 18px;
  border: 1px dotted rgba(255, 244, 198, 0.34);
  border-radius: 999px;
  background: rgba(18, 12, 5, 0.5);
  color: rgba(255, 247, 210, 0.82);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.mp-level-editor-pack-publish-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 247, 210, 0.42);
  box-shadow: 0 0 0 1px rgba(255, 247, 210, 0.16);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.mp-level-editor-pack-publish:hover .mp-level-editor-pack-publish-button {
  border-color: rgba(255, 244, 198, 0.54);
  background: rgba(30, 20, 8, 0.62);
  color: #fff7d7;
}

.mp-level-editor-pack-publish input:focus-visible + .mp-level-editor-pack-publish-button {
  border-color: rgba(255, 209, 102, 0.88);
  box-shadow: 0 0 0 2px rgba(255, 209, 102, 0.18);
}

.mp-level-editor-pack-publish input:checked + .mp-level-editor-pack-publish-button {
  border-color: rgba(99, 229, 108, 0.78);
  background: rgba(18, 67, 30, 0.62);
  color: #e6ffe2;
  box-shadow:
    0 0 0 1px rgba(99, 229, 108, 0.18),
    0 0 20px rgba(99, 229, 108, 0.3),
    inset 0 0 16px rgba(50, 167, 77, 0.18);
}

.mp-level-editor-pack-publish input:checked + .mp-level-editor-pack-publish-button .mp-level-editor-pack-publish-dot {
  background: #63e56c;
  box-shadow:
    0 0 0 1px rgba(99, 229, 108, 0.2),
    0 0 10px rgba(99, 229, 108, 0.75);
}

.mp-level-editor-pack-difficulties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  height: 50vh;
  max-height: 50vh;
  overflow: hidden;
  align-items: stretch;
  padding-right: 4px;
}

.mp-level-editor-pack-difficulty {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 245, 204, 0.04), rgba(255, 255, 255, 0.03)),
    rgba(16, 11, 5, 0.4);
  min-height: 0;
  overflow: hidden;
}

.mp-level-editor-pack-difficulty-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mp-level-editor-pack-difficulty-copy h4 {
  margin: 0;
  color: #fff3c0;
  font-size: 20px;
  line-height: 1.1;
}

.mp-level-editor-pack-difficulty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.mp-level-editor-pack-difficulty-actions button {
  flex: 0 0 auto;
  min-width: 112px;
}

.mp-level-editor-pack-levels {
  display: grid;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
}

.mp-level-editor-pack-level-row {
  align-items: flex-start;
}

.mp-level-editor-pack-level-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mp-level-editor-pack-move-actions {
  display: flex;
  gap: 8px;
}

.mp-level-editor-pack-move-actions button {
  min-width: 54px;
}

.mp-level-editor-dialog-content {
  width: min(860px, 95vw);
  max-height: min(84vh, 760px);
  display: grid;
  gap: 16px;
  overflow: hidden;
}

.mp-level-editor-dialog-input {
  width: 100%;
}

.mp-level-editor-dialog-list {
  display: grid;
  gap: 10px;
  max-height: 48vh;
  overflow-y: auto;
  padding-right: 4px;
}

.mp-level-editor-dialog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.mp-level-editor-dialog-row-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.mp-level-editor-dialog-row-title {
  color: #fff3c0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.mp-level-editor-dialog-row-meta {
  color: rgba(255, 247, 210, 0.72);
  font-size: 12px;
  line-height: 1.4;
}

.mp-level-editor-dialog-actions {
  display: flex;
  gap: 12px;
}

.mp-create-lobby-actions button,
.mp-lobby-browser-actions button {
  min-height: 52px;
}

.mp-setting-checkbox,
.mp-password-toggle {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.mp-setting-checkbox {
  margin-bottom: 0;
}

.mp-lobby-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
  align-items: stretch;
}

.mp-setting-checkbox-split {
  margin-bottom: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mp-lobby-settings-grid .mp-setting-checkbox-split .mp-setting-checkbox {
  margin-bottom: 0;
  min-width: 0;
}

.mp-lobby-settings-grid .mp-setting-checkbox {
  min-height: 42px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: default;
  transition: border-color 0.135s ease-in-out, box-shadow 0.135s ease-in-out, transform 0.135s ease-in-out, background 0.135s ease-in-out;
}

.mp-lobby-settings-grid .mp-setting-checkbox:not(:has(input[type="checkbox"]:disabled)) {
  cursor: pointer;
}

.mp-lobby-settings-grid .mp-setting-checkbox:not(:has(input[type="checkbox"]:disabled)):hover {
  border-color: rgba(255, 204, 64, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

.mp-lobby-settings-grid .mp-setting-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.mp-lobby-settings-grid .mp-setting-checkbox:has(input[type="checkbox"]:checked) {
  background: rgba(255, 215, 0, 0.22);
  border-color: transparent;
  box-shadow: none;
}

.mp-lobby-settings-grid .mp-setting-checkbox span {
  line-height: 1.2;
}

.mp-lobby-settings-grid .mp-setting-checkbox span::after {
  content: '';
  display: inline-block;
  width: 10px;
  margin-left: 8px;
  color: #4dff7a;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.mp-lobby-settings-grid .mp-setting-checkbox:has(input[type="checkbox"]:checked) span::after {
  content: '✓';
}

.slider-group .mp-setting-checkbox.classic-hud-setting {
  min-height: 42px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.135s ease-in-out, box-shadow 0.135s ease-in-out, transform 0.135s ease-in-out, background 0.135s ease-in-out;
}

.slider-group > .mp-setting-checkbox.classic-hud-setting + .mp-setting-checkbox.classic-hud-setting {
  margin-top: 10px;
}

.slider-group .mp-setting-checkbox.classic-hud-setting input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.slider-group .mp-setting-checkbox.classic-hud-setting:hover {
  border-color: rgba(255, 204, 64, 0.9);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

.slider-group .mp-setting-checkbox.classic-hud-setting:has(input[type="checkbox"]:checked) {
  background: rgba(255, 215, 0, 0.22);
  border-color: transparent;
  box-shadow: none;
}

.slider-group .mp-setting-checkbox.classic-hud-setting span {
  line-height: 1.2;
}

.slider-group .mp-setting-checkbox.classic-hud-setting span::after {
  content: '';
  display: inline-block;
  width: 10px;
  margin-left: 8px;
  color: #4dff7a;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.slider-group .mp-setting-checkbox.classic-hud-setting:has(input[type="checkbox"]:checked) span::after {
  content: '✓';
}

.mp-placeholder-checkbox {
  justify-content: flex-start;
}

.mp-setting-checkbox-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mp-setting-checkbox-with-action .mp-cog-button.hidden {
  display: inline-flex !important;
  visibility: hidden;
  pointer-events: none;
}

.mp-setting-checkbox-label {
  flex: 1 1 auto;
  margin-bottom: 0;
}

.mp-specific-stage-selected {
  flex: 0 1 auto;
  min-width: 0;
  color: #fff3c0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-stage-picker-content {
  width: min(1140px, 95vw);
  min-height: min(760px, calc(100vh - 40px));
  max-height: calc(100vh - 24px);
  padding: 30px 30px 34px;
  overflow: hidden;
}

.mp-stage-picker-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.mp-stage-picker-list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mp-stage-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 6px 0 16px;
  max-height: 42vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 18px 16px 12px;
  scrollbar-gutter: stable;
}

.mp-stage-picker-option {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 14px;
  text-align: left;
}

.mp-stage-picker-option:hover {
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

.mp-stage-picker-option.is-selected {
  border-color: rgba(255, 204, 64, 0.95);
  background: rgba(255, 204, 64, 0.14);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.18);
}

.mp-stage-picker-actions {
  justify-content: flex-end;
}

.mp-controls-dialog.is-controller-layout .mp-stage-picker-actions {
  justify-content: stretch;
}

.mp-controls-dialog.is-controller-layout .mp-stage-picker-actions > :not(.mp-stage-picker-cancel-button) {
  display: none;
}

.mp-controls-dialog.is-controller-layout .mp-stage-picker-cancel-button {
  width: 100%;
  justify-content: center;
}

.mp-stage-picker-preview-panel {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  width: min(660px, 100%);
  margin: 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mp-stage-picker-preview-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff3c0;
}

.mp-stage-picker-preview-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.mp-stage-picker-preview-viewport {
  width: 640px;
  height: 400px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 8, 12, 0.84);
  overflow: hidden;
}

.mp-stage-picker-preview-viewport.hidden {
  visibility: hidden;
}

.mp-stage-picker-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.mp-stage-picker-preview-viewport.is-dragging,
.mp-stage-picker-preview-viewport.is-dragging * {
  cursor: none !important;
}

@media (max-width: 720px) {
  .mp-stage-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mp-stage-picker-preview-viewport {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }
}

.mp-password-toggle {
  margin-bottom: 16px;
}

.mp-username-field > span {
  display: inline-block;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.mp-username-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.mp-player-color-button {
  flex: 0 0 54px;
  width: 54px;
  min-width: 54px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: background 0.135s ease-in-out, border-color 0.135s ease-in-out, box-shadow 0.135s ease-in-out;
}

.mp-player-color-button:hover {
  background: rgba(255, 255, 255, 0.14);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

.mp-player-customize-icon,
.player-customize-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 14px;
}

.mp-player-customize-icon::before,
.mp-player-customize-icon::after,
.player-customize-icon::before,
.player-customize-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 244, 194, 0.95);
  box-shadow: 0 0 8px rgba(255, 204, 64, 0.28);
}

.mp-player-customize-icon::before,
.player-customize-icon::before {
  top: 3px;
}

.mp-player-customize-icon::after,
.player-customize-icon::after {
  bottom: 3px;
}

.mp-player-customize-icon,
.player-customize-icon {
  background:
    radial-gradient(circle at 25% 3px, #ffd26d 0 3px, transparent 3.5px),
    radial-gradient(circle at 70% 11px, #ffd26d 0 3px, transparent 3.5px);
}

.mp-player-color-preview {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 12px rgba(0, 0, 0, 0.32);
}

.mp-controller-focus {
  border-color: rgba(255, 204, 64, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32) !important;
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

select option {
  color: #1b1200;
  background: #f3f3f3;
}

.row {
  display: flex;
  gap: 12px;
}

button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #1b1200;
  white-space: nowrap;
  transition: transform 0.135s ease-in-out, box-shadow 0.135s ease-in-out, background 0.135s ease-in-out;
}

button:hover:not(:disabled) {
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--fg);
}

.builder-draw-path-button {
  border-color: rgba(83, 201, 255, 0.55) !important;
  color: #a9efff !important;
  box-shadow: 0 0 10px rgba(54, 179, 255, 0.28), inset 0 0 10px rgba(38, 149, 255, 0.18);
}

.builder-draw-path-button.active {
  border-color: rgba(152, 233, 255, 0.95) !important;
  color: #e8fbff !important;
  box-shadow: 0 0 18px rgba(92, 212, 255, 0.52), inset 0 0 14px rgba(74, 172, 255, 0.3);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.hint code {
  color: #ffd38a;
}

@media (max-width: 720px) {
  .panel {
    padding: 18px;
  }

  .panel h1 {
    font-size: 22px;
  }

  .mp-level-editor-action-grid {
    grid-template-columns: 1fr;
  }

  .mp-level-editor-action {
    min-height: 0;
  }

  .mp-level-editor-embed-frame {
    min-height: 68vh;
    height: 68vh;
  }

  .mp-level-editor-list-row,
  .mp-level-editor-pack-level-row,
  .mp-level-editor-dialog-row,
  .mp-level-editor-pack-difficulty-header {
    flex-direction: column;
    align-items: stretch;
  }

  .mp-level-editor-list-actions,
  .mp-level-editor-pack-level-actions,
  .mp-level-editor-pack-difficulty-actions,
  .mp-level-editor-dialog-actions {
    width: 100%;
    justify-content: stretch;
  }

  .mp-level-editor-list-actions button,
  .mp-level-editor-pack-level-actions button,
  .mp-level-editor-pack-difficulty-actions button,
  .mp-level-editor-dialog-actions button {
    flex: 1 1 auto;
    min-width: 0;
  }

  .mp-level-editor-pack-difficulties {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    overflow-y: auto;
  }

  .mp-level-editor-pack-editor-header {
    align-items: stretch;
  }

  .mp-level-editor-pack-header-actions {
    width: 100%;
    justify-content: stretch;
  }

  .mp-level-editor-pack-publish {
    flex: 1 1 auto;
  }

  .mp-level-editor-pack-publish-button,
  #mp-level-editor-pack-editor-back {
    width: 100%;
    justify-content: center;
  }
}

.credits-menu {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 11;
  font-size: 13px;
  color: var(--fg);
}

/* Hover "bridge" so the menu doesn't vanish while moving into the panel */
.credits-menu::after {
  content: "";
  position: absolute;
  left: 0;
  top: 100%;
  width: 100%;
  height: 10px;
}

.credits-label {
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.credits-label:focus-visible {
  outline: 2px solid rgba(255, 159, 28, 0.8);
  outline-offset: 2px;
}

.credits-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  min-width: 320px;
  width: max-content;
  max-width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 6px;

  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
}

/* OPEN on hover (desktop) OR when toggled open (mobile) */
.credits-menu:hover .credits-panel,
.credits-menu.open .credits-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.credits-panel a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.credits-panel a:hover {
  text-decoration: underline;
}

.credits-panel span {
  color: var(--muted);
  margin-left: 4px;
}

.mp-setting-info-popup {
  position: fixed;
  min-width: 220px;
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.4;
  z-index: 5000;
  pointer-events: none;
}

.mp-setting-info-popup.hidden {
  display: none;
}

.mp-setting-info-popup-text {
  white-space: pre-wrap;
}

.mobile-menu-button {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(220px, 48vw);
  height: 40px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 8, 12, 0.78);
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
  backdrop-filter: blur(6px);
}

.fullscreen-button {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 12;
  padding: 6px 10px;
  font-size: 11px;
}

.voice-chat-local-toggle {
  position: fixed;
  top: 8px;
  right: 104px;
  z-index: 12;
  padding: 6px 10px;
  font-size: 11px;
}

.voice-chat-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.voice-chat-popup-card {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 24px;
}

.voice-chat-popup-card h2 {
  margin: 0 0 12px;
  color: var(--accent);
}

.voice-chat-popup-card p {
  margin: 0 0 18px;
  color: var(--fg);
}

.voice-chat-popup-volumes {
  margin-top: 12px;
  margin-bottom: 16px;
  max-height: min(45vh, 320px);
  overflow-y: auto;
  padding-right: 4px;
}

.voice-chat-popup .field.is-controller-focus,
.voice-chat-popup button.is-controller-focus {
  border-color: rgba(255, 204, 64, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32) !important;
  animation: none;
}


/* multiplayer UI */
.lobby-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 6px;
  scrollbar-gutter: stable;
}

.lobby-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s;
  cursor: pointer;
}

.lobby-item.mp-controller-focus {
  background: rgba(255, 255, 77, 0.15);
  border-color: rgba(255, 255, 77, 0.3);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.22), 0 0 20px rgba(255, 204, 64, 0.24);
  animation: none;
  transform: none;
}

.lobby-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lobby-item:hover {
  background: rgba(255, 255, 77, 0.15);
  /* Primary yellow #ffff4d with transparency */
  border-color: rgba(255, 255, 77, 0.3);
  /* Yellow border on hover */
}

.lobby-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lobby-item.disabled:hover {
  background: rgba(255, 255, 255, 0.05);
  /* Subtle hover for disabled */
  border-color: rgba(255, 255, 255, 0.05);
}

.lobby-item-info {
  display: flex;
  flex-direction: column;
}

.lobby-item-lock {
  position: relative;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin-left: 12px;
}

.lobby-item-lock::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 9px;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 230, 110, 0.95);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.lobby-item-lock::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 8px;
  width: 14px;
  height: 11px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: rgba(255, 230, 110, 0.95);
  box-shadow: 0 0 10px rgba(255, 230, 110, 0.28);
}

.lobby-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 15px;
}

.lobby-details {
  font-size: 11px;
  color: var(--muted);
}

.lobby-item-placeholder {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-style: italic;
}

.lobby-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lobby-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--accent);
}

.room-code-display {
  font-family: monospace;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lobby-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.lobby-password-copy-group {
  position: relative;
  flex: 0 0 auto;
}

.lobby-password-copy-message {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.16);
  border: 1px solid rgba(255, 215, 0, 0.28);
  color: #ffe27a;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease-in-out;
}

.lobby-password-copy-message.visible {
  opacity: 1;
}

.lobby-password-display {
  flex: 0 0 auto;
  font-family: monospace;
  font-size: 13px;
  width: 130px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.135s ease-in-out, border-color 0.135s ease-in-out, box-shadow 0.135s ease-in-out;
}

.lobby-password-display:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.lobby-password-display:disabled {
  cursor: default;
  opacity: 0.7;
}

.room-code-copy-button {
  flex: 0 0 auto;
  min-width: 36px;
  max-width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 18px;
}

.lobby-link-copy-group {
  position: relative;
  flex: 0 0 auto;
}

.room-code-copy-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#mp-toggle-password-visibility.active {
  background: rgba(255, 215, 0, 0.18);
  color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.18);
}

.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 8px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.tab-content.hidden {
  display: none;
}

.mp-lobby-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 20px;
  align-items: start;
}

#mp-pause-view .mp-lobby-layout {
  align-items: center;
}

.mp-lobby-main {
  min-width: 0;
}

.mp-pause-card {
  min-height: 0;
  align-self: center;
}

.mp-pause-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

.mp-pause-settings-fields {
  max-width: 440px;
  margin: 0 auto 18px;
}

.mp-pause-settings-fields .field {
  margin-bottom: 14px;
}

.mp-lobby-card {
  padding: 18px 20px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(12, 12, 18, 0.72);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
}

.player-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(12, 12, 18, 0.72);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.22);
}

.player-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-panel-header h3 {
  margin: 0;
  font-size: 20px;
  color: var(--fg);
}

.player-panel-count {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 159, 28, 0.18);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.player-host-section,
.player-rest-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-host-section {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-panel-subtitle {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.player-host-slot {
  min-height: 76px;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
}

.player-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  font-size: 13px;
}

.player-item.is-selectable {
  cursor: pointer;
  transition: background 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.player-item.is-selectable:hover,
.player-item.mp-controller-focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 204, 64, 0.35);
}

.player-item.is-selected {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 204, 64, 0.45);
}

.player-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-profile-picture {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  flex: 0 0 auto;
}

.player-name {
  min-width: 0;
}

.player-muted-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.player-muted-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 3px;
  width: 7px;
  height: 8px;
  background: rgba(255, 255, 255, 0.8);
  clip-path: polygon(0 25%, 42% 25%, 100% 0, 100% 100%, 42% 75%, 0 75%);
}

.player-muted-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 2px;
  height: 14px;
  border-radius: 999px;
  background: #ff8f8f;
  transform: rotate(42deg);
  transform-origin: center;
}

.player-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.player-color-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
}

.player-customize-badge {
  width: 56px;
  padding: 0 8px;
}

button.player-color-badge {
  cursor: pointer;
  flex: 0 0 auto;
}

button.player-color-badge:hover {
  background: rgba(255, 255, 255, 0.14);
}

.player-actions-menu {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 104px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(16, 12, 6, 0.96);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

.player-action-button {
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.player-action-button.is-active {
  background: rgba(255, 204, 64, 0.18);
  border-color: rgba(255, 204, 64, 0.4);
  color: #fff3c0;
}

.player-action-button.mp-controller-focus {
  border-color: rgba(255, 204, 64, 0.9) !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.3), 0 0 20px rgba(255, 204, 64, 0.32) !important;
}

.player-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18), 0 0 8px rgba(0, 0, 0, 0.35);
}

.player-empty-state {
  padding: 18px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* Color Selection Dialog */
.color-selection-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.mp-controls-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.mp-controls-dialog-content {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 24px;
  width: min(720px, calc(100% - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.mp-stage-music-launcher-field {
  display: block;
  margin-top: 0.5rem;
  margin-bottom: 0.9rem;
}

.mp-stage-music-launcher {
  display: block;
  width: 100%;
  min-height: 52px;
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.135s ease-in-out, box-shadow 0.135s ease-in-out, background 0.135s ease-in-out, border-color 0.135s ease-in-out;
}

.mp-stage-music-launcher-field:hover .mp-stage-music-launcher:not(:disabled),
.mp-stage-music-launcher:hover:not(:disabled) {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.22), 0 0 20px rgba(255, 159, 28, 0.32);
  border-color: rgba(255, 204, 64, 0.85);
}

.mp-stage-music-launcher.mp-controller-focus,
.mp-stage-music-launcher.is-controller-focus {
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.22), 0 0 20px rgba(255, 159, 28, 0.32);
  border-color: rgba(255, 204, 64, 0.85);
}

.mp-stage-music-dialog-content {
  width: min(980px, calc(100% - 32px));
  max-height: min(88vh, 860px);
  overflow-y: auto;
  padding-bottom: 0;
}

.mp-stage-music-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.mp-stage-music-column {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(5, 12, 22, 0.58);
  padding: 1rem;
}

.mp-stage-music-column-title {
  margin: 0 0 0.9rem;
  color: #ffe66e;
}

.mp-stage-music-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mp-stage-music-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mp-stage-music-entry-name {
  color: rgba(255, 255, 255, 0.92);
}

.mp-stage-music-select {
  width: 100%;
  justify-content: space-between;
  text-align: left;
  gap: 0.8rem;
}

.mp-stage-music-select::after {
  content: '▼';
  font-size: 0.7rem;
  opacity: 0.8;
}

.mp-stage-music-select.is-open::after {
  content: '▲';
}

.mp-stage-music-select.is-controller-focus,
.mp-stage-music-option.is-controller-focus,
.mp-stage-music-action.is-controller-focus {
  border-color: rgba(255, 204, 64, 0.95) !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 64, 0.22), 0 18px 40px rgba(0, 0, 0, 0.26);
}

.mp-stage-music-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.45rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 204, 64, 0.35);
  background: rgba(8, 12, 18, 0.96);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.mp-stage-music-option {
  width: 100%;
  text-align: left;
}

.mp-stage-music-option.is-selected {
  border-color: rgba(93, 208, 255, 0.9);
  background: rgba(93, 208, 255, 0.14);
}

.mp-stage-music-bottom-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: -58px;
  margin-bottom: 10px;
  align-items: start;
}

.mp-stage-music-reset-button {
  width: 100%;
  grid-column: 1;
  grid-row: 1;
}

.mp-stage-music-confirm-button {
  grid-column: 1;
  grid-row: 2;
}

.mp-stage-music-cancel-button {
  grid-column: 2;
  grid-row: 2;
}

.mp-stage-music-reset-button:hover:not(:disabled),
.mp-stage-music-confirm-button:hover:not(:disabled),
.mp-stage-music-cancel-button:hover:not(:disabled) {
  animation: none;
}

.mp-stage-music-reset-button:hover:not(:disabled),
.mp-stage-music-reset-button.is-controller-focus {
  animation: none !important;
  transform: scale(1.04) !important;
}

.mp-stage-music-confirm-button:hover:not(:disabled),
.mp-stage-music-confirm-button.is-controller-focus {
  animation: none !important;
  transform: scale(1.04) !important;
}

.mp-stage-music-cancel-button:hover:not(:disabled),
.mp-stage-music-cancel-button.is-controller-focus {
  animation: none !important;
  transform: scale(1.04) !important;
}

.mp-stage-music-hint {
  margin-top: 0.8rem;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.9rem;
}

@media (max-width: 860px) {
  .mp-stage-music-grid {
    grid-template-columns: 1fr;
  }

  .mp-stage-music-bottom-controls {
    grid-template-columns: 1fr;
    margin-top: 0.75rem;
  }

  .mp-stage-music-reset-button,
  .mp-stage-music-confirm-button,
  .mp-stage-music-cancel-button {
    grid-column: auto;
    grid-row: auto;
  }
}

.mp-quick-settings-content {
  width: min(460px, calc(100% - 32px));
}

.mp-quick-settings-sliders {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.mp-controls-dialog-title {
  margin: 0 0 18px;
  text-align: center;
}

.mp-controls-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 20px;
}

.mp-controls-column-title {
  margin: 0 0 12px;
  text-align: center;
  color: #ffe66e;
}

.mp-controls-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 18px;
  line-height: 1.4;
  color: var(--fg);
}

.mp-controls-list strong {
  color: #ffe66e;
}

.mp-controls-close {
  display: block;
  width: min(220px, 100%);
  margin: 0 auto;
}

.mp-password-dialog-content {
  width: min(420px, calc(100% - 32px));
}

.mp-password-dialog-subtitle {
  margin: 0 0 16px;
  text-align: center;
  color: var(--muted);
}

.mp-password-error-content {
  width: min(360px, calc(100% - 32px));
}

.color-selection-content {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.mp-customization-content {
  position: relative;
  max-width: min(1180px, calc(100vw - 48px));
  width: min(1180px, calc(100vw - 48px));
  background: linear-gradient(180deg, rgba(16, 13, 10, 0.9), rgba(11, 10, 16, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  padding: 20px;
  z-index: 4000;
}

.mp-customization-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 24px;
  align-items: stretch;
}

.mp-customization-preview {
  position: relative;
  min-height: 540px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 209, 102, 0.08), rgba(255, 209, 102, 0) 56%),
    linear-gradient(180deg, rgba(14, 11, 6, 0.05), rgba(10, 10, 16, 0.1));
  backdrop-filter: blur(4px);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  isolation: isolate;
  z-index: 4001;
}

.mp-customization-preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  background: #000;
  z-index: 4002;
}

.mp-customization-preview::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.mp-customization-preview.is-dragging {
  cursor: grabbing;
}

.mp-customization-preview.is-dragging,
.mp-customization-preview.is-dragging * {
  cursor: none !important;
}

.mp-customization-preview-title {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 4004;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffe7a1;
}

#mp-stage-picker-preview-viewport {
  width: min(640px, 100%);
  min-height: 0;
  aspect-ratio: 16 / 9;
  align-self: center;
}

.mp-customization-side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 4003;
}

.mp-customization-section {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

.mp-customization-section h4 {
  margin: 0 0 12px;
  color: #ffe7a1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.mp-customization-character-grid {
  display: grid;
  grid-template-columns: repeat(3, 82px);
  justify-content: space-between;
  gap: 10px;
}

.mp-customization-character-option {
  --difficulty-tile-width: 82px;
  width: 82px;
  min-width: 82px;
  height: 82px;
  padding: 8px 6px 6px;
  justify-content: center;
}

.mp-customization-character-inner {
  width: 42px;
  height: 42px;
  min-height: 42px;
  font-size: 24px;
  color: #ffe27a;
  overflow: hidden;
}

.mp-customization-character-inner .mp-customization-character-img {
  width: 56px;
  height: 56px;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  image-rendering: auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.32));
}

.mp-customization-character-option span {
  margin-top: 4px;
  font-size: 11px;
}

.mp-customization-profile-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.mp-customization-profile-prompt {
  min-height: 38px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mp-customization-profile-upload {
  min-width: 88px;
  min-height: 38px;
  margin: 0;
  padding: 8px 12px;
}

.mp-customization-profile-preview-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mp-customization-profile-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mp-customization-profile-preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mp-customization-profile-preview-placeholder {
  font-size: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.68);
  padding: 6px;
}

.mp-customization-profile-clear {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mp-customization-color-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 8px;
}

.mp-customization-color-option {
  justify-self: center;
  width: 34px;
  height: 34px;
}

.mp-customization-multi-row {
  display: block;
  margin-top: 12px;
}

.mp-customization-multi-box {
  width: 100%;
  margin-bottom: 0;
}

.mp-customization-multi-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  flex: 1 1 auto;
}

.mp-customization-multi-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(0, 0, 0, 0.28);
  color: #ffe27a;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}

.mp-customization-multi-toggle.is-selected {
  border-color: rgba(255, 204, 64, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 204, 64, 0.18), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.mp-customization-multi-slots {
  flex: 0 0 auto;
}

.mp-customization-multi-slot {
  width: 34px;
  height: 34px;
}

.mp-customization-hat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.mp-customization-hat-option {
  min-width: 0;
  width: 100%;
  padding: 10px 8px;
  min-height: 74px;
}

.mp-customization-hat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0 auto 6px;
  position: relative;
}

.mp-customization-hat-icon-image {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.mp-customization-hat-icon.is-no-hat::before {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 50%;
  height: 2px;
  background: #ff3f3f;
  transform: rotate(-45deg);
  transform-origin: center;
}

.mp-customization-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: auto;
}

.mp-customization-actions .color-selection-confirm,
.mp-customization-actions .color-selection-close {
  width: 100%;
  margin-bottom: 0;
}

.mp-customization-hat-option.selected,
.mp-customization-character-option.selected {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255, 226, 122, 0.18), rgba(255, 159, 28, 0.22));
  box-shadow: inset 0 0 0 2px rgba(255, 226, 122, 0.5), 0 12px 26px rgba(0, 0, 0, 0.24);
}

.mp-customization-character-option.is-controller-focus,
.mp-customization-hat-option.is-controller-focus {
  outline: 3px solid rgba(255, 204, 64, 0.95);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(255, 204, 64, 0.25), 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

body.hide-controller-focus .mp-controller-focus,
body.hide-controller-focus .is-controller-focus {
  outline: none !important;
  box-shadow: none !important;
  animation: none !important;
}

.color-selection-content h3 {
  margin: 0 0 20px 0;
  text-align: center;
  color: var(--fg);
}

.color-selection-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.color-selection-button {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-selection-button:hover {
  animation: menuFocusExpand 0.135s ease-in-out forwards;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.color-selection-button.is-controller-focus,
.color-selection-multi-toggle.is-controller-focus,
.color-selection-multi-slot.is-controller-focus,
.color-selection-confirm.is-controller-focus,
.color-selection-close.is-controller-focus,
.mp-controls-close.is-controller-focus,
.mp-controls-dialog-content button.is-controller-focus {
  outline: 3px solid rgba(255, 204, 64, 0.95);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(255, 204, 64, 0.25), 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: menuFocusExpand 0.135s ease-in-out forwards;
}

.color-selection-close {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-selection-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.color-selection-multi-row {
  margin-bottom: 12px;
}

.color-selection-multi-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  min-height: 50px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-selection-multi-box:hover {
  background: rgba(255, 255, 255, 0.12);
}

.color-selection-multi-toggle,
.color-selection-multi-slot,
.color-selection-confirm {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--fg);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-selection-multi-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0;
  border: none;
  background: transparent;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.color-selection-multi-label {
  display: inline-flex;
  align-items: center;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.color-selection-multi-slots {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 94px;
  flex: 0 0 94px;
  justify-content: flex-end;
}

.color-selection-multi-slot {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.color-selection-multi-slot:hover {
  background: rgba(255, 255, 255, 0.14);
}

.color-selection-multi-slot.is-active {
  border-color: rgba(255, 204, 64, 0.95);
  box-shadow: 0 0 0 4px rgba(255, 204, 64, 0.24), 0 0 24px rgba(255, 204, 64, 0.55), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.color-selection-multi-slot:not(.is-active) {
  opacity: 0.72;
  transform: scale(0.94);
}

.color-selection-button.is-selected {
  border: 2px solid rgba(255, 204, 64, 0.92);
  box-shadow: 0 0 0 3px rgba(255, 204, 64, 0.18), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.color-selection-confirm {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #1b1200;
  font-weight: 600;
}

.player-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 600;
}

.player-host-badge {
  font-size: 10px;
  background: var(--accent);
  color: #000;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: bold;
}

@media (max-width: 1100px) {
  .mp-lobby-layout {
    grid-template-columns: 1fr;
  }

  .player-panel {
    order: 0;
  }

  .mp-customization-content {
    width: min(100vw - 24px, 920px);
    max-width: min(100vw - 24px, 920px);
    padding: 18px;
  }

  .mp-customization-layout {
    grid-template-columns: 1fr;
  }

  .mp-customization-preview {
    min-height: 340px;
  }

  .mp-customization-color-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Game Selection */
.game-selection {
  margin-bottom: 20px;
  text-align: center;
  position: relative;
}

.difficulty-random-indicator {
  position: absolute;
  left: -6px;
  top: calc(50%);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.difficulty-random-indicator-text {
  color: #ffe66e;
  font-size: 18.15px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 230, 110, 0.55), 0 0 18px rgba(255, 159, 28, 0.35);
  animation: difficulty-indicator-pulse 2.8s ease-in-out infinite;
}

.difficulty-random-indicator-arrow {
  display: block;
  width: 72px;
  height: 27px;
  background: #ffe66e;
  -webkit-mask: url("assets/hud/arrow.png") center / contain no-repeat;
  mask: url("assets/hud/arrow.png") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 230, 110, 0.55)) drop-shadow(0 0 18px rgba(255, 159, 28, 0.35));
  animation: difficulty-indicator-pulse 2.8s ease-in-out infinite;
}

@keyframes difficulty-indicator-pulse {
  0%,
  100% {
    opacity: 0.72;
  }

  50% {
    opacity: 1;
  }
}

.game-selection h3 {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 12px 0;
  text-align: center;
}

.game-scroll-wrapper {
  overflow-x: auto;
  padding: 8px 4px;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Firefox */
}

.game-scroll-wrapper::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

.game-icons {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  padding: 4px;
  width: max-content;
  margin: 0 auto;
}

.game-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 90px;
  backdrop-filter: blur(4px);
}

.game-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.game-icon.selected {
  background: linear-gradient(135deg, rgba(255, 159, 28, 0.34) 0%, rgba(255, 159, 28, 0.18) 100%);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.game-icon-inner {
  font-size: 20px;
  font-weight: 800;
  color: var(--fg);
  opacity: 0.8;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.game-icon.selected .game-icon-inner {
  background: var(--accent);
  color: #000;
  opacity: 1;
}

.game-icon span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-icon.selected span {
  color: var(--fg);
}

.game-icon.add-pack-btn {
  cursor: pointer;
}

.game-icon.add-pack-btn .game-icon-inner.dotted {
  border: 2px dashed rgba(255, 255, 255, 0.3);
  background: transparent;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
}

.game-icon.add-pack-btn:hover .game-icon-inner.dotted {
  border-color: var(--accent);
  color: var(--accent);
}

.game-icon.add-pack-btn.selected {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

/* Difficulty Selection */
.difficulty-selection {
  --difficulty-tile-width: 112px;
  margin-bottom: 24px;
  text-align: center;
}

.difficulty-selection.disabled {
  opacity: 0.72;
}

.difficulty-selection h3 {
  font-size: 16px;
  color: var(--muted);
  margin: 0 0 12px 0;
  text-align: center;
}

.difficulty-icons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.difficulty-icon {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  width: var(--difficulty-tile-width);
  min-width: var(--difficulty-tile-width);
}

.difficulty-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.difficulty-icon.selected {
  background: rgba(255, 215, 0, 0.22);
  border-color: transparent;
  box-shadow: none;
}

.difficulty-icon-inner {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.difficulty-icon-img {
  width: 64px;
  height: 64px;
  object-fit: none;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.difficulty-icon-img.beginner-icon {
  object-position: 0 -128px;
}

.difficulty-icon-img.advanced-icon {
  object-position: -64px -128px;
}

.difficulty-icon-img.expert-icon {
  object-position: -128px -128px;
}

.difficulty-icon-img.master-icon {
  object-position: -192px -128px;
}

.difficulty-icon-img.ultimate-icon {
  width: 64px;
  height: 64px;
  object-position: 0 0;
}

.difficulty-icon-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
  text-align: center;
}

.difficulty-stage-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.difficulty-icon.disabled {
  cursor: default;
}

.difficulty-icon.disabled:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.05);
}

.difficulty-icon.disabled.selected:hover {
  background: rgba(255, 215, 0, 0.15);
}

.difficulty-random-buttons {
  display: grid;
  grid-template-columns: repeat(4, var(--difficulty-tile-width));
  justify-content: center;
  gap: 16px;
}

.difficulty-random-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.15;
  width: var(--difficulty-tile-width);
  white-space: normal;
  text-align: center;
}

.difficulty-random-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.difficulty-random-button.selected {
  background: rgba(255, 215, 0, 0.22);
  color: var(--fg);
}

.difficulty-random-button.disabled {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.45);
}

.difficulty-random-button.disabled:hover {
  background: rgba(255, 255, 255, 0.03);
}

.difficulty-random-button.hidden {
  display: none;
}

.difficulty-random-button span {
  display: block;
}

/* Mode Button Group */
.mode-button-group {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

#smb2-mode-buttons,
#smb2-mode-buttons.hidden {
  display: flex !important;
}

.mode-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 68px;
  min-height: 0;
  padding: 12px 12px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: normal;
}

.mode-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.mode-button.selected {
  background: rgba(255, 215, 0, 0.22);
  border-color: transparent;
  box-shadow: none;
}

.mode-button.disabled {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.38);
  cursor: default;
}

.mode-button.disabled:hover {
  background: rgba(255, 255, 255, 0.03);
  transform: none;
}

/* Chat UI */
#chat-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 400px;
  max-width: 80vw;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

#chat-messages {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-height: 400px;
  overflow-y: hidden;
  mask-image: linear-gradient(to bottom, transparent, black 10%);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 10%);
}

.chat-message {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  padding: 8px 12px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  border-left: 3px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: bounce-in-left 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: left center;
  max-width: 100%;
  word-wrap: break-word;
}

.chat-message.fade-out {
  animation: fade-out 1s ease-out forwards;
}

.chat-player-name {
  font-weight: bold;
  color: var(--accent);
  margin-right: 6px;
}

.chat-player-color-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 6px;
  vertical-align: middle;
}

.chat-player-profile-picture-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 6px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

#chat-input-container {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  max-width: 90vw;
  pointer-events: auto;
  z-index: 101;
}

#chat-input {
  width: 100%;
  background: rgba(12, 12, 18, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 12px 20px;
  color: white;
  -webkit-text-fill-color: white;
  caret-color: white;
  color-scheme: dark;
  font-size: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
  outline: none;
}

#chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 4px 25px rgba(255, 159, 28, 0.3);
  transform: scale(1.02);
}

@keyframes bounce-in-left {
  0% {
    opacity: 0;
    transform: translateX(-50px) scale(0.8);
  }

  60% {
    opacity: 1;
    transform: translateX(10px) scale(1.05);
  }

  100% {
    transform: translateX(0) scale(1);
  }
}

@keyframes fade-out {
  0% {
    opacity: 1;
    transform: translateX(0);
  }

  100% {
    opacity: 0;
    transform: translateX(-20px);
  }
}

/* Spectate UI */
#spectate-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 80px;
}

.spectate-glow {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 150px rgba(255, 159, 28, 0.7),
    inset 0 0 60px rgba(255, 159, 28, 0.4);
  border: 12px solid rgba(255, 159, 28, 0.8);
  pointer-events: none;
}

.spectate-label {
  position: relative;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  padding: 12px 24px;
  border-radius: 40px;
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: slide-down 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.spectate-switch-hint {
  position: relative;
  margin-top: 10px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}

.spectate-tag {
  background: var(--accent);
  color: #000;
  font-weight: 800;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

#spectate-target-name {
  color: white;
  font-size: 20px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes slide-down {
  0% {
    transform: translateY(-40px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

#penalty-overlay {
  position: fixed;
  inset: 0;
  z-index: 1002;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 36px;
}

.penalty-label {
  border-color: #ff6b6b;
  background: rgba(10, 0, 0, 0.82);
  animation: slide-up 0.28s ease-out;
}

.penalty-tag {
  background: #ff6b6b;
  color: #220000;
}

#penalty-text {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
}

@keyframes slide-up {
  0% {
    transform: translateY(24px);
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

#nuke-overlay {
  --nuke-gif-size: 192px;
  --monkey-fight-fade: 0;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

#nuke-overlay img {
  width: var(--nuke-gif-size);
  height: var(--nuke-gif-size);
  object-fit: contain;
  display: block;
  margin: 0 auto;
  opacity: calc(1 - var(--monkey-fight-fade));
  transition: opacity 0.3s ease;
}

#nuke-overlay.monkey-fight-active img {
  opacity: 0 !important;
  transition: none !important;
}

#nuke-countdown {
  width: var(--nuke-gif-size);
  margin: 0 auto;
  transform: translateX(30px);
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #b08a00;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  line-height: 1;
  animation: nuke-countdown-alert 3s ease-in-out infinite;
  opacity: calc(1 - var(--monkey-fight-fade));
  transition: opacity 0.3s ease;
}

@keyframes nuke-countdown-alert {
  0% {
    color: #b08a00;
  }
  50% {
    color: #ff2a2a;
  }
  100% {
    color: #b08a00;
  }
}

#nuke-target-warning {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
  pointer-events: none;
  width: 92px;
  height: 92px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.95));
  text-align: center;
}

.box-of-chaos-roulette {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  overflow: hidden;
  z-index: 1300;
  pointer-events: none;
}

.box-of-chaos-roulette.is-holding {
  animation: box-of-chaos-hold-flash 0.45s ease-in-out infinite;
}

.box-of-chaos-roulette.is-effect-active {
  animation: box-of-chaos-effect-flash 0.75s ease-in-out infinite;
}

.box-of-chaos-roulette.is-reverse-active {
  animation: box-of-chaos-reverse-shake-weak 0.12s linear infinite;
}

.box-of-chaos-roulette.is-reverse-scrambled {
  animation: box-of-chaos-reverse-shake-strong 0.12s linear infinite;
}

.box-of-chaos-roulette.is-reverse-flash {
  background: rgba(168, 28, 36, 0.82);
}

@keyframes box-of-chaos-hold-flash {
  0% {
    border-color: rgba(255, 255, 255, 0.8);
  }
  50% {
    border-color: rgba(255, 226, 84, 0.95);
  }
  100% {
    border-color: rgba(255, 255, 255, 0.8);
  }
}

@keyframes box-of-chaos-effect-flash {
  0% {
    border-color: rgba(255, 255, 255, 0.8);
  }
  50% {
    border-color: rgba(255, 226, 84, 0.95);
  }
  100% {
    border-color: rgba(255, 255, 255, 0.8);
  }
}

.box-of-chaos-roulette-track {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  will-change: transform;
}

@keyframes box-of-chaos-reverse-shake-weak {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-8.4px, 4.2px); }
  50% { transform: translate(8.4px, -4.2px); }
  75% { transform: translate(-4.2px, -8.4px); }
  100% { transform: translate(4.2px, 8.4px); }
}

@keyframes box-of-chaos-reverse-shake-strong {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-14.175px, 7.0875px); }
  50% { transform: translate(14.175px, -7.0875px); }
  75% { transform: translate(-7.0875px, -14.175px); }
  100% { transform: translate(7.0875px, 14.175px); }
}

.box-of-chaos-roulette-item {
  position: absolute;
  top: 20px;
  width: 140px;
  height: 140px;
  image-rendering: pixelated;
}

.box-of-chaos-roulette-item-smash {
  width: 136px;
  height: 136px;
  top: 22px;
  transform-origin: center center;
  animation: box-of-chaos-smash-icon-pulse 1.25s ease-in-out infinite;
}

@keyframes box-of-chaos-smash-icon-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.box-of-chaos-wind-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.box-of-chaos-wind-arrow-wrap {
  width: 140px;
  height: 102px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 157, 157, 0.45);
  border-radius: 8px;
  background: linear-gradient(155deg, rgba(98, 40, 40, 0.42), rgba(34, 14, 14, 0.58));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 14px rgba(0, 0, 0, 0.26);
}

.box-of-chaos-wind-arrow {
  position: relative;
  width: 96px;
  height: 46px;
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.48));
}

.box-of-chaos-wind-arrow-shaft {
  position: absolute;
  left: 10px;
  top: 16px;
  width: 56px;
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffd8d8, #ff6f6f);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.23);
}

.box-of-chaos-wind-arrow-head {
  position: absolute;
  left: 62px;
  top: 8px;
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 28px solid #ff8a8a;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.22));
}

.box-of-chaos-wind-speed {
  font-size: 20px;
  font-weight: 800;
  color: #ffd7d7;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.box-of-chaos-timer-pie {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: conic-gradient(#7bc6ff var(--box-chaos-timer-angle, 0deg), rgba(255, 255, 255, 0.18) 0deg);
  border: 2px solid rgba(0, 0, 0, 0.68);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.box-of-chaos-timer-pie::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: rgba(8, 12, 22, 0.92);
}

.box-of-chaos-text {
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 58px;
  font-weight: 900;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.8);
  z-index: 1310;
  pointer-events: none;
  white-space: nowrap;
}

.ball-swap-text {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 52px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.85);
  z-index: 1310;
  pointer-events: none;
  white-space: nowrap;
}

.super-speed-warning-text {
  position: fixed;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 42px;
  font-weight: 900;
  color: #ff2a2a;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.85);
  z-index: 1310;
  pointer-events: none;
  white-space: pre-line;
  text-align: center;
}

.monkey-fight-tag-timer {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: 900;
  color: #ff2a2a;
  text-shadow: 0 0 16px rgba(0, 0, 0, 0.9);
  z-index: 1311;
  pointer-events: none;
}


#final-results-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
  background: radial-gradient(circle at center, rgba(255, 212, 96, 0.16), rgba(0, 0, 0, 0.66));
  animation: final-results-backdrop-in 260ms ease-out;
}

.final-results-card {
  width: min(560px, 92vw);
  background: linear-gradient(165deg, rgba(20, 20, 28, 0.94), rgba(12, 12, 18, 0.96));
  border: 1px solid rgba(255, 215, 120, 0.45);
  border-radius: 22px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.65), 0 0 48px rgba(255, 179, 71, 0.2);
  backdrop-filter: blur(10px);
  padding: 24px 22px 18px;
  transform-origin: 50% 58%;
  animation: final-results-pop-in 760ms cubic-bezier(0.16, 1.42, 0.32, 1);
}

.final-results-title {
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.6px;
  margin-bottom: 16px;
  color: #ffd773;
  text-shadow: 0 3px 16px rgba(0, 0, 0, 0.65);
}

.final-results-list {
  display: grid;
  gap: 10px;
}

.final-result-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.final-result-row.rank-1 {
  animation: champion-pulse 3s ease-in-out infinite;
}

.final-result-rank {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #090909;
  text-align: center;
  border-radius: 999px;
  padding: 6px 10px;
}

.final-result-row.rank-1 .final-result-rank {
  background: linear-gradient(135deg, #ffd36a, #ffb347);
}

.final-result-row.rank-2 .final-result-rank {
  background: linear-gradient(135deg, #d8dce7, #aab4ca);
}

.final-result-row.rank-3 .final-result-rank {
  background: linear-gradient(135deg, #e5b887, #b8774a);
}

.final-result-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#monkey-fight-text {
  position: fixed;
  left: 50%;
  top: 172px;
  transform: translateX(-50%);
  width: max-content;
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  color: #ff2a2a;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
  line-height: 1;
  pointer-events: none;
}

#monkey-fight-border {
  position: fixed;
  inset: 0;
  z-index: 1003;
  pointer-events: none;
  border: 5px solid rgba(255, 42, 42, 0.92);
  box-shadow: inset 0 0 34px rgba(255, 42, 42, 0.7), inset 0 0 90px rgba(180, 0, 0, 0.38);
  animation: monkey-fight-border-pulse 1s ease-in-out infinite;
}

.monkey-fight-knockout-text {
  position: fixed;
  left: 50%;
  top: 34%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 1010;
  text-align: center;
  color: #ff8c1a;
  font-weight: 900;
  font-size: clamp(24px, 3vw, 42px);
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.92), 0 0 26px rgba(255, 120, 20, 0.45);
  white-space: pre-line;
  line-height: 1.15;
  pointer-events: none;
}

@keyframes monkey-fight-border-pulse {
  0% {
    box-shadow: inset 0 0 24px rgba(255, 42, 42, 0.58), inset 0 0 80px rgba(180, 0, 0, 0.28);
  }
  50% {
    box-shadow: inset 0 0 42px rgba(255, 42, 42, 0.86), inset 0 0 120px rgba(180, 0, 0, 0.5);
  }
  100% {
    box-shadow: inset 0 0 24px rgba(255, 42, 42, 0.58), inset 0 0 80px rgba(180, 0, 0, 0.28);
  }
}

.final-result-profile-picture {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  flex: 0 0 auto;
}

.final-result-score {
  font-size: 22px;
  font-weight: 800;
  color: #ffe8bf;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.final-results-footnote {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  letter-spacing: 0.4px;
}

.final-results-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.final-results-return-button {
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #1b1200;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 10px 18px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: transform 140ms ease, filter 140ms ease;
}

.final-results-return-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.final-results-return-button:disabled {
  background: #7f858f;
  color: #e2e5ea;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  filter: none;
}

.final-results-return-button:active {
  transform: translateY(0);
}

@keyframes champion-pulse {
  0% {
    box-shadow: 0 0 0 rgba(255, 218, 133, 0.08);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 218, 133, 0.36);
    transform: scale(1.018);
  }
  100% {
    box-shadow: 0 0 0 rgba(255, 218, 133, 0.08);
    transform: scale(1);
  }
}

@keyframes final-results-backdrop-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes final-results-pop-in {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.78);
  }
  52% {
    opacity: 1;
    transform: translateY(-8px) scale(1.1);
  }
  70% {
    transform: translateY(4px) scale(0.96);
  }
  84% {
    transform: translateY(-2px) scale(1.03);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel {
    transition: none !important;
  }

  #final-results-overlay,
  .final-results-card {
    animation: none !important;
  }
}

/* Rainbow Goal Animations */
@keyframes rainbow-text {
  0% {
    color: #ff0000;
  }

  17% {
    color: #ff7f00;
  }

  33% {
    color: #ffff00;
  }

  50% {
    color: #00ff00;
  }

  67% {
    color: #0000ff;
  }

  83% {
    color: #4b0082;
  }

  100% {
    color: #ff0000;
  }
}

@keyframes rainbow-glow-text {
  0% {
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.8);
  }

  17% {
    text-shadow: 0 0 8px rgba(255, 127, 0, 0.8);
  }

  33% {
    text-shadow: 0 0 8px rgba(255, 255, 0, 0.8);
  }

  50% {
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.8);
  }

  67% {
    text-shadow: 0 0 8px rgba(0, 0, 255, 0.8);
  }

  83% {
    text-shadow: 0 0 8px rgba(75, 0, 130, 0.8);
  }

  100% {
    text-shadow: 0 0 8px rgba(255, 0, 0, 0.8);
  }
}

@keyframes rainbow-border {
  0% {
    border-left-color: #ff0000;
    box-shadow: -4px 0 12px rgba(255, 0, 0, 0.4);
  }

  17% {
    border-left-color: #ff7f00;
    box-shadow: -4px 0 12px rgba(255, 127, 0, 0.4);
  }

  33% {
    border-left-color: #ffff00;
    box-shadow: -4px 0 12px rgba(255, 255, 0, 0.4);
  }

  50% {
    border-left-color: #00ff00;
    box-shadow: -4px 0 12px rgba(0, 255, 0, 0.4);
  }

  67% {
    border-left-color: #0000ff;
    box-shadow: -4px 0 12px rgba(0, 0, 255, 0.4);
  }

  83% {
    border-left-color: #4b0082;
    box-shadow: -4px 0 12px rgba(75, 0, 130, 0.4);
  }

  100% {
    border-left-color: #ff0000;
    box-shadow: -4px 0 12px rgba(255, 0, 0, 0.4);
  }
}

.chat-message.rainbow-goal {
  animation: bounce-in-left 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), rainbow-border 3s linear infinite !important;
  border-left-width: 5px !important;
}

.rainbow-letter {
  display: inline-block;
  animation: rainbow-text 3s linear infinite, rainbow-glow-text 3s linear infinite;
  font-weight: bold;
  white-space: pre;
}

@keyframes goal-green-border-pulse {
  0% {
    border-left-color: #33ff85;
    box-shadow: -5px 0 16px rgba(51, 255, 133, 0.45), 0 0 10px rgba(51, 255, 133, 0.2);
    background: rgba(0, 24, 8, 0.7);
    filter: brightness(1);
  }
  50% {
    border-left-color: #b7ffd7;
    box-shadow: -7px 0 30px rgba(124, 255, 179, 0.95), 0 0 26px rgba(124, 255, 179, 0.55);
    background: rgba(5, 40, 16, 0.86);
    filter: brightness(1.14);
  }
  100% {
    border-left-color: #33ff85;
    box-shadow: -5px 0 16px rgba(51, 255, 133, 0.45), 0 0 10px rgba(51, 255, 133, 0.2);
    background: rgba(0, 24, 8, 0.7);
    filter: brightness(1);
  }
}

@keyframes goal-red-border-pulse {
  0% {
    border-left-color: #ff5c5c;
    box-shadow: -5px 0 16px rgba(255, 92, 92, 0.45), 0 0 10px rgba(255, 92, 92, 0.2);
    background: rgba(32, 0, 0, 0.72);
    filter: brightness(1);
  }
  50% {
    border-left-color: #ffd0d0;
    box-shadow: -7px 0 30px rgba(255, 139, 139, 0.95), 0 0 26px rgba(255, 139, 139, 0.55);
    background: rgba(52, 4, 4, 0.9);
    filter: brightness(1.14);
  }
  100% {
    border-left-color: #ff5c5c;
    box-shadow: -5px 0 16px rgba(255, 92, 92, 0.45), 0 0 10px rgba(255, 92, 92, 0.2);
    background: rgba(32, 0, 0, 0.72);
    filter: brightness(1);
  }
}

@keyframes goal-green-text-pulse {
  0% {
    color: #72ffaa;
    text-shadow: 0 0 10px rgba(114, 255, 170, 0.55), 0 0 2px rgba(255, 255, 255, 0.75);
  }
  50% {
    color: #f4fff8;
    text-shadow: 0 0 24px rgba(202, 255, 223, 1), 0 0 42px rgba(114, 255, 170, 0.85);
  }
  100% {
    color: #72ffaa;
    text-shadow: 0 0 10px rgba(114, 255, 170, 0.55), 0 0 2px rgba(255, 255, 255, 0.75);
  }
}

@keyframes goal-red-text-pulse {
  0% {
    color: #ff7a7a;
    text-shadow: 0 0 10px rgba(255, 122, 122, 0.55), 0 0 2px rgba(255, 255, 255, 0.75);
  }
  50% {
    color: #fff5f5;
    text-shadow: 0 0 24px rgba(255, 209, 209, 1), 0 0 42px rgba(255, 122, 122, 0.85);
  }
  100% {
    color: #ff7a7a;
    text-shadow: 0 0 10px rgba(255, 122, 122, 0.55), 0 0 2px rgba(255, 255, 255, 0.75);
  }
}

.chat-message.goal-green-pulse {
  animation: bounce-in-left 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), goal-green-border-pulse 0.9s ease-in-out infinite !important;
  border-left-width: 6px !important;
}

.chat-message.goal-red-pulse {
  animation: bounce-in-left 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), goal-red-border-pulse 0.9s ease-in-out infinite !important;
  border-left-width: 6px !important;
}

.goal-green-text {
  display: inline-block;
  font-weight: bold;
  letter-spacing: 0.35px;
  animation: goal-green-text-pulse 0.9s ease-in-out infinite;
}

.goal-red-text {
  display: inline-block;
  font-weight: bold;
  letter-spacing: 0.35px;
  animation: goal-red-text-pulse 0.9s ease-in-out infinite;
}

/* Upload Tab Styles */
.upload-description {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

#upload-form {
  margin-bottom: 2rem;
}

#upload-form small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.upload-status {
  padding: 0.75rem;
  margin: 1rem 0;
  border-radius: 4px;
  font-size: 0.9rem;
}

.upload-status.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.upload-status.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.upload-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.packs-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.pack-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  transition: background 0.2s;
}

.pack-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pack-name {
  font-weight: 500;
  color: var(--fg);
}

.pack-delete-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.pack-delete-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
}

.loading-text,
.empty-text,
.error-text {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-style: italic;
}

.error-text {
  color: #fca5a5;
}

.upload-progress-container {
  margin: 1rem 0;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}

.upload-progress-bar {
  width: 100%;
  height: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #ffb84d 100%);
  border-radius: 12px;
  transition: width 0.3s ease;
  width: 0%;
  box-shadow: 0 0 10px rgba(255, 159, 28, 0.5);
}

.upload-progress-text {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}
