/* Satisfying Lab Studio v2 — our own look: ink-dark panels, violet→pink accent, mint highlights */
:root {
  --bg:#07090f; --rail:#0c1019; --panel:#0f1420; --card:#151b2a; --card2:#1b2335; --line:#232c40;
  --text:#eef2ff; --muted:#8b96b0; --dim:#5b6680;
  --acc1:#8b5cf6; --acc2:#ec4899; --mint:#34d399; --amber:#fbbf24;
}
* { box-sizing:border-box; }
html, body { margin:0; height:100%; }
body { background:var(--bg); color:var(--text); font:13px/1.4 "Plus Jakarta Sans", system-ui, sans-serif; display:flex; flex-direction:column; user-select:none; overflow:hidden; }
button { font-family:inherit; }

/* top bar */
.top { height:58px; flex:none; display:flex; align-items:center; gap:10px; padding:0 14px; background:linear-gradient(180deg,#0e1320,#0a0d16); border-bottom:1px solid var(--line); }
.top .back { color:var(--muted); text-decoration:none; font-weight:700; font-size:12px; padding:7px 10px; border-radius:10px; border:1px solid var(--line); }
.top .back:hover { color:#fff; border-color:#3a4560; }
.top .logo { width:34px; height:34px; border-radius:10px; display:grid; place-items:center; font:900 17px Outfit,sans-serif; background:linear-gradient(135deg,var(--acc1),var(--acc2)); box-shadow:0 6px 18px rgba(236,72,153,.3); }
.top h1 { margin:0; font:800 15px Outfit,sans-serif; letter-spacing:.02em; }
.top .sp { flex:1; }
.tb { height:36px; min-width:36px; padding:0 11px; display:inline-flex; align-items:center; justify-content:center; gap:6px; border-radius:11px; border:1px solid var(--line); background:var(--card); color:#d6ddf0; font-weight:700; font-size:12px; cursor:pointer; }
.tb:hover { background:var(--card2); color:#fff; } .tb:active { transform:scale(.96); }
.tb.dice { background:linear-gradient(135deg,#1f2a44,#2a1f44); border-color:#4c3b7a; font-size:16px; }
.tb.dice:hover { box-shadow:0 0 0 2px rgba(139,92,246,.35); }
.seed { display:flex; align-items:center; gap:6px; height:36px; padding:0 4px 0 10px; border-radius:11px; border:1px solid var(--line); background:var(--card); color:var(--dim); font-weight:800; font-size:11px; letter-spacing:.08em; }
.seed .lock { border:none; background:transparent; cursor:pointer; font-size:14px; padding:2px 4px; opacity:.55; }
.seed .lock.on { opacity:1; }
.seed input { width:104px; border:none; background:transparent; color:#fff; font:700 13px ui-monospace,monospace; outline:none; }
.rec { height:38px; padding:0 16px; border:none; border-radius:12px; background:linear-gradient(135deg,#ef4444,#ec4899); color:#fff; font:800 13px Outfit,sans-serif; letter-spacing:.04em; cursor:pointer; display:inline-flex; align-items:center; gap:8px; box-shadow:0 8px 20px rgba(239,68,68,.3); }
.rec i { width:10px; height:10px; border-radius:50%; background:#fff; }
.rec.on { background:#1f2937; box-shadow:none; } .rec.on i { border-radius:2px; background:#ef4444; }
.rec { background:linear-gradient(135deg,#7c3aed,#db2777); box-shadow:0 8px 20px rgba(124,58,237,.3); }
.rec.ready { background:linear-gradient(135deg,#10b981,#0891b2); box-shadow:0 8px 20px rgba(16,185,129,.35); }

main { flex:1; display:flex; min-height:0; }
/* tab rail */
.rail { width:74px; flex:none; background:var(--rail); border-right:1px solid var(--line); display:flex; flex-direction:column; gap:4px; padding:8px 6px; overflow-y:auto; }
.rail button { border:none; background:none; color:var(--dim); border-radius:12px; padding:9px 2px 7px; display:flex; flex-direction:column; align-items:center; gap:4px; font-size:9.5px; font-weight:800; letter-spacing:.06em; cursor:pointer; }
.rail button b { font-size:18px; line-height:1; font-weight:400; }
.rail button:hover { color:#cfd6ea; background:#121827; }
.rail button.on { color:#fff; background:linear-gradient(160deg,rgba(139,92,246,.28),rgba(236,72,153,.18)); box-shadow:inset 0 0 0 1px rgba(139,92,246,.45); }

/* settings panel */
.panel { width:330px; flex:none; background:var(--panel); border-right:1px solid var(--line); overflow-y:auto; padding:14px 14px 40px; }
.panel::-webkit-scrollbar { width:6px; } .panel::-webkit-scrollbar-thumb { background:#2a3550; border-radius:9px; }
.ptitle { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.ptitle h2 { margin:0; font:900 18px Outfit,sans-serif; letter-spacing:.04em; text-transform:uppercase; }
.ptitle .tb { height:30px; font-size:11px; }
.sec { margin:16px 0 8px; font-size:10.5px; font-weight:900; letter-spacing:.14em; color:var(--mint); text-transform:uppercase; }
.row { margin:10px 0 14px; }
.rhead { display:flex; align-items:center; gap:6px; margin-bottom:7px; }
.rhead label { flex:1; font-size:11px; font-weight:800; letter-spacing:.07em; color:#c3cbe0; text-transform:uppercase; }
.rhead .rs { width:22px; height:22px; border-radius:7px; border:1px solid var(--line); background:var(--card); color:var(--muted); font-size:12px; cursor:pointer; display:grid; place-items:center; padding:0; }
.rhead .rs:hover { color:#fff; }
.num { width:70px; height:26px; border-radius:8px; border:1px solid var(--line); background:#0a0e17; color:#fff; font:700 12px ui-monospace,monospace; text-align:right; padding:0 7px; outline:none; }
.num:focus { border-color:var(--acc1); }
.unit { color:var(--dim); font-size:11px; font-weight:700; min-width:14px; }
input[type=range] { pointer-events:none; display:block; margin:0; width:100%; height:6px; border-radius:9px; appearance:none; outline:none; cursor:pointer; background:linear-gradient(90deg,var(--acc1) 0,var(--acc2) var(--p,50%),#1d2536 var(--p,50%)); }
input[type=range]::-webkit-slider-thumb { appearance:none; width:18px; height:18px; opacity:0; }
input[type=range]::-moz-range-thumb { width:18px; height:18px; border:0; opacity:0; }
/* the handle: the only part of a slider that can be dragged */
.rg { position:relative; padding:8px 0; }
.rg .hd { position:absolute; top:50%; left:calc((100% - 18px) * var(--v,0) + 9px); width:36px; height:36px; margin:-18px 0 0 -18px; cursor:grab; touch-action:pan-y; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; -webkit-tap-highlight-color:transparent; }
.rg .hd::after { content:""; position:absolute; left:9px; top:9px; width:18px; height:18px; box-sizing:border-box; border-radius:6px; background:#fff; border:3px solid var(--acc1); box-shadow:0 2px 8px rgba(0,0,0,.5); transition:transform .12s, box-shadow .12s; }
.rg .hd.on { cursor:grabbing; } .rg .hd.on::after { transform:scale(1.35); box-shadow:0 0 0 5px rgba(168,85,247,.35), 0 2px 10px rgba(0,0,0,.6); }
input[type=range]:focus-visible + .hd::after { box-shadow:0 0 0 4px rgba(168,85,247,.5); }
.help { font-size:11px; color:var(--dim); margin-top:6px; }
.chk { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px; border-radius:12px; background:var(--card); border:1px solid var(--line); margin:8px 0; font-weight:700; font-size:12px; color:#cdd5ea; cursor:pointer; }
.chk input { display:none; }
.chk .sw { width:36px; height:20px; border-radius:20px; background:#2a3348; position:relative; flex:none; transition:.15s; }
.chk .sw::after { content:""; position:absolute; top:3px; left:3px; width:14px; height:14px; border-radius:50%; background:#fff; transition:.15s; }
.chk input:checked + .sw { background:linear-gradient(90deg,var(--acc1),var(--acc2)); }
.chk input:checked + .sw::after { left:19px; }
.grid { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.grid.g4 { grid-template-columns:repeat(4,1fr); }
.card { border:1px solid var(--line); background:var(--card); border-radius:12px; padding:7px 4px 6px; display:flex; flex-direction:column; align-items:center; gap:5px; cursor:pointer; color:#aab4cc; font-size:9.5px; font-weight:800; letter-spacing:.05em; text-transform:uppercase; text-align:center; }
.card:hover { background:var(--card2); color:#fff; }
.card.on { border-color:var(--acc1); color:#fff; background:linear-gradient(160deg,rgba(139,92,246,.22),rgba(236,72,153,.12)); box-shadow:0 0 0 1px var(--acc1) inset; }
.card canvas { width:46px; height:46px; }
.card .sw8 { display:flex; height:14px; width:52px; border-radius:5px; overflow:hidden; }
.card .sw8 i { flex:1; }
.card .ic { font-size:20px; height:30px; display:grid; place-items:center; color:#dfe5f5; }
.txt { width:100%; height:36px; border-radius:10px; border:1px solid var(--line); background:#0a0e17; color:#fff; font:600 13px inherit; font-family:inherit; padding:0 11px; outline:none; }
.txt:focus { border-color:var(--acc1); }
textarea.txt { height:auto; padding:9px 11px; resize:vertical; }
.status { color:var(--muted); font-size:12px; margin-top:8px; } #dl { color:var(--amber); font-weight:800; display:none; }

/* stage */
.stagewrap { flex:1; min-width:0; display:flex; align-items:center; justify-content:center; padding:14px; background:radial-gradient(ellipse at center,#121a2c,#07090f 70%); position:relative; }
.stage { height:min(calc(100vh - 100px),900px); aspect-ratio:9/16; max-width:100%; position:relative; border-radius:20px; overflow:hidden; border:1px solid var(--line); box-shadow:0 30px 60px rgba(0,0,0,.6); background:#000; }
.stage canvas { width:100%; height:100%; display:block; cursor:pointer; }
.chip { position:absolute; top:10px; padding:4px 10px; border-radius:99px; background:rgba(7,9,15,.72); border:1px solid rgba(255,255,255,.08); font:800 11px ui-monospace,monospace; color:#dfe5f5; letter-spacing:.04em; backdrop-filter:blur(6px); }
.chip.l { left:10px; } .chip.m { left:50%; transform:translateX(-50%); } .chip.r { right:10px; }
.chip.recb { top:auto; bottom:10px; left:10px; background:rgba(220,38,38,.9); display:none; }
.mute { position:absolute; right:10px; bottom:10px; width:34px; height:34px; border-radius:50%; border:1px solid rgba(255,255,255,.1); background:rgba(7,9,15,.72); color:#fff; cursor:pointer; font-size:15px; }
.paused-badge { position:absolute; inset:0; display:grid; place-items:center; pointer-events:none; }
.paused-badge span { padding:12px 22px; border-radius:16px; background:rgba(7,9,15,.75); font:900 18px Outfit,sans-serif; letter-spacing:.06em; border:1px solid rgba(255,255,255,.12); }
@media (max-width:1000px) { .panel { width:270px; } }
@media (max-width:760px) { main { flex-direction:column; } .rail { width:auto; flex-direction:row; } .panel { width:auto; height:40vh; } .top h1 { display:none; } }

.rec.busy { opacity:.6; cursor:progress; }

/* the machine's name in the top bar, and the machine picker in the Machine tab */
.mname { display:flex; align-items:center; gap:10px; min-width:0; }
.mname h1 { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mpick { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.mi { display:flex; flex-direction:column; align-items:center; gap:7px; padding:10px 4px 8px; border-radius:12px; border:1px solid var(--line); background:var(--card); color:#aab4cc; text-decoration:none; text-align:center; }
.mi:hover { background:var(--card2); color:#fff; border-color:#3a4560; }
.mi:focus-visible { outline:2px solid var(--acc1); outline-offset:2px; }
.mi.on { border-color:var(--acc1); color:#fff; background:linear-gradient(160deg,rgba(139,92,246,.22),rgba(236,72,153,.12)); box-shadow:0 0 0 1px var(--acc1) inset; }
.mic { width:36px; height:36px; border-radius:11px; display:grid; place-items:center; font-size:19px; color:#fff; flex:none; }
.mil { font-size:10.5px; font-weight:800; line-height:1.2; }
.msets { margin:20px 0 0; padding-top:14px; border-top:1px solid var(--line); font:800 14px Outfit,sans-serif; }
.top .acct { flex:none; display:flex; }
@media (max-width:760px) {
  .top { gap:6px; padding:0 8px; overflow-x:auto; } .top .seed { display:none; } .mname { display:none; }
  .top .ba-menu { position:fixed; top:62px; right:8px; }
}
@media (max-width:760px) { .mpick { grid-template-columns:repeat(auto-fill,minmax(92px,1fr)); } .stagewrap { min-height:0; } .stage { height:100%; } }
.top .rec, .top .back { white-space:nowrap; flex:none; }
@media (max-width:760px) { .top .hs, .top #bShot { display:none; } .top { scrollbar-width:none; } .top::-webkit-scrollbar { display:none; } .top .tb { min-width:34px; padding:0 7px; } .top .rec { padding:0 12px; } .chip { padding:3px 7px; font-size:9px; } .paused-badge span { font-size:14px; padding:9px 14px; } }
@media (max-width:760px) { .top .ba-in span { display:none; } .top .ba-in { padding:0 10px; } }

/* phones: the preview fills the screen, the tabs sit at the bottom and open the settings as a sheet above them */
.ptb { display:flex; gap:6px; } .pclose { display:none; }
@media (max-width:760px) {
  body { height:100dvh; }
  .top { height:52px; }
  main { flex-direction:column; }
  .stagewrap { order:1; flex:1; min-height:0; padding:6px; container-type:size; }
  .stage { width:100%; height:100%; max-width:none; border-radius:14px; }
  .stage canvas { object-fit:contain; }
  @supports (width:1cqh) { .stage { width:min(100cqw, 56.25cqh); height:auto; } }
  .panel { order:2; display:none; height:min(43dvh, 420px); border-right:none; border-top:1px solid var(--line); border-radius:16px 16px 0 0; padding-bottom:20px; }
  main.open .panel { display:block; }
  .rail { order:3; width:auto; justify-content:space-between; gap:0; border-right:none; border-top:1px solid var(--line); overflow-x:auto; overflow-y:hidden; scrollbar-width:none; padding:5px 4px calc(5px + env(safe-area-inset-bottom)); }
  .rail::-webkit-scrollbar { display:none; }
  .rail button { flex:1 0 auto; min-width:46px; padding:7px 3px 6px; font-size:8.5px; letter-spacing:.02em; }
  main:not(.open) .rail button.on { background:none; box-shadow:none; color:var(--dim); }
  .pclose { display:inline-flex; }
  .ptitle { position:sticky; top:-14px; z-index:2; background:var(--panel); margin:-14px -14px 6px; padding:12px 14px 8px; }
  /* while a setting is open the preview zooms in on the machine, so it stays large (the Text tab shows the whole frame) */
  main.open.zoom:not([data-tab="text"]):not([data-tab="export"]) .stage { width:100%; height:100%; aspect-ratio:auto; }
  main.open.zoom:not([data-tab="text"]):not([data-tab="export"]) .stage canvas { object-fit:cover; object-position:50% var(--oy,50%); }
}
.tapsound { display:none; position:absolute; left:50%; bottom:12px; transform:translateX(-50%); padding:9px 16px; border-radius:99px; border:1px solid rgba(255,255,255,.18); background:rgba(7,9,15,.8); color:#fff; font:800 13px Outfit,sans-serif; cursor:pointer; }

/* the export menu */
.ed { position:fixed; inset:0; z-index:900; display:grid; place-items:center; padding:18px; background:rgba(2,6,23,.78); backdrop-filter:blur(6px); }
.edb { width:min(880px,100%); max-height:100%; min-height:0; display:flex; flex-direction:column; background:var(--panel); border:1px solid #2a3350; border-radius:20px; overflow:hidden; box-shadow:0 30px 80px rgba(0,0,0,.6); }
.edt { display:flex; align-items:center; padding:14px 16px 10px; } .edt h2 { margin:0; font:900 20px Outfit,sans-serif; letter-spacing:.03em; text-transform:uppercase; } .edt .sp { flex:1; }
.edm { display:flex; gap:20px; padding:0 16px; min-height:0; flex:1; }
.edv { position:relative; flex:none; height:min(62vh,560px); aspect-ratio:9/16; border-radius:14px; overflow:hidden; background:#000; border:1px solid var(--line); align-self:flex-start; }
.edv video { width:100%; height:100%; display:block; object-fit:contain; cursor:pointer; }
.edp { position:absolute; left:50%; top:50%; width:58px; height:58px; margin:-29px 0 0 -29px; border-radius:50%; border:1px solid rgba(255,255,255,.2); background:rgba(7,9,15,.72); color:#fff; font-size:20px; cursor:pointer; } .edp.on { opacity:0; pointer-events:none; }
.edw { position:absolute; inset:0; display:grid; place-items:center; padding:16px; text-align:center; background:#0a0e17; color:var(--muted); font-weight:700; }
.edc { flex:1; min-width:0; overflow-y:auto; padding:0 4px 8px 0; } .edc .sec { display:flex; align-items:center; gap:8px; } .edc .sec:first-child { margin-top:2px; }
.edc .rs { width:22px; height:22px; border-radius:7px; border:1px solid var(--line); background:var(--card); color:var(--muted); cursor:pointer; padding:0; }
.edl { padding:6px 18px; } .track { position:relative; height:58px; border-radius:10px; background:#0a0e17; border:1px solid var(--line); touch-action:none; cursor:pointer; }
.track canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.track .cutl, .track .cutr { position:absolute; top:0; bottom:0; background:rgba(5,8,16,.82); pointer-events:none; } .track .cutl { left:0; border-radius:9px 0 0 9px; } .track .cutr { right:0; border-radius:0 9px 9px 0; }
.track .ph { position:absolute; top:-4px; bottom:-4px; width:2px; margin-left:-1px; background:#fff; pointer-events:none; }
.track .bm { position:absolute; top:-2px; margin-left:-7px; width:14px; text-align:center; color:var(--amber); font-size:13px; line-height:1; pointer-events:none; }
.track .h { position:absolute; top:-6px; bottom:-6px; width:40px; cursor:ew-resize; touch-action:none; } .track .h i { position:absolute; width:14px; top:0; bottom:0; border-radius:6px; background:linear-gradient(180deg,var(--acc1),var(--acc2)); box-shadow:0 2px 10px rgba(0,0,0,.6); }
.track .hs { margin-left:-36px; } .track .hs i { left:22px; } .track .he { margin-left:-4px; } .track .he i { left:4px; }
.track .h i::after { content:""; position:absolute; left:6px; top:35%; bottom:35%; width:2px; background:#fff; border-radius:2px; } .track .h.on i { filter:brightness(1.25); }
.edn { display:flex; flex-wrap:wrap; gap:10px 18px; margin:12px 0 8px; } .edn > div { display:flex; align-items:center; gap:6px; } .edn span { font-size:11px; font-weight:800; letter-spacing:.07em; text-transform:uppercase; color:#c3cbe0; min-width:38px; }
.edn button { width:30px; height:30px; border-radius:9px; border:1px solid var(--line); background:var(--card); color:#fff; font-size:16px; cursor:pointer; padding:0; } .edn .num { height:30px; width:72px; text-align:center; user-select:text; }
.edq { display:flex; flex-wrap:wrap; gap:8px; } .edlen { margin-top:9px; color:var(--muted); font-weight:700; } .edlen b { color:#fff; font-size:15px; }
.edr { display:flex; align-items:center; gap:10px; padding:3px 0; } .edr .dot { width:9px; height:9px; border-radius:50%; flex:none; } .edr label { width:112px; flex:none; font-weight:700; color:#cdd5ea; } .edr .rg { flex:1; min-width:0; } .edr .val { width:44px; text-align:right; font:700 12px ui-monospace,monospace; } .edr.off label, .edr.off .val { opacity:.45; }
.edf { display:flex; align-items:center; gap:14px; padding:12px 16px calc(14px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); margin-top:10px; } .edf .status { flex:1; margin:0; } .edf .rec { flex:none; height:44px; }
@media (max-width:760px) {
  .ed { padding:0; } .edb { height:100dvh; max-height:none; border-radius:0; border:none; } .edt { padding:10px 14px 6px; }
  .edm { flex-direction:column; gap:10px; padding:0 14px; overflow-y:auto; } .edv { height:38dvh; align-self:center; } .edc { overflow:visible; flex:none; width:100%; }
  .edf { flex-wrap:wrap; margin-top:0; padding-top:10px; } .edf .status:empty { display:none; } .edf .status { flex:none; width:100%; } .edf .rec { width:100%; justify-content:center; }
}

/* own sounds */
.card.mine { position:relative; } .card.mine .ic { color:var(--amber); }
.card .del { position:absolute; top:3px; right:3px; min-width:18px; height:18px; padding:0 4px; border-radius:9px; background:rgba(7,9,15,.8); border:1px solid var(--line); color:#cbd5e1; font-size:9px; line-height:16px; cursor:pointer; letter-spacing:0; }
.card .del:hover, .card .del.sure { background:#b91c1c; color:#fff; border-color:#ef4444; }
.card.add { grid-column:1/-1; flex-direction:row; justify-content:center; align-items:center; gap:12px; padding:12px 14px; border:1.5px dashed #34d399; background:linear-gradient(120deg,rgba(16,185,129,.22),rgba(6,182,212,.14)); color:#ecfdf5; text-transform:none; letter-spacing:0; text-align:left; }
.card.add:hover { background:linear-gradient(120deg,rgba(16,185,129,.34),rgba(6,182,212,.22)); border-style:solid; }
.card.add .plus { flex:none; width:34px; height:34px; border-radius:50%; display:grid; place-items:center; background:linear-gradient(160deg,#34d399,#06b6d4); color:#04221a; box-shadow:0 4px 14px rgba(16,185,129,.4); }
.card.add .plus svg { display:block; } .card.add b { display:block; font-size:17px; font-weight:900; letter-spacing:.01em; } .card.add small { display:block; font-size:10.5px; font-weight:600; color:#a7f3d0; margin-top:2px; }

.top .back { display:inline-flex; align-items:center; gap:6px; } .top .back .bico { width:22px; height:22px; display:block; }

.lagnote { position:absolute; top:46px; left:50%; transform:translateX(-50%); width:max-content; max-width:calc(100% - 20px); display:flex; align-items:center; gap:12px; padding:10px 10px 10px 18px; border-radius:16px; background:rgba(180,83,9,.94); border:1px solid rgba(255,255,255,.18); box-shadow:0 8px 24px rgba(0,0,0,.35); color:#fff; font:500 15px/1.35 Outfit,sans-serif; text-align:left; pointer-events:none; opacity:0; transition:opacity .3s; z-index:2; } .lagnote.on { opacity:1; pointer-events:auto; } .lagnote button { flex:none; width:28px; height:28px; border-radius:50%; border:0; background:rgba(0,0,0,.3); color:#fff; font:700 18px/1 sans-serif; cursor:pointer; padding:0; display:grid; place-items:center; } .lagnote b { display:block; font-weight:800; font-size:17px; }
@media (max-width:760px) { .lagnote { top:32px; gap:8px; font-size:12px; padding:7px 7px 7px 12px; border-radius:12px; } .lagnote b { font-size:13.5px; } .lagnote button { width:24px; height:24px; font-size:15px; } }

.edf .edst { flex:1; min-width:0; } .edbar { display:none; height:8px; margin-top:7px; border-radius:99px; background:rgba(255,255,255,.1); overflow:hidden; } .edbar.on { display:block; } .edbar i { display:block; height:100%; width:0; border-radius:inherit; background:linear-gradient(90deg,#a855f7,#ec4899); transition:width .25s; }
@media (max-width:760px) { .edf .edst { flex:none; width:100%; } }
