:root {
  --tag-blue: #1a3b8c;
  --tag-blue-deep: #0f275f;
  --tag-coral: #e85d3b;
  --tag-coral-hot: #ff6a45;
  --ink: #0d1a33;
  --muted: #5b6b86;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(26, 59, 140, 0.14);
  --shadow: 0 24px 60px rgba(15, 39, 95, 0.18);
  --radius: 22px;
  --font: "Outfit", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #0f275f;
}

.stage {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(145deg, #0f275f 0%, #1a3b8c 42%, #274eb0 68%, #3a2a4a 100%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  animation: drift 12s ease-in-out infinite alternate;
}

.glow-a {
  width: 42vw;
  height: 42vw;
  min-width: 280px;
  min-height: 280px;
  left: -8%;
  top: -12%;
  background: radial-gradient(circle, rgba(232, 93, 59, 0.55), transparent 68%);
}

.glow-b {
  width: 36vw;
  height: 36vw;
  min-width: 240px;
  min-height: 240px;
  right: -6%;
  bottom: -10%;
  background: radial-gradient(circle, rgba(120, 180, 255, 0.45), transparent 70%);
  animation-delay: -4s;
}

.mesh {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
  animation: mesh-shift 18s linear infinite;
}

.frame {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: grid;
  gap: 1.25rem;
}

.panel {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 1.75rem 1.75rem 1.5rem;
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand {
  text-align: center;
  margin: 0;
  animation: soft-pop 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.logo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: block;
  margin: 0 auto 0.85rem;
  box-shadow: 0 12px 28px rgba(15, 39, 95, 0.28);
}

.wordmark {
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.1;
}

.wordmark span {
  color: #ffffff;
}

.tagline {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
  text-align: center;
}

.form {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tag-blue-deep);
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--tag-blue);
  box-shadow: 0 0 0 4px rgba(26, 59, 140, 0.14);
  transform: translateY(-1px);
}

.err {
  color: #b42318;
  font-size: 0.78rem;
  font-weight: 500;
  min-height: 0.9rem;
}

.alert {
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: #fff1f0;
  border: 1px solid #ffd0cb;
  color: #9f1f14;
  font-size: 0.9rem;
  font-weight: 500;
  animation: shake 0.35s ease;
}

.cta {
  margin-top: 0.25rem;
  border: 0;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  font: inherit;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--tag-coral) 0%, var(--tag-coral-hot) 55%, #ff8a4c 100%);
  box-shadow: 0 12px 24px rgba(232, 93, 59, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(232, 93, 59, 0.42);
  filter: saturate(1.05);
}

.cta:active {
  transform: translateY(0);
}

.auth-join-link {
  margin: 1.1rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-join-link a {
  color: var(--tag-coral);
  font-weight: 700;
  text-decoration: none;
}

.auth-join-link a:hover {
  text-decoration: underline;
}

.footnote {
  margin: 1.25rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes soft-pop {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: none; }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3%, 4%, 0) scale(1.06); }
}

@keyframes mesh-shift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 48px 48px, 48px 48px; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.login-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: rgba(15, 39, 95, 0.72);
  backdrop-filter: blur(8px);
  padding: 1.5rem;
}

.login-loading[hidden] {
  display: none !important;
}

.login-loading-card {
  width: min(320px, 100%);
  text-align: center;
  color: #eef3ff;
  font-family: var(--font);
}

.login-logo-wrap {
  position: relative;
  width: 6.5rem;
  height: 6.5rem;
  margin: 0 auto 1.1rem;
  display: grid;
  place-items: center;
}

.login-logo-spin {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  animation: logo-pulse 1.4s ease-in-out infinite;
  position: relative;
  z-index: 1;
  background: #fff;
}

.login-logo-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #ff6a45;
  border-right-color: rgba(126, 182, 255, 0.85);
  animation: spin 1.1s linear infinite;
}

.login-loading-label {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.login-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.login-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e85d3b, #ff8a65, #7eb6ff);
  box-shadow: 0 0 12px rgba(232, 93, 59, 0.45);
  transition: width 0.05s linear;
}

.login-progress-pct {
  margin: 0.65rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  opacity: 0.92;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@media (max-width: 480px) {
  .panel { padding: 1.6rem 1.2rem 1.25rem; }
  .logo { width: 84px; height: 84px; }
}
