.wm-modal {
  display: none;
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  background-color: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  overflow: hidden !important;
  overscroll-behavior: none;
}

.wm-modal.is-open,
.wm-modal[aria-hidden="false"] {
  pointer-events: auto;
}

.wm-modal-content {
  background: #ffffff;
  padding: 30px;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  position: relative;
  animation: wxAuthModalFadeIn 0.3s ease-out;
}

/* 所有彈窗：矮螢幕（手機橫式）不得超出視窗，內容在卡片內捲動 */
.wm-modal-content {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

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

.wm-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
  color: #64748b;
  border: none;
  background: none;
}

#loginModal .wm-modal-content,
#registerModal .wm-modal-content {
  max-width: 400px;
  padding: 20px 18px 18px;
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#loginModal .auth-modal-title,
#registerModal .auth-modal-title {
  margin: 0 0 18px;
  padding-right: 36px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--pos-text-color, #334155);
  text-align: left;
  line-height: 1.15;
}

#loginModal .login-field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
}

#loginModal .login-underline-wrap,
#registerModal .login-underline-wrap {
  margin-bottom: 12px;
}

#loginModal .login-underline-wrap--pwd,
#registerModal .login-underline-wrap--pwd {
  margin-bottom: 0;
}

#registerModal .login-underline-wrap--pwd {
  margin-bottom: 10px;
}

#loginModal .login-underline-wrap:not(.login-underline-wrap--pwd) input,
#registerModal .login-underline-wrap:not(.login-underline-wrap--pwd) input {
  width: 100%;
  box-sizing: border-box;
  border: none !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  border-radius: 0;
  background: transparent !important;
  padding: 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--pos-text-color, #37474f);
  outline: none;
  box-shadow: none !important;
}

#loginModal .password-wrapper,
#registerModal .password-wrapper {
  display: flex;
  align-items: center;
  border-bottom: 1.5px solid #e2e8f0;
}

#loginModal .password-wrapper input,
#registerModal .password-wrapper input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 8px 0;
  font-size: 16px;
  font-weight: 600;
  outline: none;
}

#loginModal .password-wrapper .login-pwd-toggle,
#registerModal .password-wrapper .login-pwd-toggle {
  border: none;
  background: none;
  cursor: pointer;
  color: #64748b;
  padding: 4px;
}

#loginModal .auth-forgot-link {
  display: inline-block;
  margin: 8px 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

#loginModal .auth-modal-switch-row,
#registerModal .auth-modal-switch-row {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

#loginModal .auth-modal-switch-link,
#registerModal .auth-modal-switch-link {
  border: none;
  background: none;
  color: #2563eb;
  font-weight: 800;
  cursor: pointer;
}

#loginModal .auth-modal-social,
#registerModal .auth-modal-social {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

#loginModal .auth-social-link,
#registerModal .auth-social-link {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  overflow: visible;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.22s ease, filter 0.22s ease, box-shadow 0.22s ease;
}

#loginModal .auth-social-link:hover,
#loginModal .auth-social-link:focus-visible,
#registerModal .auth-social-link:hover,
#registerModal .auth-social-link:focus-visible {
  transform: translateY(-2px) scale(1.06);
  filter: brightness(1.05);
  outline: none;
  z-index: 1;
}

#loginModal .auth-social-link svg,
#registerModal .auth-social-link svg {
  display: block;
  flex-shrink: 0;
}

#loginModal .auth-social-link--google,
#registerModal .auth-social-link--google {
  background: #fff;
  border: 1px solid #e2e8f0;
}

#loginModal .auth-social-link--google svg,
#registerModal .auth-social-link--google svg {
  width: 26px;
  height: 26px;
}

#loginModal .auth-social-link--line,
#registerModal .auth-social-link--line {
  background: #00c300;
  border: 1px solid #00b000;
}

#loginModal .auth-social-link--line svg,
#registerModal .auth-social-link--line svg {
  width: 32px;
  height: 32px;
}

#loginModal .auth-line-cta,
#registerModal .auth-line-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 16px;
  padding: 10px 14px;
  box-sizing: border-box;
  border-radius: 10px;
  background: #06c755;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
}

