/* SPOTI — Custom · based on fluent.
   Tokens live here; change them and the whole app follows. */
:root {
  --ink: #1c1917;
  --surface: #fafaf9;
  --paper: #ffffff;              /* card background, above the page surface */
  --accent: #c026d3;
  --radius: 16px;
  --topbar-h: 60px;              /* fixed so a docked sidebar can clear it */
  --sidebar-w: 280px;            /* the docked width; the drawer uses its own */
  --line: 1px;                /* border weight on cards and controls */
  --outline: rgba(28, 25, 23, 0.14);          /* border colour */
  --toggle-border: var(--line) solid var(--outline);  /* the light/dark switch; `none` in some themes */
  --shadow: 0 2px 4px rgb(0 0 0 / 0.15);            /* full box-shadow value, or `none` */
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Typography beyond the family: casing, tracking and weight are what make a
     design system recognisable at a glance. */
  --h-transform: none;
  --h-spacing: normal;
  --h-weight: 600;
  --l-transform: none;   /* buttons and small labels */
  --l-spacing: normal;
  --l-weight: 600;

  /* One colour per person, picked from their name — see app.js. */
  --c1: #e11d48;
  --c2: #3d3d3d;
  --c3: #5c5c5c;
  --c4: #7a7a7a;
  --c5: #2b2b2b;
  --c6: #494949;

  --border: color-mix(in srgb, var(--ink) 16%, transparent);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode. The class is set on <html> by app.js before first paint, so the
   page never flashes the wrong palette. Only the colours change — radius,
   type, and spacing are the same design either way. */
.dark {
  --ink: #fafaf9;
  --surface: #1c1917;
  --paper: #292524;
  --accent: #e879f9;
  --outline: rgba(250, 250, 249, 0.14);
  --shadow: 0 2px 4px rgb(0 0 0 / 0.15);
  --border: color-mix(in srgb, var(--ink) 20%, transparent);
}

.dark body { background: var(--surface); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--surface);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
}

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* ---------- Splash ---------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  animation: splash-lift 0.5s var(--ease) 0.9s both;
}

.splash.is-gone { display: none; }

.splash-name {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: var(--h-weight);
  letter-spacing: var(--h-spacing);
  text-transform: var(--h-transform);
  animation: splash-in 0.4s var(--ease) both;
}

.splash-bar {
  width: 120px;
  height: 2px;
  background: var(--border);
  overflow: hidden;
}

.splash-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  animation: splash-fill 0.85s var(--ease) 0.1s both;
}

@keyframes splash-lift { to { transform: translateY(-101%); } }
@keyframes splash-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes splash-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

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

/* Scoped to the element: <body> also carries a `topbar` class to key the
   layout off, and an unscoped `.topbar` turned the whole page into the bar. */
header.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: var(--line) solid var(--outline);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: var(--h-weight);
  letter-spacing: var(--h-spacing);
  text-transform: var(--h-transform);
  /* The bar has a fixed height so a docked sidebar can clear it, which means a
     long name has to truncate rather than wrap out of it. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex: none;
}

.burger i { display: block; height: 3px; border-radius: 3px; background: var(--ink); }

/* ---------- Avatars ---------- */

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  /* --who is set per row in app.js from the person's name. */
  background: var(--who, var(--accent));
  color: var(--surface);
  border: var(--line) solid var(--outline);
}

.avatar--me { background: var(--accent); }

/* ---------- Light / dark toggle ---------- */

.mode-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
  cursor: pointer;
  color: inherit;
  background: transparent;
  border: var(--toggle-border);
  border-radius: var(--radius);
}

.mode-toggle:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }

/* Sun in light mode, moon in dark — only one is ever drawn. */
.mode-toggle .mt-moon { display: none; }
.dark .mode-toggle .mt-sun,
.dark .mode-toggle .mt-rays { display: none; }
.dark .mode-toggle .mt-moon { display: block; }

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 78vw);
  z-index: 50;
  padding: 20px 0;
  background: var(--surface);
  border-right: var(--line) solid var(--outline);
  transform: translateX(-100%);
  transition: transform 0.32s var(--ease);
}

body.nav-open .sidebar { transform: translateX(0); }

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--h-weight);
  letter-spacing: var(--h-spacing);
  text-transform: var(--h-transform);
  padding: 0 20px 16px;
  border-bottom: var(--line) solid var(--outline);
  margin-bottom: 10px;
}

.side-link {
  display: block;
  padding: 11px 20px;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: var(--l-weight);
  letter-spacing: var(--l-spacing);
  text-transform: var(--l-transform);
  opacity: 0.65;
  border-left: 3px solid transparent;
}

.side-link:hover { opacity: 1; }

.side-link.is-active {
  opacity: 1;
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* The drawer comes over the page, so the page goes back: dimmed and blurred,
   which reads as "this is on top of that" far better than a flat dim alone. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease);
}

body.nav-open .scrim { opacity: 1; pointer-events: auto; }

/* ---------- Layout ----------
   The chrome that exists is decided by the layout picked at creation; these
   rules are inert unless <body> carries the matching class, so one stylesheet
   serves every combination. */

/* Docked on wide viewports, off-canvas below — a drawer is right on a phone
   and wrong on a desktop, and 900px is where the content column stops needing
   the full width. */
/* The drawer and its scrim start below the top bar rather than covering it, so
   the burger that opened it stays visible and can close it again. */
body.topbar .sidebar,
body.topbar .scrim { top: var(--topbar-h); }

/* On the right, when that is the side it was asked for. */
body.sidebar-right .sidebar {
  left: auto;
  right: 0;
  border-right: 0;
  border-left: var(--line) solid var(--outline);
}

body.sidebar-right .sidebar { transform: translateX(100%); }
body.sidebar-right.nav-open .sidebar { transform: translateX(0); }

/* Controls that would have lived in the top bar, when there is not one. */
.floating-controls {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 45;
  display: flex;
  gap: 8px;
}

/* A docked right sidebar outranks these and would sit on top of them, so they
   move to the other corner when that is the layout. */
body.sidebar-right .floating-controls { right: auto; left: 14px; }

/* With no top bar the controls float over the content, so the content starts
   below them instead of underneath them. */
body:not(.topbar) .main { padding-top: 66px; }

.floating-controls .burger,
.floating-controls .mode-toggle {
  background: var(--paper);
  border: var(--line) solid var(--outline);
  border-radius: var(--radius);
}



/* ---------- Footer navigation ---------- */

.footernav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--paper);
  border-top: var(--line) solid var(--outline);
}

.foot-link {
  flex: 1;
  padding: 13px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
  opacity: 0.55;
  border-top: 2px solid transparent;
  margin-top: -1px;
}

.foot-link:hover { opacity: 1; }
.foot-link.is-active { opacity: 1; border-top-color: var(--accent); color: var(--accent); }

/* The footer sits over the page, so the content column and the floating
   button both have to clear it. */
body.footer .main { padding-bottom: 124px; }
body.footer .fab { bottom: 76px; }



/* ---------- Content ---------- */

.main { max-width: 1040px; margin: 0 auto; padding: 28px 18px 40px; }

.lede { margin: 0 0 24px; opacity: 0.65; }

.composer { display: grid; gap: 10px; margin-bottom: 28px; }

/* An author `display` beats the UA stylesheet's rule for [hidden], so the
   attribute needs restating or the composer is always visible. */
.composer[hidden] { display: none; }

.composer-actions { display: flex; gap: 10px; justify-content: flex-end; }

input, textarea {
  font: inherit;
  font-family: var(--font-body);
  color: inherit;
  background: var(--paper);
  border: var(--line) solid var(--outline);
  border-radius: var(--radius);
  padding: 11px 13px;
  width: 100%;
}

input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.btn {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: var(--l-weight);
  letter-spacing: var(--l-spacing);
  text-transform: var(--l-transform);
  cursor: pointer;
  padding: 10px 20px;
  border: var(--line) solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--surface);
  box-shadow: var(--shadow);
}

.btn:hover { filter: brightness(1.12); }

.btn--ghost { background: transparent; color: inherit; border-color: var(--border); }
.btn--ghost:hover { filter: none; border-color: var(--ink); }

/* ---------- Summary ----------
   One series in the accent hue, so no legend is needed — the caption says what
   is plotted. Bars grow from a single zero baseline, carry a rounded data-end
   and a square foot, and are separated by surface gaps rather than strokes. */

.summary { margin-bottom: 28px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.tile {
  background: var(--paper);
  border: var(--line) solid var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.tile-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--h-weight);
  letter-spacing: var(--h-spacing);
  line-height: 1.1;
}

.tile-label {
  font-size: 0.72rem;
  opacity: 0.6;
  margin-top: 2px;
}

.chart { margin: 0; }

.chart figcaption {
  font-size: 0.72rem;
  opacity: 0.6;
  margin-bottom: 10px;
}

.bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 2px;                      /* the surface gap doing the separating */
  height: 118px;
  border-bottom: 1px solid var(--outline);   /* recessive hairline baseline */
}

.bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
}

.bar i {
  display: block;
  width: 100%;
  max-width: 24px;               /* capped: never fill the whole slot */
  background: var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;   /* rounded end, square foot */
  min-height: 2px;
  /* Without this the bar is a shrinkable flex item: a labelled bar gave up
     height to its own label and rendered SHORTER than a smaller unlabelled
     one, which inverts the data the chart is meant to show. */
  flex: none;
}

/* The plot area proper. Bar heights are a percentage of this, not of the whole
   column — measuring against the column made a full-height bar overflow past
   the caption once its label was added. */
.bar-track {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

/* Reserved on every column, labelled or not, so all bars measure against the
   same track and their heights stay comparable. */
.bar-value {
  flex: none;
  height: 1rem;
  line-height: 1rem;
  font-size: 0.68rem;
  opacity: 0.75;
}

.bar-day {
  flex: none;
  font-size: 0.68rem;
  opacity: 0.5;
  margin-top: 6px;
}

.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

.note {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  background: var(--paper);
  border: var(--line) solid var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 13px 15px;
  /* Each row lifts into place as it scrolls in — see app.js. */
  opacity: 0;
  transform: translateY(14px);
}

.note.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.note-text { flex: 1; min-width: 0; }
.note h3 {
  margin: 0 0 3px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: var(--h-weight);
  letter-spacing: var(--h-spacing);
  text-transform: var(--h-transform);
}
.note p { margin: 0; opacity: 0.7; font-size: 0.88rem; white-space: pre-wrap; }
.note-who { font-size: 0.72rem; opacity: 0.5; margin-top: 5px; }

.note-del {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.35;
  font-size: 0.9rem;
  padding: 2px 4px;
  flex: none;
}

.note-del:hover { opacity: 1; color: var(--accent); }

.empty { opacity: 0.5; text-align: center; padding: 40px 0; }

/* ---------- Floating action button ---------- */

.fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 35;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: var(--line) solid transparent;
  background: var(--accent);
  color: var(--surface);
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--pop);
}

.fab:hover { transform: scale(1.06); }
.fab.is-active { transform: rotate(45deg); }

@media (prefers-reduced-motion: reduce) {
  .splash, .splash-name, .splash-bar i { animation: none; }
  .sidebar, .scrim, .note, .fab { transition: none; }
  .note { opacity: 1; transform: none; }
}

/* ==================================================================
   SPOTI
   The whole app is built on one idea: a level meter. It is the logo,
   it is the scrubber under the player, and it is what a row shows
   instead of its number while it plays. Everything else stays quiet.
   ================================================================== */

:root {
  --player-h: 132px;
  --meter: cubic-bezier(0.4, 0, 0.6, 1);
}

body { padding-bottom: 0; }
body.has-player .main { padding-bottom: calc(var(--player-h) + 28px); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Logo ----------
   Four bars in a rounded frame. They hold still until something plays,
   then the whole mark becomes a meter. */

.logo-mark { width: 30px; height: 30px; flex: none; display: block; }
.logo-mark--xl { width: 46px; height: 46px; }

.lm-frame {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  opacity: 0.9;
}

.lm-bars rect {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
}

.logo-mark.is-playing .lm-bars rect { animation: lm-pulse 1.1s var(--meter) infinite; }
.logo-mark.is-playing .lm-bars rect:nth-child(1) { animation-delay: -0.9s; }
.logo-mark.is-playing .lm-bars rect:nth-child(2) { animation-delay: -0.4s; }
.logo-mark.is-playing .lm-bars rect:nth-child(3) { animation-delay: -0.7s; }
.logo-mark.is-playing .lm-bars rect:nth-child(4) { animation-delay: -0.2s; }

@keyframes lm-pulse {
  0%, 100% { transform: scaleY(0.42); }
  50% { transform: scaleY(1); }
}

.wordmark { letter-spacing: 0.02em; }

/* ---------- Sidebar extras ---------- */

.side-section { margin-top: 22px; padding: 0 20px; }

.side-section .eyebrow { margin: 0 0 8px; }

.side-playlists { display: grid; gap: 1px; }

.side-playlist {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  opacity: 0.62;
}

.side-playlist:hover { opacity: 1; }
.side-playlist.is-active { opacity: 1; color: var(--accent); }
.side-playlist span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-playlist small { margin-left: auto; opacity: 0.6; font-size: 0.74rem; }

.side-empty { font-size: 0.8rem; opacity: 0.45; }

.side-foot {
  margin-top: 24px;
  padding: 16px 20px 0;
  border-top: var(--line) solid var(--outline);
  font-size: 0.74rem;
  opacity: 0.55;
  display: grid;
  gap: 3px;
}

.sidebar { display: flex; flex-direction: column; overflow-y: auto; }
.sidebar .side-foot { margin-top: auto; }

/* ---------- Page head ---------- */

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0.5;
  margin: 0 0 8px;
}

.page-head { margin-bottom: 22px; }

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  font-weight: var(--h-weight);
  line-height: 1.15;
  margin: 0 0 8px;
}

.page-meta { margin: 0; opacity: 0.6; font-size: 0.88rem; }

/* ---------- Toolbar ---------- */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search { position: relative; flex: 1 1 240px; min-width: 0; }

.search .kit-input { padding-left: 38px; }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  opacity: 0.45;
  pointer-events: none;
}

.sort-wrap { flex: 0 1 170px; }

/* ---------- Track list ---------- */

.tracks { list-style: none; margin: 0; padding: 0; }

.track {
  display: grid;
  grid-template-columns: 28px 46px minmax(0, 1fr) minmax(0, 0.62fr) 48px auto;
  align-items: center;
  gap: 14px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border-bottom: var(--line) solid var(--outline);
  cursor: default;
}

.track:last-child { border-bottom: 0; }
.track:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.track.is-current { background: color-mix(in srgb, var(--accent) 9%, transparent); }

.track-index {
  display: grid;
  place-items: center;
  height: 28px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.4;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  cursor: pointer;
}

.track-index .ti-num { display: block; }
.track-index .ti-play { display: none; width: 13px; height: 15px; fill: currentColor; }

.track:hover .track-index { opacity: 1; }
.track:hover .track-index .ti-num { display: none; }
.track:hover .track-index .ti-play { display: block; }

.track.is-current .track-index { opacity: 1; color: var(--accent); }
.track.is-current:not(:hover) .track-index .ti-num { display: none; }
.track.is-current .eq { display: flex; }
.track:hover .eq { display: none; }

/* The row's own meter — three bars, moving only while this track plays. */
.eq { display: none; align-items: flex-end; gap: 2px; height: 14px; }
.eq i {
  width: 3px;
  background: var(--accent);
  border-radius: 1px;
  height: 100%;
  transform-origin: bottom;
  animation: eq-bounce 0.9s var(--meter) infinite;
}
.eq i:nth-child(2) { animation-delay: -0.45s; }
.eq i:nth-child(3) { animation-delay: -0.2s; }
.track.is-paused .eq i { animation-play-state: paused; }

@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.28); }
  50% { transform: scaleY(1); }
}

.track-text { min-width: 0; }

/* The title is the play control — always there, whatever the width. */
.track-play {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}

.track-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track.is-current .track-title { color: var(--accent); }

.track-artist {
  margin: 0;
  font-size: 0.79rem;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-album {
  font-size: 0.8rem;
  opacity: 0.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-dur {
  font-size: 0.79rem;
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.track-actions { display: flex; align-items: center; gap: 2px; }

/* ---------- Sleeve ----------
   Real artwork when the file carried some; otherwise a meter drawn from
   the track's own name, so every sleeve is different and stays put. */

.sleeve {
  position: relative;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  border: var(--line) solid var(--outline);
}

.sleeve img { width: 100%; height: 100%; object-fit: cover; display: block; }

.sleeve--gen {
  background:
    linear-gradient(155deg, color-mix(in srgb, var(--accent) 22%, var(--paper)), var(--paper) 78%);
}

.sleeve-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 8%;
  padding: 22% 16% 20%;
}

.sleeve-bars i {
  flex: 1;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  opacity: 0.85;
}

.sleeve--sm { width: 44px; height: 44px; }

/* The player's slot before anything is playing: an empty meter. */
.sleeve--empty {
  border-style: dashed;
  background: transparent;
}

.sleeve--empty::after {
  content: "";
  position: absolute;
  left: 26%;
  right: 26%;
  bottom: 32%;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0.2;
}
.sleeve--lg { width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius); }

/* ---------- Icon buttons ---------- */

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.55;
  text-decoration: none;
}

.icon-btn:hover { opacity: 1; background: color-mix(in srgb, var(--ink) 8%, transparent); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] { opacity: 1; color: var(--accent); }
.icon-btn.is-on { opacity: 1; color: var(--accent); }
.fav-btn.is-on svg { fill: var(--accent); stroke: var(--accent); }
.icon-btn[aria-disabled="true"] { opacity: 0.25; pointer-events: none; }

.play-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--pop);
}

.play-btn:hover { transform: scale(1.07); }
.play-btn svg { width: 19px; height: 19px; fill: currentColor; }

/* ---------- Player ---------- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 36;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    "wave wave wave"
    "now controls side";
  align-items: center;
  gap: 4px 16px;
  padding: 0 16px 14px;
  background: var(--paper);
  border-top: var(--line) solid var(--outline);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

/* The scrubber is the signature: a bar meter of the track, filling as it
   plays, not a line with a dot on it. */
.player-wave {
  grid-area: wave;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 10px;
}

.wave {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 34px;
  cursor: pointer;
  touch-action: none;
}

.wave-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

.wave-bars i {
  flex: 1;
  min-width: 1px;
  border-radius: 1px;
  background: var(--ink);
  opacity: 0.18;
  height: 20%;
  transition: height 0.4s var(--ease);
}

.wave-bars--fill {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.12s linear;
}

.wave-bars--fill i { background: var(--accent); opacity: 1; }

.wave-head {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0;
  transform: translateX(-1px);
  transition: opacity 0.15s var(--ease);
}

.wave:hover .wave-head, .wave:focus-visible .wave-head { opacity: 0.55; }

.player-time {
  font-size: 0.72rem;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 34px;
}

.player-now {
  grid-area: now;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-text { min-width: 0; }

.player-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-artist {
  margin: 0;
  font-size: 0.76rem;
  opacity: 0.55;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-controls {
  grid-area: controls;
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-side {
  grid-area: side;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.volume {
  width: 96px;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  height: 18px;
  cursor: pointer;
}

.volume:focus { outline: none; }
.volume::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 20%, transparent);
}
.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--ink);
}
.volume::-moz-range-track { height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 20%, transparent); }
.volume::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--ink); }

/* ---------- Dropzone & uploads ---------- */

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 46px 24px;
  text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--ink) 24%, transparent);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); }
.dropzone.is-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
}

