:root {
  --bg: #0e1319; --panel: #161d26; --line: #2a3441; --text: #e9eef5; --muted: #a3b0c0; --accent: #ff5c7a; --accent-ink: #1a0509;
  --ok: #5fd39a; --warn-bg: #2a1d12; --warn-line: #7a5326; --warn-text: #ffd9a8;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
main { flex: 1 0 auto; width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 16px 24px; }
a { color: #ffa3b4; }
h1 { font-size: clamp(1.75rem, 6vw, 2.6rem); line-height: 1.12; margin: 18px 0 10px; letter-spacing: -0.01em; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1180px; width: 100%; margin: 0 auto; padding: 12px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.tag { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; }
.lede { font-size: 1.15rem; color: #d3dce8; max-width: 38em; margin: 0 0 18px; }
.note { color: var(--muted); font-size: .95rem; margin: 8px 0; }
.note:empty { display: none; }
.tiny { color: var(--muted); font-size: .8rem; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: .85rem; margin: 2px 0 12px; }

button, .btn { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
button:hover { border-color: #46566b; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.primary:hover { filter: brightness(1.08); }
button.link { background: none; border: 0; color: #ffa3b4; text-decoration: underline; padding: 8px 0; min-height: 40px; }
:focus-visible { outline: 3px solid #8fc1ff; outline-offset: 2px; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0 8px; }
.cta button { min-width: 168px; min-height: 52px; font-size: 1.05rem; }
.promises { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 12px; max-width: 46em; }
.promises li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.promises li.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.how { max-width: 46em; margin: 8px 0 20px; }
.how summary { cursor: pointer; padding: 10px 0; min-height: 44px; font-weight: 600; }
.how p { color: #cbd5e1; }

.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); border-radius: 12px; padding: 10px 14px; margin: 8px 0 14px; }

.studio-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .studio-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.stage-col { width: min(100%, calc(60vh * var(--ar, 1.333))); min-width: min(100%, 320px); justify-self: center; }
.stage { position: relative; width: 100%; background: #000; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.stage canvas#view { display: block; width: 100%; height: 100%; }
.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.guide ellipse { stroke: rgba(255, 255, 255, .55); stroke-width: 2; stroke-dasharray: 7 6; }
.guide rect { stroke: rgba(255, 92, 122, .8); stroke-width: 1.5; }
.lab { position: absolute; top: 10px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .8rem; padding: 3px 10px; border-radius: 99px; pointer-events: none; }
.lab-before { left: 10px; } .lab-after { right: 10px; }
.divider { position: absolute; top: 0; bottom: 0; width: 44px; margin-left: -22px; cursor: ew-resize; touch-action: pan-y; }
.divider .knob { position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.divider .knob::before, .divider .knob::after { content: ""; position: absolute; top: 11px; width: 0; height: 0; border: 5px solid transparent; }
.divider .knob::before { left: 3px; border-right-color: #223; border-left: 0; }
.divider .knob::after { right: 3px; border-left-color: #223; border-right: 0; }
.stage.nosplit .divider, .stage.nosplit .lab-before { display: none; }
.hud { position: absolute; left: 10px; bottom: 8px; font-size: .75rem; color: rgba(255, 255, 255, .8); text-shadow: 0 1px 2px #000; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.actions button { flex: 1 1 130px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.readout { display: flex; gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.readout[hidden] { display: none; }
.read-side { flex: 1; min-width: 0; }
.read-side .note { margin: 0 0 6px; min-height: 2.9em; }
.bpm-row { flex: none; display: flex; flex-direction: column; align-items: center; min-width: 4.2ch; }
.bpm { font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: #6b7a8d; }
.bpm.on { color: var(--accent); }
.unit { color: var(--muted); font-size: .95rem; }
.meter { height: 6px; background: #0b1016; border-radius: 99px; margin: 4px 0; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s linear; }
#wave { width: 100%; height: 40px; display: block; margin-top: 4px; }

.seg { border: 1px solid var(--line); border-radius: 12px; padding: 4px; display: flex; gap: 4px; margin: 0 0 6px; }
.seg legend { padding: 0 6px; color: var(--muted); font-size: .85rem; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px 8px; min-height: 44px; border-radius: 9px; cursor: pointer; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg input:focus-visible + span { outline: 3px solid #8fc1ff; outline-offset: 1px; }
.ctl { margin: 8px 0; }
.ctl label { display: flex; justify-content: space-between; gap: 8px; font-size: .95rem; }
.ctl output { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; height: 36px; accent-color: var(--accent); background: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); font-size: .8rem; }

footer.site { flex: none; border-top: 1px solid var(--line); padding: 16px; text-align: center; color: var(--muted); font-size: .85rem; }
footer.site p { margin: 0 auto; max-width: 60em; }
.lost { padding-top: 40px; }
@media (max-width: 420px) { .actions button { flex-basis: 45%; } .cta button { flex: 1 1 100%; } }
@media (prefers-reduced-motion: reduce) { .meter span { transition: none; } }
