.login-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 16, 32, 0.58);
  backdrop-filter: blur(6px);
}

.login-popup-overlay.is-open {
  display: flex;
  animation: loginPopupFadeIn 0.24s ease-out both;
}

body.login-popup-open {
  overflow: hidden;
}

.login-popup {
  position: relative;
  width: min(100%, 480px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 36px 24px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 30px 78px rgba(14, 37, 69, 0.18);
  backdrop-filter: blur(16px);
  color: #8b95a8;
  transform: scale(0.96);
}

.login-popup::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 1px solid rgba(10, 99, 230, 0.06);
  border-radius: inherit;
  pointer-events: none;
}

.login-popup-overlay.is-open .login-popup {
  animation: loginPopupZoomIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8b95a8;
  cursor: pointer;
  font-size: 0;
  line-height: 0;
  transition: none;
}

.login-popup__close::before,
.login-popup__close::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 1.5px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
}

.login-popup__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.login-popup__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.login-popup__close:hover,
.login-popup__close:focus-visible {
  background: rgba(12, 24, 44, 0.06);
  color: #1b2c50;
  outline: none;
}

.login-popup__title {
  display: block;
  margin: 0;
  color: #1b2c50;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

.login-popup__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.login-popup__field {
  display: grid;
  gap: 8px;
}

.login-popup__field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}

.login-popup__field label,
.login-popup__field-label {
  color: #1b2c50;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
}

.login-popup__field label::before {
  color: #ff3b30;
  content: '*';
}

.login-popup__field-label::before {
  content: '';
}

.login-popup__error {
  color: #ff4d4f;
  font-size: 13px;
  line-height: 1.4;
}

.login-popup__input,
.login-popup__field input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(12, 24, 44, 0.1);
  border-radius: 16px;
  background: #ffffff;
  color: #1b2c50;
  font-size: 14px;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(14, 37, 69, 0.04);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.login-popup__field input::placeholder {
  color: #9ca8ba;
}

.login-popup__field input:hover {
  background: #ffffff;
}

.login-popup__field input:hover:not(:focus) {
  border-color: rgba(12, 24, 44, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 22px rgba(14, 37, 69, 0.08);
  transform: none;
  transition: none;
}

.login-popup__field input:focus {
  background: #ffffff;
  border-color: rgba(10, 99, 230, 0.42);
  box-shadow:
    0 0 0 4px rgba(10, 99, 230, 0.1),
    0 14px 28px rgba(10, 99, 230, 0.08);
  transform: translateY(-1px);
}

.login-popup__field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
}

