:root {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --accent-color: #03a9f4;
  --button-bg: #1f1f1f;
  --button-hover: #0288d1;
  --max-width: 800px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-align: center;
}

.app-header {
  background: var(--button-bg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

.app-header img {
  max-height: 50px;
}

.app-content {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
}

.video-container {
  position: relative;
}

video {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #000;
}

/* the same canvas is used for processing and for drawing the result border
   we position it on top of the video and make it transparent to pointer events */
#canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* keep visible so we can draw threshold/overlay; remove hiding */
}

/* ensure overlay follows the video's rounded corners */
#canvas {
  border-radius: 8px;
}

.controls {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

button {
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: var(--button-hover);
}

.result {
  margin-top: 0.5rem;
  font-weight: bold;
}

.control-row {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

input#file-input {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  background: var(--button-bg);
  color: var(--text-color);
  border: 1px solid rgba(255,255,255,0.06);
}

button#stop-button {
  background: #9e9e9e;
}

.help {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--button-bg);
  border-radius: 8px;
  text-align: left;
}

.help.hidden {
  display: none;
}

.app-footer {
  background: var(--button-bg);
  padding: 0.5rem;
  font-size: 0.875rem;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-color: #fafafa;
    --text-color: #212121;
    --button-bg: #e0e0e0;
    --accent-color: #0277bd;
  }
}