:root {
  color-scheme: light;
  --alipay: #1677ff;
  --alipay-dark: #075bd8;
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --soft: #f3f7fb;
  --success: #0f9d68;
  --danger: #d64545;
  --warning: #a96000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(22, 119, 255, .18), transparent 36rem),
    linear-gradient(160deg, #eef6ff 0%, #f8fbff 48%, #edf3fa 100%);
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.pay-card {
  width: min(100%, 520px);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 28px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 26px 70px rgba(31, 78, 121, .18);
}

.brand-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.alipay-mark, .button-logo {
  display: inline-grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #2997ff, #0869ea);
  font-weight: 800;
}

.alipay-mark {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 30px;
  box-shadow: 0 10px 24px rgba(22, 119, 255, .28);
}

.button-logo {
  width: 27px;
  height: 27px;
  border: 2px solid rgba(255, 255, 255, .8);
  border-radius: 8px;
  background: transparent;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--alipay);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 { margin-bottom: 0; font-size: 24px; }

.mode-badge {
  justify-self: end;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--warning);
  background: #fff4dc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.mode-badge.official { color: #087651; background: #e3f7ef; }

.wechat-tip, .mode-note, .admin-notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.65;
}

.wechat-tip { color: #795000; background: #fff5da; border: 1px solid #ffe2a2; }
.mode-note { color: #486581; background: var(--soft); border: 1px solid #e3edf7; }

.amount-panel {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 10px 0 24px;
  padding: 23px;
  border: 1px solid #d9eaff;
  border-radius: 22px;
  background: linear-gradient(145deg, #f7fbff, #edf6ff);
}

.amount-panel > span:first-child { color: var(--muted); font-weight: 700; }
.amount-panel strong { font-size: 48px; line-height: 1; letter-spacing: -.03em; }
.amount-panel small { margin-right: 5px; font-size: 24px; }
.locked-label { color: var(--alipay); font-size: 12px; }

.amount-form { display: grid; gap: 10px; }
.amount-form label, .create-grid label { color: #334e68; font-size: 14px; font-weight: 700; }
.amount-form label em { color: #829ab1; font-style: normal; font-weight: 400; }

.amount-input-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  margin-bottom: 8px;
  padding: 5px 17px;
  border: 2px solid #d9e2ec;
  border-radius: 16px;
  transition: border-color .2s, box-shadow .2s;
}

.amount-input-wrap:focus-within { border-color: var(--alipay); box-shadow: 0 0 0 4px rgba(22, 119, 255, .1); }
.amount-input-wrap > span { color: #486581; font-size: 25px; }
.amount-input-wrap input { width: 100%; padding: 10px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 38px; font-weight: 750; }

.text-input, .admin-form input, .create-grid input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: white;
}

.text-input:focus, .admin-form input:focus, .create-grid input:focus { border-color: var(--alipay); box-shadow: 0 0 0 4px rgba(22, 119, 255, .1); }

.primary-button, .secondary-button, .small-button {
  border: 0;
  cursor: pointer;
  font-weight: 750;
  transition: transform .15s, opacity .15s, box-shadow .15s;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  margin-top: 10px;
  padding: 0 20px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--alipay), #0a67e8);
  box-shadow: 0 13px 28px rgba(22, 119, 255, .25);
}

.primary-button:active, .secondary-button:active, .small-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: wait; opacity: .65; }

.pay-actions { display: grid; gap: 10px; margin: 18px 0; }
.secondary-button { min-height: 44px; border-radius: 13px; color: var(--alipay-dark); background: #eaf3ff; }
.text-link { justify-self: center; color: var(--muted); font-size: 13px; text-decoration: none; }
.text-link.emphasis { color: var(--alipay); font-weight: 700; text-decoration: underline; }

.status-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  margin: 18px 0;
  padding: 17px;
  border-radius: 16px;
  color: #334e68;
  background: #f0f5fa;
}

.status-panel.success { color: #086949; background: #e6f8f1; }
.status-panel.error { color: #a32d2d; background: #fff0f0; }
.status-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: white; background: #829ab1; font-weight: 900; }
.success .status-icon { background: var(--success); }
.error .status-icon { background: var(--danger); }
.status-panel h2 { margin-bottom: 5px; font-size: 18px; }
.status-panel p { margin-bottom: 0; font-size: 13px; line-height: 1.55; }
.order-number { margin-top: 8px !important; color: #829ab1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }

.share-section { margin: 18px 0; border-top: 1px solid #edf2f7; padding-top: 17px; }
.share-section summary { cursor: pointer; color: #334e68; font-size: 14px; font-weight: 750; text-align: center; }
.share-section p { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.qr-frame { width: min(76vw, 300px); margin: 16px auto 0; padding: 13px; border-radius: 18px; background: white; box-shadow: 0 8px 30px rgba(50, 80, 110, .12); }
.qr-frame img { display: block; width: 100%; height: auto; image-rendering: pixelated; }

footer { display: flex; justify-content: center; gap: 18px; margin-top: 17px; color: #9fb3c8; font-size: 11px; }

@media (max-width: 440px) {
  .pay-card { padding: 22px 18px; border-radius: 23px; }
  .brand-row { grid-template-columns: auto 1fr; }
  .mode-badge { grid-column: 2; justify-self: start; }
  .amount-panel strong { font-size: 43px; }
  footer { flex-direction: column; align-items: center; gap: 4px; }
}
