:root {
  --bg: #0e1013;
  --panel: #171a1f;
  --panel-2: #1e2228;
  --line: #2c3138;
  --fg: #e8eaed;
  --dim: #969ca6;
  --accent: #4cc9a4;
  --focus: #7ad9bd;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding: 24px 16px 56px;
}

.wrap {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 14px;
}

h1 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
}

.count {
  color: var(--dim);
  font-size: 12.5px;
  margin: 0;
}

/* ---------- player deck ---------- */
.deck {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.now-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-artist {
  color: var(--dim);
  font-size: 13px;
  margin: 2px 0 0;
  min-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seekrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
}

.time {
  color: var(--dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.vol {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  min-width: 120px;
}

.vol[hidden] { display: none; }

/* ---------- range inputs ---------- */
.seek {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) calc(var(--p, 0) * 1%),
    var(--line) calc(var(--p, 0) * 1%)
  );
  cursor: pointer;
  margin: 0;
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fg);
  border: none;
}

.seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--fg);
}

.seek:disabled { opacity: 0.45; cursor: default; }

#volume { max-width: 84px; }

/* ---------- buttons ---------- */
.btn {
  display: grid;
  place-items: center;
  border: 0;
  background: var(--panel-2);
  color: var(--fg);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
}

.btn:hover { background: #262b33; }
.btn:active { transform: scale(0.97); }

.btn.icon { width: 44px; height: 44px; }
.btn.play { width: 52px; height: 52px; background: var(--accent); color: #08120f; }
.btn.play:hover { background: #58dcb4; }

.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn.play svg { width: 26px; height: 26px; }

.btn:focus-visible,
.seek:focus-visible,
.row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* play / pause icon swap */
.i-pause, .i-mute { display: none; }
.btn.play[data-state="playing"] .i-play { display: none; }
.btn.play[data-state="playing"] .i-pause { display: block; }
.btn.icon[data-muted="true"] .i-wave { display: none; }
.btn.icon[data-muted="true"] .i-mute { display: block; }

.i-wave, .i-mute { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- track list ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.list:empty { display: none; }

.list li + li { border-top: 1px solid var(--line); }

.row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 52px;
}

.row:hover { background: var(--panel); }
.row[aria-current="true"] { background: var(--panel-2); }
.row[aria-current="true"] .row-title { color: var(--accent); }

.row-no {
  color: var(--dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  color: var(--dim);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* playing bars on the active row */
.row[aria-current="true"] .row-no { color: var(--accent); }

/* ---------- messages ---------- */
.note {
  color: var(--dim);
  font-size: 13px;
  margin: 14px 2px 0;
  min-height: 18px;
}

.note:empty { min-height: 0; margin-top: 0; }

.hint {
  color: var(--dim);
  font-size: 12px;
  margin: 10px 0 0;
}

.hint:empty { display: none; }

@media (max-width: 420px) {
  body { padding: 16px 12px 40px; }
  .deck { padding: 14px; }
  .vol { min-width: 96px; }
  #volume { max-width: 56px; }
}
