/* TTB? — stark black & white */

:root {
  --bg: #000;
  --fg: #fff;
  --dim: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.28);
  --line: rgba(255, 255, 255, 0.14);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
body.locked { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
img { display: block; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 700ms ease;
}
.intro span {
  font-weight: 800;
  font-size: clamp(40px, 9vw, 88px);
  letter-spacing: -0.04em;
  animation: intro-in 700ms var(--ease) both;
}
.intro i { font-style: normal; animation: blink 0.9s steps(1) 0.5s infinite; }
.intro.out { opacity: 0; pointer-events: none; }
@keyframes intro-in { from { opacity: 0; letter-spacing: 0.2em; } }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- header ---------- */
.top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: calc(var(--gutter) + env(safe-area-inset-top)) var(--gutter) 20px;
  max-width: 1100px; margin: 0 auto;
}
.mark { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; text-decoration: none; }
.count { font: 12px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- track list ---------- */
.list {
  max-width: 1100px; margin: 0 auto;
  padding: 0 var(--gutter) calc(120px + env(safe-area-inset-bottom));
}
.release { margin: 28px 0 8px; font: 12px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; }
.release:first-child { margin-top: 0; }
.tracks { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.track {
  display: grid;
  grid-template-columns: 28px 56px minmax(0, 1fr) auto 40px;
  align-items: center; gap: 16px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.track:hover, .track:focus-visible { background: var(--fg); color: var(--bg); outline: none; }
.track:hover .t-sub, .track:hover .t-num, .track:hover .t-dur,
.track:focus-visible .t-sub, .track:focus-visible .t-num, .track:focus-visible .t-dur { color: rgba(0, 0, 0, 0.6); }
.t-num { font: 12px var(--mono); color: var(--faint); text-align: right; }
.track.current .t-num { color: var(--fg); }
.track.current:hover .t-num { color: var(--bg); }
.t-art { width: 56px; height: 56px; background: #111; object-fit: cover; }
.t-art.blank { background: repeating-linear-gradient(45deg, #111 0 6px, #000 6px 12px); }
.t-text { min-width: 0; }
.t-title { font-weight: 650; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-dur { font: 13px var(--mono); color: var(--dim); }
.t-dl { width: 40px; height: 40px; display: grid; place-items: center; color: inherit; opacity: 0.7; }
.t-dl:hover { opacity: 1; }
.tag {
  display: inline-block; margin-left: 8px; padding: 0 5px;
  border: 1px solid currentColor; font: 10px/16px var(--mono);
  text-transform: uppercase; letter-spacing: 0.08em; vertical-align: 2px; opacity: 0.6;
}
.bars { display: inline-flex; gap: 2px; height: 10px; align-items: flex-end; }
.bars i { width: 2px; background: currentColor; animation: bar 0.9s ease-in-out infinite alternate; }
.bars i:nth-child(2) { animation-delay: -0.3s; }
.bars i:nth-child(3) { animation-delay: -0.6s; }
.paused .bars i { animation-play-state: paused; }
@keyframes bar { from { height: 2px; } to { height: 10px; } }
.empty { color: var(--dim); padding: 40px 0; font: 13px var(--mono); }

@media (max-width: 560px) {
  .track { grid-template-columns: 48px minmax(0, 1fr) auto 32px; gap: 12px; padding: 8px 0; }
  .track:hover { background: none; color: inherit; }
  .track:hover .t-sub, .track:hover .t-dur { color: var(--dim); }
  .t-num { display: none; }
  .t-art { width: 48px; height: 48px; }
  .t-dl { width: 32px; }
}

/* ---------- icons / buttons ---------- */
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  position: relative; border-radius: 50%; color: var(--fg); text-decoration: none; flex: none;
  transition: opacity 120ms, background 120ms;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.icon-btn.toggle { opacity: 0.4; }
.icon-btn.toggle[aria-pressed="true"] { opacity: 1; }
.icon-btn.toggle[aria-pressed="true"]::after {
  content: ""; position: absolute; left: calc(50% - 2px); bottom: 3px;
  width: 4px; height: 4px; border-radius: 50%; background: currentColor;
}
.icon-btn.play { width: 64px; height: 64px; background: var(--fg); color: var(--bg); }
.icon-btn.play:hover { background: var(--fg); transform: scale(1.04); }
.icon-btn.play svg { width: 26px; height: 26px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }
svg text { fill: currentColor; stroke: none; font: 700 7px var(--mono); }

/* ---------- range sliders ---------- */
.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer;
  --p: 0%;
}
.range::-webkit-slider-runnable-track {
  height: 2px; background: linear-gradient(var(--fg), var(--fg)) 0 / var(--p) 100% no-repeat, var(--faint);
}
.range::-moz-range-track { height: 2px; background: var(--faint); }
.range::-moz-range-progress { height: 2px; background: var(--fg); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px;
  border-radius: 50%; background: var(--fg); border: 0; transition: transform 120ms;
}
.range::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--fg); border: 0; }
.range:hover::-webkit-slider-thumb, .range:active::-webkit-slider-thumb { transform: scale(1.3); }

/* ---------- mini player ---------- */
.mini {
  position: fixed; z-index: 10;
  left: 50%; bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100% - 2 * var(--gutter)));
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 8px;
  background: var(--bg); border: 1px solid var(--fg);
  overflow: hidden;
}
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; text-align: left; }
.mini img { width: 40px; height: 40px; object-fit: cover; background: #111; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-text b, .mini-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text span { color: var(--dim); font-size: 13px; }
.mini-bar { position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--fg); }

/* ---------- player ---------- */
.player {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.p-top {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 12px;
  padding: 12px var(--gutter) 0;
}
.p-meta { text-align: center; min-width: 0; }
.p-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { color: var(--dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stage {
  display: grid; grid-template-columns: 1fr 1fr; min-height: 0;
  gap: clamp(24px, 4vw, 64px);
  padding: 16px var(--gutter);
}
/* The image is absolutely positioned so it can never grow the grid row:
   it always fits inside the space between the header and the controls. */
.art { position: relative; min-height: 0; min-width: 0; }
.art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center;
}
.art img.blank { visibility: hidden; }

.lyrics {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 4px 0 0;
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
  scrollbar-width: thin; scrollbar-color: var(--faint) transparent;
  outline: none;
}
.lyrics::before, .lyrics::after { content: ""; display: block; height: 16%; }
.lyrics.synced::before, .lyrics.synced::after, .lyrics.sync-mode::before, .lyrics.sync-mode::after { height: 50%; }
.lyrics .l-line {
  font-size: clamp(18px, 2vw, 26px); font-weight: 650; line-height: 1.35;
  margin: 0 0 0.3em; color: var(--fg);
  transition: color 300ms, opacity 300ms;
}
.lyrics .l-gap { height: 1.4em; }
.lyrics .l-label { font: 11px/1.4 var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.6em; }
.lyrics .l-head { font-size: 13px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 0.8em; }
.lyrics .l-none { color: var(--faint); font: 13px var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.lyrics.synced .l-line { color: var(--faint); cursor: pointer; }
.lyrics.synced .l-line.past { color: var(--dim); }
.lyrics.synced .l-line.active { color: var(--fg); }
.lyrics.synced .l-line:hover { color: var(--fg); }
.lyrics .l-line.sync-next { color: var(--fg); text-decoration: underline; text-underline-offset: 6px; }

.dock { padding: 0 var(--gutter) 16px; }
.progress { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.time { font: 12px var(--mono); color: var(--dim); min-width: 4ch; text-align: center; }
.controls {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  margin-top: 4px;
}
.transport { display: flex; align-items: center; gap: clamp(2px, 1.5vw, 14px); }
.side { display: flex; align-items: center; gap: 8px; }
.side-r { justify-content: flex-end; }
.volume { display: flex; align-items: center; gap: 4px; }
.volume .range { width: 100px; }

.sync-bar {
  position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center;
  padding: 8px 12px; background: var(--fg); color: var(--bg); font: 12px var(--mono); z-index: 2;
}
.sync-bar button { border: 1px solid var(--bg); padding: 4px 10px; }
.sync-bar kbd { font: inherit; border: 1px solid rgba(0, 0, 0, 0.4); padding: 0 4px; }

/* Mobile player: art on top, lyrics below, compact controls */
@media (max-width: 800px) {
  .stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding-top: 12px; }
  .art { height: min(32vh, 100vw - 2 * var(--gutter)); height: min(32dvh, 100vw - 2 * var(--gutter)); }
  .lyrics { padding: 0; text-align: center; }
  .lyrics::before, .lyrics::after { content: ""; display: block; height: 16%; }
.lyrics.synced::before, .lyrics.synced::after, .lyrics.sync-mode::before, .lyrics.sync-mode::after { height: 50%; }
.lyrics .l-line { font-size: 19px; }
  .side { display: contents; }
  .controls { display: flex; justify-content: center; }
  .volume { display: none; }
  .transport { gap: 0; }
  .icon-btn.play { width: 56px; height: 56px; }
}
@media (max-width: 380px) {
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn.play { width: 52px; height: 52px; }
}
@media (max-height: 520px) and (min-width: 600px) {
  .stage { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .art { height: auto; }
}

.noscript { padding: var(--gutter); color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .intro i { animation: none; }
}
