/**
 * screens.css — per-screen layout and component styles.
 * Author: Frankie (frontend-coder)
 */

/* ══════════════════════════════════════════════════════════════════════
   GLOBAL GUARD — [hidden] must ALWAYS hide.
   The HTML hidden attribute only applies display:none at UA-stylesheet
   priority, so ANY authored `display:` rule on the same element silently
   defeats it. That exact failure kept the movements "Submitting…" overlay
   (display:flex) visible from mount for a full day — dark scrim over the
   camera, tracking invisible underneath. A sweep found 10 more elements
   with the same latent bug (flip-overlay, freeze-overlay, side-pip, …).
   This one rule retires the whole bug class. NEVER remove.
   ══════════════════════════════════════════════════════════════════════ */
[hidden] { display: none !important; }

/* ══════════════════════════════════════════════════════════════════════
   SCREEN 1 — INTRO (light, airy)
   ══════════════════════════════════════════════════════════════════════ */
.screen-intro {
  background: var(--surface-light);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.intro-eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gray);
  margin-bottom: 10px;
}

.intro-heading {
  font-family: var(--font-heading);
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-black);
  margin-bottom: 10px;
}

.intro-sub {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-gray);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* What you'll need card */
.needs-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.needs-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-gray);
}

.needs-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.needs-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-black);
  font-weight: 500;
}

.needs-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-light-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-gray);
}

/* Camera heads-up card */
.camera-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.camera-card-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  color: var(--color-gray);
  margin-top: 1px;
}

.camera-card-text {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  line-height: 1.55;
}

/* Privacy line — anchors directly above the CTA as one connected unit.
   margin-top: auto pushes it (and the CTA below it) to the bottom;
   whitespace collapses above, not between the lock line and the button. */
.privacy-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: auto;
  margin-bottom: 16px;
}

.privacy-icon {
  flex-shrink: 0;
  color: var(--color-gray-light);
  margin-top: 1px;
}

.privacy-text {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-gray-light);
  line-height: 1.55;
}

/* CTA section — no auto margin; privacy-line pulls both to the bottom */
.intro-cta-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.intro-cta-section .btn-primary {
  margin-bottom: 4px;
}

/* "I don't have my ID" secondary link */
.no-id-link {
  font-size: 13px;
  color: var(--color-gray);
  margin-top: 6px;
}

/* All LIGHT screens fill from y=0 (so the dark capture screen can be full-bleed
   behind the header). Light screens therefore need to clear the fixed 56px
   header themselves, with breathing room — otherwise the heading jams against it. */
#screenViewport .screen-intro,
#screenViewport .screen-doc-review,
#screenViewport .screen-completion {
  padding-top: calc(56px + env(safe-area-inset-top) + 24px);
}

/* Fix 2: Screen 4 (liveness intro) gets extra top room so the header
   doesn't clip — 24px → 32px breathing room after the shell header. */
#screenViewport .screen-liveness-intro {
  padding-top: calc(56px + env(safe-area-inset-top) + 32px);
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 2 — DOCUMENT CAPTURE (dark, camera-forward)
   ══════════════════════════════════════════════════════════════════════ */
.screen-capture {
  background: var(--surface-dark);
  min-height: 100dvh;
  position: relative;   /* anchor for the full-bleed camera stage */
  display: flex;
  flex-direction: column;
}

/* ── Capture top bar: back button + side indicator ─────────────────── */
.capture-topbar {
  position: relative;
  z-index: 2;              /* float above the full-bleed camera */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  /* clear the fixed 56px shell header */
  padding: calc(56px + env(safe-area-inset-top) + 8px) 10px 0;
  gap: 8px;
}

.capture-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.capture-back-btn:hover   { color: var(--color-white); background: rgba(255,255,255,0.08); }
.capture-back-btn:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  color: var(--color-white);
}

/* Side indicator — only visible for 2-side doc types */
.capture-side-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  /* visibility toggled via JS; hidden for 1-side types */
}

/* The two pips (front / back) */
.side-pip {
  display: block;
  width: 22px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.18);
  transition: background var(--dur-fast) var(--ease-out),
              width var(--dur-fast) var(--ease-out);
}

.side-pip--done    { background: rgba(255,255,255,0.55); }
.side-pip--current { background: rgba(255,255,255,0.90); width: 32px; }

