:root {
  --bg-base: #000000;
  --bg-elevated: #121212;
  --bg-card: #181818;
  --bg-highlight: #1a1a1a;
  --bg-hover: rgba(255, 255, 255, 0.1);
  --bg-press: rgba(255, 255, 255, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #6a6a6a;
  --accent: #fa2d48;
  --accent-hover: #ff4d65;
  --play: #fa2d48;
  --play-hover: #ff4d65;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --player-h: 90px;
  --lyrics-w: 360px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-pill: 500px;
  --favorite-btn-size: 32px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  background: var(--bg-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  font: inherit;
  color: inherit;
  text-decoration: none;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* App grid: sidebar | main, player spans full width */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--player-h);
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  gap: 8px;
  padding: 8px 8px 0;
  background: var(--bg-base);
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 12px 12px 16px;
  min-height: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  transition: background 0.15s;
}

.sidebar-brand:hover {
  background: var(--bg-hover);
}

.sidebar-brand-icon {
  color: var(--accent);
  display: flex;
}

.sidebar-brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
}

.nav-item:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--text);
  background: var(--bg-press);
}

/* Main stage (Spotify content panel) */
.main-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, #2a2a2a 0%, var(--bg-elevated) 240px);
  background-color: var(--bg-elevated);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.content-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(88px, auto);
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 12px 20px;
  background: rgba(18, 18, 18, 0.65);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  justify-self: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.topbar-search:focus-within {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.topbar-search .search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.topbar-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  color-scheme: dark;
}

.topbar-search input::placeholder {
  color: var(--text-muted);
}

.topbar-search input[type="search"]::-webkit-search-decoration,
.topbar-search input[type="search"]::-webkit-search-results-button,
.topbar-search input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

.topbar-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-left: 2px;
  cursor: pointer;
  opacity: 0.55;
  background: center / 14px 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23b3b3b3' d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z'/%3E%3C/svg%3E");
}

.topbar-search input[type="search"]::-webkit-search-cancel-button:hover {
  opacity: 1;
}

.topbar-trailing {
  justify-self: end;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  position: relative;
}

.content-topbar-mount {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: flex;
  align-items: center;
}

.sidebar-topbar-mount {
  display: none;
}

.icon-btn.mobile-nav-toggle {
  display: none;
}

.mobile-nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(28, 28, 30, 0.96);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  z-index: 40;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.mobile-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.mobile-nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.mobile-nav-toggle.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  transition: background 0.15s, transform 0.1s;
}

.pill-btn:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.04);
}

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

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.35);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card);
}

.btn {
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.1s, background 0.15s;
}

.btn-primary {
  background: var(--text);
  color: var(--bg-base);
}

.btn-primary:hover {
  transform: scale(1.04);
  background: #f5f5f5;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: color 0.15s, background 0.15s, transform 0.1s;
}

.icon-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--bg-hover);
}

.icon-btn.active {
  color: var(--play);
}

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

.control-secondary:hover {
  color: var(--text);
}

.control-secondary.active {
  color: var(--play);
}

.status-banner {
  margin: 0 20px 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  background: rgba(250, 45, 72, 0.12);
  border: 1px solid rgba(250, 45, 72, 0.35);
  color: #ffb3be;
}

.status-banner.success {
  background: rgba(250, 45, 72, 0.1);
  border-color: rgba(250, 45, 72, 0.3);
  color: #ffc0c9;
}

.main-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 24px 32px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.main-content.scrollbar-hover,
.main-content.scrollbar-active {
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.main-stage.lyrics-open .main-content,
.main-stage.queue-open .main-content {
  margin-right: var(--lyrics-w);
}

.main-stage.lyrics-open .content-topbar,
.main-stage.queue-open .content-topbar {
  background: var(--bg-elevated);
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
}

.view {
  max-width: 100%;
}

/* Home — metal bookshelf */
.view-home {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
  overflow: hidden;
}

.main-content:has(.view-home:not(.hidden)) {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.home-bookshelf {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 1px,
      transparent 48px
    ),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(120, 130, 150, 0.08), transparent 60%),
    linear-gradient(180deg, #121316 0%, #08090b 55%, #050506 100%);
}

.home-bookshelf-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 280px;
  color: rgba(200, 210, 225, 0.45);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-library {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.genre-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 20px 10px;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(22, 24, 28, 0.95), rgba(12, 13, 16, 0.88));
  scrollbar-width: none;
}

.genre-tabs::-webkit-scrollbar {
  display: none;
}

.genre-tab {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(210, 218, 230, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(40, 44, 52, 0.6), rgba(18, 20, 24, 0.85));
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.genre-tab:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.genre-tab.active {
  color: #fff;
  border-color: rgba(200, 210, 230, 0.35);
  background: linear-gradient(180deg, rgba(70, 78, 92, 0.85), rgba(32, 36, 44, 0.95));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 4px 16px rgba(0, 0, 0, 0.45);
}

.genre-load-banner {
  flex-shrink: 0;
  padding: 10px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(22, 24, 28, 0.96), rgba(14, 16, 20, 0.9));
}

.genre-load-banner[hidden] {
  display: none;
}

.genre-load-banner-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.genre-load-spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(220, 228, 240, 0.9);
  border-radius: 50%;
  animation: genreLoadSpin 0.75s linear infinite;
}

.genre-load-copy {
  flex: 1;
  min-width: 0;
}

.genre-load-text {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(210, 218, 230, 0.88);
}

.genre-load-progress {
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.genre-load-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(120, 132, 155, 0.55), rgba(210, 220, 235, 0.85));
  transition: width 0.28s ease;
}

@keyframes genreLoadSpin {
  to {
    transform: rotate(360deg);
  }
}

.shelves-loading {
  position: absolute;
  left: 56px;
  right: 24px;
  top: 38%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  text-align: center;
}

.shelves-loading[hidden] {
  display: none;
}

.shelves-loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(220, 228, 240, 0.75);
  border-radius: 50%;
  animation: genreLoadSpin 0.9s linear infinite;
}

.shelves-loading-text {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(200, 210, 225, 0.42);
}

.home-shelves-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  margin: 0;
  padding: 24px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(180, 190, 205, 0.45);
  text-align: center;
}

.library-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.library-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  background:
    linear-gradient(
      90deg,
      transparent 55px,
      rgba(255, 255, 255, 0.07) 55px,
      rgba(255, 255, 255, 0.07) 56px,
      transparent 56px
    ) left top / 56px 100% no-repeat,
    linear-gradient(90deg, rgba(6, 7, 9, 0.98), rgba(12, 14, 18, 0.75)) left top / 56px
      100% no-repeat;
}

