:root {
  --mouse-x: 0;
  --mouse-y: 0;
  --cyan: #78e8ff;
  --pink: #ff8fd6;
  --violet: #a999ff;
  --gold: #f4c56f;
  --ink: #071443;
  --white: #fff;
  --sans: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Iowan Old Style", "Songti SC", "STSong", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #06174e;
  color: #fff;
  font-family: var(--sans);
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.cosmic-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
  background: #071b5c;
}

.scene {
  position: absolute;
  inset: -4%;
  z-index: 0;
  overflow: hidden;
  transform: translate3d(
    calc(var(--mouse-x) * -9px),
    calc(var(--mouse-y) * -7px),
    0
  );
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.scene-background {
  position: absolute;
  inset: -3%;
  width: 106%;
  height: 106%;
  object-fit: cover;
  object-position: 50% 50%;
  animation: backgroundFloat 18s ease-in-out infinite alternate;
  filter: saturate(1.08) contrast(1.02);
}

@keyframes backgroundFloat {
  from {
    transform: scale(1.015) translate3d(-0.4%, 0.3%, 0);
  }
  to {
    transform: scale(1.055) translate3d(0.7%, -0.8%, 0);
  }
}

.background-drift {
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background:
    radial-gradient(circle at 14% 18%, rgba(91, 211, 255, 0.45) 0 1px, transparent 2px),
    radial-gradient(circle at 52% 25%, rgba(255, 255, 255, 0.48) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 42%, rgba(255, 157, 222, 0.48) 0 1px, transparent 2px);
  background-size: 86px 92px, 123px 109px, 151px 137px;
  animation: starDrift 26s linear infinite;
}

@keyframes starDrift {
  to {
    background-position: 86px -92px, -123px -109px, 151px -137px;
  }
}

.nebula-glow {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(100px);
  mix-blend-mode: screen;
  opacity: 0.18;
  animation: nebulaPulse 8s ease-in-out infinite alternate;
}

.nebula-glow-left {
  left: -19vw;
  bottom: -28vw;
  background: #ff5bbf;
}

.nebula-glow-right {
  top: -21vw;
  right: -11vw;
  background: #4b9fff;
  animation-delay: -3s;
}

@keyframes nebulaPulse {
  from {
    opacity: 0.12;
    transform: scale(0.9);
  }
  to {
    opacity: 0.25;
    transform: scale(1.08);
  }
}

.spark-canvas,
.scene-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.spark-canvas {
  z-index: 2;
}

.scene-vignette {
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(3, 13, 53, 0.28), transparent 28%, transparent 72%, rgba(3, 12, 51, 0.18)),
    radial-gradient(circle at center, transparent 46%, rgba(3, 11, 48, 0.3) 112%),
    linear-gradient(180deg, rgba(2, 10, 45, 0.08), transparent 55%, rgba(7, 15, 57, 0.36));
}

.shooting-star {
  position: absolute;
  z-index: 3;
  width: 110px;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95));
  filter: drop-shadow(0 0 5px #8beaff);
  transform: rotate(-24deg);
  animation: shoot 9s ease-in-out infinite;
}

.shooting-star::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -1px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 9px #fff;
}

.shooting-star-one {
  top: 14%;
  left: 18%;
}

.shooting-star-two {
  top: 31%;
  left: 59%;
  animation-delay: -3.5s;
  animation-duration: 12s;
}

.shooting-star-three {
  top: 8%;
  left: 42%;
  animation-delay: -7s;
  animation-duration: 15s;
}

@keyframes shoot {
  0%,
  74% {
    opacity: 0;
    translate: -140px 70px;
  }
  77% {
    opacity: 1;
  }
  86% {
    opacity: 0;
    translate: 240px -115px;
  }
  100% {
    opacity: 0;
  }
}

