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

:root {
  --bg: #0a0a0a;
  --text: #f2f2f2;
  --dim: #a0a0a0;
  --faint: #696969;
  --track-bg: #404040;
  --green: #22c55e;
  --green-hover: #38da72;
  --accent: #22c55e;
  --accent-hover: #38da72;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --accent-row: rgba(34, 197, 94, 0.075);
  --accent-glow: rgba(34, 197, 94, 0.3);
  --row-hover: rgba(255,255,255,0.055);
  --border: #2e2e2e;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "tnum";
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%; height: 100%;
}

#desktop-titlebar {
  display: none;
}

body.desktop #desktop-titlebar {
  position: fixed;
  inset: 0 0 auto 0;
  height: 32px;
  z-index: 1000;
  display: flex;
  justify-content: flex-end;
  background: rgba(10,10,10,0.82);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  -webkit-app-region: drag;
}

body.desktop #app {
  height: calc(100% - 32px);
  margin-top: 32px;
}

#desktop-drag-region {
  flex: 1;
}

#window-controls {
  display: flex;
  height: 32px;
  -webkit-app-region: no-drag;
}

.win-btn {
  width: 44px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.win-btn svg {
  width: 14px;
  height: 14px;
}
.win-btn:hover {
  background: rgba(255,255,255,0.075);
  color: var(--text);
}
.win-btn.close:hover {
  background: #e81123;
  color: #fff;
}
#win-maximize .ic-restore { display: none; }
body.window-maximized #win-maximize .ic-max { display: none; }
body.window-maximized #win-maximize .ic-restore { display: block; }

/* ---- Top panel ---- */
#top-panel {
  display: flex;
  height: 50%;
  min-height: 200px;
  border-bottom: 1px solid var(--border);
}

#top-left {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: 32px;
  gap: 16px 36px;
  position: relative;
  min-width: 0;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 10%, var(--accent-soft), transparent 32%),
    linear-gradient(135deg, rgba(255,255,255,0.035), transparent 58%);
}

#top-left > *:not(#player-backdrop) { position: relative; z-index: 1; }

#player-backdrop {
  position: absolute;
  inset: -60px;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.65s ease;
}
#top-left.has-art #player-backdrop { opacity: 1; }
.backdrop-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: blur(48px) saturate(1.35);
  transform: scale(1.12);
  opacity: 0;
  transition: opacity 0.75s ease;
}
.backdrop-layer.active { opacity: 0.14; }
.backdrop-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10,10,10,0.48), rgba(10,10,10,0.9));
}

#album-card {
  width: clamp(64px, 14vw, 200px);
  aspect-ratio: 1;
  overflow: hidden;
  flex-shrink: 0;
  background: #1e1e1e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  color: var(--faint);
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  box-shadow: 0 24px 60px rgba(0,0,0,0.38), 0 0 0 1px rgba(255,255,255,0.055);
}
#album-card-glare {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}
#album-art, #album-art-b {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.42s ease, transform 0.42s ease;
  transform: scale(1.025);
}
#album-art.active, #album-art-b.active {
  opacity: 1;
  transform: scale(1);
}
#album-card .placeholder {
  width: 46%;
  aspect-ratio: 1;
  color: var(--faint);
  opacity: 0.65;
  transition: opacity 0.25s ease, color 0.25s ease;
}
#album-card.has-art .placeholder { opacity: 0; }
#album-card .placeholder svg {
  width: 100%;
  height: 100%;
  display: block;
}

#now-playing {
  flex: 1;
  min-width: 120px;
  padding-top: 8px;
}
#song-title {
  font-size: 1.12em; font-weight: 760;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
#song-artist {
  font-size: 0.85em; font-weight: 600;
  color: var(--dim);
  cursor: alias;
  transition: color 0.15s ease;
}
#song-artist:hover { color: var(--accent); }
#song-album {
  font-size: 0.8em;
  color: var(--faint);
}
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#controls-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.ctrl-btn {
  background: none; border: none; color: var(--text);
  cursor: pointer; font-size: 1em; padding: 4px 8px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.ctrl-btn svg { width: 19px; height: 19px; display: block; }
.ctrl-btn:hover { color: #fff; transform: scale(1.15); background: rgba(255,255,255,0.06); }
.play-btn {
  width: 48px; height: 48px;
  background: var(--accent); color: #080e09;
  font-size: 1.2em;
  box-shadow: 0 12px 30px var(--accent-glow);
}
.play-btn:hover { background: var(--accent-hover); transform: scale(1.08); }
.play-btn .ic-pause { display: none; }
.play-btn.is-playing .ic-play { display: none; }
.play-btn.is-playing .ic-pause { display: block; }
#btn-shuffle.active, #btn-repeat.active { color: var(--accent); }
#btn-queue {
  position: relative;
}
#btn-queue.active { color: var(--accent); }
#queue-badge {
  position: absolute;
  right: -2px;
  top: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #080e09;
  font-size: 0.62rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  line-height: 15px;
}
#btn-queue.has-items #queue-badge { display: flex; }

#seek-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
}
#time-current, #time-total {
  font-size: 0.75em; color: var(--dim);
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}
#time-total { text-align: right; }
#seek-track {
  flex: 1; height: 6px; background: var(--track-bg);
  position: relative; cursor: pointer;
}
#seek-fill {
  height: 100%; background: linear-gradient(90deg, #ebebeb, var(--accent));
  width: 0%;
}
#seek-thumb {
  position: absolute; top: 50%; width: 14px; height: 14px;
  background: #fff;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.08), 0 0 16px var(--accent-glow);
}

#volume-wrap {
  display: flex; align-items: center;
  width: 80px; height: 20px;
  margin-left: auto;
}
#vol-track {
  width: 100%; height: 4px; background: var(--track-bg);
  position: relative; cursor: pointer;
}
#vol-fill {
  position: absolute; left: 0; height: 100%;
  background: var(--accent);
}
#vol-thumb {
  position: absolute; top: 50%; width: 12px; height: 12px;
  background: #fff;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#vol-icon {
  width: 18px; height: 18px; margin-right: 8px;
  color: var(--dim);
  flex-shrink: 0;
  cursor: pointer;
}
#vol-icon:hover,
#vol-icon.muted {
  color: var(--accent);
}
#vol-icon:focus,
#vol-icon:focus-visible {
  outline: none;
}
#vol-mute-slash {
  display: none;
}
#vol-icon.muted #vol-mute-slash {
  display: block;
}

/* ---- Top right (visualizer) ---- */
#top-right {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-left: 1px solid var(--border);
}
#viz-canvas {
  width: 100%; height: 100%;
  display: block;
}
#fluid-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: none;
  pointer-events: none;
}
#viz-toggle, #viz-fullscreen, #lyrics-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px;
  background: rgba(20,20,20,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--dim);
  cursor: pointer;
  font-size: 1.05em;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.55;
  transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease;
}
#viz-toggle svg, #viz-fullscreen svg, #lyrics-toggle svg { width: 18px; height: 18px; }
#viz-toggle .ic-bars { display: none; }
#viz-toggle.is-fluid .ic-waves { display: none; }
#viz-toggle.is-fluid .ic-bars { display: block; }
#viz-toggle:hover, #viz-fullscreen:hover, #lyrics-toggle:hover,
#lyrics-toggle.active {
  opacity: 1;
  color: var(--text);
  background: rgba(45,45,45,0.75);
}
#lyrics-toggle {
  right: 54px;
}
#lyrics-toggle.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, rgba(255,255,255,0.14));
}
#viz-fullscreen {
  top: auto; bottom: 12px;
  display: none;
}

