/* Nocturne — the pogmusic interface.
 *
 * Ported from the Nocturne design (claude.ai/design). The mockup carried its
 * styling as inline attributes plus a `style-hover` extension its preview
 * runtime understood; both become ordinary rules here, so the interface works
 * with no framework and no build step.
 */

@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('vendor/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('vendor/manrope-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The palette is the design's, to the value. Both themes are defined here and
 * swapped by a data-theme attribute on <html>, so a theme change is one
 * attribute write rather than a re-render. */
:root {
  --bg: #0b0b0f;
  --bg2: #131318;
  --bg3: #1c1c24;
  --text: #f4f4f8;
  --text2: #a0a0b2;
  --line: rgba(255, 255, 255, 0.08);
  --acc: #7c5cff;
  --acc2: #9b82ff;
  --shadow-cover: 0 14px 30px rgba(0, 0, 0, 0.38);
  --radius: 12px;

  /* The four safe-area insets, declared once and globally.
   *
   * index.html asks for viewport-fit=cover and a translucent status bar, so the
   * page deliberately extends under the notch, the Dynamic Island and the home
   * indicator. That is the right choice — it is what makes this look like an
   * app rather than a page — but it is a promise to compensate, and only the
   * bottom was being honoured. Anything fixed or sticky against an edge owes
   * these.
   *
   * Zero on every device without them, so the calc()s below cost nothing on a
   * desktop. */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  /* ------------------------------------------------------------ motion --
   *
   * Four curves and three durations, used everywhere.
   *
   * Everything here was `ease` before, which is the browser default: a
   * symmetric curve that leaves slowly. It reads as sluggish on an entrance
   * and mushy on a press, and using one curve for both means nothing feels
   * deliberate. A small shared vocabulary is most of what separates motion
   * that feels designed from motion that was merely added.
   */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);      /* things arriving */
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);       /* things leaving */
  --ease-both: cubic-bezier(0.65, 0, 0.35, 1);     /* things moving in place */
  --ease-spring: cubic-bezier(0.34, 1.42, 0.64, 1); /* release of a press */

  /* ------------------------------------------------------------ spacing --
   *
   * A four-pixel scale, because there was none: thirty-six distinct values
   * between 1px and 124px, including 7, 9, 11 and 13. Every one had been
   * chosen on its own, which is why nothing lined up — two panels meant to
   * match were 13px and 14px apart and looked it.
   *
   * The names are sizes, not places. A distance called --s-3 can be a margin
   * here and a padding there and still be the same distance, which is the
   * whole point of a scale.
   */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 64px;

  /* Density multiplies the whole scale at once, which is only possible now
   * that there is a scale. Cover sizes ride along, so "compact" is a genuinely
   * denser screen rather than the same layout with thinner gaps. */
  --density: 1;
  --cover-lg: 148px;
  --cover-hero: 210px;
  --t-fast: 130ms;
  --t-mid: 220ms;
  --t-slow: 400ms;

  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #fafafc;
  --bg2: #ffffff;
  --bg3: #efeff5;
  --text: #141420;
  --text2: #6b6b7e;
  --line: rgba(20, 20, 32, 0.09);
  --shadow-cover: 0 14px 30px rgba(20, 20, 40, 0.16);
  color-scheme: light;
}

/* Compact fits more on screen, wide gives it room to breathe. Applied on the
 * root so every distance derived from the scale follows at once — and the
 * player is deliberately left out of it, since its layout is a composition
 * rather than a list. */
:root[data-density='compact'] {
  --s-1: 3px;  --s-2: 6px;   --s-3: 9px;   --s-4: 12px;  --s-5: 14px;
  --s-6: 18px; --s-7: 24px;  --s-8: 30px;  --s-9: 36px;  --s-10: 48px;
  --cover-lg: 116px;
  --cover-hero: 168px;
}
:root[data-density='wide'] {
  --s-1: 5px;  --s-2: 10px;  --s-3: 15px;  --s-4: 20px;  --s-5: 26px;
  --s-6: 32px; --s-7: 42px;  --s-8: 52px;  --s-9: 64px;  --s-10: 84px;
  --cover-lg: 184px;
  --cover-hero: 260px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  /* The wash behind everything, from the design's rootStyle. */
  background: radial-gradient(1100px 520px at 78% -8%, color-mix(in srgb, var(--acc) 16%, transparent), transparent 60%), var(--bg);
  overflow: hidden;
}

a { color: var(--acc2); text-decoration: none; }
a:hover { color: color-mix(in srgb, var(--acc2) 75%, white); }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(128, 128, 150, 0.3); border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------- animations -- */

@keyframes eq1 { 0%, 100% { height: 6px } 50% { height: 14px } }
@keyframes eq2 { 0%, 100% { height: 12px } 50% { height: 5px } }
@keyframes eq3 { 0%, 100% { height: 8px } 50% { height: 15px } }
@keyframes drift1 {
  0% { transform: translate(-8%, -6%) scale(1) }
  100% { transform: translate(10%, 8%) scale(1.15) }
}
@keyframes drift2 {
  0% { transform: translate(6%, 10%) scale(1.1) }
  100% { transform: translate(-10%, -8%) scale(0.95) }
}
@keyframes coverFloat { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes coverPulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.02) } }
@keyframes coverSway {
  0%, 100% { transform: rotate(-1.2deg) translateY(0) }
  50% { transform: rotate(1.2deg) translateY(-8px) }
}
@keyframes coverPerspective {
  0%, 100% { transform: perspective(1050px) rotateX(-1deg) rotateY(9deg) rotateZ(0.65deg) translateX(-2px) }
  50% { transform: perspective(1050px) rotateX(-0.35deg) rotateY(12deg) rotateZ(0.15deg) translateX(2px) }
}
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px) }
  to { opacity: 1; transform: none }
}
/* A shorter rise for list items, which arrive in numbers: 12px each would
 * read as the whole page sliding. */
@keyframes itemIn {
  from { opacity: 0; transform: translateY(7px) }
  to { opacity: 1; transform: none }
}
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(26px) scale(0.985) }
  to { opacity: 1; transform: none }
}
@keyframes sheetOut {
  from { opacity: 1; transform: none }
  to { opacity: 0; transform: translateY(16px) scale(0.99) }
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 14px) }
  to { opacity: 1; transform: translate(-50%, 0) }
}
@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0) }
  to { opacity: 0; transform: translate(-50%, 10px) }
}

/* The design leans on motion for its identity, but none of it carries
 * meaning — so all of it goes when the reader has asked for less. */
/* The listener's own choice, alongside the operating system's.
 *
 * Same rule, two triggers: the system setting is an accessibility preference
 * and is honoured as a floor, and this one is the in-app switch for someone
 * whose machine is fine but whose laptop is not. */
:root[data-motion='none'] *,
:root[data-motion='none'] *::before,
:root[data-motion='none'] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* -------------------------------------------------------------- réglages -- */
.set-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-6);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.set-row:last-child { border-bottom: 0; }
.set-label { min-width: 180px; flex: 1; }
.set-label .t { font-size: 14px; font-weight: 650; }
.set-label .s { font-size: 12.5px; color: var(--text2); margin-top: var(--s-1); line-height: 1.5; }
.set-note { font-size: 12.5px; color: var(--text2); margin: -6px 0 var(--s-1); }

