/* Music player. Translucent "glass" panels over the blurred cover of the current song.
   Phones: the player fills the first screen, lists below it. Wide screens: side by side. */

:root {
  --accent: #f0c27b;              /* replaced by a color taken from the album cover */
  --ink: #f4f5f8;
  --muted: rgb(244 245 248 / 0.68);
  --faint: rgb(244 245 248 / 0.14);
  --glass: rgb(18 18 26 / 0.46);
  --glass-strong: rgb(18 18 26 / 0.78);
  --line: rgb(255 255 255 / 0.1);        /* dividers inside panels */
  --edge: rgb(255 255 255 / 0.2);        /* outline of glass surfaces and buttons (same as the rest of the site) */
  --btn: rgb(255 255 255 / 0.12);
  --btn-hover: rgb(255 255 255 / 0.2);
  --radius: 24px;
  --control-h: 2.33rem;          /* buttons and toggles: the same height as the site's other buttons (37 px) */
  --empty-bg: linear-gradient(160deg, #4f5057, #222327);   /* the background when there's no picture (same on Videos) */
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* No rubber-band "bounce" past the top or bottom of the page (it showed the page's edge). */
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }

body {
  margin: 0;
  overscroll-behavior: none;
  min-height: 100svh;
  background: #101014;
  color: var(--ink);
  font: 400 1rem/1.45 "Atkinson Hyperlegible", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

svg.icon { width: 1.5rem; height: 1.5rem; display: block; flex: none; }

/* ---- Backdrop: the cover, blurred and darkened ---------------------------------- */

/* Sized to the largest screen height (lvh) so it doesn't jump when a phone's address bar slides away. */
.backdrop { position: fixed; top: 0; left: 0; right: 0; height: 100vh; height: 100lvh; z-index: -1; overflow: hidden; background: var(--empty-bg); }
.backdrop img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.25);
  filter: blur(48px) saturate(1.35) brightness(0.5);
  transition: opacity 0.6s;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}

/* ---- Top bar ---------------------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1120px; margin: 0 auto;
  padding: calc(0.6rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) 0.4rem calc(1rem + env(safe-area-inset-left));
}
.top-actions { display: flex; gap: 0.25rem; }
/* Top bar: Home, Manage and Search are round buttons with the site's button finish. */
.topbar .icon-btn { width: 44px; height: 44px; border: 1px solid var(--edge); background: var(--btn); text-decoration: none; transition: background 0.15s, border-color 0.15s; }
.topbar .icon-btn:hover { background: var(--btn-hover); border-color: rgb(255 255 255 / 0.32); }
.topbar .icon-btn svg { width: 1.3rem; height: 1.3rem; }
.top-actions { display: flex; gap: 0.5rem; }
.home svg { width: 1.25rem; height: 1.25rem; }

/* ---- Layout ------------------------------------------------------------------------ */

.layout {
  display: grid;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
  /* 20 px under the top bar's buttons, as on the other pages */
  padding: 0.85rem calc(0.75rem + env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) calc(0.75rem + env(safe-area-inset-left));
}

/* The lists are never taller than the player: on computers they end where the player ends (the
   "height: 0; min-height: 100%" pair makes the player alone decide the row's height), on phones they
   fit in one screen. Longer lists scroll inside. */
/* Grid items may shrink below their longest unbroken line (a long artist or album name is cut with …
   instead of making the whole page wider than a phone's screen). */
.layout > * { min-width: 0; }
.lists { display: flex; flex-direction: column; max-height: calc(100svh - 1.5rem); }
.lists .tracks { flex: 1; min-height: 0; overflow-y: auto; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(380px, 440px) 1fr; align-items: stretch; }
  .lists { height: 0; min-height: 100%; max-height: none; }
}

/* ---- Now playing ------------------------------------------------------------------- */

.now {
  display: flex; flex-direction: column; gap: 1rem;
  padding: 1.25rem 1.25rem 1.1rem;
  min-height: calc(100svh - 4.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  justify-content: center;
}
@media (min-width: 960px) { .now { min-height: 0; } }

.art-wrap { display: flex; justify-content: center; }
.art {
  width: min(100%, 44svh, 420px);
  aspect-ratio: 1;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.45);
}
.art-empty { display: grid; place-items: center; background: linear-gradient(135deg, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0.03)); color: var(--muted); }
.art-empty > span { display: grid; place-items: center; width: 100%; height: 100%; }   /* the note icon in the middle */
.art-empty svg { width: 30%; height: 30%; }

