.np-widget {
    contain: content;
  /* background: linear-gradient(135deg, #1a1a2e, #16213e); */
  /* background: linear-gradient(135deg, #1a1a2e, #3b1364); */
  background: linear-gradient(135deg, #1a1a2e, #3e163a);
  border-radius: 12px;
  padding: 16px;
  color: #fff;
  max-width: 500px;
  margin: 20px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(111, 74, 255, 0.3);
}

.np-widget.np-offline {
  background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
  border-color: rgba(255, 100, 100, 0.3);
  text-align: center;
}

.np-widget.np-offline .np-status {
  color: #ff6b6b;
  font-size: 1.2rem;
  font-weight: bold;
}

.np-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.np-label::before {
  content: '● ';
  color: #00ff88;
  animation: pulse calc(var(--pulse-tempo, 4s) * 0.75) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.np-track-link {
  text-decoration: none;
  color: inherit;
  display: block;
  margin-bottom: 12px;
}

.np-track-link:hover {
  color: #6d4aff;
}

.np-track-info {
  background: rgba(109, 74, 255, 0.15);
  padding: 12px;
  border-radius: 8px;
  margin: 10px 0;
}

.np-title {
  font-size: 1.3rem;
  margin: 0 0 4px 0;
  color: #fff;
}

.np-artist {
  font-size: 1rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
}

.np-mixtape {
  background: #6d4aff;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
}

.np-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
}

/* OLD — layout-triggering */
.np-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6d4aff, #b60589);
  transition: width 0.25s ease;
}

/* NEW — compositor-only, no reflow */
.np-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #6d4aff, #b60589);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.np-timer {
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
}

.np-remaining {
  color: #00ff88;
}

.np-reactions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.np-react-btn {
  background: rgba(109, 74, 255, 0.2);
  border: 1px solid rgba(109, 74, 255, 0.4);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s;
}

.np-react-btn:hover {
  background: rgba(109, 74, 255, 0.4);
  transform: scale(1.1);
}

.np-react-active {
  background: #6d4aff;
  border-color: #6d4aff;
  animation: pop 0.3s ease;
}

@keyframes pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

.np-error {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.np-reaction-count {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.np-reaction {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.np-reaction sup {
  font-size: 0.7em;
  vertical-align: super;
  color: #b60589;
}

.np-no-reactions {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.np-timer,
.np-current,
.np-total,
.np-remaining {
  font-variant-numeric: tabular-nums;
}
.np-react-btn {
  transition: background-color 0.2s, transform 0.2s;  /* was: all 0.2s */
}


/* Lyric Button (inside now-playing-widget) */
.np-lyrics-btn {
  background: rgba(109, 74, 255, 0.2);
  border: 1px solid rgba(109, 74, 255, 0.4);
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 10px;
}

.np-lyrics-btn:hover:not(:disabled) {
  background: rgba(109, 74, 255, 0.4);
  transform: translateY(-1px);
}

.np-lyrics-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal Overlay */
.np-lyrics-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.np-lyrics-modal {
  /* background: linear-gradient(135deg, #1a1a2e, #16213e); */
  background: linear-gradient(135deg, #1a1a2e, #3d163e);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(109, 74, 255, 0.3);
}

.np-lyrics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(109, 74, 255, 0.2);
}

.np-lyrics-header h3 {
  margin: 0;
  font-size: 1.3rem;
  color: #fff;
}

.np-lyrics-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
}

.np-lyrics-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.np-lyrics-content {
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.9);
}

.np-lyrics-content p {
  margin: 12px 0;
  padding: 8px 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s;
}

.np-lyrics-content p:hover {
  background: rgba(109, 74, 255, 0.2);
  border-left-color: #b60589;
}

.np-lyrics-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(109, 74, 255, 0.2);
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.np-lyrics-loader {
  text-align: center;
  padding: 40px;
  color: #888;
  font-style: italic;
}


/* ---- Credit links row ---- */
.np-credit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(109, 74, 255, 0.2);
}

.np-credit-msg {
  display: block;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.np-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.np-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  text-decoration: none;
  color: #fff;
  background: rgba(109, 74, 255, 0.18);
  border: 1px solid rgba(109, 74, 255, 0.35);
  transition: background-color 0.2s, transform 0.2s;
}

.np-link:hover {
  background: rgba(109, 74, 255, 0.42);
  transform: translateY(-1px);
}

@media (max-width: 420px) {
  .np-link { padding: 5px 10px; font-size: 0.76rem; }
}

/* Smooth fade for source switching */
.np-widget.np-fading-out {
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 300ms ease, transform 300ms ease;
}

.np-widget.np-fading-in {
  opacity: 1;
  transform: scale(1);
  transition: opacity 400ms ease, transform 400ms ease;
}

/* Prevent layout jump while transitioning */
.np-widget {
  min-height: 200px;
  transition: min-height 300ms ease;
}

/* Loading state keeps same height */
.np-widget.np-loading {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(109, 74, 255, 0.1);
}

.np-widget.np-loading .np-status {
  color: #6d4aff;
  font-size: 1rem;
  letter-spacing: 1px;
}

/* =====================================================================
   SOURCE-SWITCH TRANSITION
   Targets the #now-playing-widget CONTAINER, not the inner .np-widget,
   so the whole box fades as one unit and can't collapse mid-swap.
   ===================================================================== */

#now-playing-widget {
  transition: opacity 480ms ease, transform 480ms ease;
  will-change: opacity, transform;
}

