*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #252545;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --text: #e2e8f0;
  --text-muted: #718096;
  --border: #2d2d4e;
}

html { height: -webkit-fill-available; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  height: 100vh;
  height: -webkit-fill-available;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 20px) 20px env(safe-area-inset-bottom, 20px);
}

.container {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

h1 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ─── Artwork ─────────────────────────────── */
.artwork {
  width: 220px;
  height: 220px;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.artwork.playing {
  transform: scale(1.03);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.3);
}

.artwork-icon { font-size: 80px; opacity: 0.25; }

.track-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ─── Progress ────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface2);
  border-radius: 2px;
  cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-light);
  cursor: pointer;
}

.time-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: -12px;
}

/* ─── Play button ─────────────────────────── */
.btn-play {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  /* shift play icon visually center */
  padding-left: 4px;
}

.btn-play.playing { padding-left: 0; }

.btn-play:active {
  background: #6d28d9;
  transform: scale(0.95);
}

/* ─── Bottom row ──────────────────────────── */
.bottom-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-loop {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-loop.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent);
  color: var(--accent-light);
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

#volume-icon { font-size: 16px; flex-shrink: 0; }

.volume-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--surface2);
  border-radius: 2px;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  cursor: pointer;
}

/* ─── Cache status ────────────────────────── */
.cache-status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
  white-space: nowrap;
  transition: opacity 0.5s, transform 0.5s;
  z-index: 10;
}

.cache-status.ready {
  color: #4ade80;
  border-color: #166534;
}

.cache-status.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}
