:root {
  --bg-page: #efeff1;
  --bg-subtle: #e8e8eb;
  --surface: #ffffff;
  --surface-muted: #f5f5f6;
  --text: #1a1a1e;
  --text-secondary: #5c5c66;
  --text-muted: #7a7a86;
  --text-faint: #a1a1ad;
  --accent: #ff6b4a;
  --accent-hover: #ef5a3a;
  --accent-mid: #ff9474;
  --accent-soft: rgba(255, 107, 74, 0.12);
  --accent-ring: rgba(255, 107, 74, 0.38);
  --violet: #ffb8a8;
  --danger: #dc2626;
  --border: rgba(26, 26, 30, 0.08);
  --border-strong: rgba(26, 26, 30, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --playlist-width: 228px;
  --now-playing-width: 312px;
  --player-height: 100px;
  --player-chrome-bg: rgba(255, 255, 255, 0.97);
  /* Tail padding inside scroll areas (player is in flex flow — no need to match bar height). */
  --content-scroll-pad: calc(24px + env(safe-area-inset-bottom, 0px));
  /* Mobile docked MV sheet: offset from viewport bottom (clears in-flow player). */
  --player-scroll-padding: calc(var(--player-height) + 28px + env(safe-area-inset-bottom, 0px));
  /* Air between docked MV sheet and player bar (avoids rounding / border clipping the video). */
  --mv-dock-gap: 10px;
  --mv-dock-bottom: calc(var(--player-height) + var(--mv-dock-gap) + env(safe-area-inset-bottom, 0px));
  --header-height: 64px;
  --font: "Source Sans 3", system-ui, -apple-system, sans-serif;
  --font-display: "Sora", var(--font);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --discover-green: #ff6b4a;
  --discover-green-hover: #ef5a3a;
  --discover-bg-top: #faf8f7;
  --discover-bg-mid: #f5f4f4;
  --discover-bg-bottom: #fafafa;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--bg-page);
  background-image: radial-gradient(circle at 0% 0%, rgba(255, 107, 74, 0.06) 0%, transparent 48%),
    radial-gradient(circle at 100% 20%, rgba(255, 148, 116, 0.05) 0%, transparent 42%);
  background-attachment: fixed;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Keep scrollbar tracks transparent across app surfaces. */
* {
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background: transparent;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

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

.app.app--locked {
  visibility: hidden;
  pointer-events: none;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 20%, rgba(255, 107, 74, 0.18), transparent 45%),
    rgba(10, 12, 18, 0.92);
}

/* `display: grid` above wins over the default [hidden] rule — force the gate off when hidden. */
.auth-gate[hidden] {
  display: none !important;
}

/* While the sign-in `<dialog>` is open, hide the welcome gate so two cards/backdrops never stack. */
html.auth-dialog-open .auth-gate {
  display: none !important;
  pointer-events: none;
}

.auth-gate__card {
  width: min(480px, 100%);
  background: #ffffff;
  border-radius: 16px;
  padding: 26px 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-gate__card h1 {
  margin: 0 0 8px;
}

.auth-gate__card p {
  margin: 0 0 18px;
  color: var(--text-secondary);
}

.auth-gate__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* ——— Top header ——— */
.app-header {
  flex: none;
  height: var(--header-height);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px 16px;
  padding: 0 20px 0 20px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header__start {
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-header__search-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  padding: 0 8px;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  height: 46px;
  padding: 0 14px 0 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.header-search:focus-within {
  border-color: rgba(255, 107, 74, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.12);
  background: #fff;
}

.header-search__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.85;
}

.header-search:focus-within .header-search__icon {
  color: var(--text-secondary);
}

.header-search__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  outline: none;
}

.header-search__input::placeholder {
  color: var(--text-faint);
}

.header-search__trail {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-right: -4px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.header-search__trail:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.03em;
  color: var(--text);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px 8px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  background: transparent;
  border: none;
  box-shadow: none;
  transition: color 0.18s var(--ease-out), background 0.18s var(--ease-out);
  position: relative;
}

.nav-link:hover:not(.is-active) {
  color: var(--text);
  background: rgba(26, 26, 30, 0.04);
}

.nav-link.is-active {
  color: var(--accent);
  background: transparent;
}

.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.35em;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
}

.nav-link.is-active:hover {
  color: var(--accent-hover);
  background: transparent;
}

.nav-link.is-active:hover::before {
  background: var(--accent-hover);
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

.app-header__end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-width: 0;
}

.app-header__chevrons {
  display: flex;
  gap: 6px;
}

.app-header__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.profile-menu {
  position: relative;
}

.profile-menu__trigger {
  list-style: none;
  cursor: pointer;
}

.profile-menu__trigger::-webkit-details-marker {
  display: none;
}

.profile-menu__trigger::marker {
  content: "";
}

.profile-menu__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-sm);
}

.profile-menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 140px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 80;
}

.profile-menu__item {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.profile-menu__item:hover {
  background: var(--accent-soft);
}

.header-playlists-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.header-playlists-btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.header-playlists-btn:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

.header-playlists-btn__ico {
  display: block;
}

.chevron {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.12s;
}

.chevron:not(:disabled):hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.chevron:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s, background 0.15s, border-color 0.15s,
    color 0.15s;
}

.btn--ghost {
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  background: transparent;
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--text-faint);
}

.btn--solid {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-mid) 100%);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm), 0 2px 12px rgba(255, 107, 74, 0.28);
}

.btn--solid:hover {
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 4px 18px rgba(255, 107, 74, 0.32);
}

