* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: system-ui, -apple-system, sans-serif; background: #0f172a; color: #e2e8f0; }
.card { max-width: 480px; margin: 0 auto; padding: 24px 20px; }
h1 { font-size: 1.4rem; margin: 0 0 8px; }
.sub { color: #94a3b8; margin: 0 0 24px; }
label { display: block; margin: 16px 0 6px; font-size: .95rem; }
input { width: 100%; padding: 14px; font-size: 1.1rem; border-radius: 10px; border: 1px solid #334155; background: #1e293b; color: #fff; }
button { width: 100%; padding: 16px; margin-top: 20px; font-size: 1.15rem; font-weight: 700; border: 0; border-radius: 12px; background: #22c55e; color: #052e16; }
.err { color: #f87171; }
.note { color: #64748b; font-size: .8rem; margin-top: 16px; }
#hud { display: flex; justify-content: space-between; padding: 12px 16px; font-weight: 700; }
#quality-box { background: #1e293b; border-radius: 14px; padding: 16px; margin: 8px 0 20px; }
#quality-value { font-size: 2.6rem; font-weight: 800; text-align: center; }
#quality-bar { position: relative; height: 18px; background: #0f172a; border-radius: 9px; overflow: hidden; margin-top: 8px; }
#quality-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: #ef4444; transition: width .3s; }
#quality-zone { position: absolute; left: 80%; right: 0; top: 0; bottom: 0; background: rgba(34,197,94,.25); }
#controls { display: flex; flex-direction: column; gap: 18px; }
.ctrl { background: #1e293b; border-radius: 14px; padding: 14px 16px; }
.ctrl h3 { margin: 0 0 10px; font-size: 1rem; }
.ctrl .val { font-size: 1.3rem; font-weight: 700; text-align: center; }
input[type=range] { width: 100%; height: 44px; accent-color: #22c55e; }
.stepper { display: flex; gap: 10px; }
.stepper button { flex: 1; margin: 0; padding: 18px 0; font-size: 1.3rem; background: #334155; color: #fff; }
.stepper .fine { background: #475569; }
.knob-wrap { display: flex; flex-direction: column; align-items: center; }
canvas.knob { touch-action: none; }
#demo-overlay { position: fixed; inset: 0; background: rgba(2,6,23,.96); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
#demo-overlay h2 { margin: 0 0 8px; }
#demo-overlay p { color: #94a3b8; }
#demo-overlay button { max-width: 300px; }
#msg { position: fixed; inset: 0; background: rgba(2,6,23,.96); z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; }
#msg h2 { margin: 0 0 12px; }
.demo-fill { animation: demofill 2.5s ease-in-out forwards; }
@keyframes demofill { from { width: 0; } to { width: 176px; } }
.knob-wrap { display: flex; flex-direction: column; align-items: center; }
canvas.knob { touch-action: none; }
