.modal,
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.modal.open,
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-content,
.modal-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  background: #09101f;
  padding: 40px;
  box-shadow: 0 40px 100px rgba(0,0,0,.6);
  transform: translateY(20px) scale(.97);
  transition: transform .35s cubic-bezier(.22,1,.36,1);
}

.modal-content::before,
.modal-box::before {
  content: '';
  position: absolute;
  top: 0;
  right: 20%;
  left: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,.5), transparent);
}

.modal.open .modal-content,
.modal.open .modal-box,
.modal-overlay.open .modal-content,
.modal-overlay.open .modal-box {
  transform: none;
  animation: modalShellIn .35s cubic-bezier(.22,1,.36,1);
}

.modal-header,
.modal-body,
.modal-footer {
  min-width: 0;
}

.modal-title,
.modal-content h2,
.modal-box h2 {
  margin-bottom: 8px;
  font-family: var(--display, var(--font-display));
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.02em;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, var(--border-subtle));
  border-radius: 8px;
  background: var(--card, var(--color-card));
  color: var(--muted, var(--color-muted));
  font-size: 1rem;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.modal-close:hover {
  background: rgba(255,255,255,.08);
  color: var(--text, var(--color-text));
}

.modal-close:focus-visible {
  outline: 2px solid rgba(99,102,241,.72);
  outline-offset: 3px;
}

.modal-subtitle {
  margin-bottom: 28px;
  color: var(--muted, var(--color-muted));
  font-size: .875rem;
}

.modal .auth-form,
.modal-overlay .auth-form {
  margin: 0;
}

.modal-switch {
  margin-top: 18px;
  color: var(--muted, var(--color-muted));
  font-size: .82rem;
  text-align: center;
}

.modal-switch a {
  color: var(--primary, var(--color-primary));
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.modal-switch a:hover {
  text-decoration: underline;
}

.modal-success,
.forgot-success {
  padding: 16px 0;
  text-align: center;
}

.modal-success-icon {
  display: block;
  margin-bottom: 16px;
  font-size: 3rem;
}

.modal-success-sub {
  margin: 12px 0 24px;
  color: var(--muted, var(--color-muted));
  font-size: .9rem;
}

.modal-success-dot {
  width: 28px;
  height: 28px;
  margin: 0 auto;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--green, var(--color-green));
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes modalShellIn {
  from {
    transform: translateY(20px) scale(.97);
  }

  to {
    transform: none;
  }
}