/* ——— Workspace: playlist | main | now playing (Spotify-style) ——— */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: var(--playlist-width) minmax(0, 1fr);
  min-height: 0;
}

.workspace--now-playing {
  grid-template-columns: var(--playlist-width) minmax(0, 1fr) var(--now-playing-width);
}

.workspace--hide-playlists {
  grid-template-columns: minmax(0, 1fr);
}

.workspace--hide-playlists.workspace--now-playing {
  grid-template-columns: minmax(0, 1fr) var(--now-playing-width);
}

.workspace--hide-playlists > .playlist-panel {
  display: none;
}

/* Desktop: lock layout to the viewport so only .main scrolls — video column stays visible. */
@media (min-width: 961px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .workspace {
    min-height: 0;
    overflow: hidden;
  }

  .workspace > .playlist-panel,
  .workspace > .main,
  .workspace > .now-playing-panel {
    min-height: 0;
  }

  /* Keep the frame pinned when scrolling title/artist inside the right column. */
  .now-playing-panel__frame {
    position: sticky;
    top: 0;
    z-index: 2;
    align-self: flex-start;
    width: 100%;
  }
}

.playlist-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px var(--content-scroll-pad) 18px;
  overflow-y: auto;
}

.playlist-panel__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px 4px;
}

.playlist-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.playlist-panel__close-sheet {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.playlist-panel__close-sheet:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.playlist-panel__close-sheet:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

.playlist-panel__create {
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 5px 10px;
}

.playlist-panel__list li + li {
  margin-top: 2px;
}

/* Guest / static playlist names only — full-width row buttons */
.playlist-panel__list > li > button {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
}

.playlist-panel__list > li > button:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.playlist-panel__item-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border-radius: var(--radius-sm);
}

.playlist-panel__item-row.is-active {
  background: rgba(255, 107, 74, 0.18);
}

.playlist-panel__item-row:hover {
  background: var(--accent-soft);
}

.playlist-panel__open {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: auto;
  text-align: left;
  padding: 10px 8px 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
}

.playlist-panel__open:hover {
  color: var(--text);
  background: transparent;
}

.playlist-panel__open.is-active {
  color: var(--text);
  background: transparent;
}

.playlist-panel__vis {
  flex: 0 0 auto;
  min-width: 62px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 6px;
  border-radius: 999px;
  line-height: 1;
  text-transform: uppercase;
  text-align: center;
}

.playlist-panel__vis--pub {
  color: #166534;
  background: rgba(34, 197, 94, 0.18);
}

.playlist-panel__vis--prv {
  color: var(--text-secondary);
  background: rgba(26, 26, 30, 0.06);
}


.playlist-panel__overflow {
  flex: 0 0 auto;
  position: relative;
  align-self: stretch;
  display: flex;
}

.playlist-panel__more {
  width: 36px;
  height: 100%;
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  list-style: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  user-select: none;
}

.playlist-panel__more::-webkit-details-marker {
  display: none;
}

.playlist-panel__more::marker {
  content: "";
}