#lyrics-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(28px, 7vh, 54px) clamp(28px, 7vw, 72px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
#lyrics-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0.18), rgba(0,0,0,0.58) 70%),
    linear-gradient(180deg, rgba(10,10,10,0.16), rgba(10,10,10,0.5));
  opacity: 0.9;
}
#lyrics-overlay.active {
  opacity: 1;
  transform: translateY(0);
}
#lyrics-status {
  position: relative;
  z-index: 1;
  max-width: min(86%, 520px);
  color: var(--dim);
  font-size: 0.78em;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-align: center;
}
#lyrics-status:empty { display: none; }
#lyrics-lines {
  position: relative;
  z-index: 1;
  width: min(88%, 620px);
  max-height: min(78%, 360px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  text-align: center;
  text-shadow: 0 2px 22px rgba(0,0,0,0.9);
}
.lyrics-synced {
  height: min(78%, 360px);
  min-height: 220px;
}
.lyrics-line {
  color: rgba(255,255,255,0.48);
  font-size: clamp(0.86rem, 1.35vw, 1.08rem);
  font-weight: 620;
  line-height: 1.25;
  opacity: 0.66;
  transform: scale(0.96);
  transition: color 0.42s ease, opacity 0.42s ease, transform 0.52s cubic-bezier(0.22, 1, 0.36, 1), filter 0.42s ease;
  will-change: transform, opacity;
  overflow-wrap: break-word;
  text-wrap: balance;
}
.synced-lyric {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(88%, 560px);
  max-width: calc(100% - 56px);
  padding: 0 12px;
  opacity: 0;
  filter: blur(3px);
  pointer-events: none;
  transform: translate(-50%, calc(-50% + (var(--rel, 0) * 54px))) scale(0.9);
}
.lyrics-line.current {
  color: #fff;
  font-size: clamp(1.05rem, 1.65vw, 1.46rem);
  font-weight: 780;
  opacity: 1;
  filter: blur(0);
  transform: translate(-50%, calc(-50% + (var(--rel, 0) * 54px))) scale(1.04);
}
.lyrics-line.next {
  color: rgba(255,255,255,0.72);
  opacity: 0.82;
  filter: blur(0);
}
.lyrics-line.near {
  opacity: 0.74;
  filter: blur(0);
}
.lyrics-line.far {
  opacity: 0;
  filter: blur(5px);
}
.lyrics-plain {
  justify-content: flex-start !important;
  overflow-y: auto !important;
  padding: 8px 14px 8px 10px;
  pointer-events: auto;
  text-align: left !important;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 60%, #6f6f6f) rgba(255,255,255,0.08);
}
.lyrics-plain .lyrics-line {
  text-align: left;
  transform: none;
  opacity: 0.9;
  filter: none;
  transition: color 0.2s ease, opacity 0.2s ease;
  text-wrap: initial;
}
.lyrics-plain::-webkit-scrollbar {
  width: 9px;
}
.lyrics-plain::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.055);
}
.lyrics-plain::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff), color-mix(in srgb, var(--accent) 45%, #2b2b2b));
  border: 2px solid rgba(11,11,11,0.88);
  box-shadow: 0 0 12px var(--accent-glow);
}
.lyrics-plain::-webkit-scrollbar-thumb:hover {
  background: var(--accent-hover);
}

/* ---- Fluid fullscreen overlay ---- */
body.fluid-fs #top-right {
  position: fixed; inset: 0;
  z-index: 50;
  border-left: none;
  background: #000;
}
body.fluid-fs #top-left {
  position: fixed;
  left: 24px; bottom: 24px;
  z-index: 51;
  flex: none;
  width: min(520px, calc(100vw - 48px));
  padding: 24px;
  background: rgba(10,10,10,0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
}

/* ---- Bottom panel ---- */
#bottom-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#pager-strip {
  display: flex;
  height: 100%;
  transition: none;
}
.page {
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Queue drawer ---- */
#queue-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 100%);
  z-index: 8;
  display: flex;
  flex-direction: column;
  background: rgba(11,11,11,0.96);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 48px rgba(0,0,0,0.38);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.23,1,0.32,1);
}
#queue-panel.open { transform: translateX(0); }
#queue-head {
  height: 58px;
  padding: 12px 14px 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
#queue-title {
  font-size: 0.82em;
  font-weight: 760;
  letter-spacing: 0.05em;
}
#queue-count {
  margin-top: 3px;
  color: var(--faint);
  font-size: 0.74em;
  font-variant-numeric: tabular-nums;
}
#queue-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #3b3b3b;
  background: none;
  color: var(--dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover {
  color: var(--text);
  border-color: #626262;
  background: rgba(255,255,255,0.055);
  transform: scale(1.06);
}
#queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px;
}
.queue-section {
  padding: 11px 10px 7px;
  color: var(--faint);
  font-size: 0.7em;
  font-weight: 760;
  letter-spacing: 0.08em;
}
.queue-row {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 6px 10px;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}
.queue-row:hover {
  background: rgba(255,255,255,0.065);
  transform: translateX(-3px);
}
.queue-row.manual { background: rgba(255,255,255,0.025); }
.queue-row.playing {
  background: var(--accent-row);
  box-shadow: inset 2px 0 0 var(--accent);
}
.queue-thumb {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: #1e1e1e;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.queue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.queue-meta {
  flex: 1;
  min-width: 0;
}
.queue-title {
  font-size: 0.82em;
  font-weight: 650;
}
.queue-artist {
  margin-top: 2px;
  font-size: 0.72em;
  color: var(--dim);
}
.queue-tag {
  width: 24px;
  color: var(--faint);
  font-size: 0.72em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.queue-remove {
  opacity: 0;
  flex-shrink: 0;
}
.queue-row:hover .queue-remove { opacity: 1; }
.queue-empty {
  padding: 44px 20px;
  color: var(--faint);
  text-align: center;
  font-size: 0.82em;
}

/* ---- Playlist page ---- */
#pl-header {
  padding: 18px 28px 10px;
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.04em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
}

