.overlay {
  --settings-modal-open-dur: var(--duration-slow);
  --settings-modal-close-dur: var(--duration-fast);
  --settings-modal-scale: 0.96;
  --settings-modal-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background:
    radial-gradient(circle at 50% 42%, rgba(248, 245, 237, 0.1), rgba(20, 18, 14, 0.16) 62%, rgba(20, 18, 14, 0.24)),
    rgba(20, 18, 14, 0.2);
  opacity: 0;
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition:
    opacity var(--settings-modal-open-dur) var(--settings-modal-ease),
    backdrop-filter var(--settings-modal-open-dur) var(--settings-modal-ease),
    -webkit-backdrop-filter var(--settings-modal-open-dur) var(--settings-modal-ease);
  -webkit-app-region: no-drag;
}

.overlay.open {
  opacity: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.overlay.closing {
  opacity: 0;
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  pointer-events: none;
  transition-duration: var(--settings-modal-close-dur);
}

.card {
  width: min(720px, calc(100vw - var(--space-lg) - var(--space-lg)));
  height: min(700px, calc(100vh - var(--space-lg) - var(--space-lg)));
  min-height: min(500px, calc(100vh - var(--space-lg) - var(--space-lg)));
  display: flex;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--overlay-light);
  border-radius: var(--radius-lg, 4px);
  box-shadow:
    0 26px 70px rgba(20, 18, 14, 0.18),
    0 8px 24px rgba(20, 18, 14, 0.12);
  opacity: 0;
  transform: scale(var(--settings-modal-scale));
  transform-origin: center;
  pointer-events: none;
  transition:
    transform var(--settings-modal-open-dur) var(--settings-modal-ease),
    opacity var(--settings-modal-open-dur) var(--settings-modal-ease);
  will-change: transform, opacity;
}

.card[data-wide="true"] {
  width: min(1080px, calc(100vw - var(--space-lg) - var(--space-lg)));
}

.card.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.card.closing {
  opacity: 0;
  transform: scale(var(--settings-modal-scale));
  pointer-events: none;
  transition-duration: var(--settings-modal-close-dur);
}

@media (max-width: 760px) {
  .overlay {
    padding: var(--space-sm);
  }

  .card {
    width: calc(100vw - var(--space-sm) - var(--space-sm));
    height: calc(100vh - var(--space-sm) - var(--space-sm));
    min-height: 0;
  }
}

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