/* ==========================================================================
   Painel de ajustes CRT
   ========================================================================== */

.settings-panel {
  position: relative;
  width: 100%;
  scroll-margin-block: 1rem;
  max-width: 66rem;
  margin-top: clamp(.9rem, 2vh, 1.35rem);
  padding: clamp(1rem, 2.2vw, 1.65rem);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .11);
  border-top-color: rgba(var(--gold-rgb), .35);
  border-radius: .75rem;
  background:
    linear-gradient(148deg, rgba(255, 255, 255, .08), transparent 13%),
    linear-gradient(180deg, #1b222d 0%, #0c1119 28%, #070a10 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .13),
    inset 0 -2px 8px rgba(0, 0, 0, .7),
    0 1.2rem 2.5rem -1.8rem rgba(0, 0, 0, .9);
  animation: settings-enter 340ms var(--ease-out) both;
}

.settings-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--texture-grain);
  background-size: 9rem 9rem;
  opacity: .1;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.settings-panel > * {
  position: relative;
  z-index: 1;
}

.settings-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding-bottom: clamp(.8rem, 1.5vw, 1.1rem);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.settings-panel__kicker {
  display: block;
  margin-bottom: .28rem;
  color: var(--gold-deep);
  font-family: var(--font-mono);
  font-size: clamp(.46rem, .65vw, .55rem);
  font-weight: 500;
  letter-spacing: .24em;
  line-height: 1.3;
  text-transform: uppercase;
}

.settings-panel h2 {
  margin: 0;
  color: var(--steel-050);
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.2vw, 2.35rem);
  font-weight: 400;
  letter-spacing: .035em;
  line-height: .95;
  text-transform: uppercase;
}

.settings-close {
  display: grid;
  flex: 0 0 auto;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0 0 .1rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-bottom-color: #000;
  border-radius: 50%;
  background: linear-gradient(180deg, #2d3542, #0b0f16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 4px rgba(0, 0, 0, .4);
  color: var(--steel-300);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  line-height: 1;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.settings-close:hover {
  border-color: rgba(var(--gold-rgb), .5);
  color: var(--gold-bright);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: clamp(.8rem, 2vw, 1.5rem);
  padding-block: clamp(1rem, 2vw, 1.4rem);
}

.settings-group {
  min-width: 0;
  margin: 0;
  padding: clamp(.8rem, 1.6vw, 1.15rem);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: .45rem;
  background: rgba(3, 6, 11, .33);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), inset 0 0 2.5rem rgba(0, 0, 0, .16);
}

.settings-group legend {
  padding: 0 .4rem;
  color: var(--steel-400);
  font-family: var(--font-mono);
  font-size: clamp(.44rem, .62vw, .53rem);
  font-weight: 500;
  letter-spacing: .2em;
  line-height: 1.3;
  text-transform: uppercase;
}

.effect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .2rem .85rem;
  margin-top: .7rem;
  transition: opacity var(--transition-base);
}

.settings-panel[data-master="off"] .effect-grid {
  opacity: .46;
}

.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 2.3rem;
  padding: .3rem .12rem;
  cursor: pointer;
}

.switch-row--master {
  justify-content: flex-start;
  min-height: 3.1rem;
  margin-top: .65rem;
  padding: .55rem .6rem;
  border: 1px solid rgba(var(--gold-rgb), .16);
  border-radius: .3rem;
  background: linear-gradient(90deg, rgba(var(--gold-rgb), .05), transparent 80%);
}

.switch-row--master .switch {
  margin-left: auto;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}

.switch-copy strong {
  color: var(--steel-200);
  font-family: var(--font-mono);
  font-size: clamp(.58rem, .8vw, .67rem);
  font-weight: 500;
  letter-spacing: .05em;
  line-height: 1.3;
}

.switch-copy small {
  color: var(--steel-500);
  font-family: var(--font-mono);
  font-size: clamp(.43rem, .58vw, .5rem);
  letter-spacing: .03em;
  line-height: 1.35;
}

