/* ============ 南山心率检测 · H5 样式 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #070b16;
  --surface: #101527;
  --surface2: #161d33;
  --accent: #4f7cff;
  --accent2: #7c5cff;
  --green: #34d399;
  --red: #f87171;
  --amber: #f59e0b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 18px;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(79, 124, 255, 0.18), transparent),
    radial-gradient(ellipse 70% 40% at 85% 90%, rgba(124, 92, 255, 0.1), transparent);
  background-attachment: fixed;
  line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom);
}

.app { max-width: 520px; margin: 0 auto; padding: 16px 16px 0; }

/* ---------- 顶部 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 18px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.logo {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 20px rgba(79, 124, 255, 0.4);
  font-size: 20px;
}

.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.brand p { font-size: 11.5px; color: var(--muted); }

.price-chip {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.28), rgba(124, 92, 255, 0.28));
  border: 1px solid rgba(124, 92, 255, 0.45);
  white-space: nowrap;
}

/* ---------- 卡片 ---------- */
.card {
  background: linear-gradient(180deg, rgba(22, 29, 51, 0.9), rgba(16, 21, 39, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-title { font-size: 14px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--muted); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(79, 124, 255, 0.15);
  border: 1px solid rgba(79, 124, 255, 0.35);
  color: #a9c1ff;
}

.tag.demo { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: #fbbf24; }
.tag.live { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); color: #6cf39a; }

/* ---------- 舞台 ---------- */
.stage { padding: 14px; }

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 40%, #131a2e, #05070f 75%);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

#video { width: 100%; height: 100%; object-fit: cover; display: none; }
#canvas { display: none; }

.demo-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.stage-idle {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  pointer-events: none;
}

.stage-idle .pulse-ring {
  width: 92px; height: 92px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 32px;
  background: radial-gradient(circle, rgba(79, 124, 255, 0.35), rgba(79, 124, 255, 0.05) 70%);
  border: 1px solid rgba(79, 124, 255, 0.35);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

.stage-idle p { font-size: 13px; color: var(--muted); }
.stage-idle b { color: var(--text); }

.cover-status {
  position: absolute;
  top: 10px; left: 10px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(6, 10, 20, 0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  transition: color 0.25s;
}

.demo-watermark {
  position: absolute;
  right: 10px; bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(6, 10, 20, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.25);
  display: none;
}

.demo-watermark.show { display: block; }

.bpm-overlay {
  position: absolute;
  left: 0; right: 0;
  bottom: 14px;
  text-align: center;
  pointer-events: none;
}

.bpm-value {
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
  color: var(--green);
  letter-spacing: -2px;
  text-shadow: 0 0 32px rgba(52, 211, 153, 0.45);
  font-variant-numeric: tabular-nums;
}

.bpm-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: 2px; }

/* ---------- 波形与进度 ---------- */
.waveform-wrap { margin-bottom: 12px; }
#waveform { width: 100%; height: 84px; display: block; border-radius: 10px; background: #101527; }

.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11.5px; color: var(--muted); margin-bottom: 6px;
}

.progress { height: 5px; background: var(--surface2); border-radius: 999px; overflow: hidden; margin-bottom: 14px; }

#progressBar {
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---------- 按钮 ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  min-height: 48px;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 8px 24px rgba(79, 124, 255, 0.35);
}

.btn.ghost { background: rgba(255, 255, 255, 0.06); color: var(--text); border: 1px solid var(--border); }

.btn.danger { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }

.btn.block { width: 100%; grid-column: 1 / -1; }

.btn-wechat { background: #07c160; color: #fff; }
.btn-alipay { background: #1677ff; color: #fff; }

/* ---------- 闪光灯 ---------- */
.torch-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 12px; padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px; color: var(--muted);
}

.toggle { position: relative; width: 38px; height: 22px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s;
}
.toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }

/* ---------- 次数提示 ---------- */
.pass-info {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #a7f3d0;
}
.pass-info.warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.28); color: #fcd34d; }
.pass-info[hidden] { display: none; }

/* ---------- 提示面板 ---------- */
.tips summary {
  cursor: pointer;
  list-style: none;
  font-size: 13.5px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}

.tips summary::-webkit-details-marker { display: none; }
.tips summary::after { content: "›"; font-size: 20px; color: var(--muted); transition: transform 0.2s; }
.tips[open] summary::after { transform: rotate(90deg); }

.tips ul { padding-left: 18px; margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.tips li b { color: var(--text); }

/* ---------- 使用说明动画 ---------- */
.guide-stage {
  position: relative;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 26% 52%, #141c31, #090d18 72%);
}

#guideCanvas {
  display: block;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  aspect-ratio: 400 / 220;
}

.guide-caption {
  margin-top: 10px;
  min-height: 2.6em;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- 付费墙 ---------- */
.paywall {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}

.paywall[hidden] { display: none; }

.paywall-card {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(180deg, #182039, #0e1425);
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  animation: sheet-up 0.28s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.paywall-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.paywall-head h2 { font-size: 17px; font-weight: 700; }
.paywall-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.close-btn {
  appearance: none; border: none; background: rgba(255, 255, 255, 0.07);
  color: var(--muted); width: 30px; height: 30px; border-radius: 50%;
  font-size: 16px; cursor: pointer; line-height: 1;
}

.pay-amount {
  display: flex; align-items: baseline; gap: 6px;
  margin-bottom: 4px;
}
.pay-amount .num { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; }
.pay-amount .unit { font-size: 16px; font-weight: 600; color: var(--muted); }
.pay-amount .per { font-size: 12.5px; color: var(--muted); margin-left: auto; }
.pay-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }

.pay-channels { display: grid; gap: 10px; }
.pay-channel-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px;
  border: none; border-radius: 14px;
  font-size: 15px; font-weight: 700; font-family: inherit; color: #fff;
  cursor: pointer;
}
.pay-channel-btn:disabled { opacity: 0.5; }
.pay-notice {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.7;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.pay-notice[hidden] { display: none; }
.pay-demo-link {
  display: block; width: 100%; margin-top: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 13px; font-family: inherit; cursor: pointer; padding: 8px;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- 收银台 ---------- */
.cashier { max-width: 460px; margin: 0 auto; padding: 24px 16px 40px; }
.cashier-card {
  background: linear-gradient(180deg, rgba(22, 29, 51, 0.95), rgba(16, 21, 39, 0.95));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
.cashier-amount { font-size: 38px; font-weight: 800; letter-spacing: -1.5px; margin: 6px 0 2px; }
.cashier-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; }
.qr-box {
  display: inline-block; padding: 12px; background: #fff; border-radius: 14px; margin-bottom: 8px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}
.qr-box img { display: block; width: 240px; height: 240px; }
.qr-hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 16px; line-height: 1.7; }
.cashier-status {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 12.5px; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border); color: var(--muted);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: blink 1.2s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.cashier-back { display: block; margin-top: 18px; color: var(--muted); font-size: 13px; text-decoration: none; }

/* ---------- 底部备案信息（简化 H5 版） ---------- */
.site-footer {
  max-width: 520px;
  margin: 24px auto 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.footer-license {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: rgba(148, 163, 184, 0.75);
  line-height: 1.8;
}

.footer-license a { color: inherit; text-decoration: none; }
.footer-license .sep { opacity: 0.55; }

@media (min-width: 720px) {
  .app { max-width: 640px; padding-top: 24px; }
  .app .stage { padding: 18px; }
  .site-footer { max-width: 640px; }
}

@media (max-width: 360px) {
  .brand h1 { font-size: 15px; }
  .price-chip { font-size: 12px; padding: 5px 10px; }
  .bpm-value { font-size: 46px; }
}