.side-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  margin-left: 2px;
  transition: color var(--dur-fast) var(--ease-out);
}

/* ── Flip overlay (between front and back capture) ─────────────────── */
.flip-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11,14,20,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-screen) var(--ease-out);
}

.flip-overlay.flip--active {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .flip-overlay { transition: none; }
}

.flip-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 0 32px;
}

.flip-instruction {
  font-family: var(--font-body);
  font-size: 16px;
  color: rgba(255,255,255,0.80);
  line-height: 1.5;
}

.flip-instruction strong {
  color: var(--color-white);
  font-weight: 700;
}

/* Doc type segmented control */
.doc-type-bar {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  padding: 14px 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 2;              /* float above the full-bleed camera */
  background: linear-gradient(to bottom, rgba(11,14,20,0.78), rgba(11,14,20,0));
}

.doc-type-bar::-webkit-scrollbar { display: none; }

.doc-type-btn {
  flex: 0 0 auto;          /* size to content so text never overflows the pill */
  min-height: var(--touch-min);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.55);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.doc-type-btn:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
}

.doc-type-btn.active {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.35);
  color: var(--color-white);
}

/* Camera stage */
.camera-stage {
  /* Full-bleed: the camera fills the whole screen and the controls float on top,
     so the guide aperture centers on the SCREEN, not in a lower box. */
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}

.capture-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.capture-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Frozen frame overlay (shown after auto-capture) */
.freeze-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11,14,20,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  pointer-events: none;
}

.freeze-overlay.freeze--active {
  opacity: 1;
}

.freeze-check {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--color-success);
}

.freeze-check svg {
  animation: check-pop var(--dur-slow) var(--ease-out) forwards;
}

@keyframes check-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .freeze-check svg { animation: none; opacity: 1; }
}

.freeze-label {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Live state indicator */
.live-state-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  min-height: 52px;
  background: var(--surface-dark-2);
  border-top: 1px solid rgba(255,255,255,0.06);
  /* Push the live-state bar + the actions after it to the BOTTOM of the screen,
     floating over the full-bleed camera. */
  margin-top: auto;
  position: relative;
  z-index: 2;
}

.live-state-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease-out);
}

.live-state-text {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.80);
  transition: color var(--dur-fast) var(--ease-out);
  flex: 1;
}

/* State variants on live-state-bar */
.live-state-bar.state--idle .live-state-icon    { color: var(--color-gray-light); }
.live-state-bar.state--closer .live-state-icon  { color: var(--color-amber); }
.live-state-bar.state--glare .live-state-icon   { color: var(--color-amber); }
.live-state-bar.state--steady .live-state-icon  { color: var(--color-amber); }
.live-state-bar.state--ready .live-state-icon   { color: var(--color-success); }
.live-state-bar.state--ready .live-state-text   { color: var(--color-success); }
/* Error state: transient only, fades out */
.live-state-bar.state--error .live-state-icon   { color: var(--color-error-text); opacity: 0.6; }
.live-state-bar.state--error .live-state-text   { color: var(--color-error-text); opacity: 0.6; }

/* Manual capture + trouble section */
.capture-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 24px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface-dark);
  position: relative;
  z-index: 2;              /* float above the full-bleed camera */
}

/* Manual capture — visually secondary (not the hero) */
.btn-manual-capture {
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  padding: 11px 28px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.70);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.btn-manual-capture:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.50);
  color: var(--color-white);
}

.btn-manual-capture:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
}

.trouble-link {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
}

.trouble-link:hover { color: rgba(255,255,255,0.65); }
.trouble-link:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 2px;
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 3 STUB — kept for fallback (actual doc-review replaces it below)
   ══════════════════════════════════════════════════════════════════════ */
.screen-stub {
  background: var(--surface-light);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  gap: 16px;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.stub-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-success-bg);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success);
}

.stub-heading {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  color: var(--color-black);
  line-height: 1.2;
}

.stub-sub {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.6;
  max-width: 300px;
}

.stub-coming-tag {
  background: var(--surface-light-2);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-gray);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 3 — DOCUMENT REVIEW (light)
   ══════════════════════════════════════════════════════════════════════ */
.screen-doc-review {
  background: var(--surface-light);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  gap: 20px;
}

.doc-review-topbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-review-eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gray);
}