.library-scroll.scrollbar-hover,
.library-scroll.scrollbar-active {
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.library-scroll-inner {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: start;
  min-height: 100%;
}

.year-rail {
  position: relative;
  align-self: start;
  padding-top: 16px;
  border-right: 1px solid transparent;
  background: transparent;
  user-select: none;
}

.year-rail-line {
  display: none;
}

.year-rail-track {
  position: relative;
  width: 100%;
  min-height: 100%;
}

.year-marker {
  position: absolute;
  left: 2px;
  right: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  transform: none;
  padding: 4px 0 0 4px;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(150, 160, 175, 0.5);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.year-marker::before {
  content: "";
  order: 2;
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  margin-left: auto;
  position: relative;
  right: auto;
  top: auto;
  border-radius: 50%;
  background: rgba(160, 170, 185, 0.35);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
  transition: background 0.15s, transform 0.15s;
}

.year-marker:hover,
.year-marker.active {
  color: rgba(245, 248, 255, 0.95);
  background: rgba(255, 255, 255, 0.06);
}

.year-marker.active::before {
  background: rgba(230, 236, 248, 0.95);
  transform: scale(1.2);
}

.shelves-panel {
  padding: 16px 20px 40px;
  min-width: 0;
}

.year-block {
  scroll-margin-top: 16px;
  margin-bottom: 28px;
}

.year-block:last-child {
  margin-bottom: 48px;
}

.year-block {
  position: relative;
}

.year-block--placeholder .bookshelf-frame {
  opacity: 0.55;
}

.year-block--loading .bookshelf-frame {
  opacity: 0.45;
}

.year-empty-hint {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(150, 160, 175, 0.65);
  background: rgba(12, 14, 18, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.year-load-status {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  z-index: 3;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(210, 218, 230, 0.85);
  background: rgba(12, 14, 18, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  white-space: nowrap;
}

.year-load-status.is-error {
  color: #ffb3be;
  border-color: rgba(250, 45, 72, 0.35);
}

@keyframes shelfPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 0.85;
  }
}

.year-block--empty .bookshelf-collection {
  min-height: 188px;
}

.bookshelf-frame {
  position: relative;
  padding: 0 8px 8px;
}

.bookshelf-back {
  position: absolute;
  inset: 6px 0 28px;
  border-radius: 2px;
  background: linear-gradient(180deg, #1c1f24 0%, #0e1014 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 -8px 24px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.bookshelf-collection {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 188px;
  padding: 12px 8px 0;
  overflow-x: auto;
  overflow-y: visible;
  perspective: 1000px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.bookshelf-collection.scrollbar-hover,
.bookshelf-collection.scrollbar-active {
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.shelf-surface {
  position: relative;
  z-index: 2;
  height: 10px;
  margin-top: -1px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(
    180deg,
    #5a6068 0%,
    #3a3f48 25%,
    #2a2e34 60%,
    #1a1d22 100%
  );
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 -1px 0 rgba(0, 0, 0, 0.5) inset;
}

.shelf-surface::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
}

.shelf-lip {
  height: 4px;
  margin-top: 1px;
  background: linear-gradient(180deg, #14161a, #08090b);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
}

.book-spine {
  --spine-w: 14px;
  --spine-d: 5px;
  --spine-h: 160px;
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  width: var(--spine-w);
  height: var(--spine-h);
  padding: 0;
  border: none;
  cursor: pointer;
  transform-style: preserve-3d;
  transform-origin: bottom center;
  color: var(--spine-text, rgba(255, 255, 255, 0.9));
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.25s ease,
    opacity 0.25s ease;
  filter: drop-shadow(1px 3px 5px rgba(0, 0, 0, 0.65));
}

.book-spine:hover:not(.is-pulling):not(.is-dimmed) {
  transform: translateY(-4px);
  filter: drop-shadow(2px 8px 10px rgba(0, 0, 0, 0.75));
  z-index: 4;
}

.book-spine.is-pulling {
  transform: translateX(18px) translateY(-8px);
  z-index: 20;
  filter: drop-shadow(8px 14px 18px rgba(0, 0, 0, 0.85));
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.book-spine.is-pulling.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.book-spine.is-dimmed {
  opacity: 0.32;
}

.book-vol {
  position: relative;
  width: var(--spine-w);
  height: var(--spine-h);
  transform-style: preserve-3d;
  transform: translateZ(0);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.book-spine-face,
.book-pages-face,
.book-cover-face,
.book-top-face,
.book-bottom-face {
  position: absolute;
  backface-visibility: hidden;
}

.book-spine-face {
  width: var(--spine-w);
  height: var(--spine-h);
  left: 0;
  top: 0;
  transform: translateZ(calc(var(--spine-d) / 2));
  border-radius: 2px;
  background: var(--spine-color, #3a3f4a);
  box-shadow:
    inset 1px 0 3px rgba(255, 255, 255, 0.12),
    inset -1px 0 4px rgba(0, 0, 0, 0.45);
}

.book-pages-face {
  width: var(--spine-d);
  height: var(--spine-h);
  left: var(--spine-w);
  top: 0;
  transform-origin: left center;
  transform: rotateY(90deg) translateZ(calc(var(--spine-d) / 2));
  background: linear-gradient(90deg, #8a8f98 0%, #4a4f58 45%, #2e3238 100%);
  box-shadow: inset -1px 0 2px rgba(0, 0, 0, 0.35);
}

.book-cover-face {
  width: var(--spine-h);
  height: var(--spine-h);
  left: 0;
  top: 0;
  transform-origin: left center;
  transform: rotateY(-90deg) translateZ(calc(var(--spine-w) / 2));
  background-size: cover;
  background-position: center;
  background-color: var(--spine-color, #3a3f4a);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.book-top-face,
.book-bottom-face {
  width: var(--spine-w);
  height: var(--spine-d);
  left: 0;
  background: linear-gradient(180deg, #5a5f68, #2a2e34);
}

.book-top-face {
  top: 0;
  transform: rotateX(90deg) translateZ(calc(var(--spine-d) / 2));
  transform-origin: top center;
}

.book-bottom-face {
  bottom: 0;
  transform: rotateX(-90deg) translateZ(calc(var(--spine-d) / 2));
  transform-origin: bottom center;
}

.book-spine-text {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--spine-w);
  height: var(--spine-h);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  padding: 8px 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transform: translateZ(calc(var(--spine-d) / 2 + 1px));
}

.book-spine-text.is-overflowing {
  justify-content: flex-start;
}

.book-spine-label {
  display: block;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-focus-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.book-focus-layer.is-open {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.book-focus-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.book-focus-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 24px 24px 32px;
  max-width: min(92vw, 420px);
  pointer-events: none;
}

.book-flyer-stage {
  position: relative;
  width: min(44vw, 240px);
  height: min(44vw, 240px);
  flex-shrink: 0;
  perspective: 1600px;
  pointer-events: none;
}

.book-flyer {
  --flyer-size: 160px;
  --flyer-depth: 10px;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 211;
  width: var(--flyer-size);
  height: var(--flyer-size);
  perspective: 1600px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.book-flyer.is-centered {
  --flyer-depth: 18px;
}

.book-flyer-pivot {
  position: relative;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}

.book-flyer-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transform: rotateY(90deg);
  transition: transform 0.58s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.book-flyer.is-flipped .book-flyer-wrap {
  transform: rotateY(24deg);
}

.book-flyer-vol {
  position: relative;
  width: var(--flyer-size);
  height: var(--flyer-size);
  transform-style: preserve-3d;
}

.book-flyer-face {
  position: absolute;
  left: 0;
  top: 0;
  backface-visibility: hidden;
  border-radius: 3px;
}

.book-flyer-front {
  width: var(--flyer-size);
  height: var(--flyer-size);
  transform: translateZ(calc(var(--flyer-depth) / 2));
  background-size: cover;
  background-position: center;
  background-color: var(--flyer-spine-color, #3a3f4a);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.book-flyer-back {
  width: var(--flyer-size);
  height: var(--flyer-size);
  transform: rotateY(180deg) translateZ(calc(var(--flyer-depth) / 2));
  background: linear-gradient(145deg, #14161c 0%, #2a3038 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.book-flyer-right {
  width: var(--flyer-depth);
  height: var(--flyer-size);
  left: calc(50% - (var(--flyer-depth) / 2));
  transform: rotateY(90deg) translateZ(calc(var(--flyer-size) / 2));
  background: linear-gradient(90deg, #20242b 0%, #565c66 55%, #858b94 100%);
  box-shadow:
    inset 1px 0 3px rgba(255, 255, 255, 0.12),
    inset -1px 0 4px rgba(0, 0, 0, 0.4);
}

.book-flyer-left {
  width: var(--flyer-depth);
  height: var(--flyer-size);
  left: calc(50% - (var(--flyer-depth) / 2));
  transform: rotateY(-90deg) translateZ(calc(var(--flyer-size) / 2));
  background: var(--flyer-spine-color, #3a3f4a);
  overflow: hidden;
  box-shadow:
    inset 1px 0 3px rgba(255, 255, 255, 0.14),
    inset -1px 0 5px rgba(0, 0, 0, 0.48);
}

.book-flyer-spine-text {
  position: absolute;
  left: 50%;
  top: 0;
  width: 14px;
  height: var(--flyer-size);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.3;
  padding: 8px 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transform: translateX(-50%);
}

.book-flyer-spine-text.is-overflowing {
  justify-content: flex-start;
}

.book-flyer-spine-label {
  display: block;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-flyer-top {
  width: var(--flyer-size);
  height: var(--flyer-depth);
  top: calc(50% - (var(--flyer-depth) / 2));
  transform: rotateX(90deg) translateZ(calc(var(--flyer-size) / 2));
  background: linear-gradient(180deg, #5a6068, #343a42);
}

.book-flyer-bottom {
  width: var(--flyer-size);
  height: var(--flyer-depth);
  top: calc(50% - (var(--flyer-depth) / 2));
  transform: rotateX(-90deg) translateZ(calc(var(--flyer-size) / 2));
  background: linear-gradient(180deg, #2e3238, #1a1c22);
}

.book-focus-year {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(180, 190, 205, 0.75);
  margin-bottom: 4px;
}

.book-focus-info {
  text-align: center;
  max-width: 320px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease 0.45s, transform 0.35s ease 0.45s;
  pointer-events: auto;
}

.book-focus-layer.is-open .book-focus-info {
  opacity: 1;
  transform: translateY(0);
}

.book-focus-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.book-focus-artist {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.book-focus-open {
  min-width: 160px;
}

.hint-text {
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
  font-size: 14px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 32px 0 12px;
  letter-spacing: -0.02em;
}

/* Chips / tabs */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.chip.active {
  background: var(--text);
  color: var(--bg-base);
}

/* Song table (Spotify-style) */
.song-table-header,
.song-row {
  display: grid;
  align-items: center;
  gap: 16px;
  padding: 4px 16px;
}

.song-table--search.song-table-header,
.song-table--search.song-row,
.song-list.song-table--search .song-row {
  grid-template-columns: 40px minmax(0, 4fr) minmax(0, 2fr) 48px;
}

.song-table--album.song-table-header,
.song-table--album.song-row,
.song-list.song-table--album .song-row {
  grid-template-columns: 40px minmax(0, 1fr) 48px;
}

.song-table--with-favorite.song-table--search.song-table-header,
.song-table--with-favorite.song-table--search.song-row,
.song-list.song-table--with-favorite.song-table--search .song-row,
.song-table--with-favorite.song-table--favorites.song-table-header,
.song-table--with-favorite.song-table--favorites.song-row,
.song-list.song-table--with-favorite.song-table--favorites .song-row {
  grid-template-columns: 40px minmax(0, 4fr) minmax(0, 2fr) 36px 48px;
}

.song-table--with-favorite.song-table--album.song-table-header,
.song-table--with-favorite.song-table--album.song-row,
.song-list.song-table--with-favorite.song-table--album .song-row {
  grid-template-columns: 40px minmax(0, 1fr) 36px 48px;
}

.song-table--favorites.song-table-header,
.song-table--favorites.song-row,
.song-list.song-table--favorites .song-row {
  grid-template-columns: 40px minmax(0, 4fr) minmax(0, 2fr) 48px;
}

.col-favorite {
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--favorite-btn-size);
  height: var(--favorite-btn-size);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, transform 0.1s;
}

.favorite-btn:hover:not(:disabled) {
  color: var(--text);
  transform: scale(1.06);
}

.favorite-btn.is-liked {
  color: var(--accent);
}

.favorite-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.player-favorite-btn {
  margin-right: 4px;
}

.player-favorite-btn .favorite-icon-filled {
  color: var(--accent);
}

.player-favorite-btn.is-liked .favorite-icon-outline {
  display: none;
}

.player-favorite-btn.is-liked .favorite-icon-filled {
  display: block !important;
}

.player-favorite-btn:not(.is-liked) .favorite-icon-filled {
  display: none !important;
}

.favorites-hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #3a3a3a, #1a1a1a);
  color: var(--accent);
}

.favorites-hero-art svg {
  width: 56%;
  height: 56%;
}

.song-table-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  padding-bottom: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  user-select: none;
}

.song-table-header .col-index {
  text-align: center;
}

.song-table-header .col-duration {
  display: flex;
  justify-content: flex-end;
  color: var(--text-muted);
}

.song-table-header .icon-duration {
  opacity: 0.75;
}

.song-list {
  list-style: none;
}

.song-row {
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
  min-height: 52px;
}

.song-row:hover {
  background: var(--bg-hover);
}

.song-row.playing {
  background: rgba(250, 45, 72, 0.1);
}

.song-row.playing .song-name {
  color: var(--accent);
}

.col-index {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.song-num {
  display: block;
}

.song-play-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text);
}

.song-row:hover .song-num,
.song-row.playing .song-num {
  display: none;
}

.song-row:hover .song-play-btn,
.song-row.playing .song-play-btn {
  display: flex;
}

.song-row.playing .song-play-btn {
  color: var(--accent);
}

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

.song-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}

.song-title-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.song-name {
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-row.playing .song-name {
  font-weight: 500;
}

.song-artist {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 0;
}

.artist-inline-group {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.artist-sep {
  display: inline;
  color: inherit;
  pointer-events: none;
  user-select: none;
}

.col-album {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-row:hover .col-album {
  color: var(--text);
}

.col-duration {
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Page hero (artist / album) */
.page-hero {
  position: relative;
  margin: -8px -24px 24px;
  padding: 40px 24px 32px;
  overflow: hidden;
}

.page-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(80, 80, 80, 0.6) 0%, var(--bg-elevated) 100%),
    var(--hero-image, none);
  background-size: cover;
  background-position: center top;
  filter: blur(40px);
  transform: scale(1.2);
  opacity: 0.55;
}

.page-hero-content {
  position: relative;
  display: flex;
  gap: 24px;
  align-items: flex-end;
  z-index: 1;
}

.hero-art {
  width: 192px;
  height: 192px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-card);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
}

.hero-art.round {
  border-radius: 50%;
}

.hero-meta {
  min-width: 0;
  padding-bottom: 4px;
}

.hero-type {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.hero-title {
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
}

.hero-link {
  font: inherit;
  color: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-link:hover {
  color: var(--text);
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.hero-subtitle .artist-inline-group .hero-link {
  display: inline;
}

/* Media cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.media-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.media-card:hover {
  background: #282828;
}

.media-card-art {
  position: relative;
  margin-bottom: 14px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.media-card-art img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--bg-highlight);
}

.card-play-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--play);
  color: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.35);
}

.media-card:hover .card-play-btn {
  opacity: 1;
  transform: translateY(0);
}

.card-play-btn:hover {
  background: var(--play-hover);
  transform: scale(1.05);
}

.media-card .name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card .sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card .sub.artist-inline-group .card-link {
  display: inline;
  margin-top: 0;
}

.media-card-art.round img {
  border-radius: 50%;
}

.card-link {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  transition: color 0.15s;
}

.card-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.song-link,
.hero-link {
  font: inherit;
  color: var(--text-secondary);
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
}

.song-title-block .song-artist .song-link {
  display: inline;
  max-width: none;
  white-space: inherit;
  overflow: visible;
  text-overflow: unset;
  font-size: 13px;
}

.song-title-block > .song-link {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

.col-album .song-link,
.col-album .song-meta-text {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.song-link:hover,
.hero-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.song-meta-text {
  color: var(--text-secondary);
  font-size: 13px;
}

.col-album .song-meta-text {
  font-size: 14px;
}

/* Lyrics */
.lyrics-panel {
  position: absolute;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: var(--lyrics-w);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 6;
}

.lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  flex-shrink: 0;
  color: var(--lyrics-header-color, var(--text-secondary));
  transition: color 0.45s ease;
}

.lyrics-panel.lyrics-themed .lyrics-header .icon-btn {
  color: inherit;
}

.lyrics-header h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lyrics-header-color, var(--text-secondary));
  transition: color 0.45s ease;
}

.lyrics-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.lyrics-body.scrollbar-hover,
.lyrics-body.scrollbar-active {
  scrollbar-color: var(--lyrics-scrollbar, rgba(255, 255, 255, 0.35)) transparent;
}

.lyrics-scroll {
  padding: 0 20px;
}

.lyrics-pad-start,
.lyrics-pad-end {
  height: var(--lyrics-pad, 32px);
  pointer-events: none;
}

.lyrics-line {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--lyrics-text-muted, var(--text-muted));
  margin-bottom: 14px;
  transition: color 0.35s ease, font-size 0.2s;
  cursor: pointer;
}

.lyrics-line.active {
  color: var(--lyrics-text-active, var(--text));
  font-size: 24px;
  font-weight: 800;
}

.lyrics-line.passed {
  color: var(--lyrics-text-passed, #4a4a4a);
}

.lyrics-empty {
  color: var(--lyrics-text-muted, var(--text-muted));
  font-size: 14px;
  text-align: center;
  padding: 48px 20px;
}

/* Queue panel */
.queue-panel {
  position: absolute;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: var(--lyrics-w);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 6;
}

.queue-panel.queue-panel--on-now-playing {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(400px, 38vw);
  margin: 0;
  z-index: 10;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: color-mix(in srgb, var(--queue-overlay-tint, #141416) 82%, #000);
  backdrop-filter: blur(40px) saturate(1.45);
  -webkit-backdrop-filter: blur(40px) saturate(1.45);
  box-shadow: -20px 0 64px rgba(0, 0, 0, 0.42);
  animation: queue-drawer-in-right 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.queue-panel.queue-panel--on-now-playing .queue-header {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 14px;
  color: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  flex-shrink: 0;
}

.queue-panel.queue-panel--on-now-playing .queue-header h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.94);
}

.queue-panel.queue-panel--on-now-playing #close-queue {
  display: none;
}

.queue-panel.queue-panel--on-now-playing .queue-body {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  padding: 8px 14px calc(18px + env(safe-area-inset-bottom, 0px));
}

.queue-panel.queue-panel--on-now-playing .queue-item {
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
}

.queue-panel.queue-panel--on-now-playing .queue-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.queue-panel.queue-panel--on-now-playing .queue-item.playing {
  background: rgba(255, 255, 255, 0.1);
}

.queue-panel.queue-panel--on-now-playing .queue-item.playing .queue-item-title {
  color: #fff;
  font-weight: 600;
}

.queue-panel.queue-panel--on-now-playing .queue-item.playing .queue-item-index {
  color: var(--accent);
}

.queue-panel.queue-panel--on-now-playing .queue-item-art {
  border-radius: 6px;
}

@keyframes queue-drawer-in-right {
  from {
    transform: translateX(104%);
    opacity: 0.72;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.now-playing-queue-scrim {
  position: absolute;
  inset: 0;
  z-index: 4;
  border: none;
  padding: 0;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  cursor: default;
  transition: opacity 0.28s ease;
}

.now-playing--queue-overlay .now-playing-queue-scrim {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  z-index: 6;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.now-playing--queue-overlay .now-playing-topbar {
  z-index: 12;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.queue-header h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.queue-body {
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  padding: 0 12px 16px;
  touch-action: pan-y;
}

.queue-body.scrollbar-hover,
.queue-body.scrollbar-active {
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.queue-empty {
  padding: 12px 8px;
  color: var(--text-muted);
  font-size: 14px;
}

.queue-section-label {
  padding: 8px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.queue-list {
  list-style: none;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.queue-item:hover {
  background: var(--bg-hover);
}

.queue-item.playing {
  background: rgba(250, 45, 72, 0.12);
}

.queue-item-index {
  width: 20px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.queue-item.playing .queue-item-index {
  color: var(--accent);
}

.queue-item-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-card);
  flex-shrink: 0;
}

.queue-item-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.queue-item-title {
  display: block;
  width: 100%;
  font-size: 14px;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item.playing .queue-item-title {
  color: var(--accent);
}

.queue-item-artist {
  display: block;
  width: 100%;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-toggle.active,
.lyrics-toggle.active {
  color: var(--accent);
}

/* Player bar */
.player-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 30%) minmax(0, 40%) minmax(120px, 30%);
  align-items: center;
  gap: 16px;
  height: var(--player-h);
  padding: 0 16px;
  background: #000000;
  border-top: none;
  box-shadow: none;
  z-index: 20;
}

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

.player-art {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-highlight);
  flex-shrink: 0;
  padding: 0;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.player-art:disabled {
  cursor: default;
  opacity: 0.5;
}

.player-art:not(:disabled):hover {
  opacity: 0.85;
}

.player-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-meta {
  min-width: 0;
  flex: 1;
}

.player-track-copy {
  width: 100%;
}

.player-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}

.player-meta-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.player-artists {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: inherit;
  line-height: inherit;
  color: var(--text-secondary);
}

.track-scroll-copy .player-meta-line {
  max-width: none;
}

.track-scroll-copy .player-artists {
  flex: 0 0 auto;
  min-width: max-content;
  max-width: none;
  overflow: visible;
}

.track-scroll-copy .player-artists .player-link,
.track-scroll-copy .player-artists .player-artist-text {
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.track-scroll-copy .player-meta-line > .player-link,
.track-scroll-copy .player-meta-line > #player-album.player-link {
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.track-scroll-copy.is-scroll-static .player-artists,
.track-scroll-copy.is-scroll-static .player-meta-line > .player-link,
.track-scroll-copy.is-scroll-static .player-meta-line > #player-album.player-link {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.player-artists .artist-sep {
  flex-shrink: 0;
  pointer-events: none;
  color: var(--text-secondary);
}

.player-artists .player-link {
  flex: 0 1 auto;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}

.player-artists .player-artist-text {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-link {
  display: inline-flex;
  align-items: center;
  font: inherit;
  line-height: inherit;
  color: var(--text-secondary);
  max-width: 45%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  vertical-align: baseline;
}

.player-meta-line > #player-album.player-link {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
}

.player-link:hover:not(:disabled) {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.player-link:disabled {
  opacity: 0.45;
  cursor: default;
}

.player-sep {
  flex-shrink: 0;
  font: inherit;
  line-height: inherit;
  color: var(--text-muted);
}

.player-extra {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

.player-extra .icon-btn {
  width: 36px;
  height: 36px;
}

.player-extra-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.lyrics-toggle {
  flex-shrink: 0;
}

.player-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

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

.play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}

.play-btn:hover {
  transform: scale(1.06);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.time-label {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
}

.time-label:last-child {
  text-align: right;
}

.progress-slider,
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.progress-slider {
  flex: 1;
}

.volume-slider {
  width: 100px;
  max-width: 100%;
}

.progress-slider::-webkit-slider-runnable-track,
.volume-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
}

.progress-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--text) 0%,
    var(--text) var(--progress, 0%),
    #4d4d4d var(--progress, 0%),
    #4d4d4d 100%
  );
}

.volume-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    var(--text) 0%,
    var(--text) var(--volume, 80%),
    #4d4d4d var(--volume, 80%),
    #4d4d4d 100%
  );
}

.progress-slider::-webkit-slider-thumb,
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--text);
}

.progress-slider::-moz-range-track,
.volume-slider::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  border: none;
}

.progress-slider::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--text);
}

.progress-slider::-moz-range-track {
  background: #4d4d4d;
}

.volume-slider::-moz-range-track {
  background: linear-gradient(
    to right,
    var(--text) 0%,
    var(--text) var(--volume, 80%),
    #4d4d4d var(--volume, 80%),
    #4d4d4d 100%
  );
}

.progress-slider::-moz-range-thumb,
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--text);
}

.player-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  min-width: 0;
}

.player-volume .player-extra-icon {
  width: 22px;
  height: 22px;
}

/* Spotify-style scrollbars (WebKit) */
.main-content::-webkit-scrollbar,
.lyrics-body::-webkit-scrollbar,
.library-scroll::-webkit-scrollbar,
.bookshelf-collection::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.main-content::-webkit-scrollbar-track,
.lyrics-body::-webkit-scrollbar-track,
.library-scroll::-webkit-scrollbar-track,
.bookshelf-collection::-webkit-scrollbar-track {
  background: transparent;
}

.main-content::-webkit-scrollbar-thumb,
.lyrics-body::-webkit-scrollbar-thumb,
.library-scroll::-webkit-scrollbar-thumb,
.bookshelf-collection::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
  min-height: 40px;
}

.main-content.scrollbar-hover::-webkit-scrollbar-thumb,
.main-content.scrollbar-active::-webkit-scrollbar-thumb,
.library-scroll.scrollbar-hover::-webkit-scrollbar-thumb,
.library-scroll.scrollbar-active::-webkit-scrollbar-thumb,
.bookshelf-collection.scrollbar-hover::-webkit-scrollbar-thumb,
.bookshelf-collection.scrollbar-active::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.35);
}

.lyrics-body.scrollbar-hover::-webkit-scrollbar-thumb,
.lyrics-body.scrollbar-active::-webkit-scrollbar-thumb {
  background-color: var(--lyrics-scrollbar, rgba(255, 255, 255, 0.35));
}

.main-content::-webkit-scrollbar-thumb:hover,
.library-scroll::-webkit-scrollbar-thumb:hover,
.bookshelf-collection::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

.lyrics-body::-webkit-scrollbar-thumb:hover {
  background-color: var(--lyrics-scrollbar, rgba(255, 255, 255, 0.5));
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 72px;
  }

  .sidebar-brand-text,
  .nav-item span {
    display: none;
  }


  .nav-item {
    justify-content: center;
    padding: 10px;
  }
}

@media (max-width: 900px) {
  :root {
    --player-h: auto;
    --player-mini-h: 56px;
    --player-mobile-inset-x: 12px;
    --player-mobile-gap: 8px;
    --player-mobile-lift: calc(var(--player-mobile-gap) + env(safe-area-inset-bottom, 0px));
    --player-mobile-scroll-pad: calc(var(--player-mini-h) + var(--player-mobile-gap) + 8px);
    --mobile-header-pad-y: 6px;
    --topbar-h: 52px;
    --lyrics-w: 100%;
  }

  .app-shell {
    position: fixed;
    inset: 0;
    width: 100%;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    max-height: 100dvh;
    padding: 0;
    gap: 0;
    background: var(--bg-base);
    overflow: hidden;
  }

  .sidebar {
    background: var(--bg-base);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: calc(var(--mobile-header-pad-y) + env(safe-area-inset-top, 0px)) 12px
      var(--mobile-header-pad-y);
    gap: 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .sidebar-brand {
    flex-shrink: 0;
    order: 1;
  }

  .sidebar-nav {
    display: none;
  }

  .sidebar-topbar-mount {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    flex-shrink: 0;
  }

  .icon-btn.mobile-nav-toggle {
    display: inline-flex;
  }

  .sidebar-brand-text {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 56px;
    padding: 6px 10px;
    font-size: 10px;
  }

  .nav-item span {
    display: block;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
  }

  .main-stage {
    border-radius: 0;
    min-height: 0;
    margin-bottom: var(--player-mobile-lift);
  }

  .main-content {
    padding: 8px 16px var(--player-mobile-scroll-pad);
  }

  .main-stage.lyrics-open .main-content,
  .main-stage.queue-open .main-content {
    margin-right: 0;
  }

  .lyrics-panel,
  .queue-panel:not(.queue-panel--on-now-playing) {
    top: 0;
    width: 100%;
    height: 100%;
    border-left: none;
    z-index: 30;
  }

  .lyrics-header,
  .queue-panel:not(.queue-panel--on-now-playing) .queue-header {
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-left: 16px;
    padding-right: 16px;
  }

  .lyrics-scroll {
    padding: 0 16px;
  }

  .lyrics-line {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .lyrics-line.active {
    font-size: 20px;
  }

  .content-topbar {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: var(--topbar-h);
    padding: 6px 12px;
  }

  .topbar-search {
    max-width: none;
    justify-self: stretch;
    padding: 8px 12px;
  }

  .topbar-search input {
    font-size: 16px;
  }

  .auth-area {
    gap: 6px;
  }

  .user-menu {
    padding: 2px 4px 2px 2px;
    gap: 4px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .status-banner {
    margin: 0 12px 8px;
  }

  .page-hero {
    margin-left: -16px;
    margin-right: -16px;
    padding: 24px 16px;
  }

  .page-hero-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-art {
    width: 140px;
    height: 140px;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  .media-card {
    padding: 12px;
  }

  .genre-tabs {
    padding: 12px 12px 8px;
  }

  .genre-load-banner {
    padding: 10px 12px;
  }

  .book-spine {
    --spine-h: 140px;
  }

  .bookshelf-collection,
  .year-block--empty .bookshelf-collection {
    min-height: 168px;
  }

  .library-scroll {
    background:
      linear-gradient(
        90deg,
        transparent 43px,
        rgba(255, 255, 255, 0.07) 43px,
        rgba(255, 255, 255, 0.07) 44px,
        transparent 44px
      ) left top / 44px 100% no-repeat,
      linear-gradient(90deg, rgba(6, 7, 9, 0.98), rgba(12, 14, 18, 0.75)) left top / 44px
        100% no-repeat;
  }

  .library-scroll-inner {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .shelves-loading {
    left: 44px;
    right: 12px;
  }

  .shelves-panel {
    padding: 12px 12px 32px;
  }

  .year-marker {
    font-size: 10px;
    letter-spacing: 0.02em;
    gap: 2px;
    padding: 2px 0 0 2px;
  }

  .year-marker::before {
    flex-basis: 5px;
    width: 5px;
    height: 5px;
  }

  .book-focus-stage {
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px));
    max-width: min(94vw, 360px);
  }

  .book-flyer-stage {
    width: min(56vw, 220px);
    height: min(56vw, 220px);
  }

  .book-focus-title {
    font-size: 1.25rem;
  }

  .song-table--search.song-table-header,
  .song-list.song-table--search .song-row,
  .song-table--favorites.song-table-header,
  .song-list.song-table--favorites .song-row,
  .song-table--album.song-table-header,
  .song-list.song-table--album .song-row {
    grid-template-columns: 36px minmax(0, 1fr) 44px;
  }

  .song-table--with-favorite.song-table--search.song-table-header,
  .song-list.song-table--with-favorite.song-table--search .song-row,
  .song-table--with-favorite.song-table--favorites.song-table-header,
  .song-list.song-table--with-favorite.song-table--favorites .song-row,
  .song-table--with-favorite.song-table--album.song-table-header,
  .song-list.song-table--with-favorite.song-table--album .song-row {
    grid-template-columns: 36px minmax(0, 1fr) 32px 44px;
  }

  .song-table--search .col-album,
  .song-table--search.song-table-header .col-album,
  .song-table--favorites .col-album,
  .song-table--favorites.song-table-header .col-album {
    display: none;
  }

  .song-table-header,
  .song-row {
    gap: 12px;
    padding: 4px 12px;
  }

  .main-content:has(.view-home:not(.hidden)) {
    padding-bottom: 0;
  }

  .library-scroll {
    padding-bottom: var(--player-mobile-scroll-pad);
  }

  .now-playing-topbar {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    padding-inline: 16px;
    min-height: calc(48px + env(safe-area-inset-top, 0px));
  }

  .player-bar {
    position: fixed;
    left: var(--player-mobile-inset-x);
    right: var(--player-mobile-inset-x);
    bottom: var(--player-mobile-lift);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: auto;
    height: auto;
    min-height: var(--player-mini-h);
    margin: 0;
    padding: 6px 10px 6px 8px;
    border-radius: 14px;
    background: rgba(36, 36, 38, 0.82);
    backdrop-filter: blur(24px) saturate(1.45);
    -webkit-backdrop-filter: blur(24px) saturate(1.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
    z-index: 25;
  }

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

  .player-track {
    flex: 1;
    min-width: 0;
    order: 0;
    gap: 10px;
  }

  .player-meta {
    cursor: pointer;
  }

  .player-center {
    order: 1;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    flex-direction: row;
    gap: 0;
  }

  .player-center .progress-row {
    display: none;
  }

  .player-controls {
    gap: 0;
  }

  .player-bar #shuffle-btn,
  .player-bar #repeat-btn,
  .player-bar #prev-btn {
    display: none;
  }

  .player-extra {
    display: none;
  }

  .player-volume {
    display: none;
  }

  .player-art {
    width: 42px;
    height: 42px;
    border-radius: 6px;
  }

  .player-title {
    font-size: 13px;
    line-height: 1.2;
  }

  .player-meta-line {
    margin-top: 1px;
    font-size: 11px;
  }

  .player-meta-line .player-sep,
  .player-meta-line #player-album {
    display: none;
  }

  .player-artists {
    max-width: 100%;
  }

  .player-bar .play-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    color: var(--text);
  }

  .player-bar .play-btn:hover {
    transform: none;
    opacity: 0.85;
  }

  .player-bar .play-btn svg {
    width: 22px;
    height: 22px;
  }

  .player-bar #next-btn {
    width: 36px;
    height: 36px;
  }

  .player-bar #next-btn svg {
    width: 22px;
    height: 22px;
  }

  .progress-slider::-webkit-slider-thumb,
  .progress-slider::-moz-range-thumb {
    opacity: 1;
    width: 14px;
    height: 14px;
  }

  body:has(#now-playing:not(.hidden)) .player-bar {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 768px) {
  .content-topbar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .main-content {
    padding: 8px 12px var(--player-mobile-scroll-pad);
  }

  .page-hero {
    margin-left: -12px;
    margin-right: -12px;
    padding: 20px 12px;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
}

@media (max-width: 480px) {
  #shuffle-btn,
  #repeat-btn {
    display: none;
  }

  .sidebar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .nav-item {
    min-width: 48px;
    padding: 6px 8px;
  }

  .nav-item span {
    font-size: 9px;
  }

  .hero-title {
    font-size: clamp(1.5rem, 8vw, 2.25rem);
  }

  .hero-art {
    width: 120px;
    height: 120px;
  }

  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-spine {
    --spine-h: 120px;
  }

  .bookshelf-collection,
  .year-block--empty .bookshelf-collection {
    min-height: 148px;
  }

  .player-controls {
    gap: 8px;
  }

  .play-btn {
    width: 40px;
    height: 40px;
  }

  .player-extra .icon-btn {
    width: 38px;
    height: 38px;
  }

  .player-favorite-btn {
    --favorite-btn-size: 36px;
  }

  .song-table-header,
  .song-row {
    gap: 10px;
    padding: 4px 8px;
  }

  .auth-area .btn-primary {
    padding: 7px 14px;
    font-size: 12px;
  }

  .user-avatar {
    width: 26px;
    height: 26px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .media-card .card-play-btn {
    opacity: 1;
    transform: translateY(0);
  }

  .song-row .song-num {
    display: none;
  }

  .song-row .song-play-btn {
    display: flex;
  }

  .song-row.playing .song-play-btn {
    color: var(--accent);
  }

  .book-spine:hover:not(.is-pulling):not(.is-dimmed) {
    transform: none;
  }

  .pill-btn,
  .icon-btn,
  .play-btn,
  .nav-item,
  .chip,
  .genre-tab {
    touch-action: manipulation;
  }
}

/* Now Playing (Apple Music style) */
.now-playing {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  color: #fff;
  overflow: hidden;
  background: var(--now-playing-tint, #000);
}

.now-playing-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--now-playing-tint, #000);
}

.now-playing-bg-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(64px) saturate(1.55) brightness(0.78);
  transform: scale(1.22);
  opacity: 1;
}

.now-playing-bg-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgb(0 0 0 / 0.48) 0%,
      rgb(0 0 0 / 0.1) 42%,
      rgb(0 0 0 / 0.1) 58%,
      rgb(0 0 0 / 0.52) 100%
    ),
    color-mix(in srgb, var(--now-playing-tint, #000) 52%, transparent);
}

.now-playing-topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 0;
  min-height: 56px;
  flex-shrink: 0;
}

.now-playing-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.now-playing-close,
.now-playing-queue-toggle,
.now-playing-lyrics-toggle {
  width: 40px;
  height: 40px;
  color: rgba(255, 255, 255, 0.92);
}

.now-playing-queue-toggle.active,
.now-playing-lyrics-toggle.active {
  color: var(--play);
}

.now-playing-body {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(32px, 6vw, 96px);
}

.now-playing-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: min(560px, 82vw);
  gap: 32px;
}

.now-playing-art-wrap {
  width: min(560px, min(82vw, 54vh));
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
}

.now-playing-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.now-playing-meta {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  --now-playing-icon-btn-size: 36px;
}

.now-playing-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.track-scroll-copy {
  min-width: 0;
  overflow: hidden;
}

.track-scroll-viewport {
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.track-scroll-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.now-playing-track-copy .track-scroll-inner {
  gap: 6px;
}

.track-scroll-line {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.track-scroll-copy.is-scroll-overflow {
  --track-scroll-edge-mask: linear-gradient(
    to right,
    #000 0,
    #000 calc(100% - 36px),
    rgba(0, 0, 0, 0.35) calc(100% - 16px),
    transparent 100%
  );
}

.track-scroll-copy.is-scroll-overflow[data-scroll-mode="both"] .track-scroll-viewport,
.track-scroll-copy.is-scroll-overflow[data-scroll-mode="title"] [data-scroll-line="title"],
.track-scroll-copy.is-scroll-overflow[data-scroll-mode="meta"] [data-scroll-line="meta"] {
  -webkit-mask-image: var(--track-scroll-edge-mask);
  mask-image: var(--track-scroll-edge-mask);
}

.track-scroll-copy.is-scroll-playing[data-scroll-mode="both"] .track-scroll-inner {
  width: max-content;
  max-width: none;
}

.track-scroll-copy.is-scroll-playing[data-scroll-mode="both"] .track-scroll-line {
  width: max-content;
  max-width: none;
}

.track-scroll-copy.is-scroll-static[data-scroll-mode="title"] [data-scroll-line="title"] .player-title,
.track-scroll-copy.is-scroll-static[data-scroll-mode="title"] [data-scroll-line="title"] .now-playing-title,
.track-scroll-copy.is-scroll-static[data-scroll-mode="meta"] [data-scroll-line="meta"] .player-meta-line,
.track-scroll-copy.is-scroll-static[data-scroll-mode="meta"] [data-scroll-line="meta"] .now-playing-meta-line,
.track-scroll-copy.is-scroll-static[data-scroll-mode="both"] .player-title,
.track-scroll-copy.is-scroll-static[data-scroll-mode="both"] .now-playing-title,
.track-scroll-copy.is-scroll-static[data-scroll-mode="both"] .player-meta-line,
.track-scroll-copy.is-scroll-static[data-scroll-mode="both"] .now-playing-meta-line {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-scroll-copy.is-scroll-playing [data-scroll-line="title"] .player-title,
.track-scroll-copy.is-scroll-playing [data-scroll-line="title"] .now-playing-title,
.track-scroll-copy.is-scroll-playing [data-scroll-line="meta"] .player-meta-line,
.track-scroll-copy.is-scroll-playing [data-scroll-line="meta"] .now-playing-meta-line,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="both"] .track-scroll-inner {
  will-change: transform;
}

.now-playing-track-copy {
  flex: 1;
}

.now-playing-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.track-scroll-copy.is-scroll-playing[data-scroll-mode="title"] [data-scroll-line="title"] .player-title,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="title"] [data-scroll-line="title"] .now-playing-title,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="meta"] [data-scroll-line="meta"] .player-meta-line,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="meta"] [data-scroll-line="meta"] .now-playing-meta-line {
  display: inline-block;
}

.now-playing-meta-line,
.track-scroll-copy .player-meta-line {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

.track-scroll-copy.is-scroll-playing[data-scroll-mode="meta"] .player-meta-line,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="meta"] .now-playing-meta-line,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="both"] .player-meta-line,
.track-scroll-copy.is-scroll-playing[data-scroll-mode="both"] .now-playing-meta-line {
  min-width: max-content;
  max-width: none;
}

.now-playing-meta-line .player-artists,
.track-scroll-copy .player-meta-line .player-artists {
  display: inline-flex;
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.track-scroll-copy.is-scroll-playing .player-meta-line .player-artists,
.track-scroll-copy.is-scroll-playing .now-playing-meta-line .player-artists {
  min-width: max-content;
  max-width: none;
  overflow: visible;
}

.now-playing-meta-line .player-link,
.now-playing-meta-line .player-artist-text,
.track-scroll-copy .player-meta-line .player-link,
.track-scroll-copy .player-meta-line .player-artist-text {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-scroll-copy.is-scroll-playing .player-meta-line .player-link,
.track-scroll-copy.is-scroll-playing .player-meta-line .player-artist-text,
.track-scroll-copy.is-scroll-playing .now-playing-meta-line .player-link,
.track-scroll-copy.is-scroll-playing .now-playing-meta-line .player-artist-text {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
}

.now-playing-meta-line {
  margin-top: 0;
  font-size: clamp(1rem, 1.8vw, 1.125rem);
  line-height: 1.25;
}

.now-playing-meta-line .player-artists,
.now-playing-meta-line .player-link,
.now-playing-meta-line .player-sep,
.now-playing-meta-line .player-artist-text {
  color: rgba(255, 255, 255, 0.72);
}

.now-playing-meta-line .player-link:hover:not(:disabled) {
  color: #fff;
}

.now-playing-favorite-btn {
  width: var(--now-playing-icon-btn-size);
  height: var(--now-playing-icon-btn-size);
  flex-shrink: 0;
  align-self: center;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.92);
}

.now-playing-favorite-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.now-playing-favorite-btn.is-liked {
  background: rgba(255, 255, 255, 0.14);
  color: var(--accent);
}

.now-playing-favorite-btn .favorite-icon-filled {
  color: var(--accent);
}

.now-playing-favorite-btn.is-liked .favorite-icon-outline {
  display: none;
}

.now-playing-favorite-btn.is-liked .favorite-icon-filled {
  display: block !important;
}

.now-playing-favorite-btn:not(.is-liked) .favorite-icon-filled {
  display: none !important;
}

.now-playing-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.now-playing-progress .progress-slider {
  width: 100%;
}

.now-playing-time-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.now-playing-time-row .time-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.now-playing .progress-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.95) var(--progress, 0%),
    rgba(255, 255, 255, 0.28) var(--progress, 0%),
    rgba(255, 255, 255, 0.28) 100%
  );
}

.now-playing .volume-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.95) var(--volume, 80%),
    rgba(255, 255, 255, 0.28) var(--volume, 80%),
    rgba(255, 255, 255, 0.28) 100%
  );
}