#loginModal .auth-line-cta:hover,
#loginModal .auth-line-cta:focus-visible,
#registerModal .auth-line-cta:hover,
#registerModal .auth-line-cta:focus-visible {
  filter: brightness(0.95);
  outline: none;
}

#loginModal .auth-line-cta__icon,
#registerModal .auth-line-cta__icon {
  display: inline-flex;
  flex: 0 0 auto;
}

#loginModal .auth-line-cta__icon svg,
#registerModal .auth-line-cta__icon svg {
  width: 24px;
  height: 24px;
}

#loginModal .auth-social-link--fb,
#registerModal .auth-social-link--fb {
  background: #1877f2;
  border: none;
}

#loginModal .auth-social-link--fb svg,
#registerModal .auth-social-link--fb svg {
  width: 28px;
  height: 28px;
}

#loginModal .submit-btn,
#registerModal .submit-btn {
  width: 100%;
  box-sizing: border-box;
  background: var(--pos-btn-bg, var(--button-color, #778ca3)) !important;
  color: #fff !important;
  border: none !important;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.22s ease, filter 0.22s ease;
}

#loginModal .submit-btn:hover,
#loginModal .submit-btn:focus-visible,
#registerModal .submit-btn:hover,
#registerModal .submit-btn:focus-visible {
  filter: brightness(1.05);
  transform: translateY(-2px) scale(1.03);
  outline: none;
}

#registerModal .submit-btn {
  margin-top: 18px;
}

#registerModal .wm-modal-content {
  max-height: min(92dvh, 760px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#registerModal .wx-bday-label,
#profileCompleteModal .wx-bday-label,
#profileCompleteModal .wx-bday-label-row .profile-field-label {
  display: inline;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
}

#registerModal .wx-bday-label-row,
#profileCompleteModal .wx-bday-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
}

#registerModal .wx-bday-help,
#profileCompleteModal .wx-bday-help {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

#registerModal .wx-bday-help > summary,
#profileCompleteModal .wx-bday-help > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

#registerModal .wx-bday-help > summary::-webkit-details-marker,
#profileCompleteModal .wx-bday-help > summary::-webkit-details-marker {
  display: none;
}

#registerModal .wx-bday-help__text,
#profileCompleteModal .wx-bday-help__text {
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 6px);
  width: max-content;
  max-width: 220px;
  margin: 0;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  line-height: 1.5;
}

#registerModal .wx-bday-row,
#profileCompleteModal .wx-bday-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

#registerModal .wx-bday-select,
#profileCompleteModal .wx-bday-select {
  flex: 1 1 0;
  min-width: 0;
  box-sizing: border-box;
  border: none;
  border-bottom: 1.5px solid #e2e8f0;
  border-radius: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--pos-text-color, #37474f);
  outline: none;
}

#registerModal .wx-bday-select:focus,
#profileCompleteModal .wx-bday-select:focus {
  border-bottom-color: var(--pos-highlight, #728B7E);
}

#registerModal .wx-bday-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

#profileCompleteModal .profile-complete-gate__panel.wm-modal-content {
  display: flex;
  flex-direction: column;
  width: min(720px, calc(100vw - 32px));
  max-width: 720px;
  max-height: none;
  min-height: 0;
  height: auto;
  padding: 18px 22px 16px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  overflow: visible;
  box-sizing: border-box;
}

#profileCompleteModal .profile-complete-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

#profileCompleteModal .profile-complete-form {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 0;
}

#profileCompleteModal .profile-complete-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 28px;
  align-items: start;
}

#profileCompleteModal .profile-complete-fields .profile-complete-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#profileCompleteModal .profile-complete-fields > .profile-complete-field > .profile-field-label,
#profileCompleteModal .profile-complete-fields .wx-bday-label-row {
  display: flex;
  align-items: center;
  min-height: 22px;
  margin: 0 0 4px;
  padding: 0;
  gap: 6px;
}

#profileCompleteModal .profile-complete-fields .wx-bday-label-row .profile-field-label {
  display: inline;
  margin: 0;
  min-height: 0;
}