.brand {
  position: absolute;
  top: clamp(24px, 3.4vw, 48px);
  left: clamp(24px, 3.8vw, 58px);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translate3d(
    calc(var(--mouse-x) * -3px),
    calc(var(--mouse-y) * -2px),
    0
  );
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-orbit,
.login-mark,
.loader-orbit {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(245, 202, 111, 0.76);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(101, 232, 255, 0.28), rgba(13, 74, 123, 0.82) 56%, rgba(7, 20, 65, 0.98) 58%),
    #0a2a68;
  color: #c8f8ff;
  box-shadow:
    0 0 0 5px rgba(244, 197, 111, 0.09),
    inset 0 0 23px rgba(112, 232, 255, 0.55),
    0 0 32px rgba(108, 218, 255, 0.25);
}

.brand-orbit::before,
.login-mark::before,
.loader-orbit::before {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(246, 205, 119, 0.54);
  border-radius: 50%;
  animation: orbitSpin 16s linear infinite;
}

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

.brand-orbit {
  width: 40px;
  height: 40px;
}

.brand-orbit span,
.login-mark span,
.loader-orbit span {
  font-weight: 700;
  letter-spacing: -0.07em;
  text-shadow: 0 0 13px var(--cyan);
}

.brand-orbit span {
  font-size: 14px;
}

.brand-copy {
  display: flex;
  align-items: center;
  padding-top: 3px;
  text-shadow: 0 3px 20px rgba(3, 11, 52, 0.48);
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.system-heading {
  position: absolute;
  top: clamp(76px, 8.4vh, 112px);
  left: 50%;
  z-index: 8;
  width: min(780px, calc(100vw - 360px));
  text-align: center;
  pointer-events: none;
  transform: translateX(-50%);
  text-shadow: 0 8px 34px rgba(2, 10, 52, 0.7);
}

.system-heading h1 {
  margin: 0;
  color: #fff7e4;
  font-family: var(--serif);
  font-size: clamp(40px, 4vw, 68px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0.08em;
  background: linear-gradient(108deg, #ffffff 10%, #dffaff 42%, #f7d49a 69%, #ffcae7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 16px rgba(91, 207, 255, 0.17));
}

.system-heading p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 13px 0 0;
  color: rgba(218, 247, 255, 0.76);
  font-size: clamp(13px, 1.05vw, 17px);
  font-weight: 500;
  letter-spacing: 0.3em;
}

.system-heading p::before,
.system-heading p::after {
  content: "";
  width: clamp(34px, 4vw, 72px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(141, 229, 255, 0.65));
}

.system-heading p::after {
  transform: scaleX(-1);
}

.system-heading p span {
  color: rgba(245, 200, 119, 0.9);
  font-size: 0.72em;
}

.login-shell {
  position: relative;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  pointer-events: none;
}

.login-card {
  --card-base-y: 2.5vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(410px, calc(100vw - 48px));
  padding: 25px clamp(25px, 2.7vw, 34px) 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(116, 133, 222, 0.09) 46%, rgba(11, 28, 89, 0.22)),
    rgba(8, 24, 78, 0.46);
  box-shadow:
    0 28px 90px rgba(3, 11, 55, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(87, 209, 255, 0.09);
  backdrop-filter: blur(30px) saturate(1.25);
  -webkit-backdrop-filter: blur(30px) saturate(1.25);
  pointer-events: auto;
  transform: translate3d(
    calc(var(--mouse-x) * 3px),
    calc(var(--mouse-y) * 2px),
    0
  );
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  animation: cardLift 2.85s cubic-bezier(0.37, 0, 0.22, 1) infinite;
}

@keyframes cardLift {
  0%,
  100% {
    translate: 0 var(--card-base-y);
  }
  10% {
    translate: 0 calc(var(--card-base-y) + 1px);
  }
  43% {
    translate: 0 calc(var(--card-base-y) - 9px);
  }
  72% {
    translate: 0 calc(var(--card-base-y) + 2px);
  }
  84% {
    translate: 0 calc(var(--card-base-y) - 3px);
  }
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 27px;
  pointer-events: none;
}

.login-card::after {
  content: "";
  position: absolute;
  top: -120px;
  left: -80px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(117, 227, 255, 0.1);
  filter: blur(38px);
  pointer-events: none;
}

.card-glint {
  position: absolute;
  top: 0;
  left: 12%;
  width: 42%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #bdf4ff, transparent);
  opacity: 0.86;
  animation: supportGlint 2.85s cubic-bezier(0.37, 0, 0.22, 1) infinite;
}

@keyframes supportGlint {
  0%,
  100% {
    opacity: 0.5;
    filter: drop-shadow(0 0 2px rgba(126, 234, 255, 0.2));
  }
  43% {
    opacity: 1;
    filter: drop-shadow(0 0 12px rgba(126, 234, 255, 0.95));
  }
}

.login-mark {
  z-index: 1;
  width: 62px;
  height: 62px;
  margin-bottom: 22px;
}

.login-mark span {
  font-size: 21px;
}

.login-eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  color: rgba(161, 236, 255, 0.75);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.23em;
}

.login-card h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 43px);
  font-weight: 500;
  letter-spacing: -0.025em;
  text-shadow: 0 3px 24px rgba(10, 18, 76, 0.45);
}

