:root {
  --bg: #07080c;
  --panel: #10131a;
  --line: #1c212c;
  --text: #e8ecf3;
  --muted: #8a93a6;
  --accent: #7fb4ff;
  --ok: #3ddc84;
  --warn: #ffb020;
  --bad: #ff4d4f;
  --radius: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
main { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; min-height: calc(100vh - 32px); }
h1 { font-size: 26px; margin: 8px 0 0; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0; color: var(--muted); font-weight: 600; }
p { margin: 0; color: var(--muted); }
a { color: var(--accent); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.btn { display: block; width: 100%; border: 0; border-radius: var(--radius); padding: 20px 18px; font: inherit; font-size: 20px; font-weight: 700;
  color: #fff; background: #223049; cursor: pointer; text-align: center; text-decoration: none; }
.btn.primary { background: var(--accent); color: #0a1424; }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); font-size: 17px; padding: 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.huge { padding: 34px 18px; font-size: 28px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.code { font-size: 64px; font-weight: 800; letter-spacing: .18em; text-align: center; font-variant-numeric: tabular-nums; margin: 8px 0; }
input.code-input { width: 100%; font: inherit; font-size: 40px; letter-spacing: .25em; text-align: center; padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: #0b0e14; color: var(--text); font-variant-numeric: tabular-nums; }
.status { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 18px var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); box-shadow: 0 0 18px var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.meter { height: 14px; background: #0b0e14; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn) 70%, var(--bad)); transition: width .12s linear; }
.hint { font-size: 15px; color: var(--muted); }
.hint li { margin: 6px 0; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; background: #1a2130; color: var(--muted); }
.badge.ok { color: var(--ok); } .badge.bad { color: var(--bad); }
.hidden { display: none !important; }
.spacer { flex: 1; }
body.alarm { animation: flash .6s infinite; }
@keyframes flash { 50% { background: #5a0f12; } }
body.dim { background: #000; }
body.dim .panel { background: #000; border-color: #111; }
body.dim .btn.ghost { border-color: #222; color: #777; }
body.dim h1, body.dim .status { color: #555; }
body.dim .dot.ok { box-shadow: none; opacity: .7; }
video.remote { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); object-fit: cover; }
canvas.history { width: 100%; height: 90px; display: block; background: #0b0e14; border-radius: 12px; border: 1px solid var(--line); }
label.slider { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 15px; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 34px; }
.error { color: var(--bad); font-weight: 600; }