.now-playing .progress-slider::-moz-range-progress {
  background: rgba(255, 255, 255, 0.95);
}

.now-playing .progress-slider::-moz-range-track {
  background: rgba(255, 255, 255, 0.28);
}

.now-playing .volume-slider::-moz-range-track {
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.95) var(--volume, 80%),
    rgba(255, 255, 255, 0.28) var(--volume, 80%),
    rgba(255, 255, 255, 0.28) 100%
  );
}

.now-playing .progress-slider::-webkit-slider-thumb,
.now-playing .volume-slider::-webkit-slider-thumb,
.now-playing .progress-slider::-moz-range-thumb,
.now-playing .volume-slider::-moz-range-thumb {
  background: rgba(255, 255, 255, 0.95);
}

.now-playing-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 28px);
}

.now-playing-controls .control-secondary {
  width: var(--now-playing-icon-btn-size);
  height: var(--now-playing-icon-btn-size);
  color: rgba(255, 255, 255, 0.45);
}

.now-playing-controls .control-secondary:hover {
  color: rgba(255, 255, 255, 0.82);
}

.now-playing-controls .control-secondary.active {
  color: var(--play);
}

.now-playing-play-btn {
  width: 64px;
  height: 64px;
  background: #fff;
  color: #000;
}

.now-playing-volume-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.now-playing-volume {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.now-playing-panel-actions {
  display: none;
  align-items: center;
  gap: 4px;
}

.now-playing-panel-actions .icon-btn:hover:not(:disabled),
.now-playing-panel-actions .icon-btn:active:not(:disabled) {
  background: transparent;
}

.now-playing-panel-actions .icon-btn.active {
  background: transparent;
  color: var(--play);
}

.now-playing-panel-actions .now-playing-lyrics-toggle:disabled {
  opacity: 0.38;
  color: rgba(255, 255, 255, 0.45);
}

.now-playing-volume-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.88);
}

