:root {
  color-scheme: dark;
  --black: #000000;
  --bg: #121212;
  --panel: #121212;
  --panel-2: #181818;
  --panel-3: #282828;
  --hover: #2a2a2a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: #a7a7a7;
  --quiet: #727272;
  --green: #1ed760;
  --green-dark: #1db954;
  --danger: #f3727f;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.42);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: 'Figtree', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button:not(:disabled),
input[type="range"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

#hidden-youtube-player {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 320px;
  height: 180px;
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 8px;
  height: calc(100vh - 90px);
  padding: 8px;
}

.sidebar,
.main-panel {
  background: var(--bg);
  border-radius: 8px;
  min-height: 0;
}

.sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
}

.brand,
.nav-stack,
.library-panel {
  background: var(--bg);
  border-radius: 8px;
}

.brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--black);
  font-weight: 950;
}

.brand strong,
.brand span,
.track-copy strong,
.track-copy span,
.song-title,
.song-artist {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand span,
small {
  color: var(--muted);
  font-size: 12px;
}

.nav-stack {
  display: grid;
  gap: 4px;
  padding: 8px 12px 14px;
}

.nav-button,
.liked-card,
.song-card,
.row-card {
  width: 100%;
  text-align: left;
  color: var(--text);
  background: transparent;
  border-radius: 6px;
  transition: background 180ms ease, color 180ms ease, transform 280ms var(--ease-out), box-shadow 280ms ease;
}

.nav-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.nav-button svg,
.search-box svg,
.volume-row svg {
  flex: 0 0 auto;
  color: currentColor;
}

.nav-button:hover,
.nav-button.is-active,
.liked-card:hover,
.row-card:hover {
  color: var(--text);
}

.nav-button.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.library-panel {
  padding: 8px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.section-reason {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.section-header.compact {
  padding: 8px 12px;
  margin-bottom: 8px;
}

.section-header.compact h2 {
  font-size: 15px;
  color: var(--muted);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.icon-button,
.profile-chip {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  transition: color 180ms ease, background 180ms ease, transform 240ms var(--ease-out);
}

.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.04);
}

.liked-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px;
}

.liked-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.liked-art {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #450af5, #c4efd9);
  color: white;
}

.main-panel {
  position: relative;
  min-width: 0;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(60, 60, 60, 0.5), rgba(18, 18, 18, 0) 330px),
    var(--bg);
}

.main-panel::-webkit-scrollbar {
  width: 12px;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(220px, 430px) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 16px 24px;
  background: rgba(18, 18, 18, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.history-controls {
  display: flex;
  gap: 8px;
}

.history-controls .icon-button {
  background: rgba(0, 0, 0, 0.54);
  color: var(--text);
}

.history-controls .icon-button:hover {
  background: rgba(0, 0, 0, 0.8);
}

.search-box {
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text);
  border: 2px solid transparent;
  transition: border-color 220ms ease, background 220ms ease, box-shadow 260ms ease, transform 260ms var(--ease-out);
}

.search-box:focus-within,
.search-box:hover {
  background: #333333;
  border-color: #555555;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
  transform: translateY(-1px);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-weight: 500;
}

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

.profile-chip {
  justify-self: end;
  color: var(--text);
  background: rgba(0, 0, 0, 0.62);
  border: 4px solid rgba(0, 0, 0, 0.35);
  transition: transform 150ms ease;
}

.profile-chip:hover {
  transform: scale(1.05);
}

.hero-band {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  padding: 32px 32px 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.hero-band h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero-stat {
  min-width: 132px;
  padding: 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.hero-stat strong {
  display: block;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.status-region {
  min-height: 28px;
  padding: 0 32px;
  color: var(--muted);
  font-size: 14px;
}

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

.content-grid {
  display: grid;
  gap: 40px;
  padding: 0 32px 48px;
}

.content-grid > section {
  animation: section-enter 420ms var(--ease-out) both;
}

.smart-section {
  display: grid;
  gap: 40px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 460ms var(--ease-out), transform 460ms var(--ease-out);
}

.smart-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.song-card {
  position: relative;
  min-width: 0;
  padding: 16px;
  background: var(--panel-2);
  border-radius: 8px;
  will-change: transform;
}

.song-card:hover,
.song-card.is-playing {
  background: var(--panel-3);
}

.song-card:hover {
  transform: translateY(-6px) scale(1.015);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
}

.cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #333, #555);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  display: grid;
  place-items: center;
  color: var(--muted);
  margin-bottom: 16px;
}

.cover img,
.player-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 420ms var(--ease-out), opacity 240ms ease;
}

.song-card:hover .cover img {
  transform: scale(1.05);
}

.song-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.song-artist {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
}

.song-card.is-playing .song-title,
.row-card.is-playing .song-title {
  color: var(--green);
}

.play-float {
  position: absolute;
  right: 24px;
  bottom: 84px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--black);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translateY(12px) scale(0.92);
  transition: opacity 240ms ease, transform 340ms var(--ease-spring), background 200ms ease, box-shadow 260ms ease;
  font-weight: 950;
}

.song-card:hover .play-float,
.song-card.is-playing .play-float {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.play-float:hover {
  background: #3be477;
  transform: translateY(-1px) scale(1.08);
  box-shadow: 0 14px 30px rgba(30, 215, 96, 0.24), 0 10px 24px rgba(0, 0, 0, 0.36);
}

.row-list {
  display: grid;
  gap: 4px;
}

.row-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 8px 16px 8px 8px;
  border-radius: 6px;
  background: transparent;
}

.row-card:hover,
.row-card.is-playing {
  background: rgba(255, 255, 255, 0.08);
}

.row-card:hover {
  transform: translateX(4px);
}

.row-card .cover {
  width: 52px;
  margin: 0;
  border-radius: 4px;
  box-shadow: none;
}

.row-action {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--black);
  background: var(--green);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 180ms ease, transform 260ms var(--ease-spring);
}

