:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --panel: #15161a;
  --line: #2a2c33;
  --text: #ececf1;
  --muted: #9a9ca8;
  --accent: #e8b86d;
  --accent-ink: #1a1203;
  --ok: #6fd39b;
  --bad: #ff7a7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

#app { display: grid; grid-template-columns: 1fr 380px; height: 100vh; height: 100dvh; }
@media (max-width: 900px) { #app { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; } }

#stage { position: relative; background: #000; overflow: hidden; }
#video, #out { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
#video.mirror, #out.mirror { transform: scaleX(-1); }
#hud { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 10px; flex-wrap: wrap;
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
#hud span { background: rgba(0,0,0,.55); padding: 4px 8px; border-radius: 6px; backdrop-filter: blur(6px); }
#hud span:empty { display: none; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#flash.on { animation: flash 180ms ease-out; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

#panel { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
header h1 { margin: 0; font-size: 20px; letter-spacing: .01em; }
header h1 small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
#mode-line { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.group h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
label { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
input[type=checkbox] { width: 20px; height: 20px; }

button, .button, select {
  appearance: none; border: 1px solid var(--line); background: #1e2027; color: var(--text);
  padding: 10px 14px; border-radius: 10px; font: inherit; font-size: 15px; cursor: pointer;
  min-height: 44px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }

pre.info { margin: 6px 0 0; padding: 10px; background: #0f1013; border: 1px solid var(--line); border-radius: 8px;
  font: 12.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word;
  color: #cfd2dc; max-height: 260px; overflow: auto; }
pre.info.small { font-size: 11px; max-height: 320px; }
.ok { color: var(--ok); } .bad { color: var(--bad); }

#capture-wrap img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