.doc-review-heading {
  font-family: var(--font-heading);
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-black);
}

.doc-review-sub {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.5;
}

/* Captured image cards */
.doc-review-images {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-review-image-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.doc-review-image-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
}

.doc-review-image-label {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gray);
}

.btn-retake {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-gray);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 4px 0;
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  display: inline-flex;
  align-items: center;
  transition: color var(--dur-fast) var(--ease-out);
}

.btn-retake:hover { color: var(--color-black); }
.btn-retake:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 2px;
}

.doc-review-image-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--surface-light-2);
  overflow: hidden;
  position: relative;
}

.doc-review-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.doc-review-image-wrap--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-review-placeholder-text {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray-light);
}

/* Extracted fields */
.doc-review-fields-section {
  background: var(--surface-card);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-review-fields-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.doc-review-fields-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gray);
}

.doc-review-fields-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  /* Lifted from gray-light (3:1) → gray (7:1) to clear WCAG AA at 12px */
  color: var(--color-gray);
}

.fields-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-amber);
  animation: status-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

/* Read failed — caution copy, and the pulsing dot stops (no longer "reading"). */
.doc-review-fields-status--failed { color: var(--color-amber); }
.doc-review-fields-status--failed .fields-status-dot { animation: none; }

/* Fix 3: ONE conditional reason line shown ONLY on a genuine read failure.
   Cool-gray (secondary/muted), NOT alarm-red. Hidden on clean/successful reads —
   this element is inserted by JS only when showReadFailed() fires. */
.doc-review-read-fail-reason {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);     /* cool-gray — muted secondary, not alarm */
  line-height: 1.55;
  padding: 8px 12px;
  background: var(--surface-light);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--surface-light-2);
}

/* Fix 3: empty-after-reading fields → muted "Not detected", not alarm-red and
   not the same weight as a real value. Extends field-value--pending tone. */
.field-value--not-detected {
  color: var(--color-gray-light);   /* lighter than gray — clearly secondary */
  font-weight: 400;
  font-style: italic;
  font-size: 13px;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .fields-status-dot { animation: none; }
}

.doc-review-fields-pending {
  font-family: var(--font-body);
  font-size: 13px;
  /* Lifted from gray-light (3:1) → gray (7:1) — honest placeholders must be legible */
  color: var(--color-gray);
  line-height: 1.55;
  padding: 10px 14px;
  background: var(--surface-light);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--surface-light-2);
}

.doc-review-fields-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.doc-review-field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-light-2);
}

.doc-review-field-row:last-child { border-bottom: none; }

.field-label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  font-weight: 500;
  flex-shrink: 0;
}

.field-value {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-black);
  text-align: right;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.field-value--pending {
  /* Lifted from gray-light (3:1) → gray (7:1) — pending "—" must read at AA */
  color: var(--color-gray);
  font-weight: 400;
}

/* Actions */
.doc-review-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.doc-review-retake-all {
  font-size: 13px;
  color: var(--color-gray);
  margin-top: 4px;
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 4 — LIVENESS INTRO (light)
   ══════════════════════════════════════════════════════════════════════ */
/* Fix 2: raised top-pad (was 28px → 32px via the shared rule override below) and
   widened inter-section gap (was 20px → 26px) so the consent screen reads calm,
   not cramped. Copy is VERBATIM — this is spacing only. */
.screen-liveness-intro {
  background: var(--surface-light);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 28px 24px calc(32px + env(safe-area-inset-bottom));
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  gap: 26px;
}

.liveness-intro-eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gray);
}

/* Fix 2: removed negative margin-top from heading and sub — the gap on
   .screen-liveness-intro now controls inter-section spacing cleanly. */
.liveness-intro-heading {
  font-family: var(--font-heading);
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-black);
}

.liveness-intro-sub {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-gray);
  line-height: 1.65;
}

/* What to expect card */
.liveness-steps-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.liveness-steps-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gray);
}

.liveness-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0;
}

.liveness-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-black);
  font-weight: 500;
  line-height: 1.5;
}

.liveness-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-light-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-gray);
  flex-shrink: 0;
  font-family: var(--font-heading);
  margin-top: 1px;
}

