:root {
  --bg0: #06101f;
  --bg1: #0b1d3a;
  --blue: #3b82f6;
  --blue2: #1d4ed8;
  --cyan: #60a5fa;
  --text: #e8f0ff;
  --muted: #8ba3c7;
  --card: rgba(15, 40, 80, 0.45);
  --side: 240px;
  --player: 88px;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, #041018 0%, #0a2348 42%, #123a7a 72%, #1e56b0 100%);
  background-attachment: fixed;
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  grid-template-rows: 1fr auto var(--player);
  height: 100vh;
}

.sidebar {
  grid-row: 1 / -1;
  background: linear-gradient(180deg, rgba(6,16,36,.92), rgba(8,22,52,.88));
  border-right: 1px solid rgba(96,165,250,.15);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: visible;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 20px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}
.brand-logo-wrap {
  background: transparent;
}
.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  position: relative;
  z-index: 2;
  animation: veylara-pulse 2.8s ease-in-out infinite, veylara-spin-glow 8s linear infinite;
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.55)) drop-shadow(0 0 14px rgba(37, 99, 235, 0.35));
}
.brand-logo-glow {
  position: absolute;
  inset: -6px;
  border-radius: 16px;
  background: radial-gradient(circle, rgba(56,189,248,0.45) 0%, rgba(37,99,235,0.15) 45%, transparent 70%);
  z-index: 1;
  animation: veylara-glow 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes veylara-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(56,189,248,0.5)) drop-shadow(0 0 12px rgba(37,99,235,0.3)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 12px rgba(56,189,248,0.85)) drop-shadow(0 0 22px rgba(99,102,241,0.55)); }
}
@keyframes veylara-glow {
  0%, 100% { opacity: 0.55; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes veylara-spin-glow {
  0% { filter: drop-shadow(0 0 6px rgba(56,189,248,0.55)) drop-shadow(0 0 14px rgba(37,99,235,0.35)); }
  33% { filter: drop-shadow(0 0 8px rgba(99,102,241,0.65)) drop-shadow(0 0 16px rgba(56,189,248,0.4)); }
  66% { filter: drop-shadow(0 0 8px rgba(59,130,246,0.7)) drop-shadow(0 0 18px rgba(167,139,250,0.35)); }
  100% { filter: drop-shadow(0 0 6px rgba(56,189,248,0.55)) drop-shadow(0 0 14px rgba(37,99,235,0.35)); }
}
.brand h1 { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand span { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

.nav-btn {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); text-align: left;
  padding: 11px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 10px;
  transition: .18s ease;
  text-decoration: none;
}
.nav-btn:hover { background: rgba(59,130,246,.12); color: #dbeafe; }
.nav-btn.active {
  background: linear-gradient(90deg, rgba(59,130,246,.28), rgba(59,130,246,.08));
  color: #fff;
  box-shadow: inset 3px 0 0 #60a5fa;
}

/* Top-level nav roots (YouTube Music / Spotify) */
.nav-root {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); text-align: left;
  padding: 12px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; gap: 12px;
  width: 100%;
  transition: .18s ease;
}
.nav-root:hover { background: rgba(59,130,246,.12); color: #dbeafe; }
.nav-root.active,
.nav-root.open {
  background: linear-gradient(90deg, rgba(59,130,246,.28), rgba(59,130,246,.08));
  color: #fff;
  box-shadow: inset 3px 0 0 #60a5fa;
}
.nav-root[data-flyout="sp"].active,
.nav-root[data-flyout="sp"].open {
  background: linear-gradient(90deg, rgba(29,185,84,.28), rgba(29,185,84,.08));
  box-shadow: inset 3px 0 0 #1db954;
}
.nav-root-icon {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px; flex-shrink: 0;
}
.nav-root-icon.yt {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
}
.nav-root-icon.sp {
  background: linear-gradient(135deg, #1db954, #15803d);
  color: #fff;
  font-size: 10px;
}
.nav-root-label { flex: 1; }
.nav-root-arrow {
  font-size: 18px; color: var(--muted); line-height: 1;
  transition: transform .2s ease;
}
.nav-root.open .nav-root-arrow { transform: translateX(3px); color: #fff; }

.nav-extra {
  margin-top: 8px;
  opacity: .85;
}

/* Floating fly-out — floats to the right of the sidebar */
.flyout {
  position: fixed;
  top: 12px;
  left: calc(var(--side, 240px) + 10px);
  bottom: calc(var(--player, 88px) + 12px);
  width: 220px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(6,16,36,.96), rgba(8,22,52,.94));
  border: 1px solid rgba(96,165,250,.18);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  box-shadow:
    0 16px 48px rgba(0,0,0,.45),
    0 0 0 1px rgba(96,165,250,.08);
  padding: 14px 12px 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-12px);
  transition: opacity .2s ease, transform .22s ease, visibility .22s;
  pointer-events: none;
}
.flyout.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
}
.flyout-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 14px;
  border-bottom: 1px solid rgba(96,165,250,.12);
  margin-bottom: 10px;
}
.flyout-back {
  appearance: none; border: 0;
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(59,130,246,.15);
  color: #dbeafe; font-size: 20px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
  flex-shrink: 0;
  transition: .15s ease;
}
.flyout-back:hover { background: rgba(59,130,246,.3); color: #fff; }
.flyout-title {
  font-size: 14px; font-weight: 800; color: #fff; letter-spacing: .2px;
}
.flyout-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
}
.flyout-body .nav-btn {
  padding: 11px 12px;
  font-size: 13.5px;
  border-radius: 10px;
}
#flyout-sp .nav-btn.active {
  background: linear-gradient(90deg, rgba(29,185,84,.28), rgba(29,185,84,.08));
  box-shadow: inset 3px 0 0 #1db954;
}

/* Soft caret pointing back at the sidebar */
.flyout::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 48px;
  width: 12px;
  height: 12px;
  background: rgba(8,22,52,.96);
  border-left: 1px solid rgba(96,165,250,.18);
  border-bottom: 1px solid rgba(96,165,250,.18);
  transform: rotate(45deg);
}

