:root {
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --bg: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --white: #fff;
  --wx: #07c160;
  --ali: #1677ff;
  --qq: #12b7f5;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

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

body.pay-page {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.pay-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.pay-top-link {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
}

.pay-top-link:hover { color: var(--blue); }

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 28px;
  padding: 9px 18px 9px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s, color 0.2s, transform 0.15s;
}

.btn-back-home svg { color: var(--muted); transition: color 0.2s, transform 0.2s; }

.btn-back-home:hover {
  border-color: #bfdbfe;
  color: var(--blue);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
  transform: translateX(-2px);
}

.btn-back-home:hover svg { color: var(--blue); transform: translateX(-2px); }

/* 测试页头部 */
.test-header {
  text-align: center;
  margin-bottom: 24px;
}

.test-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.75rem;
  border-radius: 999px;
  margin-bottom: 12px;
}

.test-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.test-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.test-card {
  background: var(--white);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.test-card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* 支付方式网格 */
.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.method-grid-row .method-item {
  padding: 20px 12px;
}

.checkout-only .checkout-page {
  min-height: 100vh;
}

@media (max-width: 640px) {
  .method-grid-row {
    grid-template-columns: 1fr;
  }
}

.method-item {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--white);
}

.method-item:hover { border-color: #cbd5e1; }

.method-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.method-item.active::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  line-height: 20px;
}

.method-item img {
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
}

.method-item .name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.method-item .desc {
  font-size: 0.75rem;
  color: var(--muted);
}

/* 金额 */
.amount-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.amount-stepper button {
  width: 44px;
  height: 48px;
  border: none;
  background: #f9fafb;
  font-size: 1.25rem;
  color: var(--muted);
  cursor: pointer;
}

.amount-stepper button:hover { background: #f3f4f6; color: var(--text); }

.amount-stepper .amount-field {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
}

.amount-stepper .prefix,
.amount-stepper .suffix {
  color: var(--muted);
  font-size: 0.9rem;
}

.amount-stepper input {
  width: 80px;
  border: none;
  text-align: center;
  font-size: 1.125rem;
  font-weight: 600;
  outline: none;
}

.quick-amounts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.quick-amounts button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
}

.quick-amounts button.active,
.quick-amounts button:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.test-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 16px;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-submit:hover { background: #1d4ed8; }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.hidden { display: none !important; }

/* 收银台扫码页 */
.checkout-page {
  background: #f5f5f5;
  min-height: 100vh;
  padding: 32px 16px 48px;
}

.checkout-shell {
  max-width: 960px;
  margin: 0 auto;
}

.checkout-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
}

.checkout-main {
  flex: 1;
  min-width: 0;
}

