* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #f5f5f7;
  color: #1a1a1a;
}
header {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
main {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}
.panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type="file"] {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: #4361ee;
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #6c757d; }
button:hover { opacity: 0.9; }
button:disabled { opacity: 0.5; cursor: default; }

.ws-status {
  margin-left: auto;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
}
.ws-status-connecting { background: #6c757d; }
.ws-status-open { background: #2a9d5c; }
.ws-status-closed { background: #e63946; }

.drop-zone {
  margin-top: 12px;
  padding: 30px;
  border: 2px dashed #c0c0cc;
  border-radius: 8px;
  text-align: center;
  color: #777;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}
.drop-zone.drag-over {
  background: #eef1ff;
  border-color: #4361ee;
  color: #4361ee;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.result-card {
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
}
.result-card .canvas-wrap {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-card canvas { display: block; max-width: 100%; }
.result-card .video-wrap {
  position: relative;
  background: #000;
  line-height: 0;
}
.result-card .video-wrap video { display: block; width: 100%; }
.result-card .video-wrap .overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.result-card .meta { padding: 8px 10px; font-size: 13px; }
.result-card .name { font-weight: 600; word-break: break-all; margin-bottom: 4px; }
.result-card .status { color: #777; }
.result-card .status.error { color: #e63946; }
.detection-list { list-style: none; margin: 6px 0 0; padding: 0; }
.detection-list li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  font-size: 12px;
}
.detection-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
}