.drop-icon { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { margin: 6px 0 0; font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.drop-help { margin: 0; font-size: 0.82rem; opacity: 0.55; max-width: 34ch; }

/* Dropping anywhere works, not just on the panel. */
body.is-dragging::after {
  content: "Drop to add to your library";
  position: fixed;
  inset: 12px;
  z-index: 70;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.uploads { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px; }

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line) solid var(--outline);
}

.upload-name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { font-size: 0.74rem; opacity: 0.55; font-variant-numeric: tabular-nums; }
.upload-row.is-error .upload-state { color: var(--accent); opacity: 1; }

.upload-bar {
  grid-column: 1 / -1;
  height: 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  overflow: hidden;
}

.upload-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s linear;
}

/* ---------- Playlists ---------- */

.new-playlist { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.new-playlist .kit-input { flex: 1 1 220px; min-width: 0; }

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}

.playlist-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line) solid var(--outline);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: transform 0.2s var(--ease);
}

.playlist-card:hover { transform: translateY(-2px); }

.playlist-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-count { margin: 0; font-size: 0.76rem; opacity: 0.55; }

/* Always there rather than hover-only: on a phone there is no hover to
   reveal it with. */
.playlist-card .icon-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--paper);
  opacity: 0.5;
}

.playlist-card:hover .icon-btn, .playlist-card:focus-within .icon-btn { opacity: 0.9; }

/* ---------- Popover ---------- */

.popover {
  position: fixed;
  z-index: 80;
  min-width: 208px;
  max-width: min(280px, 92vw);
  padding: 6px;
  border-radius: var(--radius);
  background: var(--paper);
  border: var(--line) solid var(--outline);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.18);
  animation: pop-in 0.14s var(--ease);
  max-height: 60vh;
  overflow-y: auto;
}

@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } }

.popover button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.popover button:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.popover button svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.6; }
.popover .pop-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.16em; opacity: 0.45; padding: 10px 11px 5px; font-family: var(--font-display); }
.popover .pop-sep { height: var(--line); background: var(--outline); margin: 5px 0; }
.popover .is-danger:hover { color: var(--accent); }

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

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.overlay[hidden] { display: none; }
.overlay .kit-modal { width: min(400px, 100%); box-shadow: 0 20px 50px rgb(0 0 0 / 0.3); }
.modal-fields { display: grid; gap: 12px; margin-bottom: 18px; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 16px);
  transform: translateX(-50%);
  z-index: 95;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 92vw;
}

.toasts .kit-toast {
  margin: 0;
  animation: toast-in 0.22s var(--ease);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Empty states ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 56px 20px;
  text-align: center;
  opacity: 1;
}

.empty-title { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.empty-help { font-size: 0.85rem; opacity: 0.55; max-width: 40ch; }
.empty .kit-btn { margin-top: 12px; }

/* ---------- Responsive ---------- */

@media (min-width: 900px) {
  /* Wide enough for the nav to stay put: dock it full-height and let the
     top bar keep only the controls. */
  body.has-sidebar { padding-left: var(--sidebar-w); }
  body.has-sidebar .sidebar { top: 0; transform: none; }
  body.has-sidebar .burger,
  body.has-sidebar .scrim { display: none; }
  body.has-sidebar .topbar { justify-content: flex-end; }
  body.has-sidebar .topbar-title { display: none; }
  body.has-sidebar .player { left: var(--sidebar-w); }
}

@media (max-width: 860px) {
  .track {
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 8px 6px;
  }
  .track-index, .track-album, .track-dur { display: none; }
}

@media (max-width: 720px) {
  :root { --player-h: 158px; }

  .player {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "wave wave"
      "now side"
      "controls controls";
    gap: 2px 10px;
    padding: 0 12px 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .player-controls { justify-content: center; padding-top: 2px; }
  .player-side #btn-mute, .player-side .volume { display: none; }
  .wave { height: 28px; }
  .toasts { bottom: calc(var(--player-h) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  .logo-mark.is-playing .lm-bars rect,
  .eq i { animation: none; }
  .eq i { transform: scaleY(0.7); }
  .playlist-card, .play-btn, .wave-bars--fill { transition: none; }
  .popover, .toasts .kit-toast { animation: none; }
}
