:root {
  --bg: #070a12;
  --ink: #f4f6fb;
  --ink-2: #aab2c5;
  --ink-3: #8f98ad;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(139, 92, 246, 0.5);
  --card: rgba(17, 21, 33, 0.62);
  --c1: #5b8cff;
  --c2: #8b5cf6;
  --c3: #22d3ee;
  --btn1: #5168f2;
  --btn2: #7c46f0;
  --danger: #ff6b6b;
}

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

html,
body {
  height: 100%;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- animated canvas ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ---------- aurora (blue / purple / teal, colorful) ---------- */
.aurora span {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  z-index: 0;
  will-change: transform;
  pointer-events: none;
}
.aurora-1 {
  width: 46vw;
  height: 46vw;
  left: -12vw;
  top: -14vw;
  background: radial-gradient(circle, #2f5fe0, transparent 65%);
  animation: drift1 22s ease-in-out infinite;
}
.aurora-2 {
  width: 42vw;
  height: 42vw;
  right: -12vw;
  bottom: -16vw;
  background: radial-gradient(circle, #7c3aed, transparent 65%);
  animation: drift2 26s ease-in-out infinite;
}
.aurora-3 {
  width: 30vw;
  height: 30vw;
  left: 40vw;
  top: 52vh;
  background: radial-gradient(circle, #0e7490, transparent 65%);
  opacity: 0.35;
  animation: drift3 30s ease-in-out infinite;
}

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vw, 5vh) scale(1.12); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-7vw, -6vh) scale(1.12); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5vw, -8vh) scale(0.9); }
}

/* ---------- planet limb ---------- */
.planet {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.planet-glow {
  position: absolute;
  right: -16vw;
  bottom: -46vh;
  width: 74vw;
  height: 74vw;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%,
    rgba(167, 139, 250, 0.18) 0%,
    rgba(91, 140, 255, 0.09) 30%,
    transparent 62%);
}
.planet-limb {
  position: absolute;
  right: -20vw;
  bottom: -52vh;
  width: 80vw;
  height: 80vw;
  border-radius: 50%;
  border: 1px solid rgba(158, 148, 255, 0.16);
  box-shadow:
    inset 0 6px 40px rgba(139, 122, 255, 0.09),
    0 -2px 60px rgba(91, 140, 255, 0.07);
  -webkit-mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0.35) 32%, transparent 52%);
  mask-image: linear-gradient(0deg, #000 0%, rgba(0, 0, 0, 0.35) 32%, transparent 52%);
}
.planet-orbit {
  position: absolute;
  right: -20vw;
  bottom: -52vh;
  width: 80vw;
  height: 80vw;
  border-radius: 50%;
  -webkit-mask-image: linear-gradient(0deg, #000 0%, transparent 46%);
  mask-image: linear-gradient(0deg, #000 0%, transparent 46%);
  animation: orbitSpin 48s linear infinite;
}
.planet-orbit i {
  position: absolute;
  left: 8%;
  top: 18%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c2);
  box-shadow: 0 0 12px 2px rgba(139, 92, 246, 0.8), 0 0 32px 6px rgba(139, 92, 246, 0.3);
}
@keyframes orbitSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

/* ---------- layout ---------- */
.stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 4vw;
  height: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 48px;
}

/* ---------- intro ---------- */
.intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: min(560px, 100%);
}

.intro-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: #fff;
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.35);
}
.logo svg {
  width: 25px;
  height: 25px;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.45));
}

.intro-org {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.intro-org span {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0.24em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--c3);
  margin-bottom: 20px;
}
.eyebrow:before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--c3);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
}

