*, *::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-height:      220px;
  --widget-radius:      10px;
  --widget-blur:        20px;
  --widget-anim:        500ms;
  --widget-title-size:  18px;
  --widget-artist-size: 13px;
  --widget-title-font:  sans-serif;
  --widget-artist-font: sans-serif;
  --widget-times-font:  monospace;
  --widget-title-shadow:  none;
  --widget-artist-shadow: none;
  --widget-times-shadow:  none;
  --album-size:         90px;
  --scale:              1;
  --wv-track:   #FFFFFF;
  --wv-ghost-b: #00CCFF;
  --wv-ghost-f: var(--widget-accent);
  --wv-fill-b:  #00CCFF;
  --wv-fill-f:  var(--widget-accent);
}

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(--widget-height);
  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);
  border-radius: var(--widget-radius);
  overflow: hidden;
  flex-shrink: 0;
  align-self: stretch;
  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: calc(10px * var(--scale)) calc(16px * var(--scale));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: calc(2px * var(--scale));
}

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

#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-artist-font);
  font-size: var(--widget-artist-size);
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: var(--widget-artist-shadow);
}

#times {
  display: flex;
  justify-content: space-between;
  font-size: calc(15px * var(--scale));
  color: rgba(255, 255, 255, 0.4);
  font-family: var(--widget-times-font);
  margin-top: auto;
  text-shadow: var(--widget-times-shadow);
}

#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;
}

/* ── Progress bar effects ──────────────────────────────────────────────── */

@keyframes pb-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 300% 0; }
}

@keyframes pb-pulse-glow {
  0%, 100% { box-shadow: 0 0 4px var(--widget-accent); }
  50%       { box-shadow: 0 0 12px var(--widget-accent), 0 0 28px var(--widget-accent); }
}

@keyframes pb-rainbow {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pb-neon {
  0%, 100% {
    box-shadow: 0 0 6px var(--widget-accent), 0 0 20px var(--widget-accent);
    filter: brightness(1.1);
  }
  50% {
    box-shadow: 0 0 10px var(--widget-accent), 0 0 35px var(--widget-accent), 0 0 60px var(--widget-accent);
    filter: brightness(1.3);
  }
}

#progress-bar.effect-shimmer {
  background: linear-gradient(
    90deg,
    var(--widget-accent) 0%, var(--widget-accent) 35%,
    rgba(255,255,255,0.8) 50%,
    var(--widget-accent) 65%, var(--widget-accent) 100%
  );
  background-size: 300% 100%;
  animation: pb-shimmer 2.8s ease-in-out infinite;
}

#progress-bar.effect-pulse-glow {
  animation: pb-pulse-glow 2s ease-in-out infinite;
}

#progress-bar.effect-rainbow {
  background: linear-gradient(90deg, #1DB954, #00CCFF, #FF56B4, #FFD700, #1DB954);
  background-size: 200% 100%;
  animation: pb-rainbow 3s linear infinite;
}

#progress-bar.effect-neon {
  animation: pb-neon 1.8s ease-in-out infinite;
}

/* ── Wave effect — Canvas-based ─────────────────────────────────────────── */

#pb-track-wave,
#pb-ghost,
#pb-dot { display: none; }

#progress-bg.effect-wave {
  background: none;
  overflow: visible;
  position: relative;
  height: calc(10px * var(--scale));
  border-radius: calc(var(--scale) * 4px);
}

#progress-bg.effect-wave #progress-bar { display: none; }

#pb-canvas {
  display: none;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  pointer-events: none;
}
#progress-bg.effect-wave #pb-canvas { display: block; }

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