.biometric-page {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: #17131b;
  background: #fff;
}

.biometric-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(23 19 27 / 10%);
}

.biometric-header-logo {
  position: absolute;
  right: 16px;
  width: 112px;
  height: 100px;
  object-fit: contain;
}

.biometric-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.biometric-stage {
  position: relative;
  display: grid;
  min-height: 0;
  padding: 20px;
  place-items: center;
  background: #fff;
}

.camera-container {
  position: relative;
  width: min(100%, 520px);
  height: 100%;
  min-height: 280px;
  overflow: hidden;
  background: #f7f5f8;
  border-radius: 16px;
}

.camera-container.is-hidden {
  display: none;
}

.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: scaleX(-1);
}

.biometric-canvas {
  display: none;
}

.face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(72%, 280px);
  height: min(84%, 360px);
  border: 3px solid rgb(92 6 140 / 80%);
  border-radius: 48% / 42%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.photo-preview-container {
  display: none;
  width: min(100%, 900px);
  height: 100%;
  min-height: 280px;
  gap: 16px;
  padding: 12px;
}

.photo-preview-container.is-visible {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.photo-preview-item {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.photo-preview-item h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.photo-preview,
.live-preview {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #f7f5f8;
  border-radius: 12px;
}

.live-preview {
  display: none;
}

.biometric-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 20px 20px;
  background: #fff;
}

.instruction-panel {
  width: min(100%, 720px);
  padding: 16px 20px;
  color: #fff;
  text-align: center;
  background: #5c068c;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgb(23 19 27 / 16%);
}

.camera-message,
.instruction-message {
  margin: 0;
}

.camera-message {
  font-size: 18px;
  font-weight: 700;
}

.instruction-message {
  margin-top: 8px;
  font-size: 15px;
}

.similarity-score {
  margin: -4px 0 0;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.verification-controls {
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.verification-controls button {
  min-width: 112px;
  min-height: 44px;
  padding: 10px 24px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.verification-controls .primary-button {
  color: #fff;
  background: #5c068c;
}

.verification-controls .primary-button:hover:not(:disabled) {
  background: #7313a4;
}

.verification-controls .primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.verification-controls .secondary-button {
  color: #5c068c;
  background: #f5eff8;
  border: 1px solid #d9c2e5;
}

.verification-controls .secondary-button:hover {
  background: #ece0f2;
}

.loading-container {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5c068c;
}

.spinner-border {
  width: 24px;
  height: 24px;
  border: 3px solid #e8d9ef;
  border-top-color: #5c068c;
  border-radius: 50%;
  animation: biometric-spin 0.8s linear infinite;
}

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

@media (max-width: 600px) {
  .biometric-header-logo {
    right: 10px;
    width: 76px;
    height: 62px;
  }

  .biometric-header h1 {
    max-width: calc(100% - 112px);
    font-size: 16px;
    text-align: center;
  }

  .biometric-stage {
    padding: 12px;
  }

  .camera-container,
  .photo-preview-container {
    min-height: 220px;
  }

  .photo-preview-container {
    gap: 8px;
    padding: 4px;
  }

  .biometric-footer {
    gap: 10px;
    padding: 0 12px max(12px, env(safe-area-inset-bottom));
  }

  .instruction-panel {
    padding: 14px 12px;
  }

  .camera-message {
    font-size: 16px;
  }

  .instruction-message {
    font-size: 14px;
  }

  .verification-controls {
    min-height: 56px;
    flex-direction: column;
    gap: 10px;
  }

  .verification-controls button {
    min-width: 96px;
    padding: 10px 16px;
  }
}
