* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
}
header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid #1e293b;
}
header h1 { margin: 0 0 4px; font-size: 1.6rem; }
header .sub { margin: 0; color: #94a3b8; font-size: 0.9rem; }
code { background: #1e293b; padding: 1px 6px; border-radius: 4px; font-size: 0.9em; }
pre {
  background: #0b1220;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  border: 1px solid #1e293b;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  background: #0b1220;
  padding: 8px;
  border-bottom: 1px solid #1e293b;
}
.tab-btn {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.tab-btn.active {
  background: #1e293b;
  border-color: #334155;
  color: #fff;
}

main { padding: 20px; max-width: 720px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }

.card {
  background: #111c2e;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 20px;
}
.card h2 { margin-top: 0; }
.muted { color: #94a3b8; font-size: 0.9rem; }

.file-pick {
  display: block;
  border: 2px dashed #334155;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 12px;
  transition: border-color 0.15s;
}
.file-pick:hover { border-color: #60a5fa; }
.file-pick input { display: none; }
.file-pick span { color: #cbd5e1; }

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #94a3b8;
  gap: 4px;
}
.controls input, .controls select {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px;
  font-size: 0.95rem;
}
.controls label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
  font-size: 0.9rem;
  grid-column: 1 / -1;
}
.controls label.check input {
  width: auto;
  margin: 0;
}

.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
button:hover:not(:disabled) { background: #1d4ed8; }
button:disabled { background: #475569; cursor: not-allowed; opacity: 0.7; }

.qr-stage {
  text-align: center;
  margin-top: 16px;
}
#qrCanvas {
  background: white;
  border-radius: 8px;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.cam-stage {
  position: relative;
  margin: 12px 0;
  background: black;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
#video { width: 100%; height: 100%; object-fit: cover; }

.status {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  color: #cbd5e1;
  margin: 8px 0;
  white-space: pre-wrap;
}
progress {
  width: 100%;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
}

.dl-link {
  display: inline-block;
  margin-top: 12px;
  background: #16a34a;
  color: white;
  padding: 10px 18px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.dl-link:hover { background: #15803d; }
