:root {
  --bg: #16181c;
  --card: #1f2228;
  --text: #f2f2f0;
  --muted: #9aa0a8;
  --accent: #a81d2a; /* Lidz brick red */
  --ok: #3fb26f;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }
header h1 { font-size: 1.3rem; letter-spacing: 0.12em; }
header .accent { color: var(--accent); }
header .tag { color: var(--muted); font-size: 0.85rem; margin-bottom: 12px; }

.steps {
  display: flex; gap: 6px; list-style: none; margin-bottom: 10px;
}
.steps li {
  flex: 1; text-align: center; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  padding: 6px 2px; border-radius: 8px; background: var(--card);
}
.steps li.active { color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.steps li.done { color: var(--ok); }
.steps li.done::after { content: " ✓"; }

.viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}
.banner {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 10px 14px;
  background: linear-gradient(rgba(0,0,0,0.75), transparent);
  display: flex; flex-direction: column; gap: 2px;
  pointer-events: none;
}
.banner strong { font-size: 0.95rem; }
.banner span { font-size: 0.78rem; color: #cfd3d8; }
.viewport.mirrored .banner, .viewport.mirrored .hint, .viewport.mirrored .ring { transform: none; }
.ring {
  position: absolute; left: 50%; top: 50%;
  width: 130px; height: 130px;
  translate: -50% -50%;
  pointer-events: none;
  display: none; /* SVG ignores the hidden attribute — controlled via .show */
}
.ring.show { display: block; }
.ring circle { fill: none; stroke-width: 6; }
.ring-track { stroke: rgba(255,255,255,0.25); }
.ring-fill {
  stroke: var(--ok);
  stroke-dasharray: 276; stroke-dashoffset: 276;
  stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  transition: stroke-dashoffset 60ms linear;
}
.arrows {
  position: absolute; top: 50%; translate: 0 -50%;
  display: flex; gap: 2px;
  font-size: 3.2rem; font-weight: 700; color: var(--accent);
  text-shadow: 0 0 12px rgba(0,0,0,0.8);
  pointer-events: none;
}
.arrows.left { left: 10px; }
.arrows.right { right: 10px; transform: scaleX(-1); }
.arrows span { animation: chevron 0.9s infinite; opacity: 0.2; }
.arrows span:nth-child(2) { animation-delay: 0.15s; }
.arrows span:nth-child(3) { animation-delay: 0.3s; }
/* flipped container reverses DOM order visually — restagger so the pulse
   still travels in the pointing direction */
.arrows.right span:nth-child(1) { animation-delay: 0.3s; }
.arrows.right span:nth-child(3) { animation-delay: 0s; }
@keyframes chevron {
  0%, 100% { opacity: 0.2; }
  30% { opacity: 1; }
}
.flash {
  position: absolute; inset: 0; background: #fff; opacity: 0;
  pointer-events: none; transition: opacity 200ms ease-out;
}
.flash.on { opacity: 0.8; transition: none; }
.checks {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin-top: 10px;
}
.checks li {
  font-size: 0.75rem; padding: 4px 10px; border-radius: 999px;
  background: var(--card); color: var(--muted);
}
.checks li::before { content: "○ "; }
.checks li.ok { color: var(--ok); }
.checks li.ok::before { content: "● "; }
.viewport video, .viewport canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.viewport.mirrored video, .viewport.mirrored canvas { transform: scaleX(-1); }
.hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(0,0,0,0.65);
  padding: 6px 14px; border-radius: 999px;
  font-size: 0.85rem; white-space: nowrap;
}
.controls { display: flex; gap: 10px; margin: 12px 0 4px; }
button {
  flex: 1; padding: 12px; border: 0; border-radius: 10px;
  background: #2b2f36; color: var(--text); font-size: 1rem; cursor: pointer;
}
button.primary { background: var(--accent); font-weight: 600; }
button.unit { flex: 0 0 64px; font-variant-numeric: tabular-nums; color: var(--muted); }
button:disabled { opacity: 0.5; }

.readouts { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--card); border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat.big { grid-column: 1 / -1; }
.stat .label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stat .value { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.stat.big .value { font-size: 1.7rem; color: var(--ok); }
.caveat { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; }

.results { margin-top: 18px; }
.results h2 { font-size: 1.05rem; margin-bottom: 10px; letter-spacing: 0.04em; }
.thumbs { display: flex; gap: 8px; margin: 12px 0; }
.thumbs figure { flex: 1; margin: 0; }
.thumbs img { width: 100%; border-radius: 8px; display: block; }
.thumbs figcaption { font-size: 0.72rem; color: var(--muted); text-align: center; margin-top: 3px; text-transform: capitalize; }

.consent { margin: 4px 0; font-size: 0.88rem; }
.consent input { accent-color: var(--accent); margin-right: 4px; }
.pair-code { font-size: 1.05rem; }
.pair-code strong { color: var(--ok); letter-spacing: 0.2em; font-size: 1.3rem; }

.staff-form { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.staff-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; color: var(--muted); }
.staff-form input {
  padding: 11px 12px; border-radius: 10px; border: 1px solid #3a3f47;
  background: var(--card); color: var(--text); font-size: 1rem; width: 100%;
}
.tape-row { display: flex; gap: 8px; }
.unit-seg { display: inline-flex; border-radius: 10px; overflow: hidden; }
.unit-seg button { flex: 0 0 auto; padding: 10px 16px; border-radius: 0; font-size: 0.9rem; color: var(--muted); }
.unit-seg button.on { background: var(--accent); color: var(--text); }

.debug { margin-top: 16px; }
.debug summary { color: var(--muted); font-size: 0.8rem; cursor: pointer; }
.debug .readouts { margin-top: 10px; }

footer { margin-top: 20px; color: var(--muted); font-size: 0.78rem; text-align: center; }