.meta { display: flex; align-items: center; gap: 0.75rem; }
.titles { flex: 1; min-width: 0; }
.titles h1 {
  margin: 0;
  font: 700 clamp(1.35rem, 5vw, 1.7rem)/1.15 "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  overflow-wrap: anywhere;
}
.artist { margin: 0.25rem 0 0; font-size: 1.05rem; }
.album { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.95rem; }
.artist, .album { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Artist and album under the song: buttons that look like text and open their pages */
.linkish { display: block; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }
button.album { color: var(--muted); }

/* ---- Seek bar ----------------------------------------------------------------------- */

.seek { position: relative; padding-top: 0.25rem; }
.seek input {
  --p: 0%;
  width: 100%; height: 28px; margin: 0;
  background: transparent;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
  touch-action: none;
}
.seek input::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--faint) var(--p));
}
.seek input::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--faint) var(--p));
}
.seek input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; margin-top: -5px;
  border-radius: 50%; border: 0;
  background: var(--ink);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
  transition: transform 0.12s;
}
.seek input::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%; border: 0;
  background: var(--ink);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.4);
}
.seek input:active::-webkit-slider-thumb { transform: scale(1.25); }
.seek input:disabled { cursor: default; opacity: 0.5; }

.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.seek-tip {
  position: absolute; bottom: calc(100% - 0.4rem);
  transform: translateX(-50%);
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: var(--glass-strong);
  font-size: 0.85rem; font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* ---- Buttons ------------------------------------------------------------------------- */

.icon-btn {
  display: inline-grid; place-items: center;
  width: 48px; height: 48px;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { background: rgb(255 255 255 / 0.08); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn.big svg { width: 2rem; height: 2rem; }
.icon-btn.toggle { color: var(--muted); }
.icon-btn.toggle[aria-pressed="true"], .icon-btn.toggle.on { color: var(--accent); }
.icon-btn.toggle.on::after, .icon-btn.toggle[aria-pressed="true"]::after {
  content: ""; position: absolute; width: 4px; height: 4px; margin-top: 2.2rem; border-radius: 50%; background: var(--accent);
}
.icon-btn.toggle { position: relative; }

.like[aria-pressed="true"] { color: var(--accent); }

.controls { display: flex; align-items: center; justify-content: space-between; max-width: 360px; width: 100%; margin: 0 auto; }

.play-btn {
  display: grid; place-items: center;
  width: 68px; height: 68px;
  border: 0; border-radius: 50%;
  background: var(--ink); color: #111;
  cursor: pointer;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
  transition: transform 0.12s;
}
.play-btn:active { transform: scale(0.95); }
.play-btn svg { width: 2rem; height: 2rem; }

.extras { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }

.quality { display: inline-flex; height: var(--control-h); padding: 3px; border: 1px solid var(--edge); border-radius: 999px; background: var(--btn); }
.quality button {
  height: 100%; padding: 0 0.85rem;
  border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.quality button[aria-pressed="true"] { background: var(--ink); color: #111; font-weight: 700; }

.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  height: var(--control-h); padding: 0 0.95rem; line-height: 1;
  border: 1px solid var(--edge); border-radius: 999px;
  background: var(--btn); color: var(--ink);
  font-size: 0.9rem; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.pill svg { width: 1.1rem; height: 1.1rem; }
.pill:hover { background: var(--btn-hover); border-color: rgb(255 255 255 / 0.32); }
.pill[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }

/* ---- Lists (up next, liked, recent, search results) ----------------------------------- */

.lists { padding: 0.75rem; }

.tabs { display: flex; gap: 0.25rem; padding: 0.25rem; margin-bottom: 0.25rem; }
.tabs button {
  flex: 1;
  padding: 0.6rem 0.5rem;
  border: 0; border-radius: 12px;
  background: transparent; color: var(--muted);
  font-weight: 700; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--faint); color: var(--ink); }

.list-note { margin: 0.5rem 0.75rem; color: var(--muted); font-size: 0.9rem; }
.list-note:empty { display: none; }

.tracks { margin: 0; padding: 0; list-style: none; }
.tracks li.section { padding: 0.9rem 0.75rem 0.3rem; color: var(--muted); font-size: 0.85rem; font-weight: 700; }

.track {
  display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 0.75rem;
  min-height: 60px;
  padding: 0.35rem 0.4rem 0.35rem 0.5rem;
  border-radius: 14px;
  cursor: pointer;
}
.track:hover { background: rgb(255 255 255 / 0.07); }
.track.playing { background: rgb(255 255 255 / 0.1); }
.track.playing .t { color: var(--accent); }
.track.gone { opacity: 0.45; cursor: default; }

.thumb {
  width: 48px; height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: rgb(255 255 255 / 0.08);
}
.thumb.empty { display: grid; place-items: center; color: var(--muted); }
.thumb.empty svg { width: 1.25rem; height: 1.25rem; }

.info { min-width: 0; }
.info .t, .info .s { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info .t { font-weight: 700; }
.info .s { color: var(--muted); font-size: 0.9rem; }

.track .icon-btn { width: 44px; height: 44px; color: var(--muted); }
.track .icon-btn:hover { color: var(--ink); }

/* ---- Search overlay -------------------------------------------------------------------- */

.search {
  position: fixed; inset: 0; z-index: 20;
  overflow-y: auto;
  background: rgb(10 10 14 / 0.55);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
  padding: calc(0.75rem + env(safe-area-inset-top)) calc(0.75rem + env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) calc(0.75rem + env(safe-area-inset-left));
}
.search-inner { max-width: 720px; margin: 0 auto; }
.search-bar {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.35rem 0.35rem 1rem;
  border-radius: 999px;
  background: var(--glass-strong);
}
.search-bar > span svg { color: var(--muted); }
.search-bar input {
  flex: 1; min-width: 0;
  padding: 0.6rem 0;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 1.1rem;
  outline: none;
}
.search-bar input::-webkit-search-cancel-button { display: none; }
@media (max-width: 24rem) { .search-bar input { font-size: 1rem; } }   /* small phones: the placeholder stays whole */
/* Filters: same look as the Videos search */
.filter-toggle { position: relative; }
.filter-toggle[aria-expanded="true"] { background: rgb(255 255 255 / 0.12); }
.filter-toggle .dot { position: absolute; top: 9px; right: 9px; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #9db8ff; }
.filters { margin-top: 0.75rem; padding: 0.4rem 1.1rem 1.1rem; background: var(--glass-strong); }
.filters .group { margin-top: 0.85rem; }
.filters h3 { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.9rem; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip {
  min-height: 2.25rem; padding: 0.3rem 0.9rem;
  border: 1px solid var(--edge); border-radius: 999px; background: var(--btn); color: var(--ink);
  font: 700 0.9rem/1.2 "Atkinson Hyperlegible", system-ui, sans-serif; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--btn-hover); border-color: rgb(255 255 255 / 0.32); }
.chip[aria-pressed="true"] { background: var(--ink); color: #111; border-color: rgb(255 255 255 / 0.5); }
.filters > .pill { margin-top: 1.1rem; }
#results { margin-top: 0.75rem; padding: 0.4rem; }
#results:empty { display: none; }
.more { display: flex; margin: 1rem auto 0; }

/* ---- Menu and toast --------------------------------------------------------------------- */

.menu {
  position: fixed; z-index: 30;
  min-width: 13rem; padding: 0.35rem;
  max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto;   /* phones held sideways */
  border-radius: 16px;
  background: var(--glass-strong);
}
.menu button {
  display: flex; align-items: center; gap: 0.7rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--ink);
  text-align: left; cursor: pointer;
}
.menu button:hover, .menu button:focus-visible { background: rgb(255 255 255 / 0.1); outline: none; }
.menu svg { width: 1.2rem; height: 1.2rem; color: var(--muted); }
.menu button.sep { position: relative; margin-top: 0.4rem; }
.menu button.sep::before { content: ""; position: absolute; top: -0.2rem; left: 0.8rem; right: 0.8rem; height: 1px; background: var(--line); }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); z-index: 40;
  transform: translateX(-50%);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: var(--glass-strong);
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ---- Manage library (admins) --------------------------------------------------------- */

.manage-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  border-radius: 999px;
  background: var(--glass-strong);
}
.manage-head h2, .box h3 { margin: 0; font: 700 1.25rem/1.2 "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif; }
.box { margin-top: 0.75rem; padding: 1.1rem 1.1rem 1.2rem; }
.box h3 { margin-bottom: 0.75rem; }
.box h4 { margin: 1.25rem 0 0.4rem; font-size: 0.95rem; color: var(--muted); }
.hint { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.9rem; }

.drop {
  display: grid; justify-items: center; gap: 0.35rem;
  padding: 1.4rem 1rem;
  border: 2px dashed rgb(255 255 255 / 0.25); border-radius: 18px;
  text-align: center; cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgb(255 255 255 / 0.05); }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop svg { width: 2rem; height: 2rem; color: var(--muted); }
.drop small { max-width: 34rem; color: var(--muted); }

.uploads { margin: 0.75rem 0 0; padding: 0; list-style: none; }
.uploads li { padding: 0.55rem 0.25rem; border-top: 1px solid var(--line); }
.uploads li:first-child { border-top: 0; }
.uploads .name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.uploads .state { display: block; color: var(--muted); font-size: 0.9rem; }
.uploads .error .state { color: #ff9b8f; }
.uploads .done .state { color: #9be39a; }
.bar { height: 4px; margin: 0.35rem 0 0.2rem; border-radius: 2px; background: var(--faint); overflow: hidden; }
.bar span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 0.2s; }

.lib-status { margin: 0 0 0.85rem; }
.activity { margin: 0; padding: 0; list-style: none; font-size: 0.92rem; }
.activity li { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem; padding: 0.35rem 0; border-top: 1px solid var(--line); }
.activity li:first-child { border-top: 0; }
.activity time { color: var(--muted); font-variant-numeric: tabular-nums; }
.activity .error span { color: #ff9b8f; }
.activity .empty { display: block; color: var(--muted); }

.track .pill { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* The language button (FR / EN) */
.lang-btn { font: 700 0.85rem/1 "Atkinson Hyperlegible", system-ui, sans-serif; letter-spacing: 0.03em; text-decoration: none; color: var(--ink); }

/* The page's title, between the Home button and the icons (as on the other pages). */
.topbar .top-title {
  flex: 1; min-width: 0; margin: 0 0.5rem 0 1rem;   /* 16 px from Home, as on the other pages */
  font: 700 1.45rem/1.2 "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 30rem) { .topbar .top-title { font-size: 1.15rem; } }

/* ---- Albums and artists ------------------------------------------------------------------ */
.quality button:disabled { opacity: 0.4; cursor: not-allowed; }       /* no data saver copy of this song */
.detail { z-index: 25; }                                               /* above the search, below the menu */
.detail .manage-head { gap: 0.5rem; padding-left: 0.5rem; }
.detail .manage-head h2 { flex: 1; margin: 0 0 0 0.6rem; }
#detail-back:not([hidden]) + h2 { margin-left: 0; }
#detail-body { padding: 1.1rem; }
.detail-top { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: center; margin-bottom: 1rem; }
.detail-pic { display: grid; place-items: center; width: 9.5rem; aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: rgb(255 255 255 / 0.08); color: var(--muted); box-shadow: 0 12px 30px rgb(0 0 0 / 0.4); }
.detail-pic.round { border-radius: 50%; }
.detail-pic img { width: 100%; height: 100%; object-fit: cover; }
.detail-pic svg { width: 40%; height: 40%; }
.detail-info { min-width: 0; }
.detail-info h3 { margin: 0; font: 700 1.45rem/1.15 "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif; overflow-wrap: anywhere; }
.detail-artist { margin-top: 0.2rem; font-size: 1.05rem; }
.detail-meta { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.92rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.85rem; }
.pill.primary { background: var(--ink); color: #111; border-color: rgb(255 255 255 / 0.5); }
.pill.primary:hover { background: #fff; }
@media (max-width: 30rem) {
  .detail-top { grid-template-columns: 1fr; justify-items: start; }
  .detail-pic { width: min(14rem, 70%); }
}
.thumb.num { display: grid; place-items: center; background: none; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Small cards: albums / artists in search results and on an artist's page */
.cards-row { display: grid; grid-auto-flow: column; grid-auto-columns: 8.5rem; gap: 0.75rem; overflow-x: auto; margin-top: 0.75rem; padding: 0.1rem 0.1rem 0.4rem; }
.cards-row:empty { display: none; }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.9rem; }
.mini-card { display: grid; gap: 0.15rem; min-width: 0; padding: 0.45rem; border: 0; border-radius: 14px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.mini-card:hover { background: rgb(255 255 255 / 0.08); }
.mini-card .pic { display: grid; place-items: center; width: 100%; aspect-ratio: 1; margin-bottom: 0.35rem; overflow: hidden; border-radius: 10px; object-fit: cover; background: rgb(255 255 255 / 0.08); color: var(--muted); }
.mini-card.kind-artist .pic { border-radius: 50%; }
.mini-card .pic svg { width: 40%; height: 40%; }
.mini-card .t, .mini-card .s { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-card .t { font-weight: 700; }
.mini-card .s { color: var(--muted); font-size: 0.85rem; }

/* Log in (visitors) in the top bar: a 44 px pill like on every other page */
.topbar .top-pill { height: 44px; padding: 0 1.15rem; }
