:root {
  --home-bg-image: url("https://zhangjunjie.aiqianyanliuliang.com/assets/releases/20260730-f4c99cb5/home-bg.png.webp");
  --login-night: #06101f;
  --login-surface: #0b1930;
  --login-paper: #f4e9c9;
  --login-paper-dim: #b9b29f;
  --login-placeholder: rgba(205, 199, 181, 0.68);
  --login-brass: #c59a4c;
  --login-brass-light: #efd58d;
  --login-crystal: #77c9e8;
  --login-danger: #e98575;
  --login-success: #9cd7c4;
  --login-line: rgba(219, 184, 109, 0.32);
  --login-shadow: rgba(0, 0, 0, 0.58);
}

@media (max-width: 760px), (max-height: 760px) {
  :root {
    --home-bg-image: url("https://zhangjunjie.aiqianyanliuliang.com/assets/releases/20260730-f4c99cb5/home-bg.png.mobile.webp");
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
  color: var(--login-paper);
  background: var(--login-night);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

.login-viewport {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100dvh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  background: var(--login-night);
}

.login-viewport::before {
  position: absolute;
  inset: -3%;
  z-index: 0;
  content: "";
  background:
    linear-gradient(rgba(4, 12, 27, 0.54), rgba(4, 12, 27, 0.54)),
    var(--home-bg-image) center / cover;
  filter: blur(15px) saturate(0.9);
  transform: scale(1.06);
}

.login-stage {
  position: relative;
  z-index: 1;
  width: min(100vw, 150.24dvh);
  aspect-ratio: 1537 / 1023;
  overflow: hidden;
  isolation: isolate;
  background: var(--login-night);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.54);
}

@media (max-aspect-ratio: 1537 / 1023) {
  .login-stage {
    width: auto;
    height: 100dvh;
  }
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: -4;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.94) contrast(1.02) brightness(0.82);
}

.login-stage::before {
  position: absolute;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(1, 6, 16, 0.04) 0 42%, rgba(1, 6, 16, 0.46) 69%, rgba(1, 6, 16, 0.8)),
    linear-gradient(180deg, rgba(1, 6, 16, 0.12), transparent 35%, rgba(1, 6, 16, 0.22));
}

.login-stage::after {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  content: "";
  box-shadow: inset 0 0 72px rgba(0, 0, 0, 0.46);
}

.login-back-button {
  position: absolute;
  top: max(4.5%, env(safe-area-inset-top));
  right: max(3.3%, env(safe-area-inset-right));
  left: auto;
  z-index: 40;
  display: block;
  width: clamp(42px, 4.8%, 66px);
  cursor: pointer;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.42));
  transition: filter 180ms ease, opacity 180ms ease;
}

.login-back-button:hover {
  filter: brightness(1.12) drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5));
}

.login-back-button:focus-visible,
.login-submit:focus-visible,
.login-field input:focus-visible {
  outline: 2px solid var(--login-crystal);
  outline-offset: 3px;
}

.login-back-button img {
  display: block;
  width: 100%;
  height: auto;
}

.login-title {
  position: absolute;
  top: 5.2%;
  left: 11.5%;
  z-index: 5;
  width: min(42%, 650px);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.58));
  animation: login-title-enter 620ms ease-out both;
}

.login-hero,
.login-cat {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 20px 20px rgba(0, 0, 0, 0.44));
  animation: login-character-enter 640ms 80ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.login-hero-boy {
  left: 7.5%;
  bottom: -4.5%;
  width: 27%;
}

.login-hero-girl {
  left: 29%;
  bottom: -4.5%;
  width: 25.5%;
  animation-delay: 130ms;
}

.login-cat {
  left: 49.5%;
  bottom: -0.5%;
  z-index: 3;
  width: 10.5%;
  animation-delay: 180ms;
}

