:root {
  --bg: #0a0a0c; --panel: #141418; --panel2: #1c1c22; --line: #26262e; --text: #f5f5f6; --dim: #8c8c96;
  --go: #c8ff3e; --rec: #ff3d3d; --fire: #ff8a1f; --r: 18px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overscroll-behavior: none; }
body { font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
button:disabled { opacity: .4; }
input { -webkit-user-select: text; user-select: text; }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 10px) 16px calc(var(--safe-b) + 16px); }
.boot { margin: auto; font-weight: 900; font-size: 64px; letter-spacing: -3px; color: var(--go); }
.logo { font-weight: 900; font-size: 30px; letter-spacing: -1.5px; color: var(--go); }
.dim { color: var(--dim); } .small { font-size: 13px; } .grow { flex: 1; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.top { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 10px; }
.top h1 { font-size: 18px; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); flex: none; }
.icon svg, .btn svg, .tbtn svg { width: 22px; height: 22px; fill: currentColor; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: var(--panel); font-weight: 600; font-size: 14px; }

/* sign in */
.auth { margin: auto 0; display: flex; flex-direction: column; gap: 12px; padding-bottom: 12vh; }
.auth .boot { margin: 0 0 6px; font-size: 76px; line-height: 1; }
.field { height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); padding: 0 18px; font-size: 17px; width: 100%; outline: none; }
.field:focus { border-color: var(--go); }
.btn { height: 58px; border-radius: 18px; background: var(--go); color: #0a0a0c; font-weight: 800; font-size: 17px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn.ghost { background: var(--panel); color: var(--text); font-weight: 700; }
.btn.rec { background: var(--rec); color: #fff; }
.btn.slim { height: 48px; font-size: 15px; border-radius: 14px; }
.err { color: #ff7b7b; min-height: 20px; font-size: 14px; }

/* library */
.seg { display: flex; background: var(--panel); border-radius: 16px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; height: 44px; border-radius: 12px; font-weight: 700; color: var(--dim); }
.seg button.on { background: var(--panel2); color: var(--text); }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: var(--r); padding: 12px 6px 12px 14px; min-height: 68px; text-align: left; width: 100%; }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .go { width: 44px; height: 44px; border-radius: 50%; background: var(--go); color: #0a0a0c; display: grid; place-items: center; flex: none; }
.item .go svg { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }
.item .go.voice { background: var(--panel2); color: var(--fire); }
.item .more { width: 40px; height: 44px; color: var(--dim); font-size: 22px; font-weight: 800; flex: none; }
.item.busy { opacity: .65; }
.empty { text-align: center; color: var(--dim); padding: 36px 20px; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--go); width: 0; transition: width .15s; }
.addwrap { position: sticky; bottom: calc(var(--safe-b) + 8px); margin-top: 14px; }
.trashlink { margin: 18px auto 0; color: var(--dim); font-size: 13px; padding: 10px; }

/* booth */
.booth { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.wave { width: 100%; height: 84px; border-radius: 14px; background: var(--panel); touch-action: none; display: block; }
.times { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--dim); margin-top: -4px; }
.recpill { height: 36px; padding: 0 14px; border-radius: 18px; background: var(--panel); font-weight: 800; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.recpill.on { background: var(--rec); color: #fff; }
.recpill .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.recpill.on .dot { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.wheel { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 6px 0; }
.gap { height: 4px; }
.dialwrap { min-height: 190px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.dial { --p: 0.5; width: min(58vw, 240px); aspect-ratio: 1; border-radius: 50%; position: relative; touch-action: none; flex: none;
  background: conic-gradient(from 210deg, var(--go) calc(var(--p) * 300deg), var(--line) 0 300deg, transparent 0); }
.dial::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #24242c, #111115 70%); box-shadow: 0 10px 30px #000a, inset 0 1px 0 #ffffff14; }
.dial .knob { position: absolute; inset: 12px; border-radius: 50%; transform: rotate(calc(210deg + var(--p) * 300deg)); pointer-events: none; }
.dial .knob::after { content: ""; position: absolute; left: 50%; top: 10px; width: 6px; height: 22px; margin-left: -3px; border-radius: 3px; background: var(--go); }
.dial .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dial .val b { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; font-variant-numeric: tabular-nums; line-height: 1; }
.dial .val span { font-size: 12px; color: var(--dim); margin-top: 6px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.step { width: 48px; height: 48px; border-radius: 50%; background: var(--panel); font-size: 24px; font-weight: 700; flex: none; }
.modes { display: flex; gap: 8px; justify-content: center; }
.modes button { flex: none; white-space: nowrap; height: 40px; padding: 0 18px; border-radius: 20px; background: var(--panel); font-weight: 700; font-size: 14px; color: var(--dim); }
.modes button.on { background: var(--text); color: #0a0a0c; }
.modes button.changed::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--go); margin-left: 6px; vertical-align: middle; }
.transport { display: grid; grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr; gap: 8px; align-items: center; }
.tbtn { height: 56px; border-radius: 16px; background: var(--panel); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tbtn.on { background: var(--panel2); color: var(--go); box-shadow: inset 0 0 0 1.5px var(--go); }
.tbtn.play { height: 64px; border-radius: 22px; background: var(--go); color: #0a0a0c; }
.tbtn.play svg { width: 28px; height: 28px; }
.tbtn.fire { color: var(--fire); }
.meter { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--go); border-radius: 3px; transition: width .06s linear; }
.meter.clip i { background: var(--rec); }
.hint { font-size: 13px; color: var(--dim); text-align: center; min-height: 18px; }
.hint.warn { color: var(--fire); }
.recrow { display: grid; grid-template-columns: 1fr 1.7fr; gap: 8px; }
.btn.firebig { background: var(--panel2); color: var(--fire); box-shadow: inset 0 0 0 1.5px var(--fire); }
.btn.firebig.hit { background: var(--fire); color: #0a0a0c; }
.load { margin: auto; text-align: center; width: 70%; }
.sliders { display: flex; flex-direction: column; gap: 14px; background: var(--panel); border-radius: var(--r); padding: 16px; }
.sl { display: grid; grid-template-columns: 54px 1fr 44px; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.sl output { color: var(--dim); font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--text); margin-top: -10px; }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--text); border: 0; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nudge { display: flex; align-items: center; justify-content: space-between; background: var(--panel); border-radius: 14px; height: 48px; padding: 0 4px; font-size: 13px; font-weight: 700; }
.nudge button { width: 40px; height: 40px; font-size: 20px; font-weight: 800; }

/* sheet + toast */
#sheet { position: fixed; inset: 0; display: none; align-items: flex-end; justify-content: center; background: #000a; z-index: 20; }
#sheet.on { display: flex; }
.sheet { width: 100%; max-width: 560px; background: var(--panel); border-radius: 24px 24px 0 0; padding: 20px 16px calc(var(--safe-b) + 16px); display: flex; flex-direction: column; gap: 8px; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.sheet p { margin: 0 0 6px; color: var(--dim); font-size: 14px; }
.sheet .btn.ghost { background: var(--panel2); }
.sheet .danger { color: #ff7b7b; }
.sheet .linkbox { background: var(--bg); border-radius: 12px; padding: 12px; font-size: 13px; word-break: break-all; -webkit-user-select: all; user-select: all; }
#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 96px); transform: translateX(-50%); background: var(--text); color: #0a0a0c; font-weight: 700; font-size: 14px; padding: 12px 18px; border-radius: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: 86vw; text-align: center; }
#toast.on { opacity: 1; }
@media (min-width: 700px) { #app { padding-top: 28px; } .wave { height: 110px; } }
@media (max-height: 640px) { .dialwrap { min-height: 150px; } .dial { width: min(44vw, 170px); } .dial .val b { font-size: 30px; } }

/* create tab + maker */
.addrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.addrow .btn { height: 52px; font-size: 15px; }
.livebtn { height: 38px; padding: 0 12px; border-radius: 19px; font-weight: 800; font-size: 13px; background: var(--go); color: #0a0a0c; flex: none; white-space: nowrap; }
.livebtn.on { background: var(--panel2); color: var(--go); box-shadow: inset 0 0 0 1.5px var(--go); }
.makerow { display: flex; gap: 8px; align-items: center; }
.pick { height: 48px; border-radius: 14px; background: var(--panel); color: var(--text); border: 0; padding: 0 10px; font-weight: 700; font-size: 13px; -webkit-appearance: none; appearance: none; text-align: center; }
.nudge b { font-size: 18px; font-variant-numeric: tabular-nums; }
.gridwrap { background: var(--panel); border-radius: var(--r); padding: 10px 8px 12px 4px; }
.grid { display: flex; flex-direction: column; gap: 4px; }
.grow2 { display: flex; align-items: center; }
.glabel { width: 34px; flex: none; font-size: 9.5px; font-weight: 800; color: var(--dim); text-align: center; text-transform: uppercase; letter-spacing: 0; overflow: hidden; }
.cells { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); }
.cell { height: 36px; min-width: 0; margin: 0 1.5px; border-radius: 5px; background: #2a2a33; }
.cell.beat { background: #3a3a46; }
.cell.on { background: var(--go); box-shadow: 0 0 10px #c8ff3e55; }
.ph { position: absolute; left: 0; top: 2px; width: 6.25%; height: 4px; border-radius: 2px; background: var(--text); transition: transform .03s linear; }
