Files
musyx/design/mockup.html
T
Yuriy Panov c4928ae7fe feat: workspace scaffold with iced shell, theme and design system
Two-crate workspace (ym-api for the API client, musyx for the iced app).
The app has the sidebar, top bar, Queue/Lyrics drawer and player bar from
the approved mockup, plus signed-out states for every screen.

- DESIGN.md records the mockup tokens; ui/theme.rs mirrors them for dark
  and light, and the app follows the system appearance
- Bundles Onest/Unbounded (OFL) and Lucide 0.460 icons (ISC)
- Back-stack navigator, player bar toggles (shuffle, repeat, volume, mute)
- snapshot feature renders a screen to PNG via iced's window screenshot
2026-10-15 13:52:55 +06:00

842 lines
56 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<title>Musyx Desktop Mockup</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600&family=Unbounded:wght@500;600&display=swap">
<style>
/* Layout: desktop window — 232px sidebar | scrolling content | optional 320px drawer; 80px player bar spans the bottom.
Dark-first: aubergine graphite ground, one amber accent taken from a tape deck's VU needle. */
:root {
--bg: #1C1A22;
--panel: #23202B;
--raised: #2D2937;
--line: #3A3546;
--fg: #EEEAF3;
--muted: #A39CB0;
--accent: #F0B23E;
--accent-ink: #2A1D04;
--like: #F27286;
--ok: #7FCB9B;
--shadow: 0 18px 50px rgba(8, 6, 14, .45);
--font-display: "Unbounded", "Onest", system-ui, sans-serif;
--font-body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
--r-cover: 10px;
--r-ctl: 8px;
color-scheme: dark;
}
@media (prefers-color-scheme: light) {
:root:not([data-theme="dark"]) {
--bg: #F3F1F6; --panel: #FFFFFF; --raised: #EAE6F0; --line: #DCD6E4;
--fg: #1F1B27; --muted: #686178; --accent: #A86C05; --accent-ink: #FFF7E6;
--like: #D2405A; --ok: #2E8A55; --shadow: 0 18px 50px rgba(40, 30, 60, .14);
color-scheme: light;
}
}
:root[data-theme="light"] {
--bg: #F3F1F6; --panel: #FFFFFF; --raised: #EAE6F0; --line: #DCD6E4;
--fg: #1F1B27; --muted: #686178; --accent: #A86C05; --accent-ink: #FFF7E6;
--like: #D2405A; --ok: #2E8A55; --shadow: 0 18px 50px rgba(40, 30, 60, .14);
color-scheme: light;
}
* { box-sizing: border-box; }
body {
background: var(--bg); color: var(--fg);
font: 400 14px/1.45 var(--font-body);
padding: 20px 16px 32px;
-webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
/* Review strip (outside the app window) */
.review { max-width: 1280px; margin: 0 auto 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.review h1 { font: 600 17px/1.2 var(--font-display); margin: 0; letter-spacing: .01em; }
.review p { margin: 0; color: var(--muted); font-size: 13px; flex: 1 1 260px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
color: var(--muted); font-size: 13px; background: var(--panel);
}
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
/* App window */
.window {
max-width: 1280px; height: 780px; margin: 0 auto;
display: grid; grid-template-columns: 232px minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) 80px;
background: var(--bg); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
box-shadow: var(--shadow);
}
.window.signed-out { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.window.signed-out > :not(.signin) { display: none; }
/* Sidebar */
.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 12px; gap: 22px; min-height: 0; }
.wordmark { font: 600 20px/1 var(--font-display); letter-spacing: -.01em; padding: 4px 10px; display: flex; align-items: baseline; gap: 2px; }
.wordmark i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button, .side-list button {
display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-ctl);
color: var(--muted); font-weight: 500; text-align: left; width: 100%;
}
.nav button:hover, .side-list button:hover { color: var(--fg); background: var(--raised); }
.nav button[aria-current="page"] { color: var(--fg); background: var(--raised); }
.nav button[aria-current="page"] svg { color: var(--accent); }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 0 10px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.side-head button { color: var(--muted); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; }
.side-head button:hover { background: var(--raised); color: var(--fg); }
.side-list { display: flex; flex-direction: column; gap: 1px; overflow: auto; min-height: 0; flex: 1; }
.side-list button { gap: 10px; padding: 6px 10px; font-weight: 400; }
.side-list .cover { width: 30px; height: 30px; border-radius: 6px; }
.side-list span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-ctl); border-top: 1px solid var(--line); padding-top: 14px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #8E7AB5, #E0A84B); display: grid; place-items: center; font-weight: 600; color: #1C1A22; flex: none; }
.account div { min-width: 0; flex: 1; }
.account b { display: block; font-weight: 500; font-size: 13.5px; }
.account small { color: var(--ok); font-size: 12px; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-ctl); color: var(--muted); flex: none; }
.icon-btn:hover { color: var(--fg); background: var(--raised); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn.liked { color: var(--like); }
.icon-btn.liked svg { fill: currentColor; }
/* Content */
.content { overflow: auto; min-height: 0; min-width: 0; position: relative; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
.topbar .search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.topbar .search input { background: none; border: 0; outline: 0; flex: 1; min-width: 0; color: var(--fg); }
.screen { padding: 6px 28px 40px; display: flex; flex-direction: column; gap: 34px; }
.screen-title { font: 600 30px/1.15 var(--font-display); letter-spacing: -.015em; margin: 0; text-wrap: balance; }
.sec { display: flex; flex-direction: column; gap: 14px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.005em; }
.sec-head button { color: var(--muted); font-size: 13px; }
.sec-head button:hover { color: var(--fg); }
.sub { color: var(--muted); }
/* Covers: generated art stands in for Yandex's avatars.yandex.net images */
.cover {
aspect-ratio: 1; max-width: 100%; border-radius: var(--r-cover); position: relative; overflow: hidden; flex: none;
background:
radial-gradient(circle at 28% 24%, hsl(var(--h1) 78% 66% / .95), transparent 52%),
radial-gradient(circle at 78% 82%, hsl(var(--h2) 70% 52% / .85), transparent 55%),
linear-gradient(140deg, hsl(var(--h2) 38% 26%), hsl(var(--h1) 44% 14%));
}
.cover.round { border-radius: 50%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 22px 18px; }
.card { display: flex; flex-direction: column; gap: 9px; text-align: left; min-width: 0; }
.card .cover { width: 100%; }
.card .cover .play-fab { position: absolute; right: 10px; bottom: 10px; opacity: 0; transform: translateY(6px); transition: .18s; }
.card:hover .cover .play-fab, .card:focus-visible .cover .play-fab { opacity: 1; transform: none; }
.card b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card small { color: var(--muted); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-fab { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.play-fab svg { fill: currentColor; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary svg { fill: currentColor; }
.btn.ghost { border: 1px solid var(--line); color: var(--fg); font-weight: 500; }
.btn.ghost:hover { background: var(--raised); }
/* My Wave hero — the one bold moment */
.wave-hero { position: relative; border-radius: 16px; overflow: hidden; min-height: 260px; background: var(--panel); border: 1px solid var(--line); display: flex; align-items: flex-end; }
.wave-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.wave-hero .wave-body { position: relative; padding: 26px 28px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 28px; width: 100%; }
.wave-hero h2 { font: 600 34px/1.05 var(--font-display); margin: 0 0 6px; letter-spacing: -.02em; }
.wave-hero p { margin: 0; color: var(--muted); max-width: 40ch; }
.wave-hero .wave-text { flex: 1 1 260px; min-width: 0; }
.wave-hero.big { min-height: 380px; }
.wave-hero.big h2 { font-size: 46px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.setting h3 { margin: 0 0 10px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg); font-size: 13.5px; }
.seg button:hover { background: var(--raised); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 500; }
/* Track list */
.tracks { display: flex; flex-direction: column; }
.trow {
display: grid; grid-template-columns: 36px minmax(0, 2.2fr) minmax(0, 1.4fr) 34px 52px 34px; align-items: center; gap: 12px;
padding: 6px 10px; border-radius: var(--r-ctl); text-align: left; width: 100%;
}
.trow.head { color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line); border-radius: 0; padding-bottom: 8px; margin-bottom: 4px; }
.trow:not(.head):hover { background: var(--raised); }
.trow .idx { color: var(--muted); text-align: center; position: relative; }
.trow .t { display: flex; align-items: center; gap: 12px; min-width: 0; }
.trow .t .cover { width: 40px; height: 40px; border-radius: 6px; }
.trow .t div { min-width: 0; }
.trow .t b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .t small, .trow .alb { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.trow .dur { color: var(--muted); text-align: right; }
.trow.playing b, .trow.playing .idx { color: var(--accent); }
.trow .more { opacity: 0; }
.trow:hover .more, .trow:focus-within .more { opacity: 1; }
.trow.no-cover .t .cover { display: none; }
.trow.with-grip { grid-template-columns: 22px 36px minmax(0, 2.2fr) minmax(0, 1.4fr) 34px 52px 34px; }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.4s; } .eq i:nth-child(3) { animation-delay: -.7s; }
.paused .eq i { animation-play-state: paused; }
@keyframes eq { 0%,100% { height: 4px } 50% { height: 14px } }
/* Detail headers (album / artist / playlist) */
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 22px 28px; }
.detail-head .cover { width: 220px; box-shadow: var(--shadow); }
.detail-head .meta { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.detail-head .kind { color: var(--muted); font-size: 13px; }
.detail-head h1 { font: 600 40px/1.08 var(--font-display); margin: 0; letter-spacing: -.02em; text-wrap: balance; }
.detail-head .by { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); }
.detail-head .by b { color: var(--fg); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--raised); color: var(--muted); font-size: 12.5px; }
.pill svg.lucide { width: 13px; height: 13px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { padding: 9px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-color: var(--accent); }
.tabs .count { color: var(--muted); font-weight: 400; margin-left: 4px; font-size: 12.5px; }
.chart-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 24px; }
.chart-row { display: grid; grid-template-columns: 26px 18px 44px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-ctl); text-align: left; }
.chart-row:hover { background: var(--raised); }
.chart-row .rank { font: 600 15px/1 var(--font-display); text-align: right; }
.chart-row .delta { font-size: 11px; color: var(--muted); text-align: center; }
.chart-row .delta.up { color: var(--ok); } .chart-row .delta.down { color: var(--like); }
.chart-row .cover { width: 44px; border-radius: 6px; }
.chart-row b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-row small { color: var(--muted); font-size: 13px; }
.top-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 24px; }
.top-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; text-align: left; position: relative; }
.top-card .cover { width: 108px; }
.top-card h3 { font: 600 26px/1.1 var(--font-display); margin: 0; }
.top-card .play-fab { position: absolute; right: 20px; bottom: 20px; }
.edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 13px; }
/* Drawer: queue / lyrics */
.drawer { grid-row: 1; grid-column: 3; width: 320px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.drawer[hidden] { display: none !important; }
.drawer-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 8px 18px; }
.drawer-head .tabs { border: 0; flex: 1; }
.drawer-body { overflow: auto; min-height: 0; padding: 4px 10px 18px; }
.drawer h4 { margin: 14px 8px 8px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.qrow { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: var(--r-ctl); text-align: left; width: 100%; }
.qrow:hover { background: var(--raised); }
.qrow .cover { width: 40px; border-radius: 6px; }
.qrow b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow small { color: var(--muted); font-size: 12.5px; }
.qrow.now b { color: var(--accent); }
.lyrics { padding: 10px 10px 30px; display: flex; flex-direction: column; gap: 14px; }
.lyrics .line { height: 15px; border-radius: 5px; background: var(--raised); }
.lyrics .line.past { opacity: .45; }
.lyrics .line.current { background: var(--accent); height: 19px; }
.lyrics .note { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
/* Player bar */
.player {
grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
align-items: center; gap: 18px; padding: 0 18px; background: var(--panel); border-top: 1px solid var(--line);
}
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now .cover { width: 52px; border-radius: 8px; }
.now div { min-width: 0; }
.now b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now small { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transport { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.transport .ctrls { display: flex; align-items: center; gap: 8px; }
.transport .pp { width: 40px; height: 40px; border-radius: 50%; background: var(--fg); color: var(--bg); display: grid; place-items: center; }
.transport .pp svg { fill: currentColor; }
.progress { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 10px; width: 100%; font-size: 12px; color: var(--muted); }
.progress span:last-child { text-align: left; }
.progress span:first-child { text-align: right; }
.bar { height: 4px; border-radius: 2px; background: var(--raised); position: relative; cursor: pointer; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 2px; }
.bar i::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--fg); opacity: 0; transition: opacity .15s; }
.bar:hover i::after { opacity: 1; }
.extras { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.quality { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; margin-right: 6px; white-space: nowrap; }
.vol { display: flex; align-items: center; gap: 8px; width: 120px; }
.vol .bar { flex: 1; }
.vol .bar i { background: var(--fg); }
/* Sign-in */
.signin { grid-column: 1 / -1; grid-row: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 0; }
.signin .left { padding: 48px 56px; display: flex; flex-direction: column; gap: 28px; overflow: auto; }
.signin h2 { font: 600 34px/1.12 var(--font-display); letter-spacing: -.02em; margin: 0; max-width: 16ch; text-wrap: balance; }
.signin .lead { color: var(--muted); max-width: 46ch; margin: 0; font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; align-items: start; counter-increment: s; }
.steps li::before { content: counter(s); width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; color: var(--muted); }
.steps b { font-weight: 500; display: block; margin-top: 4px; }
.steps .sub { font-size: 13.5px; }
.code-box { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.code { font: 600 30px/1 var(--font-display); letter-spacing: .12em; padding: 14px 18px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.status { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: pulse 1.6s infinite; }
@keyframes pulse { to { box-shadow: 0 0 0 10px transparent; } }
details { color: var(--muted); font-size: 13.5px; }
details summary { cursor: pointer; width: fit-content; }
details .token-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
details input { flex: 1 1 220px; min-width: 0; height: 38px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--panel); }
.fine { color: var(--muted); font-size: 12.5px; margin: auto 0 0; max-width: 52ch; }
.signin .right { position: relative; background: var(--panel); border-left: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.signin .right canvas.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.qr-card { position: relative; background: #FFFFFF; padding: 18px; border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-card canvas { width: 200px; height: 200px; image-rendering: pixelated; }
.qr-card small { color: #4A4458; font-size: 12.5px; }
/* Narrow layouts */
@media (max-width: 1020px) {
.drawer { position: absolute; right: 0; top: 0; bottom: 80px; z-index: 6; box-shadow: var(--shadow); }
.window { position: relative; }
.trow .alb { display: none; }
.trow, .trow.with-grip { grid-template-columns: 36px minmax(0, 1fr) 34px 52px 34px; }
.trow.with-grip { grid-template-columns: 22px 36px minmax(0, 1fr) 34px 52px 34px; }
.top-result { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
.window { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(560px, auto) auto; }
.sidebar { flex-direction: row; align-items: center; padding: 10px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.sidebar .wordmark { display: none; }
.nav { flex-direction: row; }
.nav button { width: auto; white-space: nowrap; }
.side-head, .side-list, .account { display: none; }
.content { grid-row: 2; max-height: 640px; }
.drawer { width: min(320px, 100%); bottom: 0; }
.player { grid-row: 3; grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
.extras { display: none; }
.transport .ctrls .icon-btn:not(.keep) { display: none; }
.progress { display: none; }
.screen, .topbar { padding-left: 16px; padding-right: 16px; }
.detail-head .cover { width: 150px; }
.detail-head h1 { font-size: 30px; }
.wave-hero h2, .wave-hero.big h2 { font-size: 30px; }
.signin { grid-template-columns: 1fr; }
.signin .left { padding: 28px 20px; }
.signin .right { min-height: 300px; border-left: 0; border-top: 1px solid var(--line); }
.window.signed-out { grid-template-rows: auto; }
.code { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
.eq i, .pulse { animation: none; }
.card .cover .play-fab { transition: none; }
}
</style>
<header class="review">
<h1>Musyx mockup</h1>
<p>Sample data throughout. Covers are generated art; the app will show real artwork from Yandex Music.</p>
<div class="chips" id="screen-chips" role="group" aria-label="Jump to screen"></div>
</header>
<div class="window" id="win">
<!-- Sign in -->
<section class="signin" aria-label="Sign in" hidden>
<div class="left">
<div class="wordmark">musyx<i></i></div>
<div>
<h2>Sign in with your Yandex account</h2>
</div>
<p class="lead">Musyx plays your Yandex Music library, My Wave and playlists. You confirm sign-in on Yandex's own page, so your password never passes through this app.</p>
<ol class="steps">
<li><div><b>Open oauth.yandex.ru/device</b><span class="sub">On this computer or your phone. You can also scan the QR code.</span></div></li>
<li><div><b>Enter this code</b>
<div class="code-box"><span class="code" id="dev-code">QX7K-29PM</span><button class="btn ghost" id="copy-code"><i data-lucide="copy"></i>Copy code</button></div>
</div></li>
<li><div><b>Come back here</b><span class="sub">Musyx signs you in as soon as you allow access.</span></div></li>
</ol>
<div class="status"><span class="pulse" aria-hidden="true"></span><span>Waiting for confirmation · code expires in <span class="num" id="expires">4:52</span></span></div>
<details>
<summary>Sign in with an existing token instead</summary>
<div class="token-row"><input id="token-input" type="password" placeholder="Paste OAuth token" aria-label="OAuth token"><button class="btn ghost" id="token-btn">Sign in</button></div>
</details>
<p class="fine">Musyx is an unofficial client and isn't affiliated with Yandex. Your sign-in token is kept in the system keychain.</p>
</div>
<div class="right">
<canvas class="bg" id="signin-wave" aria-hidden="true"></canvas>
<div class="qr-card"><canvas id="qr" width="29" height="29" aria-label="QR code for oauth.yandex.ru/device"></canvas><small>Scan to open the sign-in page</small></div>
</div>
</section>
<!-- Sidebar -->
<aside class="sidebar">
<div class="wordmark">musyx<i></i></div>
<nav class="nav" aria-label="Main">
<button data-go="home"><i data-lucide="house"></i>Home</button>
<button data-go="wave"><i data-lucide="audio-lines"></i>My Wave</button>
<button data-go="search"><i data-lucide="search"></i>Search</button>
<button data-go="collection"><i data-lucide="library"></i>Collection</button>
<button data-go="podcasts"><i data-lucide="podcast"></i>Podcasts</button>
</nav>
<div class="side-head"><span>Playlists</span><button aria-label="New playlist"><i data-lucide="plus"></i></button></div>
<div class="side-list" id="side-playlists"></div>
<div class="account">
<span class="avatar">Ю</span>
<div><b>yuriy.panov</b><small>Plus subscription</small></div>
<button class="icon-btn" data-go="signin" aria-label="Sign out"><i data-lucide="log-out"></i></button>
</div>
</aside>
<!-- Content -->
<main class="content" id="content">
<div class="topbar">
<button class="icon-btn" id="back" aria-label="Back"><i data-lucide="chevron-left"></i></button>
<label class="search"><i data-lucide="search"></i><input id="q" placeholder="Artists, tracks, podcasts" aria-label="Search"></label>
</div>
<!-- Home -->
<section class="screen" data-screen="home">
<div class="wave-hero">
<canvas data-wave aria-hidden="true"></canvas>
<div class="wave-body">
<div class="wave-text"><h2>My Wave</h2><p>An endless stream picked from what you play, like and skip. Tuned to: any mood, favourites.</p></div>
<button class="btn primary" data-play-wave><i data-lucide="play"></i>Play My Wave</button>
<button class="btn ghost" data-go="wave"><i data-lucide="sliders-horizontal"></i>Tune</button>
</div>
</div>
<div class="sec"><div class="sec-head"><h2>Made for you</h2></div><div class="grid" id="made-for-you"></div></div>
<div class="sec"><div class="sec-head"><h2>Chart</h2><button>Show all 100</button></div><div class="chart-list" id="chart"></div></div>
<div class="sec"><div class="sec-head"><h2>Albums you might like</h2><button>Show all</button></div><div class="grid" id="albums-like"></div></div>
</section>
<!-- My Wave -->
<section class="screen" data-screen="wave" hidden>
<div class="wave-hero big">
<canvas data-wave aria-hidden="true"></canvas>
<div class="wave-body">
<div class="wave-text"><h2>My Wave</h2><p>Every like, skip and full listen steers what comes next.</p></div>
<button class="btn primary" data-play-wave><i data-lucide="play"></i>Play</button>
</div>
</div>
<div class="settings-grid">
<div class="setting"><h3>Mood</h3><div class="seg" data-seg><button aria-pressed="true">Any</button><button>Energetic</button><button>Cheerful</button><button>Calm</button><button>Sad</button></div></div>
<div class="setting"><h3>Character</h3><div class="seg" data-seg><button aria-pressed="true">Favourite</button><button>Unfamiliar</button><button>Popular</button></div></div>
<div class="setting"><h3>Language</h3><div class="seg" data-seg><button>Russian</button><button>Foreign</button><button>No vocals</button><button aria-pressed="true">Any</button></div></div>
</div>
<div class="sec"><div class="sec-head"><h2>Stations</h2></div><div class="grid" id="stations"></div></div>
</section>
<!-- Search -->
<section class="screen" data-screen="search" hidden>
<h1 class="screen-title">Results for “земфира”</h1>
<div class="tabs" role="tablist" data-tabs><button role="tab" aria-selected="true">All</button><button role="tab">Tracks</button><button role="tab">Albums</button><button role="tab">Artists</button><button role="tab">Playlists</button><button role="tab">Podcasts</button></div>
<div class="top-result">
<div class="sec"><div class="sec-head"><h2>Top result</h2></div>
<button class="top-card" data-go="artist">
<span class="cover round" style="--h1:330;--h2:260"></span>
<h3>Земфира</h3><span class="sub">Artist · 4.1M listeners a month</span>
<span class="play-fab"><i data-lucide="play"></i></span>
</button>
</div>
<div class="sec"><div class="sec-head"><h2>Tracks</h2></div><div class="tracks" id="search-tracks"></div></div>
</div>
<div class="sec"><div class="sec-head"><h2>Albums</h2></div><div class="grid" id="search-albums"></div></div>
</section>
<!-- Collection -->
<section class="screen" data-screen="collection" hidden>
<h1 class="screen-title">Collection</h1>
<div class="tabs" role="tablist" data-tabs>
<button role="tab" aria-selected="true">Liked tracks<span class="count num">1,284</span></button>
<button role="tab">Albums<span class="count num">96</span></button>
<button role="tab">Artists<span class="count num">41</span></button>
<button role="tab">Playlists<span class="count num">18</span></button>
<button role="tab">Podcasts<span class="count num">6</span></button>
<button role="tab">Disliked<span class="count num">57</span></button>
</div>
<div class="actions" style="margin-top:-12px"><button class="btn primary" data-play-first="liked"><i data-lucide="play"></i>Play</button><button class="btn ghost"><i data-lucide="shuffle"></i>Shuffle</button></div>
<div class="tracks" id="liked"></div>
</section>
<!-- Album -->
<section class="screen" data-screen="album" hidden>
<div class="detail-head">
<span class="cover" style="--h1:8;--h2:345"></span>
<div class="meta">
<span class="kind">Album · 1988</span>
<h1>Группа крови</h1>
<div class="by"><b>Кино</b><span class="num">12 tracks · 47 min</span><span class="pill"><i data-lucide="disc-3"></i>MP3 320</span></div>
<div class="actions">
<button class="btn primary" data-play-first="album"><i data-lucide="play"></i>Play</button>
<button class="btn ghost"><i data-lucide="shuffle"></i>Shuffle</button>
<button class="icon-btn liked" data-like aria-label="Remove album from collection" aria-pressed="true"><i data-lucide="heart"></i></button>
<button class="icon-btn" aria-label="More album actions"><i data-lucide="ellipsis"></i></button>
</div>
</div>
</div>
<div class="tracks" id="album-tracks"></div>
<div class="sec"><div class="sec-head"><h2>More by Кино</h2></div><div class="grid" id="more-by"></div></div>
</section>
<!-- Artist -->
<section class="screen" data-screen="artist" hidden>
<div class="detail-head">
<span class="cover round" style="--h1:330;--h2:260"></span>
<div class="meta">
<span class="kind">Artist · Rock, Pop</span>
<h1>Земфира</h1>
<div class="by"><span class="num">4.1M listeners a month · 2.3M likes</span></div>
<div class="actions">
<button class="btn primary" data-play-first="artist"><i data-lucide="play"></i>Play</button>
<button class="btn ghost" data-play-wave><i data-lucide="audio-lines"></i>Artist wave</button>
<button class="icon-btn" data-like aria-label="Like artist" aria-pressed="false"><i data-lucide="heart"></i></button>
</div>
</div>
</div>
<div class="sec"><div class="sec-head"><h2>Popular tracks</h2><button>Show all</button></div><div class="tracks" id="artist-tracks"></div></div>
<div class="sec"><div class="sec-head"><h2>Albums</h2></div><div class="grid" id="artist-albums"></div></div>
<div class="sec"><div class="sec-head"><h2>Similar artists</h2></div><div class="grid" id="similar"></div></div>
</section>
<!-- Playlist (own, editable) -->
<section class="screen" data-screen="playlist" hidden>
<div class="detail-head">
<span class="cover" style="--h1:42;--h2:190"></span>
<div class="meta">
<span class="kind">Your playlist · <span class="pill"><i data-lucide="lock"></i>Private</span></span>
<h1>Дорога на дачу</h1>
<div class="by"><b>yuriy.panov</b><span class="num">14 tracks · 52 min · edited yesterday</span></div>
<div class="actions">
<button class="btn primary" data-play-first="playlist"><i data-lucide="play"></i>Play</button>
<button class="btn ghost"><i data-lucide="plus"></i>Add tracks</button>
<button class="btn ghost"><i data-lucide="pencil"></i>Rename</button>
<button class="icon-btn" aria-label="Make public"><i data-lucide="globe"></i></button>
<button class="icon-btn" aria-label="Delete playlist"><i data-lucide="trash-2"></i></button>
</div>
</div>
</div>
<div class="edit-bar"><i data-lucide="grip-vertical"></i>Drag tracks to reorder. Changes save to Yandex Music right away.</div>
<div class="tracks" id="playlist-tracks"></div>
</section>
<!-- Podcasts -->
<section class="screen" data-screen="podcasts" hidden>
<h1 class="screen-title">Podcasts and books</h1>
<div class="sec"><div class="sec-head"><h2>Continue listening</h2></div><div class="tracks" id="episodes"></div></div>
<div class="sec"><div class="sec-head"><h2>Your podcasts</h2></div><div class="grid" id="pods"></div></div>
</section>
</main>
<!-- Drawer -->
<aside class="drawer" id="drawer" hidden>
<div class="drawer-head">
<div class="tabs" role="tablist" id="drawer-tabs"><button role="tab" data-panel="queue" aria-selected="true">Queue</button><button role="tab" data-panel="lyrics">Lyrics</button></div>
<button class="icon-btn" id="drawer-close" aria-label="Close panel"><i data-lucide="x"></i></button>
</div>
<div class="drawer-body" data-panel-body="queue">
<h4>Now playing</h4><div id="q-now"></div>
<h4>Next from: Группа крови</h4><div id="q-next"></div>
</div>
<div class="drawer-body" data-panel-body="lyrics" hidden>
<div class="lyrics" id="lyrics"><p class="note">Synced lyrics from Yandex Music appear here. The current line follows playback, and clicking a line seeks to it.</p></div>
</div>
</aside>
<!-- Player -->
<footer class="player" id="player">
<div class="now">
<span class="cover" id="p-cover" style="--h1:8;--h2:345"></span>
<div><b id="p-title">Звезда по имени Солнце</b><small id="p-artist">Кино</small></div>
<button class="icon-btn liked" data-like aria-label="Remove from liked tracks" aria-pressed="true"><i data-lucide="heart"></i></button>
<button class="icon-btn" aria-label="Don't recommend this track"><i data-lucide="ban"></i></button>
</div>
<div class="transport">
<div class="ctrls">
<button class="icon-btn" id="shuffle" aria-label="Shuffle" aria-pressed="false"><i data-lucide="shuffle"></i></button>
<button class="icon-btn keep" id="prev" aria-label="Previous track"><i data-lucide="skip-back"></i></button>
<button class="pp keep" id="pp" aria-label="Pause"><i data-lucide="pause"></i></button>
<button class="icon-btn keep" id="next" aria-label="Next track"><i data-lucide="skip-forward"></i></button>
<button class="icon-btn" id="repeat" aria-label="Repeat" aria-pressed="false"><i data-lucide="repeat"></i></button>
</div>
<div class="progress num"><span id="t-cur">1:12</span><div class="bar" id="seek"><i id="t-fill" style="width:32%"></i></div><span id="t-dur">3:45</span></div>
</div>
<div class="extras">
<span class="quality">MP3 320</span>
<button class="icon-btn" data-drawer="lyrics" aria-label="Lyrics" aria-pressed="false"><i data-lucide="mic-vocal"></i></button>
<button class="icon-btn" data-drawer="queue" aria-label="Queue" aria-pressed="false"><i data-lucide="list-music"></i></button>
<div class="vol"><i data-lucide="volume-2"></i><div class="bar" id="vol"><i style="width:70%"></i></div></div>
</div>
</footer>
</div>
<script src="https://unpkg.com/lucide@0.460.0/dist/umd/lucide.min.js"></script>
<script>
(() => {
const $ = (s, r = document) => r.querySelector(s);
const $$ = (s, r = document) => [...r.querySelectorAll(s)];
const icons = () => { try { window.lucide && lucide.createIcons(); } catch (e) {} };
// ---- Sample data ----
const kino = { h1: 8, h2: 345 };
const album = [
["Группа крови", "4:46"], ["Закрой за мной дверь, я ухожу", "4:16"], ["Война", "4:34"],
["Попробуй спеть вместе со мной", "4:43"], ["Звезда по имени Солнце", "3:45"], ["Спокойная ночь", "6:06"],
["Мама, мы все тяжело больны", "4:02"], ["В наших глазах", "3:37"], ["Бошетунмай", "3:30"],
["Легенда", "4:05"], ["Прохожий", "3:22"], ["Дерево", "2:58"]
].map(([t, d]) => ({ t, a: "Кино", al: "Группа крови", d, ...kino }));
const z = (t, al, d, h1, h2) => ({ t, a: "Земфира", al, d, h1, h2 });
const zTracks = [
z("Хочешь?", "Прости меня моя любовь", "3:45", 200, 250), z("Искала", "Прости меня моя любовь", "3:38", 200, 250),
z("Ариведерчи", "Земфира", "4:00", 330, 280), z("ПММЛ", "Прости меня моя любовь", "3:56", 200, 250),
z("Жить в твоей голове", "Жить в твоей голове", "4:26", 160, 220)
];
const liked = [
album[4], zTracks[0],
{ t: "Выхода нет", a: "Сплин", al: "Гранатовый альбом", d: "3:50", h1: 25, h2: 300 },
{ t: "Полковнику никто не пишет", a: "Би-2", al: "Би-2", d: "4:45", h1: 280, h2: 30 },
{ t: "Владивосток 2000", a: "Мумий Тролль", al: "Морская", d: "2:45", h1: 185, h2: 210 },
{ t: "Город золотой", a: "Аквариум", al: "Десять стрел", d: "3:25", h1: 48, h2: 20 },
{ t: "Что такое осень", a: "ДДТ", al: "Актриса Весна", d: "5:10", h1: 30, h2: 0 },
zTracks[2], album[0],
{ t: "Каждый раз", a: "Монеточка", al: "Раскраски для взрослых", d: "3:28", h1: 300, h2: 170 }
];
const card = (o) => `<button class="card" data-go="${o.go || "album"}"><span class="cover${o.round ? " round" : ""}" style="--h1:${o.h1};--h2:${o.h2}">
<span class="play-fab"><i data-lucide="play"></i></span></span><span><b>${o.t}</b><small>${o.s}</small></span></button>`;
const madeForYou = [
{ t: "Playlist of the Day", s: "Updated today · 60 tracks", h1: 45, h2: 15, go: "playlist" },
{ t: "Déjà Vu", s: "Tracks you haven't heard yet", h1: 270, h2: 200, go: "playlist" },
{ t: "Premiere", s: "New from artists you like", h1: 150, h2: 90, go: "playlist" },
{ t: "Secret Stash", s: "Songs you might have missed", h1: 320, h2: 40, go: "playlist" },
{ t: "Your 2026", s: "Your most played this year", h1: 210, h2: 330, go: "playlist" }
];
const albumsLike = [
{ t: "Группа крови", s: "Кино · 1988", ...kino },
{ t: "Прости меня моя любовь", s: "Земфира · 2000", h1: 200, h2: 250 },
{ t: "Морская", s: "Мумий Тролль · 1997", h1: 185, h2: 210 },
{ t: "Гранатовый альбом", s: "Сплин · 1998", h1: 25, h2: 300 },
{ t: "Десять стрел", s: "Аквариум · 1986", h1: 48, h2: 20 }
];
const chart = [
["Хочешь?", "Земфира", "up", 200, 250], ["Звезда по имени Солнце", "Кино", "", 8, 345],
["Выхода нет", "Сплин", "down", 25, 300], ["Полковнику никто не пишет", "Би-2", "up", 280, 30],
["Владивосток 2000", "Мумий Тролль", "", 185, 210], ["Каждый раз", "Монеточка", "up", 300, 170]
];
const playlists = [
{ t: "Liked tracks", h1: 345, h2: 330, go: "collection" }, { t: "Дорога на дачу", h1: 42, h2: 190, go: "playlist" },
{ t: "Для работы", h1: 160, h2: 230, go: "playlist" }, { t: "Русский рок 90-х", h1: 10, h2: 40, go: "playlist" },
{ t: "Вечер пятницы", h1: 290, h2: 330, go: "playlist" }, { t: "Бег 170 bpm", h1: 120, h2: 60, go: "playlist" }
];
const trow = (tr, i, opts = {}) => `<div class="trow${opts.noCover ? " no-cover" : ""}${opts.grip ? " with-grip" : ""}" role="button" tabindex="0" data-track="${i}" data-list="${opts.list}">
${opts.grip ? `<span class="grip" aria-hidden="true"><i data-lucide="grip-vertical"></i></span>` : ""}
<span class="idx num">${i + 1}</span>
<span class="t"><span class="cover" style="--h1:${tr.h1};--h2:${tr.h2}"></span><div><b>${tr.t}</b><small>${tr.a}</small></div></span>
<span class="alb">${tr.al}</span>
<button class="icon-btn${opts.liked ? " liked" : ""}" data-like aria-pressed="${!!opts.liked}" aria-label="Like"><i data-lucide="heart"></i></button>
<span class="dur num">${tr.d}</span>
<button class="icon-btn more" aria-label="More actions"><i data-lucide="ellipsis"></i></button></div>`;
const head = (grip) => `<div class="trow head${grip ? " with-grip" : ""}">${grip ? "<span></span>" : ""}<span class="idx">#</span><span>Title</span><span class="alb">Album</span><span></span><span class="dur"><i data-lucide="clock-3"></i></span><span></span></div>`;
const lists = { album, liked, artist: zTracks, search: zTracks.slice(0, 4), playlist: [liked[2], liked[5], album[1], zTracks[4], liked[3], liked[6], album[3], liked[4]] };
$("#album-tracks").innerHTML = head() + album.map((t, i) => trow(t, i, { noCover: true, list: "album", liked: i === 4 })).join("");
$("#liked").innerHTML = head() + liked.map((t, i) => trow(t, i, { list: "liked", liked: true })).join("");
$("#artist-tracks").innerHTML = zTracks.map((t, i) => trow(t, i, { list: "artist", liked: i === 0 })).join("");
$("#search-tracks").innerHTML = lists.search.map((t, i) => trow(t, i, { list: "search", liked: i === 0 })).join("");
$("#playlist-tracks").innerHTML = head(true) + lists.playlist.map((t, i) => trow(t, i, { list: "playlist", grip: true })).join("");
$("#made-for-you").innerHTML = madeForYou.map(card).join("");
$("#albums-like").innerHTML = albumsLike.map(card).join("");
$("#search-albums").innerHTML = [
{ t: "Прости меня моя любовь", s: "2000", h1: 200, h2: 250 }, { t: "Земфира", s: "1999", h1: 330, h2: 280 },
{ t: "Вендетта", s: "2005", h1: 0, h2: 220 }, { t: "Жить в твоей голове", s: "2013", h1: 160, h2: 220 }, { t: "Бордерлайн", s: "2021", h1: 260, h2: 20 }
].map(card).join("");
$("#artist-albums").innerHTML = $("#search-albums").innerHTML;
$("#more-by").innerHTML = [
{ t: "Звезда по имени Солнце", s: "1989", h1: 40, h2: 10 }, { t: "Последний герой", s: "1989", h1: 220, h2: 260 },
{ t: "Ночь", s: "1986", h1: 250, h2: 300 }, { t: "Чёрный альбом", s: "1990", h1: 0, h2: 0 }
].map(card).join("");
$("#similar").innerHTML = [
{ t: "Сплин", s: "Artist", h1: 25, h2: 300, round: true, go: "artist" }, { t: "Мумий Тролль", s: "Artist", h1: 185, h2: 210, round: true, go: "artist" },
{ t: "Би-2", s: "Artist", h1: 280, h2: 30, round: true, go: "artist" }, { t: "Монеточка", s: "Artist", h1: 300, h2: 170, round: true, go: "artist" }
].map(card).join("");
$("#stations").innerHTML = [
{ t: "Rock", s: "Genre station", h1: 10, h2: 340, go: "wave" }, { t: "Indie", s: "Genre station", h1: 170, h2: 120, go: "wave" },
{ t: "For running", s: "Activity station", h1: 100, h2: 50, go: "wave" }, { t: "Focus", s: "Activity station", h1: 220, h2: 250, go: "wave" },
{ t: "1990s", s: "Era station", h1: 300, h2: 20, go: "wave" }
].map(card).join("");
$("#chart").innerHTML = chart.map(([t, a, d, h1, h2], i) => `<button class="chart-row" data-go="album"><span class="rank num">${i + 1}</span>
<span class="delta ${d}" aria-label="${d === "up" ? "Up" : d === "down" ? "Down" : "No change"}">${d === "up" ? "▲" : d === "down" ? "▼" : "–"}</span>
<span class="cover" style="--h1:${h1};--h2:${h2}"></span><span style="min-width:0"><b>${t}</b><small>${a}</small></span><span class="num sub">${liked.find(x => x.t === t)?.d || "3:45"}</span></button>`).join("");
$("#side-playlists").innerHTML = playlists.map(p => `<button data-go="${p.go}"><span class="cover" style="--h1:${p.h1};--h2:${p.h2}"></span><span>${p.t}</span></button>`).join("");
$("#episodes").innerHTML = [
{ t: "Как устроен звук винила", a: "Подкаст «Звукорежиссура» · 38 min left", al: "", d: "52:10", h1: 50, h2: 200 },
{ t: "Глава 7", a: "Мастер и Маргарита · audiobook", al: "", d: "41:32", h1: 0, h2: 270 }
].map((t, i) => trow(t, i, { list: "episodes" })).join("");
$("#pods").innerHTML = [
{ t: "Звукорежиссура", s: "Podcast · weekly", h1: 50, h2: 200 }, { t: "Мастер и Маргарита", s: "Audiobook · 17 h", h1: 0, h2: 270 },
{ t: "Почему это смешно", s: "Podcast", h1: 140, h2: 40 }
].map(card).join("");
// ---- Navigation ----
const screens = [["signin", "Sign in"], ["home", "Home"], ["wave", "My Wave"], ["search", "Search"], ["collection", "Collection"], ["album", "Album"], ["artist", "Artist"], ["playlist", "Playlist"], ["podcasts", "Podcasts"]];
$("#screen-chips").innerHTML = screens.map(([k, l]) => `<button class="chip" data-go="${k}" aria-pressed="false">${l}</button>`).join("");
const history = [];
let current = "home";
function go(name, push = true) {
const win = $("#win");
if (push && name !== current) history.push(current);
current = name;
const signedOut = name === "signin";
win.classList.toggle("signed-out", signedOut);
$(".signin").hidden = !signedOut;
$$(".screen").forEach(s => s.hidden = s.dataset.screen !== name);
$$(".nav button").forEach(b => b.dataset.go === name ? b.setAttribute("aria-current", "page") : b.removeAttribute("aria-current"));
$$("#screen-chips .chip").forEach(c => c.setAttribute("aria-pressed", String(c.dataset.go === name)));
$("#content").scrollTop = 0;
if (signedOut) drawQR();
try { localStorage.setItem("musyx-mock-screen", name); } catch (e) {}
}
document.addEventListener("click", (e) => {
const g = e.target.closest("[data-go]");
if (g && !e.target.closest("[data-like]")) { go(g.dataset.go); }
});
$("#back").addEventListener("click", () => { if (history.length) go(history.pop(), false); });
$("#q").addEventListener("keydown", (e) => { if (e.key === "Enter") go("search"); });
// Tabs & segmented controls
$$("[data-tabs]").forEach(t => t.addEventListener("click", (e) => {
const b = e.target.closest("button"); if (!b) return;
$$("button", t).forEach(x => x.setAttribute("aria-selected", String(x === b)));
}));
$$("[data-seg]").forEach(s => s.addEventListener("click", (e) => {
const b = e.target.closest("button"); if (!b) return;
$$("button", s).forEach(x => x.setAttribute("aria-pressed", String(x === b)));
}));
// Likes
document.addEventListener("click", (e) => {
const l = e.target.closest("[data-like]"); if (!l) return;
e.stopPropagation();
const on = l.getAttribute("aria-pressed") !== "true";
l.setAttribute("aria-pressed", String(on)); l.classList.toggle("liked", on);
}, true);
// ---- Player ----
let queue = album, qi = 4, playing = true, pos = 72, dur = 225;
const secs = (d) => { const [m, s] = d.split(":").map(Number); return m * 60 + s; };
const fmt = (s) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
function renderPlayer() {
const tr = queue[qi];
$("#p-title").textContent = tr.t; $("#p-artist").textContent = tr.a;
$("#p-cover").style.cssText = `--h1:${tr.h1};--h2:${tr.h2}`;
$("#t-dur").textContent = tr.d; dur = secs(tr.d);
$("#t-cur").textContent = fmt(pos); $("#t-fill").style.width = (pos / dur * 100) + "%";
$("#pp").innerHTML = `<i data-lucide="${playing ? "pause" : "play"}"></i>`;
$("#pp").setAttribute("aria-label", playing ? "Pause" : "Play");
$$(".trow.playing").forEach(r => { r.classList.remove("playing"); const ix = r.querySelector(".idx"); ix.textContent = +r.dataset.track + 1; });
$$(`.trow[data-list="${queue.name}"][data-track="${qi}"]`).forEach(r => {
r.classList.add("playing"); r.classList.toggle("paused", !playing);
r.querySelector(".idx").innerHTML = `<span class="eq" aria-label="Playing"><i></i><i></i><i></i></span>`;
});
const q = (t, i, now) => `<button class="qrow${now ? " now" : ""}" data-q="${i}"><span class="cover" style="--h1:${t.h1};--h2:${t.h2}"></span><span style="min-width:0"><b>${t.t}</b><small>${t.a}</small></span><span class="num sub">${t.d}</span></button>`;
$("#q-now").innerHTML = q(tr, qi, true);
$("#q-next").innerHTML = queue.slice(qi + 1).map((t, i) => q(t, qi + 1 + i)).join("") || `<p class="sub" style="padding:0 8px">Nothing queued. My Wave continues after this track.</p>`;
const n = 16, cur = Math.min(n - 1, Math.floor(pos / dur * n));
$("#lyrics").innerHTML = `<p class="note">Synced lyrics from Yandex Music appear here. The current line follows playback, and clicking a line seeks to it.</p>` +
Array.from({ length: n }, (_, i) => `<span class="line${i < cur ? " past" : i === cur ? " current" : ""}" style="width:${55 + ((i * 37) % 40)}%"></span>`).join("");
icons();
}
album.name = "album"; liked.name = "liked"; zTracks.name = "artist"; lists.search.name = "search"; lists.playlist.name = "playlist";
function play(list, i) { queue = list; qi = i; pos = 0; playing = true; renderPlayer(); }
document.addEventListener("click", (e) => {
if (e.target.closest("[data-like], .more")) return;
const r = e.target.closest(".trow[data-track]");
if (r && lists[r.dataset.list]) play(lists[r.dataset.list], +r.dataset.track);
const pf = e.target.closest("[data-play-first]");
if (pf) { const l = { album, liked, artist: zTracks, playlist: lists.playlist }[pf.dataset.playFirst]; play(l, 0); }
const pw = e.target.closest("[data-play-wave]");
if (pw) play(liked, Math.floor(Math.random() * liked.length));
const qb = e.target.closest("[data-q]");
if (qb) { qi = +qb.dataset.q; pos = 0; renderPlayer(); }
});
$("#pp").addEventListener("click", () => { playing = !playing; renderPlayer(); });
$("#next").addEventListener("click", () => { qi = (qi + 1) % queue.length; pos = 0; renderPlayer(); });
$("#prev").addEventListener("click", () => { if (pos > 3) pos = 0; else qi = (qi - 1 + queue.length) % queue.length, pos = 0; renderPlayer(); });
["#shuffle", "#repeat"].forEach(id => $(id).addEventListener("click", (e) => { const b = e.currentTarget; b.setAttribute("aria-pressed", String(b.getAttribute("aria-pressed") !== "true")); }));
$("#seek").addEventListener("click", (e) => { const r = e.currentTarget.getBoundingClientRect(); pos = (e.clientX - r.left) / r.width * dur; renderPlayer(); });
$("#vol").addEventListener("click", (e) => { const r = e.currentTarget.getBoundingClientRect(); e.currentTarget.firstElementChild.style.width = ((e.clientX - r.left) / r.width * 100) + "%"; });
setInterval(() => { if (!playing || current === "signin") return; pos += 1; if (pos >= dur) { qi = (qi + 1) % queue.length; pos = 0; } renderPlayer(); }, 1000);
// Drawer
function openDrawer(panel) {
const d = $("#drawer");
const same = !d.hidden && $(`#drawer-tabs [data-panel="${panel}"]`).getAttribute("aria-selected") === "true";
d.hidden = same;
$$("#drawer-tabs button").forEach(b => b.setAttribute("aria-selected", String(b.dataset.panel === panel)));
$$("[data-panel-body]").forEach(b => b.hidden = b.dataset.panelBody !== panel);
$$("[data-drawer]").forEach(b => b.setAttribute("aria-pressed", String(!d.hidden && b.dataset.drawer === panel)));
}
$$("[data-drawer]").forEach(b => b.addEventListener("click", () => openDrawer(b.dataset.drawer)));
$("#drawer-tabs").addEventListener("click", (e) => { const b = e.target.closest("button"); if (b) { $("#drawer").hidden = true; openDrawer(b.dataset.panel); } });
$("#drawer-close").addEventListener("click", () => { $("#drawer").hidden = true; $$("[data-drawer]").forEach(b => b.setAttribute("aria-pressed", "false")); });
// ---- Sign-in bits ----
$("#copy-code").addEventListener("click", () => {
const btn = $("#copy-code");
const done = () => { btn.lastChild.textContent = "Copied"; setTimeout(() => btn.lastChild.textContent = "Copy code", 1600); };
try { navigator.clipboard.writeText($("#dev-code").textContent).then(done, () => { getSelection().selectAllChildren($("#dev-code")); }); }
catch (e) { getSelection().selectAllChildren($("#dev-code")); }
});
$("#token-btn").addEventListener("click", () => go("home"));
let left = 292;
setInterval(() => { if (current !== "signin") return; left = left > 0 ? left - 1 : 300; $("#expires").textContent = fmt(left); }, 1000);
function drawQR() {
// Decorative stand-in for the real QR the app renders from verification_url.
const c = $("#qr"), x = c.getContext("2d"), n = 29;
x.fillStyle = "#fff"; x.fillRect(0, 0, n, n); x.fillStyle = "#1C1A22";
let s = 7;
const rnd = () => (s = (s * 16807) % 2147483647) / 2147483647;
for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) if (rnd() > .52) x.fillRect(i, j, 1, 1);
[[0, 0], [n - 7, 0], [0, n - 7]].forEach(([a, b]) => {
x.fillStyle = "#fff"; x.fillRect(a - (a ? 1 : 0), b - (b ? 1 : 0), 8, 8);
x.fillStyle = "#1C1A22"; x.fillRect(a, b, 7, 7); x.fillStyle = "#fff"; x.fillRect(a + 1, b + 1, 5, 5); x.fillStyle = "#1C1A22"; x.fillRect(a + 2, b + 2, 3, 3);
});
}
// ---- Wave canvases ----
const reduce = matchMedia("(prefers-reduced-motion: reduce)").matches;
const accent = () => getComputedStyle(document.documentElement).getPropertyValue("--accent").trim() || "#F0B23E";
function drawWave(cv, t) {
const r = cv.getBoundingClientRect(); if (!r.width) return;
const dpr = devicePixelRatio || 1;
if (cv.width !== Math.round(r.width * dpr)) { cv.width = Math.round(r.width * dpr); cv.height = Math.round(r.height * dpr); }
const x = cv.getContext("2d"), w = cv.width, h = cv.height;
x.clearRect(0, 0, w, h);
const col = accent();
const amp = playing ? 1 : .45;
for (let k = 0; k < 14; k++) {
x.beginPath();
const base = h * (.22 + k * .028), a = h * (.05 + k * .006) * amp, f = 1.6 + k * .09, ph = t * (.35 + k * .02) + k * .5;
for (let px = 0; px <= w; px += 6 * dpr) {
const u = px / w;
const y = base + Math.sin(u * Math.PI * f + ph) * a + Math.sin(u * Math.PI * 4.2 - ph * .7) * a * .35;
px ? x.lineTo(px, y) : x.moveTo(px, y);
}
x.strokeStyle = col; x.globalAlpha = .08 + (k / 14) * .55; x.lineWidth = (1 + k * .08) * dpr; x.stroke();
}
x.globalAlpha = 1;
}
function frame(ts) {
const t = reduce ? 1.2 : ts / 1000;
$$("[data-wave]").forEach(cv => { if (!cv.closest("[hidden]")) drawWave(cv, t); });
if (current === "signin") drawWave($("#signin-wave"), t * .6);
if (!reduce) requestAnimationFrame(frame);
}
// Boot
let start = "home";
try { const s = localStorage.getItem("musyx-mock-screen"); if (s && screens.some(x => x[0] === s)) start = s; } catch (e) {}
go(start, false);
renderPlayer();
requestAnimationFrame(frame);
if (reduce) { addEventListener("click", () => requestAnimationFrame(frame)); }
})();
</script>