body.auth-modal-open {
  overflow: hidden;
}

.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.76);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.auth-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.auth-modal {
  position: relative;
  display: none;
  box-sizing: border-box;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--text, #f4f4f5);
  background: var(--card, #141416);
  border: 1px solid var(--border-strong, #34343a);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.62);
}

.auth-modal.active {
  display: block;
  animation: authModalIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-modal::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--red, #cc0000);
}

@keyframes authModalIn {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--text-dim, #787880);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
}

.auth-modal-close:hover,
.auth-modal-close:focus-visible {
  color: var(--text, #f4f4f5);
  background: var(--bg-3, #202024);
  outline: none;
}

.auth-modal-close svg {
  width: 17px;
  height: 17px;
}

.auth-modal-head {
  padding: 28px 32px 0;
  text-align: center;
}

.auth-modal-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text, #f4f4f5);
  font: 800 17px/1 'Inter', Arial, sans-serif;
  text-decoration: none;
}

.auth-modal-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.auth-modal-brand > span > span {
  color: var(--red-hover, #ff1a1a);
}

.auth-modal-head h2 {
  margin: 14px 0 6px;
  color: var(--text, #f4f4f5);
  font: 800 24px/1.2 'Inter', Arial, sans-serif;
  letter-spacing: 0;
}

.auth-modal-head p {
  margin: 0 0 22px;
  color: var(--text-muted, #a2a2aa);
  font: 400 14px/1.5 'Inter', Arial, sans-serif;
}

.auth-modal-body {
  padding: 0 32px 28px;
}

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

.auth-modal-field {
  display: block;
  margin: 0 0 14px;
  text-align: left;
}

.auth-modal-field > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-dim, #787880);
  font: 600 12px/1.3 'Inter', Arial, sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-modal-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  padding: 11px 13px;
  color: var(--text, #f4f4f5);
  background: var(--bg-3, #202024);
  border: 1px solid var(--border, #29292e);
  border-radius: 7px;
  font: 400 14px/1.4 'Inter', Arial, sans-serif;
}

.auth-modal-field input:focus {
  border-color: var(--red, #cc0000);
  box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.14);
  outline: none;
}

.auth-modal-field input::placeholder {
  color: var(--text-dim, #787880);
}

.auth-modal-form-row {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 14px;
}

.auth-modal-form-row a,
.auth-modal-check a,
.auth-modal-foot a {
  color: var(--red-hover, #ff1a1a);
  text-decoration: none;
}

.auth-modal-form-row a:hover,
.auth-modal-check a:hover,
.auth-modal-foot a:hover {
  text-decoration: underline;
}

.auth-modal-form-row a {
  font: 600 12px/1.4 'Inter', Arial, sans-serif;
}

.auth-modal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--text-dim, #787880);
  cursor: pointer;
  font: 400 11px/1.5 'Inter', Arial, sans-serif;
}

.auth-modal-check input {
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--red, #cc0000);
}

.auth-modal-submit {
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  color: #fff;
  background: var(--red, #cc0000);
  border: 1px solid var(--red, #cc0000);
  border-radius: 7px;
  box-shadow: 0 4px 20px rgba(204, 0, 0, 0.22);
  cursor: pointer;
  font: 700 14px/1.2 'Inter', Arial, sans-serif;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.auth-modal-submit:hover,
.auth-modal-submit:focus-visible {
  background: var(--red-hover, #ff1a1a);
  border-color: var(--red-hover, #ff1a1a);
  outline: none;
  transform: translateY(-1px);
}

.auth-modal-submit:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.auth-modal-note {
  margin: 12px 0 0;
  color: var(--text-dim, #787880);
  font: 400 11px/1.5 'Inter', Arial, sans-serif;
  text-align: center;
}

.auth-modal-foot {
  padding: 15px 32px;
  color: var(--text-muted, #a2a2aa);
  background: var(--bg-3, #202024);
  border-top: 1px solid var(--border, #29292e);
  border-radius: 0 0 8px 8px;
  font: 400 13px/1.5 'Inter', Arial, sans-serif;
  text-align: center;
}

.auth-modal-foot a {
  font-weight: 600;
}

.auth-modal-message {
  margin: 0 0 16px;
  padding: 11px 12px;
  border: 1px solid var(--border-strong, #34343a);
  border-radius: 7px;
  font: 500 12px/1.5 'Inter', Arial, sans-serif;
}

.auth-modal-message-error {
  color: #ffb3b3;
  background: rgba(204, 0, 0, 0.1);
  border-color: rgba(255, 26, 26, 0.48);
}

.auth-modal-message-success {
  color: #9df2c8;
  background: rgba(0, 180, 105, 0.09);
  border-color: rgba(0, 217, 122, 0.42);
}

.auth-modal-account-email {
  margin: 0 0 14px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  color: var(--text-muted, #a2a2aa);
  background: var(--bg-3, #202024);
  border: 1px solid var(--border, #29292e);
  border-radius: 7px;
  font: 500 12px/1.4 'JetBrains Mono', monospace;
  text-align: center;
}

@media (max-width: 520px) {
  .auth-modal-backdrop {
    align-items: flex-start;
    padding: 14px;
    overflow-y: auto;
  }

  .auth-modal {
    max-height: none;
    margin: auto 0;
  }

  .auth-modal-head {
    padding: 24px 22px 0;
  }

  .auth-modal-body {
    padding: 0 22px 22px;
  }

  .auth-modal-foot {
    padding: 14px 22px;
  }

  .auth-modal-head h2 {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-modal-backdrop {
    transition: none;
  }

  .auth-modal.active {
    animation: none;
  }
}
