:root {
  --bg: #101418;
  --card: #1a2027;
  --line: #2c353f;
  --text: #eef2f5;
  --muted: #94a1ad;
  --accent: #ff8a1f;
  --good: #3ddc84;
  --warn: #ffc247;
  --bad: #ff5d5d;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) 0 calc(64px + env(safe-area-inset-bottom)); }
main { max-width: 560px; margin: 0 auto; padding: 12px 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; flex: 1; min-width: 0; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 10px; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
textarea { min-height: 70px; font-family: inherit; }
button { font-size: 16px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: #242c35; color: var(--text); flex: 1; min-width: 0; }
#btn-snap { width: 100%; margin-top: 8px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; width: 100%; }
button.danger { color: var(--bad); }
button.on { border-color: var(--accent); color: var(--accent); }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }

nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #0b0e11; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav button { border: 0; border-radius: 0; background: none; color: var(--muted); padding: 16px 4px; font-size: 14px; }
nav button.on { color: var(--accent); font-weight: 700; }

.cam canvas { width: 100%; display: block; border-radius: 10px; background: #000; min-height: 60px; }
.cam video { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.status { font-size: 14px; color: var(--muted); margin: 8px 0; }
.status.ok { color: var(--good); }
.status.motion, .status.warming { color: var(--warn); }
.status.error { color: var(--bad); }

.score { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.score div { background: var(--bg); border-radius: 10px; padding: 8px 2px; }
.score b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.score span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.score .last b { color: var(--accent); }
.flash { animation: flash .9s ease-out; }
@keyframes flash { from { background: var(--accent); } to { background: var(--card); } }

svg.target { width: 100%; height: auto; display: block; touch-action: manipulation; border-radius: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { flex: none; padding: 5px 9px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; font-variant-numeric: tabular-nums; }
.chip small { color: var(--muted); margin-right: 4px; }
.chip.total { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.series { margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; }

.tip { border-left: 4px solid var(--muted); padding: 6px 10px; margin-bottom: 8px; background: var(--bg); border-radius: 0 8px 8px 0; }
.tip.good { border-color: var(--good); }
.tip.warn { border-color: var(--warn); }
.tip b { display: block; }
.tip span { font-size: 14px; color: #c9d2da; }

.day { margin: 14px 0 6px; color: var(--muted); font-size: 13px; text-transform: uppercase; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; margin-bottom: 8px; background: var(--card); }
.item b { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item small { display: block; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid div { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.grid b { display: block; font-size: 20px; }
.grid span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
svg.chart { width: 100%; height: auto; display: block; }
