* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: #07060d; color: #f3f0ff; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; -webkit-user-select: none; user-select: none; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#video { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hidden { display: none !important; }

.panel { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 32px 28px; max-width: 480px; margin: 0 auto; z-index: 2; }
#intro { background: radial-gradient(circle at 50% 40%, #3b1d6e 0%, #07060d 65%); max-width: none; align-items: center; text-align: center; }
#intro > * { max-width: 420px; }
#about { background: rgba(7, 6, 13, 0.94); max-width: none; padding: 32px max(28px, calc(50% - 220px)); overflow-y: auto; }
h1 { font-size: 2.4rem; letter-spacing: 0.02em; background: linear-gradient(90deg, #8b7bff, #4fd1c5, #ffd166, #ff6b6b); -webkit-background-clip: text; background-clip: text; color: transparent; }
ul { text-align: left; padding-left: 1.2em; opacity: 0.85; }
.small { font-size: 0.85rem; opacity: 0.7; min-height: 1.2em; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
.primary { background: linear-gradient(90deg, #6d5dfc, #3fb8af); padding: 14px 28px; border-radius: 999px; font-weight: 600; font-size: 1.05rem; align-self: center; }
.primary:disabled { opacity: 0.5; }
.link { background: none; text-decoration: underline; opacity: 0.75; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; padding: max(16px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); }
#hud .top { display: flex; justify-content: space-between; align-items: center; }
#bpm { font-size: 2rem; font-weight: 700; text-shadow: 0 2px 8px #000; }
#bpm small { font-size: 0.9rem; font-weight: 500; margin-left: 4px; opacity: 0.8; }
#quality { width: 90px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
#qualityBar { height: 100%; width: 0; background: #4fd1c5; transition: width 0.4s; }
#reading { text-align: center; text-shadow: 0 2px 10px #000; margin-top: auto; margin-bottom: 18px; }
#auraName { font-size: 1.7rem; font-weight: 700; }
#auraText { opacity: 0.9; }
.controls { display: flex; justify-content: space-around; align-items: center; pointer-events: auto; }
.controls button { width: 48px; height: 48px; border-radius: 50%; background: rgba(0, 0, 0, 0.45); font-size: 1.3rem; font-weight: 700; }
.controls .shutter { width: 72px; height: 72px; background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.35); }
#debug { position: fixed; top: 70px; left: 8px; right: 8px; z-index: 3; margin: 0; padding: 8px; font: 12px/1.4 ui-monospace, monospace; background: rgba(0, 0, 0, 0.6); color: #9f9; white-space: pre-wrap; pointer-events: none; }
#rec { display: grid; place-items: center; background: conic-gradient(#ff4d5e calc(var(--p, 0) * 360deg), rgba(0, 0, 0, 0.45) 0); }
#rec span { width: 18px; height: 18px; border-radius: 50%; background: #ff4d5e; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.55); transition: border-radius 0.2s; }
#rec.recording span { border-radius: 3px; background: #fff; }
.rec-on #reading { visibility: hidden; }
.pill { pointer-events: auto; padding: 8px 16px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); font-size: 0.9rem; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.pill.on { background: rgba(79, 140, 255, 0.55); }
