/* 用户兑换页。CSP 只允许同源样式表，不要写内联 style。 */
:root {
  --bg: #0b0f1a; --bg2: #111827;
  --card: rgba(17, 24, 39, .72); --card-solid: #111827;
  --line: rgba(148, 163, 184, .16); --line2: rgba(148, 163, 184, .28);
  --text: #f1f5f9; --muted: #94a3b8;
  --accent: #fb923c; --accent2: #f97316; --on-accent: #1a1206;
  --grad: linear-gradient(135deg, #fbbf24 0%, #f97316 55%, #ea580c 100%);
  --glow: 0 10px 30px -10px rgba(249, 115, 22, .55);
  --ok: #34d399; --err: #f87171; --warn: #fbbf24; --info: #60a5fa;
  --radius: 18px; --radius-sm: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc; --bg2: #eef2f7;
    --card: rgba(255, 255, 255, .82); --card-solid: #fff;
    --line: rgba(15, 23, 42, .1); --line2: rgba(15, 23, 42, .2);
    --text: #0f172a; --muted: #475569;
    --accent: #c2410c; --accent2: #ea580c;
    --glow: 0 10px 28px -12px rgba(234, 88, 12, .45);
    --ok: #047857; --err: #b91c1c; --warn: #b45309; --info: #1d4ed8;
  }
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
/* 背景光晕放在伪元素上，避免 iOS 上 background-attachment: fixed 卡顿 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 50% at 15% 10%, rgba(99, 102, 241, .16), transparent 60%),
              radial-gradient(50% 40% at 90% 15%, rgba(6, 182, 212, .12), transparent 60%),
              radial-gradient(45% 40% at 70% 95%, rgba(249, 115, 22, .10), transparent 60%);
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.skip { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 14px; border-radius: 10px; background: var(--card-solid); color: var(--text); }
.skip:focus { top: 12px; }

/* ---------- 顶栏 ---------- */
.nav { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.nav-in { max-width: 1040px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand b { color: var(--accent); }
.logo { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent); background: var(--grad); box-shadow: var(--glow); }
.logo svg { width: 18px; height: 18px; }
.nav-links { display: flex; gap: 6px; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 999px; }
.nav-links a:hover { color: var(--text); background: var(--line); }

/* ---------- 首屏 ---------- */
.hero { max-width: 760px; margin: 0 auto; padding: 64px 20px 28px; text-align: center; }
.pill { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 5px 14px; font-size: 13px;
  color: var(--muted); border: 1px solid var(--line2); border-radius: 999px; background: var(--card); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.hero h1 { margin: 0; font-size: clamp(38px, 7vw, 64px); line-height: 1.12; letter-spacing: -.02em; font-weight: 800; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 18px auto 0; max-width: 520px; color: var(--muted); font-size: 17px; }
.chips { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chips li { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; }
.ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--on-accent); background: var(--grad); }
.ic-pro { background: linear-gradient(135deg, #a5b4fc, #6366f1); color: #0b0f1a; }

/* ---------- 兑换面板 ---------- */
.panel { max-width: 560px; margin: 0 auto; padding: 8px 16px 24px; display: flex; flex-direction: column; gap: 16px; outline: none; }
.stepper { list-style: none; margin: 0 0 4px; padding: 0; display: flex; align-items: center; }
.stepper li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; flex: 1; }
.stepper li:last-child { flex: 0 0 auto; }
.stepper li:not(:last-child)::after { content: ""; flex: 1; height: 2px; margin: 0 10px; border-radius: 2px; background: var(--line2); }
.stepper .n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 1px solid var(--line2); }
.stepper .is-current { color: var(--text); font-weight: 600; }
.stepper .is-current .n, .stepper .is-done .n { border-color: transparent; color: var(--on-accent); background: var(--grad); }
.stepper .is-done:not(:last-child)::after { background: var(--accent2); }
.card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .6); }
.card h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 18px; }
.panel .card { scroll-margin-top: 76px; } /* 滚动定位时让出吸顶导航栏的高度 */
.num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; color: var(--accent); background: color-mix(in srgb, var(--accent2) 16%, transparent); }

/* ---------- 表单 ---------- */
.input { width: 100%; padding: 13px 14px; font-size: 16px; color: var(--text); background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--line2); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent2) 22%, transparent); }
.input.is-ok { border-color: var(--ok); }
.input.is-err { border-color: var(--err); }
.input.is-err:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 22%, transparent); }
.mono.input { letter-spacing: .04em; }
.textarea { resize: vertical; min-height: 120px; font-size: 13px; line-height: 1.5; letter-spacing: 0; }
.code-row { display: flex; align-items: center; gap: 10px; }
.tag { flex: none; padding: 5px 10px; font-size: 13px; font-weight: 600; border-radius: 999px; color: var(--accent); background: color-mix(in srgb, var(--accent2) 16%, transparent); }
.hint { margin: 8px 0 16px; min-height: 1.6em; font-size: 14px; color: var(--muted); }
.hint.is-ok { color: var(--ok); }
.hint.is-err { color: var(--err); }
.hint.is-warn { color: var(--warn); }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 16px 0 8px; font-size: 14px; font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn { position: relative; width: 100%; padding: 13px 20px; font-size: 16px; font-weight: 700; color: var(--on-accent);
  background: var(--grad); border: 0; border-radius: 999px; cursor: pointer; box-shadow: var(--glow); transition: transform .12s, filter .15s, opacity .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; box-shadow: none; }
