:root {
  --bg: #f4f6fa; --card: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --accent: #2563eb; --accent-ink: #ffffff; --danger: #dc2626; --ok: #059669; --warn: #d97706;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --card: #111c30; --ink: #e8eef9; --muted: #94a3b8; --line: #243049; --accent: #3b82f6; --danger: #f87171; --ok: #34d399; --warn: #fbbf24; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
main { max-width: 520px; margin: 0 auto; padding: 18px 16px 40px; }
h1 { font-size: 1.5rem; margin: 6px 0 2px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.sub, .muted { color: var(--muted); }
.center { text-align: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0 0 10px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 14px 0 6px; }
input, select { width: 100%; font-size: 1.05rem; padding: 12px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
button { width: 100%; font-size: 1.05rem; font-weight: 600; padding: 14px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); margin-top: 14px; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button.link { background: transparent; color: var(--muted); font-weight: 500; margin-top: 6px; }
button.big { padding: 22px; font-size: 1.35rem; }
button.small { width: auto; padding: 9px 16px; margin: 0; font-size: .95rem; }
button:disabled { opacity: .5; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.err { color: var(--danger); margin: 12px 0 0; }
.ok { color: var(--ok); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; border: 1px solid var(--line); }
.chip.on { color: var(--ok); border-color: var(--ok); }
.chip.off { color: var(--muted); }
.notice { white-space: pre-wrap; max-height: 52vh; overflow: auto; font-size: .92rem; line-height: 1.5; }
.code { font-size: 2.9rem; font-weight: 800; letter-spacing: .06em; text-align: center; margin: 26px 0 8px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .9s linear; }
.video-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.frame { position: absolute; inset: 18% 14%; border: 3px solid rgba(255,255,255,.85); border-radius: 16px; pointer-events: none; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); max-width: 488px; margin: 0 auto; padding: 14px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; text-align: center; }
.topbar { display: flex; justify-content: space-between; align-items: center; }
.topbar button { margin: 0; }
