:root {
  --brand: #f60022;
  --brand-hover: #dc001e;
  --ink: #10131a;
  --muted: #6d7789;
  --line: #e3e7ee;
  --font-sans: 'Microsoft YaHei', '微软雅黑', -apple-system, BlinkMacSystemFont,
    'PingFang SC', 'HarmonyOS Sans SC', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.login-page {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  background: #fff url('/custom/assets/login-bg.png') center top / cover no-repeat;
}

.site-header {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: clamp(78px, 8vw, 160px);
  padding: 0 clamp(28px, 2.3vw, 48px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #10131a;
  font-size: clamp(18px, 1.18vw, 24px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.brand img {
  width: clamp(38px, 2.5vw, 50px);
  height: clamp(38px, 2.5vw, 50px);
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: clamp(20px, 2.2vw, 42px);
}

.header-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 36px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #10131a;
  background: transparent;
  font-size: 15px;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease;
}

.header-actions button:hover {
  color: var(--brand);
  background: rgba(255, 255, 255, 0.66);
}

.header-actions svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-login {
  padding: 0 6px !important;
}

.login-panel {
  position: absolute;
  z-index: 3;
  top: calc(50% - 20px);
  left: clamp(72px, 12.25vw, 250px);
  width: clamp(360px, 19.6vw, 400px);
  transform: translateY(-49%);
}

.login-panel h1 {
  margin: 0;
  color: #090c12;
  font-size: clamp(38px, 2.45vw, 50px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0.04em;
}

.auth-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.auth-tabs[hidden] {
  display: none;
}

.auth-tabs > span {
  width: 1px;
  height: 22px;
  background: #d9dee7;
}

.auth-tab {
  position: relative;
  padding: 0 0 8px;
  border: 0;
  color: #9299a7;
  background: transparent;
  font-size: clamp(8.333px, 0.55vw, 11.333px);
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  transition: color 150ms ease, font-size 150ms ease;
}

.auth-tab::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--brand);
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 150ms ease, transform 150ms ease;
}

.auth-tab:hover {
  color: #4d5563;
}

.auth-tab.active {
  color: #090c12;
  font-size: clamp(25px, 1.65vw, 34px);
}

.auth-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.tagline {
  margin: 0 0 34px;
  color: var(--muted);
  font-size: clamp(14px, 0.83vw, 17px);
  font-weight: 600;
  letter-spacing: 0.025em;
}

#loginForm,
#registerForm,
#twoFactorForm {
  display: grid;
  gap: 16px;
}

.register-email-fields {
  display: grid;
  gap: 16px;
}

.register-email-fields[hidden] {
  display: none;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 54px;
  padding: 0 50px 0 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 3px 12px rgba(44, 56, 78, 0.025);
  transition: border-color 160ms ease, box-shadow 160ms ease,
    background-color 160ms ease;
}

.field:focus-within {
  border-color: rgba(246, 0, 34, 0.42);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(246, 0, 34, 0.07);
}

.field > svg {
  position: absolute;
  left: 20px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #202733;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: #222833;
  background: transparent;
  font-size: 14px;
}

.field input::placeholder {
  color: #858d9c;
  opacity: 1;
}

.password-toggle {
  position: absolute;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #717b8d;
  background: transparent;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--brand);
  background: #fff3f5;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .eye-closed,
.password-toggle.is-visible .eye-open {
  display: none;
}

.password-toggle.is-visible .eye-closed {
  display: block;
}

.legal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin: -4px 8px -6px;
  color: var(--muted);
  font-size: 13px;
}

.legal[hidden],
.turnstile[hidden],
#loginView[hidden],
#registerView[hidden],
#twoFactorView[hidden] {
  display: none;
}

.legal label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.legal input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.legal a {
  margin-left: 4px;
  color: var(--brand);
  text-decoration: none;
}

.verification-field {
  padding-right: 114px;
}

.send-code-btn {
  position: absolute;
  right: 8px;
  height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  color: var(--brand);
  background: rgba(246, 0, 34, 0.07);
  font-size: 12px;
  cursor: pointer;
}

.send-code-btn:hover:not(:disabled) {
  background: rgba(246, 0, 34, 0.12);
}

.send-code-btn:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}

.turnstile {
  min-height: 65px;
  margin: -4px auto -6px;
}