.login-pass {
  position: absolute;
  top: 8.5%;
  right: 4.3%;
  bottom: 7.5%;
  z-index: 20;
  display: flex;
  width: 35.5%;
  min-width: 340px;
  flex-direction: column;
  padding: clamp(50px, 5.1%, 76px) clamp(30px, 3.5%, 54px) 28px clamp(58px, 4.8%, 74px);
  color: var(--login-paper);
  background:
    linear-gradient(90deg, rgba(197, 154, 76, 0.13) 0 1px, transparent 1px) 45px 0 / 1px 100% no-repeat,
    linear-gradient(150deg, rgba(255, 255, 255, 0.045), transparent 32%),
    linear-gradient(180deg, rgba(10, 26, 49, 0.97), rgba(5, 15, 31, 0.985));
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
  box-shadow: 0 24px 55px var(--login-shadow);
  animation: login-pass-enter 650ms 90ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.login-pass::before {
  position: absolute;
  inset: 7px;
  z-index: -1;
  pointer-events: none;
  border: 1px solid var(--login-line);
  content: "";
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
}

.login-pass-spine {
  position: absolute;
  top: 8.5%;
  bottom: 8.5%;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(239, 213, 141, 0.62);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

.login-pass-spine::before,
.login-pass-spine::after {
  width: 1px;
  flex: 1;
  background: var(--login-line);
  content: "";
}

.login-pass-spine b {
  color: var(--login-brass-light);
  font-size: 0.72rem;
  font-weight: 400;
}

.login-heading {
  margin: 0;
}

.login-heading p {
  margin: 0 0 6px;
  color: var(--login-brass-light);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.7rem, 0.8vw, 0.92rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-heading h1 {
  margin: 0;
  color: var(--login-paper);
  font-family: "Songti SC", SimSun, serif;
  font-size: clamp(2rem, 2.8vw, 3.2rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.login-heading-rule {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0 clamp(20px, 3.1vh, 34px);
  color: rgba(197, 154, 76, 0.66);
}

.login-heading-rule::before,
.login-heading-rule::after {
  height: 1px;
  background: var(--login-line);
  content: "";
}

.login-heading-rule::before {
  width: 30px;
}

.login-heading-rule::after {
  flex: 1;
}

.login-heading-rule i {
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}

.login-form {
  display: grid;
  min-height: 0;
  flex: 1;
  align-content: start;
  gap: clamp(13px, 1.8vh, 20px);
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--login-paper-dim);
  font-size: clamp(0.82rem, 0.9vw, 1rem);
  font-weight: 600;
  line-height: 1.2;
}

.login-field-label svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--login-brass-light);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.login-field input {
  width: 100%;
  height: clamp(48px, 5.9vh, 58px);
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid rgba(239, 213, 141, 0.38);
  border-radius: 0;
  outline: 0;
  color: var(--login-paper);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.035), transparent);
  font-size: clamp(0.92rem, 1vw, 1.08rem);
  font-weight: 600;
  letter-spacing: 0;
  caret-color: var(--login-crystal);
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.login-field input::placeholder {
  color: var(--login-placeholder);
  font-weight: 500;
  opacity: 1;
}

.login-field input:hover {
  border-color: rgba(239, 213, 141, 0.58);
}

.login-field input:focus {
  border-color: var(--login-crystal);
  background-color: rgba(119, 201, 232, 0.035);
  box-shadow: 0 8px 18px -14px rgba(119, 201, 232, 0.9);
}

.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus,
.login-field input:autofill {
  -webkit-text-fill-color: var(--login-paper);
  box-shadow: 0 0 0 1000px #0a1930 inset;
  caret-color: var(--login-crystal);
}

.login-message {
  min-height: 2.8em;
  margin: -3px 0 -5px;
  color: var(--login-paper-dim);
  font-size: clamp(0.78rem, 0.82vw, 0.9rem);
  font-weight: 600;
  line-height: 1.4;
}

.login-message.is-error {
  color: var(--login-danger);
}

.login-message.is-success {
  color: var(--login-success);
}

.login-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(10px, 1vw, 15px);
  align-items: center;
}

.login-submit {
  display: flex;
  width: 100%;
  min-width: 0;
  height: clamp(50px, 6.2vh, 64px);
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 1.5vw, 22px);
  overflow: hidden;
  border: 1px solid rgba(239, 213, 141, 0.78);
  border-radius: 3px;
  color: #241a08;
  background: linear-gradient(180deg, #f0d58d, #c49743);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.55), 0 10px 22px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  font-size: clamp(0.98rem, 1.08vw, 1.18rem);
  font-weight: 800;
  letter-spacing: 0;
  transition: background-color 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.login-submit:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.62), 0 12px 26px rgba(0, 0, 0, 0.3);
}

