:root {
  --bg: #14161f;
  --panel: #1f2330;
  --text: #f4f5fa;
  --muted: #9aa1b8;
  --ok: #2fd37a;
  --warn: #ffb020;
  --accent: #6c8cff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-text-size-adjust: 100%;
}
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100dvh;
}
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
h1 { font-size: 18px; margin: 0; font-weight: 700; }
.cam-label { font-size: 13px; color: var(--muted); }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
}
.stage video, .stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage.mirror video, .stage.mirror canvas { transform: scaleX(-1); }
.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted); padding: 24px;
}
.empty p { margin: 4px 0; font-size: 16px; }
.empty .small { font-size: 13px; }

.status { margin: 0; font-size: 14px; color: var(--muted); min-height: 1.4em; }

.main {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel);
  border-radius: 16px;
  padding: 16px 20px;
  border: 3px solid transparent;
  min-height: 112px;
}
.main .num { font-size: 64px; font-weight: 800; line-height: 1; min-width: 1.6em; text-align: center; font-variant-numeric: tabular-nums; }
.main .name { font-size: 34px; font-weight: 800; line-height: 1.15; }
.main .en { font-size: 15px; color: var(--muted); margin-top: 4px; }
.main.ok { border-color: var(--ok); }
.main.ok .num { color: var(--ok); }
.main.unknown { border-color: var(--warn); }
.main.unknown .num { color: var(--warn); }
.main.unknown .name { font-size: 26px; }
.main.idle .num { color: var(--muted); }
.main.idle .name { font-size: 20px; font-weight: 600; color: var(--muted); }

.rest { display: flex; flex-wrap: wrap; gap: 8px; min-height: 0; }
.chip { background: var(--panel); border: 2px solid var(--ok); border-radius: 999px; padding: 6px 14px; font-size: 16px; font-weight: 600; }
.chip.unknown { border-color: var(--warn); }

.actions { display: flex; gap: 10px; }
.btn {
  flex: 1; font: inherit; font-size: 17px; font-weight: 700;
  padding: 14px 16px; border-radius: 14px; border: 2px solid var(--panel);
  background: var(--panel); color: var(--text); min-height: 52px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1020; }
.btn:active { opacity: .85; }

.tech { font-size: 14px; color: var(--muted); }
.tech summary { padding: 8px 0; cursor: pointer; }
.tech label { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.tech select { font: inherit; padding: 8px; border-radius: 8px; background: var(--panel); color: var(--text); border: 1px solid #333a52; }
.debug { margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.privacy { margin: auto 0 0; font-size: 12px; color: var(--muted); text-align: center; }

@media (orientation: landscape) and (max-height: 520px) {
  .app { max-width: none; }
}

.nav { font-size: 14px; color: var(--accent); text-decoration: none; }