.playlist-panel__more:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.playlist-panel__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 60;
  min-width: 9.5rem;
  max-width: 12.5rem;
  max-height: min(280px, calc(100vh - 20px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable both-edges;
  padding: 6px 10px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.playlist-panel__menu-item {
  width: 100%;
  text-align: left;
  padding: 9px 14px 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
}

.playlist-panel__menu-item:hover {
  background: var(--accent-soft);
}

.menu-item__icon {
  flex: 0 0 14px;
  width: 14px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text-muted);
}

.menu-item__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-playlist-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(10, 14, 20, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.playlist-overflow-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(10, 14, 20, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.playlist-track-remove {
  margin: 8px 12px 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.playlist-track-remove:hover {
  color: var(--danger);
}

.auth-dialog {
  border: none;
  border-radius: 14px;
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  box-shadow: var(--shadow-lg);
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.auth-dialog__form {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.auth-dialog__label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.auth-dialog__label input {
  padding: 9px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

/* Auth dialog status / errors — compact “label” chips */
.auth-dialog__notice {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.auth-dialog__notice--success {
  color: #166534;
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.auth-dialog__notice--info {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #93c5fd;
}

.auth-dialog__notice--neutral {
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.auth-dialog__notice--warn {
  color: #92400e;
  background: #fffbeb;
  border-color: #fcd34d;
}

.auth-dialog__notice--error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.auth-dialog__switch {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.auth-dialog__forgot-btn {
  justify-self: start;
  padding: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-hover);
}

.auth-dialog__switch-btn {
  color: var(--accent-hover);
  font-weight: 700;
  margin-left: 4px;
  padding: 0;
}

.auth-dialog__switch-btn:hover {
  text-decoration: underline;
}

.auth-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.diag-dialog {
  border: none;
  border-radius: 14px;
  width: min(680px, calc(100vw - 24px));
  padding: 0;
  box-shadow: var(--shadow-lg);
}

.diag-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.diag-dialog__form {
  padding: 16px;
  display: grid;
  gap: 10px;
}

.diag-dialog__form h2 {
  margin: 0;
}

.diag-dialog__content {
  margin: 0;
  max-height: min(56vh, 420px);
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #0b0b0e;
  color: #f3f4f6;
  padding: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.diag-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.queue-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0, 0, 0, 0.5);
}

.queue-preview {
  position: fixed;
  right: 22px;
  bottom: calc(var(--player-height) + 18px + env(safe-area-inset-bottom, 0px));
  width: min(420px, calc(100vw - 24px));
  max-height: min(74vh, 760px);
  z-index: 121;
  background: #0b0b0e;
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-preview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 10px;
}

.queue-preview__tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.queue-preview__tab {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}

.queue-preview__tab.is-active {
  color: #fff;
  border-bottom-color: var(--discover-green);
}

.queue-preview__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
}

.queue-preview__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.queue-preview__content {
  overflow-y: auto;
  padding: 4px 14px 14px;
  overflow-anchor: none;
}

.queue-preview__section-title {
  margin: 12px 0 10px;
  font-size: 1.75rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.queue-preview__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-preview__item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 4px 6px;
  user-select: none;
  transition: transform 0.16s var(--ease-out);
  will-change: transform;
}

.queue-preview__item--swiping {
  /* Red feedback grows as swipe distance increases (set from JS via --swipe-progress). */
  background: rgba(220, 38, 38, calc(0.08 + (var(--swipe-progress, 0) * 0.34)));
}

.queue-preview__item[draggable="true"] {
  cursor: grab;
  touch-action: pan-y;
}

.queue-preview__item img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #1a1a1e;
}

.queue-preview__item-main {
  min-width: 0;
}

.queue-preview__item-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-preview__item-sub {
  margin: 2px 0 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-preview__item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px;
  border-radius: 8px;
  touch-action: pan-y;
}

.queue-preview__drag-hint {
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.queue-preview__item--dragging {
  opacity: 0.45;
}

.queue-preview__item--drop-before {
  box-shadow: inset 0 2px 0 var(--discover-green);
}

.queue-preview__item--drop-after {
  box-shadow: inset 0 -2px 0 var(--discover-green);
}

.queue-preview__action-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1;
}

.queue-preview__action-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.queue-preview__action-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.queue-preview__action-btn--danger:hover:not(:disabled) {
  color: #fff;
  background: rgba(220, 38, 38, 0.8);
  border-color: rgba(220, 38, 38, 0.9);
}

.queue-preview__empty {
  margin: 10px 0 2px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.7);
}

@media (max-width: 900px) {
  .queue-preview {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: calc(var(--player-height) + 12px + env(safe-area-inset-bottom, 0px));
    max-height: min(68vh, 680px);
  }
  /* Mobile uses swipe-left to remove. */
  .queue-preview .queue-preview__action-btn--danger {
    display: none;
  }
  /* Make add-to-queue/playlist popover easier to tap on phones. */
  .track-playlist-menu.playlist-panel__menu {
    min-width: min(86vw, 18rem);
    max-width: min(92vw, 21rem);
    max-height: min(46vh, 360px);
    padding: 8px 10px 8px 8px;
  }
  .playlist-overflow-menu.playlist-panel__menu {
    min-width: min(86vw, 18rem);
    max-width: min(92vw, 21rem);
    max-height: min(46vh, 360px);
    padding: 8px 10px 8px 8px;
  }
  .track-playlist-menu .playlist-panel__menu-item {
    min-height: 44px;
    padding: 11px 14px 11px 12px;
    font-size: 0.95rem;
    line-height: 1.25;
  }
  .playlist-overflow-menu .playlist-panel__menu-item {
    min-height: 44px;
    padding: 11px 14px 11px 12px;
    font-size: 0.95rem;
    line-height: 1.25;
  }
  .track-playlist-menu .menu-item__icon {
    flex-basis: 18px;
    width: 18px;
    font-size: 1.05rem;
  }
}

/* Mobile app-like feel: hide browser focus rings/highlights on touch devices. */
@media (hover: none) and (pointer: coarse) {
  *:focus,
  *:focus-visible {
    outline: none !important;
    box-shadow: none !important;
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

.main {
  position: relative;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-bottom: var(--content-scroll-pad);
  background: var(--surface-muted);
  border-left: none;
}

.main.main--lyrics-open {
  overflow: hidden;
}

/* Don’t paint discover / search / library under the lyrics sheet (fixes bleed-through when scrolling). */
.main.main--lyrics-open > :not(.lyrics-view) {
  visibility: hidden;
  pointer-events: none;
}

/* ——— Lyrics (Spotify-style, desktop + mobile) ——— */
.lyrics-view {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  isolation: isolate;
  color: #f4f4f5;
  background: #060608;
  padding-bottom: var(--content-scroll-pad);
  box-sizing: border-box;
}

.lyrics-view[hidden] {
  display: none !important;
}

.lyrics-view--loading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 3px;
  z-index: 20;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 107, 74, 0.1) 35%,
    rgba(255, 107, 74, 0.95) 50%,
    rgba(255, 107, 74, 0.1) 65%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: lyrics-fetch-bar 0.95s linear infinite;
  pointer-events: none;
}

@keyframes lyrics-fetch-bar {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -120% 0;
  }
}

.lyrics-view__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 107, 74, 0.22) 0%, transparent 55%),
    radial-gradient(90% 60% at 80% 100%, rgba(120, 80, 200, 0.12) 0%, transparent 50%),
    linear-gradient(180deg, #14141a 0%, #0a0a0d 45%, #060608 100%);
  pointer-events: none;
}

.lyrics-view__head {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 12px;
  gap: 0;
}

.lyrics-view__close {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s var(--ease-out);
}

.lyrics-view__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.04);
}

.lyrics-view__scroll-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  /* No mask — masks can composite oddly and reveal content behind this layer. */
}

.lyrics-view__scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.lyrics-view__scroll::-webkit-scrollbar {
  width: 6px;
}

