* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f1117;
  color: #e8eaef;
  line-height: 1.5;
}

.container { max-width: 1000px; margin: 0 auto; padding: 2rem 1rem; }

header { text-align: center; margin-bottom: 2rem; }
header h1 { font-size: 1.75rem; }
.subtitle { color: #8b92a8; margin-top: 0.25rem; }

.status-bar {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  background: #1a1d27;
  border: 1px solid #2e3345;
}

.status-bar.ok { background: rgba(34,197,94,0.15); color: #4ade80; border-color: #166534; }
.status-bar.err { background: rgba(239,68,68,0.15); color: #f87171; border-color: #991b1b; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: #1a1d27;
  border: 1px solid #2e3345;
  border-radius: 12px;
  padding: 1.5rem;
}

.card h2 { font-size: 1.1rem; margin-bottom: 0.25rem; }

label { display: block; font-size: 0.85rem; color: #8b92a8; margin: 1rem 0 0.35rem; }

input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #2e3345;
  border-radius: 8px;
  background: #242836;
  color: #e8eaef;
  font-size: 0.95rem;
}

.camera-box {
  position: relative;
  background: #000;
  border-radius: 12px;
  aspect-ratio: 4/3;
  overflow: hidden;
  margin-top: 1rem;
  border: 2px solid #2e3345;
}

.camera-box.active { border-color: #4f7cff; }

video, canvas { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Mirror preview so left/right matches what the user sees in a selfie */
.camera-box video { transform: scaleX(-1); }

.challenge-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.6) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  pointer-events: none;
}

.challenge-steps {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 0.3s;
}

.step-dot.active { background: #4f7cff; transform: scale(1.3); box-shadow: 0 0 12px #4f7cff; }
.step-dot.done { background: #22c55e; }

.challenge-text {
  font-size: 1.35rem;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  margin: auto 0;
}

.countdown {
  font-size: 3rem;
  font-weight: 700;
  color: #4f7cff;
  text-shadow: 0 0 20px rgba(79,124,255,0.6);
  min-height: 3.5rem;
}

.hidden { display: none !important; }

.actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

.btn {
  padding: 0.65rem 1.2rem;
  border: 1px solid #2e3345;
  border-radius: 8px;
  background: #242836;
  color: #e8eaef;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn:hover { background: #2e3345; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #4f7cff; border-color: #4f7cff; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #3d6aef; }

.result {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #0a0c10;
  color: #86efac;
  border-radius: 8px;
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre-wrap;
  border: 1px solid #2e3345;
}

.result.fail { color: #fca5a5; border-color: #7f1d1d; }

footer {
  text-align: center;
  margin-top: 2rem;
  color: #8b92a8;
  font-size: 0.85rem;
}
