/* app frame: scroll area, the floating dock (bottom on phones, a side panel on desktop), the mini player capsule, splash */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; }
#main { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding-bottom: calc(var(--nav-h) + var(--mini-h) + var(--safe-b) + 44px); scroll-behavior: auto; }
#view { max-width: 1240px; margin-inline: auto; min-height: 100%; }
.page { padding: calc(var(--safe-t) + 18px) 16px 8px; }

/* top bar for sub pages (artist, album, playlist) */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 8px) 10px 8px; transition: background .25s, box-shadow .25s; }
.topbar.solid { background: rgba(21, 20, 29, .86); box-shadow: 0 1px 0 var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.topbar .tb-title { font: 600 16px var(--kufi); opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .3s var(--ease); }
.topbar.solid .tb-title { opacity: 1; transform: none; }

/* the dock: a floating capsule; a soft gradient "ink" slides to the active tab and its label opens */
#nav { position: fixed; z-index: 40; inset-inline: 12px; bottom: calc(var(--safe-b) + 10px); height: var(--nav-h);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px; border-radius: 24px;
  background: rgba(33, 31, 45, .8); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 14px 34px rgba(8, 6, 16, .5), inset 0 0 0 1px var(--line); }
#nav .nv { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 18px;
  color: var(--mute); font-size: 12.5px; font-weight: 600; transition: color .3s; }
#nav .nv span { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; transition: max-width .45s var(--ease), opacity .3s; }
#nav .nv.on { color: var(--sun-ink); background-color: var(--sun); background-image: linear-gradient(135deg, var(--sun), #E3B9F0 55%, var(--ember));
  animation: nvfill .5s both; } /* the tab fills once the sliding ink has arrived */
@keyframes nvfill { 0%, 99% { background-color: transparent; background-image: none; } }
#nav .nv.on span { max-width: 80px; opacity: 1; }
#nav .nv:not(.on):hover { color: var(--txt); }
#nav .nv svg { transition: transform .3s var(--spring); }
#nav .nv:active svg { transform: scale(.82); }
#nav .nv.on svg { transform: scale(1.06); }
.nv-ink { position: absolute; z-index: 0; top: 0; left: 0; width: 0; height: 0; border-radius: 18px; pointer-events: none;
  background: linear-gradient(135deg, var(--sun), #E3B9F0 55%, var(--ember)); box-shadow: 0 6px 18px rgba(184, 166, 255, .35);
  transition: transform .55s var(--spring), opacity .3s; opacity: 0; }
.nv-ink.ready { opacity: 1; }
#nav .brand { display: none; }

/* mini player capsule: the cover spins like a record inside a progress ring */
#mini { position: fixed; z-index: 39; inset-inline: 12px; bottom: calc(var(--safe-b) + 18px + var(--nav-h)); height: var(--mini-h);
  display: flex; align-items: center; gap: 10px; padding: 6px; padding-inline-end: 6px; border-radius: 22px; overflow: hidden;
  background: rgba(33, 31, 45, .86); background: color-mix(in srgb, rgb(var(--tint)) 10%, rgba(33, 31, 45, .92));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 10px 30px rgba(8, 6, 16, .45), inset 0 0 0 1px var(--line);
  transition: transform .5s var(--spring), opacity .3s; }
#mini.off { transform: translateY(160%) scale(.9); opacity: 0; pointer-events: none; }
#mini .mi-disc { position: relative; width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
#mini .mi-disc img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--s2); animation: spin 9s linear infinite; animation-play-state: paused; box-shadow: 0 0 0 3px rgba(21, 20, 29, .9); }
#mini .mi-disc::after { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
#mini.playing .mi-disc img { animation-play-state: running; }
#mini .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
#mini .ring circle { fill: none; stroke-width: 3; stroke-linecap: round; }
#mini .ring .bg { stroke: rgba(255, 255, 255, .1); }
#mini .ring .fg { stroke: url(#miniGrad); stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .5s linear; }
#mini .mi-t { flex: 1; min-width: 0; cursor: pointer; }
#mini .mi-t b, #mini .mi-t span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini .mi-t b { font-weight: 600; font-size: 14px; }
#mini .mi-t span { font-size: 12.5px; color: var(--sub); }
#mini [data-pp] { background: var(--txt); color: var(--bg); width: 42px; height: 42px; }
#mini [data-pp]:hover { background: #fff; }

