/* ===== app shell ===== */
.app { display: flex; flex-direction: column; height: 100vh; }
.app__body {
  flex: 1; min-height: 0;
  display: flex; gap: 8px;
  padding: 8px 8px 0 8px;
}

/* ===== left sidebar ===== */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w-min); max-width: 420px;
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
  transition: width .2s var(--ease-out), min-width .2s var(--ease-out);
}
.sidebar.collapsed { width: 72px; min-width: 72px; }
.sidebar__nav, .sidebar__lib {
  background: var(--bg-panel); border-radius: var(--panel-radius);
}
.sidebar__nav { padding: 8px 12px; }
.sidebar__nav-logo { display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px; color: #fff; }
.sidebar__nav-logo svg { width: 32px; height: 32px; }
.sidebar__nav-logo span { font-weight: 700; font-size: 22px; letter-spacing: -0.04em; }
.sidebar__nav-item {
  display: flex; align-items: center; gap: 20px;
  width: 100%; padding: 10px 12px; border-radius: 6px;
  font-size: 16px; font-weight: 700; color: var(--text-subdued);
  transition: color .15s;
  text-align: left;
}
.sidebar__nav-item svg { width: 24px; height: 24px; flex-shrink: 0; }
.sidebar__nav-item:hover { color: var(--text-base); }
.sidebar__nav-item.active { color: var(--text-base); }
.sidebar.collapsed .sidebar__nav { display: none; }

.sidebar__lib { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.lib__head { display: flex; align-items: center; padding: 10px 16px 4px; gap: 8px; }
.lib__title {
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; font-weight: 700; color: var(--text-subdued);
  padding: 6px 8px; border-radius: 6px; transition: color .15s;
}
.lib__title svg { width: 24px; height: 24px; }
.lib__title:hover { color: var(--text-base); }
.lib__head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  color: var(--text-subdued); transition: color .15s, background-color .15s, transform .1s;
  position: relative; flex-shrink: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text-base); background: hsla(0,0%,100%,.1); }
.icon-btn:active { transform: scale(.94); }
.icon-btn:disabled { color: #5a5a5a; cursor: not-allowed; background: none; transform: none; }
.icon-btn--lg { width: 40px; height: 40px; }
.icon-btn--lg svg { width: 20px; height: 20px; }

.lib__chips { display: flex; gap: 8px; padding: 8px 16px; overflow: hidden; }
.chip {
  background: var(--bg-highlight); color: var(--text-base);
  font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 9999px;
  white-space: nowrap; transition: background-color .15s; flex-shrink: 0;
}
.chip:hover { background: #353535; }
.chip.active { background: var(--text-base); color: #000; }
.lib__tools { display: flex; align-items: center; padding: 2px 8px 2px 16px; gap: 4px; min-height: 36px; }
.lib__search { flex: 1; min-width: 0; }
.lib__search-input {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-highlight); border-radius: 4px; padding: 6px 10px;
  animation: popin .12s var(--ease-out);
}
.lib__search-input svg { width: 14px; height: 14px; color: var(--text-subdued); flex-shrink: 0; }
.lib__search-input input {
  background: none; border: 0; outline: 0; color: var(--text-base);
  font-size: 12.5px; width: 100%; min-width: 0;
}
.lib__sort {
  display: flex; align-items: center; gap: 6px; color: var(--text-subdued);
  font-size: 13.5px; font-weight: 500; padding: 6px 8px; border-radius: 4px; white-space: nowrap;
}
.lib__sort:hover { color: var(--text-base); }
.lib__sort svg { width: 16px; height: 16px; }

.lib__list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }
.lib-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px; border-radius: 6px; text-align: left;
  transition: background-color .1s;
  position: relative;
}
.lib-item:hover { background: var(--bg-elevated); }
.lib-item.active { background: var(--bg-highlight); }
.lib-item__img { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; flex-shrink: 0; background: #282828; }
.lib-item__img.round { border-radius: 50%; }
.lib-item__meta { min-width: 0; flex: 1; }
.lib-item__name { font-size: 15px; font-weight: 500; color: var(--text-base); }
.lib-item__name.playing { color: var(--accent); }
.lib-item__sub { font-size: 13.5px; color: var(--text-subdued); display: flex; align-items: center; gap: 5px; }
.lib-item__sub svg { width: 12px; height: 12px; color: var(--accent); flex-shrink: 0; }
.lib-item__badge { color: var(--text-dim); }
.lib-item__badge svg { width: 14px; height: 14px; }
.lib__empty { padding: 24px 20px; color: var(--text-subdued); font-size: 13.5px; }

/* collapsed rail */
.rail { display: none; }
.sidebar.collapsed .rail { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--bg-panel); border-radius: var(--panel-radius); padding: 8px 0; flex: 1; overflow-y: auto; scrollbar-width: none; }
.sidebar.collapsed .rail::-webkit-scrollbar { display: none; }
.rail__btn { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; padding: 10px 0; border-radius: 6px; color: var(--text-subdued); font-size: 10px; font-weight: 600; }
.rail__btn svg { width: 24px; height: 24px; }
.rail__btn:hover { color: #fff; background: var(--bg-elevated); }
.rail__btn.active { color: #fff; }
.rail__img { width: 48px; height: 48px; border-radius: 4px; margin: 4px 0; object-fit: cover; cursor: pointer; }
.rail__img.round { border-radius: 50%; }

/* ===== main view ===== */
.main-view {
  flex: 1; min-width: 0; position: relative;
  background: var(--bg-panel); border-radius: var(--panel-radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  transition: background-color .25s;
  border-radius: var(--panel-radius) var(--panel-radius) 0 0;
}
.topbar__nav { display: flex; gap: 8px; }
.topbar__nav .icon-btn { background: rgba(0,0,0,.7); color: #fff; width: 32px; height: 32px; }
.topbar__nav .icon-btn:hover:not(:disabled) { background: rgba(0,0,0,.85); transform: scale(1.04); }
.topbar__nav .icon-btn:disabled { color: #727272; background: rgba(0,0,0,.35); }
.topbar__nav .icon-btn svg { width: 16px; height: 16px; }
.topbar__middle { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topbar__home-btn { display: none; }
.topbar__search {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-elevated); border-radius: 9999px;
  height: 48px; padding: 0 14px; width: 364px; max-width: 100%;
  border: 1px solid transparent; transition: border-color .15s, background-color .15s;
  color: var(--text-subdued);
}
.topbar__search:hover { background: #2a2a2a; border-color: var(--border-subtle); }
.topbar__search:focus-within { border-color: #fff; background: #2a2a2a; }
.topbar__search svg { width: 18px; height: 18px; flex-shrink: 0; }
.topbar__search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font-size: 14px; }
.topbar__search input::placeholder { color: var(--text-subdued); }
.topbar__search .icon-btn { width: 28px; height: 28px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--text-base); color: #000; font-weight: 700; font-size: 14px;
  height: 32px; padding: 0 16px; border-radius: 9999px;
  transition: transform .1s, background-color .15s;
  white-space: nowrap;
}
.pill-btn:hover { transform: scale(1.04); }
.pill-btn--ghost { background: transparent; color: var(--text-subdued); }
.pill-btn--ghost:hover { color: var(--text-base); }
.pill-btn svg { width: 16px; height: 16px; }
.user-btn { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0; transition: transform .1s; position: relative; }
.user-btn:hover { transform: scale(1.06); }
.user-btn img { width: 100%; height: 100%; object-fit: cover; }

.main-view__scroll { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.main-view__content { min-height: 60vh; }

/* ===== right bar ===== */
.rightbar[hidden] { display: none; }
.rightbar {
  width: var(--rightbar-w); flex-shrink: 0;
  background: var(--bg-panel); border-radius: var(--panel-radius);
  display: flex; flex-direction: column; overflow: hidden;
}
.rightbar__head { display: flex; align-items: center; padding: 14px 16px 8px; gap: 8px; }
.rightbar__title { font-size: 16px; font-weight: 700; }
.rightbar__tabs { display: flex; gap: 8px; padding: 0 16px 8px; }
.rightbar__scroll { flex: 1; overflow-y: auto; padding: 8px 16px 16px; }
.rp-art { width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.rp-track { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.rp-track__meta { flex: 1; min-width: 0; }
.rp-track__title { font-size: 18px; font-weight: 700; }
.rp-track__title.playing { color: #fff; }
.rp-track__artist { color: var(--text-subdued); font-size: 14px; }
.rp-track__artist:hover { color: #fff; text-decoration: underline; }
.rp-card { background: var(--bg-elevated); border-radius: 8px; overflow: hidden; margin-top: 16px; }
.rp-card__img { width: 100%; height: 180px; object-fit: cover; }
.rp-card__body { padding: 16px; }
.rp-card__title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.rp-card__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-card__listeners { color: var(--text-subdued); font-size: 13px; }
.rp-card__bio { color: var(--text-subdued); font-size: 13px; margin-top: 10px; line-height: 1.6; }
.rp-credits { margin-top: 16px; }
.rp-credits__row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); font-size: 13.5px; }
.rp-credits__row:last-child { border-bottom: 0; }
.rp-credits__role { color: var(--text-subdued); }
.rp-queue-head { font-size: 14px; font-weight: 700; color: var(--text-subdued); margin: 18px 0 6px; }

/* ===== now playing bar ===== */
.now-playing {
  height: var(--np-height); flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 12px;
}
.np__left { display: flex; align-items: center; gap: 12px; width: 30%; min-width: 180px; }
.np__art-wrap { position: relative; width: 56px; height: 56px; flex-shrink: 0; }
.np__art { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.np__expand {
  position: absolute; right: 4px; top: 4px; width: 24px; height: 24px;
  border-radius: 50%; background: rgba(0,0,0,.7); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, transform .15s;
}
.np__expand svg { width: 14px; height: 14px; }
.np__art-wrap:hover .np__expand { opacity: 1; }
.np__expand:hover { transform: scale(1.08); }
.np__meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.np__title { font-size: 14px; font-weight: 500; color: #fff; }
.np__title:hover { text-decoration: underline; cursor: pointer; }
.np__artist { font-size: 12.5px; color: var(--text-subdued); }
.np__artist:hover { color: #fff; text-decoration: underline; cursor: pointer; }
.np__left .heart-btn { flex-shrink: 0; }

.np__center { flex: 1; max-width: 722px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.np__controls { display: flex; align-items: center; gap: 20px; }
.np__play {
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; color: #000;
  display: flex; align-items: center; justify-content: center;
  transition: transform .1s, background-color .15s;
  flex-shrink: 0;
}
.np__play svg { width: 16px; height: 16px; }
.np__play:hover { transform: scale(1.06); }
.np__play:active { transform: scale(1); background: #b3b3b3; }
.ctl-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-subdued); transition: color .15s, transform .1s;
  position: relative; flex-shrink: 0;
}
.ctl-btn svg { width: 16px; height: 16px; }
.ctl-btn:hover:not(:disabled) { color: #fff; }
.ctl-btn:active:not(:disabled) { transform: scale(.94); color: var(--text-subdued); }
.ctl-btn:disabled { color: #4d4d4d; cursor: not-allowed; }
.ctl-btn.active { color: var(--accent); }
.ctl-btn.active:hover { color: var(--accent-bright); }
.ctl-btn.active::after {
  content: ""; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
}
.ctl-btn .badge1 {
  position: absolute; top: 3px; right: 3px; font-size: 8px; font-weight: 800; color: var(--accent);
  pointer-events: none;
}

.np__seek { display: flex; align-items: center; gap: 8px; width: 100%; }
.np__time { font-size: 11px; color: var(--text-subdued); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }
.np__time:first-child { text-align: right; }

.slider {
  --val: 0%;
  --fill: #fff;
  flex: 1; height: 12px; display: flex; align-items: center; cursor: pointer;
  touch-action: none; position: relative;
}
.slider__track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: hsla(0,0%,100%,.3); }
.slider__fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: var(--val);
  background: var(--fill); border-radius: 2px;
}
.slider__thumb {
  position: absolute; top: 50%; left: var(--val); transform: translate(-50%, -50%);
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  opacity: 0; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  transition: opacity .1s;
  pointer-events: none;
}
.slider:hover, .slider.dragging { --fill: var(--accent); }
.slider:hover .slider__thumb, .slider.dragging .slider__thumb { opacity: 1; }

.np__right { display: flex; align-items: center; gap: 2px; width: 30%; min-width: 180px; justify-content: flex-end; }
.np__vol { display: flex; align-items: center; width: 125px; }
.np__vol .slider { height: 12px; }

/* footer inside main view */
.footer { padding: 40px 32px 32px; }
.footer__cols { display: flex; gap: 60px; flex-wrap: wrap; }
.footer__col { display: flex; flex-direction: column; gap: 8px; min-width: 140px; }
.footer__col h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.footer__col a, .footer__col span { color: var(--text-subdued); font-size: 13.5px; }
.footer__col a:hover { color: #fff; text-decoration: underline; }
.footer__bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-subtle); color: var(--text-dim); font-size: 12.5px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
