:root {
  --auth-bg: rgba(5, 7, 12, 0.78);
  --auth-card: #0b0d14;
  --auth-border: rgba(255, 255, 255, 0.12);
  --auth-text: #f4f6ff;
  --auth-muted: #a9b3ce;
  --auth-accent: #46eaf2;
  --auth-red: var(--brand-red, #e50914);
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 2.6rem 1rem;
  background: var(--auth-bg);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.auth-card {
  position: relative;
  width: min(520px, 94vw);
  max-height: calc(100vh - 4rem);
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--auth-border);
  background: radial-gradient(120% 120% at 50% 0%, rgba(64, 92, 255, 0.14), rgba(11, 13, 20, 0.92) 48%, #090b12 100%);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
  padding: 2.3rem 2rem 2rem;
  color: var(--auth-text);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.25s ease;
}

.auth-modal.open .auth-card {
  transform: translateY(0) scale(1);
}

.auth-card::-webkit-scrollbar {
  width: 6px;
}

.auth-card::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(70, 234, 242, 0.9), transparent);
  box-shadow: 0 0 22px rgba(70, 234, 242, 0.7);
}

.auth-card::after {
  content: "";
  position: absolute;
  inset: -40% 15% auto;
  height: 65%;
  background: radial-gradient(circle, rgba(70, 234, 242, 0.16), transparent 65%);
  pointer-events: none;
}

.auth-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(8, 10, 16, 0.7);
  color: #e7ecff;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
}

.auth-close:hover {
  background: rgba(18, 22, 32, 0.9);
}

.auth-header {
  text-align: center;
  position: relative;
  z-index: 1;
}

.auth-brand {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-family: "Montserrat", sans-serif;
  color: #f4f6ff;
}

.auth-brand span {
  color: var(--auth-accent);
}

#authTitle {
  margin: 1.1rem 0 0.4rem;
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  font-family: "Montserrat", sans-serif;
}

.auth-subtitle {
  margin: 0;
  color: var(--auth-muted);
}

.auth-body {
  margin-top: 1.6rem;
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.auth-view {
  display: grid;
  gap: 0.95rem;
}

.auth-view[hidden] {
  display: none;
}

.auth-field {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: rgba(12, 14, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.auth-field input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f5f7ff;
  font-size: 0.95rem;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.auth-field input::placeholder {
  color: #7d89aa;
}

.auth-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9aa7c7;
}

.auth-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.auth-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #d7dff3;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
}

.auth-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.auth-row {
  display: flex;
  justify-content: flex-end;
}

.auth-link,
.auth-link-inline {
  background: none;
  border: none;
  color: #b8c4e2;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.auth-link:hover,
.auth-link-inline:hover {
  color: #ffffff;
  text-decoration: underline;
}

.auth-submit {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Montserrat", sans-serif;
  color: #fff;
  background: linear-gradient(90deg, #ff3b7c, var(--auth-red));
  box-shadow: 0 14px 32px rgba(229, 9, 20, 0.3);
  cursor: pointer;
}

.auth-submit:disabled {
  cursor: progress;
  opacity: 0.7;
}

.auth-submit:hover {
  filter: brightness(1.05);
}

.auth-feedback {
  margin: 0.75rem 0 0;
  font-size: 0.86rem;
  color: #ff7a9a;
}

.auth-feedback[data-state="info"] {
  color: #9fd7ff;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.78rem;
  color: #94a0bd;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-social {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.8rem;
}

.auth-social-btn {
  height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(13, 16, 26, 0.88);
  color: #f4f6ff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.auth-social-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.32);
}

.auth-social-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.auth-social-btn.discord {
  color: #7289da;
}

.auth-social-btn.github {
  color: #f4f6ff;
}

.auth-footer {
  margin: 0.2rem 0 0;
  text-align: center;
  color: #98a5c4;
  font-size: 0.85rem;
}

.auth-footer .auth-link-inline {
  color: var(--auth-accent);
  font-weight: 600;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 560px) {
  .auth-card {
    padding: 2rem 1.4rem 1.6rem;
  }

  .auth-close {
    top: 0.8rem;
    right: 0.8rem;
  }
}
