:root {
  --berry-50: #fff4f5;
  --berry-100: #ffe7eb;
  --berry-200: #ffc8d1;
  --berry-300: #ff9bad;
  --berry-400: #ff6f8b;
  --berry-500: #f64770;
  --berry-600: #d73158;
  --ink-900: #2a0f18;
  --ink-700: #5a2e3d;
  --mint-100: #effcf8;
  --mint-400: #44c1a1;
  --panel: rgba(255, 248, 249, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(146, 62, 86, 0.2);
  --shadow: 0 16px 48px rgba(143, 40, 74, 0.2);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Lexend", sans-serif;
  color: var(--ink-900);
  background:
    radial-gradient(circle at 15% 10%, #fff0d8 0%, transparent 42%),
    radial-gradient(circle at 85% 20%, #ffd8df 0%, transparent 40%),
    linear-gradient(140deg, #fffaf5 0%, #ffeef2 45%, #fff7f8 100%);
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 36vw;
  height: 36vw;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -1;
  opacity: 0.55;
  animation: drift 11s ease-in-out infinite;
}

.orb-a { background: #ff7a90; top: -12vw; right: -8vw; }
.orb-b { background: #ffce7a; bottom: -10vw; left: -8vw; animation-delay: 1.6s; }

.app-shell {
  width: min(1160px, 94vw);
  margin: 4.2rem auto;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.2rem;
}

.card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  animation: enter 0.72s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.library-panel { padding: 1.4rem; animation-delay: 0.07s; }
.player-panel { padding: 1.6rem; animation-delay: 0.16s; }

h1, h2, h3 { margin: 0; font-family: "Space Grotesk", sans-serif; }
h1 { font-size: 1.42rem; }

.lib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.gear-btn {
  background: none !important;
  color: var(--ink-700) !important;
  font-size: 1.3rem;
  cursor: pointer;
  border: none;
  padding: 0.2rem;
  transition: transform 0.2s;
  width: auto;
  height: auto;
}

.gear-btn:hover { transform: rotate(60deg); }

.subtitle {
  margin-top: 0.45rem;
  color: var(--ink-700);
  font-size: 0.93rem;
}

/* ── Auth ── */

.auth-section {
  margin-top: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.auth-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.26rem 0.58rem;
  border-radius: 999px;
  color: var(--berry-600);
  background: var(--berry-100);
  border: 1px solid rgba(188, 61, 96, 0.2);
}

.auth-badge.ok {
  color: #1c6e55;
  background: #e4faef;
  border-color: rgba(67, 155, 126, 0.28);
}

.auth-status {
  margin: 0.55rem 0 0;
  color: var(--ink-700);
  font-size: 0.86rem;
}

.auth-actions { margin-top: 0.65rem; display: flex; gap: 0.5rem; }

.btn.discord { background: linear-gradient(120deg, #6a7bff, #4f62ff); }
.btn:disabled { opacity: 0.62; cursor: not-allowed; }

/* ── Upload ── */

.upload-buttons { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

.upload-zone {
  border: 2px dashed rgba(175, 54, 92, 0.35);
  border-radius: 18px;
  background: var(--panel-strong);
  min-height: 80px;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 0.8rem;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.upload-zone:hover,
.upload-zone.drag {
  transform: translateY(-2px);
  border-color: var(--berry-600);
  background: #fff;
}

.upload-zone.locked { cursor: not-allowed; opacity: 0.65; }
.upload-zone.locked:hover {
  transform: none;
  border-color: rgba(175, 54, 92, 0.35);
  background: var(--panel-strong);
}

.folder-upload { border-color: rgba(67, 155, 126, 0.35); min-height: 60px; }
.folder-upload:hover { border-color: var(--mint-400); }

.upload-title { font-family: "Space Grotesk", sans-serif; font-size: 1.03rem; }
.upload-copy { color: var(--ink-700); font-size: 0.89rem; margin-top: 0.25rem; }

/* ── Buttons ── */

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.62rem 0.9rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(110deg, var(--berry-500), var(--berry-300));
  color: #fff;
}

.btn.secondary { background: #fff; color: var(--ink-900); border: 1px solid var(--line); }

.btn-sm { padding: 0.38rem 0.7rem; font-size: 0.82rem; }

.btn-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(130deg, var(--berry-500), var(--berry-300));
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 1;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-icon:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(192, 52, 90, 0.3);
}

/* ── Player ── */

.now-playing { display: flex; align-items: center; gap: 1rem; }

.cover-art {
  width: 124px;
  aspect-ratio: 1 / 1;
  border-radius: 20px;
  background:
    radial-gradient(circle at 18% 18%, #ffe7ad 0%, transparent 30%),
    linear-gradient(135deg, #ff7f95, #f24d71);
  box-shadow: 0 14px 34px rgba(192, 52, 90, 0.34);
  display: grid;
  place-items: center;
  color: #fff;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
}

.meta-label { margin: 0; color: var(--ink-700); font-size: 0.87rem; }
#current-track-title { margin-top: 0.2rem; font-size: 1.2rem; word-break: break-word; }
#current-track-artist { margin-top: 0.15rem; color: var(--ink-700); font-size: 0.9rem; }
.meta-album { margin: 0.1rem 0 0; color: var(--ink-700); font-size: 0.82rem; opacity: 0.7; }

.like-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ink-700);
  padding: 0.3rem 0;
  transition: transform 0.2s, color 0.2s;
}

.like-btn:hover { transform: scale(1.15); }
.like-btn.liked { color: var(--berry-500); }

.progress-wrap {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 0.65rem;
}

input[type="range"] { accent-color: var(--berry-600); }

.controls { margin-top: 1rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.circle-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--ink-900);
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}

.circle-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(102, 35, 56, 0.22);
}

.circle-btn.active { background: var(--berry-100); border-color: var(--berry-400); color: var(--berry-600); }

.circle-btn.play {
  width: 54px;
  height: 54px;
  background: linear-gradient(130deg, var(--berry-500), var(--berry-300));
  color: #fff;
  border: 0;
}

.volume-wrap { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; color: var(--ink-700); font-size: 0.85rem; }
.volume-wrap input { width: 80px; }

/* ── EQ ── */

.eq-section {
  margin-top: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
}

.eq-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }

.eq-sliders { display: flex; gap: 0.4rem; align-items: flex-end; justify-content: center; height: 140px; }

.eq-band { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; flex: 1; }

.eq-band input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  height: 100px;
  width: 28px;
  accent-color: var(--berry-500);
}

.eq-band-label { font-size: 0.65rem; color: var(--ink-700); font-weight: 600; }
.eq-band-value { font-size: 0.7rem; color: var(--ink-700); }

.eq-presets { margin-top: 0.5rem; display: flex; justify-content: center; }

.eq-preset-select {
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.82rem;
  background: #fff;
}

/* ── Visualizer ── */

.visualizer-section { margin-top: 0.8rem; text-align: right; }

.visualizer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visualizer-overlay canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.visualizer-cover {
  position: absolute;
  width: 30vmin;
  height: 30vmin;
  border-radius: 24px;
  box-shadow: 0 0 80px rgba(255, 255, 255, 0.15);
  background-size: cover;
  background-position: center;
  z-index: 2;
  opacity: 0.9;
}

.visualizer-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 3;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
}

.visualizer-close:hover { background: rgba(255, 255, 255, 0.3); }

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #fff;
  border-radius: 20px;
  padding: 1.6rem;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: enter 0.3s ease;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }

.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--ink-700); padding: 0.2rem; }

.modal-body .setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 0;
  gap: 1rem;
}

