@font-face {
  font-family: "Saans";
  src: url("assets/fonts/SaansMedium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  --font-base: "Saans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #111111;
  --text: #f3f3f3;
  --line: #ffffff17;
  --text-muted: color-mix(in srgb, var(--text) 62%, var(--bg));
  --surface: color-mix(in srgb, var(--text) 5%, transparent);
  --surface-hover: color-mix(in srgb, var(--text) 8%, transparent);
  --surface-border: #ffffff14;
  color-scheme: dark;
  --accent-srgb: #f9290e;
  --accent-p3: #f9290e;
  --accent: var(--accent-srgb);
  --site-header-height: 3.4rem;
}

@supports (color: color(display-p3 0 0 0)) {
  :root {
    --accent-p3: color(display-p3 0.8978 0.2550 0.1592);
    --accent: var(--accent-p3, var(--accent-srgb));
  }
}

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

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

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

button {
  font-family: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0.2em;
}

.player-container {
  max-width: 1240px;
  width: 100%;
  height: calc(100dvh - var(--site-header-height));
  margin: 0 auto;
  padding: 2rem 2rem 1.5rem;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 3.5rem;
  align-items: stretch;
  box-sizing: border-box;
  overflow: hidden;
}

.now-playing-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.art-frame-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-shrink: 1;
  min-height: 0;
}

.art-frame {
  width: 100%;
  max-width: min(320px, 34vh);
  aspect-ratio: 1 / 1;
  border-radius: 0.85rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  background: #141414;
}

.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: opacity, transform;
  transition: opacity 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.55s cubic-bezier(0.25, 1, 0.5, 1);
}

.cover-img--back {
  z-index: 1;
  opacity: 1;
}

.cover-img--front {
  z-index: 2;
  opacity: 1;
}

.track-text-wrap {
  margin-bottom: 1.15rem;
  flex-shrink: 0;
  will-change: opacity, transform;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.track-text-wrap.is-changing {
  opacity: 0;
  transform: translateY(6px);
}

.track-title {
  font-size: clamp(1.6rem, 2.4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  margin-bottom: 0.25rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.progress-wrap {
  margin-bottom: 1.25rem;
  cursor: pointer;
  padding: 0.6rem 0;
  flex-shrink: 0;
  user-select: none;
  touch-action: none;
}

.progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  position: relative;
  transition: height 0.15s ease;
}

.progress-wrap:hover .progress-track,
.progress-wrap.is-dragging .progress-track {
  height: 6px;
}

.progress-buffer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  pointer-events: none;
  transition: width 0.2s ease;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  box-shadow: 0 0 10px var(--accent);
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6), 0 0 4px var(--accent);
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0.6;
  transition: transform 0.15s ease, opacity 0.15s ease;
  pointer-events: none;
}

.progress-wrap:hover .progress-thumb,
.progress-wrap.is-dragging .progress-thumb {
  transform: translate(-50%, -50%) scale(1.15);
  opacity: 1;
}

.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding: 0 0.5rem;
  flex-shrink: 0;
}

.btn-ctrl {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 0.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background-color 0.2s;
  position: relative;
}

.btn-ctrl:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

.btn-ctrl.is-active {
  color: var(--accent);
}

.repeat-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  display: none;
}

.repeat-one-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: monospace;
  color: var(--accent);
  line-height: 1;
  display: none;
}

.btn-play {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, background-color 0.2s;
}

.btn-play:hover {
  transform: scale(1.08);
  border-color: var(--accent);
  background: #202020;
  color: var(--accent);
}

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

.volume-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--surface-border);
  border-radius: 0.65rem;
  padding: 0.55rem 0.9rem;
  flex-shrink: 0;
}

.btn-vol {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.btn-vol:hover {
  color: #fff;
}

.vol-slider {
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline: none;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent);
}

.vol-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: monospace;
  width: 36px;
  text-align: right;
}

.playlist-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.playlist-heading {
  font-size: 1.5rem;
  font-weight: 500;
}

.playlist-badge {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  color: var(--accent);
  font-family: monospace;
}

.playlist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.playlist-list::-webkit-scrollbar {
  width: 5px;
}

.playlist-list::-webkit-scrollbar-track {
  background: transparent;
}

.playlist-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

.playlist-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.playlist-item {
  display: grid;
  grid-template-columns: 32px 48px 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.playlist-item:hover {
  background: var(--surface-hover);
  border-color: var(--line);
}

.playlist-item.is-active {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}

.item-index {
  font-size: 0.9rem;
  font-family: monospace;
  color: var(--text-muted);
  text-align: center;
}

.playlist-item.is-active .item-index {
  color: var(--accent);
  font-weight: bold;
}

.item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  background: #181818;
}

.item-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.item-title {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
  transition: color 0.15s;
}

.playlist-item.is-active .item-title {
  color: var(--accent);
}

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

.item-meta {
  display: flex;
  align-items: center;
}

.item-duration {
  font-size: 0.85rem;
  font-family: monospace;
  color: var(--text-muted);
}

.site-header {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  z-index: 300;
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: 1.15rem;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--site-header-height);
}

.site-header__inner {
  height: var(--site-header-height);
  justify-content: space-between;
  align-items: center;
  padding: 0 clamp(1rem, 5vw, 2.5rem);
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
}

.brand {
  color: var(--text);
  letter-spacing: -0.01em;
  font-weight: 500;
  text-decoration: none;
}

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

.dock-now-playing {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .dock-now-playing {
    display: none;
  }
}

.dock-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.dock-title {
  color: #fff;
  font-weight: 500;
}

.dock-sep {
  color: var(--line);
}

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

@media (max-width: 860px) {
  html, body {
    overflow-y: auto;
    height: auto;
  }

  .player-container {
    height: auto;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 1.5rem 1rem calc(var(--site-header-height) + 2rem);
    overflow: visible;
  }

  .now-playing-section {
    height: auto;
  }

  .playlist-section {
    height: auto;
    overflow: visible;
  }

  .playlist-list {
    overflow-y: visible;
    height: auto;
  }
}
