:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1f262e;
  --line: #2d333b;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
               "Malgun Gothic", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5;
  overscroll-behavior: none;
}
a { color: #58a6ff; }

.wrap { max-width: 520px; margin: 0 auto; padding: 24px 16px 40px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 24px 0 8px; color: var(--muted); font-weight: 600; }
p.sub { color: var(--muted); font-size: 14px; margin: 0 0 20px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.card.link { display: block; text-decoration: none; color: inherit; }
.card.link:active { background: var(--panel-2); }
.card .title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.card .desc { color: var(--muted); font-size: 13px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=password], input[type=text], select {
  width: 100%; padding: 12px; font-size: 16px;
  background: var(--panel-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
}
button {
  font: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--fg); cursor: pointer;
}
button:active { opacity: .7; }
button.primary { background: #238636; border-color: #2ea043; color: #fff; }
button.danger  { background: #4a1d1d; border-color: #6e2b2b; color: #ffb4b4; }
button:disabled { opacity: .45; cursor: default; }
button.wide { width: 100%; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }

.msg { font-size: 14px; padding: 10px 12px; border-radius: 8px; margin-top: 12px; display: none; }
.msg.show { display: block; }
.msg.err { background: #3d1618; color: #ffb4b4; }
.msg.ok  { background: #15301c; color: #9ae6a8; }

/* 상태 표시 */
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on  { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dot.warn { background: var(--warn); }
.dot.off { background: var(--err); }

/* 영상 */
.stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.stage video { display: block; width: 100%; height: auto; background: #000; }
.stage .overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; background: rgba(0,0,0,.72);
  color: var(--muted); font-size: 14px; text-align: center; padding: 20px;
}
.stage .overlay.hidden { display: none; }
.badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(0,0,0,.6); border-radius: 6px; padding: 4px 8px;
  font-size: 11px; font-variant-numeric: tabular-nums; color: #cfd8e3;
  display: flex; align-items: center; gap: 6px;
}

/* 소리 레벨 미터 */
.meter { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .08s linear; }

.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-variant-numeric: tabular-nums; }

/* 카메라 폰 화면 절전 모드 */
body.dimmed { background: #000; }
body.dimmed .wrap > *:not(.dim-catch) { opacity: 0; pointer-events: none; }
.dim-catch {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: none; align-items: center; justify-content: center;
  color: #222; font-size: 13px;
}
body.dimmed .dim-catch { display: flex; }

.spinner {
  width: 22px; height: 22px; border: 2px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }
