* {
  box-sizing: border-box;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background: rgba(230, 57, 70, 0.6);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(230, 57, 70, 0.8);
}

html {
  scrollbar-color: rgba(230, 57, 70, 0.6) #1a1a1a;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  background: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  flex-direction: column;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 1.5rem 0;
}

.container {
  width: 100%;
  max-width: 2000px;
  margin: 0 auto;
  padding: 0 1rem;
}

.sc-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

/* Base: responsive square embeds
   2 rows of 4 must fit on screen with nav (~60px) + page numbers (~50px) + gaps (~48px)
   So each row gets roughly (100vh - 160px) / 2 max height */
.sc-player {
  flex: 1 1 calc(25% - 16px);
  min-width: 280px;
  max-width: 450px;
  aspect-ratio: 1 / 1;
  max-height: calc((100vh - 200px) / 2);
  width: 100%;
  border: 2px solid #1a1a1a;
  border-radius: 20px;
  background: linear-gradient(270deg, #8a0038, #4a1d80, #1a4f8a, #0a6b50, #8a6500, #8a0038);
  background-size: 600% 100%;
  animation: shimmer 3s ease-in-out infinite;
}
.sc-player:nth-child(2) { animation-delay: -0.4s; }
.sc-player:nth-child(3) { animation-delay: -0.8s; }
.sc-player:nth-child(4) { animation-delay: -1.2s; }
.sc-player:nth-child(5) { animation-delay: -1.6s; }
.sc-player:nth-child(6) { animation-delay: -2.0s; }
.sc-player:nth-child(7) { animation-delay: -2.4s; }
.sc-player:nth-child(8) { animation-delay: -2.8s; }

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 1440p+ wide screens — 4 columns, larger players */
@media (min-width: 1800px) {
  .sc-player {
    max-width: 500px;
  }
}

/* Smaller desktops / large tablets */
@media (max-width: 1200px) {
  .sc-player {
    flex: 1 1 calc(33.33% - 16px);
    max-width: 380px;
  }
}

/* Tablets */
@media (max-width: 900px) {
  .sc-player {
    flex: 1 1 calc(50% - 16px);
    max-width: 350px;
    max-height: none;
  }

  .bottom-nav {
    gap: 1rem;
  }
}

/* Mobile */
@media (max-width: 600px) {
  body {
    padding: 1rem 0;
  }

  .sc-player {
    flex: 0 0 100%;
    max-width: 100%;
    max-height: none;
    min-width: 0;
  }

  .bottom-nav {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0;
  }

  .home-link {
    font-size: 0.95rem;
    border-right: none;
    padding-right: 0;
  }

  .track-count {
    font-size: 0.95rem;
    border-right: none;
    padding-right: 0;
  }

  .filter-btn {
    font-size: 0.95rem;
    border-right: none;
    padding-right: 0;
  }

  .sort-controls {
    border-right: none;
    padding-right: 0;
  }

  .sort-btn {
    font-size: 0.95rem;
  }

  .page-numbers {
    font-size: 0.95rem;
    justify-content: center;
  }

  .page-numbers .page-nav-divider {
    border-right: none;
    padding-right: 0;
    margin-right: 0;
  }
}

/* BOTTOM NAV */
.bottom-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(230, 57, 70, 0.6);
  border-radius: 6px;
  flex-wrap: wrap;
}

