.pay-body {
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(22, 119, 255, .12), transparent 60%),
    radial-gradient(900px 360px at 100% 0%, rgba(239, 123, 98, .12), transparent 55%),
    #f3f5f8;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.pay-body.modal-open {
  overflow: hidden;
  touch-action: none;
}

.pay-page {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  box-sizing: border-box;
}

.pay-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 36px rgba(15, 23, 42, .08);
  padding: 22px 22px 26px;
  border: 1px solid rgba(255, 255, 255, .8);
}

.pay-hero {
  margin: -6px 0 6px;
}

.pay-hero-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(22, 119, 255, .1);
  color: #1677ff;
  font-size: 12px;
  font-weight: 700;
}

.pay-title {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
  color: #111827;
  letter-spacing: .2px;
}

.pay-sub {
  margin-top: 6px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
}

.pay-label {
  display: block;
  margin-top: 20px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
}

.pay-input {
  width: 100%;
  height: 48px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  background: #fff;
  color: #111827;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.pay-input:focus {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, .15);
}

.user-nick {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #64748b;
}

.user-nick-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: #94a3b8;
}

.user-nick strong {
  color: #0f172a;
  font-size: 15px;
  word-break: break-all;
}

.user-nick.is-ok {
  background: #eff6ff;
}

.user-nick.is-ok strong {
  color: #1677ff;
}

.user-nick.is-err {
  background: #fff1f0;
}

.user-nick.is-err strong {
  color: #cf1322;
}

.user-nick.is-loading strong {
  color: #94a3b8;
  font-weight: 500;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.amount-chip {
  height: 48px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  font-size: 15px;
  color: #334155;
  transition: .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.amount-chip:active {
  transform: scale(.98);
}

.amount-chip.active {
  border-color: #1677ff;
  background: linear-gradient(180deg, #f0f7ff, #e8f3ff);
  color: #1677ff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(22, 119, 255, .15);
}

.custom-row {
  margin-top: 10px;
  position: relative;
}

.custom-prefix {
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  color: #94a3b8;
  font-weight: 700;
  pointer-events: none;
}

.custom-input {
  padding-left: 32px;
}

.pay-summary {
  margin-top: 20px;
  padding: 14px;
  background: linear-gradient(135deg, #f8fafc, #eef4ff);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sum-item {
  min-width: 0;
}

.sum-label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.sum-value {
  font-size: 18px;
  color: #0f172a;
  font-weight: 700;
}

.sum-value strong {
  font-size: 22px;
}

.sum-coins .sum-value {
  color: #ef7b62;
}

.pay-actions {
  margin-top: 18px;
  position: sticky;
  bottom: 12px;
  z-index: 5;
}

.pay-btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #1677ff, #3b82f6);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(22, 119, 255, .28);
  -webkit-tap-highlight-color: transparent;
}

.pay-btn:active {
  transform: translateY(1px);
}

.pay-btn:disabled {
  opacity: .65;
  cursor: default;
  box-shadow: none;
}

.pay-btn-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.pay-btn-secondary {
  background: linear-gradient(135deg, #ef7b62, #f59a7a);
  box-shadow: 0 10px 24px rgba(239, 123, 98, .28);
}

.pay-btn-ghost {
  margin-top: 10px;
  background: #fff;
  color: #1677ff;
  border: 1px solid #bfdbfe;
  box-shadow: none;
}

.pay-tip {
  margin-top: 10px;
  min-height: 18px;
  color: #cf1322;
  font-size: 13px;
  text-align: center;
}

.success-card {
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 8px auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  font-size: 34px;
  line-height: 64px;
  box-shadow: 0 12px 28px rgba(34, 197, 94, .28);
}

.success-panel {
  margin: 18px 0 8px;
  text-align: left;
  background: #f8fafc;
  border-radius: 14px;
  padding: 6px 14px;
}

.success-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 14px;
  color: #64748b;
}

.success-line:last-child {
  border-bottom: 0;
}

.success-line strong,
.success-line em {
  color: #0f172a;
  font-style: normal;
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}

.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.pay-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
}

.pay-modal-box {
  position: relative;
  z-index: 1;
  width: min(880px, 100%);
  height: min(760px, calc(100vh - 32px));
  max-height: calc(100dvh - 32px);
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
  animation: payModalIn .22s ease-out;
}

@keyframes payModalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.pay-modal-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #1677ff, #3b82f6);
  color: #fff;
}

.pay-modal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ali-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex: 0 0 auto;
}

.pay-modal-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.pay-modal-sub {
  margin-top: 2px;
  font-size: 12px;
  opacity: .9;
}

.pay-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.pay-modal-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid #eef2f7;
  background: #f8fbff;
}

.meta-row {
  padding: 12px 14px;
  border-right: 1px solid #eef2f7;
  min-width: 0;
}

.meta-row:last-child {
  border-right: 0;
}

.meta-row > span {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.meta-row strong {
  display: block;
  font-size: 15px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-money {
  color: #1677ff !important;
}

.meta-money em {
  font-style: normal;
  font-size: 18px;
}

.meta-coins {
  color: #ef7b62 !important;
}

.pay-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 12px 8px;
  background: #f3f5f8;
}

.modal-hint {
  margin: 0 4px 10px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.ali-frame-wrap {
  flex: 1;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.ali-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  display: block;
}

.mobile-wait {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 16px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
}

.wait-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #dbeafe;
  border-top-color: #1677ff;
  animation: spin .8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.wait-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}

.wait-desc {
  margin: 8px 0 20px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.6;
  max-width: 280px;
}

.pay-modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 14px;
  font-size: 12px;
  color: #94a3b8;
  background: #fff;
  border-top: 1px solid #eef2f7;
}

.foot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, .15);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: .7; }
}

@media (max-width: 720px) {
  .pay-page {
    padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .pay-card {
    border-radius: 16px;
    padding: 18px 16px 22px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .07);
  }

  .pay-title {
    font-size: 22px;
  }

  .amount-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pay-summary {
    grid-template-columns: 1fr;
  }

  .pay-actions {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .pay-modal {
    padding: 0;
    align-items: stretch;
  }

  .pay-modal-box {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    animation: paySheetIn .24s ease-out;
  }

  @keyframes paySheetIn {
    from { transform: translateY(24px); opacity: .6; }
    to { transform: none; opacity: 1; }
  }

  .pay-modal-meta {
    grid-template-columns: 1fr;
  }

  .meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-right: 0;
    border-bottom: 1px solid #eef2f7;
    padding: 10px 14px;
  }

  .meta-row > span {
    margin-bottom: 0;
  }

  .meta-row:last-child {
    border-bottom: 0;
  }

  .pay-modal-body {
    padding: 10px;
  }

  .pay-body .site-footer {
    display: none;
  }

  .pay-body .site-header .nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .pay-body .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-height: auto;
    padding: 10px 0;
  }

  .pay-body .brand-text .slogan {
    display: none;
  }
}

@media (max-width: 380px) {
  .amount-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
