  :root {
    --bg: #f8f9fc;
    --text: #1e2937;
    --card: #ffffff;
    --search-bg: #ffffff;
    --search-border: #c9a47f;
    --player-bg: rgba(255,255,255,0.95);
    --accent: #956433;
    --accent-light: #c9a47f;
    --border: rgba(149,100,51,0.3);
    --shadow: rgba(0,0,0,0.08);
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0a0f1c;
      --text: #f1f5f9;
      --card: rgba(255,255,255,0.06);
      --player-bg: rgba(15,23,42,0.92);
      --accent: #c9a47f;
    }
  }
  
  html, body {
  overscroll-behavior-y: contain;
  touch-action: manipulation;
}

  body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
  }

  .app {
    padding: 20px 20px 240px;
    max-width: 960px;
    margin: auto;
    text-align: left;
  }

  h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 18px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  
  #list{
    height:520px;
    overflow-y:auto;
    overflow-x:hidden;   /* hide horizontal scrollbar */
    position:relative;
}

/* SIDE MENU */
.side-menu {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100%;
  background: var(--card);
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  z-index: 2000;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
}

.side-menu.open {
  left: 0;
}

.menu-content {
  padding: 20px;
  text-align: left;
  flex: 1;
  overflow-y: auto;
}

.menu-content h3 {
  margin-bottom: 20px;
}

/* ABOUT SECTION (sidebar footer) */
.aboutSection {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}

.aboutIcon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}

.aboutText {
  font-size: 11px;
  color: var(--text);
  opacity: 0.7;
  line-height: 1.7;
}

.menu-item {
  display: block;
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  border: none;
  background: none;
  text-align: left;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

.menu-item:hover {
  background: rgba(201,164,127,0.2);
  border-radius: 8px;
}

/* OVERLAY */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.35);
  z-index: 1500;
  display: none;
}

.menu-overlay.show {
  display: block;
}

  /* SEARCH */
  .search-container {
    position: relative;
    width: 100%;
    margin: 0 auto 14px;
  }

  #search {
    width: 100%;
    padding: 11px 42px 11px 14px;
    border: 2px solid var(--search-border);
    border-radius: 12px;
    background: var(--search-bg);
    color: var(--text);
    font-size: 15.5px;
    box-sizing: border-box;
    outline: none;
  }

  #search::placeholder {
    color: #94a3b8;
    opacity: 1;
  }

  @media (prefers-color-scheme: dark) {
    #search {
      background: rgba(255,255,255,0.08);
      color: #f1f5f9;
      border-color: rgba(201,164,127,0.5);
    }

    #search::placeholder {
      color: #94a3b8;
    }
  }

  .clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    display: none;
    padding: 3px;
  }

  .clear-btn:hover {
    color: var(--accent);
  }

  /* TABS */
  .filter-tabs{
   display:flex;
   gap:10px;
   justify-content:flex-start;
   overflow-x:auto;
   padding:6px 2px 12px;
   scrollbar-width:none;
   -webkit-overflow-scrolling:touch;
   flex-wrap:nowrap;
}

  .filter-tabs::-webkit-scrollbar{
   display:none;
}

  .tab-btn{
   flex:0 0 auto;
   padding:9px 18px;
   white-space:nowrap;
   font-size:14px;
   border-radius:999px;
   border:1px solid var(--border);
   background:var(--card);
   color:var(--text);
   transition:.25s ease;
}

   .tab-btn.active{
   background:linear-gradient(
   90deg,
   var(--accent),
   var(--accent-light)
);

   color:#fff;
   border-color:transparent;
   box-shadow:0 4px 14px rgba(149,100,51,.25);
}

  /* SONG LIST */
  .song{
   display:flex;
   align-items:center;
   gap:8px;
   width:100%;
   box-sizing:border-box;
   padding:6px 10px;
   margin:4px 0;
   background:var(--card);
   border:1px solid var(--border);
   border-radius:10px;
   cursor:pointer;
   transition:.3s;
   overflow:hidden;
}

  .song:hover {
    transform: translateX(6px);
    background: rgba(201,164,127,0.12);
  }

  .song img {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
  }

  .song span{
    flex:1;
    min-width:0;
    overflow:hidden;
    display:block;
    position:relative;
}

  .song-title{
    display:inline-flex;
    white-space:nowrap;
    width:max-content;
}

  .song-right{
   display:flex;
   align-items:center;
   justify-content:flex-end;
   gap:6px;
   width:72px;   /* fixed right column */
   flex-shrink:0;
}

  .duration {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    width:42px;
    min-width: 40px;
    text-align: right;
  }

  .heart {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #64748b;
  }

  .heart.liked {
    color: #ef4444;
  }

  .song.active {
  background: linear-gradient(90deg, var(--accent), var(--accent-light)) !important;
  color: white !important;
  border-color: transparent;
}

/*Adds border to downloaded songs*/
/*
.song.downloaded {
  border-color: var(--accent);
}
*/

.song.downloaded::after {
  content: "⬇";
  margin-left: auto;
  font-size: 12px;
  opacity: 0.8;
}

  /* PLAYER */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  isolation: isolate;
  background: var(--player-bg);
  backdrop-filter: blur(22px);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -10px 30px var(--shadow);
  z-index: 1000;
  box-sizing: border-box;
  
  transition: height 0.3s ease, transform 0.3s ease;
  will-change: transform;
  touch-action: pan-y;
  overflow: visible;
  cursor: grab;
}

  #cover{
    width:60px;
    height:60px;
    border-radius:50%;
    object-fit:cover;
    flex-shrink:0;
    position:relative;
    will-change:transform;
    transform:translateZ(0);
    backface-visibility:hidden;