.search-wrap { padding: 8px 8px 16px; }
.search-wrap input {
  width: 100%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(96,165,250,.2);
  color: #fff; border-radius: 999px;
  padding: 9px 14px; outline: none;
}
.search-wrap input:focus { border-color: var(--cyan); }

.sidebar-foot { margin-top: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 8px; }
.auth-btn {
  display: block; width: 100%; text-align: center;
  text-decoration: none; color: #fff; font-weight: 700;
  padding: 10px 12px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 8px 20px rgba(29,78,216,.35);
}
.auth-btn.out { background: rgba(255,255,255,.08); font-weight: 600; color: #cbd5e1; box-shadow: none; }
.auth-btn.sp-in {
  background: linear-gradient(135deg, #1db954, #15803d);
  box-shadow: 0 8px 20px rgba(29,185,84,.3);
}
.auth-btn.sp-out {
  background: rgba(29,185,84,.12);
  color: #86efac;
  border: 1px solid rgba(29,185,84,.25);
  box-shadow: none;
}
.nav-signout-sp {
  margin-top: 10px;
  color: #86efac !important;
  border: 1px solid rgba(29,185,84,.25);
}
.nav-signout-sp.connect {
  background: rgba(29,185,84,.18) !important;
  color: #bbf7d0 !important;
}
.hint { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.4; }

.main {
  overflow: auto;
  padding: 28px 36px 24px;
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: rgba(96,165,250,.35); border-radius: 8px; }

.hero {
  background: linear-gradient(120deg, rgba(37,99,235,.35), rgba(6,20,48,.2));
  border: 1px solid rgba(147,197,253,.18);
  border-radius: 20px;
  padding: 28px 32px;
  margin-bottom: 28px;
}
.hero h2 { font-size: 28px; margin-bottom: 6px; }
.hero p { color: var(--muted); }

.section-title {
  font-size: 20px; font-weight: 700; margin: 8px 0 16px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 18px;
}

.tile {
  background: var(--card);
  border: 1px solid rgba(147,197,253,.12);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
  position: relative;
}
.tile:hover { transform: translateY(-4px); background: rgba(37,99,235,.22); }
.tile img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 10px; display: block; background: #0b1a33;
}
.tile .meta { margin-top: 10px; }
.tile .t { font-size: 13px; font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .a { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-fab {
  position: absolute; right: 18px; bottom: 52px;
  width: 40px; height: 40px; border-radius: 50%;
  background: #3b82f6; color: #fff; border: 0;
  display: grid; place-items: center;
  opacity: 0; transform: translateY(6px);
  transition: .16s ease; pointer-events: none;
  box-shadow: 0 8px 18px rgba(29,78,216,.5);
}
.tile:hover .play-fab { opacity: 1; transform: none; }

.player {
  grid-column: 2;
  background: linear-gradient(90deg, rgba(8,20,44,.96), rgba(15,40,90,.92));
  border-top: 1px solid rgba(96,165,250,.2);
  display: grid;
  grid-template-columns: 280px 1fr 220px;
  align-items: center;
  padding: 0 18px;
  gap: 16px;
}

.now {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.now img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; background: #122; display: block; }
.now .nt { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .na { font-size: 12px; color: var(--muted); }

.controls { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ctrl-row { display: flex; align-items: center; gap: 14px; }
.ctrl {
  width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: transparent; color: #dbeafe; cursor: pointer; font-size: 16px;
}
.ctrl.big {
  width: 44px; height: 44px;
  background: #fff; color: #0b1d3a; font-size: 18px; font-weight: 700;
}
.bar-wrap { display: flex; align-items: center; gap: 8px; width: min(520px, 100%); }
.bar-wrap span { font-size: 11px; color: var(--muted); width: 36px; }
.bar {
  flex: 1; height: 5px; border-radius: 99px;
  background: rgba(255,255,255,.15); appearance: none; cursor: pointer;
}
.bar::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #93c5fd; }

#yt-host {
  width: 200px;
  height: 112px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  flex-shrink: 0;
}
#yt-host iframe {
  width: 200px;
  height: 112px;
  border: 0;
  display: block;
}
.tile.on {
  outline: 2px solid #60a5fa;
  box-shadow: 0 0 0 4px rgba(59,130,246,.25);
}

.status { color: var(--muted); font-size: 12px; text-align: right; }
.banner {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.35);
  color: #fecaca; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px;
}

.menu-toggle { display: none; }

@media (max-width: 720px) {
  .menu-toggle {
    display: grid;
    place-items: center;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 50;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: rgba(8,20,44,.92);
    color: #fff;
    font-size: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,.35);
  }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 96px;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    z-index: 40;
    grid-row: auto;
    box-shadow: 12px 0 40px rgba(0,0,0,.45);
  }
  .sidebar.open { transform: none; }
  #view, .main {
    grid-column: 1;
    padding-top: 56px;
  }
  .player {
    grid-column: 1;
    grid-template-columns: 1fr;
    min-height: 96px;
  }
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .now img { width: 48px; height: 48px; }
  .hero h2 { font-size: 22px; }
  .page, .artist-body, .discover { padding: 20px 16px 24px; }
  .artist-card { flex-direction: column; align-items: flex-start; }
  .avatar { width: 88px; height: 88px; }
  .lib-search { flex-direction: column; }
}