.login-popup__code-button {
  height: 48px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #0a63e6, #064bd6);
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 18px 34px rgba(10, 99, 230, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.login-popup__code-button:hover,
.login-popup__code-button:focus-visible {
  box-shadow:
    0 22px 38px rgba(10, 99, 230, 0.26),
    0 0 0 1px rgba(255, 255, 255, 0.16) inset;
  filter: saturate(1.04);
  outline: none;
  transform: translateY(-1px);
}

.login-popup__code-button:disabled {
  border: 1px solid rgba(12, 24, 44, 0.1);
  background: #f5f8fd;
  color: #9ca8ba;
  cursor: not-allowed;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(14, 37, 69, 0.04);
  transform: none;
}

.login-popup__agreement {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: #4d5d78;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.5;
}

.login-popup__agreement input {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #2d5aff;
}

.login-popup__agreement-bubble {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 2;
  min-width: 136px;
  padding: 8px 12px;
  border: 1px solid rgba(208, 51, 51, 0.18);
  border-radius: 10px;
  background: #ffffff;
  color: #d03333;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
  box-shadow:
    0 14px 30px rgba(14, 37, 69, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.68) inset;
}

.login-popup__agreement-bubble[hidden] {
  display: none;
}

.login-popup__agreement-bubble::after {
  position: absolute;
  left: 18px;
  bottom: -5px;
  width: 8px;
  height: 8px;
  border-right: 1px solid rgba(208, 51, 51, 0.18);
  border-bottom: 1px solid rgba(208, 51, 51, 0.18);
  background: #ffffff;
  content: '';
  transform: rotate(45deg);
}

.login-popup__agreement a {
  color: #2254f5;
  text-decoration: none;
}

.login-popup__agreement a:hover,
.login-popup__agreement a:focus-visible {
  text-decoration: underline;
}

.login-popup__message {
  position: absolute;
  left: 50%;
  bottom: 280px;
  z-index: 2;
  min-width: 136px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(208, 51, 51, 0.18);
  border-radius: 10px;
  background: #ffffff;
  color: #d03333;
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
  box-shadow:
    0 14px 30px rgba(14, 37, 69, 0.13),
    0 0 0 1px rgba(255, 255, 255, 0.68) inset;
  transform: translateX(-50%);
}

.login-popup__message:empty {
  display: none;
}

.login-popup__message[data-state='success'] {
  border-color: rgba(18, 128, 92, 0.18);
  color: #12805c;
}

.login-popup__submit {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #0a63e6, #064bd6);
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  line-height: 20px;
  box-shadow: 0 18px 34px rgba(10, 99, 230, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.login-popup__submit:hover,
.login-popup__submit:focus-visible {
  box-shadow:
    0 22px 38px rgba(10, 99, 230, 0.26),
    0 0 0 1px rgba(255, 255, 255, 0.16) inset;
  filter: saturate(1.04);
  outline: none;
  transform: translateY(-1px);
}

.login-popup__submit:disabled {
  filter: grayscale(0.15) saturate(0.82);
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
}

.login-popup [data-wechat-login][data-wechat-inline] {
  margin-top: 40px;
}

.login-popup__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  margin: 0 auto 12px;
  color: #70809a;
  font-size: 14px;
  line-height: 22px;
  text-align: center;
}

.login-popup__divider::before,
.login-popup__divider::after {
  flex: 0 0 40px;
  width: 40px;
  height: 1px;
  background: rgba(12, 24, 44, 0.1);
  content: '';
}

.login-popup__wechat-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0 auto 0;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #07c160;
  cursor: pointer;
  transition: none;
}

.login-popup__wechat-button:hover,
.login-popup__wechat-button:focus-visible {
  background: #07c160;
  box-shadow: 0 4px 10px rgba(7, 193, 96, 0.18);
  color: #ffffff;
  outline: none;
}

.login-popup__wechat-button::before {
  content: '';
  width: 20px;
  height: 20px;
  background: currentColor;
  mask: url("/assets/images/site-icon/wechat-icon.svg?t=20260617235211") center / contain no-repeat;
}

.login-popup__wechat-button img {
  display: none;
  pointer-events: none;
}

.login-popup .auth-wechat-modal[hidden] {
  display: none;
}

.login-popup .auth-wechat-modal {
  display: block;
  margin-top: 18px;
  text-align: center;
}

.login-popup .auth-wechat-modal__dialog {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: fit-content;
  padding: 24px 0 0;
  height: fit-content;
}

.login-popup .auth-wechat-modal__header strong {
  color: #1b2c50;
  font-size: 18px;
  font-weight: 700;
  line-height: 26px;
}

.login-popup .auth-wechat-modal__qr {
  position: relative;
  display: grid;
  place-items: center;
  width: max-content;
  min-width: 160px;
  height: 160px;
  margin: 0 auto;
  border: 1px solid rgba(12, 24, 44, 0.08);
  border-radius: 24px;
  background: #ffffff;
}

.login-popup .auth-wechat-modal__qr img {
  display: none;
  width: 134px;
  height: 134px;
}

.login-popup .auth-wechat-modal__qr.is-ready img {
  display: block;
}

.login-popup .auth-wechat-modal__qr.is-ready span {
  display: none;
}

.login-popup .auth-wechat-modal__qr span {
  color: #70809a;
  font-size: 13px;
}

.login-popup .auth-wechat-modal__tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  min-width: 146px;
  margin: 0 auto 0;
  padding-left: 22px;
  color: #70809a;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  white-space: nowrap;
}

.login-popup .auth-wechat-modal__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 16px;
}

.login-popup .auth-wechat-modal__close,
.login-popup .auth-wechat-modal__refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #8b95a8;
  cursor: pointer;
  font-size: 14px;
  line-height: 22px;
}

.login-popup .auth-wechat-modal__close {
  position: static;
  color: #0a63e6;
  margin: 0 auto;
}

.login-popup .auth-wechat-modal__refresh svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.login-popup .auth-wechat-modal__refresh span {
  display: none;
}

.login-popup .auth-wechat-modal__refresh:hover,
.login-popup .auth-wechat-modal__refresh:focus-visible {
  color: #0a63e6;
}

.login-popup .auth-wechat-modal__close:hover,
.login-popup .auth-wechat-modal__close:focus-visible,
.login-popup .auth-wechat-modal__refresh:hover,
.login-popup .auth-wechat-modal__refresh:focus-visible {
  outline: none;
  text-decoration: underline;
}

.login-popup .auth-wechat-modal__refresh:disabled {
  color: #8b95a8;
  cursor: not-allowed;
}

@keyframes loginPopupFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes loginPopupZoomIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media screen and (max-width: 640px) {
  .login-popup-overlay {
    padding: 16px;
  }

  .login-popup {
    padding: 44px 22px 30px;
  }

  .login-popup__title {
    font-size: 20px;
  }

  .login-popup__field-row {
    grid-template-columns: 1fr;
  }

  .login-popup__code-button {
    width: 100%;
  }
}
