:root {
  --bg: rgba(18, 20, 26, 0.42);
  --blur: 20px;
  --saturate: 150%;
  --radius: 20px;
  --border-color: rgba(255, 255, 255, 0.16);
  --border-width: 1px;
  --shadow: 0 12px 44px rgba(0, 0, 0, 0.38);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --accent: #1db954;

  --title-size: 21px;
  --artist-size: 14px;
  --label-size: 11px;
  --title-weight: 700;
  --artist-weight: 400;
  --label-transform: uppercase;

  --width: 540px;
  --gap: 18px;
  --padding: 16px;
  --art-size: 104px;
  --art-radius: 14px;

  --progress-height: 6px;
  --progress-from: #1db954;
  --progress-to: #7ee2a0;
  --progress-bg: rgba(255, 255, 255, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Widget (glass card)                                                 */
/* ------------------------------------------------------------------ */
.widget {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: var(--padding);
  width: var(--width);
  max-width: 100%;
  border-radius: var(--radius);
  background: var(--bg);
  border: var(--border-width) solid var(--border-color);
  backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--saturate));
  box-shadow: var(--shadow);
  position: relative;
}

.art {
  position: relative;
  width: var(--art-size);
  height: var(--art-size);
  border-radius: var(--art-radius);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.art video,
.art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.info {
  flex: 1;
  min-width: 0;
}

.now-playing-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--label-size);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: var(--label-transform);
  color: var(--accent);
  margin-bottom: 7px;
}

.now-playing-label::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-out infinite;
}

.title {
  font-size: var(--title-size);
  font-weight: var(--title-weight);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-text {
  display: inline-block;
  white-space: nowrap;
}

.artist {
  font-size: var(--artist-size);
  font-weight: var(--artist-weight);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
  margin-bottom: 12px;
}

.progress {
  width: 100%;
}

.bar {
  width: 100%;
  height: var(--progress-height);
  border-radius: 999px;
  background: var(--progress-bg);
  overflow: hidden;
}

body.square-progress .bar,
body.square-progress .fill {
  border-radius: 0;
}

.fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--progress-from), var(--progress-to));
  transition: width 0.2s linear;
}

.times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/* Idle state                                                          */
/* ------------------------------------------------------------------ */
.idle {
  display: flex;
  align-items: center;
  padding: var(--padding);
  border-radius: var(--radius);
  background: var(--bg);
  border: var(--border-width) solid var(--border-color);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--muted);
  font-size: 14px;
}

.idle-text {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Layout / visibility toggles                                         */
/* ------------------------------------------------------------------ */
body.vertical .widget {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

body.vertical .now-playing-label {
  justify-content: center;
}

body.vertical .times {
  justify-content: center;
  gap: 10px;
}

body.align-center .info {
  text-align: center;
}

body.align-right .info {
  text-align: right;
}

body.align-center .now-playing-label,
body.align-right .now-playing-label {
  justify-content: center;
}

body.align-right .now-playing-label {
  justify-content: flex-end;
}

body.no-cover .art {
  display: none;
}

body.no-title .title {
  display: none;
}

body.no-artist .artist {
  display: none;
}

body.no-label .now-playing-label {
  display: none;
}

body.no-label-dot .now-playing-label::before {
  display: none;
}

body.no-progress .progress {
  display: none;
}

body.no-time .times {
  display: none;
}

/* Marquee for long titles */
body.marquee .title {
  text-overflow: clip;
}

body.marquee .title-text.scrolling {
  animation: marquee var(--marquee-duration, 8s) ease-in-out infinite alternate;
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--marquee-shift, -100px));
  }
}

/* Dim when paused */
body.dim-on-pause.paused .widget {
  opacity: 0.45;
  filter: grayscale(0.6);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

/* ------------------------------------------------------------------ */
/* Background styles                                                    */
/* ------------------------------------------------------------------ */
body.bg-solid .widget,
body.bg-solid .idle {
  background: var(--bg-solid);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.bg-clear .widget,
body.bg-clear .idle {
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

body.bg-accent .widget,
body.bg-accent .idle {
  background:
    radial-gradient(140% 140% at 0% 0%, var(--accent-soft), transparent 55%),
    var(--bg);
  border-color: var(--accent-soft);
}

body.bg-outline .widget,
body.bg-outline .idle {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

/* ------------------------------------------------------------------ */
/* Cover styles                                                         */
/* ------------------------------------------------------------------ */
body.cover-circle .art,
body.cover-circle .art img,
body.cover-circle .art video {
  border-radius: 50%;
}

/* Vinyl disc */
body.cover-disc .art,
body.cover-disc .art img,
body.cover-disc .art video {
  border-radius: 50%;
}

body.cover-disc .art::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(
    circle at 50% 50%,
    rgba(0, 0, 0, 0.2) 0 1px,
    transparent 1px 3px
  );
  z-index: 1;
  pointer-events: none;
}

body.cover-disc .art::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #0b0b0c;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.05);
  z-index: 2;
}

body.cover-disc.disc-spin .art {
  animation: disc-spin 7s linear infinite;
}

body.cover-disc.disc-spin.paused .art {
  animation-play-state: paused;
}

@keyframes disc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Full-bleed background cover */
body.cover-full .widget {
  overflow: hidden;
  min-height: 128px;
}

body.cover-full.vertical .widget {
  min-height: 260px;
}

body.cover-full .art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
  z-index: 0;
}

body.cover-full .widget::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0.16) 45%,
    rgba(0, 0, 0, 0.74) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

body.cover-full .info {
  position: relative;
  z-index: 2;
}

body.cover-full.vertical .widget {
  align-items: center;
  justify-content: flex-end;
}

body.cover-full.vertical .info {
  width: 100%;
}

.hidden {
  display: none !important;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(29, 185, 84, 0.55);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(29, 185, 84, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(29, 185, 84, 0);
  }
}