/* Tips card */
.liveness-tips-card {
  background: var(--surface-light-2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.liveness-tips-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.liveness-tips-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  line-height: 1.4;
}

.liveness-tips-icon {
  flex-shrink: 0;
  color: var(--color-gray-light);
  display: flex;
  align-items: center;
}

/* CTA section */
.liveness-intro-cta-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.liveness-intro-cta-section .btn-primary { margin-bottom: 4px; }

.liveness-back-link {
  font-size: 13px;
  color: var(--color-gray);
  margin-top: 6px;
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 5 — LIVE FACE DETECTION (dark)
   ══════════════════════════════════════════════════════════════════════ */
.screen-face-detect {
  background: var(--surface-dark);
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.face-detect-topbar {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: calc(56px + env(safe-area-inset-top) + 8px) 10px 0;
  gap: 8px;
}

.face-detect-step-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
}

/* Camera stage */
.face-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
}

/* Mirror the PREVIEW — feels natural to user. Raw frames sent to /pose un-mirrored. */
.face-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}

.face-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* canvas is NOT mirrored — draw guide in visual space (matches the mirrored video) */
  transform: scaleX(-1);
}

/* Live state bar */
.face-live-bar {
  flex-shrink: 0;
  padding: 14px 20px;
  background: var(--surface-dark-2);
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
  position: relative;
  z-index: 2;
  min-height: 52px;
  display: flex;
  align-items: center;
}

.face-live-text {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,0.80);
  transition: color var(--dur-fast) var(--ease-out);
}

/* State variants — icon+text+color all vary so no state is color-only.
   Ready = gold (earned, not ambient). Never green on the face screen —
   green signals "passed", which this is not until the server confirms. */
.face-live-bar.face-state--ready .face-live-text  { color: var(--color-cta); }
.face-live-bar.face-state--center .face-live-text,
.face-live-bar.face-state--steady .face-live-text,
.face-live-bar.face-state--light .face-live-text  { color: var(--color-amber); }
.face-live-bar.face-state--error .face-live-text  { color: var(--color-error-text); opacity: 0.7; }

/* Help row */
.face-help-row {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 12px 24px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface-dark);
  position: relative;
  z-index: 2;
}

.face-help-link {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  text-align: center;
}

.face-help-link:hover { color: rgba(255,255,255,0.65); }
.face-help-link:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 2px;
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 6 — GUIDED MOVEMENTS (dark)
   ══════════════════════════════════════════════════════════════════════ */
.screen-movements {
  background: var(--surface-dark);
  min-height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.movements-topbar {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: calc(56px + env(safe-area-inset-top) + 8px) 10px 0;
  gap: 8px;
}

.movements-step-track {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
}

/* Camera stage — mirrored like face-detect */
.movements-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.movements-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);  /* mirror for natural feel */
}

/* Progress ring — centered over the video */
.movements-ring-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);  /* slight upward shift — face sits high */
  z-index: 1;
  pointer-events: none;
}

.movements-ring-svg {
  filter: drop-shadow(0 2px 12px rgba(0,0,0,0.40));
}

/* Progress/ready arc + directional arrow — smooth colour + reveal.
   Ring is GOLD while armed ("ready — move now"), GREEN on complete. */
#movementsRingArc {
  transition: stroke-dashoffset var(--dur-fast) var(--ease-out),
              stroke var(--dur-fast) var(--ease-out);
}
#movementsRingArrow {
  transition: opacity var(--dur-fast) var(--ease-out);
}

/* Confirm check (shown after movement complete) */
.movements-ring-check {
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.movements-ring-check--visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .movements-ring-check,
  #movementsRingArc,
  #movementsRingArrow { transition: none; }
}

/* Instruction strip */
.movements-instruction-wrap {
  flex-shrink: 0;
  margin-top: auto;
  padding: 16px 20px 6px;
  background: var(--surface-dark-2);
  border-top: 1px solid rgba(255,255,255,0.06);
  position: relative;
  z-index: 2;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.movements-instruction {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.3;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.movements-instruction-sub,
.movements-instruction-sub--polite {
  font-family: var(--font-body);
  font-size: 13px;
  /* Lifted from 0.50 → 0.62 on --surface-dark-2 to clear WCAG AA 4.5:1 for 13px text.
     The face-lost message is load-bearing — must be legible at a glance. */
  color: rgba(255,255,255,0.62);
  min-height: 18px;
  transition: color var(--dur-fast) var(--ease-out);
}

/* Help row */
.movements-help-row {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  padding: 10px 24px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface-dark);
  position: relative;
  z-index: 2;
}

.movements-help-link {
  font-size: 13px;
  color: rgba(255,255,255,0.30);
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  text-align: center;
}

.movements-help-link:hover { color: rgba(255,255,255,0.60); }
.movements-help-link:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Submit overlay — covers the movements screen while the POST is in flight.
   (The global `[hidden] { display:none !important }` rule at the top of this
   file guarantees it stays hidden until doSubmitAndComplete un-hides it.) */
.movements-submit-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(9, 11, 14, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.movements-submit-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px;
}

.movements-submit-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--color-cta);
  border-radius: 50%;
  animation: movements-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .movements-submit-spinner { animation: none; border-top-color: var(--color-cta); }
}