.switch-row input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  opacity: 0;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 2.55rem;
  height: 1.38rem;
  border: 1px solid rgba(0, 0, 0, .85);
  border-radius: .18rem;
  background: #05080c;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .06);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: .18rem;
  width: 1.02rem;
  height: 1.02rem;
  transform: translateY(-50%);
  border: 1px solid #000;
  border-radius: .12rem;
  background: linear-gradient(180deg, #5b6471, #252c36 45%, #0e1218);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(0, 0, 0, .6);
  transition: left 170ms var(--ease-out), background 170ms ease, box-shadow 170ms ease;
}

.switch-row input:checked + .switch {
  border-color: rgba(var(--gold-rgb), .55);
  background: #231d0b;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, .8), 0 0 .55rem rgba(var(--gold-rgb), .13);
}

.switch-row input:checked + .switch::before {
  left: calc(100% - 1.2rem);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 58%, var(--gold-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 0 .55rem rgba(var(--gold-rgb), .38);
}

.switch-row input:focus-visible + .switch {
  box-shadow: var(--focus-ring);
}

.range-row {
  display: block;
  margin-top: 1rem;
}

.range-row:first-of-type {
  margin-top: .3rem;
}

.range-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .3rem;
}

.range-row__head strong {
  color: var(--steel-200);
  font-family: var(--font-mono);
  font-size: clamp(.58rem, .8vw, .66rem);
  font-weight: 500;
  letter-spacing: .06em;
  line-height: 1.3;
}

.range-row output {
  color: var(--gold-bright);
  font-family: var(--font-mono);
  font-size: clamp(.53rem, .72vw, .61rem);
  font-weight: 500;
  letter-spacing: .04em;
  line-height: 1.3;
}

input[type="range"] {
  display: block;
  width: 100%;
  height: 1.45rem;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: .26rem;
  border: 1px solid rgba(0, 0, 0, .9);
  border-radius: .08rem;
  background: linear-gradient(90deg, var(--gold) 0 var(--range-progress, 50%), #05080c var(--range-progress, 50%) 100%);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .05);
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: .26rem;
  border: 1px solid rgba(0, 0, 0, .9);
  border-radius: .08rem;
  background: #05080c;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .9);
}

input[type="range"]::-moz-range-progress {
  height: .26rem;
  border-radius: .08rem;
  background: var(--gold);
}

input[type="range"]::-webkit-slider-thumb {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: calc((.26rem - 1.05rem) / 2 - 1px);
  appearance: none;
  border: 1px solid #000;
  border-radius: .15rem;
  background: linear-gradient(180deg, #6b7481, #2a313b 47%, #11151b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 4px rgba(0, 0, 0, .65);
}

input[type="range"]::-moz-range-thumb {
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid #000;
  border-radius: .15rem;
  background: linear-gradient(180deg, #6b7481, #2a313b 47%, #11151b);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 2px 4px rgba(0, 0, 0, .65);
}

input[type="range"]:focus-visible {
  outline: none;
  box-shadow: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px var(--navy-950), 0 0 0 4px var(--gold-bright);
}

input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 2px var(--navy-950), 0 0 0 4px var(--gold-bright);
}

.settings-panel__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: clamp(.8rem, 1.5vw, 1.1rem);
  border-top: 1px solid rgba(255, 255, 255, .075);
}

.settings-panel__foot p {
  color: var(--steel-500);
  font-family: var(--font-mono);
  font-size: clamp(.45rem, .62vw, .53rem);
  letter-spacing: .04em;
  line-height: 1.5;
}

.settings-reset {
  flex: 0 0 auto;
  min-height: 2.35rem;
  padding: .5rem .8rem;
  border: 1px solid rgba(255, 255, 255, .12);
  border-bottom-color: #000;
  border-radius: .3rem;
  background: linear-gradient(180deg, #242b36, #0b0e14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 2px 4px rgba(0, 0, 0, .35);
  color: var(--steel-300);
  font-family: var(--font-mono);
  font-size: clamp(.48rem, .65vw, .56rem);
  font-weight: 500;
  letter-spacing: .12em;
  line-height: 1.3;
  text-transform: uppercase;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.settings-reset:hover {
  border-color: rgba(var(--gold-rgb), .4);
  color: var(--gold-bright);
}

@keyframes settings-enter {
  0% {
    opacity: 0;
    transform: translateY(-.45rem);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}