:root {
  /* Background Colors */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f3f4;
  --bg-accent: #e8f0fe;

  /* Text Colors */
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --text-inverse: #ffffff;

  /* Brand Colors */
  --brand-primary: #1a73e8;
  --brand-primary-hover: #1557b0;
  --brand-secondary: #34a853;
  --brand-warning: #fbbc04;
  --brand-error: #ea4335;

  /* Surface Colors */
  --surface-default: #ffffff;
  --surface-variant: #f8f9fa;
  --surface-overlay: rgba(255, 255, 255, 0.95);

  /* Border Colors */
  --border-light: #e8eaed;
  --border-medium: #dadce0;
  --border-focus: #1a73e8;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.1);
  --shadow-md: 0 1px 3px 0 rgba(60, 64, 67, 0.15), 0 4px 8px 3px rgba(60, 64, 67, 0.1);
  --shadow-lg: 0 2px 6px 2px rgba(60, 64, 67, 0.15), 0 8px 24px 4px rgba(60, 64, 67, 0.1);
  --shadow-xl: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 12px 32px 8px rgba(60, 64, 67, 0.1);

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 50%;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Google Sans', Roboto, system-ui, sans-serif;
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}

/* Desktop Background Enhancement */
@media (min-width: 769px) {
  body {
    background: var(--bg-primary);
  }
}

/* Mobile App Container */
.mobile-app {
  min-height: 100vh;
  min-height: 100dvh;
  /* Dynamic viewport height for mobile browsers */
  display: flex;
  flex-direction: column;
}

/* Step Container - Full Screen on Mobile, Centered Card on Desktop */
.step-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 20px) env(safe-area-inset-right, 20px) env(safe-area-inset-bottom, 20px) env(safe-area-inset-left, 20px);
}

#processingStep {
  display: flex;
  align-items: center;
}

.information-message {
  background: var(--surface-variant);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1rem;
  max-width: 400px;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

/* Desktop Layout */
@media (min-width: 769px) {
  .mobile-app {
    justify-content: center;
    align-items: center;
    padding: 2rem;
  }

  .step-container {
    min-height: auto;
    max-width: 600px;
    width: 100%;
    background: var(--surface-default);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    margin: auto;
    justify-content: center;
  }

  #cameraStep.step-container {
    max-width: 800px;
    padding: 2rem;
  }

  .welcome-content {
    padding: 2rem 0;
  }

  .camera-container {
    min-height: 400px;
    max-height: 500px;
  }

  .step-content {
    padding: 1rem 0;
  }
}

/* Welcome Screen */
.welcome-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

.logo-container {
  margin-bottom: 1.5rem;
}

.app-logo {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(var(--shadow-sm));
}

h1 {
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.375rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

/* Desktop Typography */
@media (min-width: 769px) {
  .app-logo {
    font-size: 4rem;
  }

  h1 {
    font-size: 2.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .logo-container {
    margin-bottom: 2rem;
  }
}

.privacy-statement {
  background: var(--surface-variant);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  margin-top: 1em;
  max-width: 400px;
}

.privacy-statement p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* Step Content */
.step-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.step-header {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  padding-top: 1rem;
}

.back-btn {
  background: var(--surface-default);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.125rem;
  font-weight: 500;
  margin-right: 1rem;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.back-btn:hover {
  background: var(--surface-variant);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

/* Buttons */
.primary-btn {
  background: var(--brand-primary);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  min-width: 160px;
  position: relative;
  overflow: hidden;
}

.primary-btn:hover {
  background: var(--brand-primary-hover);
  box-shadow: var(--shadow-md);
}

.primary-btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-sm);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  background: var(--surface-default);
  border: 1px solid var(--border-medium);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.secondary-btn:hover {
  background: var(--surface-variant);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

/* Desktop
@media (min-width: 769px) {
  .primary-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    min-width: 180px;
  }

  .secondary-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .camera-controls {
    margin-top: 2rem;
  }

  .capture-btn {
    width: 80px;
    height: 80px;
  }

  .capture-inner {
    width: 60px;
    height: 60px;
  }
}

/* Input Fields */
.input-container {
  margin: 1.5rem 0;
  position: relative;
}

.modern-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--surface-default);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.modern-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.modern-input::placeholder {
  color: var(--text-muted);
}

.modern-input.invalid {
  border-color: var(--brand-error);
  animation: shake 0.3s ease-in-out;
}

/* Desktop Input Enhancements */
@media (min-width: 769px) {
  .modern-input {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
  }

  .input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem 0;
  }
}

.error-message {
  color: var(--brand-error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  opacity: 0;
  transition: var(--transition);
}

.error-message.show {
  opacity: 1;
}

/* Camera Styles */
.camera-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Allow flex children to shrink */
}

.camera-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-variant);
  border: 1px solid var(--border-light);
  min-height: 45vh;
  max-height: 55vh;
  box-shadow: var(--shadow-md);
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 50vh;
  max-height: 55vh;
  border-radius: var(--radius-lg);
  transform: scaleX(-1);
  /* Mirror the video horizontally for natural selfie view */
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: var(--radius-lg);
}