.set-choices { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.set-choice {
  padding: var(--s-2) var(--s-3);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  text-align: left;
  min-width: 108px;
  transition: border-color var(--t-mid) var(--ease-both),
              color var(--t-mid) var(--ease-both),
              background-color var(--t-mid) var(--ease-both);
}
.set-choice:hover { color: var(--text); }
.set-choice[aria-checked='true'] {
  border-color: var(--acc);
  background: color-mix(in srgb, var(--acc) 14%, transparent);
  color: var(--text);
}
.set-choice-t { font-size: 13px; font-weight: 650; }
.set-choice-s { font-size: 11.5px; color: var(--text2); margin-top: 2px; }

.set-inline { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.set-inline input {
  padding: var(--s-2) var(--s-3);
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.set-inline input:focus { border-color: color-mix(in srgb, var(--acc) 60%, var(--line)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------------- shell -- */

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

.shell { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--bg2) 82%, transparent);
  backdrop-filter: blur(22px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: var(--s-5) var(--s-3);
  gap: var(--s-1);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3) var(--s-5);
}
.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  /* The in-app mark is the bare symbol on transparency: no tile, no radius to
   * round, and nothing to clip. It sits directly on the sidebar the way the
   * icons beneath it do — the boxed version is for the home screen, where the
   * platform draws the container and the artwork has to fill it.
   *
   * A hair larger than the tiled icon it replaces: a shape floating free reads
   * smaller than a filled square of the same box. */
  object-fit: contain;
}
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text2);
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item[aria-current='page'] { font-weight: 800; color: var(--text); background: var(--bg3); }
.nav-item svg { flex-shrink: 0; }

.side-label {
  margin-top: var(--s-6);
  padding: 0 var(--s-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text2);
  text-transform: uppercase;
}
.side-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--s-2);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.side-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: 9px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.side-row:hover { background: var(--bg3); }
.side-row .cover { width: 34px; height: 34px; border-radius: 7px; flex-shrink: 0; }
.side-row .t { font-size: 13.5px; font-weight: 600; }
.side-row .s { font-size: 11.5px; color: var(--text2); }
.side-empty { padding: var(--s-2) var(--s-3); font-size: 12.5px; color: var(--text2); line-height: 1.5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: transparent; }

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-6);
  flex-shrink: 0;
}
/* Only where it is sticky. A transparent bar over scrolling content shows the
 * rows sliding through the search field, which is the one thing a sticky
 * header must not do. */
.topbar.stuck {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.round-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
  flex-shrink: 0;
}
.round-btn:hover:not(:disabled) { color: var(--text); }
.round-btn:disabled { opacity: 0.4; cursor: default; }
.round-btn.lg { width: 34px; height: 34px; border: 1px solid var(--line); }

.nav-arrows { display: flex; gap: var(--s-2); }
.topbar-spacer { flex: 1; }

.searchbox {
  flex: 1;
  /* A flex item defaults to min-width:auto, which is its content width — and
   * an <input> reports a content width of about twenty characters. Without
   * this the search field refuses to shrink and pushes the whole topbar past
   * the viewport on a narrow window. */
  min-width: 0;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: var(--s-2) var(--s-4);
  color: var(--text);
  font-size: 13.5px;
}
.searchbox svg { flex-shrink: 0; color: var(--text2); }
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  outline: none;
}
.searchbox input::placeholder { color: var(--text2); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(135deg, var(--acc), #3ac0c4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-2) var(--s-6) var(--s-8);
  /* Naming the element lets the browser animate this region alone, instead of
   * capturing the whole document and crossfading the sidebar and the player
   * along with it. */
  view-transition-name: screen;
}

/* The crossfade between screens. Deliberately short and slightly offset: a
 * long one would be in the way of someone moving quickly, and a pure fade
 * with no movement reads as a flicker. */
::view-transition-old(screen) {
  animation: screenOut 160ms var(--ease-in) both;
}
::view-transition-new(screen) {
  animation: screenIn 260ms var(--ease-out) both;
}
@keyframes screenOut { to { opacity: 0; transform: translateY(-6px) } }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px) } }
.screen { animation: riseIn var(--t-slow) var(--ease-out) both; }

/* --------------------------------------------------------------- typography */

h1.page {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin: var(--s-2) 0 var(--s-5);
}
h1.greeting {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin: var(--s-2) 0 var(--s-5);
  background: linear-gradient(90deg, var(--text) 45%, var(--acc2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* The gradient text needs a painted fallback if background-clip fails. */
  color: var(--text);
}
h2.section { font-size: 21px; font-weight: 800; letter-spacing: -0.3px; margin: 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}
.section-more { font-size: 12.5px; font-weight: 700; color: var(--text2); cursor: pointer; }
.section-more:hover { color: var(--text); }

.muted { color: var(--text2); }

/* ------------------------------------------------------------------ cards -- */

.quick-grid {
  display: grid;
  /* min() so the track never exceeds the container: a bare 300px minimum
   * overflows any column narrower than that. */
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-8);
}
.quick {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: color-mix(in srgb, var(--bg3) 80%, transparent);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  /* Named properties, not `all`: `all` makes the browser watch every
   * property, layout ones included, so a width or padding change animates
   * by accident and costs a reflow per frame. */
  transition: background-color var(--t-mid) var(--ease-both),
              border-color var(--t-mid) var(--ease-both),
              transform var(--t-mid) var(--ease-out);
  text-align: left;
  width: 100%;
}
.quick:hover { background: var(--bg3); transform: translateY(-2px); }
.quick .cover { width: 64px; height: 64px; flex-shrink: 0; }
.quick .t { font-size: 14.5px; font-weight: 700; padding-right: var(--s-3); }

.rail { display: flex; gap: var(--s-4); overflow-x: auto; padding-bottom: var(--s-2); margin-bottom: var(--s-6); }
.card {
  width: 172px;
  flex-shrink: 0;
  cursor: pointer;
  padding: var(--s-3);
  border-radius: 16px;
  transition: background-color var(--t-mid) var(--ease-both),
              transform var(--t-mid) var(--ease-out);
  background: none;
  text-align: left;
}
.card:hover { background: var(--bg3); transform: translateY(-4px); }
.card .cover { width: var(--cover-lg); height: var(--cover-lg); border-radius: var(--radius); box-shadow: var(--shadow-cover); }
.card .t { font-size: 14px; font-weight: 700; margin-top: var(--s-3); }
.card .s { font-size: 12.5px; color: var(--text2); margin-top: var(--s-1); }
.card.round .cover { border-radius: 50%; width: calc(var(--cover-lg) * 0.85); height: calc(var(--cover-lg) * 0.85); margin: 0 auto; }
.card.round { width: 150px; text-align: center; }

/* One-line clamp, used on every card title. */
.t, .s, .side-row .t, .side-row .s {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s-4);
}
.genre {
  height: 110px;
  border-radius: 14px;
  padding: var(--s-4);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--t-mid) var(--ease-out),
              filter var(--t-mid) var(--ease-both);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}
.genre:hover { filter: brightness(1.12); transform: scale(1.02); }
.genre .n { font-size: 12.5px; font-weight: 700; opacity: 0.85; }

.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* Chips and the filter box share a line, and the box drops under them when
 * the row runs out of width rather than squeezing the chips. */
