:root {
  --bg: #ffffff;
  --ink: #111111;
  --text: #222222;
  --muted: #555555;
  --line: #e5e5e5;
  --alipay: #1677ff;
  --alipay-deep: #0f66e0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 36px 20px 28px;
  -webkit-font-smoothing: antialiased;
}

.stage {
  width: min(720px, 100%);
  margin: 10vh auto auto;
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  animation: rise 0.7s ease 0.05s forwards;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

.domain {
  margin: 0 auto 18px;
  font-family: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(1.65rem, 5vw, 2.45rem);
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #7eb6f5;
  word-break: break-all;
}

h1 {
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 6.5vw, 3.2rem);
  color: var(--ink);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.sub {
  margin: 16px auto 0;
  max-width: 36em;
  color: var(--text);
  font-size: clamp(0.98rem, 2.2vw, 1.12rem);
  letter-spacing: 0.02em;
  line-height: 1.75;
  font-weight: 400;
}

.cta {
  margin-top: 36px;
}

.page-foot {
  width: min(640px, 100%);
  margin: 36px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.page-foot .visits strong {
  font-weight: 700;
  color: var(--ink);
}

.page-foot .promo {
  margin-top: 6px;
  color: var(--text);
}

.buy {
  appearance: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 180px;
  padding: 14px 36px;
  border-radius: 8px;
  background: var(--alipay);
  color: #fff;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: background 0.2s ease;
}

.buy-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.buy:hover {
  background: var(--alipay-deep);
}

.buy:disabled {
  opacity: 0.7;
  cursor: wait;
}

.buy.is-loading {
  pointer-events: none;
}

.buy:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.pay-panel {
  margin-top: 36px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.pay-panel.open {
  max-height: 460px;
  opacity: 1;
}

.pay-inner {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.amount {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
}

.amount span {
  font-size: 1.85rem;
  color: var(--alipay);
  margin-left: 4px;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.qr-wrap {
  margin: 22px auto 0;
  width: 220px;
  height: 220px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  position: relative;
}

#qrcode {
  position: relative;
  width: 196px;
  height: 196px;
}

#qrcode canvas.qr-canvas {
  display: block;
  width: 196px;
  height: 196px;
}

.qr-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #fff;
}

.qr-status[hidden] { display: none !important; }

.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 28px;
}

.wave span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--alipay);
  animation: wave 1.05s ease-in-out infinite;
}

.wave span:nth-child(2) { animation-delay: 0.12s; }
.wave span:nth-child(3) { animation-delay: 0.24s; }
.wave span:nth-child(4) { animation-delay: 0.36s; }
.wave span:nth-child(5) { animation-delay: 0.48s; }

@keyframes wave {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-10px); opacity: 1; }
}

.qr-error {
  font-size: 0.9rem;
  color: #c0392b;
  text-align: center;
  line-height: 1.5;
}

.order-no {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.alipay-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}

.alipay-mask[hidden] {
  display: none !important;
}

.alipay-dialog {
  width: min(320px, 100%);
  padding: 24px 20px 18px;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.alipay-dialog-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.alipay-dialog-text {
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.6;
}

.alipay-dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.alipay-dialog-cancel,
.alipay-dialog-ok {
  flex: 1;
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 12px 10px;
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
}

.alipay-dialog-cancel {
  background: #f0f0f0;
  color: var(--text);
}

.alipay-dialog-ok {
  background: var(--alipay);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .stage {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .pay-panel { transition: none; }
  .wave span { animation: none; opacity: 0.7; }
}