/* phones: the tabs are a solid bar along the whole bottom edge, like a music app - icon over its label, the
   active one in the accent colour; the mini player rides just above it */
@media (max-width: 959px) {
  /* only a sliver of the home-indicator area is kept under the labels, so no empty band hangs below the tabs */
  :root { --dock-b: calc(var(--safe-b) * .3); --nav-h: 58px; }
  #nav { inset-inline: 0; bottom: 0; height: calc(var(--nav-h) + var(--dock-b)); padding: 0 4px var(--dock-b); border-radius: 0;
    background: rgba(20, 19, 28, .96); box-shadow: 0 -1px 0 var(--line); }
  #nav .nv { flex-direction: column; gap: 4px; border-radius: 0; font-size: 11px; font-weight: 600; }
  #nav .nv span, #nav .nv.on span { max-width: none; opacity: 1; }
  #nav .nv.on { color: var(--sun); background: none; animation: none; }
  #nav .nv.on svg { transform: scale(1.1); }
  .nv-ink { display: none; }
  #mini { bottom: calc(var(--dock-b) + var(--nav-h) + 8px); }
  #main { padding-bottom: calc(var(--nav-h) + var(--mini-h) + var(--dock-b) + 32px); }
}


#offline { position: fixed; top: calc(var(--safe-t) + 8px); inset-inline: 0; margin-inline: auto; width: max-content; z-index: 60;
  padding: 6px 14px; border-radius: 99px; background: var(--pb); color: var(--ink); font-size: 12.5px; font-weight: 500; display: flex; gap: 6px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.35); }

/* YouTube's player for songs with no copy on the server: never seen, never touched, always behind the app */
#ytHost { position: fixed; left: 0; bottom: 0; width: 200px; height: 200px; opacity: 0 !important; pointer-events: none !important; z-index: -1; overflow: hidden; }
#ytHost iframe { pointer-events: none; }
/* the play button asks for a press when the browser held the sound back */
.mini.ask [data-pp], [data-pp].ask { animation: askp 1.4s var(--ease) infinite; }
@keyframes askp { 50% { box-shadow: 0 0 0 10px rgba(var(--tint), .0), 0 0 0 0 rgba(var(--tint), .45); transform: scale(1.08); } }

/* desktop: the dock becomes a floating side panel on the start side, the player a capsule along the bottom */
@media (min-width: 960px) {
  #app { flex-direction: row; }
  #nav { position: relative; inset: auto; bottom: auto; margin: 14px; margin-inline-end: 0; width: 236px; height: calc(100% - 28px); flex: none;
    display: flex; flex-direction: column; gap: 6px; padding: 22px 12px; border-radius: 28px; background: rgba(33, 31, 45, .7); }
  #nav .brand { display: flex; justify-content: center; padding: 0 10px 18px; }
  #nav .brand .logo { width: 120px; height: auto; filter: drop-shadow(0 8px 22px rgba(170, 60, 255, .28)); }
  #nav .nv { justify-content: flex-start; gap: 14px; height: 50px; flex: none; padding: 0 16px; font-size: 15px; }
  #nav .nv span, #nav .nv.on span { max-width: none; opacity: 1; }
  #nav .nv:not(.on):hover { background: rgba(255, 255, 255, .04); }
  #main { padding-bottom: calc(var(--mini-h) + 48px); }
  .page { padding: 28px 32px 8px; }
  #mini { inset-inline: 264px 16px; bottom: 14px; height: 76px; padding: 8px 10px; }
  #mini .mi-disc { width: 60px; height: 60px; }
  #mini .mi-disc img { width: 50px; height: 50px; }
}