.intro-body h1 {
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, #f6f8fd 15%, #b9c3d6 135%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grad {
  background: linear-gradient(100deg, var(--c1), var(--c2) 60%, var(--c3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.lede {
  margin-top: 22px;
  max-width: 460px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
  list-style: none;
}
.chips li {
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  transition:
    border-color 0.25s,
    transform 0.25s,
    background 0.25s,
    box-shadow 0.25s,
    color 0.25s;
}
.chips li:hover {
  border-color: var(--line-strong);
  color: #c9b8fd;
  transform: translateY(-2px);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 6px 18px -8px rgba(139, 92, 246, 0.55);
}

.intro-foot {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

/* ---------- login card ---------- */
.login-card {
  position: relative;
  padding: 40px 38px 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: cardIn 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* cursor spotlight */
.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    360px circle at var(--mx, 50%) var(--my, 0%),
    rgba(91, 140, 255, 0.13),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.login-card:hover::before {
  opacity: 1;
}

/* top edge glow */
.login-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196, 181, 253, 0.6), transparent);
}

.card-head h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.card-head p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-2);
}

/* ---------- fields ---------- */
.field {
  position: relative;
  margin-top: 22px;
}

.field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-55%);
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  transition: color 0.25s;
  pointer-events: none;
}
.field-icon svg {
  width: 100%;
  height: 100%;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.25s,
    background 0.25s,
    box-shadow 0.25s;
}
.field input::placeholder {
  color: var(--ink-3);
}
.field input:focus {
  border-color: var(--c1);
  background: rgba(91, 140, 255, 0.07);
  box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.13);
}
.field input:focus ~ .field-icon,
.field:focus-within .field-icon {
  color: var(--c1);
}

.field-line {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  box-shadow: 0 0 8px rgba(91, 140, 255, 0.6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  pointer-events: none;
}
.field:focus-within .field-line {
  transform: scaleX(1);
}

/* shake on error */
.field.shake {
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
.field.has-error input {
  border-color: rgba(255, 122, 122, 0.6);
}
.field.has-error input:focus {
  box-shadow: 0 0 0 4px rgba(255, 122, 122, 0.12);
}

.toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-55%);
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}
.toggle-pw svg {
  width: 17px;
  height: 17px;
}
.toggle-pw:hover {
  color: var(--c1);
  background: rgba(91, 140, 255, 0.1);
}

/* ---------- error box ---------- */
.error-box {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--danger);
  background: rgba(255, 122, 122, 0.08);
  opacity: 0;
  transition:
    max-height 0.3s ease,
    margin-top 0.3s ease,
    padding 0.3s ease,
    opacity 0.3s ease;
}
.error-box.show {
  max-height: 60px;
  margin-top: 18px;
  padding: 10px 14px;
  border-color: rgba(255, 122, 122, 0.25);
  opacity: 1;
}

/* ---------- submit ---------- */
.submit-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 51px;
  margin-top: 28px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(100deg, var(--btn1), var(--btn2));
  background-size: 160% 160%;
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(91, 118, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition:
    transform 0.2s,
    box-shadow 0.3s,
    background-position 0.6s ease;
}
.submit-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}
.submit-btn:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 16px 38px rgba(99, 102, 241, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.submit-btn:hover::after {
  transform: translateX(100%);
}
.submit-btn:active {
  transform: translateY(0);
}
.btn-arrow {
  display: flex;
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
}
.btn-arrow svg {
  width: 100%;
  height: 100%;
}
.submit-btn:hover .btn-arrow {
  transform: translateX(4px);
}
.submit-btn:disabled {
  opacity: 0.75;
  cursor: default;
  transform: none;
}
.submit-btn.loading .btn-arrow {
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.card-note {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  body { overflow: auto; }
  .stage {
    grid-template-columns: 1fr;
    gap: 36px;
    height: auto;
    min-height: 100%;
    padding: 40px 24px 48px;
  }
  .intro {
    height: auto;
    gap: 28px;
  }
  .only-wide { display: none; }
  .login-card { padding: 32px 26px 28px; }
  .planet-glow, .planet-limb, .planet-orbit {
    right: -60vw;
  }
}

@media (min-width: 961px) {
  br.only-wide { display: inline; }
}

@media (max-width: 480px) {
  .intro-body h1 { font-size: 32px; }
  .chips li { font-size: 11px; padding: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora span,
  .login-card,
  .submit-btn::after,
  .planet-orbit {
    animation: none !important;
  }
}
