html,
body {
  margin: 0;
  min-height: 100%;
}

:root {
  --auth-bg-top: #1f1d55;
  --auth-bg-mid: #21416f;
  --auth-bg-end: #29b4cc;
  --auth-panel-width: 440px;
  --auth-panel-shadow: 0 28px 90px rgba(5, 18, 42, 0.26);
  --auth-line: rgba(121, 224, 240, 0.78);
  --auth-mouse-x: 50%;
  --auth-mouse-y: 50%;
  --auth-shift-x: 0px;
  --auth-shift-y: 0px;
  --auth-shift-x-soft: 0px;
  --auth-shift-y-soft: 0px;
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  font-family: "Figtree", sans-serif;
  color: #17314f;
  background:
    linear-gradient(120deg, var(--auth-bg-top) 0%, var(--auth-bg-mid) 54%, var(--auth-bg-end) 100%);
}

body.is-auth-loading {
  overflow: hidden;
}

.auth-shell,
.auth-stage {
  min-height: 100vh;
}

.auth-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  overflow: hidden;
}

.auth-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 28%, rgba(87, 123, 255, 0.24), transparent 22%),
    radial-gradient(circle at 78% 32%, rgba(87, 236, 242, 0.16), transparent 24%),
    radial-gradient(circle at 88% 88%, rgba(91, 240, 228, 0.22), transparent 30%);
  transform: translate3d(var(--auth-shift-x-soft), var(--auth-shift-y-soft), 0);
  transition: transform 320ms ease-out;
  pointer-events: none;
}

.auth-stage::after {
  content: "";
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(circle at 22% 24%, rgba(89, 110, 255, 0.28), transparent 22%),
    radial-gradient(circle at 72% 76%, rgba(57, 245, 224, 0.26), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(105, 229, 255, 0.14), transparent 22%);
  filter: blur(52px);
  opacity: 0.82;
  transform: translate3d(var(--auth-shift-x), var(--auth-shift-y), 0);
  transition: transform 360ms ease-out, opacity 280ms ease-out;
  pointer-events: none;
}

.auth-wavebackdrop {
  position: absolute;
  inset: 0;
  background-image: url("/assets/bg-sound-wave.png");
  background-repeat: no-repeat;
  background-position: center 56%;
  background-size: min(1700px, 110vw) auto;
  opacity: 0.82;
  filter: drop-shadow(0 0 18px rgba(77, 233, 241, 0.18));
  transition: transform 0.9s ease, opacity 0.35s ease, filter 0.35s ease;
  animation: authWaveFloat 10s ease-in-out infinite alternate;
  pointer-events: none;
}

.auth-wavebackdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 24% 52%, rgba(76, 239, 240, 0.1), transparent 18%),
    radial-gradient(circle at 76% 52%, rgba(76, 239, 240, 0.12), transparent 20%),
    linear-gradient(180deg, rgba(13, 24, 54, 0.18) 0%, transparent 24%, transparent 76%, rgba(15, 29, 55, 0.18) 100%);
  background-size: 100% 100%, 100% 100%, 100% 100%;
  animation: authWaveGlow 10s ease-in-out infinite alternate;
}

.auth-center {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  display: grid;
  justify-items: center;
  gap: 28px;
}

.auth-brand-lockup {
  display: grid;
  justify-items: center;
}

.auth-logo {
  width: clamp(170px, 16vw, 220px);
  height: auto;
  filter: drop-shadow(0 16px 28px rgba(8, 24, 55, 0.18));
}

.auth-panel {
  width: min(100%, var(--auth-panel-width));
  min-height: 0;
  padding: 20px;
  border: 1px solid rgba(222, 236, 247, 0.32);
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
  box-shadow: var(--auth-panel-shadow);
  backdrop-filter: blur(24px);
  position: relative;
  overflow: hidden;
  transition: transform 0.28s ease, box-shadow 0.28s ease, background 0.28s ease;
}

.auth-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(214, 251, 255, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  pointer-events: none;
}

