:root {
  --ali-blue: #1677ff;
  --ali-blue-d: #0e5fd8;
  --ink: #1a1a1a;
  --muted: #8a93a6;
  --line: #eef0f4;
  --ok: #00b96b;
  --warn: #d97706;
  --bad: #e23d3d;
}
* { box-sizing: border-box; }
.ap-body {
  margin: 0;
  background: #f3f5f9;
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
.ap-wrap { max-width: 440px; margin: 0 auto; padding: 0 14px 32px; }

.ap-top {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 4px;
}
.ap-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ali-blue); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 17px;
}
.ap-top-title { font-weight: 700; font-size: 16px; color: var(--ink); }

.ap-card {
  background: #fff; border-radius: 16px; padding: 24px 20px 20px;
  box-shadow: 0 6px 24px rgba(20, 40, 80, .06);
  text-align: center;
}
.ap-merchant { color: var(--muted); font-size: 13px; margin: 0 0 2px; }
.ap-plan-title { font-size: 16px; font-weight: 600; margin: 0 0 14px; }
.ap-amount { font-size: 40px; font-weight: 800; letter-spacing: .5px; margin: 0 0 18px; }
.ap-cny { font-size: 22px; font-weight: 700; margin-right: 2px; vertical-align: 6px; }

.ap-qr {
  width: 268px; max-width: 86%; margin: 0 auto 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: grid; place-items: center;
}
.ap-qr img { width: 100%; height: auto; display: block; }
.ap-qr-off {
  height: 240px; color: var(--muted); font-size: 15px; line-height: 1.8;
  display: grid; place-items: center; background: #fafbfc;
}
.ap-tip { color: #4a5568; font-size: 13.5px; margin: 0 0 6px; }
.ap-tip-warn { color: var(--warn); }

.ap-redeem {
  margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line);
  text-align: left;
}
.ap-redeem-head { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.ap-redeem-sub { color: var(--muted); font-size: 12.5px; line-height: 1.6; margin: 0 0 12px; }
.ap-redeem-row { display: flex; gap: 8px; }
.ap-input {
  flex: 1; min-width: 0; padding: 12px 14px;
  border: 1px solid #dfe3ea; border-radius: 10px;
  font-size: 16px; letter-spacing: 4px; font-family: ui-monospace, Menlo, monospace;
}
.ap-input:focus { outline: none; border-color: var(--ali-blue); box-shadow: 0 0 0 3px rgba(22, 119, 255, .12); }
.ap-btn {
  flex-shrink: 0; padding: 12px 18px; border: 0; border-radius: 10px;
  background: var(--ali-blue); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
}
.ap-btn:hover { background: var(--ali-blue-d); }
.ap-btn:disabled { opacity: .55; cursor: not-allowed; }
.ap-btn-ghost { background: #eef3ff; color: var(--ali-blue); margin-top: 8px; width: 100%; }
.ap-btn-ghost:hover { background: #e2ebff; }

.ap-redeem-msg { font-size: 13px; margin: 12px 0 0; display: flex; align-items: center; gap: 8px; }
.ap-redeem-msg[hidden], .ap-result[hidden], .ap-btn-portal[hidden] { display: none !important; }
.ap-card.is-done .ap-before,
.ap-card.is-done .ap-foot { display: none; }
.ap-redeem-msg.is-wait { color: var(--ali-blue); }
.ap-redeem-msg.is-warn { color: var(--warn); }
.ap-redeem-msg.is-err { color: var(--bad); }
.ap-spin {
  width: 15px; height: 15px; flex-shrink: 0;
  border: 2px solid rgba(22, 119, 255, .25);
  border-top-color: var(--ali-blue);
  border-radius: 50%;
  animation: ap-spin 0.7s linear infinite;
}
@keyframes ap-spin { to { transform: rotate(360deg); } }

.ap-result {
  margin-top: 14px; padding: 14px; border-radius: 12px;
  background: #f0faf4; border: 1px solid #c8ecd6; text-align: center;
}
.ap-result-label { font-size: 12.5px; color: var(--ok); font-weight: 700; margin-bottom: 8px; }
.ap-cdk {
  display: block; font-family: ui-monospace, Menlo, monospace;
  font-size: 15px; font-weight: 700; word-break: break-all; color: var(--ink);
  background: #fff; border: 1px dashed #c8ecd6; border-radius: 8px; padding: 10px;
}
.ap-result-hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.ap-foot { color: var(--muted); font-size: 12px; text-align: center; margin: 18px 0 0; }

.ap-card-err { padding: 40px 20px; }
.ap-err-icon {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 12px;
  background: #fdecec; color: var(--bad); display: grid; place-items: center;
  font-size: 26px; font-weight: 800;
}
.ap-err-title { font-size: 17px; margin: 0 0 6px; }
.ap-err-msg { color: var(--muted); font-size: 13.5px; margin: 0; }

/* 续杯工具购买页来的（?from=client）：顶部返回 + 领码后的下载按钮 */
.ap-back { margin-left: auto; font-size: 13px; color: var(--ali-blue); text-decoration: none; }
.ap-back:hover { text-decoration: underline; }
.ap-btn-dl { display: block; width: 100%; margin-top: 10px; background: var(--ok); }
.ap-btn-dl:hover { background: #00a75f; }
.ap-btn-portal {
  display: block; width: 100%; margin-top: 10px; text-align: center; text-decoration: none;
  background: linear-gradient(90deg, #1677ff, #36cfc9);
  box-shadow: 0 0 0 0 rgba(22, 119, 255, .55);
  animation: apPortalGlow 1.6s ease-in-out infinite;
}
.ap-btn-portal:hover { filter: brightness(1.06); }
@keyframes apPortalGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 119, 255, .45), 0 8px 22px rgba(22, 119, 255, .35); }
  50% { box-shadow: 0 0 0 8px rgba(22, 119, 255, 0), 0 8px 28px rgba(54, 207, 201, .55); }
}
.ap-result-hint a { color: var(--ali-blue); }

/* 升级模式（?current=激活码）的说明条 */
.ap-upgrade-note { text-align: left; font-size: 12.5px; line-height: 1.6; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 10px; margin: 0 0 12px; }
.ap-upgrade-note b { color: #b45309; }
