* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body,
html {
  width: 100%;
  height: 100%;
  overflow: hidden; /* Prevent scrolling */
  background-color: #000;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  touch-action: none; /* Prevent native browser zooming/panning on mobile */
}

#camera-stream {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure video fills screen without distorting */
  z-index: 1;
  pointer-events: none;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none; /* Let touches pass through if not on the canvas itself */
  touch-action: none;
}

#overlay-canvas {
  position: absolute;
  transform-origin: top left; /* Changed to top-left to make pan/zoom calculations simpler */
  cursor: move;
  pointer-events: auto; /* Allow interaction with the canvas */
  border: 1px dashed rgba(255, 255, 255, 0.5); /* Indicate it's movable */
  touch-action: none; /* Prevent native pinch zoom on the canvas itself */
}

/* Locked state */
body.locked #overlay-canvas {
  pointer-events: none; /* Prevent moving when locked */
  border: none;
}

body.locked #controls-panel {
  background-color: transparent;
  box-shadow: none;
  height: auto;
  pointer-events: none; /* Pass clicks through the empty panel background */
}

body.locked #settings-group {
  display: none;
}

body.locked h3 {
  display: none;
}

body.locked #unlock-btn {
  /* display: block; managed in JS now */
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  background-color: #ff3b30;
  color: white;
  padding: 15px 20px;
  border-radius: 30px;
  border: none;
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  pointer-events: auto; /* Re-enable clicks just for the button */
}

#controls-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px;
  z-index: 10;
  border-top-left-radius: 15px;
  border-top-right-radius: 15px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  max-height: 50vh;
  overflow-y: auto;
}

#controls-panel h3 {
  margin-bottom: 10px;
  font-size: 1.2rem;
  color: #333;
  display: inline-block;
}

button {
  background-color: #007aff;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 15px;
}

#lock-btn {
  float: right;
  background-color: #34c759;
}

button:active {
  opacity: 0.8;
}

.control-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.control-group label {
  margin-bottom: 5px;
  font-size: 0.9rem;
  color: #444;
  font-weight: 500;
}

input[type="range"] {
  width: 100%;
}

input[type="file"] {
  font-size: 0.9rem;
}

#reset-btn {
  background-color: #8e8e93;
  width: 100%;
}