.login-submit:active:not(:disabled) {
  filter: brightness(0.96);
  box-shadow: inset 0 2px 5px rgba(70, 40, 0, 0.22), 0 7px 16px rgba(0, 0, 0, 0.26);
}

.login-submit:disabled {
  cursor: wait;
  filter: saturate(0.52) brightness(0.8);
}

.login-submit svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.login-action-copy {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-pass-seal {
  display: grid;
  width: clamp(50px, 4.5vw, 66px);
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgba(119, 201, 232, 0.52);
  border-radius: 50%;
  background: rgba(6, 16, 31, 0.86);
  box-shadow: inset 0 0 0 4px rgba(6, 16, 31, 0.8), 0 0 20px rgba(119, 201, 232, 0.14);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.login-pass-seal i {
  width: 31%;
  aspect-ratio: 1;
  border: 1px solid var(--login-crystal);
  box-shadow: 0 0 8px rgba(119, 201, 232, 0.38);
  transform: rotate(45deg);
}

.login-save-note {
  margin: -2px 0 0;
  color: rgba(185, 178, 159, 0.62);
  font-size: clamp(0.68rem, 0.7vw, 0.78rem);
  line-height: 1.5;
}

.login-pass.is-error .login-field input[aria-invalid="true"] {
  border-color: var(--login-danger);
  background-color: rgba(233, 133, 117, 0.045);
}

.login-pass.is-success {
  box-shadow: 0 24px 55px var(--login-shadow), 0 0 30px rgba(119, 201, 232, 0.18);
}

.login-pass.is-success .login-pass-seal {
  border-color: var(--login-success);
  box-shadow: inset 0 0 0 4px rgba(6, 16, 31, 0.8), 0 0 22px rgba(156, 215, 196, 0.35);
}

.login-pass.is-loading .login-pass-seal i {
  animation: login-seal-pulse 900ms ease-in-out infinite;
}

@keyframes login-title-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes login-character-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes login-pass-enter {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes login-pass-enter-mobile {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes login-seal-pulse {
  50% {
    opacity: 0.66;
    box-shadow: 0 0 14px rgba(119, 201, 232, 0.72);
  }
}

@media (max-width: 1180px), (max-height: 760px) {
  .login-title {
    top: 4.5%;
    width: 39%;
  }

  .login-hero-boy {
    left: 6%;
    width: 25.5%;
  }

  .login-hero-girl {
    left: 27%;
    width: 24%;
  }

  .login-cat {
    left: 46.5%;
    width: 10%;
  }

  .login-pass {
    top: 5%;
    right: 3.5%;
    bottom: 5%;
    width: 38%;
    padding: 38px 28px 22px 56px;
  }

  .login-heading-rule {
    margin-bottom: 18px;
  }

  .login-form {
    gap: 11px;
  }

  .login-message {
    min-height: 2.5em;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  html,
  body,
  .game-viewport-ready,
  .game-viewport-ready body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  .login-viewport,
  .game-viewport-ready .login-viewport {
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh;
    max-height: none;
    place-items: start stretch;
    overflow: visible;
  }

  .login-viewport::before {
    display: none;
  }

  .login-stage,
  .game-viewport-ready .login-stage {
    width: 100% !important;
    height: max(100dvh, 740px) !important;
    min-height: max(100dvh, 740px);
    aspect-ratio: auto;
    overflow: hidden;
    box-shadow: none;
  }

  .login-bg {
    object-position: 43% center;
  }

  .login-stage::before {
    background: linear-gradient(180deg, rgba(1, 6, 16, 0.02) 0 36%, rgba(1, 6, 16, 0.38) 54%, rgba(1, 6, 16, 0.9) 100%);
  }

  .login-stage::after {
    box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.34);
  }

  .login-back-button {
    top: max(18px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    left: auto;
    width: 42px;
  }

  .login-title {
    top: max(7%, calc(56px + env(safe-area-inset-top)));
    left: 50%;
    width: min(76%, 390px);
    transform: translateX(-50%);
  }

  .login-hero-boy {
    left: -7%;
    bottom: 44.5%;
    width: 55%;
  }

  .login-hero-girl {
    left: 34%;
    bottom: 44.5%;
    width: 53%;
  }

  .login-cat {
    left: 72%;
    bottom: 45.5%;
    width: 23%;
  }

  .login-pass {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    min-width: 0;
    min-height: 46.5%;
    padding: 44px 8% max(22px, env(safe-area-inset-bottom));
    clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%, 0 18px);
    box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.4);
    animation-name: login-pass-enter-mobile;
  }

  .login-pass::before {
    bottom: max(7px, env(safe-area-inset-bottom));
    clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%, 0 12px);
  }

  .login-pass-spine {
    display: none;
  }

  .login-heading p {
    font-size: 0.65rem;
  }

  .login-heading h1 {
    font-size: clamp(1.9rem, 8vw, 2.45rem);
  }

  .login-heading-rule {
    margin: 9px 0 16px;
  }

  .login-form {
    gap: 10px;
  }

  .login-field {
    gap: 4px;
  }

  .login-field-label {
    font-size: 0.78rem;
  }

  .login-field input {
    height: 45px;
    font-size: 0.9rem;
  }

  .login-message {
    min-height: 2.5em;
    font-size: 0.76rem;
  }

  .login-submit {
    height: 48px;
    font-size: 0.95rem;
  }

  .login-pass-seal {
    width: 48px;
  }

  .login-save-note {
    display: none;
  }
}

@media (max-width: 360px) and (orientation: portrait) {
  .login-stage,
  .game-viewport-ready .login-stage {
    height: max(100dvh, 720px) !important;
    min-height: max(100dvh, 720px);
  }

  .login-title {
    width: 80%;
  }

  .login-pass {
    padding-right: 7%;
    padding-left: 7%;
  }

  .login-heading h1 {
    font-size: 1.8rem;
  }

  .login-actions {
    gap: 9px;
  }

  .login-submit {
    padding: 0 14px;
    font-size: 0.88rem;
  }

  .login-pass-seal {
    width: 46px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .login-stage {
    width: 100vw;
    height: auto;
  }

  .login-title {
    top: 3%;
    left: 13%;
    width: 35%;
  }

  .login-hero-boy {
    left: 5%;
    width: 23%;
  }

  .login-hero-girl {
    left: 23%;
    width: 22%;
  }

  .login-cat {
    left: 40%;
    width: 9%;
  }

  .login-pass {
    top: 3.5%;
    right: max(2.5%, env(safe-area-inset-right));
    bottom: 3.5%;
    width: 41%;
    min-width: 0;
    padding: 24px 22px 16px 48px;
  }

  .login-pass-spine {
    left: 17px;
    font-size: 0.48rem;
  }

  .login-heading p {
    display: none;
  }

  .login-heading h1 {
    font-size: clamp(1.35rem, 4.8vmin, 2rem);
  }

  .login-heading-rule {
    margin: 6px 0 8px;
  }

  .login-form {
    gap: 6px;
  }

  .login-field {
    gap: 3px;
  }

  .login-field-label {
    font-size: clamp(0.58rem, 2.1vmin, 0.76rem);
  }

  .login-field-label svg {
    width: 12px;
    height: 12px;
  }

  .login-field input {
    height: clamp(32px, 8.5vmin, 40px);
    font-size: clamp(0.66rem, 2.3vmin, 0.84rem);
  }

  .login-message {
    min-height: 1.5em;
    margin: -2px 0;
    font-size: clamp(0.58rem, 2vmin, 0.72rem);
    line-height: 1.25;
  }

  .login-submit {
    height: clamp(34px, 9vmin, 42px);
    font-size: clamp(0.68rem, 2.4vmin, 0.88rem);
  }

  .login-submit svg {
    width: 15px;
    height: 15px;
  }

  .login-pass-seal {
    width: clamp(34px, 9vmin, 42px);
  }

  .login-save-note {
    display: none;
  }
}

@supports not (height: 100dvh) {
  .login-viewport {
    height: 100vh;
  }

  @media (max-width: 760px) and (orientation: portrait) {
    .login-viewport,
    .game-viewport-ready .login-viewport {
      min-height: 100vh;
    }

    .login-stage,
    .game-viewport-ready .login-stage {
      height: max(100vh, 740px) !important;
      min-height: max(100vh, 740px);
    }
  }
}

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