#profileCompleteModal .profile-complete-fields .login-underline-wrap,
#profileCompleteModal .profile-pwd-optional .login-underline-wrap,
#profileCompleteModal .password-wrapper {
  margin: 0;
  min-height: 0;
  width: 100%;
}

#profileCompleteModal input,
#profileCompleteModal select {
  margin-bottom: 0;
  letter-spacing: 0;
}

#profileCompleteModal .profile-complete-fields .login-underline-wrap input {
  width: 100%;
  height: 36px;
  padding: 8px 12px;
  font-size: 16px;
  box-sizing: border-box;
  margin: 0;
  border: none;
  border-bottom: 1.5px solid #e2e8f0;
  border-radius: 0;
  background: transparent;
}

#profileCompleteModal .profile-complete-fields .wx-bday-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  min-height: 0;
  width: 100%;
}

#profileCompleteModal .profile-complete-fields .wx-bday-select {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  font-size: 16px;
  font-weight: 600;
  line-height: 36px;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid #e2e8f0;
  border-radius: 0;
  box-sizing: border-box;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

#profileCompleteModal .profile-complete-fields .profile-field-hint {
  display: block;
  margin: 6px 0 0;
  padding: 0;
  line-height: 1.25;
}

#profileCompleteModal .profile-complete-form__foot {
  display: block;
  margin-top: 12px;
}

#profileCompleteModal .profile-modal-kicker,
#profileCompleteModal .auth-modal-title,
#profileCompleteModal .profile-modal-lead,
#profileCompleteModal .profile-nick-inline,
#profileCompleteModal .profile-err {
  flex-shrink: 0;
}

#profileCompleteModal .profile-modal-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #94a3b8;
  text-transform: none;
}

#profileCompleteModal .auth-modal-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #1e293b;
  line-height: 1.2;
}

#profileCompleteModal .profile-modal-lead,
#profileCompleteModal .profile-nick-inline,
#profileCompleteModal .profile-field-hint,
#profileCompleteModal .profile-notify__lead,
#profileCompleteModal .profile-notify-card__meta {
  font-size: 11px;
  line-height: 1.4;
  font-weight: 600;
}

#profileCompleteModal .profile-modal-lead {
  margin: 2px 0 8px;
  color: #9a3412;
}

#profileCompleteModal .profile-nick-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px 10px;
  background: #f8fafc;
  border-radius: 8px;
  color: #64748b;
}

#profileCompleteModal .profile-nick-inline strong {
  color: #334155;
}

#profileCompleteModal .profile-nick-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #eef2f6;
  border-radius: 12px;
  font-size: 14px;
  color: #334155;
  line-height: 1.45;
}

#profileCompleteModal .profile-nick-box__label,
#profileCompleteModal .profile-nick-box__hint {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

#profileCompleteModal .profile-field-label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  margin: 0 0 4px;
  color: #475569;
}

#profileCompleteModal .profile-req {
  color: #dc2626;
  font-weight: 800;
}

#profileCompleteModal .profile-field-hint {
  margin: 2px 0 0;
  color: #9a3412;
}

#profileCompleteModal .login-underline-wrap {
  margin-bottom: 2px;
}

#profileCompleteModal .login-underline-wrap:not(.login-underline-wrap--pwd) input {
  box-sizing: border-box;
  border: none !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  border-radius: 0;
  background: transparent !important;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  outline: none;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}

#profileCompleteModal .login-underline-wrap:not(.login-underline-wrap--pwd) input:focus {
  border-bottom-color: var(--pos-highlight, #728B7E) !important;
  background: transparent !important;
}

#profileCompleteModal .password-wrapper {
  display: flex;
  align-items: center;
  border-bottom: 1.5px solid #e2e8f0;
}

#profileCompleteModal .password-wrapper input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Noto Sans TC', sans-serif;
  letter-spacing: 0;
  outline: none;
}

#profileCompleteModal #profile-password[type="password"],
#profileCompleteModal #profile-password-confirm[type="password"] {
  font-family: 'Noto Sans Mono', monospace;
  letter-spacing: 0;
}

