*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #03050f;
  color: #c9d6f0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #03050f;
}

.auth-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse 600px 600px at 20% 30%, rgba(14, 42, 120, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 20%, rgba(20, 60, 160, 0.14) 0%, transparent 70%),
    radial-gradient(ellipse 700px 700px at 60% 80%, rgba(8, 28, 90, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 400px 400px at 10% 80%, rgba(30, 80, 180, 0.10) 0%, transparent 70%);
  animation: meshDrift 20s ease-in-out infinite alternate;
}

.auth-bg::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse 500px 500px at 70% 60%, rgba(14, 42, 120, 0.10) 0%, transparent 70%),
    radial-gradient(ellipse 600px 600px at 30% 70%, rgba(20, 60, 160, 0.08) 0%, transparent 70%);
  animation: meshDrift 25s ease-in-out infinite alternate-reverse;
}

@keyframes meshDrift {
  0%   { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(3%, -2%) rotate(1deg); }
  66%  { transform: translate(-2%, 3%) rotate(-1deg); }
  100% { transform: translate(1%, -1%) rotate(0.5deg); }
}

.auth-bg .noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
}

.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(60, 120, 255, 0.3);
  animation: particleFloat linear infinite;
}

.particle:nth-child(1)  { left:  8%; animation-duration: 22s; animation-delay: 0s;    width: 3px; height: 3px; background: rgba(40, 90, 220, 0.25); }
.particle:nth-child(2)  { left: 18%; animation-duration: 28s; animation-delay: -4s;   }
.particle:nth-child(3)  { left: 30%; animation-duration: 25s; animation-delay: -8s;   width: 2.5px; height: 2.5px; }
.particle:nth-child(4)  { left: 42%; animation-duration: 20s; animation-delay: -2s;   background: rgba(20, 60, 180, 0.2); }
.particle:nth-child(5)  { left: 55%; animation-duration: 30s; animation-delay: -6s;   width: 3px; height: 3px; }
.particle:nth-child(6)  { left: 65%; animation-duration: 24s; animation-delay: -10s;  background: rgba(80, 140, 255, 0.2); }
.particle:nth-child(7)  { left: 75%; animation-duration: 26s; animation-delay: -3s;   }
.particle:nth-child(8)  { left: 85%; animation-duration: 22s; animation-delay: -7s;   width: 2.5px; height: 2.5px; }
.particle:nth-child(9)  { left: 92%; animation-duration: 27s; animation-delay: -12s;  background: rgba(30, 80, 200, 0.18); }
.particle:nth-child(10) { left: 50%; animation-duration: 32s; animation-delay: -15s;  width: 1.5px; height: 1.5px; }

@keyframes particleFloat {
  0%   { transform: translateY(105vh) scale(0);  opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-10vh)  scale(1);  opacity: 0; }
}

.auth-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(4, 8, 24, 0.80);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(40, 80, 200, 0.12);
  border-radius: 24px;
  padding: 44px 38px 38px;
  box-shadow:
    0 0 0 1px rgba(60, 120, 255, 0.04) inset,
    0 25px 60px rgba(0, 0, 0, 0.65),
    0 0 80px rgba(14, 42, 140, 0.07);
  animation: cardFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(40, 90, 220, 0.45),
    rgba(80, 140, 255, 0.45),
    transparent
  );
}

