*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #000;
  --bg-main: #0a0a0a;
  --bg-card: #141414;
  --bg-card-hover: #1e1e1e;
  --bg-elevated: #1a1a1a;
  --text: #fff;
  --text-dim: #aaa;
  --text-faint: #666;
  --accent: #c4a265;
  --accent-dim: rgba(196, 162, 101, 0.18);
  --border: rgba(255, 255, 255, 0.08);
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'DM Sans', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  width: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, button { font-family: inherit; }

.screen {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(20px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

/* ── SELECT SCREEN ───────────────────────────── */
.select-header {
  text-align: center;
  margin-bottom: 32px;
  padding-top: 8px;
}

.logo {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: #fff;
}
.logo span { font-weight: 600; font-style: italic; }

.select-tag {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 10px;
}

.playlist-grid {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.playlist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.06s;
  min-height: 84px;
  text-align: left;
  width: 100%;
}

.playlist-card:active {
  transform: scale(0.985);
  background: var(--bg-card-hover);
}

@media (hover: hover) {
  .playlist-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(196, 162, 101, 0.3);
  }
}

.playlist-card.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.card-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(196, 162, 101, 0.1);
  border: 1px solid var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.15;
  color: #fff;
  margin-bottom: 4px;
}

.card-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 6px;
}

.card-arrow {
  font-size: 28px;
  color: var(--text-faint);
  margin-left: 4px;
  flex-shrink: 0;
}

.select-loading {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 40px;
}

/* ── PLAYER SCREEN ───────────────────────────── */
.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  width: 100%;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.icon-btn:active { background: var(--bg-card-hover); }

.player-header-info {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.player-header-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.player-header-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-spacer { width: 44px; flex-shrink: 0; }

/* Now playing */
.now-playing {
  text-align: center;
  margin: 18px 0 22px;
  width: 100%;
}

.art-circle {
  width: min(45vw, 150px);
  height: min(45vw, 150px);
  border-radius: 50%;
  margin: 0 auto 22px;
  background: radial-gradient(circle at 30% 30%, rgba(196, 162, 101, 0.18), rgba(0, 0, 0, 0.4));
  border: 1px solid var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s ease;
}

.art-circle.playing {
  animation: pulse 3.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
  50% { transform: scale(1.02); box-shadow: 0 14px 50px rgba(196, 162, 101, 0.18); }
}

.art-icon {
  font-family: var(--font-display);
  font-size: 48px;
  color: var(--accent);
  font-style: italic;
  font-weight: 300;
  opacity: 0.9;
}

/* Play / pause icon swap */
.play-btn .pause-svg { display: none; }
.play-btn.is-playing .play-svg { display: none; }
.play-btn.is-playing .pause-svg { display: block; }

.now-track-name {
  font-family: var(--font-display);
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 500;
  line-height: 1.2;
  color: #fff;
  padding: 0 4px;
  word-break: break-word;
  margin-bottom: 6px;
}

.now-track-meta {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  min-height: 16px;
}

/* Progress */
.progress-wrap {
  width: 100%;
  margin: 6px 0 26px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #e6c07b);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.progress-times {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

/* Big controls */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 8px 0 32px;
  width: 100%;
}

.ctrl-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.06s, border-color 0.15s;
}

.ctrl-btn:active {
  transform: scale(0.94);
  background: var(--bg-card-hover);
}

@media (hover: hover) {
  .ctrl-btn:hover { background: var(--bg-card-hover); border-color: rgba(255,255,255,0.18); }
}

.ctrl-btn.play-btn {
  width: 96px;
  height: 96px;
  background: linear-gradient(180deg, #d4b072, #a8854d);
  border-color: rgba(196, 162, 101, 0.6);
  color: #1a1207;
  box-shadow: 0 8px 28px rgba(196, 162, 101, 0.25);
}

.ctrl-btn.play-btn:active {
  background: linear-gradient(180deg, #c4a265, #98763f);
}

.ctrl-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}


/* Track list */
.track-list-wrap {
  width: 100%;
  margin-top: 6px;
}

.track-list-title {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 12px;
  padding: 0 4px;
}

.track-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 54px;
  transition: background 0.15s, border-color 0.15s;
}

.track-row:active { background: var(--bg-card-hover); }

@media (hover: hover) {
  .track-row:hover { background: var(--bg-card-hover); }
}

.track-row.is-playing {
  background: rgba(196, 162, 101, 0.08);
  border-color: var(--accent-dim);
}

.track-row-num {
  width: 24px;
  flex-shrink: 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.track-row.is-playing .track-row-num {
  color: var(--accent);
}

.track-row-name {
  flex: 1;
  font-size: 14px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.track-row-dur {
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.empty-tracks {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 24px 8px;
}

/* Wider screens — keep things centered, never wider than this */
@media (min-width: 600px) {
  .screen {
    padding-left: 32px;
    padding-right: 32px;
    align-items: center;
  }
  .player-header,
  .now-playing,
  .progress-wrap,
  .controls,
  .track-list-wrap {
    max-width: 520px;
  }
}