#profileCompleteModal .password-wrapper .login-pwd-toggle {
  border: none;
  background: none;
  cursor: pointer;
  color: #94a3b8;
  padding: 4px;
}

#profileCompleteModal .wx-bday-select:focus {
  border-bottom-color: var(--pos-highlight, #728B7E);
  background: transparent;
}

#profileCompleteModal .profile-err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 700;
}

#profileCompleteModal .profile-err[hidden] {
  display: none !important;
}

#profileCompleteModal .submit-btn {
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  box-sizing: border-box;
  margin-top: 0;
  background: var(--pos-btn-bg, var(--button-color, #728B7E)) !important;
  color: #fff !important;
  border: none !important;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(114, 139, 126, 0.22);
  white-space: nowrap;
}

#profileCompleteModal .submit-btn:hover,
#profileCompleteModal .submit-btn:focus-visible {
  filter: brightness(1.04);
  transform: translateY(-1px);
  outline: none;
}

#profileCompleteModal .profile-pwd-optional {
  margin: 12px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  flex-shrink: 0;
}

#profileCompleteModal .profile-pwd-optional > .profile-field-label {
  margin: 0 0 2px;
}

#profileCompleteModal .profile-pwd-optional > .profile-field-hint {
  margin: 0 0 6px;
  padding: 0;
}

#profileCompleteModal .profile-pwd-optional__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 28px;
}

#profileCompleteModal .profile-pwd-optional .profile-field-label {
  margin-bottom: 4px;
}

#profileCompleteModal .profile-notify {
  margin: 10px 0 0;
}

#profileCompleteModal .profile-notify__title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

#profileCompleteModal .profile-notify__lead {
  margin: 0 0 6px;
  color: #9a3412;
}

#profileCompleteModal .profile-notify__list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

#profileCompleteModal button.profile-notify-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid #e8eef2;
  border-radius: 12px;
  background: #fff;
  color: #1e293b;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

#profileCompleteModal button.profile-notify-card:hover,
#profileCompleteModal button.profile-notify-card:focus-visible {
  border-color: #cbd5e1;
  outline: none;
}

#profileCompleteModal button.profile-notify-card.is-on {
  border-color: #94a3b8;
  background: #f8fafc;
}

#profileCompleteModal button.profile-notify-card.is-done,
#profileCompleteModal button.profile-notify-card:disabled {
  background: #eef2f6;
  border-color: #d0d7de;
  color: #64748b;
  cursor: default;
  pointer-events: none;
}

#profileCompleteModal .profile-notify-card__icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
}

#profileCompleteModal .profile-notify-card--line .profile-notify-card__icon {
  background: #06c755;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  font-family: 'Noto Sans TC', sans-serif;
}
#profileCompleteModal .profile-notify-card--line .profile-notify-card__icon::after {
  content: "LINE";
}

#profileCompleteModal .profile-notify-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

#profileCompleteModal .profile-notify-card__name {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
}

#profileCompleteModal .profile-notify-card__meta {
  display: block;
  margin-top: 1px;
  color: #9a3412;
}

#profileCompleteModal .profile-notify-card__cta {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

#profileCompleteModal button.profile-notify-card:hover .profile-notify-card__cta,
#profileCompleteModal button.profile-notify-card.is-on .profile-notify-card__cta {
  background: #334155;
  border-color: #334155;
  color: #fff;
}

#profileCompleteModal button.profile-notify-card.is-done .profile-notify-card__cta,
#profileCompleteModal button.profile-notify-card:disabled .profile-notify-card__cta,
#profileCompleteModal button.profile-notify-card.is-done:hover .profile-notify-card__cta {
  background: #94a3b8;
  border-color: #94a3b8;
  color: #fff;
}

@media (max-width: 640px) {
  #profileCompleteModal .profile-complete-gate__panel.wm-modal-content {
    width: calc(100vw - 16px);
    max-width: none;
    padding: 14px 14px 12px;
  }
}

@media (max-width: 560px) {
  #profileCompleteModal .profile-complete-fields,
  #profileCompleteModal .profile-notify__list,
  #profileCompleteModal .profile-pwd-optional__fields {
    grid-template-columns: 1fr;
  }
}