@keyframes cardFadeIn {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-brand {
  text-align: center;
  margin-bottom: 8px;
}

.auth-brand .logo-text {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #4a7fff, #7ab0ff, #a8cfff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(40, 90, 220, 0.3));
  display: inline-block;
}

.auth-brand .logo-dot {
  -webkit-text-fill-color: transparent;
  background: linear-gradient(135deg, #a8cfff, #d0e8ff);
  -webkit-background-clip: text;
  background-clip: text;
}

.auth-heading {
  text-align: center;
  margin-bottom: 32px;
}

.auth-heading h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #dce8ff;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.auth-heading p {
  font-size: 0.88rem;
  color: rgba(140, 170, 220, 0.75);
  font-weight: 400;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(140, 170, 220, 0.75);
  margin-bottom: 8px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 16px;
  font-size: 0.9rem;
  color: rgba(100, 140, 220, 0.4);
  transition: color 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.input-wrapper input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  background: rgba(10, 20, 60, 0.5);
  border: 1px solid rgba(40, 80, 180, 0.14);
  border-radius: 12px;
  color: #dce8ff;
  font-family: 'Poppins', sans-serif;
  font-size: 0.92rem;
  font-weight: 400;
  outline: none;
  transition:
    border-color 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
}

.input-wrapper input::placeholder {
  color: rgba(100, 140, 210, 0.3);
  font-weight: 400;
}

.input-wrapper input:focus {
  border-color: rgba(60, 120, 255, 0.5);
  background: rgba(14, 28, 80, 0.55);
  box-shadow:
    0 0 0 3px rgba(40, 90, 220, 0.10),
    0 0 20px rgba(40, 90, 220, 0.07);
}

.input-wrapper:focus-within .input-icon {
  color: rgba(100, 160, 255, 0.8);
}

.toggle-password {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: rgba(100, 140, 220, 0.4);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  transition: color 0.25s ease;
  z-index: 2;
}

.toggle-password:hover {
  color: rgba(140, 180, 255, 0.8);
}

.input-validation {
  position: absolute;
  right: 16px;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  z-index: 2;
}

.input-validation.valid   { color: #4ade80; }
.input-validation.invalid { color: #f87171; }

.validation-hint {
  font-size: 0.75rem;
  color: rgba(140, 170, 220, 0.45);
  margin-top: 6px;
  padding-left: 2px;
  transition: color 0.3s ease;
}

.validation-hint.error   { color: #f87171; }
.validation-hint.success { color: #4ade80; }

.password-strength {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.strength-bars {
  display: flex;
  gap: 4px;
  flex: 1;
}

.strength-bar {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  flex: 1;
  transition: background 0.4s ease;
}

.strength-bar.active.weak        { background: #ef4444; }
.strength-bar.active.medium      { background: #f59e0b; }
.strength-bar.active.strong      { background: #22c55e; }
.strength-bar.active.very-strong { background: #4ade80; }

.strength-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 50px;
  text-align: right;
  transition: color 0.4s ease;
  color: rgba(140, 170, 220, 0.45);
}

.strength-label.weak        { color: #ef4444; }
.strength-label.medium      { color: #f59e0b; }
.strength-label.strong      { color: #22c55e; }
.strength-label.very-strong { color: #4ade80; }

.form-group.invite-group label {
  color: rgba(251, 191, 36, 0.7);
}

.form-group.invite-group .input-wrapper input {
  border-color: rgba(251, 191, 36, 0.12);
}

.form-group.invite-group .input-wrapper input:focus {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.03);
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.06),
    0 0 20px rgba(251, 191, 36, 0.04);
}

.form-group.invite-group .input-wrapper .input-icon {
  color: rgba(251, 191, 36, 0.35);
}

.form-group.invite-group .input-wrapper:focus-within .input-icon {
  color: rgba(251, 191, 36, 0.7);
}

.auth-btn {
  width: 100%;
  padding: 15px 24px;
  border: none;
  border-radius: 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a3fa8, #2d5fd4);
  transition:
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s ease,
    filter 0.3s ease;
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.auth-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(255,255,255,0.08) 0%,
    transparent 50%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.auth-btn:hover {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.12);
}

.auth-btn:hover::before {
  opacity: 1;
}

.auth-btn:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 2px 10px rgba(30, 70, 200, 0.2);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}

.auth-btn .btn-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s ease;
}

.auth-btn .btn-spinner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-btn.loading .btn-text    { display: none; }
.auth-btn.loading .btn-spinner { display: inline-flex; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 0.85rem;
  color: rgba(140, 170, 220, 0.55);
}

.auth-footer a {
  color: #6a9fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.25s ease;
  position: relative;
}

.auth-footer a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: #6a9fff;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-footer a:hover {
  color: #a0c4ff;
}

.auth-footer a:hover::after {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(40, 80, 180, 0.1);
}

.auth-divider span {
  font-size: 0.75rem;
  color: rgba(140, 170, 220, 0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

@media (max-width: 520px) {
  .auth-card {
    padding: 36px 24px 30px;
    border-radius: 20px;
    max-width: 100%;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .auth-wrapper {
    padding: 0;
    align-items: stretch;
  }

  .auth-brand .logo-text {
    font-size: 1.75rem;
  }

  .auth-heading h1 {
    font-size: 1.3rem;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding: 30px 18px 24px;
  }

  .input-wrapper input {
    padding: 12px 14px 12px 42px;
    font-size: 0.88rem;
  }
}

.auth-card .form-group {
  opacity: 0;
  transform: translateY(12px);
  animation: fieldFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-card .form-group:nth-child(1) { animation-delay: 0.15s; }
.auth-card .form-group:nth-child(2) { animation-delay: 0.22s; }
.auth-card .form-group:nth-child(3) { animation-delay: 0.29s; }
.auth-card .form-group:nth-child(4) { animation-delay: 0.36s; }
.auth-card .form-group:nth-child(5) { animation-delay: 0.43s; }

.auth-btn {
  opacity: 0;
  transform: translateY(12px);
  animation: fieldFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.45s forwards;
}

.auth-footer {
  opacity: 0;
  animation: fieldFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards;
}

@keyframes fieldFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::selection {
  background: rgba(40, 90, 220, 0.3);
  color: #fff;
}

::-moz-selection {
  background: rgba(40, 90, 220, 0.3);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(40, 80, 180, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(60, 120, 240, 0.25);
}

.turnstile-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 16px 0 20px 0;
  min-height: 65px;
}