:root {
  color-scheme: light;
  --primary: #1E40AF;
  --primary-dark: #1D3A99;
  --success: #059669;
  --error: #DC2626;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #1E293B;
  --muted: #64748B;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body[dir="rtl"] {
  direction: rtl;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}

.brand {
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
}

.lang-toggle {
  background: transparent;
  border: 1px solid #CBD5E1;
  color: var(--muted);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}

#screens {
  flex: 1;
  padding: 0 20px 32px;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.screen h1 {
  font-size: 22px;
  margin: 4px 0;
}

.screen p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
}

.icon {
  font-size: 56px;
  line-height: 1;
  margin-top: 12px;
}

.tips {
  text-align: start;
  color: var(--muted);
  font-size: 14px;
  padding-inline-start: 20px;
  margin: 8px 0;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  max-width: 320px;
  margin-top: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:disabled {
  background: #94A3B8;
  cursor: not-allowed;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.error-text {
  color: var(--error);
  font-size: 14px;
  margin-top: 4px;
}

.camera-wrap {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 3 / 4;
  background: #0D1B2A;
  border-radius: 20px;
  overflow: hidden;
}

.camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror front camera, matches what the user expects to see */
}

.oval-frame {
  position: absolute;
  inset: 12% 18%;
  border: 3px solid rgba(255,255,255,0.8);
  border-radius: 50% / 40%;
  pointer-events: none;
}

.step-prompt {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
}

.thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.thumbs img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid var(--success);
}

.capture-actions {
  width: 100%;
  display: flex;
  justify-content: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid #CBD5E1;
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
  margin-top: 40px;
}

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