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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC",
    "Microsoft JhengHei", sans-serif;
  background: #0f1115;
  color: #e6e8eb;
  min-height: 100vh;
  padding: 24px;
}

header {
  max-width: 1400px;
  margin: 0 auto 24px;
}

header h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.status {
  font-size: 14px;
  color: #9aa0a6;
}

.status.ok {
  color: #4ade80;
}

.status.error {
  color: #f87171;
}

main {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 980px) {
  main {
    grid-template-columns: 1fr;
  }
}

.stage {
  background: #1a1d23;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

#video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  z-index: 1;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

fieldset {
  background: #1a1d23;
  border: 1px solid #2a2e36;
  border-radius: 12px;
  padding: 16px;
}

legend {
  padding: 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #9aa0a6;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}

fieldset label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6366f1;
  cursor: pointer;
}

input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: #0f1115;
  border: 1px solid #2a2e36;
  border-radius: 8px;
  color: #e6e8eb;
  font-size: 14px;
  margin-bottom: 12px;
}

input[type="text"]:focus {
  outline: none;
  border-color: #6366f1;
}

.btn-row {
  display: flex;
  gap: 8px;
}

button,
.upload-btn {
  flex: 1;
  padding: 10px 12px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}

button:hover,
.upload-btn:hover {
  background: #4f46e5;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.danger {
  background: #dc2626;
  width: 100%;
  margin-top: 12px;
}

button.danger:hover {
  background: #b91c1c;
}

.hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

.label-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

.label-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #2a2e36;
  font-size: 14px;
}

.label-list li:last-child {
  border-bottom: none;
}

.label-list .name {
  font-weight: 500;
}

.label-list .count {
  font-size: 12px;
  color: #9aa0a6;
  margin-right: 8px;
}

.label-list .remove {
  background: transparent;
  border: 1px solid #2a2e36;
  color: #9aa0a6;
  padding: 4px 8px;
  font-size: 12px;
  flex: 0 0 auto;
}

.label-list .remove:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.label-list .empty {
  color: #6b7280;
  font-size: 13px;
  text-align: center;
  padding: 12px 0;
}
