body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f4f8;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 20px;
}

.container {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  width: 100%;
  max-width: 400px !important;
  box-sizing: border-box;
}

h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.4rem;
}

#imageUpload {
  margin-bottom: 15px;
  width: 100%;
}

#preview-container {
  width: 100%;
  aspect-ratio: 4/3;
  border: 2px solid #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f9f9f9;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 15px;
}

#preview,
#webcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4caf50;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
  margin: auto;
}

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

button {
  padding: 10px 16px;
  font-size: 15px;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  margin: 5px 0;
  width: 100%;
}

button:hover {
  background-color: #45a049;
}

#result {
  margin-top: 15px;
  font-size: 1rem;
  color: #333;
  min-height: 40px;
}

.back-button {
  position: fixed;
  top: 15px;
  left: 15px;
  background-color: white;
  color: #4caf50;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.3s ease, color 0.3s ease;
}

.back-button:hover {
  background-color: #4caf50;
  color: white;
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  h2 {
    font-size: 1.2rem;
  }
  button {
    font-size: 14px;
    padding: 8px 14px;
  }
}
