:root {
  --bg: #0e0e10;
  --bg-elev: #17171b;
  --bg-elev-2: #1f1f25;
  --fg: #ececf1;
  --fg-muted: #8a8a93;
  --accent: #6ee7b7;
  --accent-fg: #053b2a;
  --danger: #f87171;
  --border: #2a2a32;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 120px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.muted { color: var(--fg-muted); font-size: 13px; }
.error { color: var(--danger); }
.empty { text-align: center; padding: 32px 0; }

.now-playing {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

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

.np-time {
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 14px;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-elev-2);
  border-radius: 999px;
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--fg);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--fg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ctrl {
  background: transparent;
  border: none;
  color: var(--fg);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.05s;
}
.ctrl:hover { background: var(--bg-elev-2); }
.ctrl:active { transform: scale(0.95); }
.ctrl svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ctrl.primary {
  background: var(--accent);
  color: var(--accent-fg);
  width: 44px;
  height: 44px;
}
.ctrl.primary svg { fill: currentColor; stroke: none; }
.ctrl.primary:hover { background: var(--accent); filter: brightness(1.1); }
.ctrl.toggle { position: relative; }
.ctrl.toggle[aria-pressed="true"],
.ctrl.toggle[data-mode="all"],
.ctrl.toggle[data-mode="one"] { color: var(--accent); }
.ctrl.toggle[aria-pressed="true"]::after,
.ctrl.toggle[data-mode="all"]::after,
.ctrl.toggle[data-mode="one"]::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

#btn-play .icon-pause { display: none; }
#btn-play.is-playing .icon-play { display: none; }
#btn-play.is-playing .icon-pause { display: inline-block; }

#btn-repeat .icon-repeat-one { display: none; }
#btn-repeat[data-mode="one"] .icon-repeat { display: none; }
#btn-repeat[data-mode="one"] .icon-repeat-one { display: inline-block; }

.volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
  margin-left: auto;
  color: var(--fg-muted);
}
.volume svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.volume input { max-width: 120px; }

.tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tracks li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.tracks li:last-child { border-bottom: none; }
.tracks li:hover { background: var(--bg-elev-2); }
.tracks li.active {
  background: var(--bg-elev-2);
  color: var(--accent);
}

.tr-num {
  width: 24px;
  text-align: right;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  flex-shrink: 0;
}
.tracks li.active .tr-num { color: var(--accent); }
.tr-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 22px; }
  .volume { margin-left: 0; flex-basis: 100%; margin-top: 8px; }
  .controls { gap: 2px; }
}