/* Lyrics above player */
.lyrics-bar {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px 4px;
  min-height: 52px;
  background: linear-gradient(180deg, rgba(8,16,36,.0), rgba(8,20,44,.92));
  border-top: 1px solid rgba(96,165,250,.12);
  pointer-events: none;
  z-index: 5;
}
.lyrics-prev, .lyrics-next {
  font-size: 12px;
  color: #64748b;
  max-width: min(720px, 90vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  opacity: 0.7;
}
.lyrics-cur {
  font-size: 15px;
  font-weight: 700;
  color: #e2e8f0;
  max-width: min(800px, 94vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  text-shadow: 0 2px 12px rgba(99, 102, 241, 0.45);
}
.lyrics-bar[hidden] { display: none !important; }

.tile, .track, .mini-card { position: relative; }
.tile.is-playing, .track.is-playing {
  outline: 2px solid #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.2);
}
.tile.is-playing.sp, .track.is-playing.sp {
  outline-color: #1db954;
  box-shadow: 0 0 0 4px rgba(29,185,84,.18);
}
.now-overlay {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(24,8,8,.12), rgba(24,4,4,.78));
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 8px; padding: 10px; pointer-events: none; z-index: 2;
}
.now-overlay .eq { display:flex; align-items:flex-end; gap:3px; height:22px; }
.now-overlay .eq i {
  width:3px; background: linear-gradient(180deg,#fecaca,#ef4444);
  border-radius:2px; animation: pulse-eq .7s ease-in-out infinite alternate;
}
.now-overlay.sp {
  background: linear-gradient(180deg, rgba(4,16,24,.15), rgba(4,16,24,.78));
}
.now-overlay.sp .eq i {
  background: linear-gradient(180deg,#86efac,#1db954);
}
.now-overlay .eq i:nth-child(2){ animation-delay:.1s; height:70%; }
.now-overlay .eq i:nth-child(3){ animation-delay:.2s; height:45%; }
.now-overlay .eq i:nth-child(4){ animation-delay:.05s; height:90%; }
.now-overlay .eq i:nth-child(5){ animation-delay:.18s; height:55%; }
.now-overlay .now-txt { font-size:11px; font-weight:800; color:#fecaca; max-width:70%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.now-overlay.sp .now-txt { color:#bbf7d0; }
.player.source-youtube .ctrl.big { background:#ef4444; color:#fff; }
.player.source-spotify .ctrl.big { background:#1db954; color:#041018; }
@keyframes pulse-eq { from { transform:scaleY(.35); } to { transform:scaleY(1); } }
.like.on, .ytlike.on, .ytlike.liked, button.like.on {
  background: #ef4444 !important;
  color: #fff !important;
}
