:root { --body: #ecebe6; --panel: #f7f6f2; --ink: #23272b; --muted: #6b6f73; --line: #d6d4cd; --red: #d8432f; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--body); color: var(--ink); font: 16px/1.4 -apple-system, system-ui, sans-serif; overscroll-behavior: none; }
main { max-width: 520px; height: 100%; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 16px); display: flex; flex-direction: column; gap: 14px; }
header { display: flex; align-items: baseline; gap: 8px; }
header b { font-size: 1.5rem; letter-spacing: -.01em; }
header span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.insts { display: flex; flex-wrap: wrap; gap: 8px; }
.inst { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 99px; padding: 8px 14px; font: inherit; font-size: .92rem; }
.inst.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pad { flex: 1; min-height: 240px; display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad canvas { width: min(100%, 360px); aspect-ratio: 1; }
.sandbar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.sandbar i { display: block; height: 100%; background: var(--ink); transition: width .2s; }
.hint { color: var(--muted); text-align: center; margin: 0; min-height: 2.8em; }
.sens { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .9rem; }
.sens input { flex: 1; accent-color: var(--red); }
.gate { position: fixed; inset: 0; background: var(--body); display: grid; place-items: center; text-align: center; padding: 24px; }
.gate[hidden] { display: none; }
.gate h1 { font-size: 2.2rem; margin: 0 0 8px; }
.gate p { color: var(--muted); max-width: 300px; margin: 0 auto 22px; }
.btn { border: 0; background: var(--red); color: #fff; font: 600 1.05rem system-ui; padding: 14px 28px; border-radius: 14px; }
.diag { margin: 0; text-align: center; font: 11px ui-monospace, Menlo, monospace; color: var(--muted); }