.camera-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.face-guide {
  /* Remove the static face guide circle for a cleaner look */
  display: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }

  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.status-message {
  background: var(--surface-default);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  margin: 1rem 0;
  color: var(--text-primary);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* Camera Controls */
.camera-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0 1rem;
  flex-shrink: 0;
}

.capture-btn {
  width: 72px;
  height: 72px;
  background: var(--surface-default);
  border: 3px solid var(--border-medium);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
}

.capture-btn:hover:not(:disabled) {
  transform: scale(1.05);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-lg);
}

.capture-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.capture-inner {
  width: 52px;
  height: 52px;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: var(--transition);
}

.capture-btn:active:not(:disabled) .capture-inner {
  transform: scale(0.9);
}

.secondary-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Preview Styles */
.preview-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}

.preview-image {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.preview-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 0 2rem;
}

.preview-controls .primary-btn {
  margin-bottom: 0.5rem;
}

/* Processing Styles */
.processing-content {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.processing-animation {
  margin-bottom: 2rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--brand-primary);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

/* Success Animation */
.success-icon {
  width: 64px;
  height: 64px;
  background: var(--brand-secondary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-inverse);
  animation: bounceIn 0.6s ease-out;
  box-shadow: var(--shadow-md);
}

/* Error Animation */
.error-icon {
  width: 64px;
  height: 64px;
  background: var(--brand-error);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-inverse);
  animation: bounceIn 0.6s ease-out;
  box-shadow: var(--shadow-md);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }

  70% {
    transform: scale(0.95);
  }

  100% {
    transform: scale(1);
  }
}

