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

:root {
  --widget-bg:          #1E1E1E;
  --widget-panel:       rgba(0, 0, 0, 0.6);
  --widget-accent:      #1DB954;
  --widget-text:        #FFFFFF;
  --widget-width:       480px;
  --widget-radius:      10px;
  --widget-blur:        20px;
  --widget-anim:        500ms;
  --widget-title-size:  18px;
  --widget-artist-size: 13px;
  --widget-font:        sans-serif;
  --album-size:         90px;
  --scale:              1;
}

html, body {
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
}

#widget {
  display: flex;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--widget-width);
  height: var(--album-size);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.8));
  opacity: 0;
  transition: opacity var(--widget-anim) ease;
  pointer-events: none;
}

#widget.visible {
  opacity: 1;
  pointer-events: auto;
}

#album-art-box {
  position: relative;
  width: var(--album-size);
  height: var(--album-size);
  border-radius: var(--widget-radius);
  overflow: hidden;
  flex-shrink: 0;
  margin-right: calc(8px * var(--scale));
  background: rgba(0, 0, 0, 0.5);
}

#album-art,
#album-art-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#album-art-back { z-index: 0; }
#album-art      { z-index: 1; }

#song-info-box {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--widget-radius);
}

#background-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: var(--widget-radius);
}

#bg-image,
#bg-image-back {
  position: absolute;
  width: 140%;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  filter: blur(var(--widget-blur));
}

#bg-image-back { z-index: 0; }
#bg-image      { z-index: 1; }

#info-panel {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow: hidden;
  background: var(--widget-panel);
  padding: 0 calc(16px * var(--scale));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: calc(3px * var(--scale));
}

#song-title {
  font-family: var(--widget-font);
  font-size: var(--widget-title-size);
  font-weight: 700;
  color: var(--widget-text);
  white-space: nowrap;
}

#song-title.marquee-active {
  animation: marquee-scroll var(--marquee-duration, 6s) ease-in-out infinite;
}

@keyframes marquee-scroll {
  0%, 15%   { transform: translateX(0); }
  85%, 100% { transform: translateX(var(--marquee-offset, 0px)); }
}

#artist-name {
  font-family: var(--widget-font);
  font-size: var(--widget-artist-size);
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#times {
  display: flex;
  justify-content: space-between;
  font-size: calc(13px * var(--scale));
  color: rgba(255, 255, 255, 0.4);
  font-family: monospace;
  margin-top: calc(4px * var(--scale));
}

#progress-bg {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  height: calc(4px * var(--scale));
  margin-top: calc(3px * var(--scale));
}

#progress-bar {
  height: 100%;
  background: var(--widget-accent);
  border-radius: 3px;
  width: 0%;
  transition: width 1s linear;
}

.fade-out { opacity: 0 !important; transition: opacity 0.25s ease !important; }
