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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f1115;
  color: #e6e8eb;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #23262d;
  flex-wrap: wrap;
}

h1 { font-size: 1.1rem; font-weight: 600; }
h1 .sub { font-size: 0.8rem; font-weight: 400; color: #8b929e; }
h2 { font-size: 0.95rem; margin-bottom: 0.5rem; }

.status { font-size: 0.8rem; color: #8b929e; }
.status.ok { color: #4ade80; }
.status.err { color: #f87171; }

main { padding: 1rem; max-width: 900px; margin: 0 auto; }

.viewport { margin-bottom: 0.75rem; }

.stage {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
}

.stage video, .stage img {
  display: block;
  width: 100%;
  height: auto;
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stage-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b929e;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.hud {
  display: flex;
  gap: 1.25rem;
  padding: 0.4rem 0.2rem;
  font-size: 0.78rem;
  color: #8b929e;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}

button, .file-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

button:disabled { background: #374151; color: #8b929e; cursor: default; }
.file-btn { background: #374151; display: inline-block; }
.file-btn input { display: none; }

.chk { font-size: 0.8rem; color: #b9bec7; display: flex; align-items: center; gap: 0.3rem; }

.result canvas {
  max-width: 100%;
  border-radius: 8px;
  background: #fff;
  display: block;
  margin-bottom: 0.5rem;
}

.result a { color: #60a5fa; font-size: 0.85rem; }
