:root { color-scheme: dark; --bg: #0f1012; --fg: #eee; --muted: #9a9ca3; --card: #1b1d21; --accent: #ff7a1a; --red: #e5383b; --green: #2fbf71; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); gap: 12px; }
h1 { font-size: 1.1rem; margin: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 0 12px 24px; }
.badges { display: flex; gap: 8px; }
.badge { font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--card); letter-spacing: .04em; }
.badge.on { background: var(--red); color: #fff; }
.badge.connecting { background: #8a6d00; color: #fff; }
.badge.off { color: var(--muted); }
.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stage canvas { pointer-events: none; }
.stage:fullscreen { border-radius: 0; aspect-ratio: auto; }
.placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 16px; }
.floating { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
button, select, input[type=password] { font: inherit; color: var(--fg); background: var(--card); border: 1px solid #33363d; border-radius: 6px; padding: 9px 14px; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; }
button.danger { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 0; }
.card { background: var(--card); border-radius: 10px; padding: 20px; max-width: 380px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }
.card input[type=password] { background: var(--bg); }
label.inline { display: inline-flex; gap: 6px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--red); margin: 0; }

/* Overlays on the video (broadcaster screen) */
.hud { position: absolute; z-index: 2; margin: 0; }
.hud-tl { top: 10px; left: 10px; display: flex; gap: 6px; }
.hud-tr { top: 10px; right: 10px; padding: 6px 11px; background: rgba(0,0,0,.55); border-color: transparent; }
.hud-br { bottom: 10px; right: 10px; }
.hud .badge { font-size: .85rem; padding: 4px 9px; backdrop-filter: blur(4px); }
.hud .badge.off, .hud .badge.muted { background: rgba(0,0,0,.55); color: #fff; }
.qr { background: #fff; color: #111; padding: 6px 6px 3px; border-radius: 8px; text-align: center; cursor: zoom-in;
      width: clamp(84px, 18%, 170px); transition: width .2s; }
.qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.qr figcaption { font-size: .7rem; font-weight: 700; padding-top: 2px; }
.qr.big { width: min(70%, 60vh); cursor: zoom-out; }

/* Display mode: video fills the screen with only the overlays */
body.display-mode { overflow: hidden; }
body.display-mode .stage { position: fixed; inset: 0; z-index: 10; width: 100vw; height: 100vh; height: 100dvh;
                           aspect-ratio: auto; border-radius: 0; }
body.display-mode .hud-tl { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); }
body.display-mode .hud-br { bottom: max(10px, env(safe-area-inset-bottom)); right: max(10px, env(safe-area-inset-right)); }
