:root {
  color-scheme: light;
  --ink: #151817;
  --muted: #66706b;
  --subtle: #6d7772;
  --line: #dfe5e1;
  --canvas: #f2f5f3;
  --surface: #ffffff;
  --soft-surface: #f7f9f8;
  --wechat: #04783e;
  --alipay: #075bbd;
  --danger: #b42318;
  --danger-soft: #fff3f1;
  --active: var(--wechat);
  --active-soft: rgba(7, 193, 96, 0.13);
  --active-focus: rgba(7, 193, 96, 0.28);
  --header-height: 72px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  letter-spacing: 0;
}

body[data-method="alipay"] {
  --active: var(--alipay);
  --active-soft: rgba(22, 119, 255, 0.13);
  --active-focus: rgba(22, 119, 255, 0.28);
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 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;
}

.app-header {
  min-height: var(--header-height);
  color: #ffffff;
  background: var(--ink);
}

.header-inner {
  width: min(1120px, 100%);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-symbol {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 7px;
  font-size: 17px;
  font-weight: 750;
}

.brand-name {
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
}

.brand-name strong {
  font-weight: 750;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  white-space: nowrap;
}

.state-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #f4b740;
  box-shadow: 0 0 0 4px rgba(244, 183, 64, 0.12);
}

.service-state[data-state="ready"] .state-dot {
  background: var(--wechat);
  box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.13);
}

.service-state[data-state="warning"] .state-dot,
.service-state[data-state="error"] .state-dot {
  background: #ff6b5f;
  box-shadow: 0 0 0 4px rgba(255, 107, 95, 0.13);
}

.checkout-shell {
  width: min(1120px, 100%);
  min-height: calc(100svh - var(--header-height));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  background: var(--surface);
  animation: checkout-enter 420ms ease-out both;
}

.payment-entry {
  min-width: 0;
  padding: 72px 64px 64px 40px;
  padding: 72px clamp(48px, 7vw, 96px) 64px 40px;
}

.order-summary {
  min-width: 0;
  padding: 72px 40px 44px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--soft-surface);
}

.section-label {
  margin: 0 0 12px;
  color: var(--active);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: 0;
  transition: color 180ms ease;
}

.title-block h1,
.order-summary h2 {
  margin: 0;
  font-weight: 720;
  line-height: 1.14;
}

.title-block h1 {
  font-size: 38px;
}

.order-summary h2 {
  font-size: 24px;
}

.title-support {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

#payForm {
  margin-top: 52px;
}

.form-section {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.form-section + .form-section {
  margin-top: 38px;
}

.form-section legend,
.description-section > label {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  color: #343a37;
  font-size: 14px;
  font-weight: 680;
  line-height: 1.4;
}

.description-section > label span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 500;
}

.amount-control {
  width: 100%;
  height: 80px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.amount-control:focus-within {
  border-color: var(--active);
  box-shadow: 0 0 0 3px var(--active-soft);
}

.amount-control[data-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}

.currency {
  align-self: center;
  color: #343a37;
  font-size: 25px;
  font-weight: 650;
}

#amount {
  width: 100%;
  min-width: 0;
  height: 64px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  line-height: 1;
}

.amount-unit {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
}

