:root {
  --ink: #1f1f1f;
  --muted: #8c8c8c;
  --line: #f0f0f0;
  --blue: #1677ff;
  --blue-2: #0958d9;
  --bg: #f5f6f8;
}

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

html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(22, 119, 255, 0.16); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }

.bar {
  background: #fff;
  border-bottom: 1px solid #eee;
}
.bar-in {
  width: min(960px, calc(100% - 32px));
  height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
}
.brand strong {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-svg { width: 28px; height: 28px; display: block; flex: none; }
.bar-in > span { color: var(--muted); font-size: 13px; flex: none; }

.stage {
  width: min(440px, calc(100% - 32px));
  margin: 28px auto 0;
  flex: 1;
}
.sheet {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 28px 28px 24px;
}

.payee { margin: 0 0 22px; color: #595959; font-size: 14px; }
.amt-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.amount-box {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px solid #e8e8e8;
  padding: 4px 0 8px;
}
.amount-box:focus-within { border-bottom-color: var(--blue); }
.currency { font-size: 28px; font-weight: 600; line-height: 1; }
.amount-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0;
  font-size: 40px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.amount-box input::placeholder { color: #d9d9d9; font-weight: 500; }

.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.chip {
  height: 40px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.chip:hover { border-color: #91caff; color: var(--blue); }
.chip.on { border-color: var(--blue); color: var(--blue); background: #f5f9ff; }

.hint { margin: 10px 0 0; color: #bfbfbf; font-size: 12px; }
.method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.method span { color: var(--muted); }
.method-pay { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.alipay-ico { width: 20px; height: 20px; display: block; flex: none; }

.submit {
  width: 100%;
  margin-top: 22px;
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  background: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.submit:hover { background: #4096ff; }
.submit:active { background: var(--blue-2); }
.submit:disabled { opacity: .65; cursor: wait; }
.submit.fallback {
  margin-top: 8px;
  background: #fff;
  color: var(--blue);
  border: 1px solid #d6e4ff;
}

.assure, .secure, .muted, .note { color: var(--muted); font-size: 13px; }
.assure { text-align: center; margin: 16px 0 0; }

.sandbox {
  margin: -8px 0 16px;
  background: #fff7e8;
  color: #9a6700;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
.alert { border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.alert.error { background: #fff1f0; color: #b42318; }
.alert.ok { background: #f6ffed; color: #067647; }

.maintain { text-align: center; padding: 28px 8px; }
.maintain h1 { margin: 0 0 8px; font-size: 20px; font-weight: 600; }
.maintain p { margin: 0; color: var(--muted); }

.foot {
  width: min(440px, calc(100% - 32px));
  margin: 20px auto 28px;
  display: flex;
  justify-content: center;
  gap: 16px;
  color: #bfbfbf;
  font-size: 12px;
}
.foot a { color: #bfbfbf; }
.foot a:hover { color: var(--blue); }

.page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 40px;
}
.redirect, .result {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 40px 28px 28px;
  text-align: center;
}
.redirect h1, .result h1 { margin: 14px 0 4px; font-size: 20px; font-weight: 600; }
.amount-lg {
  margin: 8px 0 4px;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.progress { height: 2px; border-radius: 99px; background: #f0f0f0; overflow: hidden; margin: 20px 0 16px; }
.progress span {
  display: block;
  height: 100%;
  width: 36%;
  background: var(--blue);
  animation: load 1.05s ease-in-out infinite;
}
@keyframes load { from { transform: translateX(-120%); } to { transform: translateX(340%); } }

.spinner, .state-ico { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; }
.spinner { border: 3px solid #e6f4ff; border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-ico { display: grid; place-items: center; }
.state-ico.ok { background: #f6ffed; color: #12a150; }
.state-ico.wait { background: #e6f4ff; color: var(--blue); }
.state-ico.bad { background: #fff1f0; color: #d92d20; }
.state-ico svg { width: 28px; height: 28px; }

.rows { text-align: left; margin: 18px 0 8px; }
.rows div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rows span { color: var(--muted); flex: none; }
.rows b { font-weight: 500; text-align: right; word-break: break-all; }
.textlink { display: inline-block; margin-top: 8px; color: var(--muted); font-size: 14px; }
.note { margin: 0 0 16px; }

.wx-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 12px 16px;
}
.wx-card {
  width: min(280px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 16px 16px 18px;
}
.wx-arrow { text-align: right; font-size: 22px; line-height: 1; color: var(--blue); }
.wx-card h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.wx-card p { margin: 0; color: #595959; font-size: 14px; }

@media (max-width: 640px) {
  .bar-in { width: calc(100% - 28px); }
  .stage, .foot { width: calc(100% - 24px); }
  .stage { margin-top: 12px; }
  .sheet { padding: 22px 18px 18px; }
  .amount-box input { font-size: 36px; }
  .page { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); align-items: flex-start; }
  .redirect, .result { padding: 32px 18px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
