:root {
  --bg: #0f1012;
  --panel: #17181b;
  --panel-2: #1e2024;
  --line: #2a2c31;
  --text: #ececee;
  --muted: #8b8d94;
  --accent: #f2f2f2;
  --meta-w: 280px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { -webkit-font-smoothing: antialiased; }
#app { max-width: 1200px; margin: 0 auto; padding: 20px 24px 60px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 28px; }
.brand { color: var(--muted); text-decoration: none; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.brand:hover { color: var(--text); }

#landing { padding: 80px 0; text-align: center; }

.titles { margin-bottom: 22px; }
.artist { margin: 0 0 4px; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.01em; }
.notes { margin: 10px 0 0; color: var(--muted); white-space: pre-wrap; max-width: 70ch; line-height: 1.5; }

.loading { padding: 40px 0; max-width: 480px; }
.loading .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
#loadbar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.loading p { font-size: 13px; margin-top: 10px; }
.error { color: #ff8787; }

/* transport */
.transport {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 80%, transparent);
}
button { font: inherit; color: inherit; cursor: pointer; }
.play {
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--accent); color: #111; display: grid; place-items: center; flex: none;
}
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .i-pause, .playing .play .i-play { display: none; }
.playing .play .i-pause { display: block; }
.time { font-variant-numeric: tabular-nums; font-size: 15px; min-width: 96px; }
.time .sep { color: var(--muted); margin: 0 6px; }
.modes { display: flex; background: var(--panel-2); border-radius: 999px; padding: 3px; }
.modes button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.modes button.on { background: var(--accent); color: #111; font-weight: 600; }
.ghost { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13px; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--muted); }

/* tracks */
#tracks { display: flex; flex-direction: column; gap: 6px; --p: 0; }
.track {
  display: grid; grid-template-columns: var(--meta-w) 1fr; min-height: 64px;
  background: var(--panel); border-radius: 10px; overflow: hidden;
  transition: opacity .15s;
}
.track.mixrow { min-height: 84px; background: var(--panel-2); margin-bottom: 8px; }
.meta {
  display: grid; grid-template-columns: 10px 1fr auto; grid-template-rows: auto auto;
  align-items: center; column-gap: 10px; row-gap: 8px; padding: 10px 14px;
  border-right: 1px solid var(--line);
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.name { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btns { display: flex; gap: 4px; }
.btns button {
  width: 28px; height: 24px; border-radius: 5px; border: 1px solid var(--line);
  background: none; font-size: 11px; font-weight: 700; color: var(--muted);
}
.btns .m.on { background: #e8590c; border-color: #e8590c; color: #fff; }
.btns .s.on { background: #fcc419; border-color: #fcc419; color: #111; }
.volrow { grid-column: 2 / 4; display: flex; align-items: center; gap: 10px; }
.vol { flex: 1; accent-color: var(--c); height: 16px; min-width: 0; }
.dl { color: var(--muted); text-decoration: none; font-size: 12px; }
.dl:hover { color: var(--text); }

.wave { position: relative; cursor: pointer; touch-action: none; }
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.played { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 100%); overflow: hidden; }
.played canvas { width: var(--ww); }
.head { position: absolute; top: 0; bottom: 0; left: calc(var(--p) * 100%); width: 1px; background: #fff; opacity: .8; pointer-events: none; }

.track.silent { opacity: .35; }
.mode-mix .track:not(.mixrow) { opacity: .45; }
.mode-mix .track.silent:not(.mixrow) { opacity: .25; }
.mode-stems .track.mixrow { opacity: .45; }

.hint { margin-top: 18px; font-size: 12px; line-height: 2; }
kbd { font: 11px ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin: 0 1px; }

@media (max-width: 720px) {
  #app { padding: 14px 12px 40px; }
  h1 { font-size: 24px; }
  .track { grid-template-columns: 1fr; }
  .meta { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  .wave { height: 56px; }
  .mixrow .wave { height: 72px; }
  .transport { gap: 10px; flex-wrap: wrap; }
  .hint { display: none; }
}

/* buffering indicator */
.buffering .time::after { content: "Loading…"; margin-left: 10px; color: var(--muted); font-size: 12px; }
.buffering .play { opacity: .7; }