.checkout-guide {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.guide-card {
  background: var(--white);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  max-width: 360px;
  width: 100%;
}

.guide-img {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.guide-caption {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.guide-caption.sub {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 6px;
}

@media (min-width: 768px) {
  .checkout-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 32px;
  }

  .checkout-main {
    flex: 1.05;
  }

  .checkout-guide {
    flex: 0.95;
    position: sticky;
    top: 32px;
  }

  .checkout-card {
    max-width: none;
    margin: 0;
  }
}

@media (max-width: 767px) {
  .checkout-guide {
    order: 2;
  }

  .checkout-main {
    order: 1;
  }

  .guide-card {
    max-width: none;
  }

  .guide-img {
    max-width: 220px;
  }
}

.checkout-brand {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.125rem;
  font-weight: 600;
}

.checkout-brand img {
  width: 36px;
  height: 36px;
}

.method-item img,
.channel-card img {
  object-fit: contain;
}

.checkout-card {
  max-width: 400px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.checkout-body {
  padding: 28px 24px 20px;
}

.checkout-row {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.checkout-row .label { color: var(--muted); }

.checkout-row .order-no {
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.btn-copy {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
}

.btn-copy:hover { text-decoration: underline; }

.checkout-amount-wrap {
  margin: 16px 0 20px;
}

.checkout-base-amount {
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.checkout-amount {
  text-align: center;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--blue);
  margin: 0;
}

.checkout-amount-tip {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 10px;
  padding: 0 12px;
  line-height: 1.5;
}

.checkout-qr-wrap {
  position: relative;
  margin: 0 auto;
  max-width: 260px;
}

.checkout-qr-wrap.is-timeout .checkout-qr img {
  filter: blur(8px) grayscale(0.3);
  opacity: 0.45;
  transition: filter 0.45s ease, opacity 0.45s ease;
}

.checkout-qr {
  text-align: center;
  margin-bottom: 0;
  transition: filter 0.45s ease;
}

.checkout-qr img {
  width: 220px;
  height: 220px;
  max-width: 100%;
  border: 1px solid var(--border);
  padding: 8px;
  background: #fff;
  border-radius: 8px;
}

/* 支付状态遮罩（成功 / 超时） */
.pay-status-overlay {
  position: absolute;
  inset: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.pay-status-overlay.is-timeout {
  pointer-events: auto;
}

.pay-status-overlay.is-success {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  backdrop-filter: blur(2px);
}

.pay-status-overlay.is-timeout {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  backdrop-filter: blur(1px);
}

.confetti-side {
  position: absolute;
  width: 100px;
  height: 120px;
  bottom: 20%;
  pointer-events: none;
  overflow: visible;
}

.confetti-left { left: -8px; }
.confetti-right { right: -8px; }

.particle {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 5px;
  height: 14px;
  background: var(--color);
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
}

@keyframes confetti-fire {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
  85% { opacity: 1; }
  100% {
    transform: translate(var(--x), var(--y)) scale(0.3) rotate(var(--rotate));
    opacity: 0;
  }
}

.status-pop {
  text-align: center;
  position: relative;
  z-index: 2;
}

.status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 auto 12px;
  line-height: 1;
}

.status-icon.icon-success {
  background: #dcfce7;
  color: #16a34a;
  box-shadow: 0 8px 28px rgba(22, 163, 74, 0.35);
}

.status-icon.icon-timeout {
  background: #fee2e2;
  color: #dc2626;
  box-shadow: 0 8px 28px rgba(220, 38, 38, 0.3);
}

.status-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.btn-reorder {
  display: inline-block;
  padding: 10px 22px;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-reorder:hover {
  background: #1d4ed8;
}

@keyframes pop-in {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  60% {
    transform: scale(1.12);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.pop-in {
  animation: pop-in 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.success-confetti-wrap {
  position: relative;
  height: 100px;
  margin-bottom: 8px;
}

.success-confetti-wrap .confetti-left,
.success-confetti-wrap .confetti-right {
  bottom: 10%;
}

.success-box-animated .icon-ok {
  position: relative;
  z-index: 2;
  margin: -48px auto 16px;
}

/* 小票黄底提醒 */
.checkout-receipt {
  position: relative;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-top: 2px dashed #e8c468;
  padding: 18px 20px 20px;
  text-align: center;
}

/* 小票撕边效果 */
.checkout-receipt::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background: radial-gradient(circle at 8px 0, transparent 6px, #fffbeb 6px) repeat-x;
  background-size: 16px 8px;
}

.checkout-receipt p {
  font-size: 0.875rem;
  line-height: 1.6;
  color: #b45309;
  font-weight: 500;
  margin: 0;
}

.checkout-timer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 16px 24px 20px;
  background: var(--white);
}

.checkout-timer .time {
  color: var(--blue);
  font-weight: 600;
}

.checkout-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* 支付成功 */
.pay-success-badge {
  display: inline-block;
  padding: 6px 16px;
  margin-bottom: 20px;
  background: #10b981;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.pay-success-badge.manual {
  background: #059669;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
}

.success-box {
  text-align: center;
  padding: 48px 24px;
  max-width: 400px;
  margin: 40px auto;
  background: var(--white);
  border-radius: 16px;
}

.success-box .icon-ok {
  width: 64px;
  height: 64px;
  background: #dcfce7;
  color: #16a34a;
  border-radius: 50%;
  font-size: 2rem;
  line-height: 64px;
  margin: 0 auto 16px;
}

.success-box h2 { margin-bottom: 12px; }
.success-box p { color: var(--muted); margin-bottom: 24px; }

.btn-back {
  display: inline-block;
  padding: 12px 24px;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
}