.movements-submit-text {
  font-family: var(--font-body);
  font-size: 15px;
  color: rgba(255,255,255,0.75);
  text-align: center;
  line-height: 1.5;
}

.movements-submit-retry-btn {
  margin-top: 4px;
  color: var(--color-cta);
  border-color: var(--color-cta);
  min-width: 120px;
}

/* No-face banner — shown when the sidecar returns faceDetected:false for
   NO_FACE_BANNER_FRAMES consecutive frames. Prominent amber pill sitting
   ABOVE the step instruction text inside .movements-instruction-wrap.
   hidden attribute hides it; JS removes hidden when the threshold is met. */
.movements-no-face-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;                      /* sits just above the instruction text */
  padding: 11px 14px;
  background: rgba(201, 148, 0, 0.18);   /* amber tint — on-brand warning */
  border: 1px solid rgba(201, 148, 0, 0.50);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: #F5C842;                         /* readable warm amber on dark */
  line-height: 1.4;
  text-align: left;
}

.movements-no-face-banner[hidden] { display: none; }

.movements-no-face-icon {
  flex-shrink: 0;
  color: #F5C842;
}

/* Debug overlay — only shown when ?debug=1; sits at the very bottom of the screen
   so it never covers the instruction or ring. Remove block when debug is retired. */
.movements-debug-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + 4px);
  z-index: 20;
  background: rgba(0, 0, 0, 0.70);
  padding: 4px 12px;
  font-family: monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  pointer-events: none;
  user-select: none;
}


/* ══════════════════════════════════════════════════════════════════════
   SCREEN 7 — COMPLETION (light)
   ══════════════════════════════════════════════════════════════════════ */
.screen-completion {
  background: var(--surface-light);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 32px 24px calc(40px + env(safe-area-inset-bottom));
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
  gap: 20px;
  align-items: stretch;
}

.completion-icon-wrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.completion-icon-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-success-bg);
  border: 1px solid rgba(22, 163, 74, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: icon-in var(--dur-slow) var(--ease-out) forwards;
}

@keyframes icon-in {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .completion-icon-ring { animation: none; opacity: 1; }
}

.completion-eyebrow {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-success);
  margin-top: -8px;
}

.completion-heading {
  font-family: var(--font-heading);
  font-size: clamp(22px, 6.5vw, 30px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--color-black);
  margin-top: -8px;
}

.completion-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: -8px;
}

.completion-body p {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-gray);
  line-height: 1.6;
}

/* Art.22 "Your options" appeal card — legally-required human-review notice.
   These classes had NO styling, so on the light completion screen the text
   inherited a light colour and was invisible. Must always be readable. */
.completion-appeal-card {
  background: var(--color-amber-bg, rgba(201,148,0,0.10));
  border: 1px solid rgba(201,148,0,0.35);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.completion-appeal-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a6a00;
}
.completion-appeal-intro {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-black);
}
.completion-appeal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* What happens next card */
.completion-next-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.completion-next-title {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gray);
}

.completion-next-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.completion-next-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-black);
  font-weight: 500;
  line-height: 1.5;
}

.completion-next-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-success-bg);
  border: 1px solid rgba(22, 163, 74, 0.20);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-success);
  flex-shrink: 0;
  font-family: var(--font-heading);
  margin-top: 1px;
}

/* Privacy line */
.completion-privacy {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.completion-privacy-icon {
  flex-shrink: 0;
  color: var(--color-gray-light);
  margin-top: 1px;
  display: flex;
  align-items: center;
}

.completion-privacy-text {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-gray-light);
  line-height: 1.55;
}