/* 不可点时用中性灰，半透明的橙色渐变看起来发脏 */
.btn:disabled:not(.is-loading):not(.btn-ghost) { color: var(--muted); background: var(--line); }
.btn-ghost:disabled { opacity: .5; }
.btn.is-loading { color: transparent; opacity: 1; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--on-accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.btn-ghost { color: var(--text); background: transparent; border: 1px solid var(--line2); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: var(--line); filter: none; }
.link-btn { padding: 0; font: inherit; font-size: 13px; font-weight: 500; color: var(--accent); background: none; border: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row .btn { flex: 1 1 180px; width: auto; }

/* ---------- 查询结果 ---------- */
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.result-product { font-size: 18px; font-weight: 700; }
.badge { flex: none; padding: 4px 10px; font-size: 13px; font-weight: 600; border-radius: 999px; border: 1px solid currentColor; }
.badge.unused { color: var(--ok); }
.badge.processing { color: var(--info); }
.badge.used { color: var(--muted); }
.badge.void { color: var(--err); }
.info { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: 14px; }
.info:empty { display: none; }
.info dt { color: var(--muted); }
.info dd { margin: 0; word-break: break-all; }
.howto { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.howto li + li { margin-top: 4px; }
.howto strong { color: var(--text); }
.preview { display: grid; gap: 6px; margin: 0 0 16px; padding: 12px 14px; font-size: 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--ok) 9%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.preview div { display: flex; justify-content: space-between; gap: 12px; }
.confirm { margin: 0 0 16px; padding: 16px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--accent2) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent2) 35%, transparent); }
.confirm-text { margin: 0 0 4px; font-weight: 600; }
.confirm .row { margin-top: 12px; }

/* ---------- 兑换结果 ---------- */
.status { text-align: center; }
.status h2 { justify-content: center; margin: 14px 0 6px; font-size: 20px; }
.status p { margin: 0 0 6px; }
.status .btn { margin-top: 14px; }
.status-icon { position: relative; width: 60px; height: 60px; margin: 4px auto 0; border-radius: 50%; border: 3px solid currentColor; }
.status.processing .status-icon { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.status.success .status-icon { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status.success .status-icon::after { content: ""; position: absolute; left: 19px; top: 11px; width: 13px; height: 24px; border: solid currentColor; border-width: 0 4px 4px 0; transform: rotate(45deg); }
.status.failed .status-icon { color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.status.failed .status-icon::before, .status.failed .status-icon::after { content: ""; position: absolute; left: 25px; top: 13px; width: 4px; height: 28px; border-radius: 2px; background: currentColor; }
.status.failed .status-icon::before { transform: rotate(45deg); }
.status.failed .status-icon::after { transform: rotate(-45deg); }
.status.pending .status-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.status.pending .status-icon::before { content: ""; position: absolute; left: 25px; top: 11px; width: 4px; height: 17px; border-radius: 2px; background: currentColor; }
.status.pending .status-icon::after { content: ""; position: absolute; left: 25px; top: 25px; width: 14px; height: 4px; border-radius: 2px; background: currentColor; }
.wait { display: none; margin: 14px 0 4px; }
.status.processing .wait { display: block; }
.bar { position: relative; height: 6px; margin: 0 auto 10px; max-width: 320px; overflow: hidden; border-radius: 99px; background: var(--line); }
.bar span { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 99px; background: var(--grad); animation: slide 1.6s ease-in-out infinite; }

/* ---------- 常见问题 / 页脚 / 提示 ---------- */
.faq { max-width: 560px; margin: 24px auto 0; padding: 0 16px; outline: none; }
.faq h2 { margin: 0 0 12px; font-size: 20px; }
.faq details { margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.faq summary { padding: 14px 16px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 16px 14px; color: var(--muted); font-size: 14px; }
.foot { max-width: 560px; margin: 28px auto 0; padding: 20px 16px 40px; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.foot p { margin: 0; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 18px; font-size: 14px; color: var(--text); background: var(--card-solid);
  border: 1px solid var(--line2); border-radius: 999px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .6); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { 0% { left: -40%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
  .bar span { left: 0; width: 100%; opacity: .6; }
}
@media (max-width: 560px) {
  .hero { padding: 40px 18px 20px; }
  .lead { font-size: 16px; }
  .nav-links { display: none; }
  .card { padding: 18px; }
  .stepper .t { font-size: 13px; }
  .stepper li:not(:last-child)::after { margin: 0 6px; }
}