:root {
  --bg: #0e1013;
  --panel: #181b20;
  --line: #2a2f37;
  --text: #eceef1;
  --muted: #9aa3ae;
  --accent: #4ea1ff;
  --good: #3ecf7a;
  --warn: #ffb547;
  --bad: #ff5d5d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; font-size: 16px; }
a { color: var(--accent); }
button, .btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; text-decoration: none; text-align: center;
  cursor: pointer; display: inline-block; line-height: 1.2;
}
button:active, .btn:active { background: #222731; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; }
input, select {
  width: 100%; padding: 11px 12px; font-size: 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #0b0d10; color: var(--text);
}
input[type=checkbox] { width: 22px; height: 22px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }

/* 실시간 보기 */
body.live { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: #000; font-size: 14px; }
.grow { flex: 1; }
.stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; position: relative; }
.stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  background: rgba(0,0,0,.6); color: #fff; padding: 20px; font-size: 15px; }
.actions .btn, .actions button { padding: 12px 6px; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 8px; padding: 12px 14px;
  padding-bottom: max(12px, env(safe-area-inset-bottom)); background: #000; }
body.full .bar, body.full .actions { display: none; }
body.full .stage img { height: 100vh; height: 100dvh; }

/* 일반 페이지 */
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.top h1 { font-size: 20px; margin: 0; flex: 1; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field.check { display: flex; align-items: center; gap: 10px; }
.field.check label { margin: 0; flex: 1; }
.field .err { color: var(--bad); font-size: 13px; margin-top: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }
.msg { padding: 10px 12px; border-radius: 10px; background: #10241a; color: #bff0d2; margin: 10px 0; font-size: 14px; }
.msg.err { background: #2a1212; color: #ffc9c9; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* 녹화 목록 */
.player { width: 100%; background: #000; border-radius: 12px; display: block; margin-bottom: 8px; }
.day { margin: 18px 0 8px; font-size: 15px; color: var(--muted); }
.rec { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-bottom: 6px; }
.rec.playing { border-color: var(--accent); }
.rec .t { font-weight: 600; flex: 1; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: #3a2a10; color: var(--warn); }

/* 기기 등록 코드 */
.code { font-size: 40px; font-weight: 700; letter-spacing: 6px; text-align: center; margin: 8px 0; font-variant-numeric: tabular-nums; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 220px; margin: 10px auto; }
.qr svg { width: 100%; height: auto; display: block; }
.dev { border-top: 1px solid var(--line); padding: 12px 0; }
.dev:first-child { border-top: 0; }
.dev .name { font-weight: 600; }
.pair-input { font-size: 28px; letter-spacing: 6px; text-align: center; font-variant-numeric: tabular-nums; }
