@property --chorus-phase {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}
.karaoke {
  --cue-violet: #8c14e8;
  --cue-rose: #ce167f;
  --cue-warm: #c53735;
  --cue-mint: #007c62;
  --cue-blue: #0964ed;
  --chorus-spectrum: linear-gradient(
    90deg,
    var(--cue-violet) 0%,
    var(--cue-rose) 20%,
    var(--cue-warm) 40%,
    var(--cue-mint) 60%,
    var(--cue-blue) 80%,
    var(--cue-violet) 100%
  );
}
[data-theme="dark"] .karaoke {
  --cue-violet: #b673ff;
  --cue-rose: #ff53bd;
  --cue-warm: #ffd04a;
  --cue-mint: #1ee9b8;
  --cue-blue: #53a7ff;
}
.karaoke .karaoke-section {
  font-weight: 600;
  background-image: var(--chorus-spectrum);
  background-size: 200% 100%;
  background-repeat: repeat-x;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: cue-colour-flow 2.8s linear infinite;
}
.karaoke .karaoke-estimate {
  display: none;
}
.karaoke .karaoke-lead i {
  background: var(--cue-violet);
  box-shadow: none;
}
.karaoke .karaoke-lead i:nth-child(2) {
  background: var(--cue-rose);
}
.karaoke .karaoke-lead i:nth-child(3) {
  background: var(--cue-mint);
}
.karaoke-current[data-chorus="true"] .karaoke-word {
  position: relative;
  text-shadow: none;
  /* Sung text shows only through the rainbow overlay; painting it underneath
     too leaves a pale fringe around the coloured glyphs. */
  background-image: linear-gradient(
    to right,
    transparent var(--word-progress, 0%),
    var(--karaoke-unsung) var(--word-progress, 0%)
  );
}
.karaoke-current[data-chorus="true"] .karaoke-word[data-timing="steady"].sung {
  color: transparent;
}
.karaoke-current[data-chorus="true"] .karaoke-word::after {
  content: attr(data-rainbow-text) / "";
  position: absolute;
  inset: 0;
  padding-inline: inherit;
  pointer-events: none;
  background-image: var(--chorus-spectrum);
  background-size: var(--chorus-span, 900px) 100%;
  background-position: calc(
      var(--chorus-phase) * var(--chorus-span, 900px) - var(--word-x, 0px)
    )
    0;
  background-repeat: repeat-x;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  clip-path: inset(0 calc(100% - var(--word-progress, 0%)) 0 0);
  text-shadow: none;
}
@keyframes cue-colour-flow {
  from {
    background-position: 0% 50%;
  }
  to {
    background-position: 200% 50%;
  }
}
@media (forced-colors: active) {
  .karaoke .karaoke-section {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
  }
  .karaoke-current[data-chorus="true"] .karaoke-word::after {
    display: none;
  }
}
