:root {
  --bg: #0f1115; --card: #181b22; --line: #2a2f3a; --text: #e8eaf0; --muted: #9aa3b2;
  --primary: #e53935; --primary-text: #fff; --live: #22c55e; --warn: #f59e0b; --danger: #ef4444;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 24px; margin: 0; } h2 { font-size: 17px; margin: 0; }
.muted { color: var(--muted); } .error { color: var(--danger); } .warn { color: var(--warn); }
code { background: #0b0d11; padding: 1px 5px; border-radius: 4px; }

.btn { border: 1px solid var(--line); background: #222632; color: var(--text); border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; color: var(--danger); border-color: #5a2a2a; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, select { background: #0b0d11; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; font: inherit; min-width: 0; }
.copy { display: flex; gap: 6px; } .copy input { flex: 1; font-size: 12px; }

.panel #app { max-width: 1400px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.topbar, .event-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; } .grow { flex: 1; min-width: 200px; }
.login { max-width: 380px; margin: 12vh auto 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.event { flex-direction: row; justify-content: space-between; align-items: center; color: inherit; text-decoration: none; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #2a2f3a; color: var(--muted); white-space: nowrap; }
.pill.live { background: rgba(34,197,94,.15); color: var(--live); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cam.is-live { border-color: rgba(34,197,94,.5); }
.cam-head { display: flex; justify-content: space-between; align-items: center; }
.cam-body { display: flex; gap: 14px; align-items: flex-start; }
.qr { background: #fff; border-radius: 8px; padding: 4px; flex-shrink: 0; }
.cam-info { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.howto summary { cursor: pointer; font-weight: 700; } .howto ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

.cam-page { height: 100dvh; overflow: hidden; background: #000; }
.cam-page #preview { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-page #preview.mirror { transform: scaleX(-1); }
.cam-top { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: linear-gradient(rgba(0,0,0,.7), transparent); font-size: 14px; }
#status { font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.12); }
#status[data-tone="live"] { background: var(--primary); color: #fff; }
#status[data-tone="wait"] { background: rgba(245,158,11,.25); color: #fcd34d; }
#status[data-tone="error"] { background: rgba(239,68,68,.25); color: #fca5a5; }
#stats { color: #d1d5db; font-variant-numeric: tabular-nums; }
.cam-controls { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: 10px 14px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.cam-controls select { max-width: 170px; }
.btn.icon { width: 44px; height: 44px; padding: 0; font-size: 20px; border-radius: 50%; background: rgba(255,255,255,.12); border-color: transparent; }
.btn.icon.on { background: rgba(255,255,255,.3); }
.btn.big { padding: 12px 22px; font-size: 16px; border-radius: 99px; }
.is-live .btn.big { background: #333; border-color: #555; }
.zoom { display: flex; align-items: center; gap: 6px; color: #fff; font-size: 13px; } .zoom input { width: 140px; }
.portrait { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,.7); padding: 12px 18px; border-radius: 10px; font-weight: 700; text-align: center; pointer-events: none; }
.preview { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview-hint { position: absolute; right: 6px; bottom: 6px; font-size: 11px; color: #cbd5e1; background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 4px; pointer-events: none; }