.now-playing .volume-slider {
  flex: 1;
  width: auto;
  max-width: none;
}

.now-playing-lyrics {
  position: relative;
  display: none;
  min-width: 0;
  flex-shrink: 0;
  width: min(880px, 58vw);
  height: min(calc(100vh - 64px), 940px);
  align-self: center;
}

.now-playing-lyrics-body {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.45) 8%,
    #000 18%,
    #000 82%,
    rgba(0, 0, 0, 0.45) 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(0, 0, 0, 0.45) 8%,
    #000 18%,
    #000 82%,
    rgba(0, 0, 0, 0.45) 92%,
    transparent 100%
  );
}

.now-playing-lyrics-body::-webkit-scrollbar {
  display: none;
}

.now-playing-lyrics-body .lyrics-scroll {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 2.8vh, 36px);
}

.now-playing-lyrics-body .lyrics-line {
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.18;
  color: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition: color 0.2s ease;
}

.now-playing-lyrics-body .lyrics-line.active {
  color: #fff;
}

.now-playing-lyrics-body .lyrics-line.passed {
  color: rgba(255, 255, 255, 0.28);
}

.now-playing-lyrics-body .lyrics-empty {
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.125rem;
  padding-top: 24px;
}

.now-playing-lyrics-body .lyrics-pad-start {
  height: var(--lyrics-pad-start, 16px);
  flex-shrink: 0;
}

