.jukebox-wrap {
  pointer-events: none;
  width: min(90vw, 440px);
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transform: translateY(-6px);
  transition: grid-template-rows 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.45s ease,
              margin-top 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.45s ease;
}

.jukebox-wrap.jukebox-open {
  pointer-events: auto;
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 12px;
  transform: translateY(0);
}

.jukebox-clip {
  overflow: hidden;
  min-height: 0;
}

.jukebox {
  background: #030305;
  text-align: left;
}

.jb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px 8px;
  border-bottom: 1px solid rgba(158, 170, 255, 0.25);
  font-family: 'JetBrainsMono NF ExtraBold', 'Courier New', monospace;
  font-size: clamp(0.6rem, 1.2vw, 0.7rem);
  letter-spacing: 0.16em;
  color: #9eaaff;
}

.jb-head-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* little square that pulses only while audio is actually running */
.jb-led {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: rgba(187, 127, 130, 0.35);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.jukebox.jb-playing .jb-led {
  background: #bb7f82;
  box-shadow: 0 0 8px rgba(187, 127, 130, 0.8);
  animation: jbPulse 2s ease-in-out infinite;
}

.jb-time {
  flex: 0 0 auto;
  color: rgba(238, 240, 255, 0.4);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.jb-time-now {
  color: rgba(238, 240, 255, 0.7);
}

/* --- body --- */
.jb-body {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 13px 14px 14px;
}

.jb-art {
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  background: #0a0a12;
  border: 1px solid rgba(158, 170, 255, 0.25);
  overflow: hidden;
}

.jb-art canvas,
.jb-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

/* faint scanlines so the cover sits in the same world as the terminal */
.jb-art::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(3, 3, 5, 0.32) 0px,
    rgba(3, 3, 5, 0.32) 1px,
    transparent 1px,
    transparent 3px
  );
}

.jb-main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  flex: 1 1 auto;
  gap: 8px;
}

.jb-meta {
  min-width: 0;
}

.jb-title {
  font-family: 'JetBrainsMono NF ExtraBold', 'Courier New', monospace;
  font-size: clamp(0.88rem, 1.7vw, 1rem);
  letter-spacing: 0.02em;
  color: rgba(238, 240, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jb-title-mark {
  color: #bb7f82;
  margin-left: 4px;
}

.jb-artist {
  margin-top: 2px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgba(238, 240, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- scrubber --- */
.jb-scrub {
  position: relative;
  padding: 7px 0;
  cursor: pointer;
  touch-action: none;
}

.jb-scrub-rail {
  position: relative;
  height: 1px;
  background: rgba(158, 170, 255, 0.25);
}

.jb-scrub-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: #bb7f82;
}

.jb-scrub-head {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 2px;
  height: 9px;
  margin-left: -1px;
  background: #bb7f82;
  transform: translateY(-50%);
  box-shadow: 0 0 8px rgba(187, 127, 130, 0.6);
}

.jb-scrub:hover .jb-scrub-rail,
.jb-scrub:focus-visible .jb-scrub-rail {
  background: rgba(158, 170, 255, 0.45);
}

.jb-scrub:focus-visible {
  outline: 1px solid rgba(187, 127, 130, 0.6);
  outline-offset: 3px;
}

/* --- controls --- */
.jb-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.jb-btn {
  background: none;
  border: none;
  margin: 0;
  padding: 3px 7px;
  font-family: 'JetBrainsMono NF ExtraBold', 'Courier New', monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: rgba(187, 127, 130, 0.65);
  cursor: pointer;
  transition: color 0.2s ease, text-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.jb-btn:hover,
.jb-btn:focus-visible {
  color: #d99ea1;
  text-shadow: 0 0 10px rgba(187, 127, 130, 0.55);
}

.jb-btn:focus-visible {
  outline: 1px solid rgba(187, 127, 130, 0.6);
  outline-offset: 2px;
}

.jb-btn:active {
  color: #f2c1c4;
}

.jb-btn-play {
  font-size: 0.9rem;
  color: #bb7f82;
}

.jb-count {
  margin-left: auto;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: rgba(238, 240, 255, 0.28);
  font-variant-numeric: tabular-nums;
}

/* empty / broken states keep the same frame, just say what's wrong */
.jukebox.jb-empty .jb-scrub,
.jukebox.jb-empty .jb-controls {
  opacity: 0.35;
  pointer-events: none;
}

@keyframes jbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 420px) {
  .jb-art { width: 56px; height: 56px; }
  .jb-body { gap: 11px; padding: 11px 12px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .jukebox-wrap { transition: opacity 0.2s ease; }
  .jukebox.jb-playing .jb-led { animation: none; }
}