.lib-toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}
.lib-filter {
  flex: 1;
  min-width: 190px;
  max-width: 320px;
  margin-left: auto;
  padding: var(--s-2) var(--s-3);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.lib-filter::placeholder { color: var(--text2); }
.lib-filter:focus { border-color: color-mix(in srgb, var(--acc) 60%, var(--line)); }
.chip {
  padding: var(--s-2) var(--s-4);
  border-radius: 18px;
  background: var(--bg3);
  color: var(--text2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed='true'] { background: var(--acc); color: #fff; font-weight: 700; }

.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-2) var(--s-3);
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.row:hover { background: var(--bg3); }
.row .cover { width: 52px; height: 52px; border-radius: 8px; flex-shrink: 0; }
.row .t { font-size: 14.5px; font-weight: 700; }
.row .s { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.row .meta { font-size: 12.5px; color: var(--text2); flex-shrink: 0; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------- staggered entrances -- */
/*
 * Rows and cards arrive one after another rather than all at once. The delay
 * is small — the whole run finishes inside a third of a second — but it is
 * what turns a list appearing into a list being dealt out, and it gives the
 * eye an order to read in.
 *
 * Capped at twelve: past that the last item would arrive noticeably late, and
 * a long list should not make someone wait to see its end.
 */
.rows > *, .rail > * { animation: itemIn 340ms var(--ease-out) both; }
.rows > *:nth-child(1), .rail > *:nth-child(1) { animation-delay: 0ms; }
.rows > *:nth-child(2), .rail > *:nth-child(2) { animation-delay: 26ms; }
.rows > *:nth-child(3), .rail > *:nth-child(3) { animation-delay: 52ms; }
.rows > *:nth-child(4), .rail > *:nth-child(4) { animation-delay: 78ms; }
.rows > *:nth-child(5), .rail > *:nth-child(5) { animation-delay: 104ms; }
.rows > *:nth-child(6), .rail > *:nth-child(6) { animation-delay: 130ms; }
.rows > *:nth-child(7), .rail > *:nth-child(7) { animation-delay: 156ms; }
.rows > *:nth-child(8), .rail > *:nth-child(8) { animation-delay: 182ms; }
.rows > *:nth-child(9), .rail > *:nth-child(9) { animation-delay: 208ms; }
.rows > *:nth-child(10), .rail > *:nth-child(10) { animation-delay: 234ms; }
.rows > *:nth-child(11), .rail > *:nth-child(11) { animation-delay: 260ms; }
.rows > *:nth-child(n+12), .rail > *:nth-child(n+12) { animation-delay: 286ms; }

/* ---------------------------------------------------- press and hover -- */
/*
 * A press should be felt. Squashing on :active and springing back on release
 * is the cheapest possible physicality, and its absence is why buttons that
 * only change colour feel like pictures of buttons.
 */
.play-btn:active:not(:disabled),
.round-btn:active,
.icon-sq:active,
.btn-pill:active:not(:disabled),
.btn-primary:active:not(:disabled),
.chip:active { transform: scale(0.94); transition-duration: var(--t-fast); }

.row {
  transition: background-color var(--t-fast) var(--ease-both),
              transform var(--t-mid) var(--ease-out);
}
.row:active { transform: scale(0.995); }
.nav-item, .icon-sq, .chip, .round-btn {
  transition: background-color var(--t-mid) var(--ease-both),
              color var(--t-mid) var(--ease-both),
              border-color var(--t-mid) var(--ease-both),
              transform var(--t-mid) var(--ease-spring);
}

/* ------------------------------------------------------------------ hero -- */

.hero { display: flex; align-items: flex-end; gap: var(--s-6); padding: var(--s-6) 0 var(--s-6); }
.hero .cover {
  width: var(--cover-hero);
  height: var(--cover-hero);
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.hero .kind {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text2);
}
.hero h1 {
  font-size: clamp(28px, 4.4vw, 52px);
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: var(--s-2) 0 var(--s-3);
  line-height: 1.05;
}
.hero .sub { font-size: 14px; color: var(--text2); }
.hero .sub b { color: var(--text); }
.hero-actions { display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-5); }

.play-big {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--acc);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--acc) 40%, transparent);
  transition: transform var(--t-mid) var(--ease-spring);
  flex-shrink: 0;
}
.play-big:hover { transform: scale(1.05); }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--acc2); }
.icon-btn[aria-pressed='true'] { color: var(--acc2); border-color: color-mix(in srgb, var(--acc2) 45%, transparent); }
.icon-btn[aria-pressed='true'] svg { fill: var(--acc2); }

/* --------------------------------------------------------- track listing -- */

.tracklist-head,
.track {
  display: grid;
  /* Six children, not four: the heart and the add button are columns of their
   * own. Declared for four, grid put them on a second row — invisible on a
   * desktop because they only appear on hover, and plainly wrong on a touch
   * screen where they are always shown. Every row was silently twice as tall
   * as it looked. */
  /* The action columns are a fixed width rather than `auto`: the header row
   * has no buttons, so `auto` collapsed them to zero there and its "Durée"
   * label stopped lining up with the durations below it by exactly their
   * width. */
  grid-template-columns: 40px 1fr 120px 60px 26px 26px;
  gap: var(--s-3);
  align-items: center;
}
.tracklist-head {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text2);
}
.tracklist { display: flex; flex-direction: column; margin-top: var(--s-1); }
.track {
  padding: var(--s-2) var(--s-3);
  border-radius: 9px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.track:hover { background: var(--bg3); }
.track .n { font-size: 13.5px; color: var(--text2); }
.track .name { font-size: 14px; font-weight: 600; }
.track.current .name { color: var(--acc2); }
.track .artist { font-size: 12px; color: var(--text2); margin-top: 2px; }
.track .plays { font-size: 13px; color: var(--text2); }
.track .dur { font-size: 13px; color: var(--text2); text-align: right; }
.track.pending { opacity: 0.55; }

/* The animated equaliser that marks the playing row. */
.eq { display: flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.eq i { width: 3px; background: var(--acc2); border-radius: 2px; display: block; }
.eq i:nth-child(1) { animation: eq1 0.9s infinite ease-in-out; height: 6px; }
.eq i:nth-child(2) { animation: eq2 0.8s infinite ease-in-out; height: 12px; }
.eq i:nth-child(3) { animation: eq3 1s infinite ease-in-out; height: 8px; }
.eq.paused i { animation-play-state: paused; }

/* --------------------------------------------------------------- profile -- */

.profile-head { display: flex; align-items: center; gap: var(--s-6); padding: var(--s-6) 0 var(--s-7); flex-wrap: wrap; }
.profile-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc), #3ac0c4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.profile-head h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -1.2px; margin: var(--s-1) 0 var(--s-2); }
.stats { display: flex; gap: var(--s-3); margin-bottom: var(--s-7); flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 170px;
  max-width: 220px;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s-4);
}
.stat .v { font-size: 26px; font-weight: 800; color: var(--acc2); }
.stat .k { font-size: 12.5px; color: var(--text2); margin-top: var(--s-1); }

/* ---------------------------------------------------------------- player -- */

.player {
  height: 84px;
  flex-shrink: 0;
  /*
   * Two layers: a wash of the current cover's colour over the normal
   * translucent panel. --player-tint is set from the artwork when a track is
   * playing and cleared otherwise, so the bar picks up the record without
   * ever losing the contrast the controls need — the wash is faint, and the
   * panel underneath still carries the text.
   */
  background:
    linear-gradient(90deg,
      color-mix(in srgb, var(--player-tint, transparent) 22%, transparent),
      color-mix(in srgb, var(--player-tint, transparent) 6%, transparent) 55%,
      transparent),
    color-mix(in srgb, var(--bg2) 72%, transparent);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--player-line, var(--line));
  transition: background 700ms var(--ease-both), border-color 700ms var(--ease-both);
  display: flex;
  align-items: center;
  padding: 0 var(--s-5);
  gap: var(--s-5);
}
.player-now { display: flex; align-items: center; gap: var(--s-3); width: 280px; min-width: 0; cursor: pointer; text-align: left; }
.player-now .cover { width: 52px; height: 52px; border-radius: 8px; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.player-now .t { font-size: 13.5px; font-weight: 700; }
.player-now .s { font-size: 12px; color: var(--text2); margin-top: 2px; }
.player-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.transport { display: flex; align-items: center; gap: var(--s-5); }
.transport button { color: var(--text2); display: flex; }
.transport button:hover:not(:disabled) { color: var(--text); }
.transport button:disabled { opacity: 0.35; cursor: default; }
.play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--t-mid) var(--ease-spring);
  flex-shrink: 0;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn svg { fill: var(--bg); }
.play-btn.busy { animation: spin 0.9s linear infinite; }

.scrub { display: flex; align-items: center; gap: var(--s-2); width: 100%; max-width: 560px; }
.scrub .time { font-size: 11px; color: var(--text2); width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.scrub .time.right { text-align: left; }

/* The progress and volume controls are real range inputs: keyboard-operable
 * and screen-reader-announced, painted to look like the design's bars. */
.bar {
  flex: 1;
  appearance: none;
  -webkit-appearance: none;
  height: 14px;
  background: none;
  cursor: pointer;
  margin: 0;
  min-width: 0;
}
/*
 * The played part is a background *image* clipped by background-size, not a
 * colour stop in a gradient.
 *
 * It used to be `linear-gradient(to right, var(--fill-color) X%, var(--bg3) X%)`,
 * which works only while --fill-color is a plain colour. The expanded player
 * passes a gradient of the cover's two colours, and a gradient is not a valid
 * colour stop: the whole declaration was dropped, the track lost its
 * background, and all that remained was the box-shadow glow — a uniform line
 * with no visible progress. Painting the fill as an image accepts both.
 */
.bar::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background-color: var(--bg3);
  background-image: var(--fill-image, linear-gradient(var(--acc), var(--acc)));
  background-size: var(--fill, 0%) 100%;
  background-repeat: no-repeat;
  /*
   * A hint of bloom, not a halo. The shadow is cast by the whole track — the
   * unplayed part included — so anything strong reads as the entire bar
   * glowing rather than the played part being lit. It also follows the cover's
   * colour, so it agrees with the fill instead of always being the accent.
   */
  box-shadow: 0 0 5px color-mix(in srgb, var(--bar-glow, var(--acc)) 16%, transparent);
}
.bar::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background-color: var(--bg3);
  background-image: var(--fill-image, linear-gradient(var(--acc), var(--acc)));
  background-size: var(--fill, 0%) 100%;
  background-repeat: no-repeat;
}
.bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text);
  margin-top: -3.5px;
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease-both);
}
.bar::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  opacity: 0;
}
.bar:hover::-webkit-slider-thumb, .bar:focus-visible::-webkit-slider-thumb { opacity: 1; }
.bar:hover::-moz-range-thumb, .bar:focus-visible::-moz-range-thumb { opacity: 1; }
.bar.plain::-webkit-slider-runnable-track { box-shadow: none; }

