/* ---------- Settings panel (public/js/settings.js) ---------- */
:root {
  --ui-scale: 1;
}

#settingsBtn {
  right: 204px; /* emotes 108px, music 156px */
  transition: transform 0.25s;
}
#settingsBtn:hover,
#settingsBtn.on {
  transform: rotate(60deg);
}

#settings {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at center, rgba(30, 12, 50, 0.55), rgba(4, 2, 10, 0.78));
  animation: setFade 0.18s ease-out;
}
@keyframes setFade {
  from {
    opacity: 0;
  }
}
@keyframes setPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.set-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  padding: 18px 20px 16px;
  animation: setPop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  background: linear-gradient(160deg, rgba(40, 22, 64, 0.95), rgba(18, 10, 30, 0.96));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(190, 160, 255, 0.08) inset, 0 0 60px rgba(157, 123, 255, 0.18);
}

.set-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.set-top h2 {
  margin: 0;
  font-family: 'Creepster', 'Fredoka', cursive;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 2px;
  color: var(--ghost);
  text-shadow: 0 0 18px rgba(157, 123, 255, 0.6);
}
.set-x {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}
.set-x:hover {
  background: rgba(255, 107, 129, 0.25);
}

.set-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  margin-bottom: 12px;
}
.set-tab {
  flex: 1;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 9px;
  padding: 8px 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.set-tab:hover {
  color: var(--text);
}
.set-tab.on {
  color: #fff;
  background: linear-gradient(135deg, #8f6bff, #c86bff);
  box-shadow: 0 4px 14px rgba(143, 107, 255, 0.35);
}

.set-body {
  overflow-y: auto;
  min-height: 250px;
  padding-right: 4px;
}
.set-pane {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.set-row {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.set-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(190, 160, 255, 0.14);
}
.set-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.set-label {
  font-weight: 500;
  font-size: 15px;
}
.set-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent-2);
  min-width: 48px;
  text-align: right;
}
.set-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* range slider with filled track */
.set-row input[type='range'] {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 10px 0 2px;
  border-radius: 6px;
  background: linear-gradient(90deg, #8f6bff, #c86bff) 0 / var(--fill) 100% no-repeat, rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}
.set-row input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #a983ff;
  box-shadow: 0 0 10px rgba(157, 123, 255, 0.7);
}
.set-row input[type='range']::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #a983ff;
  box-shadow: 0 0 10px rgba(157, 123, 255, 0.7);
}
.set-row input[type='range']:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--accent-2);
}

/* toggle switch */
.set-switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: background 0.2s;
}
.set-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.2s;
}
.set-switch.on {
  background: linear-gradient(135deg, #8f6bff, #c86bff);
  border-color: transparent;
}
.set-switch.on::after {
  transform: translateX(20px);
  background: #fff;
}

/* segmented choice */
.set-seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
}
.set-seg button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
}
.set-seg button.on {
  color: #fff;
  background: rgba(157, 123, 255, 0.55);
}

/* controls reference */
.set-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.set-keysec {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}
.set-keysec h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--ghost);
}
.set-keysec table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.set-keysec td {
  padding: 3px 0;
  vertical-align: top;
}
.set-keysec td:first-child {
  white-space: nowrap;
  padding-right: 8px;
  color: var(--muted);
}
.set-keysec kbd {
  margin-left: 0;
  color: var(--text);
}

.set-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

/* FPS counter */
#fpsCounter {
  position: fixed;
  left: 10px;
  top: 8px;
  z-index: 70;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.5);
  font: 600 12px/1.6 ui-monospace, monospace;
  color: #7dffa0;
  pointer-events: none;
}
#fpsCounter.ok {
  color: var(--accent-2);
}
#fpsCounter.bad {
  color: var(--danger);
}

/* UI scale: zoom the HUD/menus but not the canvas or pointer-positioned helpers */
#menu .card,
#lobby,
#hud > *:not(#pickPreview):not(#crosshair),
#reveal .card,
#scores .card,
#tabBoard .card,
#chat,
#feed,
#chore,
.icon-btn,
#abilityBar,
#gadgetSlots,
#echoBadge,
#presenceBox,
#fpsCounter {
  zoom: var(--ui-scale);
}

/* Reduce motion */
body.reduce-motion #bigText.show {
  animation: setBigFade 1.2s ease-out forwards;
}
@keyframes setBigFade {
  0% {
    opacity: 0;
  }
  15%,
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
body.reduce-motion #settings,
body.reduce-motion .set-card {
  animation: none;
}

@media (max-width: 520px) {
  .set-keys {
    grid-template-columns: 1fr;
  }
  .set-tab {
    font-size: 12px;
  }
  .set-top h2 {
    font-size: 28px;
  }
}