.lyrics-view__scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 99px;
}

.lyrics-view__lines {
  max-width: 42rem;
  margin: 0 auto;
  padding: 24px 28px 120px;
  text-align: center;
}

.lyrics-view__lines--pending .lyrics-line {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
}

.lyrics-view__lines--pending .lyrics-line.is-active {
  color: rgba(255, 255, 255, 0.95);
}

.lyrics-line {
  margin: 0;
  padding: 0.55em 12px;
  font-size: clamp(1.5rem, 4.2vw, 2.25rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.28);
  transition: color 0.35s var(--ease-out), transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
  transform: scale(0.96);
  opacity: 0.85;
}

.lyrics-line.is-active {
  color: #fff;
  transform: scale(1);
  opacity: 1;
}

.lyrics-line.is-past {
  color: rgba(255, 255, 255, 0.14);
  transform: scale(0.92);
  opacity: 0.65;
}

.lyrics-line.is-soon {
  color: rgba(255, 255, 255, 0.38);
}

@media (max-width: 720px) {
  .lyrics-view__lines {
    padding: 16px 20px 100px;
  }

  .lyrics-line {
    font-size: clamp(1.35rem, 6vw, 1.85rem);
    padding: 0.5em 8px;
  }
}

/* ——— Now playing / music video (right column, Spotify-style) ——— */
.now-playing-panel[hidden] {
  display: none !important;
}

.now-playing-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #121214;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  color: #f4f4f5;
  overflow: hidden;
}

.now-playing-panel__inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 14px 20px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.now-playing-panel__frame {
  position: relative;
  width: 100%;
  flex: 0 1 auto;
  aspect-ratio: 9 / 16;
  min-height: 220px;
  max-height: min(calc(100vh - var(--header-height) - var(--player-height) - 160px), 520px);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0a0a0b;
}

.now-playing-panel__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.now-playing-panel__media .now-playing-panel__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s var(--ease-out);
}

.now-playing-panel__media .now-playing-panel__youtube-embed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  transition: opacity 0.2s var(--ease-out);
}

.now-playing-panel__media .now-playing-panel__video.now-playing-panel__video--art-mode {
  opacity: 0;
}

.now-playing-panel__media .now-playing-panel__youtube-embed.now-playing-panel__youtube-embed--art-mode {
  opacity: 0;
}

.now-playing-panel__media .now-playing-panel__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out);
  pointer-events: none;
}

.now-playing-panel__media .now-playing-panel__poster.now-playing-panel__poster--visible {
  opacity: 1;
}

.now-playing-panel__fullscreen {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, transform 0.15s var(--ease-out);
}

.now-playing-panel__fullscreen:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: scale(1.05);
}

.now-playing-panel__fs-ico {
  width: 20px;
  height: 20px;
}

.now-playing-panel__fs-ico--close {
  display: none;
}

.now-playing-panel__fullscreen.is-fullscreen .now-playing-panel__fs-ico--open {
  display: none;
}

.now-playing-panel__fullscreen.is-fullscreen .now-playing-panel__fs-ico--close {
  display: block;
}

.now-playing-panel__frame:fullscreen,
.now-playing-panel__frame:-webkit-full-screen {
  max-height: none;
  min-height: 100%;
  aspect-ratio: auto;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: #000;
}

.now-playing-panel__frame:fullscreen .now-playing-panel__media .now-playing-panel__video,
.now-playing-panel__frame:-webkit-full-screen .now-playing-panel__media .now-playing-panel__video {
  object-fit: contain;
}

.now-playing-panel__frame:fullscreen .player.player--fs-overlay,
.now-playing-panel__frame:-webkit-full-screen .player.player--fs-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  border-top: none;
  background: linear-gradient(to top, rgba(7, 10, 16, 0.92), rgba(7, 10, 16, 0.6));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.now-playing-panel__frame:fullscreen .player.player--fs-overlay .player__song,
.now-playing-panel__frame:-webkit-full-screen .player.player--fs-overlay .player__song {
  color: #fff;
}

.now-playing-panel__frame:fullscreen .player.player--fs-overlay .player__artist,
.now-playing-panel__frame:-webkit-full-screen .player.player--fs-overlay .player__artist {
  color: rgba(255, 255, 255, 0.78);
}

.now-playing-panel__video:fullscreen,
.now-playing-panel__video:-webkit-full-screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.now-playing-panel__switch {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #0f0f10;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s var(--ease-out), background 0.15s;
}

.now-playing-panel__switch:hover {
  transform: translateX(-50%) scale(1.03);
  background: #f0f0f2;
}

.now-playing-panel__meta {
  flex-shrink: 0;
  padding: 0 2px;
}

.now-playing-panel__title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #fff;
}

.now-playing-panel__artist {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}

.now-playing-panel__minimize {
  display: none;
}

/* ——— Discover (home) — light hub ——— */
.discover {
  /* Fill #main-scroll so .main’s surface-muted band doesn’t show as a false “empty panel” below the hub. */
  min-height: 100%;
  color: var(--text);
  background: linear-gradient(
    185deg,
    var(--discover-bg-top) 0%,
    #f2f0ef 18%,
    var(--discover-bg-mid) 42%,
    var(--discover-bg-bottom) 100%
  );
  background-attachment: local;
}

.discover__inner {
  padding: 20px 28px 8px;
  max-width: 1920px;
  margin: 0 auto;
}

.discover__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.chip {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
}

.chip:hover {
  background: #fff;
  border-color: var(--border-strong);
}