.modal-body .setting-row label { font-weight: 600; color: var(--ink-900); }

.modal-body .setting-row select {
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--panel-strong);
}

/* ── Queue ── */

.queue-section { margin-top: 1.35rem; }

.queue-list {
  margin: 0.6rem 0 0;
  list-style: none;
  padding: 0;
  max-height: 310px;
  overflow-x: hidden;
  overflow-y: auto;
}

.queue-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  margin-bottom: 0.4rem;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  word-break: break-word;
}

.queue-item:hover { border-color: var(--berry-300); background: var(--berry-50); }

.queue-item.playing {
  border-color: var(--berry-600);
  background: linear-gradient(95deg, var(--mint-100), #fff);
}

.queue-track-info { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }

.queue-track-num {
  color: var(--ink-700);
  font-size: 0.82rem;
  font-weight: 600;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.queue-track-title { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.queue-track-artist { color: var(--ink-700); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Library ── */

.saved-section { margin-top: 1rem; }

.saved-header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }

.saved-header-actions { display: flex; align-items: center; gap: 0.4rem; }

.saved-list { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow-y: auto; }

.library-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  margin-bottom: 0.35rem;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.track-info { min-width: 0; }

.track-title { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.track-artist { color: var(--ink-700); font-size: 0.78rem; }
.track-size { color: var(--ink-700); font-size: 0.72rem; margin-top: 0.1rem; }

.heart-btn {
  background: none !important;
  color: var(--berry-500) !important;
  font-size: 1.2rem;
  width: auto;
  height: auto;
  padding: 0.2rem;
}

/* ── Animations ── */

@keyframes enter {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(16px) translateX(-8px); }
}

/* ── Responsive ── */

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; margin: 1.3rem auto 2rem; }
  .cover-art { width: 96px; }
  .controls { flex-wrap: wrap; }
  .volume-wrap { width: 100%; justify-content: flex-end; }
  .eq-sliders { height: 100px; }
  .eq-band input[type="range"] { height: 70px; }
}
