:root {
  --bg: #0b0b0f;
  --fg: #dcdcdc;
  --accent: #9b84f7;
  --muted: #888;
  --card: #15151b;
  --card-hover: #1d1d25;
  --highlight: #1a1a22;
  --button-bg: #1d1d28;
  --button-hover: #2a2a3b;
  --sidebar-width: 300px;
  --header-height: 50px;
  --footer-height: 60px;
}

[data-theme="light"] {
  --bg: #f5f5fa;
  --fg: #121212;
  --accent: #805ef7;
  --muted: #666;
  --card: #f0f0f5;
  --card-hover: #eaeaff;
  --highlight: #f0f0f0;
  --button-bg: #e4e4ff;
  --button-hover: #d8d8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  transition: background 0.3s, color 0.3s;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.navbar {
  background: #111118;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  border-bottom: 1px solid #202020;
}

.nav-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a,
.nav-links button,
.nav-links select {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--accent);
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
  font-weight: 600;
}

.nav-links button:hover,
.nav-links a:hover,
.nav-links select:hover {
  background: var(--highlight);
}

select {
  background-color: transparent;
  color: var(--fg);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
}

.main-center {
  text-align: center;
  padding: 5rem 2rem 6rem;
  max-width: 1000px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
}

.intro-image-block img {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 0 8px rgba(155, 132, 247, 0.4);
}

.text-style-violet {
  color: var(--accent);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 6px rgba(155, 132, 247, 0.6);
}

.hero p {
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
}

.top-categories {
  height: var(--header-height);
  background: #111118;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  overflow-x: auto;
  white-space: nowrap;
}

.categories-scroll {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem;
}

.category-button {
  background: var(--card);
  border: none;
  color: var(--fg);
  padding: 0.3rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 0.9rem;
  white-space: nowrap;
}

.category-button:hover {
  background: var(--card-hover);
}

.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

main#musicContainer {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.sidebar-right {
  width: var(--sidebar-width);
  background: var(--card);
  border-left: 1px solid #222;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
}

.sidebar-search {
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #333;
  background: #111118;
  color: var(--fg);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.playlist-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  background: var(--card);
  transition: background 0.15s;
}

.playlist-item:hover {
  background: var(--card-hover);
}

.playlist-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}

.playlist-item .info {
  flex: 1;
  overflow: hidden;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  user-select: none;
}

.playlist-item .info .title {
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.playlist-item .info .author {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.music-control {
  height: var(--footer-height);
  background: #111118;
  border-top: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0 1rem;
  user-select: none;
}

.music-control button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s;
}

.music-control button:hover {
  color: #c3a7ff;
}

.progress-container {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  font-size: 0.85rem;
}

#progressBar {
  flex: 1;
  cursor: pointer;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 5px;
  background: #333;
}

#progressBar::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  margin-top: -4px;
}

#progressBar::-moz-range-thumb {
  height: 14px;
  width: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.footer {
  background: #111118;
  color: var(--muted);
  text-align: center;
  padding: 2.5rem 1.5rem;
  font-size: 0.9rem;
  border-top: 1px solid #2b2b2b;
}

.footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* Scrollbars */
.sidebar-right::-webkit-scrollbar,
main#musicContainer::-webkit-scrollbar {
  width: 8px;
}
.sidebar-right::-webkit-scrollbar-track,
main#musicContainer::-webkit-scrollbar-track {
  background: #111118;
}
.sidebar-right::-webkit-scrollbar-thumb,
main#musicContainer::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

/* Responsive mobile */
@media (max-width: 600px) {
  body {
    overflow: auto;
  }

  .main-container {
    flex-direction: column;
    height: auto;
  }

  .sidebar-right {
    width: 100% !important;
    height: 250px;
    border-left: none;
    border-top: 1px solid #222;
    padding: 0.5rem 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    margin-top: 0.75rem;
  }

  main#musicContainer {
    padding: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    max-height: none;
    overflow: visible;
  }

  .top-categories {
    height: 40px;
    padding: 0 0.5rem;
  }

  .category-button {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
  }

  .music-control {
    flex-wrap: wrap;
    height: auto;
    gap: 1rem;
    padding: 0.5rem 1rem;
  }

  .music-control button {
    font-size: 1.6rem;
  }

  .progress-container {
    flex: 1 1 100%;
    gap: 0.4rem;
    font-size: 0.75rem;
  }

  #progressBar {
    height: 5px;
  }

  .playlist-item img {
    width: 36px;
    height: 36px;
  }

  .playlist-item .info {
    font-size: 0.85rem;
  }

  .hero h1 {
    font-size: 2.2rem;
  }
}
