:root {
  --bg: #f4f5f7; --surface: #ffffff; --text: #14171a; --muted: #5b6470;
  --border: #dfe3e8; --accent: #1f6feb; --ok: #1a7f37; --warn: #9a6700; --err: #cf222e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d10; --surface: #15191e; --text: #e8eaed; --muted: #9aa4ae;
    --border: #262c33; --accent: #4c8dff; --ok: #3fb950; --warn: #d29922; --err: #f85149;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 960px; margin: 0 auto;
       padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
main.narrow { max-width: 360px; padding-top: 12vh; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
h1 { font-size: 17px; margin: 0; font-weight: 600; }
.account { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.account form { margin: 0; }
.account button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.err { background: var(--err); }
.stage { position: relative; background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
           padding: 16px; text-align: center; color: #fff; font-size: 14px; background: rgba(0, 0, 0, .45); }
.overlay[hidden] { display: none; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
button, input { font: inherit; border-radius: 8px; border: 1px solid var(--border);
                background: var(--surface); color: var(--text); min-height: 40px; }
button { padding: 8px 14px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
input { flex: 1; min-width: 0; padding: 8px 10px; }
form.device { display: flex; gap: 8px; margin-top: 12px; }
.stats { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.stat b { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.stat span { font-variant-numeric: tabular-nums; }
form.login { display: grid; gap: 14px; margin-top: 20px; }
form.login label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
form.login input { width: 100%; }
.error { margin: 16px 0 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--err); color: var(--err); font-size: 14px; }
