:root{
  --black: #000000;
  --bg-base: #121212;
  --bg-elevated: #181818;
  --bg-highlight: #282828;
  --bg-press: #000000;
  --green: #1DB954;
  --green-hover: #1ed760;
  --text-white: #ffffff;
  --text-subdued: #a7a7a7;
  --text-bright: #b3b3b3;
  --border: #2a2a2a;
  --player-h: 90px;
  --sidebar-w: 280px;
}

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

html,body{
  height:100%;
  background:var(--black);
  font-family:'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color:var(--text-white);
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}

button{ font-family:inherit; border:none; background:none; cursor:pointer; color:inherit; }
a{ text-decoration:none; color:inherit; }
input{ font-family:inherit; border:none; outline:none; background:none; color:inherit; }
ul{ list-style:none; }
svg{ width:100%; height:100%; fill:currentColor; display:block; }

::-webkit-scrollbar{ width:12px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:rgba(255,255,255,0.15); border-radius:6px; border:3px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover{ background:rgba(255,255,255,0.3); }

/* ============ APP SHELL ============ */
.app{
  display:flex;
  height:calc(100vh - var(--player-h));
  gap:8px;
  padding:8px 8px 0 8px;
}

/* ============ SIDEBAR ============ */
.sidebar{
  width:var(--sidebar-w);
  background:var(--black);
  border-radius:8px;
  display:flex;
  flex-direction:column;
  padding:20px 12px;
  flex-shrink:0;
  animation:slideInLeft .5s ease;
}

@keyframes slideInLeft{ from{ opacity:0; transform:translateX(-16px);} to{ opacity:1; transform:translateX(0);} }

.sidebar-logo{
  display:flex; align-items:center; gap:10px;
  padding:8px 12px 24px 12px;
  font-size:24px; font-weight:800; letter-spacing:-0.5px;
}
.logo-icon{ width:32px; height:32px; flex-shrink:0; }

.sidebar-nav{ display:flex; flex-direction:column; gap:4px; margin-bottom:20px; }
.nav-item{
  display:flex; align-items:center; gap:16px;
  padding:8px 12px;
  border-radius:6px;
  font-weight:700; font-size:14px;
  color:var(--text-subdued);
  transition:color .15s ease;
}
.nav-item svg{ width:22px; height:22px; }
.nav-item:hover{ color:var(--text-white); }
.nav-item.active{ color:var(--text-white); }

.sidebar-actions{ display:flex; flex-direction:column; gap:6px; margin-bottom:8px; }
.pill-btn{
  display:flex; align-items:center; gap:12px;
  padding:8px 12px;
  font-size:14px; font-weight:700;
  color:var(--text-subdued);
  border-radius:6px;
  transition:color .15s ease, background .15s ease;
  text-align:left;
}
.pill-btn:hover{ color:var(--text-white); background:var(--bg-highlight); }
.pill-icon{
  width:24px; height:24px;
  display:flex; align-items:center; justify-content:center;
  background:var(--text-subdued);
  color:var(--black);
  border-radius:4px;
  font-size:16px;
  flex-shrink:0;
}
.pill-btn:hover .pill-icon{ background:var(--text-white); }

.sidebar-divider{ border:none; border-top:1px solid var(--border); margin:8px 4px 12px 4px; }

.sidebar-search-wrap{ padding:0 12px 12px 12px; }
.sidebar-search-wrap input{
  width:100%; font-size:13px; color:var(--text-bright);
  border-bottom:1px solid transparent;
  padding:4px 0;
}
.sidebar-search-wrap input::placeholder{ color:var(--text-subdued); }

.playlist-list{
  overflow-y:auto;
  flex:1;
  display:flex; flex-direction:column;
}
.playlist-item{
  display:flex; align-items:center; gap:12px;
  padding:8px 12px;
  border-radius:6px;
  cursor:pointer;
  transition:background .15s ease;
}
.playlist-item:hover{ background:var(--bg-highlight); }
.playlist-item.playing .pl-name{ color:var(--green); }
.pl-cover{
  width:48px; height:48px; border-radius:4px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  font-size:18px;
}
.pl-meta{ display:flex; flex-direction:column; min-width:0; }
.pl-name{ font-size:14px; font-weight:500; color:var(--text-white); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pl-sub{ font-size:12px; color:var(--text-subdued); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ============ MAIN ============ */
.main{
  flex:1;
  background:linear-gradient(180deg, #1f1f1f 0%, var(--bg-base) 320px);
  border-radius:8px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  position:relative;
}

.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 32px;
  position:sticky; top:0; z-index:10;
  background:transparent;
}
.nav-arrows{ display:flex; gap:16px; }
.round-btn{
  width:32px; height:32px; border-radius:50%;
  background:rgba(0,0,0,0.7);
  display:flex; align-items:center; justify-content:center;
  color:var(--text-white);
  transition:background .15s ease;
}
.round-btn svg{ width:18px; height:18px; }
.round-btn:hover{ background:rgba(0,0,0,0.9); }

.topbar-search{
  display:flex; align-items:center; gap:8px;
  background:var(--bg-highlight);
  border-radius:500px;
  padding:10px 16px;
  width:400px;
  max-width:40vw;
  transition:background .15s ease;
  border:1px solid transparent;
}
.topbar-search:focus-within{ background:#2a2a2a; border-color:var(--text-white); }
.search-icon{ width:18px; height:18px; color:var(--text-white); flex-shrink:0; }
.topbar-search input{ flex:1; font-size:14px; color:var(--text-white); }
.topbar-search input::placeholder{ color:var(--text-subdued); }

.topbar-user{ display:flex; align-items:center; gap:24px; }
.upgrade-btn{
  font-size:14px; font-weight:700; color:var(--text-white);
  padding:8px 4px;
  transition:transform .1s ease;
}
.upgrade-btn:hover{ transform:scale(1.04); }
.avatar{
  width:32px; height:32px; border-radius:50%;
  background:#535353;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:14px;
  cursor:pointer;
  transition:transform .15s ease;
}
.avatar:hover{ transform:scale(1.06); }

.content{
  flex:1;
  overflow-y:auto;
  padding:0 32px 32px 32px;
}

/* Greeting cards */
.greeting-row{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(230px, 1fr));
  gap:16px;
  margin:16px 0 32px 0;
}
.greeting-card{
  display:flex; align-items:center; gap:16px;
  background:rgba(255,255,255,0.07);
  border-radius:6px;
  overflow:hidden;
  cursor:pointer;
  transition:background .25s ease;
  animation:fadeUp .5s ease backwards;
}
.greeting-card:hover{ background:rgba(255,255,255,0.14); }
.greeting-card .g-cover{ width:64px; height:64px; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:22px; }
.greeting-card .g-name{ font-weight:700; font-size:14px; }

@keyframes fadeUp{ from{ opacity:0; transform:translateY(12px);} to{ opacity:1; transform:translateY(0);} }

/* Rows */
.row{ margin-bottom:32px; animation:fadeUp .5s ease backwards; }
.row-header{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:16px; }
.row-header h2{ font-size:22px; font-weight:800; letter-spacing:-0.3px; }
.show-all{ font-size:12px; font-weight:700; color:var(--text-subdued); }
.show-all:hover{ color:var(--text-white); text-decoration:underline; }

.card-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(180px, 1fr));
  gap:20px;
}

.card{
  background:var(--bg-elevated);
  border-radius:8px;
  padding:16px;
  cursor:pointer;
  transition:background .25s ease;
  position:relative;
}
.card:hover{ background:var(--bg-highlight); }

.card-cover-wrap{ position:relative; margin-bottom:16px; }
.card-cover{
  width:100%; aspect-ratio:1/1;
  border-radius:4px;
  display:flex; align-items:center; justify-content:center;
  font-size:36px;
  box-shadow:0 8px 24px rgba(0,0,0,0.5);
  position:relative;
  overflow:hidden;
}
.card-cover::after{
  content:'';
  position:absolute; inset:0;
  background:radial-gradient(circle at 30% 20%, rgba(255,255,255,0.25), transparent 60%);
}
.artist-grid .card-cover{ border-radius:50%; }

.card-play-btn{
  position:absolute;
  bottom:8px; right:8px;
  width:48px; height:48px;
  border-radius:50%;
  background:var(--green);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 16px rgba(0,0,0,0.4);
  opacity:0; transform:translateY(8px);
  transition:opacity .25s ease, transform .25s ease, background .15s ease, transform .1s ease;
  color:var(--black);
}
.card-play-btn svg{ width:20px; height:20px; margin-left:2px; }
.card:hover .card-play-btn{ opacity:1; transform:translateY(0); }
.card-play-btn:hover{ background:var(--green-hover); transform:translateY(0) scale(1.06) !important; }
.card-play-btn.is-playing{ opacity:1; transform:translateY(0); }

.card-title{ font-weight:700; font-size:15px; margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.card-desc{ font-size:13px; color:var(--text-subdued); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.4; }

/* Equalizer for playing card */
.eq{
  display:flex; align-items:flex-end; gap:2px;
  width:14px; height:14px;
}
.eq span{
  width:3px; background:var(--green);
  animation:eq 0.9s ease-in-out infinite;
}
.eq span:nth-child(1){ height:40%; animation-delay:0s; }
.eq span:nth-child(2){ height:100%; animation-delay:.2s; }
.eq span:nth-child(3){ height:60%; animation-delay:.4s; }
@keyframes eq{ 0%,100%{ transform:scaleY(0.4);} 50%{ transform:scaleY(1);} }

/* ============ PLAYER BAR ============ */
.player-bar{
  height:var(--player-h);
  background:var(--bg-elevated);
  border-top:1px solid var(--border);
  display:grid;
  grid-template-columns:1fr 2fr 1fr;
  align-items:center;
  padding:0 16px;
  position:fixed;
  bottom:0; left:0; right:0;
  z-index:100;
}

.player-left{ display:flex; align-items:center; gap:12px; min-width:180px; }
.now-art{
  width:56px; height:56px; border-radius:4px;
  background:var(--bg-highlight);
  flex-shrink:0;
  object-fit:cover;
}
.now-info{ min-width:0; }
.now-title{ font-size:14px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:180px; }
.now-artist{ font-size:12px; color:var(--text-subdued); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.like-btn{ width:20px; height:20px; color:var(--text-subdued); transition:color .15s ease, transform .2s ease; flex-shrink:0; }
.like-btn:hover{ color:var(--text-white); }
.like-btn.liked{ color:var(--green); animation:pop .3s ease; }
@keyframes pop{ 0%{ transform:scale(1);} 40%{ transform:scale(1.35);} 100%{ transform:scale(1);} }

.player-center{ display:flex; flex-direction:column; align-items:center; gap:8px; max-width:722px; margin:0 auto; width:100%; }
.player-controls{ display:flex; align-items:center; gap:20px; }
.ctrl-btn{ width:16px; height:16px; color:var(--text-subdued); transition:color .15s ease, transform .15s ease; }
.ctrl-btn:hover{ color:var(--text-white); transform:scale(1.06); }
.ctrl-btn.small{ width:16px; height:16px; }
.ctrl-btn.active-toggle{ color:var(--green); }
.ctrl-btn.active-toggle:hover{ color:var(--green-hover); }

.play-btn{
  width:32px; height:32px; border-radius:50%;
  background:var(--text-white);
  color:var(--black);
  display:flex; align-items:center; justify-content:center;
  transition:transform .1s ease, background .15s ease;
}
.play-btn svg{ width:16px; height:16px; }
.play-btn:hover{ transform:scale(1.06); background:#f0f0f0; }
.play-btn:active{ transform:scale(0.94); }

.progress-row{ display:flex; align-items:center; gap:8px; width:100%; }
.time{ font-size:11px; color:var(--text-subdued); min-width:40px; text-align:center; user-select:none; }

.progress-bar, .volume-bar{
  position:relative;
  height:4px;
  background:rgba(255,255,255,0.3);
  border-radius:2px;
  cursor:pointer;
  flex:1;
}
.progress-fill, .volume-fill{
  position:absolute; left:0; top:0; bottom:0;
  background:var(--text-white);
  border-radius:2px;
  width:0%;
  transition:background .1s ease;
}
.progress-bar:hover .progress-fill, .volume-bar:hover .volume-fill{ background:var(--green); }
.progress-handle, .volume-handle{
  position:absolute; top:50%; left:0%;
  width:12px; height:12px; border-radius:50%;
  background:var(--text-white);
  transform:translate(-50%,-50%) scale(0);
  transition:transform .15s ease;
  box-shadow:0 1px 4px rgba(0,0,0,0.4);
}
.progress-bar:hover .progress-handle, .volume-bar:hover .volume-handle{ transform:translate(-50%,-50%) scale(1); }
.progress-bar.dragging .progress-handle, .volume-bar.dragging .volume-handle{ transform:translate(-50%,-50%) scale(1); }

.player-right{ display:flex; align-items:center; justify-content:flex-end; gap:16px; }
.volume-row{ display:flex; align-items:center; gap:8px; width:130px; }
.volume-bar{ width:100%; }

/* Toast */
.toast{
  position:fixed;
  bottom:calc(var(--player-h) + 20px);
  left:50%;
  transform:translateX(-50%) translateY(20px);
  background:#f0f0f0;
  color:#000;
  font-weight:600;
  font-size:14px;
  padding:12px 20px;
  border-radius:6px;
  box-shadow:0 8px 24px rgba(0,0,0,0.5);
  opacity:0;
  pointer-events:none;
  transition:opacity .25s ease, transform .25s ease;
  z-index:1000;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* Row stagger animation delays */
.row:nth-of-type(1){ animation-delay:.05s; }
.row:nth-of-type(2){ animation-delay:.12s; }
.row:nth-of-type(3){ animation-delay:.19s; }
.greeting-card:nth-child(1){ animation-delay:.03s; }
.greeting-card:nth-child(2){ animation-delay:.07s; }
.greeting-card:nth-child(3){ animation-delay:.11s; }
.greeting-card:nth-child(4){ animation-delay:.15s; }
.greeting-card:nth-child(5){ animation-delay:.19s; }
.greeting-card:nth-child(6){ animation-delay:.23s; }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px){
  :root{ --sidebar-w:0px; }
  .sidebar{ display:none; }
  .card-grid{ grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); }
  .topbar-search{ width:220px; }
  .now-title, .now-artist{ max-width:100px; }
  .volume-row{ display:none; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.01ms !important; animation-iteration-count:1 !important; transition-duration:0.01ms !important; }
}

:focus-visible{
  outline:2px solid var(--green);
  outline-offset:2px;
}