.row-card:hover .row-action,
.row-card.is-playing .row-action {
  opacity: 1;
  transform: scale(1);
}

.row-action:hover {
  transform: scale(1.08);
}

.empty-state {
  padding: 48px;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
  font-weight: 500;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 24px;
}

.skeleton-card {
  height: 256px;
  border-radius: 8px;
  background: linear-gradient(90deg, #181818, #282828, #181818);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@keyframes section-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.motion-enter {
  animation: content-rise 540ms var(--ease-out) both;
  animation-delay: var(--stagger, 0ms);
}

@keyframes content-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.player {
  height: 90px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 620px) minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px 16px;
  background: var(--black);
  border-top: 1px solid #282828;
  transition: box-shadow 260ms ease, border-color 260ms ease;
}

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

.player-thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  color: var(--muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-thumb img {
  display: none;
}

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

.track-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.track-copy span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}

.transport {
  display: grid;
  gap: 8px;
}

.transport-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.transport-buttons .icon-button {
  color: var(--muted);
}

.transport-buttons .icon-button:hover {
  color: var(--text);
  background: transparent;
}

.transport-buttons .mode-button.is-active,
.transport-buttons .mode-button.is-active:hover {
  color: var(--green);
}

.mode-button.is-active::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  position: absolute;
  bottom: 2px;
}

.mode-button {
  position: relative;
}

.play-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--black);
  transition: transform 240ms var(--ease-spring), background 180ms ease, box-shadow 220ms ease;
}

.play-button:hover {
  transform: scale(1.1);
  background: white;
  box-shadow: 0 10px 22px rgba(255, 255, 255, 0.12);
}

.progress-row,
.volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.progress-row span {
  width: 40px;
  text-align: center;
}

.volume-row {
  justify-content: end;
}

/* Custom Progress Bar Wrapper */
.progress-bar-wrapper {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: height 180ms ease, background 180ms ease;
}

.progress-bar-wrapper:hover {
  height: 6px;
}

.progress-bar-wrapper input[type="range"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}

.progress-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--text);
  border-radius: 999px;
  width: 0%;
  pointer-events: none;
  transition: width 220ms linear, background 180ms ease;
}

.progress-bar-wrapper:hover .progress-bar-fill {
  background: var(--green);
}

.volume-wrapper {
  max-width: 100px;
}

.queue-drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 102px;
  z-index: 30;
  width: min(420px, calc(100vw - 24px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(30, 215, 96, 0.12), rgba(24, 24, 24, 0) 210px),
    rgba(18, 18, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.62);
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  opacity: 0.94;
  transition: transform 440ms var(--ease-spring), opacity 240ms ease;
}

.queue-drawer.is-open {
  transform: translateX(0);
  opacity: 1;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 14px;
}

.queue-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.queue-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 6px 12px 18px;
  overflow-y: auto;
}

.queue-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 12px;
  padding: 8px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border-radius: 10px;
  transition: background 180ms ease, transform 260ms var(--ease-out);
}

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

.queue-item:hover {
  transform: translateX(-2px);
}

.queue-item .cover {
  width: 52px;
  margin: 0;
  border-radius: 7px;
  box-shadow: none;
}

.queue-item span:not(.cover) {
  min-width: 0;
}

.queue-item strong,
.queue-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item strong {
  font-size: 14px;
  margin-bottom: 4px;
}

.queue-item.is-playing strong {
  color: var(--green);
}

.queue-like {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--green);
  font-size: 20px;
  border-radius: 999px;
  transition: background 180ms ease, transform 240ms var(--ease-spring);
}

.queue-like:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.12);
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: scrim-in 260ms ease both;
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.mobile-nav {
  display: none;
}

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

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .song-grid,
  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }

  .player {
    grid-template-columns: minmax(170px, 1fr) minmax(300px, 540px);
  }

  .volume-row {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
    background: var(--bg);
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: calc(100vh - 212px);
    padding: 0;
  }

  .sidebar {
    display: none;
  }

  .main-panel {
    min-height: calc(100vh - 212px);
    border-radius: 0;
    background: var(--bg);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 16px;
  }

  .history-controls {
    display: none;
  }

  .search-box {
    height: 44px;
    background: var(--panel-2);
  }

  .hero-band {
    align-items: start;
    padding: 24px 20px 16px;
  }

  .hero-band h1 {
    font-size: 32px;
  }

  .hero-stat {
    display: none;
  }

  .status-region,
  .content-grid {
    padding-left: 20px;
    padding-right: 20px;
  }

  .song-grid,
  .skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .song-card {
    padding: 12px;
  }

  .play-float {
    width: 40px;
    height: 40px;
    right: 16px;
    bottom: 72px;
    opacity: 1;
    transform: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }

  .player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 66px;
    z-index: 15;
    grid-template-columns: 1fr;
    height: auto;
    gap: 12px;
    padding: 12px;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
  }

  .track-now {
    justify-content: center;
  }

  .transport-buttons {
    gap: 16px;
  }

  .queue-drawer {
    inset: auto 10px 76px;
    height: min(70vh, 560px);
    width: calc(100vw - 20px);
    border-radius: 18px 18px 22px 22px;
    transform: translateY(calc(100% + 90px));
  }

  .queue-drawer.is-open {
    transform: translateY(0);
  }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 16;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-nav button {
    color: var(--muted);
    background: transparent;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-nav button:hover,
  .mobile-nav button:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    outline: none;
  }
}
