/* Reset & base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

header {
  padding: 20px 0;
  text-align: center;
  background: #4a90e2;
  width: 100%;
  color: #fff;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

h1 {
  font-size: 2rem;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 20px;
  width: 100%;
  max-width: 800px;
}

.camera-container {
  position: relative;
  width: 100%;
  max-width: 640px; /* max width for both camera & uploaded image */
  height: auto;
}

video, canvas {
  width: 100%; /* scale to container */
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}


canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: none; /* Only shown when using uploaded image */
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 20px 0;
  gap: 10px;
}

button, .btn-file {
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  color: #fff;
}

button:hover, .btn-file:hover {
  opacity: 0.9;
}

.btn {
  background: #4a90e2;
}

.voice {
  background: #50e3c2;
}

.voice.stop {
  background: #e94e77;
}

.btn-file {
  background: #f5a623;
}

.result-card {
  background: #fff;
  padding: 15px 20px;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  margin-top: 10px;
}

footer {
  margin-top: auto;
  padding: 15px 0;
  color: #888;
}
.camera-container {
  position: relative;
  width: 100%;
  max-width: 640px;
  height: 360px;          /* 🔑 fixed display height */
  overflow: hidden;      /* 🔑 stops overflow */
}

video, canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* 🔑 keeps image inside box */
}