.chip.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-mid));
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.discover-hero {
  margin-bottom: 8px;
}

.discover-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  margin: 0 0 20px;
  line-height: 1.1;
  color: var(--text);
}

.discover-spotlights {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.discover-hub-empty {
  margin: 0;
  padding: 16px 4px 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text-secondary);
  max-width: 38rem;
}

.discover-hub-empty--hero {
  padding-top: 8px;
  padding-bottom: 4px;
}

.discover-section .discover-hub-empty {
  padding: 12px 4px 20px;
}

.discover-spotlights__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.discover-spotlights__more {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.discover-spotlight {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 10px 14px 10px 10px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  min-width: 0;
  overflow: hidden;
}

.discover-spotlight:hover {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.discover-spotlight__img {
  width: 88px;
  height: 88px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

.discover-spotlight__text {
  flex: 1;
  min-width: 0;
}

.discover-spotlight__eyebrow {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.discover-spotlight__title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-spotlight__artist {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-spotlight__play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--discover-green);
  color: #0a0a0a;
  opacity: 0;
  transform: translateY(6px) scale(0.92);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), background 0.15s;
  box-shadow: 0 6px 20px rgba(29, 185, 84, 0.35);
}

.discover-spotlight:hover .discover-spotlight__play {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.discover-spotlight__play:hover {
  background: var(--discover-green-hover);
  transform: translateY(0) scale(1.05);
}

.discover-quick {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, box-shadow 0.18s;
  min-height: 72px;
  height: 72px;
}

.discover-quick:hover {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: var(--shadow-md);
}

.discover-quick img {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.discover-quick__title {
  flex: 1;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.3;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discover-quick__play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--discover-green);
  color: #0a0a0a;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s var(--ease-out);
  box-shadow: 0 4px 16px rgba(29, 185, 84, 0.3);
}

.discover-quick:hover .discover-quick__play {
  opacity: 1;
}

.discover-section {
  padding-top: 28px;
}

.discover-section .section__head h2 {
  color: var(--text);
  font-size: 1.35rem;
}

.discover-section .section__show {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.discover-section .section__show:hover {
  color: var(--accent-hover);
}

.discover .card-row {
  gap: 18px;
}

.discover .card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.discover .card:hover {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.discover .card__img-wrap {
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.discover .card__title {
  color: var(--text);
}

.discover .card__desc {
  color: var(--text-muted);
}

.discover .card__play {
  background: var(--discover-green);
  color: #0a0a0a;
  padding: 0;
  box-shadow: 0 6px 18px rgba(29, 185, 84, 0.35);
}

.discover .card__play:hover {
  background: var(--discover-green-hover);
  filter: none;
}

.discover .card__play-svg {
  display: block;
  margin-left: 2px;
}

/* Search & library cards: match hub (green play) */
#view-search .card__play,
#view-library .card__play {
  background: var(--discover-green);
  color: #0a0a0a;
  padding: 0;
  box-shadow: 0 6px 18px rgba(29, 185, 84, 0.3);
}

#view-search .card__play:hover,
#view-library .card__play:hover {
  background: var(--discover-green-hover);
  filter: none;
}

#view-search .card__play-svg,
#view-library .card__play-svg {
  display: block;
  margin-left: 2px;
}

.section {
  padding: 20px 32px 36px;
}

.section--search {
  padding-top: 12px;
}

.section--hidden {
  display: none;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}

.section__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.section__lede {
  margin: -8px 0 20px;
  max-width: 42ch;
}

.section__show {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.section__show:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 22px;
}

.collection-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.collection-playlists {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 12px;
  /* Sidebar can grow up to this height; list inside scrolls past it. */
  max-height: 560px;
  /* Allow overflow so the "..." menu popover isn't clipped. */
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.collection-playlists__title {
  margin: 2px 8px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.collection-playlists__list li + li {
  margin-top: 2px;
}

.collection-playlists__list {
  flex: 1 1 auto;
  overflow: auto;
  padding-right: 4px;
}

.collection-playlists__list::-webkit-scrollbar {
  width: 10px;
}

.collection-playlists__list::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.16);
  border-radius: 999px;
}

.collection-playlist-empty {
  margin: 4px 8px 8px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.collection-playlist__open {
  display: flex;
  align-items: center;
  gap: 10px;
}

.collection-playlist__thumb {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-subtle);
}

.collection-playlist__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-tracks {
  min-width: 0;
}

.collection-tracks__meta {
  margin-bottom: 16px;
}

.collection-tracks__meta-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.collection-tracks__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.collection-tracks__summary {
  margin: 6px 0 0;
}

.library-view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  background: var(--surface);
}

.library-view-toggle__btn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.library-view-toggle__btn.is-active {
  background: var(--accent-soft);
  color: var(--text);
}

.library-cards--list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.library-list-row:hover {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: var(--shadow-lg);
}

.library-list-row__start {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.library-list-row__thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-subtle);
  flex: 0 0 52px;
}

.library-list-row__meta {
  min-width: 0;
}

.library-list-row__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-list-row__artist {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-list-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.library-list-row__play {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--discover-green);
  color: #0a0a0a;
  box-shadow: 0 6px 18px rgba(29, 185, 84, 0.3);
}

.library-list-row__play:hover {
  background: var(--discover-green-hover);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  position: relative;
}

@media (max-width: 980px) {
  .collection-layout {
    grid-template-columns: 1fr;
  }

  .collection-tracks__meta-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.card:hover {
  border-color: rgba(15, 23, 42, 0.2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.card:hover .card__play {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card:hover .card__like {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card:hover .card__queue {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card__img-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  margin-bottom: 12px;
  background: var(--bg-subtle);
}

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

.card__play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-mid));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  padding-left: 3px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  opacity: 0;
  transform: translateY(8px) scale(0.92);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), filter 0.15s;
}

.card__play:hover {
  filter: brightness(1.08);
  transform: translateY(0) scale(1.05);
}

.card__like {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), filter 0.15s, background 0.15s;
}

.card__like-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.card__like:hover {
  filter: brightness(1.08);
  transform: translateY(0) scale(1.05);
}

.card__like.is-on {
  opacity: 1;
  background: linear-gradient(145deg, #ef476f, #f78c6b);
}

.card__queue,
.card__add {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), filter 0.15s, background 0.15s;
  z-index: 2;
}

.card__queue-svg {
  width: 18px;
  height: 18px;
  display: block;
}

.card__queue:hover,
.card__add:hover {
  filter: brightness(1.08);
  transform: translateY(0) scale(1.05);
  background: rgba(255, 107, 74, 0.92);
}


.library-list-row__queue {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.1);
  color: var(--text);
}

