/* face-verify-v1 — Active liveness using MediaPipe. Self-contained. */

* { box-sizing: border-box; }
body {
  margin: 0;
  background: #0f172a;
  color: white;
  font-family: var(--font-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.topbar .back {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  font-size: 22px;
  border-radius: 50%;
  color: white;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; }

.fv {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 30px 20px 40px;
}

.step {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: fade-in 0.25s ease-out;
}
.step[hidden] { display: none !important; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.step-icon {
  width: 80px; height: 80px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  display: grid;
  place-items: center;
}
.success-ic {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
}
.fail-ic {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
}

.step h2 { font-size: 22px; font-weight: 800; margin: 0 0 10px; letter-spacing: -0.01em; }
.step-desc {
  color: rgba(255,255,255,0.72);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 22px;
}
.step-desc b { color: white; }
.step-desc small { font-size: 12px; opacity: 0.7; }
.step-foot {
  margin-top: 18px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  line-height: 1.6;
}

.bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  text-align: left;
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.78);
}
.bullets li::before {
  content: "✓ ";
  color: #34d399;
  font-weight: 800;
  margin-right: 4px;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  font-weight: 800;
  font-size: 15px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
  transition: transform 0.05s, box-shadow 0.2s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(99, 102, 241, 0.55); }
.primary-btn:active { transform: translateY(0); }
.primary-btn:disabled {
  background: rgba(255,255,255,0.12);
  cursor: not-allowed;
  box-shadow: none;
  color: rgba(255,255,255,0.4);
}

.cancel-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-weight: 500;
  margin-top: 20px;
}
.cancel-btn:hover { color: white; }

/* === Loading spinner === */
.spinner {
  width: 60px; height: 60px;
  margin: 0 auto 22px;
  border: 4px solid rgba(99, 102, 241, 0.18);
  border-top-color: #a5b4fc;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Camera capture === */
.cam-wrap {
  position: relative;
  width: 260px; height: 260px;
  margin: 0 auto 18px;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
}
.cam-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(-1);   /* mirror like a selfie camera */
}
.cam-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  border: 3px solid rgba(99, 102, 241, 0.5);
  box-shadow: inset 0 0 0 6px rgba(0,0,0,0.4);
  transition: border-color 0.2s;
}
.cam-wrap.active .cam-ring { border-color: var(--primary); }
.cam-wrap.success .cam-ring { border-color: #34d399; }
.cam-wrap.warn .cam-ring { border-color: #fbbf24; }

.task-banner {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}
.task-icon { font-size: 28px; line-height: 1; }
.task-text { font-weight: 700; font-size: 15px; }

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.progress-dots .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  transition: background 0.2s, transform 0.2s;
}
.progress-dots .dot.done {
  background: #34d399;
  transform: scale(1.15);
}
.progress-dots .dot.active {
  background: var(--primary);
}

.live-stats {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, monospace;
  margin-bottom: 4px;
}
.live-stats b { color: rgba(255,255,255,0.7); font-weight: 600; margin-left: 4px; }