box-shadow:
0 0 0 3px rgba(255,255,255,.08),
0 0 0 6px rgba(0,0,0,.18);
}

/* vinyl center hole */
  #cover::after{
    content:"";
    position:absolute;
    width:12px;
    height:12px;
    border-radius:50%;
    background:#111;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    box-shadow:0 0 0 3px #999 inset;
}

/* while metadata loading */
   #cover.loading{
     animation:
     rotateCover 3s linear infinite,
     recordGlow 1.8s ease-in-out infinite;
     filter:saturate(1.08);
}

/* when actually playing, use your normal slower spin */
    #cover.playing{
      animation:rotateCover 18s linear infinite;
}

    @keyframes rotateCover{
       from{transform:rotate(0deg)}
       to{transform:rotate(360deg)}
}

     @keyframes recordGlow{
0%{box-shadow:0 0 0 3px rgba(255,255,255,.08),0 0 0 6px rgba(0,0,0,.18)}
50%{box-shadow:0 0 0 3px rgba(201,164,127,.35),0 0 18px rgba(201,164,127,.35)}
100%{box-shadow:0 0 0 3px rgba(255,255,255,.08),0 0 0 6px rgba(0,0,0,.18)}
}

  .info {
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  #title{
  display:block;
  overflow:hidden;
  white-space:nowrap;
  position:relative;
  width: 100%; /* Update Marquee */
}

#title span{
  display:inline-block;
  white-space:nowrap;
}

/* animation */
#title.marquee span {
  animation-name: playerTicker;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  animation-delay: 1.2s; /* smooth pause before scroll */
}

#title.marquee span::after {
  content: attr(data-title);
  padding-left: 60px;
}

.player.mini #title.marquee span::after {
  padding-left: 40px;
}

@keyframes playerTicker{
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

  #time {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 6px;
  }

  .bar {
    height: 6px;
    background: rgba(149,100,51,0.2);
    border-radius: 999px;
    cursor: pointer;
    margin: 0 auto;
  }

  #progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 999px;
  }

/* CONTROLS */
   .controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

/* BUTTON BASE */
    .controls button {
     width: 44px;
     height: 44px;
     border-radius: 50%;
     font-size: 19px;
     display: flex;
     align-items: center;
      justify-content: center;
      border: 1px solid var(--border);
      background: rgba(149,100,51,0.15);
      color: var(--text);
      cursor: pointer;
      position: relative;
      overflow: hidden;

  /* ELASTIC ANIMATION */
  transition:
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;

  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

/* DESKTOP HOVER */
@media (hover: hover) and (pointer: fine) {
  .controls button:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.06);
  }
}

/* ACTIVE TOGGLED STATE */
.controls button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 10px rgba(201,164,127,0.45);
}

/* PRESS (ELASTIC FEEL) */
.controls button:active {
  transform: scale(0.88);
  background: var(--accent);
  color: white;
}

/* RIPPLE (HAPTIC-LIKE) */
.controls button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.25s ease;
  pointer-events: none;
}

.controls button:active::after {
  opacity: 1;
  transform: scale(1.2);
}

/* PLAY BUTTON */
.play-btn {
  width: 60px !important;
  height: 60px !important;
  font-size: 27px !important;
  background: var(--accent) !important;
  color: white !important;
  border: none !important;
}

.play-btn.pause {
  font-size: 23px !important;
}

  #volume {
    width: 120px;
    accent-color: var(--accent);
  }

  /* MENU */
  /* MENU */
.menu-popup {
  position: absolute;
  bottom: 80px;
  right: 20px;

  background: var(--player-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 0;

  box-shadow: 0 10px 30px var(--shadow);

  display: none;
  flex-direction: column;

  z-index: 999999;
  min-width: 170px;

  overflow: visible;
}

  .menu-popup button {
    padding: 12px 20px;
    text-align: left;
    background: none;
    border: none;
    font-size: 15.5px;
    cursor: pointer;
    color: var(--text);
  }

  .menu-popup button:hover {
    background: rgba(201,164,127,0.15);
  }

  /* MOBILE */
  @media (max-width: 680px) {
    .app { padding-bottom: 245px; }
    #search { font-size: 14.5px; }
    .song img { width: 32px; height: 32px; }
    .player { flex-direction: column; }
    .controls button { width: 36px; height: 36px; font-size: 16px; }
  }

/* MINI PLAYER MODE (VISIBLE CHANGE) */
.player.mini {
  height: 65px;
  padding: 8px 12px;
  flex-direction: row;
  align-items: center;
  overflow: visible;
}

/* shrink cover */
.player.mini #cover {
  width: 44px;
  height: 44px;
}

/* compress info */
.player.mini .info {
  flex: 1;
  text-align: left;
    min-width: 0;
}

/* title */
.player.mini #title {
  font-size: 13px;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

/* hide heavy UI completely */
.player.mini .bar,
.player.mini #time,
.player.mini #volume,
.player.mini #shuffle,
.player.mini #repeat,
.player.mini #menu-btn {
  display: none !important;
}

/* controls layout */
.player.mini .controls {
  flex-wrap: nowrap;
  gap: 4px;
}

/* shrink buttons */
.player.mini .controls button {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

/* play button */
.player.mini #play {
  width: 42px !important;
  height: 42px !important;
  font-size: 18px !important;
}

/* collapse button stays visible */
.player.mini #collapse-btn {
  opacity: 1;
  background: var(--accent);
  color: white;
}