.now-playing-lyrics-body .lyrics-pad-end {
  height: var(--lyrics-pad-end, 40vh);
  flex-shrink: 0;
}

.now-playing-lyrics-toggle:disabled,
.now-playing-lyrics-toggle.is-unavailable {
  opacity: 0.38;
  color: rgba(255, 255, 255, 0.45);
  cursor: default;
}

.now-playing--lyrics-visible .now-playing-body {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(56px, 7vw, 104px);
  width: 100%;
  padding-inline: clamp(32px, 5vw, 80px);
}

.now-playing--lyrics-visible .now-playing-main {
  flex-shrink: 0;
}

.now-playing--lyrics-visible .now-playing-lyrics {
  display: block;
}

@media (max-width: 960px) {
  .now-playing-topbar-actions[aria-hidden="true"] {
    display: none;
  }

  .now-playing-panel-actions:not([aria-hidden="true"]) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    width: 100%;
    padding-top: 4px;
    box-sizing: border-box;
  }

  .now-playing-panel-actions .now-playing-lyrics-toggle {
    grid-column: 1;
    justify-self: center;
  }

  .now-playing-panel-actions .now-playing-queue-toggle {
    grid-column: 2;
    justify-self: center;
  }

  .now-playing-panel-actions .now-playing-lyrics-toggle,
  .now-playing-panel-actions .now-playing-queue-toggle {
    width: 44px;
    height: 44px;
    color: rgba(255, 255, 255, 0.88);
  }

  .now-playing-panel-actions .now-playing-lyrics-toggle:disabled {
    opacity: 0.38;
    color: rgba(255, 255, 255, 0.45);
  }

  .now-playing-panel-actions .icon-btn:hover:not(:disabled),
  .now-playing-panel-actions .icon-btn:active:not(:disabled) {
    background: transparent;
  }

  .now-playing-panel-actions .icon-btn.active {
    background: transparent;
  }

  .now-playing-panel-actions .now-playing-lyrics-toggle.active,
  .now-playing-panel-actions .now-playing-queue-toggle.active {
    color: var(--play);
  }

  .now-playing--lyrics-visible .now-playing-body,
  .now-playing--queue-visible .now-playing-body {
    flex-direction: column;
    gap: 12px;
    padding-inline: 24px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
  }

  .now-playing--lyrics-visible .now-playing-main,
  .now-playing--queue-visible .now-playing-main {
    flex: 0 0 auto;
    width: min(420px, 92vw);
    gap: 12px;
  }

  .now-playing--lyrics-visible .now-playing-art-wrap,
  .now-playing--queue-visible .now-playing-art-wrap {
    width: min(156px, 36vw);
  }

  .now-playing--lyrics-visible .now-playing-meta,
  .now-playing--queue-visible .now-playing-meta {
    gap: 12px;
  }

  .now-playing--lyrics-visible .now-playing-lyrics {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    width: min(760px, 94vw);
    height: auto;
    max-height: none;
  }

  .now-playing--lyrics-visible .now-playing-lyrics-body {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .now-playing--queue-visible .queue-panel.queue-panel--inline {
    flex: 1 1 0;
    min-height: 0;
    width: min(760px, 94vw);
    height: auto;
    max-height: none;
  }

  .queue-panel.queue-panel--inline {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: auto;
    flex-shrink: 1;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    animation: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .queue-panel.queue-panel--inline .queue-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    padding: 0 0 8px;
    border: none;
    background: transparent;
  }

  .queue-panel.queue-panel--inline .queue-header::before {
    display: none;
  }

  .queue-panel.queue-panel--inline .queue-header h3 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: rgba(255, 255, 255, 0.55);
  }

  .queue-panel.queue-panel--inline #close-queue {
    display: none;
  }

  .queue-panel.queue-panel--inline .queue-body {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(
      to bottom,
      #000 0%,
      #000 86%,
      rgba(0, 0, 0, 0.5) 94%,
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      #000 0%,
      #000 86%,
      rgba(0, 0, 0, 0.5) 94%,
      transparent 100%
    );
  }

  .queue-panel.queue-panel--inline .queue-body::-webkit-scrollbar {
    display: none;
  }

  .now-playing-lyrics-body .lyrics-line {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
  }
}

@media (max-width: 640px) {
  .now-playing-body {
    padding-inline: 20px;
  }

  .now-playing-main {
    width: min(420px, 92vw);
    gap: 24px;
  }

  .now-playing-art-wrap {
    width: min(420px, min(92vw, 50vh));
  }

  .now-playing--lyrics-visible .now-playing-art-wrap,
  .now-playing--queue-visible .now-playing-art-wrap {
    width: min(148px, 34vw);
  }

  .now-playing-play-btn {
    width: 56px;
    height: 56px;
  }
}
