:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #222;
  --muted: #666;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #22c55e;
  --err: #ef4444;
  --border: #e5e7eb;
  --soft: #f3f4f6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 'Tajawal', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.hidden { display: none !important; }

h1 {
  font-size: 22px;
  margin: 0 0 12px;
  text-align: center;
  font-weight: 700;
}

h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 10px;
  text-align: center;
}

.lede {
  color: var(--muted);
  text-align: center;
  margin: 0 0 16px;
}

.disclosure {
  background: var(--soft);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  text-align: right;
}

.disclosure ul {
  margin: 0;
  padding-inline-start: 20px;
  color: var(--muted);
}

.disclosure li + li {
  margin-top: 6px;
}

.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--soft);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  cursor: pointer;
}

.consent-row input {
  margin-top: 4px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

button, .primary {
  display: block;
  width: 100%;
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, opacity .2s, transform .05s;
}

button:hover, .primary:hover { background: var(--accent-hover); }
button:active, .primary:active { transform: translateY(1px); }
button:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.fineprint {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin: 12px 0 0;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}

#cam, #overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay { pointer-events: none; }

.prompt {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 6px;
}

.progress-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background .2s, transform .2s;
}

.progress-dots .dot.active {
  background: var(--accent);
  transform: scale(1.25);
}

.progress-dots .dot.done {
  background: var(--ok);
}

.step-counter {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  letter-spacing: .04em;
}

.status {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
  text-align: center;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

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

progress {
  width: 100%;
  height: 8px;
  appearance: none;
  margin-top: 14px;
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress:indeterminate {
  background: linear-gradient(90deg, var(--border) 30%, var(--accent) 50%, var(--border) 70%) 0 0/200% 100%;
  border-radius: 999px;
  animation: indeterminate 1.2s linear infinite;
}
@keyframes indeterminate { to { background-position: -200% 0; } }

#step-success h1 { color: var(--ok); }
#step-error h1 { color: var(--err); }
#step-capture h1,
#step-upload h1 { margin-bottom: 14px; }
#step-upload p,
#step-success p,
#step-error p { text-align: center; color: var(--muted); margin: 0 0 4px; }
#error-message { color: var(--muted); margin-bottom: 16px; }

#redirect-link {
  display: inline-block;
  margin-top: 10px;
}