.add-btn {
  width: 1.05em; height: 1.05em;
  border: 1px solid #464646;
  background: none;
  color: var(--dim);
  font-size: 1em; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.add-btn:hover {
  color: #080e09;
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.12);
}
.add-btn svg { width: 0.72em; height: 0.72em; }
#pl-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}
.pl-row {
  display: flex; align-items: center;
  padding: 8px 16px; gap: 16px;
  cursor: pointer; height: 75px;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.pl-row:hover {
  background: rgba(255,255,255,0.07);
  transform: translateX(5px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.pl-thumb {
  width: 54px; height: 54px;
  flex-shrink: 0; overflow: hidden;
  background: #1e1e1e;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5em; color: var(--faint);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pl-row:hover .pl-thumb {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.pl-name { font-weight: 600; font-size: 0.95em; }
.pl-count { font-size: 0.8em; color: var(--dim); margin-left: auto; }
.music-icon {
  width: 45%;
  height: 45%;
  color: var(--faint);
}

/* ---- Songs page ---- */
#song-header {
  display: flex; align-items: center;
  padding: 14px 28px 10px; gap: 12px;
  flex-shrink: 0;
}
#btn-back { font-size: 1.1em; padding: 4px 12px; }
#song-header-name { font-weight: 700; font-size: 0.95em; text-transform: uppercase; }
#song-header-count { font-size: 0.8em; color: var(--faint); }
#search-box {
  margin-left: auto;
  border: 1px solid #464646;
  padding: 2px 10px;
  display: flex; align-items: center;
  position: relative;
}
#search-box::before {
  content: "";
  width: 14px; height: 14px;
  margin-right: 7px;
  opacity: 0.65;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") center / contain no-repeat;
}
#search-box:focus-within { border-color: #787878; }
#search-input {
  background: none; border: none; color: var(--text);
  outline: none; font-size: 0.8em; width: 180px;
}
#search-input::placeholder { color: var(--faint); }

#song-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}
.song-row {
  display: flex; align-items: center;
  padding: 8px 16px; gap: 16px;
  cursor: pointer; height: 75px;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.song-row:hover {
  background: rgba(255,255,255,0.07);
  transform: translateX(5px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.song-row.active { background: var(--accent-row); box-shadow: inset 2px 0 0 var(--accent); }
.song-row.dragging { opacity: 0.4; }
.song-row.drag-over { background: var(--accent-soft); transform: translateX(5px); }
.song-num {
  width: 40px; text-align: right;
  font-size: 0.85em; color: var(--faint); flex-shrink: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}
.song-row.active .song-num {
  display: flex;
  justify-content: flex-end;
}
.eq-icon {
  width: 18px;
  height: 18px;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.song-row.active .eq-icon { display: flex; }
.song-row.active .song-index { display: none; }
.eq-icon span {
  width: 3px;
  height: 6px;
  background: var(--accent);
  animation: eq-bounce 0.92s ease-in-out infinite;
}
.eq-icon span:nth-child(2) { height: 13px; animation-delay: -0.28s; }
.eq-icon span:nth-child(3) { height: 9px; animation-delay: -0.52s; }
@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.45); opacity: 0.7; }
  50% { transform: scaleY(1); opacity: 1; }
}
.song-row:hover .song-num {
  color: var(--text);
  transform: translateX(-3px);
}
.song-thumb {
  width: 54px; height: 54px;
  object-fit: cover; flex-shrink: 0;
  background: #1e1e1e;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5em; color: var(--faint);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.song-row:hover .song-thumb {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.song-info { flex: 1; min-width: 0; }
.song-title { font-weight: 600; font-size: 0.9em; }
.song-row.active .song-title { color: var(--accent); }
.song-artist { font-size: 0.75em; color: var(--dim); margin-top: 2px; cursor: alias; transition: color 0.15s ease; display: inline-block; max-width: 100%; }
.song-artist:hover { color: var(--accent); }

.skeleton-row { pointer-events: none; }
.sk-line, .sk-thumb {
  position: relative;
  overflow: hidden;
  background: rgba(255,255,255,0.075);
}
.sk-thumb { width: 54px; height: 54px; flex-shrink: 0; }
.sk-line {
  height: 12px;
  margin: 6px 0;
}
.sk-line.short { width: 46%; }
.sk-line.long { width: 72%; }
.sk-line::after, .sk-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.13), transparent);
  animation: skeleton-shimmer 1.35s infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }

.marquee { overflow: hidden !important; white-space: nowrap !important; text-overflow: clip !important; }
.marquee-inner { display: inline-block; white-space: nowrap; will-change: transform; }
.marquee-inner.anim { animation: marquee-scroll linear infinite; }
@keyframes marquee-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* Context menu */
#ctx-menu {
  position: fixed; z-index: 100;
  background: #1a1a1a; border: 1px solid #333;
  padding: 4px 0; min-width: 140px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.ctx-item {
  padding: 8px 16px; cursor: pointer;
  font-size: 0.8em; color: var(--text);
  transition: background 0.12s ease;
}
.ctx-item:hover { background: var(--accent); color: #080e09; }
.ctx-item.danger { color: #fca5a5; }
.ctx-item.danger:hover { background: #ef4444; color: #fff; }
.ctx-item.disabled,
.ctx-item.disabled:hover {
  color: var(--faint);
  background: transparent;
  cursor: default;
  opacity: 0.42;
}
.ctx-sep {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 0;
}

/* ---- Modals ---- */
#modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #161616;
  border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0,0,0,0.6);
  padding: 22px;
  width: min(380px, 92vw);
  display: flex; flex-direction: column; gap: 14px;
}
.modal-wide {
  width: min(640px, 92vw);
  max-height: min(640px, 82vh);
}
.modal-title { font-weight: 700; font-size: 1em; }
#yt-playlist-label { color: var(--accent); font-size: 0.85em; margin-left: 10px; text-transform: uppercase; }
.modal input[type="text"] {
  background: #0d0d0d;
  border: 1px solid #464646;
  color: var(--text);
  outline: none;
  padding: 9px 12px;
  font-size: 0.9em;
  width: 100%;
}
.modal input[type="text"]:focus { border-color: #787878; }
.modal-error { color: #f87171; font-size: 0.8em; min-height: 1em; }
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.settings-field span {
  color: var(--dim);
  font-size: 0.74em;
  font-weight: 680;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
#settings-status {
  min-height: 20px;
  color: var(--faint);
  font-size: 0.8em;
  line-height: 1.35;
}
#settings-status.ok { color: var(--accent); }
#settings-status.bad { color: #f87171; }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
}
.modal-btn {
  background: none;
  border: 1px solid #464646;
  color: var(--text);
  cursor: pointer;
  padding: 7px 18px;
  font-size: 0.85em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.modal-btn:hover { border-color: #787878; background: rgba(255,255,255,0.05); }
.modal-btn.primary { background: var(--accent); border-color: var(--accent); color: #080e09; font-weight: 600; }
.modal-btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.modal-btn:disabled { opacity: 0.45; cursor: default; }

#yt-search-row { display: flex; gap: 10px; }
#yt-results {
  flex: 1;
  overflow-y: auto;
  min-height: 120px;
  display: flex; flex-direction: column;
}
.yt-status-msg { color: var(--faint); font-size: 0.85em; padding: 24px 0; text-align: center; }
.yt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.yt-row.skeleton-row { pointer-events: none; }
.yt-thumb {
  width: 80px; height: 45px;
  object-fit: cover; flex-shrink: 0;
  background: #1e1e1e;
}
.yt-info { flex: 1; min-width: 0; }
.yt-title { font-size: 0.85em; font-weight: 600; }
.yt-meta { font-size: 0.75em; color: var(--dim); margin-top: 2px; }
.yt-dl-btn {
  flex-shrink: 0;
  min-width: 110px;
  text-align: center;
}
.yt-dl-btn.working { color: var(--accent); border-color: var(--accent-glow); background: var(--accent-soft); }
.yt-dl-btn.done { color: var(--accent); border-color: transparent; background: none; cursor: default; }
.yt-dl-btn.failed { color: #f87171; border-color: rgba(248,113,113,0.4); }
.yt-row .sk-thumb { width: 80px; height: 45px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; }

/* Responsive */
@media (max-width: 700px) {
  #top-left { padding: 16px; gap: 8px 16px; }
  #search-input { width: 100px; }
  #volume-wrap { display: none; }
}