.field-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.method-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.method-option {
  position: relative;
  min-width: 0;
  min-height: 84px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.method-option:hover {
  border-color: #b7c1bc;
  transform: translateY(-1px);
}

.method-option:focus-within {
  outline: 3px solid var(--active);
  outline-offset: 2px;
}

.method-option.is-selected {
  border-color: var(--active);
  box-shadow: inset 0 0 0 1px var(--active);
}

.method-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.method-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.method-icon-wechat {
  background: #ebfbf2;
}

.method-icon-alipay {
  background: #edf5ff;
}

.method-icon img {
  width: 23px;
  height: 23px;
  display: block;
}

.method-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.method-copy strong {
  font-size: 14px;
  font-weight: 690;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.method-copy span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.radio-mark {
  width: 18px;
  height: 18px;
  display: block;
  border: 1px solid #b9c2bd;
  border-radius: 50%;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.method-option.is-selected .radio-mark {
  border-color: var(--active);
  box-shadow: inset 0 0 0 4px #ffffff;
  background: var(--active);
}

#goodsDesc {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  color: var(--ink);
  background: #ffffff;
  font-size: 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

#goodsDesc::placeholder {
  color: #747e79;
}

#goodsDesc:focus {
  border-color: var(--active);
  box-shadow: 0 0 0 3px var(--active-soft);
}

.summary-list {
  margin: 48px 0 0;
}

.summary-list > div {
  min-height: 45px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
}

.summary-list dt,
.summary-list dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.summary-list dt {
  color: var(--muted);
}

.summary-list dd {
  max-width: 170px;
  overflow-wrap: anywhere;
  color: #343a37;
  font-weight: 630;
  text-align: right;
}

.summary-total {
  margin-top: 14px;
  padding-top: 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.summary-total span {
  color: #343a37;
  font-size: 14px;
  font-weight: 650;
}

.summary-total strong {
  min-width: 0;
  color: var(--ink);
  font-size: 31px;
  font-variant-numeric: tabular-nums;
  font-weight: 740;
  overflow-wrap: anywhere;
  text-align: right;
}

.config-notice,
.submit-error {
  margin-top: 24px;
  padding: 12px 14px;
  border: 1px solid #f1b9b4;
  border-radius: 7px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 13px;
  line-height: 1.5;
}

.config-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#retryHealth {
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: var(--danger);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}

#retryHealth:focus-visible {
  outline: 3px solid var(--danger);
  outline-offset: 2px;
}

.pay-button {
  position: relative;
  width: 100%;
  height: 56px;
  margin-top: auto;
  padding: 0 18px 0 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  cursor: pointer;
  transition: background-color 180ms ease, transform 160ms ease, opacity 160ms ease;
}

.pay-button:not(:disabled):hover {
  background: #29302d;
}

.pay-button:not(:disabled):active {
  transform: translateY(1px);
}

.pay-button:focus-visible {
  outline: 3px solid var(--active);
  outline-offset: 3px;
}

.pay-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 690;
  text-align: left;
}

.button-arrow {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) invert(1);
  transition: transform 160ms ease;
}

.pay-button:not(:disabled):hover .button-arrow {
  transform: translateX(3px);
}

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

.pay-button[data-loading="true"] .button-arrow {
  display: none;
}

.pay-button[data-loading="true"] .button-spinner {
  display: block;
}

.secure-note {
  margin: 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--subtle);
  font-size: 11px;
}

.secure-mark {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--active);
  transition: background-color 180ms ease;
}

[hidden] {
  display: none !important;
}

.summary-value-update {
  animation: value-update 240ms ease-out;
}

@keyframes checkout-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes value-update {
  0% {
    opacity: 0.45;
    transform: translateY(2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 820px) {
  .header-inner {
    padding: 0 24px;
  }

  .checkout-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .payment-entry {
    padding: 48px 24px 44px;
  }

  .order-summary {
    padding: 40px 24px 32px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .pay-button {
    margin-top: 34px;
  }
}

@media (max-width: 540px) {
  :root {
    --header-height: 64px;
  }

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

  .brand-symbol {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
  }

  .brand-name {
    font-size: 15px;
  }

  .service-state {
    font-size: 12px;
  }

  .payment-entry {
    padding: 38px 18px 38px;
  }

  .order-summary {
    padding: 36px 18px 28px;
  }

  .title-block h1 {
    font-size: 32px;
  }

  #payForm {
    margin-top: 40px;
  }

  .amount-control {
    height: 72px;
    padding: 0 16px;
  }

  #amount {
    height: 58px;
    font-size: 36px;
  }

  .method-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .method-option {
    min-height: 76px;
  }

  .summary-list {
    margin-top: 34px;
  }
}

@media (max-width: 380px) {
  .header-inner {
    min-height: var(--header-height);
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .brand-name,
  .service-state {
    white-space: normal;
  }
}

@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;
  }
}
