Web: sidebar playlists fixed for 1080p, side album art, vertical stem faders with live meters

- Nav scrolls, playlists section always gets room, boot race fixed (waits on connect)
- Album art expands into the left sidebar (Feishin style), collapses on hover button
- Mixer: tall vertical channel strips with per-stem peak meters (AnalyserNode, rAF, transform-only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-11-19 21:57:24 -08:00
1 parent 115eb28bdf
commit f624a9866a
5 files changed
+165 -100

No files matched your search

+81 -49
View File
@@ -148,19 +148,20 @@ let drawer = null; // "mixer" | "lyrics" | "queue"
const Lyr = { id: null, data: null, idx: -1 };
const artOf = (t, size) => t?.srv ? img(t.srv, t.thumb, size) : "";
// Full-size album art over the content area, opened from the art in the player bar.
const Big = {
el: null,
open() { if (!Q.cur() || Radio.station) return; this.el.hidden = false; this.fill(); },
close() { if (this.el) this.el.hidden = true; },
// Feishin-style big art at the foot of the sidebar, opened from the art in the player bar.
const wide = matchMedia("(min-width: 861px)");
const SideArt = {
src: "",
show(on) { S.sideArt = on; save(); this.fill(); },
fill() {
const o = this.el;
if (!o || o.hidden) return;
const t = Q.cur(), src = artOf(t, 1000);
if (!src) return this.close();
if (o.dataset.src !== src) { o.dataset.src = src; o.querySelector("img").src = src; o.querySelector(".bg").style.backgroundImage = `url("${src}")`; }
o.querySelector(".t").textContent = t.title;
o.querySelector(".s").textContent = [t.artist, t.album].filter(Boolean).join(" · ");
const t = Radio.station ? null : Q.cur(), src = artOf(t, 640), on = !!(S.sideArt && src && wide.matches);
$("#app").classList.toggle("sideart", on);
$("#player").classList.toggle("sideart", on);
if (!on || src === this.src) return;
// Swap only once the new art has decoded, so it never flashes empty between tracks.
this.src = src;
const im = new Image(); im.src = src;
im.decode().catch(() => {}).then(() => { if (this.src === src) $("#sideart img").src = src; });
},
};
const UI = {
@@ -173,7 +174,7 @@ const UI = {
$("#np-title").textContent = st.name;
$("#np-sub").textContent = "Web Radio";
$("#np-art").removeAttribute("src");
$("#b-art").hidden = true; Big.close();
$("#b-art").hidden = true; SideArt.fill();
document.title = `${st.name} · Stemify`;
if ("mediaSession" in navigator) navigator.mediaSession.metadata = new MediaMetadata({ title: st.name, artist: "Web Radio" });
return;
@@ -184,7 +185,7 @@ const UI = {
$("#np-sub").textContent = t ? [t.artist, t.album].filter(Boolean).join(" · ") : "";
const art = artOf(t, 120);
if (art) $("#np-art").src = art; else $("#np-art").removeAttribute("src");
$("#b-art").hidden = !art; Big.fill();
$("#b-art").hidden = !art; SideArt.fill();
document.title = t ? `${t.title} · Stemify` : "Stemify";
if ("mediaSession" in navigator) {
navigator.mediaSession.metadata = t ? new MediaMetadata({
@@ -206,6 +207,7 @@ const UI = {
for (const d of ["mixer", "lyrics", "queue"]) $(`#b-${d}`).classList.toggle("on", drawer === d);
$("#b-mixer").classList.toggle("dot", S.karaoke);
if ("mediaSession" in navigator) navigator.mediaSession.playbackState = playing ? "playing" : "paused";
if (drawer === "mixer") Meter.start();
},
progress() {
$("#t-pos").textContent = E.loading ? `${Math.round(E.loadFrac * 100)}%` : fmtTime(E.position());
@@ -225,6 +227,7 @@ const UI = {
d.innerHTML = tabs + `<div id="dbody">${drawer === "mixer" ? mixerHtml() : drawer === "queue" ? queueHtml() : lyricsShell()}</div>`;
if (drawer === "lyrics") loadLyrics();
if (drawer === "queue") $(".q-item.cur", d)?.scrollIntoView({ block: "center" });
d.classList.toggle("mixing", drawer === "mixer");
}
this.transport();
},
@@ -262,14 +265,15 @@ function mixerHtml() {
if (!names.length) return `<p class="note">${E.loading ? "Loading stems…" : Q.cur() ? "This track has no stems yet. Right-click it and pick Stem Now." : "Play something with stems to mix it."}</p>`;
return `<div id="mixer" data-names="${esc(names.join(","))}">
<div class="presets">${presetsHtml(names)}</div>
${names.map(n => {
<div class="strips">${names.map(n => {
const s = setting(n);
return `<div class="stem ${stemGain(n, names) ? "" : "silent"} ${s.muted ? "muted" : ""}" data-stem="${esc(n)}" style="--c:${STEM_COLORS[n] || "#8e8e93"}">
<div class="fader" data-fader="${esc(n)}" role="slider" tabindex="0" aria-label="${esc(n)} level" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(s.level * 100)}" style="--v:${pct(s.level)}">
<span class="name">${esc(n)}</span><span class="pct">${pct(s.level)}</span></div>
<button class="ms mute ${s.muted ? "on" : ""}" data-mute="${esc(n)}" title="Mute">M</button>
<button class="ms solo ${s.solo ? "on" : ""}" data-solo="${esc(n)}" title="Solo">S</button></div>`;
}).join("")}
<div class="pct">${pct(s.level)}</div>
<div class="fader" data-fader="${esc(n)}" role="slider" aria-orientation="vertical" tabindex="0" aria-label="${esc(n)} level" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(s.level * 100)}" style="--v:${s.level}">
<i class="lvl"></i><i class="mtr"></i><i class="cap"><b></b></i></div>
<div class="name" title="${esc(n)}">${esc(n)}</div>
<div class="msrow"><button class="ms mute ${s.muted ? "on" : ""}" data-mute="${esc(n)}" title="Mute">M</button><button class="ms solo ${s.solo ? "on" : ""}" data-solo="${esc(n)}" title="Solo">S</button></div></div>`;
}).join("")}</div>
<div id="mixfoot">${mixFoot(names)}</div></div>`;
}
// Updates the open mixer in place, so taps answer at once and the slider being dragged keeps
@@ -292,9 +296,30 @@ function syncMixer() {
}
const paintFader = (f, v) => {
const p = pct(v);
if (f.style.getPropertyValue("--v") === p) return;
f.style.setProperty("--v", p); f.setAttribute("aria-valuenow", Math.round(v * 100)); f.querySelector(".pct").textContent = p;
if (f.style.getPropertyValue("--v") === String(v)) return;
f.style.setProperty("--v", v); f.setAttribute("aria-valuenow", Math.round(v * 100)); f.parentNode.querySelector(".pct").textContent = pct(v);
};
// Live meters: each stem's bar rises and falls with its audio (pre-fader peak, shown under the
// fader's level like the iOS mixer). Runs on animation frames only while the mixer is open and
// playing or still falling, and writes nothing but transforms.
const Meter = {
raf: 0, rows: null, box: null, shown: new Map(),
start() { if (!this.raf) this.raf = requestAnimationFrame(this.tick); },
tick: () => {
const M = Meter, box = $("#mixer");
M.raf = 0;
if (!box || drawer !== "mixer" || document.hidden) return;
if (M.box !== box) { M.box = box; M.rows = [...box.querySelectorAll(".stem")].map(r => ({ n: r.dataset.stem, el: r.querySelector(".mtr") })); M.shown.clear(); }
const playing = E.playing && !E.buffering, names = mixNames();
let moving = false;
for (const r of M.rows) {
const st = setting(r.n), live = playing && stemGain(r.n, names) ? E.meter(r.n) * st.level : 0;
const prev = M.shown.get(r.n) || 0, v = live >= prev ? live : Math.max(live, prev - 0.025);
if (Math.abs(v - prev) > 0.002 || (v === 0 && prev !== 0)) { r.el.style.transform = `scaleY(${v.toFixed(3)})`; M.shown.set(r.n, v); }
if (v > 0) moving = true;
}
if (playing || moving) M.start();
},
};
// Sets a stem's level live; the save and mixer refresh wait until the gesture settles.
let levelSave = 0;
@@ -362,30 +387,27 @@ d$.addEventListener("click", ev => {
else if (ds.q) Q.jump(+ds.q);
else if (ds.li) E.seek(Lyr.data.lines[+ds.li].t);
});
// Faders: a mouse sets the level where it presses and drags from there. A finger has to move
// sideways first (or tap) so scrolling the drawer never changes a level.
// Faders: vertical. Grabbing the cap (or any touch) moves it from where it is; a mouse press
// elsewhere on the track jumps there first. Touches never scroll the drawer from a fader.
{
let drag = null;
const at = (f, x) => { const r = f.getBoundingClientRect(); setLevel(f.dataset.fader, (x - r.left) / r.width); };
const span = r => r.height - 8, val = (r, y) => (r.bottom - 4 - y) / span(r);
d$.addEventListener("pointerdown", ev => {
const f = ev.target.closest(".fader");
if (!f || ev.button) return;
drag = { f, id: ev.pointerId, x0: ev.clientX, y0: ev.clientY, on: ev.pointerType === "mouse" };
if (drag.on) { ev.preventDefault(); f.setPointerCapture(ev.pointerId); f.classList.add("drag"); at(f, ev.clientX); }
ev.preventDefault();
const n = f.dataset.fader, r = f.getBoundingClientRect(), v = setting(n).level;
const onCap = Math.abs(ev.clientY - (r.bottom - 4 - v * span(r))) < 14;
drag = { f, n, id: ev.pointerId, y0: ev.clientY, v0: v, r, rel: onCap || ev.pointerType !== "mouse" };
f.setPointerCapture(ev.pointerId); f.classList.add("drag");
if (!drag.rel) setLevel(n, val(r, ev.clientY));
});
d$.addEventListener("pointermove", ev => {
if (!drag || ev.pointerId !== drag.id) return;
if (!drag.on) {
const dx = Math.abs(ev.clientX - drag.x0), dy = Math.abs(ev.clientY - drag.y0);
if (dy > 8 && dy > dx) { drag = null; return; }
if (dx < 6) return;
drag.on = true; drag.f.setPointerCapture(ev.pointerId); drag.f.classList.add("drag");
}
at(drag.f, ev.clientX);
setLevel(drag.n, drag.rel ? drag.v0 + (drag.y0 - ev.clientY) / span(drag.r) : val(drag.r, ev.clientY));
});
const end = ev => {
if (!drag || ev.pointerId !== drag.id) return;
if (!drag.on && ev.type === "pointerup") at(drag.f, ev.clientX);
drag.f.classList.remove("drag"); drag = null;
};
d$.addEventListener("pointerup", end);
@@ -395,7 +417,7 @@ d$.addEventListener("click", ev => {
const f = ev.target.closest(".fader");
if (!f) return;
ev.preventDefault();
setLevel(f.dataset.fader, setting(f.dataset.fader).level - Math.sign(ev.deltaY || -ev.deltaX) * 0.02);
setLevel(f.dataset.fader, setting(f.dataset.fader).level - Math.sign(ev.deltaY || ev.deltaX) * 0.02);
}, { passive: false });
d$.addEventListener("keydown", ev => {
const f = ev.target.closest(".fader");
@@ -477,9 +499,10 @@ function applyBar() {
$("#speed").style.display = S.bar.speed ? "" : "none";
for (const k of ["mixer", "lyrics", "queue"]) $(`#b-${k}`).style.display = S.bar[k] ? "" : "none";
}
Big.el = $("#bigart");
Big.el.onclick = () => Big.close();
$("#b-art").onclick = ev => { ev.stopPropagation(); Big.open(); };
$("#b-art").onclick = ev => { if (wide.matches) { ev.stopPropagation(); SideArt.show(true); } };
$("#sideart .sa-col").onclick = () => SideArt.show(false);
$("#sideart .sa-img").onclick = () => { const t = Q.cur(); if (t?.albumKey) location.hash = `#/album/${t.srv}:${t.albumKey}`; };
wide.addEventListener("change", () => SideArt.fill());
$(".np").onclick = () => { const t = Q.cur(); if (t?.albumKey) location.hash = `#/album/${t.srv}:${t.albumKey}`; };
if ("mediaSession" in navigator) {
@@ -492,7 +515,7 @@ if ("mediaSession" in navigator) {
}
document.addEventListener("keydown", ev => {
if (ev.key === "Escape") { Big.close(); return Menu.close(); }
if (ev.key === "Escape") return Menu.close();
if (ev.target.closest("input, select, textarea") || ev.metaKey || ev.ctrlKey || ev.altKey) return;
const k = ev.key.toLowerCase();
if (k === " ") { ev.preventDefault(); togglePlay(); }
@@ -897,7 +920,7 @@ const routes = {
if (my !== seq) return;
pls = st.random ? pls.sort(() => Math.random() - 0.5) : pls.sort(comparator(st.param));
count(pls.length + playlists.length, "playlist");
navPls = [...pls].sort((a, b) => a.title.localeCompare(b.title)); navPlaylists();
navPls = [...pls].sort((a, b) => (a.title || "").localeCompare(b.title || "")); navState = "ok"; navPlaylists();
$("#plexpl").innerHTML = pls.length ? `<div class="grid">${pls.map(p => card({ href: `#/playlist/${p._srv}:${p.ratingKey}`, img: img(p._srv, p.thumb || p.composite), fb: p.composite && rawImg(p._srv, p.composite), t: p.title, s: plural(p.leafCount || 0, "track"), kind: "playlist", srv: p._srv, key: p.ratingKey })).join("")}</div>`
: `<p class="empty-msg">No music playlists.</p>`;
},
@@ -985,15 +1008,22 @@ const routes = {
// Sidebar playlist list: stem playlists, then Plex ones (fetched at start and on the Playlists page).
let navPls = [], navHtml = "";
let navState = "loading";
const STEMDOT = '<svg viewBox="0 0 24 24"><path d="M5 10h2v10H5zm4-6h2v16H9zm4 8h2v8h-2zm4-4h2v12h-2z"/></svg>';
function navPlaylists() {
const box = $("#nav-pl"), html = playlists.map(p => `<a href="#/stemplaylist/${p.id}">${esc(p.title)}</a>`).join("")
+ navPls.map(p => `<a href="#/playlist/${p._srv}:${p.ratingKey}">${esc(p.title)}</a>`).join("");
const box = $("#nav-pl"), html = playlists.map(p => `<a href="#/stemplaylist/${p.id}" title="${esc(p.title)} · stem playlist"><span>${esc(p.title)}</span>${STEMDOT}</a>`).join("")
+ navPls.map(p => `<a href="#/playlist/${p._srv}:${p.ratingKey}" title="${esc(p.title)}"><span>${esc(p.title)}</span></a>`).join("")
|| `<p class="nav-empty">${navState === "loading" ? "Loading…" : navState === "none" ? "No Plex server set up." : "No playlists yet."}</p>`;
if (html !== navHtml) { navHtml = html; box.innerHTML = html; }
for (const a of box.children) a.classList.toggle("on", a.getAttribute("href") === location.hash);
}
async function loadNavPlaylists() {
if (!liveServers().length) return;
try { navPls = (await everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" })).sort((a, b) => a.title.localeCompare(b.title)); } catch {}
await connecting;
if (!liveServers().length) navState = "none";
else {
try { navPls = (await everything(liveServers().map(srv => ({ srv })), "/playlists", { playlistType: "audio" })).sort((a, b) => (a.title || "").localeCompare(b.title || "")); } catch {}
navState = "ok";
}
navPlaylists();
}
@@ -1207,7 +1237,7 @@ function renderSettings() {
navigator.storage?.estimate?.().then(e => { const el = $("#storage-info"); if (el && e?.quota) el.insertAdjacentText("afterbegin", `${fmtBytes(e.usage)} of ${fmtBytes(e.quota)} used. `); }).catch(() => {});
const again = () => { if (location.hash.startsWith("#/settings")) renderSettings(); };
const plexChanged = () => { genreCache = null; save(); };
const plexChanged = () => { genreCache = null; save(); loadNavPlaylists(); };
$("#signin").onclick = async () => {
const st = $("#sstatus");
try { const ok = await signIn(m => { st.textContent = m; }); plexChanged(); toast(`Added ${plural(ok.length, "server")}`); again(); }
@@ -1305,16 +1335,18 @@ async function connect() {
save();
}
let connecting = null;
(async () => {
applyTheme();
applyStemFilter();
applyBar();
await Offline.init();
await Promise.race([connect(), new Promise(r => setTimeout(r, 5000))]);
connecting = connect();
await Promise.race([connecting, new Promise(r => setTimeout(r, 5000))]);
Q.restore();
UI.all();
route();
loadNavPlaylists();
Live.poll();
setInterval(() => { if (!document.hidden) Stems.refresh(); }, 5 * 60 * 1000);
setInterval(() => { if (!document.hidden) { Stems.refresh(); loadNavPlaylists(); } }, 5 * 60 * 1000);
})();
+7 -5
View File
@@ -22,10 +22,13 @@
<a href="#/playlists" data-nav="playlists"><svg viewBox="0 0 24 24"><path d="M3 5h14v2H3zm0 6h14v2H3zm0 6h9v2H3zm16-4v-2l4 1v2l-2-.5V19a2.5 2.5 0 1 1-2-2.45V13z"/></svg>Playlists</a>
<a href="#/downloads" data-nav="downloads"><svg viewBox="0 0 24 24"><path d="M11 3h2v10.2l3.6-3.6 1.4 1.4-6 6-6-6 1.4-1.4 3.6 3.6V3zM4 19h16v2H4z"/></svg>Downloads</a>
<a href="#/radio" data-nav="radio"><svg viewBox="0 0 24 24"><path d="M12 10a2 2 0 1 1 0 4 2 2 0 0 1 0-4zM7.8 7.8l1.4 1.4a4 4 0 0 0 0 5.6l-1.4 1.4a6 6 0 0 1 0-8.4zm8.4 0a6 6 0 0 1 0 8.4l-1.4-1.4a4 4 0 0 0 0-5.6l1.4-1.4zM5 5l1.4 1.4a8 8 0 0 0 0 11.2L5 19A10 10 0 0 1 5 5zm14 0a10 10 0 0 1 0 14l-1.4-1.4a8 8 0 0 0 0-11.2L19 5z"/></svg>Web Radio</a>
<div class="nav-h">Playlists</div>
<div id="nav-pl"></div>
<div id="live" hidden></div>
<a href="#/settings" data-nav="settings" class="settings-link"><svg viewBox="0 0 24 24"><path d="M10.3 2h3.4l.5 2.6c.6.2 1.2.5 1.7.9l2.5-.9 1.7 2.9-2 1.8a7 7 0 0 1 0 1.9l2 1.8-1.7 2.9-2.5-.9c-.5.4-1.1.7-1.7.9l-.5 2.6h-3.4l-.5-2.6a7 7 0 0 1-1.7-.9l-2.5.9-1.7-2.9 2-1.8a7 7 0 0 1 0-1.9l-2-1.8 1.7-2.9 2.5.9c.5-.4 1.1-.7 1.7-.9l.5-2.6zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z" transform="translate(0 1)"/></svg>Settings</a>
<section class="nav-sec">
<a class="nav-h" href="#/playlists">Playlists</a>
<div id="nav-pl"></div>
</section>
<div id="live" hidden></div>
<div id="sideart"><button class="sa-img" title="Go to album"><img alt=""></button><button class="sa-col" title="Collapse art"><svg viewBox="0 0 24 24"><path d="M12 16.4L4.3 8.7l1.4-1.4 6.3 6.3 6.3-6.3 1.4 1.4z"/></svg></button></div>
</aside>
<main id="view"></main>
<aside id="drawer" hidden></aside>
@@ -33,7 +36,7 @@
<footer id="player" class="empty">
<div class="left">
<div class="np">
<button id="b-art" title="Expand art" hidden><img id="np-art" alt=""><span class="exp"><svg viewBox="0 0 24 24"><path d="M4 4h6v2H7.4l4 4-1.4 1.4-4-4V10H4V4zm16 0v6h-2V7.4l-4 4-1.4-1.4 4-4H14V4h6zM4 20v-6h2v2.6l4-4 1.4 1.4-4 4H10v2H4zm16 0h-6v-2h2.6l-4-4 1.4-1.4 4 4V14h2v6z"/></svg></span></button>
<button id="b-art" title="Expand art" hidden><img id="np-art" alt=""><span class="exp"><svg viewBox="0 0 24 24"><path d="M12 7.6l7.7 7.7-1.4 1.4-6.3-6.3-6.3 6.3-1.4-1.4z"/></svg></span></button>
<div class="np-text"><div id="np-title"></div><div id="np-sub"></div></div>
</div>
</div>
@@ -59,7 +62,6 @@
<input id="volume" type="range" min="0" max="1" step="0.01" title="Volume">
</div>
</footer>
<div id="bigart" hidden><div class="bg"></div><button class="x" title="Close (Esc)">×</button><img alt=""><div class="cap"><div class="t"></div><div class="s"></div></div></div>
<script type="module" src="app.js"></script>
</body>
</html>
+18 -5
View File
@@ -193,7 +193,7 @@ const Pre = {
// ---- engine -----------------------------------------------------------------------------------
export const E = {
els: [], names: [], gains: [], urls: [], ctx: null, master: null,
els: [], names: [], gains: [], meters: [], urls: [], ctx: null, master: null, mbuf: new Float32Array(1024),
want: false, stalled: false, loading: false, loadFrac: 0, pendingPos: 0,
entry: null, offline: null, ctl: null, gen: 0,
@@ -262,13 +262,15 @@ export const E = {
el.src = s.url;
el.playbackRate = el.defaultPlaybackRate = S.speed;
if (this.pendingPos) el.currentTime = this.pendingPos;
let gain = null;
let gain = null, meter = null;
if (graph) {
gain = this.ctx.createGain();
this.ctx.createMediaElementSource(el).connect(gain).connect(this.master);
meter = this.ctx.createAnalyser();
meter.fftSize = 1024;
this.ctx.createMediaElementSource(el).connect(meter).connect(gain).connect(this.master);
}
if (s.blob) this.urls.push(s.url);
this.els.push(el); this.gains.push(gain); this.names.push(s.name);
this.els.push(el); this.gains.push(gain); this.meters.push(meter); this.names.push(s.name);
}
this.graph = graph;
const lead = this.els[0];
@@ -284,10 +286,21 @@ export const E = {
this.ctl?.abort(); this.ctl = null;
for (const el of this.els) { el.pause(); el.removeAttribute("src"); el.load(); }
for (const u of this.urls) URL.revokeObjectURL(u);
this.els = []; this.names = []; this.gains = []; this.urls = [];
this.els = []; this.names = []; this.gains = []; this.meters = []; this.urls = [];
this.loading = false;
},
// A stem's live peak before its fader, 0..1 over a 48 dB range (0 without Web Audio).
meter(name) {
const a = this.meters[this.names.indexOf(name)];
if (!a) return 0;
const b = this.mbuf;
a.getFloatTimeDomainData(b);
let p = 0;
for (let i = 0; i < b.length; i++) { const v = b[i] < 0 ? -b[i] : b[i]; if (v > p) p = v; }
return p < 0.004 ? 0 : Math.min(1, (20 * Math.log10(p) + 48) / 48);
},
applyGains() {
const named = this.names.filter(Boolean);
this.els.forEach((el, i) => {
+1 -1
View File
@@ -24,7 +24,7 @@ export const S = Object.assign({
acapella: false, // spell "A Cappella" as "Acapella"
bar: { speed: true, mixer: true, lyrics: true, queue: true }, // player bar buttons
stations: [], // web radio: [{id, name, url}]
theme: "graphite", accent: "", css: "",
theme: "graphite", accent: "", css: "", sideArt: false,
}, load(KEY) || {});
if (!S.clientId) S.clientId = uuid();
+58 -40
View File
@@ -9,6 +9,7 @@
--accent-ink: #ffffff;
--radius: 6px;
--player-h: 90px;
--nav-w: 240px;
--glass: #101010ee;
--hover: #e7e7e70d;
--shadow: #0009;
@@ -30,20 +31,36 @@ button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; fill: currentColor; display: block; }
#app { display: grid; grid-template-columns: 200px 1fr auto; height: calc(100% - var(--player-h)); }
#nav { background: var(--panel); padding: 16px 10px 10px; display: flex; flex-direction: column; gap: 1px; min-height: 0; }
#app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); height: calc(100% - var(--player-h)); }
#nav { background: var(--panel); padding: 16px 10px 0; display: flex; flex-direction: column; gap: 1px; min-height: 0; overflow-y: auto; overflow-x: hidden; }
#nav > * { flex: none; }
.brand { white-space: nowrap; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; padding: 0 10px 6px; }
.brand::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 3px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 4px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav a { display: flex; align-items: center; gap: 12px; min-height: 34px; padding: 0 10px; border-radius: 4px; color: var(--muted); font-weight: 500; white-space: nowrap; transition: color .12s, background-color .12s; }
#nav a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#nav a svg { width: 18px; height: 18px; flex: none; }
#nav a:hover { color: var(--text); }
#nav a:hover { color: var(--text); background: var(--hover); }
#nav a.on { background: var(--raised); color: var(--text); }
#search input { width: 100%; margin: 10px 0; padding: 7px 10px; background: var(--raised); border: 1px solid transparent; border-radius: 4px; outline: none; }
#search input:focus { border-color: var(--accent); }
.nav-h { margin: 16px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); opacity: .7; }
#nav-pl { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -4px; padding: 0 4px; }
#nav-pl a { display: block; padding: 5px 10px; font-weight: 400; }
.settings-link { margin-top: 6px; border-top: 1px solid var(--line); border-radius: 0 !important; padding-top: 10px !important; }
.nav-sec { flex: 1 1 0 !important; min-height: 150px; display: flex; flex-direction: column; margin: 10px -10px 0; padding: 6px 10px 8px; border-top: 1px solid var(--line); }
#nav .nav-h { flex: none; min-height: 30px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: none; }
#nav .nav-h:hover { background: none; }
#nav-pl { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 1px; margin: 0 -6px; padding: 0 6px; }
#nav-pl a { flex: none; min-height: 32px; font-weight: 400; gap: 8px; justify-content: space-between; }
#nav-pl a svg { width: 13px; height: 13px; opacity: .55; }
.nav-empty { margin: 4px 10px; color: var(--muted); opacity: .7; font-size: 12px; }
.settings-link { margin-top: 2px; }
#sideart { display: none; position: relative; margin: 0 -10px; aspect-ratio: 1; background: var(--raised); overflow: hidden; }
#app.sideart #sideart { display: block; animation: sain .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes sain { from { opacity: 0; transform: translateY(24px); } }
#sideart .sa-img { display: block; width: 100%; height: 100%; padding: 0; cursor: pointer; }
#sideart img { display: block; width: 100%; height: 100%; object-fit: cover; }
#sideart img:not([src]) { visibility: hidden; }
#sideart .sa-col { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
background: rgba(0, 0, 0, .62); color: #fff; font-size: 18px; opacity: 0; transform: scale(.9); transition: opacity .15s, transform .15s; }
#sideart:hover .sa-col, #sideart .sa-col:focus-visible { opacity: 1; transform: none; }
#sideart .sa-col:hover { background: rgba(0, 0, 0, .85); }
#view { overflow-y: auto; padding: 24px 32px 48px; background: var(--bg); }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; }
@@ -189,6 +206,7 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
#drawer h2 { margin: 0 0 14px; }
#drawer { display: flex; flex-direction: column; padding-top: 12px; }
#drawer[hidden] { display: none; }
#drawer.mixing { width: 340px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; position: sticky; top: -12px; background: var(--panel); padding: 6px 0; z-index: 1; }
.tabs button { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.tabs button.on { background: var(--raised); color: var(--text); }
@@ -210,20 +228,26 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
.chip { background: var(--raised); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip:disabled { opacity: .35; cursor: default; }
.stem { --c: #8e8e93; display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: stretch; margin-bottom: 8px; }
.fader { position: relative; height: 54px; border-radius: 10px; overflow: hidden; cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none;
background: color-mix(in srgb, var(--c) 12%, var(--raised)); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; outline: none; }
.fader::before { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--v)); will-change: transform;
background: linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, transparent), color-mix(in srgb, var(--c) 75%, transparent)); pointer-events: none; }
.fader::after { content: ""; position: absolute; top: 8px; bottom: 8px; left: clamp(2px, calc(var(--v) - 3px), calc(100% - 5px)); width: 3px; border-radius: 2px; background: var(--c); box-shadow: 0 0 8px var(--c); pointer-events: none; }
.fader:focus-visible { box-shadow: 0 0 0 2px var(--c); }
.fader.drag::after { width: 4px; }
.fader .name, .fader .pct { position: relative; z-index: 1; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .55); }
.fader .name { text-transform: capitalize; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fader .pct { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stem.silent .fader { filter: saturate(.15); opacity: .55; }
.ms { width: 44px; height: auto; border-radius: 8px; background: var(--raised); font-size: 12px; font-weight: 800; color: var(--muted);
.strips { display: flex; gap: 8px; justify-content: center; margin: 4px 0 6px; --fh: clamp(170px, calc(100vh - var(--player-h) - 470px), 320px); }
.stem { --c: #8e8e93; flex: 1 1 0; min-width: 0; max-width: 58px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.stem .pct { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.stem .name { text-align: center; text-transform: capitalize; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fader { position: relative; height: var(--fh); border-radius: 12px; overflow: hidden; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; outline: none;
background: color-mix(in srgb, var(--c) 9%, var(--raised)); contain: strict; }
.fader i { position: absolute; display: block; pointer-events: none; }
.fader .lvl, .fader .mtr { inset: 0; transform-origin: bottom; will-change: transform; }
.fader .lvl { transform: scaleY(var(--v)); background: linear-gradient(to top, color-mix(in srgb, var(--c) 30%, transparent), color-mix(in srgb, var(--c) 46%, transparent)); }
.fader .mtr { transform: scaleY(0); background: linear-gradient(to top, color-mix(in srgb, var(--c) 82%, #000), var(--c)); }
.fader .cap { left: 0; right: 0; top: 4px; bottom: 4px; transform: translateY(calc((1 - var(--v)) * 100%)); will-change: transform; }
.fader .cap b { position: absolute; left: 6px; right: 6px; top: -3px; height: 6px; border-radius: 3px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); transition: transform .1s; }
.fader:hover .cap b, .fader.drag .cap b { transform: scaleY(1.35); }
.fader:focus-visible { box-shadow: inset 0 0 0 2px var(--c); }
.stem.silent .fader, .stem.silent .name { opacity: .4; }
.stem.silent .mtr { visibility: hidden; }
.msrow { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.ms { height: 26px; min-width: 0; border-radius: 6px; background: var(--raised); font-size: 11px; font-weight: 800; color: var(--muted);
transition: transform .08s, background-color .12s, color .12s; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ms:hover { color: var(--text); }
.ms:active { transform: scale(.88); }
.ms.mute.on { background: #ff453a; color: #fff; }
.ms.solo.on { background: #ffcc00; color: #1a1400; }
@@ -245,22 +269,13 @@ input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var
border-top: 1px solid rgba(50, 50, 50, .7); display: grid; grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.6fr) minmax(180px, 1fr); align-items: center; gap: 20px; padding: 0 20px; }
#player.empty .center, #player.empty .right, #player.empty #b-art { opacity: .35; pointer-events: none; }
.left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#b-art { position: relative; flex: none; width: 60px; height: 60px; padding: 0; border-radius: 4px; overflow: hidden; cursor: zoom-in; }
#b-art { position: relative; flex: none; width: 60px; height: 60px; padding: 0; border-radius: 4px; overflow: hidden; }
#b-art[hidden] { display: none; }
#b-art .exp { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .15s; }
#b-art .exp svg { width: 22px; height: 22px; fill: #fff; }
#b-art:hover .exp, #b-art:focus-visible .exp { opacity: 1; }
#bigart { position: fixed; inset: 0 0 var(--player-h) 0; z-index: 40; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
padding: 32px 16px; background: #000; overflow: hidden; cursor: zoom-out; animation: bigin .18s ease-out; }
#bigart[hidden] { display: none; }
#bigart .bg { position: absolute; inset: -80px; background-size: cover; background-position: center; filter: blur(70px) brightness(.4) saturate(1.3); transform: translateZ(0); }
#bigart img { position: relative; width: min(68vh, 88vw, 760px); aspect-ratio: 1; object-fit: cover; border-radius: 8px; box-shadow: 0 24px 70px rgba(0, 0, 0, .65); }
#bigart .cap { position: relative; text-align: center; max-width: 88vw; }
#bigart .t { font-size: clamp(20px, 3vw, 30px); font-weight: 800; }
#bigart .s { color: rgba(255, 255, 255, .7); margin-top: 4px; }
#bigart .x { position: absolute; top: 14px; right: 18px; font-size: 28px; color: #fff; opacity: .7; }
#bigart .x:hover { opacity: 1; }
@keyframes bigin { from { opacity: 0; } }
#b-art .exp { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .7);
opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s; }
#b-art .exp svg { width: 15px; height: 15px; fill: #fff; }
#b-art:hover .exp, #b-art:focus-visible .exp { opacity: 1; transform: none; }
#player.sideart #b-art { display: none; }
.np { display: flex; gap: 12px; align-items: center; min-width: 0; }
#np-art { width: 60px; height: 60px; border-radius: 4px; object-fit: cover; background: var(--raised); flex: none; }
#np-art:not([src]) { display: none; }
@@ -295,12 +310,13 @@ input[type=range] { accent-color: var(--accent); }
@media (max-width: 860px) {
:root { --player-h: 150px; }
#app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
#app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
#nav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); align-items: center; }
.brand { padding: 0 8px 0 4px; }
#nav a { white-space: nowrap; overflow: visible; }
#nav a svg, .nav-h, #nav-pl { display: none; }
.settings-link { border-top: 0; padding-top: 7px !important; border-radius: 4px !important; }
#nav a svg, .nav-sec, #sideart, #b-art .exp { display: none !important; }
#nav { overflow-y: hidden; }
#nav a { min-height: 32px; }
#search input { margin: 0; width: 120px; }
#live { margin: 0; white-space: nowrap; }
.settings { grid-template-columns: 1fr; }
@@ -311,7 +327,7 @@ input[type=range] { accent-color: var(--accent); }
.tracks th { top: -20px; }
.settings-link { margin-top: 0; }
#view { padding: 20px 16px 40px; }
#drawer { position: fixed; inset: auto 0 var(--player-h) 0; width: auto; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); z-index: 5; }
#drawer, #drawer.mixing { position: fixed; inset: auto 0 var(--player-h) 0; width: auto; max-height: 60vh; border-left: 0; border-top: 1px solid var(--line); z-index: 5; }
#player { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.center { grid-column: 1 / -1; grid-row: 2; }
.right #volume { display: none; }
@@ -321,6 +337,8 @@ input[type=range] { accent-color: var(--accent); }
.cplay { opacity: 1; transform: none; width: 36px; height: 36px; font-size: 14px; }
.grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.card { padding: 6px; }
.strips { --fh: clamp(140px, 24vh, 220px); }
.stem { max-width: 64px; }
}
/* presets */