.submit-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  margin-top: 4px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 20px rgba(246, 0, 34, 0.17);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease,
    box-shadow 150ms ease;
}

.submit-btn:hover:not(:disabled) {
  background: var(--brand-hover);
  box-shadow: 0 12px 30px rgba(246, 0, 34, 0.25);
  transform: translateY(-1px);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.995);
}

.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.submit-btn.loading span:first-child {
  display: none;
}

.submit-btn.loading .spinner {
  display: block;
}

.login-links {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 19px;
  font-size: 14px;
}

.login-links a,
.backup-toggle,
.back-btn {
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms ease;
}

.login-links a:hover,
.backup-toggle:hover,
.back-btn:hover {
  color: var(--brand);
}

.models {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(-55px, -2.5vw, -40px);
  display: block;
  width: min(56vw, 1135px);
  height: auto;
  transform: translateX(-45%);
  pointer-events: none;
  user-select: none;
}

.scene-labels {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.scene-labels span {
  position: absolute;
  color: #fff;
  font-size: clamp(17px, 1.55vw, 31px);
  font-weight: 400;
}

.primary-label {
  top: 31.3%;
  left: 50.1%;
  transform: rotate(28deg);
}

.secondary-label {
  top: 39.5%;
  left: 46.8%;
  opacity: 0.76;
  transform: rotate(28deg);
}

.site-footer {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(28px, 2.3vw, 48px) 26px;
  color: #6d7789;
  font-size: clamp(12px, 0.7vw, 14px);
}

.site-footer a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.back-btn,
.backup-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
  font-size: 14px;
}

.back-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.backup-toggle {
  display: block;
  margin: 22px auto 0;
  font-size: 14px;
}

.toast {
  position: fixed;
  z-index: 20;
  top: 86px;
  left: 50%;
  max-width: min(90vw, 520px);
  padding: 12px 22px;
  border: 1px solid #f0d8dc;
  border-radius: 10px;
  color: #7a1424;
  background: rgba(255, 247, 248, 0.96);
  box-shadow: 0 10px 30px rgba(45, 32, 36, 0.12);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.success {
  border-color: #cde9da;
  color: #17623a;
  background: rgba(244, 253, 248, 0.97);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

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

  .login-page {
    min-height: 100svh;
    background-position: 58% top;
  }

  .login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(3px);
  }

  .login-panel {
    top: calc(var(--nav-headroom, 64px) + 48px);
    left: 50%;
    width: min(84vw, 400px);
    padding: 26px;
    border: 1px solid rgba(226, 230, 237, 0.8);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 20px 60px rgba(30, 43, 68, 0.1);
    transform: translateX(-50%);
  }

  .models {
    display: none;
  }

  .scene-labels {
    display: none;
  }

  .site-footer {
    position: fixed;
    padding-bottom: 14px;
  }
}

@media (max-width: 520px) {
  .login-page {
    min-height: 680px;
  }

  .login-panel {
    top: calc(var(--nav-headroom, 58px) + 25px);
    width: calc(100vw - 44px);
    padding: 24px 18px;
  }

  .login-panel h1 {
    font-size: 30px;
  }

  .auth-tabs {
    margin-bottom: 14px;
  }

  .auth-tab {
    font-size: 8.333px;
  }

  .auth-tab.active {
    font-size: 25px;
  }

  .tagline {
    margin: 0 0 24px;
    font-size: 12px;
  }

  #loginForm,
  #registerForm,
  #twoFactorForm {
    gap: 14px;
  }

  .field,
  .submit-btn {
    height: 50px;
  }

  .login-links {
    margin-top: 16px;
    font-size: 13px;
  }

  .site-header {
    padding: 0 18px;
  }

  .brand {
    gap: 7px;
  }

  .header-actions {
    gap: 7px;
  }

  .site-footer {
    flex-direction: column;
    gap: 2px;
    padding: 0 12px 8px;
    font-size: 10px;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  .login-panel {
    transform: translateY(-45%);
  }

  .login-panel h1 {
    font-size: 38px;
  }

  .tagline {
    margin: 14px 0 24px;
  }

  #loginForm {
    gap: 14px;
  }

  .field,
  .submit-btn {
    height: 54px;
  }

  .login-links {
    margin-top: 16px;
  }

  .models {
    bottom: -110px;
  }
}

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