.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 850;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 10, 18, 0.78);
  backdrop-filter: blur(10px);
}

.auth-modal.active {
  display: flex;
}

.auth-modal__dialog {
  position: relative;
  width: min(460px, 100%);
  max-height: min(88vh, 900px);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(20, 28, 42, 0.98), rgba(12, 18, 28, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  padding: 28px;
}

.auth-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.auth-modal__close:hover,
.auth-modal__close:focus-visible {
  border-color: rgba(124, 77, 255, 0.45);
  color: var(--text);
  background: rgba(124, 77, 255, 0.14);
  outline: none;
}

.auth-modal__header {
  margin-bottom: 18px;
}

.auth-modal__eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

.auth-modal__title {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.15;
}

.auth-modal__copy {
  margin: 10px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 20px 0 16px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
}

.auth-tab {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 700;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.auth-tab:hover,
.auth-tab:focus-visible {
  color: var(--text);
  outline: none;
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(124, 77, 255, 0.22), rgba(0, 194, 255, 0.16));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(124, 77, 255, 0.18);
}

.auth-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.12);
  color: #ffd7d7;
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-link {
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.auth-link:hover,
.auth-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.auth-submit-btn {
  margin-top: 4px;
}

.auth-submit-btn[disabled] {
  opacity: 0.72;
  cursor: wait;
}

@media (max-width: 640px) {
  .auth-modal {
    padding: 12px;
    align-items: flex-end;
  }

  .auth-modal__dialog {
    width: 100%;
    max-height: min(92vh, 900px);
    border-radius: 24px 24px 18px 18px;
    padding: 24px 20px 20px;
  }
}