.library-list-row__queue:hover {
  background: rgba(255, 107, 74, 0.18);
  color: var(--accent-hover);
}

.card__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 6px;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__desc {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-title {
  font-family: var(--font-display);
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 2.5vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

#view-search .search-box {
  display: none;
}

#view-search .search-title {
  margin-bottom: 8px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
}

.search-box svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--text-faint);
}

.search-box input {
  flex: 1;
  border: none;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: var(--text-faint);
}

.search-status {
  min-height: 1.25rem;
  margin: 12px 0 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.search-status.is-error {
  color: var(--danger);
}

.search-results {
  margin-top: 20px;
}

.card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
}

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

/* ——— Player (in flex flow so workspace scrollbars aren’t covered — no extra workspace padding) ——— */
.player {
  flex-shrink: 0;
  width: 100%;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(140px, 26%) minmax(280px, 1fr) minmax(140px, 26%);
  align-items: center;
  gap: 20px 28px;
  padding: 14px 28px calc(14px + env(safe-area-inset-bottom, 0px));
  min-height: var(--player-height);
  box-sizing: border-box;
  background: var(--player-chrome-bg);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.07);
}

.player__now {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player__cover {
  border-radius: 10px;
  background: var(--bg-subtle);
  flex-shrink: 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.player__meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.player__song {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.player__artist {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  justify-content: center;
}

.player__transport {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 auto;
}

.icon-btn {
  color: var(--text-muted);
  font-size: 1rem;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s, transform 0.12s;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn--transport {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 10px;
}

.icon-btn__svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
}

.icon-btn--sm {
  font-size: 0.875rem;
}

.icon-btn.is-on {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn--like.is-on .icon-btn__svg {
  fill: currentColor;
  stroke: currentColor;
}

.icon-btn.is-on:hover {
  color: var(--accent-hover);
}

.icon-btn--repeat {
  position: relative;
}

.icon-btn__repeat-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.icon-btn__repeat-one {
  display: none;
  position: absolute;
  right: -4px;
  bottom: -3px;
  min-width: 12px;
  height: 12px;
  padding: 0 3px;
  font-size: 8px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
  letter-spacing: -0.04em;
  color: #fff;
  background: var(--accent);
  border-radius: 3px;
}

#btn-repeat[data-repeat="0"] .icon-btn__svg {
  opacity: 0.38;
}

#btn-repeat[data-repeat="1"] .icon-btn__svg,
#btn-repeat[data-repeat="2"] .icon-btn__svg {
  opacity: 1;
  color: var(--accent);
}

#btn-repeat[data-repeat="2"] .icon-btn__repeat-one {
  display: block;
}

.play-btn {
  position: relative;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-mid));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s;
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.22), 0 2px 6px rgba(26, 26, 30, 0.05);
}

.play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 22px rgba(255, 107, 74, 0.28), 0 2px 8px rgba(26, 26, 30, 0.05);
}

.play-btn:active {
  transform: scale(0.98);
}

.play-btn__icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  margin: 0;
  display: block;
  flex-shrink: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.play-btn__icon--pause {
  display: none;
}

.play-btn.is-playing .play-btn__icon--play {
  display: none;
}

.play-btn.is-playing .play-btn__icon--pause {
  display: block;
}

.player__progress {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.time {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: center;
}

.time:first-of-type {
  text-align: left;
}

.time:last-of-type {
  text-align: right;
}

.progress {
  flex: 1;
  height: 8px;
  cursor: pointer;
  position: relative;
  border-radius: 99px;
  transition: height 0.15s var(--ease-out);
  align-self: center;
}

.player__progress:hover .progress {
  height: 10px;
}

.progress__track {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.1);
  pointer-events: none;
}

.progress:focus-visible {
  height: 10px;
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.progress__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  pointer-events: none;
  transition: width 0.08s linear;
  box-shadow: 0 0 10px rgba(15, 23, 42, 0.1);
}

.progress__fill::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translate(50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  transition: transform 0.15s var(--ease-out), box-shadow 0.15s;
}

