:root {
  --bg: #121418;
  --bg-elev: #1c2028;
  --ink: #f4f1ea;
  --muted: #9aa3ad;
  --line: #2c3340;
  --accent: #e2b340;
  --accent-ink: #1a1408;
  --ok: #3dbe7a;
  --danger: #e05b4f;
  --font: "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.45;
}

a {
  color: var(--accent);
}

.wrap {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.brand {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}

h1 {
  font-size: 1.7rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.lede {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 42rem;
}

.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.card:hover {
  border-color: var(--accent);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.file {
  position: relative;
  overflow: hidden;
  display: inline-block;
}

.file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.preview {
  display: block;
  max-width: min(100%, 280px);
  border-radius: 10px;
  background: #000;
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.status {
  min-height: 1.4em;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--danger);
}

.steps {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
}

.steps li {
  margin: 0.35em 0;
}

.back {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--muted);
  text-decoration: none;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin: 10px 0;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--ok);
}

.stage {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.stage canvas,
.stage video {
  max-width: 100%;
  height: auto;
  display: block;
}

body.broadcast {
  background: #000;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body.broadcast .chrome {
  display: none;
}

.broadcast-ui {
  display: none;
}

body.broadcast .broadcast-ui {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 8px 8px 20px;
}

.broadcast-bar {
  color: #fff;
  font-weight: 650;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.broadcast-qr {
  background: #fff;
  padding: 10px;
  line-height: 0;
}

.broadcast-qr canvas {
  display: block;
  width: min(92vw, 92vh);
  height: auto;
}

.cam-box {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.cam-box video,
.cam-box canvas {
  width: 100%;
  display: block;
}

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

.result-img {
  max-width: min(100%, 360px);
  border-radius: 10px;
  display: block;
  margin-top: 12px;
  background: #111;
}
