/* 公共绑定页样式。只服务移动端为主的扫码场景，所以默认窄栏居中。 */

:root {
  --brand: #07c160;
  --brand-dark: #05a050;
  --ink: #1a1a1a;
  --ink-2: #5b6169;
  --ink-3: #8b919a;
  --line: #e8eaed;
  --bg: #f4f5f7;
  --card: #fff;
  --warn: #ff8f1f;
  --err: #e64340;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
               "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.page {
  max-width: 460px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

/* ── 头部 ─────────────────────────────────────────── */

.hd { text-align: center; padding: 8px 0 18px; }

.logo {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  padding: 4px 12px;
  border-radius: 999px;
}

.hd h1 {
  margin: 10px 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .5px;
}

.tagline {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

/* ── 卡片 ─────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .05);
  padding: 22px 18px 20px;
}

/* ── 二维码区 ─────────────────────────────────────── */

.qr-box { text-align: center; }

.qr-frame {
  position: relative;
  width: 232px;
  height: 232px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.qr-slot { width: 100%; height: 100%; }

/* qrcode-generator 的 createImgTag 会生成一张带 margin 的 <img>，
   这里强制铺满，长按识别区域也更大 */
.qr-slot img {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: -webkit-optimize-contrast;
}

.qr-mask {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, .94);
  color: var(--ink-2);
  font-size: 13px;
  text-align: center;
  padding: 0 14px;
}

.qr-mask[hidden] { display: none; }

.spin {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: tmk-spin .8s linear infinite;
}

@keyframes tmk-spin { to { transform: rotate(360deg); } }

.qr-countdown {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-3);
  min-height: 18px;
}

.qr-countdown.soon { color: var(--warn); font-weight: 600; }

/* ── 状态条 ───────────────────────────────────────── */

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f7f8fa;
  font-size: 14px;
  color: var(--ink-2);
}

.status .dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
}

.status .txt { flex: 1 1 auto; }

.status[data-state="loading"] .dot { background: var(--ink-3); }

.status[data-state="wait"] .dot {
  background: var(--brand);
  animation: tmk-pulse 1.6s ease-in-out infinite;
}

.status[data-state="scaned"] { background: #fff8e8; color: #9a6400; }
.status[data-state="scaned"] .dot { background: var(--warn); }

.status[data-state="confirmed"] { background: #e8f9ef; color: var(--brand-dark); }
.status[data-state="confirmed"] .dot { background: var(--brand); }

.status[data-state="expired"] { background: #fff8e8; color: #9a6400; }
.status[data-state="expired"] .dot { background: var(--warn); }

.status[data-state="error"] { background: #fdeeee; color: #a32f2d; }
.status[data-state="error"] .dot { background: var(--err); }

@keyframes tmk-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}

/* ── 步骤说明 ─────────────────────────────────────── */

.steps {
  margin: 18px 0 0;
  padding: 0 0 0 22px;
  color: var(--ink-2);
  font-size: 13px;
}

.steps li { margin: 5px 0; }
.steps li::marker { color: var(--brand); font-weight: 600; }

/* ── 结果区 ───────────────────────────────────────── */

.result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: #e8f9ef;
  border: 1px solid #c4eed6;
}

.result[hidden] { display: none; }

.result-row { font-size: 14px; color: #0a7a3d; font-weight: 600; }
.result-row.sub {
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 6px;
}
.result-row.sub[hidden] { display: none; }

.result.is-warn { background: #fff8e8; border-color: #ffe1b0; }
.result.is-warn .result-row { color: #9a6400; }

/* ── 按钮 ─────────────────────────────────────────── */

.actions { margin-top: 18px; text-align: center; }

.btn {
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}

.btn:active { background: var(--brand-dark); }
.btn:disabled { background: #c7ccd3; cursor: not-allowed; }

/* ── 错误提示 ─────────────────────────────────────── */

.err {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdeeee;
  color: #a32f2d;
  font-size: 13px;
  word-break: break-all;
}

.err[hidden] { display: none; }

/* ── 页脚 ─────────────────────────────────────────── */

.ft {
  text-align: center;
  padding: 20px 12px 0;
  font-size: 12px;
  color: var(--ink-3);
}

.ft p { margin: 4px 0; }
.ft .muted { color: #a5abb3; font-size: 11px; }

@media (max-width: 360px) {
  .qr-frame { width: 200px; height: 200px; }
  .card { padding: 18px 14px 16px; }
}
