:root{
  --green:#1db954;
  --bg:#121212;
  --panel:#181818;
  --hover:#282828;
  --text:#fff;
  --sub:#b3b3b3;
  --border:#2a2a2a;
  --shadow: 0 12px 28px rgba(0,0,0,.45);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  overflow:hidden;
}

a{color:inherit; text-decoration:none}
button{font-family:inherit}

.app-shell{
  height:100vh;
  display:flex;
}

/* Sidebar */
.sidebar{
  width:260px;
  background:#000;
  padding:16px 14px;
  display:flex;
  flex-direction:column;
  gap:14px;
  border-right:1px solid #0a0a0a;
  transition: width .18s ease, transform .18s ease;
}
.brand{
  display:flex; align-items:center; gap:10px;
  padding:8px 10px; border-radius:10px;
}
.brand:hover{background:#121212}
.brand-badge{
  width:30px;height:30px;border-radius:50%;
  background:var(--green);
  display:grid;place-items:center;
  color:#000;font-weight:1000;
}
.brand-name{font-weight:1000; letter-spacing:.2px}

.nav{display:flex; flex-direction:column; gap:4px}
.nav a{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:10px;
  color:var(--sub); user-select:none;
}
.nav a:hover{background:#121212; color:#fff}
.nav a.active{background:#121212; color:#fff}

.lib{
  margin-top:8px;
  border-top:1px solid #111;
  padding-top:10px;
}
.lib-title{
  color:var(--sub);
  font-size:12px;
  letter-spacing:.12em;
  padding:8px 12px;
  text-transform:uppercase;
}
.playlist{
  width:100%;
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:10px;
  color:var(--sub);
  cursor:pointer;
  background:none;
  border:none;
  text-align:left;
}
.playlist:hover{background:#121212; color:#fff}

.sidebar-footer{
  margin-top:auto;
  padding:10px 12px;
  color:var(--sub);
  font-size:12px;
  line-height:1.35;
  opacity:.92;
}

/* collapsed sidebar */
body.sidebar-collapsed .sidebar{width:86px}
body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav span,
body.sidebar-collapsed .lib-title,
body.sidebar-collapsed .playlist span:last-child,
body.sidebar-collapsed .sidebar-footer{display:none}
body.sidebar-collapsed .nav a{justify-content:center}
body.sidebar-collapsed .playlist{justify-content:center}

/* main */
.main{
  flex:1;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

/* topbar */
.topbar{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  background: linear-gradient(180deg, #1b1b1b, #121212);
  border-bottom:1px solid #1a1a1a;
}

.icon-btn{
  width:38px;height:38px;
  border-radius:50%;
  border:none;
  background:#0b0b0b;
  color:#fff;
  display:grid;
  place-items:center;
  cursor:pointer;
}
.icon-btn:hover{background:#161616}
.icon-btn:disabled{opacity:.35; cursor:not-allowed}

.searchbox{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  max-width:720px;
  background:#fff;
  border-radius:999px;
  padding:10px 12px;
  color:#000;
}
.searchbox input{
  border:none;
  outline:none;
  flex:1;
  font-size:14px;
  background:transparent;
}
.chip{
  border:none;
  cursor:pointer;
  color:#000;
  background:#eaeaea;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
}
.chip:hover{background:#dedede}

.userbox{margin-left:auto; display:flex; align-items:center; gap:10px}
.userpill{
  display:flex; align-items:center; gap:10px;
  background:#0b0b0b;
  color:#fff;
  border:1px solid #1a1a1a;
  border-radius:999px;
  padding:8px 12px;
  cursor:pointer;
}
.userpill:hover{background:#141414}
.avatar{
  width:24px;height:24px;border-radius:50%;
  background:#2a2a2a;
  display:grid; place-items:center;
  font-size:12px;
}

/* content */
.content{
  overflow:auto;
  padding:16px 16px 120px;
}
.h1{font-size:26px; font-weight:1100; margin:12px 0 10px}
.h2{font-size:18px; font-weight:1100; margin:18px 0 12px; display:flex; justify-content:space-between; align-items:center}
.subtle{color:var(--sub)}
.grid{display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap:16px}
.row{display:flex; gap:14px; overflow:auto; padding-bottom:4px; scroll-snap-type:x proximity}
.row::-webkit-scrollbar{height:10px}
.row::-webkit-scrollbar-thumb{background:#2a2a2a; border-radius:999px}

.card{
  background:var(--panel);
  padding:14px;
  border-radius:12px;
  cursor:pointer;
  position:relative;
  transition: background .14s ease, transform .14s ease;
  min-width: 170px;
  max-width: 220px;
  scroll-snap-align:start;
}
.card:hover{background:var(--hover); transform: translateY(-2px)}
.card img{
  width:100%;
  aspect-ratio:1/1;
  border-radius:10px;
  object-fit:cover;
  display:block;
  box-shadow: var(--shadow);
}
.card .title{
  margin-top:10px;
  font-weight:1000;
  font-size:14px;
  line-height:1.2;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.card .meta{
  margin-top:6px;
  font-size:13px;
  color:var(--sub);
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.play-fab{
  position:absolute;
  right:16px;
  top:128px;
  width:46px;height:46px;
  border-radius:50%;
  background:var(--green);
  color:#000;
  display:grid;
  place-items:center;
  font-weight:1100;
  opacity:0;
  transform: translateY(10px);
  transition: opacity .14s ease, transform .14s ease;
  box-shadow: 0 12px 26px rgba(0,0,0,.45);
}
.card:hover .play-fab{opacity:1; transform: translateY(0)}

/* track page */
.track-hero{
  display:flex;
  gap:18px;
  align-items:flex-end;
  padding:18px;
  border-radius:16px;
  background: linear-gradient(135deg, #2b2b2b, #141414);
  border:1px solid #1f1f1f;
}
.track-hero img{
  width:180px;height:180px;
  border-radius:14px;
  object-fit:cover;
  box-shadow: var(--shadow);
}
.track-hero .kicker{color:var(--sub); font-size:12px; letter-spacing:.12em}
.track-hero .name{font-size:34px; font-weight:1200; margin:6px 0 6px; line-height:1.05}
.track-hero .by{color:var(--sub); font-size:14px}
.hero-actions{margin-top:14px; display:flex; gap:10px; flex-wrap:wrap}
.btn{
  border:none;
  cursor:pointer;
  border-radius:999px;
  padding:10px 16px;
  font-weight:1100;
}
.btn.primary{background:var(--green); color:#000}
.btn.secondary{background:#2a2a2a; color:#fff}
.btn.secondary:hover{background:#343434}
.panel{
  margin-top:14px;
  background:var(--panel);
  border:1px solid #202020;
  border-radius:14px;
  padding:14px;
}
.panel-title{font-weight:1100; margin:0 0 10px}
.lyrics{white-space:pre-wrap; line-height:1.45; color:#e9e9e9}
.empty{color:var(--sub); padding:10px 0}
.hidden{display:none !important}

/* player */
.player{
  position:fixed;
  left:0; right:0; bottom:0;
  height:92px;
  background:#181818;
  border-top:1px solid var(--border);
  display:none;
  align-items:center;
  justify-content:space-between;
  padding:0 16px;
  gap:14px;
}
.player-left{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:240px;
  cursor:pointer;
}
.player-cover{width:56px;height:56px;border-radius:10px; object-fit:cover}
.player-meta{display:flex; flex-direction:column; gap:2px; max-width:320px}
.player-song{font-weight:1100; font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.player-artist{font-size:12px; color:var(--sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}

.player-center{display:flex; flex-direction:column; align-items:center; gap:8px; flex:1}
.player-controls{display:flex; align-items:center; gap:10px}
.pbtn{
  width:38px;height:38px;
  border-radius:50%;
  border:none;
  background:none;
  color:#fff;
  cursor:pointer;
}
.pbtn:hover{background:#232323}
.pbtn.play{background:#fff; color:#000}
.pbtn.play:hover{background:#eaeaea}

.progress{
  width:min(520px, 52vw);
  height:4px;
  background:#2a2a2a;
  border-radius:999px;
  overflow:hidden;
  cursor:pointer;
}
.progress>div{height:100%; width:0%; background:#fff}

.player-right{
  min-width:220px;
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
  color:var(--sub);
  font-size:12px;
}

/* Now Playing overlay */
.nowplaying{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.78);
  display:none;
  z-index:80;
}
.now-shell{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%, -50%);
  width:min(980px, 92vw);
  height:min(640px, 86vh);
  background:#121212;
  border:1px solid #1f1f1f;
  border-radius:18px;
  box-shadow: var(--shadow);
  display:flex;
  overflow:hidden;
}
.np-left{
  flex:1.1;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
  background: linear-gradient(135deg, #1a1a1a, #121212);
}
.np-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.np-title{font-weight:1100}
.np-close{
  width:38px;height:38px;
  border-radius:50%;
  border:none;
  background:#0b0b0b;
  color:#fff;
  cursor:pointer;
  display:grid;
  place-items:center;
}
.np-close:hover{background:#161616}

.np-art{
  width:min(360px, 46vw);
  max-width:420px;
  aspect-ratio:1/1;
  border-radius:16px;
  object-fit:cover;
  box-shadow: var(--shadow);
}
.np-meta{display:flex; flex-direction:column; gap:6px}
.np-song{font-size:22px; font-weight:1200}
.np-artist{color:var(--sub)}
.np-actions{display:flex; gap:10px; flex-wrap:wrap}

.np-right{
  flex:0.9;
  background:#0f0f0f;
  border-left:1px solid #1a1a1a;
  padding:18px;
  overflow:auto;
}
.queue-title{font-weight:1100; margin:0 0 10px}
.queue-item{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px;
  border-radius:12px;
  cursor:pointer;
}
.queue-item:hover{background:#161616}
.queue-item.active{background:#1f1f1f}
.qart{width:42px;height:42px;border-radius:10px; object-fit:cover}
.qmeta{display:flex; flex-direction:column; gap:2px; min-width:0}
.qname{font-weight:1000; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.qby{font-size:12px; color:var(--sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}

/* Mobile overlay */
.mobile-only{display:none}
.overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:none;
  z-index:40;
}
@media (max-width: 980px){
  .now-shell{flex-direction:column}
  .np-right{border-left:none; border-top:1px solid #1a1a1a}
  .np-art{width:min(320px, 74vw)}
}
@media (max-width: 860px){
  .sidebar{
    position:fixed;
    left:0; top:0; bottom:0;
    transform: translateX(-102%);
    z-index:50;
    width:280px;
  }
  body.sidebar-open .sidebar{transform: translateX(0)}
  body.sidebar-open .overlay{display:block}
  .mobile-only{display:inline-grid}
}

/* Auth modal */
.authmodal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.65);
  display:none;
  z-index:90;
}
.authcard{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%, -50%);
  width:min(520px, 92vw);
  background:#121212;
  border:1px solid #1f1f1f;
  border-radius:18px;
  box-shadow: var(--shadow);
  padding:16px;
}
.authhead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.authh{font-weight:1200}
.tabs{
  display:flex;
  gap:8px;
  margin-top:12px;
}
.tab{
  flex:1;
  border:none;
  border-radius:12px;
  background:#0b0b0b;
  color:#fff;
  padding:10px;
  cursor:pointer;
}
.tab.active{background:#1a1a1a}
.authmsg{
  margin-top:10px;
  color:#ffb3b3;
  font-size:13px;
  min-height: 18px;
}
.field{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:12px;
}
.field label{color:var(--sub); font-size:13px}
.field input{
  border:1px solid #2a2a2a;
  background:#0f0f0f;
  color:#fff;
  padding:12px 12px;
  border-radius:12px;
  outline:none;
}
.field input:focus{border-color:#3a3a3a}
.authfoot{
  margin-top:14px;
  display:flex;
  gap:10px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
}
