:root {
  --bg: #eef2f7; --card: #fff; --text: #14213d; --muted: #5d6b82; --line: #d5dce7;
  --accent: #1d5fd1; --accent-text: #fff; --danger: #c62828; --ok: #1b9e4b; --err-bg: #fdecec;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1420; --card: #172033; --text: #e8edf6; --muted: #98a5bb; --line: #2b3850;
    --accent: #4f8cf7; --danger: #ef5350; --err-bg: #3a1d22; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.card { width: 100%; max-width: 520px; background: var(--card); border-radius: 16px; padding: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08); }
header { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
h1 { margin: 0; font-size: 24px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input:not([type=checkbox]) { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: transparent; color: inherit; font: inherit; }
#code { font-size: 34px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
button { font: inherit; font-weight: 600; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: inherit; cursor: pointer; }
button.primary { width: 100%; margin-top: 20px; background: var(--accent); color: var(--accent-text); border: 0; font-size: 18px; }
button.danger { background: var(--danger); color: #fff; border: 0; }
button:disabled { opacity: .6; cursor: wait; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row button { flex: 1; }
.error { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--err-bg); color: var(--danger); }
.note { margin-top: 16px; padding: 12px; border-radius: 8px; border: 1px solid var(--line); }
.live { font-size: 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(27,158,75,.2); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(27,158,75,0); } }
video { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 10px; }
#stats { margin-top: 10px; min-height: 1em; }
#step-end p { margin-bottom: 6px; font-size: 18px; }
footer { margin-top: 18px; }
