:root {
  --bg: #0b0d12;
  --panel: #151922;
  --text: #f4f6fb;
  --muted: #a5adbd;
  --accent: #50ffaa;
  --warn: #ffd24a;
  --bad: #ff6464;
  --line: #2a3140;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
.screen { max-width: 520px; margin: 0 auto; padding: 16px; }

h1 { font-size: 2rem; margin: 8px 0 0; letter-spacing: 0.02em; }
.tag { color: var(--accent); font-weight: 700; margin: 4px 0 16px; letter-spacing: 0.08em; font-size: 0.85rem; }
.lead { font-size: 1.15rem; line-height: 1.4; }
.checklist { color: var(--muted); line-height: 1.6; padding-left: 1.1rem; }
.foot { color: var(--muted); font-size: 0.8rem; margin-top: 20px; }

button { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
button:active { transform: scale(0.98); }
button.big { width: 100%; padding: 22px 16px; font-size: 1.35rem; font-weight: 800; margin: 12px 0; }
button.primary { background: var(--accent); color: #05140d; border-color: var(--accent); }
button.small { flex: 1; padding: 12px 8px; font-size: 0.95rem; min-height: 48px; }
button.danger { border-color: var(--bad); color: var(--bad); }

.topbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.badge { font-weight: 800; font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; letter-spacing: 0.06em; }
.badge.real { background: var(--accent); color: #05140d; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; color: var(--muted); }

.stage { position: relative; width: 100%; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 9 / 16; max-height: 56dvh; margin: 0 auto; transform: scaleX(-1); }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.stage.video-hidden video { opacity: 0; }

.banner { margin-top: 10px; padding: 14px 10px; text-align: center; font-size: 1.9rem; font-weight: 900; letter-spacing: 0.03em; border-radius: 12px; background: var(--panel); border: 2px solid var(--line); }
.banner.ok { border-color: var(--accent); color: var(--accent); }
.banner.warn { border-color: var(--warn); color: var(--warn); }
.banner.bad { border-color: var(--bad); color: var(--bad); }
.banner.flash { background: var(--accent); color: #05140d; }

.calib { height: 14px; background: var(--panel); border-radius: 999px; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); }
#calib-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.15s linear; }

.counter { text-align: center; font-weight: 900; font-size: 4.5rem; line-height: 1; margin-top: 10px; }
.counter .goal { font-size: 2.2rem; color: var(--muted); }
.phase { text-align: center; color: var(--muted); font-size: 1.2rem; margin: 4px 0 10px; min-height: 1.5em; }

.row { display: flex; gap: 8px; margin-top: 8px; }

.debug { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.debug pre { margin: 0 0 8px; white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; color: #cfe; }
.debug textarea { width: 100%; height: 140px; margin-top: 8px; background: #0e1118; color: var(--text); border: 1px solid var(--line); border-radius: 8px; font-size: 0.7rem; }

.msg { margin-top: 12px; padding: 14px; border-radius: 12px; background: #2a1517; border: 1px solid var(--bad); line-height: 1.45; font-size: 1rem; }
.msg.info { background: #14221b; border-color: var(--accent); }
.msg strong { display: block; margin-bottom: 4px; }
.msg ul { margin: 6px 0 0; padding-left: 1.1rem; }
