/* Configurações — botão de engrenagem + painel que desce do topo.
   Tudo em tokens (var(--…)), então já acompanha o tema. */

.cfg-engrenagem {
  position: fixed;
  top: 12px;
  right: 12px;
  /* abaixo de qualquer modal/lightbox (20+) — é mobília da página, não deve
     flutuar por cima de overlays nem tampar o "x" deles no canto. */
  z-index: 15;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--muted);
  box-shadow: var(--sombra-sm);
  cursor: pointer;
  transition: transform .25s ease, color .15s ease, border-color .15s ease;
}
.cfg-engrenagem:hover { color: var(--acento); border-color: var(--line-forte); transform: rotate(45deg); }
.cfg-engrenagem svg { width: 20px; height: 20px; display: block; }

.cfg-fundo {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 12, 18, .5);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 16px;
}

.cfg-painel {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--raio) var(--raio);
  box-shadow: var(--sombra-lg);
  padding: 16px 20px 22px;
  animation: cfg-desce .18s ease-out;
}
@keyframes cfg-desce {
  from { transform: translateY(-14px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.cfg-topo {
  position: sticky;
  top: -16px;
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.cfg-topo h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.cfg-x {
  border: 0; background: transparent;
  font-size: 22px; line-height: 1;
  color: var(--muted); cursor: pointer;
  padding: 2px 6px; border-radius: 6px;
}
.cfg-x:hover { background: var(--bg-sub); color: var(--ink); }

.cfg-corpo { display: grid; gap: 4px; }

.cfg-secao {
  display: grid;
  gap: 8px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.cfg-secao:last-child { border-bottom: 0; }
.cfg-linha {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}
.cfg-rotulo {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.cfg-dica { margin: 2px 0 0; font-size: 11.5px; color: var(--faint); line-height: 1.5; }

/* controle segmentado */
.cfg-seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  background: var(--bg-sub);
  border: 1px solid var(--line);
  border-radius: var(--raio-sm);
  padding: 4px;
}
.cfg-seg button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 8px 6px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.cfg-seg button:hover { color: var(--ink); }
.cfg-seg button[aria-pressed="true"] {
  background: var(--bg-elev);
  color: var(--acento-forte);
  box-shadow: var(--sombra-sm);
}

/* botão de ação */
.cfg-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg-sub);
  border: 1px solid var(--line-forte);
  border-radius: var(--raio-sm);
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.cfg-btn:hover:not(:disabled) { border-color: var(--acento); color: var(--acento); }
.cfg-btn:disabled { opacity: .6; cursor: default; }

/* interruptor */
.cfg-switch {
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-forte);
  background: var(--bg-sub);
  position: relative;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.cfg-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-elev);
  box-shadow: var(--sombra-sm);
  transition: transform .15s ease;
}
.cfg-switch[aria-pressed="true"] { background: var(--acento); border-color: var(--acento); }
.cfg-switch[aria-pressed="true"]::after { transform: translateX(18px); }
.cfg-switch:disabled { opacity: .6; cursor: default; }

/* downloads recentes dentro do painel */
.cfg-recentes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.cfg-recentes li { display: grid; gap: 1px; }
.cfg-recentes a {
  font-size: 13px;
  font-weight: 600;
  color: var(--acento);
  text-decoration: none;
  word-break: break-all;
}
.cfg-recentes a:hover { text-decoration: underline; }
.cfg-recentes span { font-size: 11.5px; color: var(--faint); }

@media (prefers-reduced-motion: reduce) {
  .cfg-engrenagem, .cfg-painel, .cfg-switch::after { transition: none; animation: none; }
  .cfg-engrenagem:hover { transform: none; }
}