.player__progress:hover .progress__fill::after,
.progress:focus-visible .progress__fill::after {
  transform: translate(50%, -50%) scale(1.08);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.player__extras {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.queue-mobile-btn {
  display: none;
}

.player-more-btn {
  display: none;
}

.player-more-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 160px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 4px;
  z-index: 5;
}

.player-more-menu__item {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
}

.player-more-menu__item:hover {
  background: var(--accent-soft);
}

.player__extras-tray {
  display: flex;
  align-items: center;
  gap: 10px;
}

.volume {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 148px;
  width: 100%;
}

.volume__icon {
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.volume input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  min-width: 0;
}

@media (max-width: 960px) {
  /*
   * Same column flex lock as desktop: in-flow .player must stay visible.
   * Without a bounded .app height, the page grows and the bar scrolls away.
   */
  html,
  body {
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
  }

  .app {
    height: 100dvh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .workspace {
    min-height: 0;
    overflow: hidden;
  }

  .workspace > .main {
    min-height: 0;
  }

  /* Keep fixed/off-canvas columns from occupying a second grid track. */
  .workspace > .playlist-panel,
  .workspace > .main,
  .workspace > .now-playing-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .main.main--lyrics-open {
    z-index: 47;
  }

  /* In mobile float mode, keep the docked video sheet above the main column. */
  .main.main--lyrics-open.main--lyrics-float-mobile {
    z-index: 44;
  }

  /* In float mode, keep main content visible/interactive behind the lyrics card. */
  .main.main--lyrics-open.main--lyrics-float-mobile > :not(.lyrics-view) {
    visibility: visible;
    pointer-events: auto;
  }

  .workspace.workspace--now-playing.workspace--lyrics-float-mobile .lyrics-view.lyrics-view--float-mobile {
    position: fixed;
    left: 12px;
    right: 12px;
    /* `--mobile-header-stack` = search row bottom + gap (app.js); lyrics may sit over primary nav, not over search. */
    top: max(6px, var(--mobile-header-stack, 120px));
    /* Sit above the docked sheet; `--mv-sheet-visual-height` is set from measured panel height in app.js. */
    bottom: calc(var(--player-scroll-padding) + var(--mv-sheet-visual-height, min(62vw, 360px)) + 20px);
    height: auto;
    min-height: 0;
    max-height: min(40dvh, 320px);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(8, 8, 12, 0.94);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* Direct child of `.workspace` in float mode so this must beat the docked sheet (45). */
    z-index: 50;
    isolation: auto;
    overflow: hidden;
  }

  .workspace.workspace--now-playing.workspace--lyrics-float-mobile .lyrics-view.lyrics-view--float-mobile .lyrics-view__bg {
    background: linear-gradient(180deg, rgba(20, 20, 26, 0.9) 0%, rgba(8, 8, 12, 0.98) 100%);
  }

  .workspace.workspace--now-playing.workspace--lyrics-float-mobile .lyrics-view.lyrics-view--float-mobile .lyrics-view__head {
    padding: 6px 10px 8px;
  }

  .workspace.workspace--now-playing.workspace--lyrics-float-mobile .lyrics-view.lyrics-view--float-mobile .lyrics-view__close {
    width: 36px;
    height: 30px;
    background: rgba(255, 255, 255, 0.12);
  }

  .workspace.workspace--now-playing.workspace--lyrics-float-mobile .lyrics-view.lyrics-view--float-mobile .lyrics-view__lines {
    max-width: none;
    padding: 10px 16px 56px;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .workspace.workspace--now-playing.workspace--lyrics-float-mobile .lyrics-view.lyrics-view--float-mobile .lyrics-line {
    font-size: clamp(1.05rem, 4.2vw, 1.35rem);
    padding: 0.42em 6px;
    line-height: 1.28;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .workspace,
  .workspace.workspace--now-playing {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .header-playlists-btn {
    display: none;
  }

  /*
   * Header: use stacked layout for the whole mobile/tablet band (≤960px).
   * Between 721–960px the desktop 4-column grid left nav + search + actions
   * on one row, which overlapped badly once the playlists icon appeared.
   */
  .app-header {
    padding: 10px 14px 12px;
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    height: auto;
    min-height: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    column-gap: 10px;
    row-gap: 0;
    align-items: start;
  }

  .app-header__start {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .brand__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-header__end {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    min-width: 0;
    max-width: 100%;
  }

  .app-header__search-wrap {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 10px 0 0;
    width: 100%;
    min-width: 0;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: none;
    margin: 0;
    margin-top: 8px;
    padding: 8px 0 10px;
    gap: 4px;
    border-top: 1px solid var(--border);
    background: transparent;
    box-sizing: border-box;
  }

  .nav-link {
    padding: 8px 14px 8px 18px;
    font-size: 0.875rem;
  }

  .nav-link.is-active::before {
    left: 4px;
    height: 1.25em;
  }

  .app-header__chevrons {
    display: none;
  }

  .app-header__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }

  .discover__inner,
  .section {
    padding-left: 18px;
    padding-right: 18px;
  }

  .playlist-sheet-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    grid-column: 1;
    grid-row: 1;
    z-index: 52;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .playlist-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 88vw);
    max-width: 100%;
    z-index: 53;
    margin: 0;
    padding: 16px 14px var(--content-scroll-pad) max(14px, env(safe-area-inset-left, 0px));
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    box-shadow: 8px 0 36px rgba(0, 0, 0, 0.28);
    transform: translateX(-102%);
    transition: transform 0.26s var(--ease-out);
    pointer-events: none;
    border-right: 1px solid var(--border-strong);
  }

  .playlist-panel__close-sheet {
    display: inline-flex;
  }

  .playlist-panel__label {
    flex: 1 1 auto;
    margin-bottom: 0;
    min-width: 0;
  }

  .workspace.workspace--playlists-open .playlist-panel {
    transform: translateX(0);
    pointer-events: auto;
  }

  /* Dock music video above the player — size to content, no clipping (was max-height + overflow) */
  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--mv-dock-bottom);
    width: 100%;
    /* Reserve brand + search band only; sheet may extend over the nav row. */
    max-height: min(
      calc(100dvh - var(--mv-dock-bottom) - var(--mobile-header-stack, 120px) - 12px),
      900px
    );
    min-height: 0;
    z-index: 45;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.28);
    animation: mv-sheet-in 0.28s var(--ease-out);
    overflow: visible;
  }

  /* ~16:9 video + sheet padding (switch pill hidden on mobile) */
  .workspace.workspace--now-playing .main {
    padding-bottom: calc(var(--player-scroll-padding) + var(--mv-sheet-visual-height, min(62vw, 360px)) + 28px);
  }

  /* Mini player floats in the corner — no extra main gutter vs full-width bar */
  .workspace.workspace--now-playing.workspace--mv-sheet-minimized .main {
    padding-bottom: var(--player-scroll-padding);
  }

  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__inner {
    position: relative;
    gap: 0;
    padding: 10px 10px 14px;
    overflow: visible;
    flex: none;
    min-height: 0;
  }

  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__minimize {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.15s, transform 0.15s var(--ease-out);
  }

  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__minimize:hover {
    background: rgba(0, 0, 0, 0.65);
    transform: scale(1.05);
  }

  .now-playing-panel__minimize-ico {
    width: 22px;
    height: 22px;
    display: block;
  }

  .now-playing-panel__minimize-ico--expand {
    display: none;
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__minimize-ico--collapse {
    display: none;
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__minimize-ico--expand {
    display: block;
  }

  /* YouTube-style floating mini player (corner PiP) */
  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) {
    left: auto;
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(var(--mv-dock-bottom) + 12px);
    top: auto;
    width: min(200px, calc(100vw - 24px));
    max-height: none;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
      0 20px 50px rgba(0, 0, 0, 0.48),
      0 0 0 1px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 48;
    animation: mv-pip-in 0.32s var(--ease-out);
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__inner {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    cursor: pointer;
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__minimize {
    position: absolute;
    top: 6px;
    right: 6px;
    left: auto;
    z-index: 6;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    cursor: pointer;
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__frame {
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    gap: 0;
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__media {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0;
  }

  .workspace.workspace--now-playing
    .now-playing-panel.now-playing-panel--minimized:not([hidden])
    .now-playing-panel__media
    .now-playing-panel__video,
  .workspace.workspace--now-playing
    .now-playing-panel.now-playing-panel--minimized:not([hidden])
    .now-playing-panel__media
    .now-playing-panel__poster {
    object-fit: cover;
  }

  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__fullscreen {
    display: none;
  }

  /* Player bar already shows title + artist — keep sheet meta hidden when minimized too */
  .workspace.workspace--now-playing .now-playing-panel.now-playing-panel--minimized:not([hidden]) .now-playing-panel__meta {
    display: none !important;
  }

  /* Stack: media (16:9) + controls — switch is no longer inside overflow:hidden */
  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__frame {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    aspect-ratio: unset;
    min-height: 0;
    max-height: none;
    width: 100%;
    flex: 0 0 auto;
    overflow: visible;
    padding: 0;
  }

  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: #000;
  }

  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__media .now-playing-panel__video,
  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__media .now-playing-panel__poster {
    object-fit: contain;
  }

  /* Toggle artwork/video from the player bar filmstrip icon only */
  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__switch {
    display: none !important;
  }

  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__fullscreen {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 4;
  }

  /* Player bar already shows title + artist — hide duplicate under the video sheet */
  .workspace.workspace--now-playing .now-playing-panel:not([hidden]) .now-playing-panel__meta {
    display: none;
  }
}

@keyframes mv-sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mv-pip-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(16px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 520px) {
  .app-header__actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    max-width: min(200px, 52vw);
  }

  .app-header__actions .btn {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .brand__name {
    font-size: 1rem;
  }

  .card-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

@media (max-width: 720px) {
  .discover-spotlights__row {
    grid-template-columns: 1fr;
  }

  .discover-spotlight {
    gap: 12px;
    min-height: 92px;
    padding: 8px 10px 8px 8px;
  }

  .discover-spotlight__img {
    width: 72px;
    height: 72px;
  }

  .discover-spotlight__title {
    font-size: 1rem;
  }

  .discover-spotlight__play {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 900px) {
  :root {
    /* Two-row compact player — keep in sync with .player padding + rows so MV dock sits flush. */
    --player-height: 158px;
    --mv-dock-bottom: calc(var(--player-height) + var(--mv-dock-gap) + env(safe-area-inset-bottom, 0px));
    --player-scroll-padding: calc(var(--player-height) + 28px + env(safe-area-inset-bottom, 0px));
  }

  .player {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: auto;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }

  /* Lyrics lives in .player__transport; tray is hidden — drop empty third row */
  .player__extras {
    display: none;
  }

  .queue-mobile-btn {
    display: inline-flex;
  }

  .player-more-btn {
    display: inline-flex;
  }

  .player__now {
    grid-row: 1;
  }

  .player__controls {
    grid-row: 2;
    position: relative;
  }

  .player__transport {
    gap: 10px;
  }

  /* Keep mobile transport focused on core actions only. */
  #btn-lyrics,
  #btn-shuffle,
  #btn-repeat,
  #btn-music-video {
    display: none !important;
  }
}
