:root {
  color-scheme: light dark;
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #555;
  --accent: #0b5cad;
  --accent-fg: #fff;
  --border: #c8c8c0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #f2f2f2;
    --muted: #b5b5b5;
    --accent: #6cb4ff;
    --accent-fg: #0a0a0a;
    --border: #444;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.125rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

h1 { margin: 0 0 .25rem; font-size: 2rem; }
h2 { margin: 1.5rem 0 .25rem; font-size: 1.125rem; color: var(--muted); }
.intro { margin: 0 0 1.25rem; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

button {
  font: inherit;
  font-weight: 600;
  min-height: 3.5rem;
  padding: .75rem 1.5rem;
  border: 2px solid var(--accent);
  border-radius: .5rem;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}

button:disabled { opacity: .6; cursor: progress; }

button.secondary {
  background: transparent;
  color: var(--fg);
}

.diag { margin-top: 1rem; color: var(--muted); font-size: .875rem; }

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

.option { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.option input { width: 1.5rem; height: 1.5rem; }

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

.last {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
}

.stage {
  position: relative;
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: .5rem;
  overflow: hidden;
  background: #000;
}

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

.stage canvas {
  position: absolute;
  inset: 0;
  height: 100%;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