.processing-text {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.processing-details {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Status messages in processing */
.status-message.success {
  background: var(--bg-accent);
  border: 1px solid rgba(26, 115, 232, 0.2);
  color: var(--brand-primary);
}

.status-message.error {
  background: rgba(234, 67, 53, 0.1);
  border: 1px solid rgba(234, 67, 53, 0.2);
  color: var(--brand-error);
}

/* Responsive Design */
@media (max-width: 768px) {
  .step-container {
    padding: env(safe-area-inset-top, 10px) env(safe-area-inset-right, 10px) env(safe-area-inset-bottom, 10px) env(safe-area-inset-left, 10px);
  }

  .welcome-content {
    padding: 1rem;
  }

  .app-logo {
    font-size: 3rem;
  }

  h1 {
    font-size: 2rem;
  }

  .privacy-statement {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .face-guide {
    width: 150px;
    height: 150px;
  }

  .capture-btn {
    width: 70px;
    height: 70px;
  }

  .capture-inner {
    width: 50px;
    height: 50px;
  }
}

@media (max-width: 480px) {
  .step-header {
    margin-bottom: 1rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .back-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .primary-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    min-height: 44px;
  }

  .secondary-btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  /* Camera optimizations for small screens */
  .camera-container {
    min-height: 40vh;
    max-height: 45vh;
    margin: 0.5rem 0;
    flex: 1;
  }

  #video {
    min-height: 40vh;
    max-height: 45vh;
  }

  .camera-controls {
    padding: 0.5rem 0;
    background: var(--surface-overlay);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-shrink: 0;
    /* Prevent controls from shrinking */
  }

  .status-message {
    margin: 0.5rem 0;
    padding: 0.75rem;
    font-size: 0.875rem;
    flex-shrink: 0;
    /* Prevent status from shrinking */
  }
}

/* Extra small screens and landscape mobile */
@media (max-width: 360px),
(orientation: landscape) and (max-height: 500px) {
  .camera-container {
    min-height: 35vh;
    max-height: 40vh;
    margin: 0.25rem 0;
  }

  #video {
    min-height: 35vh;
    max-height: 40vh;
  }

  .status-message {
    margin: 0.25rem 0;
    padding: 0.5rem;
    font-size: 0.85rem;
  }

  .capture-btn {
    width: 56px;
    height: 56px;
    margin-bottom: 0.5rem;
  }

  .capture-inner {
    width: 36px;
    height: 36px;
  }

  .step-header {
    margin-bottom: 0.5rem;
  }

  h2 {
    font-size: 1.125rem;
  }
}

/* Face Detection Smoothing */
.face-shimmer {
  background: linear-gradient(90deg,
      transparent,
      rgba(26, 115, 232, 0.4),
      transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-full);
  border: 2px solid var(--brand-primary);
  box-shadow:
    0 0 16px rgba(26, 115, 232, 0.3),
    inset 0 0 16px rgba(26, 115, 232, 0.1);
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Landing Page Styles */
.landing-info {
  text-align: justify;
  max-width: 600px;
  margin: 0 auto;
}

.landing-info h2 {
  color: var(--text-primary);
  margin: 2rem 0 1rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.landing-info p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 1.1rem;
  line-height: 1.6;
}

.how-it-works {
  list-style: none;
  counter-reset: step-counter;
  margin: 1rem 0 2rem 0;
}

.how-it-works li {
  counter-increment: step-counter;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  padding-left: 2.5rem;
  position: relative;
  font-size: 1.1rem;
  line-height: 1.6;
}

.how-it-works li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  background: var(--accent-gradient);
  color: rgb(7, 13, 107);
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.privacy-features {
  list-style: none;
  margin: 1rem 0 2rem 0;
}

.privacy-features li {
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  padding-left: 2rem;
  position: relative;
  font-size: 1.1rem;
  line-height: 1.6;
}

.privacy-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: #098e0e;
  font-weight: bold;
  font-size: 1.2rem;
}



.help-section {
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-small);
  padding: 1.5rem;
  margin-top: 2rem;
  text-align: center;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft);
}

.help-section p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Split Layout for Landing Page */
.split-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.split-option {
  background: var(--surface-default);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.25rem 1rem;
  align-items: start;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  width: 100%;
  text-align: left;
}

.split-option:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-primary);
}

.split-icon {
  grid-row: 1 / 3;
  font-size: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.split-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.split-description {
  color: var(--text-secondary);
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  line-height: 1.4;
}

.split-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.split-divider::before,
.split-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
  margin: 0 1rem;
}

.quality-options,
.split-option>.primary-btn {
  grid-column: 1 / 3;
  width: 100%;
}

.quality-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.quality-btn {
  padding: 0.625rem 0.5rem !important;
  min-width: 0 !important;
  font-size: 0.8125rem !important;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.lead-text {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.privacy-badge {
  background: var(--bg-accent);
  color: var(--brand-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-top: 1.5rem;
  display: inline-block;
  border: 1px solid rgba(26, 115, 232, 0.2);
}