.auth-panel-state {
  position: relative;
  z-index: 1;
}

.auth-form-state {
  display: grid;
  gap: 8px;
}

.auth-form {
  display: grid;
  gap: 12px;
  margin-top: 0;
}

.auth-field {
  display: grid;
  gap: 0;
}

.auth-input {
  min-height: 58px;
  padding: 0 18px;
  border: 1px solid rgba(208, 229, 244, 0.3);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background-color .16s ease;
}

.auth-input::placeholder {
  color: rgba(227, 239, 248, 0.56);
}

.auth-input:focus {
  outline: none;
  border-color: rgba(115, 228, 242, 0.88);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 4px rgba(91, 185, 206, 0.14);
  transform: translateY(-1px);
}

.auth-submit {
  min-height: 60px;
  border: 0;
  border-radius: 20px;
  background: linear-gradient(135deg, #58bfd4, #4dd3db);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(51, 174, 191, 0.28);
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 42px rgba(51, 174, 191, 0.32);
  filter: brightness(1.03);
}

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

.auth-status {
  min-height: 0;
  margin: 0;
  color: #ffd4d8;
  font-size: 14px;
  font-weight: 700;
}

.auth-status:empty {
  display: none;
}

.auth-session-notice {
  margin-top: 4px;
  padding: 16px 18px;
  border: 1px solid rgba(209, 231, 245, 0.22);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-session-title {
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.auth-session-copy {
  margin: 6px 0 0;
  color: rgba(221, 240, 251, 0.76);
  font-size: 14px;
  line-height: 1.5;
}

.auth-loading-state {
  display: none;
  min-height: 280px;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 8px 0;
}

.auth-loading-mark {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 140px;
}

.auth-loading-mark span {
  display: block;
  width: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4da0ff 0%, #35d7f1 100%);
  box-shadow: 0 0 26px rgba(53, 215, 241, 0.22);
  transform-origin: center;
  animation: authLoadingBar 1.15s ease-in-out infinite;
}

.auth-loading-mark span:nth-child(1) { height: 88px; animation-delay: 0s; }
.auth-loading-mark span:nth-child(2) { height: 118px; animation-delay: 0.08s; }
.auth-loading-mark span:nth-child(3) { height: 146px; animation-delay: 0.16s; }
.auth-loading-mark span:nth-child(4) { height: 118px; animation-delay: 0.24s; }
.auth-loading-mark span:nth-child(5) { height: 88px; animation-delay: 0.32s; }

.auth-loading-title {
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-loading-copy {
  max-width: 290px;
  color: rgba(222, 242, 250, 0.72);
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
}

body.is-auth-loading .auth-form-state {
  display: none;
}

body.is-auth-loading .auth-loading-state {
  display: grid;
}

body.is-auth-loading .auth-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
}

body.is-auth-loading .auth-wavebackdrop {
  opacity: 0.95;
  transform: scale(1.015);
  filter: drop-shadow(0 0 28px rgba(77, 233, 241, 0.26));
}

body.is-auth-loading .auth-center {
  animation: authStageHold 0.8s ease forwards;
}

@keyframes authLoadingBar {
  0%,
  100% {
    transform: scaleY(0.82);
    opacity: 0.78;
  }
  50% {
    transform: scaleY(1.08);
    opacity: 1;
  }
}

@keyframes authStageHold {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(1.01);
    opacity: 1;
  }
}

@keyframes authWaveFloat {
  0% {
    transform: translate3d(-0.6%, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(0.6%, -12px, 0) scale(1.022);
  }
}

@keyframes authWaveGlow {
  0% {
    opacity: 0.74;
  }
  100% {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .auth-stage {
    padding: 28px 18px;
  }

  .auth-wavebackdrop {
    background-size: 1300px auto;
    background-position: center 58%;
    opacity: 0.56;
  }

  .auth-panel {
    width: min(100%, 420px);
    min-height: 0;
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .auth-logo {
    width: 160px;
  }

  .auth-wavebackdrop {
    background-size: 1080px auto;
  }
}