/* CTA */
.completion-cta-section {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}


/* ══════════════════════════════════════════════════════════════════════
   SHARED BRANCH / OVERLAY SHEETS — Camera denied + Human review
   ══════════════════════════════════════════════════════════════════════ */

/* iOS steps list inside camera-denied sheet */
.camera-denied-ios-steps {
  list-style: none;
  counter-reset: ios-step;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.camera-denied-ios-steps li {
  counter-increment: ios-step;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-gray);
  line-height: 1.5;
}

.camera-denied-ios-steps li::before {
  content: counter(ios-step);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-light-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-gray);
  flex-shrink: 0;
  font-family: var(--font-heading);
}

.camera-denied-steps {
  text-align: left;
}

/* Human review option row */
.human-review-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface-light);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.human-review-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-light-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-gray);
  margin-top: 2px;
}

.human-review-option-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.human-review-option-text strong {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-black);
}

.human-review-option-text span {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════════════════
   COMPLIANCE COMPONENTS — shared across intro + liveness-intro screens
   ══════════════════════════════════════════════════════════════════════ */

/* "Read privacy notice" / "Read full consent" inline text-links */
.privacy-read-link,
.compliance-read-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: inherit;
  color: var(--color-cta);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  min-height: var(--touch-min);
  display: inline;
  line-height: inherit;
}
.privacy-read-link:hover,
.compliance-read-link:hover {
  color: var(--color-cta-hover);
}
.privacy-read-link:focus-visible,
.compliance-read-link:focus-visible {
  outline: 2px solid var(--color-cta);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Draft marker — amber warning at the top of a compliance sheet */
.compliance-draft-marker {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-amber);
  background: var(--color-amber-bg);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  text-align: center;
}

/* Loading spinner text */
.compliance-loading {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-gray);
  text-align: center;
  padding: 16px 0;
  animation: compliancePulse 1.2s ease-in-out infinite;
}
@keyframes compliancePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* Scrollable document body inside the sheet */
.compliance-doc-body {
  max-height: 55dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 2px;
  text-align: left;
}
.compliance-doc-body:empty {
  display: none;
}

/* Markdown element styles — scoped inside .compliance-doc-body */
.compliance-doc-body .compliance-md-h1,
.compliance-doc-body .compliance-md-h2,
.compliance-doc-body .compliance-md-h3 {
  font-family: var(--font-heading);
  color: var(--color-black);
  margin: 14px 0 6px;
  line-height: 1.25;
}
.compliance-doc-body .compliance-md-h1 { font-size: 16px; }
.compliance-doc-body .compliance-md-h2 { font-size: 15px; }
.compliance-doc-body .compliance-md-h3 { font-size: 14px; }

.compliance-doc-body .compliance-md-p {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  line-height: 1.65;
  margin: 0 0 8px;
}

.compliance-doc-body .compliance-md-ul,
.compliance-doc-body .compliance-md-ol {
  margin: 0 0 8px 18px;
  padding: 0;
}
.compliance-doc-body .compliance-md-ul li,
.compliance-doc-body .compliance-md-ol li {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  line-height: 1.55;
  margin-bottom: 4px;
}

.compliance-doc-body hr {
  border: none;
  border-top: 1px solid var(--surface-light-2);
  margin: 12px 0;
}

/* ── BIOMETRIC CONSENT GATE CARD (screen-liveness-intro) ──────────────── */
.consent-gate-card {
  background: var(--surface-light);
  border: 1px solid var(--surface-light-2);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.consent-gate-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.consent-gate-icon {
  color: var(--color-cta);
  flex-shrink: 0;
}

.consent-gate-title {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-black);
  letter-spacing: 0.02em;
}

.consent-gate-summary {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-gray);
  line-height: 1.6;
}

/* Accept checkbox label */
.consent-accept-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 4px 0;
}
.consent-accept-label input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--color-cta);
  cursor: pointer;
}
.consent-accept-label span {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-black);
  line-height: 1.55;
}

/* Manual verification fallback */
.consent-manual-fallback {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-gray-light);
  line-height: 1.5;
}
.consent-manual-note {
  font-style: italic;
  color: var(--color-gray-muted);
}

/* Start button disabled state */
#livenessStartBtn:disabled,
#livenessStartBtn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
