:root {
  --bg: #0e0d12;
  --bg-2: #16151c;
  --surface: #1d1c24;
  --surface-2: #26252f;
  --line: #2f2e39;
  --text: #f4f2f7;
  --muted: #9b98a8;
  --accent: #e8b86d;
  --accent-ink: #1a1408;
  --danger: #ff6b6b;
  --ok: #5fd39a;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, select { font: inherit; color: inherit; }

button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}

.hidden { display: none !important; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.15s, transform 0.1s, color 0.15s;
}
.icon-btn:active { transform: scale(0.92); background: var(--surface-2); }
.icon-btn svg { width: 26px; height: 26px; fill: currentColor; }
.icon-btn.on { color: var(--accent); }
.icon-btn .badge {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  transform: translate(10px, 9px);
}

.play-btn {
  width: 76px;
  height: 76px;
  background: var(--accent);
  color: var(--accent-ink);
}
.play-btn svg { width: 34px; height: 34px; }
.play-btn:active { background: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 600;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; }

.field {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  font-size: 16px; /* 16px stops iOS from zooming in on focus */
}
.field:focus { border-color: var(--accent); }

/* Range input styled as a progress/volume bar */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  --pct: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--surface-2) var(--pct));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--pct), var(--surface-2) var(--pct));
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.bad { background: var(--danger); }

/* Track list */
.track-list { list-style: none; margin: 0; padding: 0; }
.track {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.track:active { background: var(--surface-2); }
.track .num {
  width: 24px;
  text-align: right;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  flex: none;
}
.track .meta { flex: 1; min-width: 0; }
.track .title, .track .artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track .title { font-weight: 600; }
.track .artist { font-size: 13px; color: var(--muted); margin-top: 2px; }
.track .dur { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; flex: none; }
.track.current .title, .track.current .num { color: var(--accent); }
.track .saved { width: 16px; height: 16px; fill: var(--muted); flex: none; opacity: 0; }
.track .saved.yes { opacity: 1; fill: var(--ok); }

.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
.eq.paused i { animation: none; height: 4px; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  max-width: calc(100% - 32px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