.login-intro {
  position: relative;
  z-index: 1;
  margin: 10px 0 28px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.login-form {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.login-form > label > span {
  display: block;
  margin: 0 0 7px 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.login-form input[type="text"],
.login-form input[type="email"],
.login-form input[type="password"] {
  width: 100%;
  height: 52px;
  padding: 0 17px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(7, 22, 73, 0.3);
  color: #fff;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.login-form input::placeholder {
  color: rgba(255, 255, 255, 0.32);
}

.login-form input:hover,
.login-form input:focus {
  border-color: rgba(124, 229, 255, 0.68);
  background: rgba(9, 29, 88, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 24px rgba(96, 220, 255, 0.1);
  outline: none;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 66px !important;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 15px;
  padding: 4px;
  border: 0;
  background: none;
  color: rgba(205, 245, 255, 0.58);
  font-size: 11px;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-field button:hover {
  color: #fff;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -2px;
  font-size: 11px;
}

.account-actions {
  display: flex;
  align-items: center;
}

.remember-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.57);
  cursor: pointer;
}

.remember-option input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #7edff7;
}

.remember-option span {
  margin: 0;
}

.signup-button {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(177, 237, 255, 0.76);
  cursor: pointer;
}

.signup-button:hover {
  color: #fff;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 9, 42, 0.72);
  backdrop-filter: blur(12px) saturate(1.08);
  -webkit-backdrop-filter: blur(12px) saturate(1.08);
  animation: qrBackdropIn 0.22s ease both;
}

.qr-dialog {
  position: relative;
  width: min(360px, calc(100vw - 40px));
  padding: 28px 28px 25px;
  border: 1px solid rgba(179, 235, 255, 0.38);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(53, 91, 170, 0.42), rgba(7, 23, 75, 0.92)),
    #0a1d59;
  box-shadow:
    0 32px 90px rgba(0, 5, 35, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.17);
  text-align: center;
  animation: qrDialogIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.qr-close-button {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.qr-close-button:hover {
  border-color: rgba(128, 227, 255, 0.56);
  color: #fff;
}

.qr-eyebrow {
  margin: 0 0 7px;
  color: rgba(151, 231, 255, 0.75);
  font-size: 10px;
  letter-spacing: 0.2em;
}

.qr-dialog h2 {
  margin: 0;
  color: #fff8e9;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.qr-image-frame {
  width: min(248px, 72vw);
  margin: 21px auto 16px;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 15px 40px rgba(1, 8, 45, 0.42);
}

.qr-image-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.qr-help {
  margin: 0;
  color: rgba(225, 247, 255, 0.72);
  font-size: 12px;
  letter-spacing: 0.04em;
}

@keyframes qrBackdropIn {
  from {
    opacity: 0;
  }
}

@keyframes qrDialogIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 54px;
  margin-top: 3px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  background: linear-gradient(105deg, #7adcf4 0%, #a59bff 52%, #f295d3 100%);
  color: #071443;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0.1em;
  box-shadow:
    0 15px 34px rgba(68, 68, 170, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  cursor: pointer;
  transition:
    transform 0.25s ease,
    filter 0.25s ease,
    box-shadow 0.25s ease;
}

.submit-button:hover {
  filter: brightness(1.08) saturate(1.1);
  transform: translateY(-2px);
  box-shadow:
    0 20px 42px rgba(68, 68, 170, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.submit-button:active {
  transform: scale(0.985);
}

.submit-button:disabled {
  cursor: wait;
  filter: saturate(0.78) brightness(0.92);
  opacity: 0.8;
}

.error {
  min-height: 16px;
  margin-top: -3px;
  color: #ffc2cf;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

[hidden] {
  display: none !important;
}

.submit-button.is-success {
  background: linear-gradient(105deg, #74e6c0, #79e1e7);
}

.submit-button i {
  font-size: 20px;
  font-style: normal;
  font-weight: 400;
}

.preview-note {
  position: relative;
  z-index: 1;
  display: none;
  max-width: 310px;
  margin: 16px 0 0;
  color: #b8ffe7;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.preview-note.is-visible {
  display: block;
  animation: noteIn 0.45s ease both;
}

@keyframes noteIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mascot-zone {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 6;
  width: clamp(108px, 9.7vw, 160px);
  aspect-ratio: 1022 / 1539;
  pointer-events: none;
  transform: translate3d(80vw, 60vh, 0);
  transform-style: preserve-3d;
  transform-origin: center bottom;
  will-change: transform;
}

.mascot-aura {
  position: absolute;
  top: 18%;
  left: 20%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 196, 122, 0.22), rgba(255, 142, 211, 0.11) 39%, rgba(102, 217, 255, 0.05) 62%, transparent 74%);
  filter: blur(12px);
  mix-blend-mode: screen;
  animation: auraPulse 2.9s ease-in-out infinite;
}

@keyframes auraPulse {
  0%,
  100% {
    opacity: 0.64;
    transform: scale(0.94);
  }
  45% {
    opacity: 1;
    transform: scale(1.07);
  }
}

.mascot-bouncer {
  position: absolute;
  inset: 0;
  transform-origin: center 92%;
  transform-style: preserve-3d;
  animation: mascotBounce 2.85s cubic-bezier(0.37, 0, 0.22, 1) infinite;
}

.mascot-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: perspective(720px) rotateX(var(--runner-tilt, 0deg)) rotateY(var(--turn-y, 0deg)) rotateZ(var(--runner-lean, 0deg));
  transform-origin: center 78%;
  transform-style: preserve-3d;
  filter:
    drop-shadow(0 13px 14px rgba(4, 12, 53, 0.42))
    drop-shadow(-3px -2px 10px rgba(111, 229, 255, 0.2));
  transition: transform 0.14s ease-out, filter 0.2s ease;
}

@keyframes mascotBounce {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale3d(1, 1, 1);
  }
  10% {
    transform: translate3d(0, 7px, 0) rotate(-0.4deg) scale3d(1.018, 0.982, 1);
  }
  28% {
    transform: translate3d(-2px, -18px, 12px) rotate(-1.5deg) scale3d(0.99, 1.014, 1);
  }
  43% {
    transform: translate3d(2px, -31px, 20px) rotate(1.1deg) scale3d(0.997, 1.008, 1);
  }
  58% {
    transform: translate3d(1px, -17px, 10px) rotate(0.5deg) scale3d(1.004, 0.998, 1);
  }
  72% {
    transform: translate3d(0, 8px, 0) rotate(-0.3deg) scale3d(1.025, 0.975, 1);
  }
  84% {
    transform: translate3d(0, -7px, 5px) rotate(0.2deg) scale3d(0.996, 1.008, 1);
  }
}

.mascot-shadow {
  position: absolute;
  left: 29%;
  bottom: 0.7%;
  width: 58%;
  height: 5.8%;
  border-radius: 50%;
  background: rgba(3, 18, 72, 0.56);
  filter: blur(5px);
  transform-origin: center;
  animation: shadowBounce 2.85s cubic-bezier(0.37, 0, 0.22, 1) infinite;
}

@keyframes shadowBounce {
  0%,
  100% {
    opacity: 0.58;
    transform: scaleX(1);
  }
  10%,
  72% {
    opacity: 0.68;
    transform: scaleX(1.08);
  }
  43% {
    opacity: 0.17;
    transform: scaleX(0.52);
  }
  84% {
    opacity: 0.48;
    transform: scaleX(0.88);
  }
}

.staff-energy {
  position: absolute;
  top: 5.7%;
  left: 3.8%;
  z-index: 4;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  mix-blend-mode: screen;
  animation: staffFloat 2.85s cubic-bezier(0.37, 0, 0.22, 1) infinite;
}

@keyframes staffFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  10% {
    transform: translateY(7px);
  }
  43% {
    transform: translateY(-31px);
  }
  72% {
    transform: translateY(8px);
  }
  84% {
    transform: translateY(-7px);
  }
}

.staff-energy::before {
  content: "";
  position: absolute;
  inset: 19%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(178, 249, 255, 0.46), rgba(74, 221, 255, 0.12) 52%, transparent 70%);
  filter: blur(8px);
  animation: energyBreath 1.7s ease-in-out infinite alternate;
}

@keyframes energyBreath {
  to {
    opacity: 0.58;
    transform: scale(1.24);
  }
}

.energy-ring {
  position: absolute;
  border: 1px solid rgba(132, 239, 255, 0.52);
  border-radius: 50%;
}

.energy-ring::before {
  content: "";
  position: absolute;
  top: 48%;
  left: -3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #bdf8ff;
  box-shadow: 0 0 12px #7eeaff;
}

.energy-ring-one {
  inset: 1%;
  animation: orbitSpin 7s linear infinite;
}

.energy-ring-two {
  inset: 10%;
  border-color: rgba(255, 189, 115, 0.58);
  animation: reverseOrbit 9s linear infinite;
}

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

.energy-spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 13px #fff, 0 0 24px #7aeaff;
  animation: sparkBlink 1.5s ease-in-out infinite;
}

.energy-spark-one {
  top: 5%;
  right: 14%;
}

.energy-spark-two {
  left: 4%;
  bottom: 25%;
  animation-delay: -0.7s;
}

@keyframes sparkBlink {
  50% {
    opacity: 0.2;
    transform: scale(0.5);
  }
}

.wukong-three-layer {
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.wukong-three-layer canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  filter: drop-shadow(0 14px 24px rgba(3, 12, 52, 0.28));
  transition: opacity 0.55s ease;
}

.wukong-three-layer.is-ready canvas {
  opacity: 1;
}

.wukong-three-layer.is-fallback::before {
  content: "";
  position: absolute;
  right: clamp(24px, 7vw, 110px);
  bottom: clamp(20px, 6vh, 70px);
  width: clamp(88px, 9vw, 138px);
  aspect-ratio: 1022 / 1539;
  background: url("/ai-wukong-cutout.png") center / contain no-repeat;
  filter: drop-shadow(0 12px 24px rgba(3, 12, 52, 0.36));
}

.wukong-video-layer {
  --wukong-x: 76vw;
  --wukong-y: 68vh;
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.wukong-video-mascot {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(124px, 14vw, 228px);
  aspect-ratio: 3 / 4;
  opacity: 0;
  transform: translate3d(var(--wukong-x), var(--wukong-y), 0)
    translate(-50%, -50%);
  transform-origin: center bottom;
  transition: opacity 0.45s ease;
  will-change: transform;
  contain: layout paint style;
}

.wukong-video-layer.is-ready .wukong-video-mascot {
  opacity: 1;
}

.wukong-action-frame {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: none;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.wukong-action-video,
.wukong-action-fallback {
  display: none;
  background: transparent;
}

.wukong-video-layer.uses-video .wukong-action-video,
.wukong-video-layer.uses-webp .wukong-action-fallback {
  display: block;
}

.wukong-action-idle {
  opacity: 1;
}

.wukong-action-run {
  opacity: 0;
}

.wukong-video-layer.is-running .wukong-action-idle {
  opacity: 0;
}

.wukong-video-layer.is-running .wukong-action-run {
  opacity: 1;
}

@media (max-width: 700px) {
  .wukong-three-layer {
    z-index: 9;
  }

  .wukong-video-layer {
    z-index: 9;
  }

  .wukong-video-mascot {
    width: clamp(120px, 30vw, 156px);
  }
}

.preview-badge {
  position: absolute;
  right: 28px;
  bottom: 22px;
  z-index: 8;
  color: rgba(255, 255, 255, 0.36);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.loading-screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #061448;
  transition:
    opacity 0.8s ease,
    visibility 0.8s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-orbit {
  width: 72px;
  height: 72px;
  animation: loaderPulse 1.7s ease-in-out infinite;
}

.loader-orbit span {
  font-size: 23px;
}

.loading-screen p {
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.54);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
}

@keyframes loaderPulse {
  50% {
    transform: scale(1.08);
    box-shadow:
      0 0 0 10px rgba(244, 197, 111, 0.06),
      inset 0 0 30px rgba(103, 228, 255, 0.6),
      0 0 54px rgba(103, 228, 255, 0.28);
  }
}

@media (max-width: 1180px) {
  .mascot-zone {
    width: clamp(104px, 10.5vw, 140px);
  }

  .login-card {
    width: min(395px, calc(100vw - 48px));
  }

  .system-heading {
    width: min(650px, calc(100vw - 290px));
  }
}

@media (max-width: 900px) {
  .cosmic-stage {
    min-height: 600px;
  }

  .login-shell {
    justify-items: center;
    padding-left: 24px;
  }

  .login-card {
    width: min(390px, calc(100vw - 48px));
  }

  .mascot-zone {
    width: clamp(96px, 12vw, 118px);
  }

  .system-heading {
    top: 82px;
    width: min(560px, calc(100vw - 120px));
  }

  .system-heading h1 {
    font-size: clamp(34px, 5.5vw, 48px);
  }

  .system-heading p {
    font-size: clamp(11px, 1.6vw, 14px);
  }

}

@media (max-width: 720px) {
  html,
  body {
    overflow-y: auto;
  }

  .cosmic-stage {
    min-height: 100svh;
    height: auto;
    overflow: hidden;
  }

  .scene {
    position: fixed;
  }

  .scene-background {
    object-position: 48% 50%;
  }

  .brand {
    top: 22px;
    left: 22px;
  }

  .brand-orbit {
    width: 36px;
    height: 36px;
  }

  .brand-copy strong {
    font-size: 19px;
  }

  .system-heading {
    top: 91px;
    width: calc(100vw - 36px);
  }

  .system-heading h1 {
    font-size: clamp(29px, 8.5vw, 38px);
    letter-spacing: 0.045em;
  }

  .system-heading p {
    gap: 7px;
    margin-top: 9px;
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .system-heading p::before,
  .system-heading p::after {
    width: 24px;
  }

  .login-shell {
    justify-items: center;
    min-height: 100svh;
    padding: 88px 18px 118px;
  }

  .login-card {
    --card-base-y: 1vh;
    width: min(430px, 100%);
    padding: 24px 22px 23px;
  }

  .mascot-zone {
    z-index: 4;
    width: 88px;
    opacity: 0.82;
  }

  .login-shell {
    z-index: 7;
  }

  .preview-badge {
    display: none;
  }

}

@media (max-height: 700px) and (min-width: 721px) {
  .login-card {
    scale: 0.88;
  }

  .mascot-zone {
    width: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .scene,
  .brand,
  .login-card {
    transform: none !important;
  }

}