.track-count {
  color: #fff;
  font-size: 1.25rem;
  padding-right: 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.home-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.2s;
  padding-right: 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.home-link:hover {
  color: #fff;
}

/* SORT CONTROLS */
.sort-controls {
  display: flex;
  gap: 1.25rem;
  padding-right: 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.sort-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.15rem 0.5rem;
  font-family: inherit;
  transition: color 0.2s, background 0.2s;
}

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

.sort-btn.active {
  color: #fff;
  text-decoration: underline;
}

.sort-btn.active.random-active {
  color: #0d0d0d;
  background: #fff;
  text-decoration: none;
  padding: 0.1rem 0.65rem 0.2rem 0.5rem;
  border-radius: 4px;
  animation: popIn 0.3s ease;
  line-height: 1;
}

@keyframes popIn {
  0% { transform: scale(1); }
  40% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/*PAGE NUMBERS*/
.page-numbers {
  font-size: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}

.page-numbers .page-nav {
  cursor: pointer;
  color: #fff;
  transition: color 0.2s;
  margin: 0 4px;
}

.page-numbers .page-nav:hover {
  color: #fff;
}

.page-numbers .page-nav.disabled {
  color: #999;
  cursor: default;
}

.page-numbers .page-nav-divider {
  padding-right: 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  margin-right: 0.5rem;
}

.page-numbers .page-info {
  color: #fff;
  cursor: default;
}

/* FILTER POPUP */
.filter-btn {
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.2s;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  padding-right: 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.3);
}

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

.filter-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.filter-overlay.show {
  display: flex;
}

.filter-popup {
  background: #1a1a1a;
  border: 3px solid rgba(230, 57, 70, 0.6);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 1100px;
  width: 92%;
  max-height: 80vh;
  overflow-y: auto;
}

.filter-groups {
  display: flex;
  flex-direction: column;
}

.filter-top-row {
  columns: 4;
  column-gap: 0.5rem;
}

.filter-top-row .filter-group-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  break-inside: avoid;
}

.filter-separator {
  border-top: 1px solid #333;
  margin: 0 0 0.5rem 0;
}

.filter-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #fff;
  margin: 0.75rem 0 0.5rem 0;
  padding: 0.4rem 0.6rem;
  background: rgba(50, 100, 180, 0.6);
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.filter-section-title:hover {
  background: rgba(50, 100, 180, 0.8);
  border-color: rgba(50, 100, 180, 1);
}

.filter-section-title.no-click {
  cursor: default;
}

.filter-section-title.no-click:hover {
  background: rgba(50, 100, 180, 0.6);
  border-color: transparent;
}

.filter-section-groups {
  columns: 4;
  column-gap: 0.5rem;
}

.filter-section-groups .filter-group-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  break-inside: avoid;
}

@media (max-width: 800px) {
  .filter-top-row,
  .filter-section-groups {
    columns: 3;
  }
}

@media (max-width: 600px) {
  .filter-top-row,
  .filter-section-groups {
    columns: 2;
  }
}

@media (max-width: 400px) {
  .filter-top-row,
  .filter-section-groups {
    columns: 1;
  }
}

.filter-group-btn {
  padding: 0.4rem 0.75rem;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #ccc;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  text-align: left;
}

.filter-group-btn:hover {
  background: #333;
  color: #fff;
}

.filter-group-btn.active {
  background: rgba(230, 57, 70, 0.6);
  border-color: rgba(230, 57, 70, 0.8);
  color: #fff;
}


.filter-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #333;
  justify-content: flex-end;
}

.filter-actions button {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

.filter-apply {
  background: rgba(50, 100, 180, 0.8);
  color: #fff;
  border: none;
}

.filter-apply:hover {
  background: rgba(50, 100, 180, 1);
}

.filter-clear {
  background: transparent;
  border: 1px dashed #555;
  color: #e0e0e0;
}

.filter-clear:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #999;
  color: #fff;
}

/* Compact filter popup for 1080p and below */
@media (max-height: 1080px) {
  .filter-popup {
    padding: 0.75rem;
  }
  .filter-top-row {
    column-gap: 0.35rem;
  }
  .filter-top-row .filter-group-btn {
    margin-bottom: 0.25rem;
  }
  .filter-section-title {
    font-size: 0.6rem;
    margin: 0.3rem 0 0.25rem 0;
    padding: 0.25rem 0.5rem;
  }
  .filter-section-groups {
    column-gap: 0.35rem;
  }
  .filter-section-groups .filter-group-btn {
    margin-bottom: 0.25rem;
  }
  .filter-group-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
  }
  .filter-separator {
    margin: 0 0 0.25rem 0;
  }
  .filter-actions {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    gap: 0.5rem;
  }
  .filter-actions button {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
  }
}

