:root {
  --bg: #0c0f19;
  --card: #141c2e;
  --accent: #7b61ff;
  --accent2: #00d4ff;
  --text: #e9f0ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #1a2240, var(--bg));
  min-height: 100vh;
  padding-bottom: 180px;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 80% 20%, #7b61ff44, transparent 45%),
              radial-gradient(circle at 20% 80%, #00d4ff22, transparent 40%);
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.top-header h1 { margin: 0; letter-spacing: 1px; }
#logout-btn {
  border: 0;
  border-radius: 999px;
  background: #243151;
  color: white;
  padding: 8px 14px;
}

.layout { padding: 0 20px 170px; }
.header {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}
#searchPage { padding-bottom: 20px; }
.recent-block { margin-bottom: 12px; }
.recent-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#clearRecentBtn { padding: 8px 12px; border-radius: 10px; }
#searchBar {
  display: flex;
  gap: 10px;
  margin: 10px 0 20px;
}
.search-type-tabs {
  display: flex;
  gap: 8px;
  margin: -8px 0 14px;
  overflow-x: auto;
}
.search-type-tabs button {
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.search-type-tabs button.active {
  background: #1db954;
  border-color: #1db954;
}

input, button {
  border-radius: 12px;
  border: 1px solid #32405f;
  background: #10182c;
  color: white;
  padding: 12px;
}

#searchInput, #searchInputPage { flex: 1; }
#searchBtn, #searchBtnPage {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  border: 0;
  font-weight: 700;
  cursor: pointer;
}

#songs-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  padding-bottom: 140px;
}
.library-track-list {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
}
.library-track-row {
  display: grid;
  grid-template-columns: 24px 52px 1fr 38px;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 10px;
}
.library-track-row:hover {
  background: #16213a;
}
.library-track-index {
  opacity: .7;
  text-align: center;
}
.library-track-row img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
}
.library-track-meta {
  min-width: 0;
}
.library-track-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.library-track-artist {
  font-size: 14px;
  opacity: .8;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.library-row-play {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  background: #1db954;
}
.library-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.library-action-btn {
  border-radius: 999px;
  padding: 8px 14px;
}
.library-action-main {
  background: #1db954;
  border: 0;
}
#load-more-btn {
  margin-bottom: 130px !important;
}

#searchList, .track-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.song-card {
  background: linear-gradient(180deg, #17223e, #11192c);
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  box-shadow: 0 10px 25px #00000033;
  transition: transform .2s;
}
.song-card:hover { transform: translateY(-4px); }
.song-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
}
.song-title { margin-top: 8px; font-weight: 700; }
.song-artist { color: #9bb0db; font-size: 13px; }

.track-row {
  display: grid;
  grid-template-columns: 62px 1fr 40px 40px;
  align-items: center;
  gap: 10px;
  background: #121a2f;
  border: 1px solid #293753;
  border-radius: 14px;
  padding: 8px;
}
.track-row img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 10px;
}
.track-meta { min-width: 0; }
.track-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 18px;
  font-weight: 700;
}
.track-artist {
  color: #a5b4d5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-play, .track-remove {
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
}
.track-play { background: #1db954; border: 0; }
.track-remove { background: #2b3040; border: 0; }

#player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 65px;
  background: #0f172abb;
  backdrop-filter: blur(10px);
  border-top: 1px solid #314161;
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  padding: 8px 12px;
  gap: 10px;
}

.player-info { display: flex; gap: 10px; flex: 1; cursor: pointer; width: 100%; }
.player-info img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: cover;
  background: #2a3552;
}
.player-text {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 4px;
}
.mini-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mini-source-link,
.mini-menu-btn,
.source-link,
.full-menu-btn {
  border: 0;
  background: transparent;
  color: #b9c8e6;
  padding: 0;
}
.mini-source-link,
.source-link {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
}
.mini-menu-btn,
.full-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #1a2640;
}
.marquee-line, .full-marquee {
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
#player-title, #player-artist, #full-title, #full-artist {
  display: inline-block;
  min-width: 100%;
  animation: marquee-scroll 11s linear infinite;
  padding-right: 40px;
}
#player-title { font-weight: 700; }
#player-artist { color: #95a6ca; font-size: 13px; }

.seek-wrapper, .full-seek-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  min-width: 0;
}
input[type='range'] {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}
#seek-slider {
  height: 8px;
}
#seek-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
}
#seek-slider::-webkit-slider-thumb {
  margin-top: -4px;
}

.player-controls, .full-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.player-controls button, .full-controls button {
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 17px;
  padding: 0;
}
.player-controls {
  gap: 14px;
}
.player-controls button {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

#full-player {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #0f1730, #090e1f);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 18px 20px 90px;
  overflow-y: auto;
}
.full-top-row {
  width: min(92vw, 430px);
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 10px;
}
#full-cover {
  width: min(80vw, 350px);
  border-radius: 20px;
  box-shadow: 0 20px 50px #00000070;
}
#minimize-btn {
  border: 0;
  background: transparent;
  color: #d5ddf2;
}
.full-marquee {
  width: min(90vw, 380px);
  text-align: center;
}
#full-title, #full-artist { text-align: center; }
#full-title { font-size: 27px; font-weight: 800; }
#full-artist { color: #a9badc; font-size: 18px; }
.lyrics-section {
  width: min(92vw, 430px);
  background: #0b1227bf;
  border: 1px solid #2c3d63;
  border-radius: 14px;
  padding: 12px;
}
.lyrics-head { font-weight: 700; margin-bottom: 8px; }
.lyrics-content {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  color: #d5dcf0;
  line-height: 1.5;
}
.lyrics-line.active {
  color: #77ff9e;
  font-weight: 700;
}
.track-menu {
  position: fixed;
  inset: 0;
  background: #00000088;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.track-menu-card {
  width: min(500px, 100%);
  background: #101828;
  border-radius: 16px 16px 0 0;
  border: 1px solid #2f3e5e;
  border-bottom: 0;
  padding: 8px 10px 20px;
}
.track-menu-card button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 14px 10px;
  font-size: 17px;
}
.track-menu-card button:hover { background: #1a2742; }

@keyframes marquee-scroll {
  0% { transform: translateX(0); }
  15% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.homebox {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 65px;
  background: #101828;
  border-top: 1px solid #2f3d58;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.homepageButtonImage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #a5b6d9;
}
.homepageButtonImage.active,
.homepageButtonImage:hover { color: white; }

.auth-modal {
  position: fixed;
  inset: 0;
  background: #030712cc;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: min(420px, 92vw);
  background: #121c33;
  border: 1px solid #304164;
  border-radius: 20px;
  padding: 20px;
}
.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.auth-card form button {
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  border: 0;
  font-weight: 700;
}
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.auth-switch .active {
  background: #24365b;
}
#auth-msg { margin-top: 10px; min-height: 20px; }

@media (max-width: 640px) {
  #player-bar { bottom: 70px; }
  .layout { padding: 0 12px; }
}

input[type='range']:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  accent-color: #5c667d;
}

input[type='range']:disabled::-webkit-slider-runnable-track {
  background: #2b3448;
}

input[type='range']:disabled::-webkit-slider-thumb {
  background: #7a8498;
}