#now-playing-widget.np-fading-out {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
}

/* TUNING plate — inherits the frozen height, so no layout jump */
#now-playing-widget .np-widget.np-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 500px;
  margin: 20px auto;
  padding: 16px;
  border-radius: 12px;
  background: rgba(109, 74, 255, 0.12);
  border: 1px solid rgba(109, 74, 255, 0.3);
  color: #fff;
}

#now-playing-widget .np-widget.np-loading .np-status {
  color: #6d4aff;
  font-size: 1rem;
  letter-spacing: 2px;
  animation: np-tuning-pulse calc(var(--pulse-tempo, 4s) * 0.5) ease-in-out infinite;
}

@keyframes np-tuning-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* =====================================================================
   CROSSFADE STYLES (optional)
   Enable by setting CFG.CROSSFADE_ENABLED = true in widget JS
   ===================================================================== */

 .np-crossfade-outgoing {
    opacity: 0;
    transform: scale(0.98);
    pointer-events: none;
  } 
 .np-crossfade-incoming {
    position: relative;
    z-index: 2;
  } 

  /* ---- "play from here" deep link ------------------------------------- */
.np-jump {
  display: inline-block;
  margin: 0.35rem 0 0.5rem;
  padding: 0.3rem 0.75rem;
  font-family: 'VT323', monospace;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-decoration: none;
  color: var(--site-accent, #00ff00);
  background: rgba(var(--site-accent-rgb, 0, 255, 0), 0.08);
  border: 1px solid var(--border-medium, rgba(0, 255, 0, 0.78));
  border-radius: 3px;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.np-jump:hover,
.np-jump:focus-visible {
  background: var(--site-accent, #00ff00);
  color: #000;
  outline: none;
  box-shadow: 0 0 14px rgba(var(--site-accent-rgb, 0, 255, 0), 0.6);
}

/* ---- mixtape chip doubles as the jump-to-here link ------------------ */
.np-mixtape-link {
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dotted currentColor;
  transition: color 0.18s ease, border-color 0.18s ease, text-shadow 0.18s ease;
}

/* small play glyph so the chip reads as clickable */
.np-mixtape-link::after {
  content: ' ▶';
  font-size: 0.82em;
  opacity: 0.6;
  transition: opacity 0.18s ease;
}

.np-mixtape-link:hover,
.np-mixtape-link:focus-visible {
  color: var(--site-accent, #00ff00);
  border-bottom-color: var(--site-accent, #00ff00);
  text-shadow: 0 0 10px rgba(var(--site-accent-rgb, 0, 255, 0), 0.55);
  outline: none;
}

.np-mixtape-link:hover::after,
.np-mixtape-link:focus-visible::after {
  opacity: 1;
}


/* ==== CASEFILE 158b — accent-token skin (cyan-aware) ==== */
#now-playing-widget { border: 1px solid rgba(var(--site-accent-rgb), 0.4); }
#now-playing-widget .np-label { color: var(--site-accent); letter-spacing: 2px; }
#now-playing-widget .np-mixtape { color: var(--site-accent); }
#now-playing-widget .np-progress-fill { background: linear-gradient(90deg, var(--site-accent), rgba(var(--site-accent-rgb), 0.4)); }
#now-playing-widget .np-react-btn { background: rgba(var(--site-accent-rgb), 0.14); border: 1px solid rgba(var(--site-accent-rgb), 0.35); }
#now-playing-widget .np-react-btn:hover { background: var(--site-accent); color: #000; }
#now-playing-widget .np-lyrics-btn { background: rgba(var(--site-accent-rgb), 0.14); }
#now-playing-widget .np-custody .np-title { color: var(--site-accent); text-shadow: 0 0 10px rgba(var(--site-accent-rgb), 0.4); }
#now-playing-widget .np-custody .np-artist { color: rgba(255,255,255,0.75); }

/* ==== [COUNT-IN-BTN] per-button reaction count (Rule 28 append) ==== */
#now-playing-widget .np-react-btn .np-rx-cnt {
  font-size: 0.55em;
  margin-left: 2px;
  vertical-align: super;
  font-family: inherit;
}
