:root {
  color-scheme: light;
  --ink: #142b2e;
  --muted: #4d6363;
  --line: #d7e3e0;
  --surface: #fff;
  --accent: #116456;
  --accent-hover: #0b5146;
  --accent-soft: #e9f4ef;
  --positive: #087055;
  --warning: #86511c;
  --danger: #ad3145;
  font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(155deg, #eaf2ee 0, #f6f8f7 28rem);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}

input, button { font: inherit; }
h1, h2, p, dl, dd, fieldset { margin: 0; }
fieldset { min-width: 0; border: 0; padding: 0; }

.frame { width: min(57rem, calc(100% - 3rem)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: #f9fbfa; }
.identity { display: flex; align-items: center; min-height: 3.9rem; gap: .7rem; font-weight: 700; }

.wallet-mark { display: grid; width: 2.16rem; height: 2.16rem; place-items: center; border-radius: .59rem; background: #17443d; color: #fff; }
.wallet-mark > span { position: relative; width: 1.26rem; height: .88rem; border: 1.5px solid currentColor; border-radius: .22rem; }
.wallet-mark > span::after { position: absolute; right: -.18rem; top: .15rem; width: .49rem; height: .39rem; border-radius: .12rem; background: #a0d7bd; content: ""; }

.checkout { padding: clamp(1.5rem, 4vw, 3.4rem) 0 2.5rem; }
.page-title { margin-bottom: clamp(1.1rem, 3vw, 1.8rem); font-size: clamp(1.85rem, 4.5vw, 2.85rem); line-height: 1.2; font-weight: 750; }

.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.checkout[data-view="entry"] { max-width: 35rem; }
.checkout[data-view="pay"] { max-width: 29rem; padding-top: clamp(.8rem, 4vw, 2.2rem); }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1rem, 3vw, 1.55rem); background: var(--surface); box-shadow: 0 .45rem 1.5rem #1639330b; }
.card h2 { font-size: 1.16rem; line-height: 1.45; font-weight: 720; }
.details-card h2 { margin-bottom: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.amount-field > label, .method-fields > legend { display: block; margin-bottom: .36rem; padding: 0; font-size: .94rem; font-weight: 650; }

.amount-input { display: flex; align-items: center; min-height: 3.65rem; gap: .58rem; padding: 0 .8rem; border: 1px solid #aebfba; border-radius: .65rem; background: #f8faf9; }
.amount-input:focus-within { border-color: var(--accent); outline: 2px solid #b4d5ca; outline-offset: 1px; }
.amount-input input { width: 100%; min-width: 0; align-self: stretch; padding: .47rem 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1.52rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.amount-input input::placeholder { color: #697b79; }
.amount-input input:disabled { color: var(--ink); opacity: 1; }
.yuan-symbol { color: var(--accent); font-size: 1.3rem; font-weight: 700; }
.currency { color: var(--muted); font-size: .82rem; font-weight: 650; }
.field-hint { margin-top: .26rem; color: var(--muted); font-size: .875rem; }

.method-fields { margin-top: 1.01rem; }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .53rem; }
.method-option { display: flex; align-items: center; flex-wrap: wrap; min-height: 3rem; gap: .42rem; min-width: 0; padding: .45rem .56rem; border: 1px solid #bacac5; border-radius: .6rem; font-size: .88rem; font-weight: 650; cursor: pointer; }
.method-option:has(:checked) { border-color: var(--accent); background: #f0f7f4; }
.method-option:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.method-option:has(:disabled) { cursor: default; }
.method-option input { order: 3; margin: 0 0 0 auto; accent-color: var(--accent); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; gap: .4rem; padding: .55rem 1rem; border: 1px solid transparent; border-radius: .62rem; font-size: .94rem; font-weight: 700; cursor: pointer; }
.button-primary { width: 100%; margin-top: 1rem; background: var(--accent); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-primary:disabled { background: #e5ece9; color: #4b6260; cursor: default; }
.button-secondary { margin-top: .85rem; border-color: #a9c9be; background: var(--accent-soft); color: var(--accent-hover); }
.button-secondary:hover:not(:disabled) { background: #ddebE5; }
.button-secondary:disabled { opacity: .65; cursor: default; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.form-message { margin-top: .55rem; color: var(--danger); font-size: .875rem; overflow-wrap: anywhere; }
.form-message:empty { display: none; }
.entry-access { margin-top: .65rem; }
.entry-current-order { width: 100%; text-decoration: none; }

.payment-card { background: #f9fcfa; text-align: center; }
.payment-brand { position: relative; overflow: hidden; width: 7.6rem; height: 2rem; margin: 0 auto .28rem; }
.payment-brand img { position: absolute; top: 50%; left: 50%; width: 110%; height: auto; transform: translate(-50%, -51%); mix-blend-mode: multiply; }
.pay-navigation { margin-top: .55rem; }
.pay-back { display: inline-flex; align-items: center; justify-content: center; min-height: 2.7rem; padding: 0 .6rem; color: var(--accent-hover); font-size: .875rem; font-weight: 650; text-underline-offset: .18em; }
.pay-back:focus-visible, .entry-current-order:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.payment-status { display: grid; justify-items: center; gap: .36rem; }
.payment-status > div { min-width: 0; }
.payment-title { font-size: 1.22rem; line-height: 1.35; font-weight: 740; }
.payment-status p { margin-top: .22rem; color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.payment-status p:empty, .payment-card[data-stage="ready"] .state-icon { display: none; }
.order-matching { margin: .48rem 0 .2rem; color: var(--accent); font-weight: 700; }
.payment-card[data-stage="ready"] .payment-title { font-size: .92rem; color: var(--muted); }
.state-icon { display: grid; width: 2.3rem; height: 2.3rem; flex: 0 0 auto; place-items: center; border-radius: .6rem; background: var(--accent-soft); color: var(--accent); }
.state-icon::before { width: .9rem; height: .9rem; border: 1.6px solid currentColor; border-radius: 50%; content: ""; }
.payment-card[data-stage="paid"] { border-color: #b5dfce; background: linear-gradient(155deg, #fff 48%, #effbf6 100%); }
.payment-card[data-stage="paid"] .state-icon { color: var(--positive); background: #dcf4ea; }
.payment-card[data-stage="paid"] .state-icon::before { width: .97rem; height: .55rem; border: 0; border-bottom: 2px solid currentColor; border-left: 2px solid currentColor; border-radius: 0; transform: rotate(-45deg) translateY(-.08rem); }
.payment-card[data-stage="warning"] .state-icon { color: var(--warning); background: #fff0da; }
.payment-card[data-stage="warning"] .state-icon::before { width: 0; height: 0; border: 0; font-size: .97rem; font-weight: 700; line-height: 0; transform: translateX(-.14rem); content: "!"; }

.order-facts { display: grid; justify-items: center; gap: .15rem; margin-top: .38rem; }
.order-facts dd { overflow-wrap: anywhere; }
.fact-amount { color: var(--ink); font-size: clamp(1.8rem, 6vw, 2.35rem); font-weight: 745; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fact-method { color: var(--ink); font-size: .875rem; font-weight: 650; }
.order-reference { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; column-gap: .35rem; color: var(--muted); font-size: .8rem; }
.order-reference dd { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .035em; }

.qr-section { display: grid; justify-items: center; gap: .32rem; margin-top: .66rem; }
.scan-title { color: var(--accent-hover); font-size: .93rem; font-weight: 750; }
.payment-card[data-method="wechat"] .scan-title {
  width: min(100%, 22rem);
  padding: .65rem .7rem;
  border: 1px solid #cce5d9;
  border-radius: .65rem;
  background: var(--accent-soft);
  font-size: clamp(1.1875rem, 5.6vw, 1.25rem);
  line-height: 1.35;
}
.scan-note { max-width: min(100%, 24rem); color: var(--muted); font-size: .875rem; line-height: 1.45; }
.payment-qr { display: block; width: min(100%, 15rem); width: min(100%, clamp(8.75rem, calc(100dvh - 18rem), 15rem)); height: auto; aspect-ratio: 1; padding: .35rem; border: 1px solid var(--line); border-radius: .55rem; background: white; object-fit: contain; image-rendering: pixelated; }
.payment-card[data-method="wechat"] .payment-qr { width: min(100%, 17.5rem); width: min(100%, clamp(8.75rem, calc(100dvh - 15.5rem), 17.5rem)); }
.paid-time { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem .8rem; margin-top: .84rem; padding-top: .68rem; border-top: 1px solid #cce5d9; color: #305648; font-size: .88rem; }
.paid-time time { color: #175b46; font-weight: 650; font-variant-numeric: tabular-nums; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 720px) {
  .frame { width: min(34rem, calc(100% - 1.75rem)); }
}

@media (max-height: 620px) {
  body:has(.checkout[data-view="pay"]) .identity { min-height: 2.55rem; }
  body:has(.checkout[data-view="pay"]) .wallet-mark { width: 1.8rem; height: 1.8rem; }
  .checkout[data-view="pay"] { padding-block: .42rem .6rem; }
  .checkout[data-view="pay"] .payment-card { padding: .65rem; }
  .payment-brand { width: 6.5rem; height: 1.65rem; }
  .pay-navigation { margin-top: .2rem; }
  .payment-status p { font-size: .8rem; line-height: 1.35; }
  .order-facts, .qr-section { margin-top: .42rem; }
}

@media (max-width: 365px) {
  .card { padding: .95rem; }
  .method-option { gap: .3rem; }
}
