.pay-page {
  min-height: 100vh;
  background: #f3f6fa;
}

.pay-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
}

.pay-auth-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 10px;
}

.pay-auth-account {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.pay-auth-account strong {
  color: var(--ink);
}

.pay-auth-account:hover strong {
  color: var(--green-strong);
}

.pay-auth-button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-strong);
  background: var(--surface);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
}

.pay-auth-button.primary {
  display: inline-flex;
  align-items: center;
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.home-auth-slot {
  margin-left: auto;
}

.home-auth-slot .pay-auth-button.primary {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.94rem;
  font-weight: 650;
}

.home-auth-slot .pay-auth-button.primary:hover,
.home-auth-slot .pay-auth-button.primary:focus-visible {
  color: var(--green-strong);
  background: transparent;
}

body.pay-modal-open {
  overflow: hidden;
}

.pay-login-modal[hidden] {
  display: none;
}

.pay-login-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.pay-login-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(12, 30, 54, 0.52);
  cursor: default;
}

body:not(.pay-page) .pay-login-backdrop {
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.9), transparent 32%),
    rgba(229, 238, 251, 0.96);
  backdrop-filter: blur(8px);
}

.pay-login-dialog {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(12, 36, 68, 0.24);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.pay-login-modal.open .pay-login-dialog {
  opacity: 1;
  transform: translateY(0);
}

.pay-login-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 8px;
}

.pay-login-dialog-header h2 {
  margin: 3px 0 0;
  font-size: 1.8rem;
}

.pay-login-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.pay-login-close:hover {
  color: var(--ink);
  border-color: #b8cbe0;
}

.pay-login-intro {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.65;
}

.pay-login-terms {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 0.82rem;
  line-height: 1.6;
  text-align: center;
}

.pay-login-terms a {
  color: var(--green-strong);
  font-weight: 750;
}

.pay-hero {
  padding: 54px 0 38px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
}

.pay-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: center;
  gap: 40px;
}

.pay-hero h1 {
  max-width: 760px;
  font-size: clamp(2.35rem, 5vw, 4.2rem);
}

.pay-hero-compact {
  padding: 44px 0 32px;
}

.pay-hero-compact h1 {
  margin-bottom: 12px;
  font-size: clamp(2.35rem, 4.5vw, 3.7rem);
}

.pay-plan-section {
  padding-top: 46px;
}