.player-right { width: 210px; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); color: var(--text2); }
/* flex: none matters: .bar carries flex: 1, which made the width below a
 * starting size the volume then grew past, filling the whole right-hand
 * column. */
.player-right .vol { flex: none; width: 84px; }

/* ------------------------------------------------------- expanded player -- */

.now-playing {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #06101d;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  contain: layout paint style;
  animation: sheetIn 380ms var(--ease-out) both;
  /* Edge to edge on purpose — the background should reach the corners — but
   * its contents must not. Padding keeps the wash full-bleed and moves the
   * close button out from under the island, the controls off the home
   * indicator. */
  padding:
    var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
}
/* Closing used to be a bare remove(): the screen was simply gone on the next
 * frame, which is the one moment an interface most obviously lacks polish. */
.now-playing.closing { animation: sheetOut 240ms var(--ease-in) both; }
.np-wash {
  position: absolute;
  inset: 0;
  opacity: var(--ambient-wash-opacity, 0.12);
  scale: var(--ambient-wash-scale, 1);
  transform-origin: 34% 48%;
}
.np-blob { position: absolute; border-radius: 50%; }
.np-wash,
.np-blob {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  will-change: opacity, transform;
}
.np-fluid,
.np-flow-glow,
.np-flow {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.np-flow-glow {
  z-index: 1;
  opacity: 0.92;
  /* The half-resolution backing store provides the soft bloom. Avoiding a
   * live full-screen CSS filter keeps macOS on the fast compositor path. */
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: strict;
}
.np-fluid {
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: strict;
}
.np-flow {
  z-index: 2;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: strict;
  will-change: transform, opacity;
}

/* --------------------------------------------------- reacting to the audio -- */
/*
 * --level and --bass are written every frame by the analyser. The values are
 * used through the independent `scale` and `opacity` properties, never through
 * `transform`: the blobs and the cover already animate `transform` on a timer,
 * and an animation owns that property outright. `scale` composes with it, so
 * the drift keeps running underneath and the sound rides on top.
 *
 * Only .reactive gets any of this, so a browser without the Web Audio API — or
 * a graph that refused to build — keeps exactly the fixed animation it had.
 */
.now-playing.reactive .np-blob {
  /* Measured on a real track: the overall level swings across almost its
   * whole range while the bass sits high and steady, because a dense mix has
   * a near-constant bottom end. So the breathing comes from the level, and
   * the bass only adds the accent on top of it.
   *
   * Amplitudes are wide now that the particles are gone: with a field of
   * small lights competing for attention the background had to stay
   * restrained, and without them it can carry the reaction on its own. */
  scale: var(--ambient-blob-scale, 1);
  opacity: var(--ambient-blob-opacity, 0.14);
  transition: scale 90ms linear, opacity 140ms linear;
}
.now-playing.reactive .np-wash {
  opacity: var(--ambient-wash-opacity, 0.055);
  /* Saturation as well as opacity: a wash that only brightens reads as a lamp
   * being turned up, while one that also saturates reads as the colour itself
   * arriving — which is what the cover is lending the screen. */
  transition: opacity 160ms linear;
}
.now-playing.reactive .np-cover {
  /* Small on purpose: the artwork is the thing being looked at, and artwork
   * that visibly throbs is a novelty that wears out in a minute. */
  scale: calc(1 + var(--level, 0) * 0.018 + var(--bass, 0) * 0.008);
  transition: scale 70ms linear;
}
.now-playing.reactive .np-mood .dot {
  scale: calc(1 + var(--bass, 0) * 0.8);
  transition: scale 80ms linear;
}

.np-blob.one { top: -20%; left: -12%; width: 60%; height: 70%; opacity: 0.35; }
.np-blob.two { bottom: -25%; right: -14%; width: 58%; height: 68%; opacity: 0.45; }
.np-head {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 22px 30px;
  flex-shrink: 0;
}
.np-head-tools { display: flex; align-items: center; gap: 10px; }
.np-tune-toggle {
  height: 38px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--cover-primary, #54b9e8) 34%, rgba(255,255,255,.08));
  border-radius: 999px;
  color: var(--text2);
  background: rgba(4, 12, 23, 0.42);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .15em;
  backdrop-filter: blur(16px);
}
.np-tune-toggle[aria-expanded='true'] { color: #fff; border-color: var(--cover-primary, #54b9e8); }
.np-tuner {
  position: fixed;
  z-index: 12;
  /* Fixed, so the padding on .now-playing does not reach it: these owe the
   * insets themselves. */
  top: calc(76px + var(--safe-t));
  right: calc(24px + var(--safe-r));
  width: min(380px, calc(100vw - 32px - var(--safe-l) - var(--safe-r)));
  max-height: calc(100dvh - 96px - var(--safe-t) - var(--safe-b));
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--cover-primary, #54b9e8) 28%, rgba(255,255,255,.08));
  border-radius: 22px;
  background: color-mix(in srgb, #07111e 82%, transparent);
  box-shadow: 0 30px 90px rgba(0,0,0,.48), inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(24px) saturate(1.25);
  opacity: 0;
  visibility: hidden;
  transform: translate3d(16px, -6px, 0) scale(.98);
  transform-origin: top right;
  transition: opacity 180ms ease, transform 220ms var(--ease-both), visibility 180ms;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.np-tuner.open { opacity: 1; visibility: visible; transform: translate3d(0,0,0) scale(1); }
.np-tuner-head, .np-tuner-foot { display: flex; align-items: center; justify-content: space-between; }
.np-tuner-head strong { display: block; font-size: 13px; letter-spacing: .13em; }
.np-tuner-head span { display: block; margin-top: 3px; color: var(--text2); font-size: 11px; }
.np-tuner-head > button { color: var(--text2); font-size: 25px; line-height: 1; }
.np-tuner-grid {
  display: grid;
  gap: 13px;
  margin: 18px -5px 16px 0;
  padding-right: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--cover-primary, #54b9e8) 40%, transparent) transparent;
}
.np-tune-section {
  position: sticky;
  top: 0;
  z-index: 1;
  margin-top: 5px;
  padding: 8px 0 5px;
  background: linear-gradient(90deg, color-mix(in srgb, #07111e 94%, transparent) 78%, transparent);
  color: color-mix(in srgb, var(--cover-primary, #54b9e8) 76%, white);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .14em;
}
.np-tune-section:first-child { margin-top: 0; padding-top: 2px; }
.np-tune-row { display: grid; gap: 7px; }
.np-tune-label { display: flex; justify-content: space-between; color: var(--text2); font-size: 12px; }
.np-tune-label output { color: #fff; font-variant-numeric: tabular-nums; }
.np-tune-row input { width: 100%; accent-color: var(--cover-primary, #54b9e8); }
.np-tuner-foot { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.np-tuner-foot button { color: var(--text2); font-size: 11px; }
.np-tuner-foot kbd { color: var(--text2); font: 10px/1 system-ui; letter-spacing: .08em; }
.np-head > :first-child { justify-self: start; }
.np-head .label { font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text2); }
.np-fps {
  justify-self: end;
  min-width: 82px;
  min-height: 34px;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--cover-primary, #54b9e8) 24%, transparent);
  border-radius: 999px;
  background: rgba(5, 12, 22, 0.38);
  color: rgba(255, 255, 255, 0.9);
  font-size: 10px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.25px;
  backdrop-filter: blur(12px);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms var(--ease-out);
}
.np-fps:hover,
.np-fps:focus-visible {
  background: color-mix(in srgb, var(--cover-primary, #54b9e8) 12%, rgba(5, 12, 22, 0.5));
  border-color: color-mix(in srgb, var(--cover-primary, #54b9e8) 52%, transparent);
}
.np-fps.changed { transform: scale(1.055); }
.np-fps-live { font-weight: 800; }
.np-fps-cap { color: var(--text2); font-size: 8px; font-weight: 700; letter-spacing: 0.55px; }
.np-body {
  position: relative;
  z-index: 3;
  flex: 1;
  min-height: 0;
  /* The ring is half again as wide as the artwork, which a short window
   * cannot always hold. Without this the top of the cover was simply cut off
   * and unreachable; scrolling is a worse outcome than fitting, but a far
   * better one than clipping. */
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(430px, 1.12fr) minmax(400px, 0.88fr);
  align-items: center;
  /* `safe` matters as much as the overflow above it: centred flex content
   * that overflows pushes its first item past the start edge, where a scroll
   * container cannot reach it. The top of the artwork was cut off and there
   * was no way to scroll up to it. `safe` falls back to start-alignment the
   * moment it stops fitting. */
  gap: clamp(38px, 5vw, 96px);
  padding: 12px clamp(42px, 6vw, 124px) 64px;
}
/* Ring and artwork share one grid cell, so the cell sizes to the larger of
 * the two — the ring — and the layout reserves its full width. Positioning
 * the canvas absolutely instead let the stage collapse to the cover, and the
 * bars spilled over the title underneath. */
.np-stage {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
}
.np-stage > * { grid-area: 1 / 1; }
.np-ring { display: none; pointer-events: none; z-index: 0; }
.np-stage .np-cover-tilt { z-index: 1; }

.np-cover-tilt {
  width: fit-content;
  transform-style: preserve-3d;
  transform-origin: 46% 54%;
  animation: coverPerspective 11s ease-in-out infinite;
  will-change: transform;
}
.np-cover-tilt.has-three {
  animation: none;
  transform: none;
}

.np-cover {
  width: min(520px, 42vw, 64vh);
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--cover-secondary, #fff) 44%, transparent);
  transition: box-shadow 700ms var(--ease-both), border-color 700ms var(--ease-both);
  flex-shrink: 0;
  position: relative;
  box-shadow:
    0 30px 110px color-mix(in srgb, var(--cover-primary, #54b9e8) 34%, transparent),
    0 0 34px color-mix(in srgb, var(--cover-secondary, #fff) 20%, transparent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.np-cover-fallback {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-size: cover;
  background-position: center;
  transition: opacity 280ms ease;
}
.np-cover-three {
  position: absolute;
  inset: -12%;
  width: 124%;
  height: 124%;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: strict;
  will-change: transform, opacity;
  filter: none;
  transition: opacity 280ms ease;
}
.np-cover.three-ready {
  border-color: transparent;
  background: none !important;
  box-shadow: none !important;
  backdrop-filter: none;
}
.np-cover.three-ready .np-cover-fallback {
  opacity: 0;
  visibility: hidden;
}
.np-cover.three-ready .np-cover-three { opacity: 1; }
.np-detail {
  width: min(590px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 36px;
}
.np-meta { text-align: left; }
.np-title { font-size: clamp(34px, 3.4vw, 56px); line-height: 1.02; font-weight: 800; letter-spacing: -1.8px; }
.np-sub { font-size: clamp(15px, 1.2vw, 19px); color: color-mix(in srgb, var(--text2) 82%, white); margin-top: 12px; }
.np-mood {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  padding: 5px 13px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--cover-primary, #7c5cff) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--cover-secondary, #fff) 15%, transparent);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text2);
}
.np-mood .dot { width: 7px; height: 7px; border-radius: 50%; }
.np-scrub { display: flex; align-items: center; gap: 14px; width: 100%; }
.np-scrub .bar { height: 22px; }
.np-transport { display: flex; align-items: center; justify-content: center; gap: clamp(24px, 4vw, 54px); }
.np-transport .play-btn {
  width: 72px;
  height: 72px;
  box-shadow: 0 12px 44px color-mix(in srgb, var(--cover-primary, #000) 32%, transparent);
}
.np-vol {
  position: fixed;
  right: calc(clamp(34px, 5vw, 88px) + var(--safe-r));
  /* 44px clears nothing on a phone: the home indicator alone is 34 of them. */
  bottom: calc(44px + var(--safe-b));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(190px, 50vw);
}

@media (max-width: 1180px) {
  .np-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    gap: 28px;
    padding: 0 24px 92px;
  }
  .np-cover { width: min(390px, 54vw, 42vh); border-radius: 12px; }
  .np-cover-tilt { animation-duration: 14s; }
  .np-detail { width: min(600px, 86vw); gap: 24px; }
  .np-meta { text-align: center; }
  .np-title { font-size: clamp(28px, 6vw, 42px); letter-spacing: -1px; }
  /* 22px puts it under the home indicator, which is 34 on its own. */
  .np-vol { bottom: calc(22px + var(--safe-b)); }
}

/* ------------------------------------------------------------------ auth -- */

.auth-wrap {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  position: relative;
  overflow: hidden;
}
.auth-card {
  position: relative;
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: blur(22px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: var(--s-7) var(--s-7);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  animation: riseIn var(--t-slow) var(--ease-out) both;
}
.auth-card h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.6px; margin: var(--s-4) 0 var(--s-1); }
.auth-card .lede { font-size: 13.5px; color: var(--text2); margin: 0 0 var(--s-6); line-height: 1.55; }
.field { margin-bottom: var(--s-3); }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: var(--s-1); }
.field input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--s-3) var(--s-3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.field input:focus { border-color: color-mix(in srgb, var(--acc) 60%, transparent); }
.btn-primary {
  width: 100%;
  padding: var(--s-3);
  border-radius: 11px;
  background: var(--acc);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  margin-top: var(--s-2);
  transition: filter var(--t-fast) var(--ease-both), transform var(--t-mid) var(--ease-spring);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.auth-switch { margin-top: var(--s-4); font-size: 13px; color: var(--text2); text-align: center; }
.auth-switch button { color: var(--acc2); font-weight: 700; }

.form-error {
  background: color-mix(in srgb, #ff4d6a 14%, transparent);
  border: 1px solid color-mix(in srgb, #ff4d6a 40%, transparent);
  color: #ff9db0;
  border-radius: 10px;
  padding: var(--s-2) var(--s-3);
  font-size: 13px;
  margin-bottom: var(--s-4);
  line-height: 1.45;
}
:root[data-theme='light'] .form-error { color: #b3123a; }

/* ------------------------------------------------------------ misc bits -- */

.empty {
  padding: var(--s-10) var(--s-5);
  text-align: center;
  color: var(--text2);
  font-size: 14px;
  line-height: 1.7;
}
.empty strong { color: var(--text); display: block; font-size: 17px; margin-bottom: var(--s-2); font-weight: 700; }
.empty code {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px var(--s-2);
  font-size: 12.5px;
}

.toast {
  position: fixed;
  bottom: calc(100px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg3);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: var(--s-3) var(--s-4);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  z-index: 100;
  /* Its own keyframes rather than the shared rise: the toast is centred with
   * translateX(-50%), and a rise that animates `transform` wholesale wipes
   * that out — it slid in from the left and snapped to centre at the end. */
  animation: toastIn 260ms var(--ease-out) both;
  max-width: min(460px, 90vw);
}
.toast.closing { animation: toastOut 200ms var(--ease-in) both; }

.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, color-mix(in srgb, var(--bg3) 55%, var(--text2)) 50%, var(--bg3) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s var(--ease-both) infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }

.badge {
  display: inline-block;
  padding: 2px var(--s-2);
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  vertical-align: middle;
  margin-left: var(--s-2);
}

/* Visible only to assistive technology, for labels the design shows as icons. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible { outline: 2px solid var(--acc2); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------ responsive -- */

/* The design ships a separate mobile file; this keeps the desktop layout
 * usable as it narrows rather than reimplementing that here. */
@media (max-width: 900px) {
  .sidebar { width: 76px; padding: var(--s-5) var(--s-2); }
  /* History is one swipe away on a narrow device, and the spacer is pure
   * luxury — both go so the search field keeps a usable width. */
  .nav-arrows { display: none; }
  .topbar-spacer { display: none; }
  /* Backstop: the rails scroll inside their own containers, so clipping the
   * page here can only catch a genuine layout overflow. */
  .content { overflow-x: hidden; }
  .brand-name, .nav-item span, .side-label, .side-list { display: none; }
  .nav-item { justify-content: center; padding: var(--s-3) 0; }
  .player-now { width: auto; flex: 1; }
  .player-right { width: auto; }
  .player-right .vol { display: none; }
  .content { padding: var(--s-2) var(--s-4) var(--s-7); }
  .topbar { padding: var(--s-3) var(--s-4); gap: var(--s-2); }
  .topbar .hide-sm { display: none; }
  .hero { flex-direction: column; align-items: flex-start; gap: var(--s-4); }
  .hero .cover { width: 160px; height: 160px; }
  .track, .tracklist-head { grid-template-columns: 30px 1fr 52px 26px 26px; }
  .tracklist-head .plays, .track .plays { display: none; }
}

/* ============================================================== phone == */
/*
 * Below 760px this stops being a narrow desktop and becomes a phone layout.
 *
 * The difference is not size. A sidebar shrunk to a strip of icons is still a
 * sidebar: it takes the left edge, which is the hardest place to reach with a
 * thumb, and it competes with the content for a width there is none of. A
 * phone puts navigation at the bottom, where the hand already is, and gives
 * the whole width to what you came to look at.
 */
@media (max-width: 760px) {
  /* Every offset below is derived from these two rather than guessed. The
   * first attempt hardcoded the bar at 60px while its content made it 65, and
   * the player sat five pixels inside it. */
  :root {
    --tabbar-h: 64px;
    --miniplayer-h: 62px;
  }
  /* The document scrolls, not an inner pane.
   *
   * Switching the shell to a column already broke the height chain — .content
   * kept `overflow-y: auto` and quietly stopped being the scroller while the
   * body took over. Rather than repair a container nobody scrolls, this makes
   * the document the scroller on purpose: it is the native behaviour on a
   * phone, and the one that lets the browser's own chrome collapse as you go
   * down a list. The bar and the player are fixed, so they stay put either
   * way.
   */
  /* Release the document so it can actually scroll.
   *
   * The rules below hand scrolling to the document — .content stops being a
   * scroller and #app grows with its content — but html and body were still
   * pinned at height:100% with body overflow:hidden, which is right for the
   * desktop shell and forbids exactly what this layout depends on. The result
   * was a phone where nothing scrolled at all: the page simply ended at the
   * bottom of the screen.
   *
   * min-height rather than height, so a short screen still fills the viewport
   * and the tab bar has something to sit against. */
  html, body {
    height: auto;
    min-height: 100%;
    overflow: visible;
  }
  #app { height: auto; min-height: 100dvh; }
  .shell { flex-direction: column; min-height: 0; }
  .main { min-height: 0; }
  .content { overflow: visible; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(18px);
  }

  /* The sidebar becomes the tab bar: fixed to the bottom, above the player. */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding:
      var(--s-1)
      calc(var(--s-2) + var(--safe-r))
      var(--safe-b)
      calc(var(--s-2) + var(--safe-l));
    /* The home indicator sits over the bottom edge; without this the last row
     * of targets is under it. */
    padding-bottom: calc(var(--s-1) + var(--safe-b));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: color-mix(in srgb, var(--bg2) 94%, transparent);
    backdrop-filter: blur(20px);
    z-index: 40;
    overflow: visible;
  }
  /* Only the four that earn a tab. The others are on the profile. */
  .sidebar .brand,
  .sidebar .side-label,
  .sidebar .side-list,
  .sidebar .side-new,
  .sidebar .sidebar-foot,
  .sidebar .admin-badge,
  .sidebar .nav-item:not(.tabbar) { display: none; }

  .sidebar .nav-item {
    flex-direction: column;
    gap: 3px;
    /* 56px tall, comfortably over the 44px anyone can reliably hit. */
    min-height: 52px;
    padding: var(--s-1) var(--s-1);
    border-radius: var(--s-3);
    font-size: 10.5px;
    font-weight: 600;
  }
  .sidebar .nav-item span { display: block; }
  .sidebar .nav-item[aria-current='page'] { background: none; color: var(--acc2); }

  /* The player floats just above the tab bar rather than sitting on the
   * bottom edge, so both stay reachable and neither covers the other. */
  .player {
    position: fixed;
    left: var(--s-2);
    right: var(--s-2);
    bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s-2));
    height: var(--miniplayer-h);
    padding: 0 var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--s-3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    z-index: 39;
  }
  /* On a phone the bar is a handle to the full player, not a console: the
   * transport keeps play/pause and nothing else competes for the width. */
  .player-mid .scrub,
  .player-right,
  .transport button:first-child,
  .transport button:last-child { display: none; }
  .player-mid { flex: 0 0 auto; }
  .player-now { flex: 1; min-width: 0; }
  .player-now .cover { width: 42px; height: 42px; }

  /* Room for both, so the last row of a list is never trapped underneath. */
  /* Clear both, plus a breath, so the last row of a list is never trapped. */
  .content {
    padding: var(--s-2) var(--s-4)
      calc(var(--tabbar-h) + var(--miniplayer-h) + var(--safe-b) + var(--s-6));
  }
  .admin-body {
    padding-bottom: calc(var(--tabbar-h) + var(--miniplayer-h) + var(--safe-b) + var(--s-6));
  }

  /* The status bar sits over this one. Without the top inset the search field
   * and the avatar land under the clock and the battery. */
  .topbar {
    padding:
      calc(var(--s-3) + var(--safe-t))
      calc(var(--s-4) + var(--safe-r))
      var(--s-3)
      calc(var(--s-4) + var(--safe-l));
  }
  .page { font-size: 26px; }

  /* Touch targets, everywhere a finger lands. */
  .row, .track { min-height: 56px; }
  .chip { padding: var(--s-2) var(--s-4); }
}

@media (max-width: 560px) {
  .player { padding: 0 var(--s-3); gap: var(--s-3); }
  .player-mid { gap: var(--s-1); }
  .transport { gap: var(--s-4); }
  .scrub .time { width: 30px; font-size: 10.5px; }
  .quick-grid { gap: var(--s-2); }
  .card { width: 140px; }
  .card .cover { width: 116px; height: 116px; }
}

/* ============================================================== admin == */
/* Ported from Nocturne Admin.dc.html. The shell is the app's, with the
 * sidebar switched to the administration sections. */

.admin-badge {
  padding: 0 var(--s-3) var(--s-4);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--acc);
  text-transform: uppercase;
}
.sidebar-foot { margin-top: auto; padding-top: var(--s-3); }
.sidebar-foot .nav-item { font-size: 13.5px; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-7);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.admin-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; margin: 0; }
.admin-body { flex: 1; overflow-y: auto; padding: var(--s-6) var(--s-7) var(--s-9); }

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--acc);
  color: #fff;
  border-radius: 20px;
  padding: var(--s-2) var(--s-4);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--acc) 30%, transparent);
  transition: transform var(--t-mid) var(--ease-spring),
              filter var(--t-fast) var(--ease-both),
              box-shadow var(--t-mid) var(--ease-both);
  white-space: nowrap;
}
.btn-pill:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn-pill:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-ghost {
  padding: var(--s-2) var(--s-4);
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--line);
}
.btn-ghost:hover { color: var(--text); }
.btn-ghost[aria-pressed='true'] { background: var(--acc); color: #fff; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-7); }
.kpi {
  background: color-mix(in srgb, var(--bg3) 75%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: var(--s-5);
}
.kpi .k { font-size: 12px; font-weight: 600; color: var(--text2); }
.kpi .v { font-size: 28px; font-weight: 800; margin-top: var(--s-2); letter-spacing: -0.5px; }
.kpi .n { font-size: 12px; font-weight: 700; color: var(--text2); margin-top: var(--s-1); }
.kpi .n.good { color: #4fc98a; }
.kpi .n.bad { color: #f16a6a; }

.chart-card {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: var(--s-6) var(--s-6) var(--s-3);
  margin-bottom: var(--s-7);
}
.chart { display: flex; align-items: flex-end; gap: var(--s-3); height: 160px; }
.chart .col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}
.chart .val { font-size: 11px; font-weight: 700; color: var(--text2); }
.chart .bar-fill {
  width: 100%;
  max-width: 46px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--acc), color-mix(in srgb, var(--acc) 35%, transparent));
  transition: height var(--t-slow) var(--ease-out);
  min-height: 3px;
}
.chart .day { font-size: 11px; color: var(--text2); }

h2.admin-section { font-size: 17px; font-weight: 800; margin: 0 0 var(--s-3); }

.admin-toolbar { display: flex; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }
.admin-search {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 var(--s-3);
}
.admin-search svg { color: var(--text2); flex-shrink: 0; }
.admin-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  padding: var(--s-2) 0;
  outline: none;
}

/* The table is wide by nature; it scrolls inside its own box rather than
 * pushing the page sideways. */
.table-scroll { overflow-x: auto; }
.admin-table { min-width: 820px; }
.admin-row,
.admin-thead {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 150px) 100px 70px 110px 84px;
  gap: var(--s-3);
  align-items: center;
}
.admin-thead {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text2);
}
.admin-row { padding: var(--s-2) var(--s-3); border-radius: 9px; }
.admin-row:hover { background: var(--bg3); }
.admin-row .cover { width: 38px; height: 38px; border-radius: 6px; flex-shrink: 0; }
.admin-row .lead { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.admin-row .t { font-size: 13.5px; font-weight: 700; }
.admin-row .s { font-size: 11.5px; color: var(--text2); }
.admin-row .c { font-size: 12.5px; color: var(--text2); }
.admin-actions { display: flex; gap: var(--s-1); justify-content: flex-end; }
.icon-sq {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text2);
  flex-shrink: 0;
}
.icon-sq:hover { color: var(--text); }
.icon-sq.danger:hover { color: #f16a6a; border-color: color-mix(in srgb, #f16a6a 40%, transparent); }

.pill {
  justify-self: start;
  padding: var(--s-1) var(--s-3);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.ready { background: rgba(79, 201, 138, 0.15); color: #4fc98a; }
.pill.pending, .pill.processing, .pill.queued, .pill.running { background: color-mix(in srgb, var(--acc) 18%, transparent); color: var(--acc2); }
.pill.failed { background: rgba(241, 106, 106, 0.15); color: #f16a6a; }
.pill.done { background: rgba(79, 201, 138, 0.15); color: #4fc98a; }
.pill.neutral { background: rgba(160, 160, 178, 0.15); color: var(--text2); }

.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-4); }
.admin-card {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: var(--s-3);
  display: flex;
  gap: var(--s-3);
  align-items: center;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.admin-card:hover { border-color: color-mix(in srgb, var(--acc) 40%, transparent); }
.admin-card .cover { width: 64px; height: 64px; border-radius: 9px; flex-shrink: 0; }

/* ---------------------------------------------------------- downloads -- */

.dl-row,
.dl-thead {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 120px 110px minmax(0, 1fr) 74px;
  gap: var(--s-3);
  align-items: center;
}
.dl-thead {
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text2);
}
.dl-row { padding: var(--s-2) var(--s-3); border-radius: 9px; }
.dl-row:hover { background: var(--bg3); }
.dl-row .err {
  font-size: 11.5px;
  color: #f16a6a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-src { font-size: 11.5px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notice {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  background: color-mix(in srgb, var(--acc) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  border-radius: 12px;
  padding: var(--s-3) var(--s-4);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text2);
  margin-bottom: var(--s-5);
}
.notice strong { color: var(--text); display: block; margin-bottom: var(--s-1); font-size: 13.5px; }
.notice code {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px var(--s-1);
  font-size: 12px;
}
.notice.warn {
  background: rgba(224, 178, 58, 0.1);
  border-color: rgba(224, 178, 58, 0.32);
}

/* ------------------------------------------------------------- modal -- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(var(--s-5) + var(--safe-t))
    calc(var(--s-5) + var(--safe-r))
    calc(var(--s-5) + var(--safe-b))
    calc(var(--s-5) + var(--safe-l));
  animation: fadeIn 180ms var(--ease-out) both;
}
.modal {
  width: min(560px, 100%);
  max-height: min(86vh, 780px);
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: var(--s-6);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: sheetIn 280ms var(--ease-out) both;
}
.modal h2 { font-size: 19px; font-weight: 800; margin: 0 0 var(--s-5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-6); }
.modal .field input, .modal .field select, .modal .field textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--s-3) var(--s-3);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.modal .field input:focus, .modal .field select:focus { border-color: color-mix(in srgb, var(--acc) 60%, transparent); }

.tabs { display: flex; gap: var(--s-1); margin-bottom: var(--s-5); background: var(--bg3); border-radius: 12px; padding: var(--s-1); }
.tabs button {
  flex: 1;
  padding: var(--s-2) var(--s-3);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text2);
}
.tabs button[aria-selected='true'] { background: var(--bg2); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  padding: var(--s-6) var(--s-5);
  text-align: center;
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--t-mid) var(--ease-both),
              background-color var(--t-mid) var(--ease-both),
              color var(--t-mid) var(--ease-both);
}
.dropzone:hover, .dropzone.over { border-color: var(--acc); color: var(--text); background: color-mix(in srgb, var(--acc) 7%, transparent); }
.dropzone b { color: var(--acc); }

.preview-list {
  margin-top: var(--s-4);
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.preview-item {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.preview-item:last-child { border-bottom: 0; }
.preview-item .idx { width: 20px; color: var(--text2); font-size: 12px; flex-shrink: 0; }
.preview-item .d { color: var(--text2); font-size: 12px; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid color-mix(in srgb, var(--text2) 40%, transparent);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* ------------------------------------------- metadata review -- */
/*
 * A card per track rather than a table row: the choice being made is
 * "which of these is my track", and that needs the current state and every
 * candidate visible at once, artwork included.
 */
.match-list { display: flex; flex-direction: column; gap: var(--s-3); }

.match-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.match-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.match-head .cover.sm { width: 40px; height: 40px; border-radius: 7px; flex-shrink: 0; }
.match-head .t { font-weight: 650; font-size: 14px; }
.match-head .s { color: var(--text2); font-size: 12.5px; margin-top: 2px; }
.match-head .meta { color: var(--text2); font-size: 12px; white-space: nowrap; }

.match-body { padding: var(--s-1) var(--s-3) var(--s-3); }

.meta-search { padding: var(--s-2) 0 var(--s-2); }
.meta-search-row { display: flex; gap: var(--s-2); align-items: center; }
.meta-query {
  flex: 1;
  min-width: 0;
  padding: var(--s-2) var(--s-3);
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.meta-query:focus { border-color: color-mix(in srgb, var(--acc) 60%, var(--line)); }
.btn-ghost.sm .spinner { width: 12px; height: 12px; border-width: 2px; }

.match-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
}
.match-row:last-child { border-bottom: 0; }
.match-row .t { font-weight: 600; font-size: 13.5px; }
.match-row .s { color: var(--text2); font-size: 12.5px; margin-top: 1px; }
.match-row .meta { color: var(--text2); font-size: 11.5px; margin-top: var(--s-1); }

.match-cover {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--text2) 12%, transparent);
}
.empty-cover { background: color-mix(in srgb, var(--text2) 8%, transparent); }

.match-source {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-1);
  flex-shrink: 0;
}
/* Confidence, coloured so a weak title match cannot be mistaken for a
 * fingerprint at a glance. */
.pill.high { background: rgba(79, 201, 138, 0.15); color: #4fc98a; }
.pill.mid { background: rgba(232, 178, 74, 0.16); color: #e8b24a; }
.pill.low { background: rgba(160, 160, 178, 0.15); color: var(--text2); }

.btn-pill.sm { padding: var(--s-2) var(--s-3); font-size: 12.5px; flex-shrink: 0; }
.btn-pill .spinner { width: 12px; height: 12px; border-width: 2px; border-top-color: #fff; }
.btn-ghost.sm { padding: var(--s-2) var(--s-3); font-size: 12.5px; }

/* ------------------------------------------------ search and download -- */
/* --------------------------------------------------------- bibliothèque -- */
/*
 * The rail is a single horizontal row that scrolls; the library needs the same
 * cards wrapping down the page instead, since it shows everything rather than
 * a curated handful.
 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--cover-lg), 100%), 1fr));
  gap: var(--s-2);
  align-items: start;
}
.card-grid .card { width: auto; }
.card-grid .card .cover { width: 100%; height: auto; aspect-ratio: 1; }
.card-grid .card.round .cover { width: 100%; height: auto; border-radius: 50%; }

.lib-count {
  font-size: 12.5px;
  color: var(--text2);
  margin: 2px 0 var(--s-3);
}

/* ------------------------------------------------------------- système -- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: var(--s-3);
  margin: var(--s-4) 0 var(--s-1);
}
.stat {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.stat .label { font-size: 11.5px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-size: 22px; font-weight: 800; margin-top: var(--s-1); letter-spacing: -0.5px; }
.stat .sub { font-size: 12px; color: var(--text2); margin-top: var(--s-1); }

.sys-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: 10px;
  font-size: 13.5px;
}
.sys-row:nth-child(odd) { background: color-mix(in srgb, var(--text) 3%, transparent); }
.sys-row .meta { font-size: 12.5px; color: var(--text2); flex-shrink: 0; }
.sys-n { font-weight: 800; font-size: 15px; min-width: 42px; }

/* A dot rather than a word: the state is scanned, not read. */
.sys-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: #4fc98a; }
.dot.warn { background: #e8b24a; }
.dot.off { background: #f16a6a; }

.sys-details { margin-top: var(--s-3); font-size: 12px; }
.sys-details summary { cursor: pointer; color: var(--text2); }
.sys-details summary:hover { color: var(--text); }
.sys-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text2);
  padding: var(--s-1) 0;
  overflow-wrap: anywhere;
}
.sys-path b { color: var(--text); font-family: inherit; }

/* Peer buttons on one line, wrapping together rather than stacking one by
 * one. Sized from the scale, so density carries it. */
.button-row {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin: var(--s-6) 0 var(--s-7);
}

/* -------------------------------------------------------- playlist bits -- */
.field label.check {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  font-size: 13px;
}
.field label.check input { width: auto; margin: 0; }

.side-new {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: 100%;
  padding: var(--s-2) var(--s-2);
  margin-bottom: var(--s-1);
  border-radius: 8px;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--text2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: color var(--t-mid) var(--ease-both),
              border-color var(--t-mid) var(--ease-both);
}
.side-new:hover { color: var(--text); border-color: color-mix(in srgb, var(--acc) 50%, var(--line)); }

/* Revealed on hover, so a row is a row until there is a reason for it not to
 * be. Always visible on a touch screen, where there is no hover to reveal it. */
.track-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--text2);
  flex-shrink: 0;
  opacity: 0;
  cursor: pointer;
  transition: opacity var(--t-fast) var(--ease-both),
              color var(--t-fast) var(--ease-both),
              background-color var(--t-fast) var(--ease-both);
}
.track:hover .track-add, .track-add:focus-visible { opacity: 1; }
/* A liked track keeps its heart visible: that is a fact about the track, not
 * a control waiting to be found. */
.track-add.heart[aria-pressed='true'] { opacity: 1; color: var(--acc2); }
.track-add:hover { color: var(--text); background: color-mix(in srgb, var(--text) 10%, transparent); }
@media (hover: none) {
  .track-add { opacity: 1; }
}
.icon-btn.danger:hover { color: #f16a6a; }

.link-input {
  width: 100%;
  padding: var(--s-3) var(--s-3);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.link-input:focus { border-color: color-mix(in srgb, var(--acc) 60%, var(--line)); }

.yt-search { display: flex; gap: var(--s-2); align-items: center; }
.yt-search input {
  flex: 1;
  min-width: 0;
  padding: var(--s-3) var(--s-4);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg3);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.yt-search input:focus { border-color: color-mix(in srgb, var(--acc) 60%, var(--line)); }

.yt-results { margin-top: var(--s-3); max-height: 46vh; overflow-y: auto; }
.yt-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--line);
}
.yt-row:last-child { border-bottom: 0; }
.yt-row .t { font-size: 13.5px; font-weight: 650; }
.yt-row .s { font-size: 12px; color: var(--text2); margin-top: var(--s-1); }
.yt-thumb {
  width: 80px;
  height: 45px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--text2) 12%, transparent);
}
/* Queued: the row stays, so a second click is visibly pointless rather than
 * merely refused. */
.btn-pill.done {
  background: color-mix(in srgb, #4fc98a 22%, transparent);
  color: #4fc98a;
  box-shadow: none;
}

/* --------------------------------------------- edit metadata -- */
.field-row { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.field-row > .field { min-width: 0; }

.edit-cover-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0 var(--s-1);
}
.edit-cover-row .edit-cover {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

@media (max-width: 900px) {
  .admin-head { padding: var(--s-3) var(--s-4); }
  .admin-body { padding: var(--s-4) var(--s-4) var(--s-8); }
  .admin-head h1 { font-size: 18px; }

  /* The candidate row runs out of width first: the source and the button
   * drop under the text rather than squeezing the title to nothing. */
  .match-row { flex-wrap: wrap; }
  .match-row .grow { min-width: 0; flex: 1 1 60%; }
  .match-source { flex-direction: row; align-items: center; }
}

/* ── comptes ─────────────────────────────────────────────────────────────── */

/* The registration switch. A real switch rather than a checkbox with a label:
 * the position itself has to say which way it is set, from across the room,
 * because getting it wrong opens the library to anyone with the address. */
.switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: var(--bg3);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background var(--t-mid) var(--ease-both),
              border-color var(--t-mid) var(--ease-both);
}
.switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text2);
  /* Translation on its own line so it composes with nothing else and cannot be
   * clobbered by a transform set elsewhere. */
  transition: translate var(--t-mid) var(--ease-spring),
              background var(--t-mid) var(--ease-both);
}
.switch.on { background: var(--acc); border-color: transparent; }
.switch.on .knob { translate: 20px 0; background: #fff; }
.switch:disabled { opacity: 0.5; cursor: default; }

/* The confirming button of a destructive dialog. Red only here, where the
 * action is one keystroke away and irreversible — not on the row buttons that
 * merely lead to this dialog. */
.btn-primary.danger {
  background: #d94a4a;
  box-shadow: 0 6px 18px rgba(217, 74, 74, 0.3);
}
.btn-primary.danger:hover:not(:disabled) { filter: brightness(1.08); }

/* Destructive actions read as destructive only on approach: a row of red
 * buttons is a row nobody reads, and every one of these sits next to an
 * account somebody uses. */
.btn-ghost.danger { color: var(--text2); }
.btn-ghost.danger:hover:not(:disabled) {
  /* A literal, like .notice.warn above: this palette has no failure token, and
   * inventing one here would leave a single caller defining a convention. */
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.45);
}
.btn-ghost:disabled { opacity: 0.4; cursor: default; }
.btn-ghost:disabled:hover { color: var(--text2); }

.row-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

/* An aside under a setting, for the case where two sources disagree. */
.hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text2);
}

/* The invitation code, shown once. Monospaced and roomy because it will be
 * read aloud or retyped at least as often as it is copied. */
.invite-code {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px;
  letter-spacing: 1.5px;
  text-align: center;
  padding: var(--s-4);
}

@media (max-width: 760px) {
  /* Stacked, because three buttons on one line leave the name a column one
   * word wide. The actions get the row underneath and keep a finger-sized
   * target. Scoped to .account-row so the Système screen, whose rows are a
   * label and a figure, keeps its single line. */
  .account-row { flex-wrap: wrap; }
  .account-row > .grow { flex: 1 0 100%; }
  .account-row .row-actions { width: 100%; justify-content: flex-end; }
}

/* A credited name inside a line of text: readable as a link without becoming
 * a button, because a row of them under every track would shout. */
.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.linklike:hover { color: var(--text); text-decoration: underline; }

/* An artist's portrait is a photograph of a person, not a record sleeve: it
 * crops to the face rather than fitting the whole frame. */
.card.round .cover { background-position: center 22%; }

/* Installed as an app, the interface does not zoom — see lockZoom().
 *
 * pan-x pan-y, never none: `none` would refuse the scroll as well, and the
 * page would simply stop moving. This declines the pinch and the double-tap
 * and leaves every ordinary drag alone, including the one that dismisses the
 * player. */
html.no-zoom {
  touch-action: pan-x pan-y;
  /* Stops the long-press magnifier and the accidental selection that a drag
   * across a track list otherwise produces. Inputs opt back in below, or they
   * become impossible to correct. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
html.no-zoom input,
html.no-zoom textarea,
html.no-zoom [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}