.pay-after-note {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pay-summary {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.pay-summary h2 {
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.pay-summary dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.pay-summary dl div {
  display: grid;
  gap: 3px;
}

.pay-summary dt {
  color: var(--faint);
  font-size: 0.82rem;
  font-weight: 800;
}

.pay-summary dd {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
}

.pay-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.pay-product-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
}

.pay-product-card.recommended {
  border-color: rgba(59, 130, 246, 0.38);
  box-shadow: inset 0 3px 0 var(--green), 0 16px 36px rgba(15, 23, 42, 0.07);
}

.pay-product-card h2 {
  margin-bottom: 6px;
  font-size: 1.65rem;
}

.pay-product-card p {
  color: var(--muted);
}

.pay-price {
  margin: 8px 0 18px;
  color: var(--green-strong);
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}

.pay-benefits {
  display: grid;
  gap: 9px;
  margin: 0 0 22px;
  padding: 0;
  color: var(--muted);
  list-style: none;
}

.pay-benefits li {
  position: relative;
  padding-left: 22px;
}

.pay-benefits li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 1px;
  width: 11px;
  height: 7px;
  border-bottom: 3px solid var(--green);
  border-left: 3px solid var(--green);
  transform: rotate(-45deg);
}

.pay-product-card .button {
  width: fit-content;
  margin-top: auto;
}

.pay-login-shell {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
  padding: 44px 0 70px;
}

.pay-login-panel {
  width: min(100%, 480px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.pay-login-panel h1 {
  margin-bottom: 9px;
  font-size: 2rem;
}

.pay-login-panel > p {
  margin-bottom: 24px;
  color: var(--muted);
}

.pay-form {
  display: grid;
  gap: 17px;
}

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

.pay-field label,
.pay-field-label {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.pay-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #cad9e8;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  outline: none;
}

.pay-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.13);
}

.pay-field input[readonly] {
  color: var(--muted);
  background: #f6f9fd;
  cursor: default;
}

.pay-field[hidden],
.pay-auth-switch[hidden],
[data-auth-submit][hidden] {
  display: none;
}

.pay-invite-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pay-invite-guide {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border: 1px solid #d6e5f5;
  border-radius: 8px;
  background: #eef3f9;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.pay-invite-guide img {
  display: block;
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
}

.pay-invite-guide strong {
  color: var(--ink);
}

.pay-auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.pay-auth-switch button {
  padding: 0;
  border: 0;
  color: var(--green-strong);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.pay-auth-switch button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pay-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.pay-message.success {
  color: var(--green-strong);
}

.pay-login-dialog .pay-message {
  min-height: 0;
  margin-top: -7px;
}

.pay-login-dialog .pay-message:empty {
  display: none;
}

.pay-login-dialog .pay-message.error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #b42318;
  background: #fef2f2;
  font-weight: 650;
  line-height: 1.45;
}

.pay-login-dialog .pay-message.error::before {
  display: inline-grid;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  place-items: center;
  margin-top: 1px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "!";
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

[data-auth-submit]:disabled {
  color: #ffffff;
  background: #c9d0cc;
  box-shadow: none;
  cursor: not-allowed;
}

[data-auth-submit][data-submitting="true"] {
  cursor: wait;
}

.pay-checkout-section {
  padding: 38px 0 70px;
}

.pay-checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: start;
  gap: 20px;
}

.pay-checkout-main,
.pay-checkout-aside {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.pay-order-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.pay-order-row .brand-logo {
  width: 58px;
  height: 58px;
}

.pay-order-row strong {
  display: block;
}

.pay-order-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.pay-order-amount {
  color: var(--green-strong);
  font-size: 1.45rem;
  font-weight: 900;
  white-space: nowrap;
}

.pay-facts {
  display: grid;
  margin: 20px 0 0;
}

.pay-facts div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.pay-facts dt {
  color: var(--faint);
  font-weight: 750;
}

.pay-facts dd {
  margin: 0;
  font-weight: 750;
}

.pay-method {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(59, 130, 246, 0.38);
  border-radius: 8px;
  background: #f4f8ff;
}

.pay-alipay-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #1677ff;
  font-weight: 900;
}

.pay-consent {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  margin: 17px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.pay-consent input {
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  accent-color: var(--green);
}

.pay-consent a {
  color: var(--green-strong);
  font-weight: 750;
}

.pay-qr-result {
  display: none;
  margin-top: 18px;
  text-align: center;
}

.pay-qr-result.visible {
  display: block;
}

.pay-qr-result img {
  width: 230px;
  height: 230px;
  margin: 0 auto 12px;
  border: 8px solid #fff;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.pay-success {
  display: none;
  grid-column: 1 / -1;
  padding: 26px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 8px;
  background: #e8f0f8;
  text-align: center;
}

.pay-success.visible {
  display: block;
}

.pay-success-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 0.72rem;
  font-weight: 900;
}

.pay-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .pay-hero-grid,
  .pay-product-grid,
  .pay-checkout-grid {
    grid-template-columns: 1fr;
  }

  .pay-auth-slot {
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
    padding: 8px 12px;
  }

  .home-auth-slot {
    width: auto;
    margin-left: auto;
    padding: 0;
  }
}

@media (max-width: 620px) {
  .pay-hero {
    padding-top: 34px;
  }

  .pay-hero-compact { padding-top: 28px; }

  .pay-hero h1 {
    font-size: 2.45rem;
  }

  .pay-product-card,
  .pay-login-dialog,
  .pay-checkout-main,
  .pay-checkout-aside {
    padding: 18px;
  }

  .pay-product-card .button {
    width: 100%;
  }

  .pay-order-row,
  .pay-facts div {
    grid-template-columns: 1fr;
  }

  .pay-order-amount {
    margin-top: 4px;
  }

  .pay-auth-account span {
    display: none;
  }

  .home-auth-slot {
    gap: 2px;
  }

  .home-auth-slot .pay-auth-account {
    min-height: 32px;
    padding: 0 6px;
    font-size: 0.8rem;
  }

  .home-auth-slot .pay-auth-account strong {
    display: none;
  }

  .home-auth-slot .pay-auth-account::after {
    content: "控制台";
    color: var(--muted);
    font-weight: 700;
  }

  .home-auth-slot .pay-auth-button {
    min-height: 32px;
    padding: 0 7px;
    font-size: 0.8rem;
  }

  .pay-login-modal {
    align-items: end;
    padding: 12px;
  }

  .pay-login-dialog {
    width: 100%;
    max-height: calc(100vh - 24px);
  }
}
