/* Fundos do karaokê (static/karaoke/themes.js), os mesmos na TV e na web.
   Cada fundo usa duas camadas (::before e ::after) que só mexem em transform e opacity.
   O véu (.kk-theme-scrim) escurece o centro, onde fica a letra, e as faixas de cima e de baixo.
   Música pausada: o movimento para e o fundo escurece. Reduzir movimento: fica parado. */
.kk-theme { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: #0e1014; }
.kk-theme[hidden] { display: none; }
.kk-theme::before, .kk-theme::after {
  content: ''; position: absolute; inset: -25%; will-change: transform;
  animation-play-state: running; animation-timing-function: ease-in-out; animation-iteration-count: infinite;
}
.kk-theme-scrim, .kk-theme-video, .kk-theme-poster, .kk-theme-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.kk-theme-video, .kk-theme-poster { object-fit: cover; }
.kk-theme-canvas[hidden] { display: none; }
/* Com vídeo ou WebGL na frente, as camadas CSS ficam desligadas (não gastam nada por baixo). */
.kk-theme.has-media::before, .kk-theme.has-media::after { content: none; }
.kk-theme-scrim {
  z-index: 2; transition: background-color .6s ease-out;
  background:
    linear-gradient(to bottom, #101216b0 0, #1012168a 11%, #10121600 26%),
    linear-gradient(to top, #101216c4 0, #10121694 15%, #10121600 32%),
    radial-gradient(ellipse 48% 56% at 50% 50%, #10121699 0, #1012168a 60%, #10121640 86%, #10121600 100%);
}
.kk-theme.is-paused::before, .kk-theme.is-paused::after { animation-play-state: paused; }
.kk-theme.is-paused .kk-theme-scrim { background-color: #090b0e66; }

@keyframes kk-drift { from { transform: translate3d(-6%, -4%, 0) rotate(0deg); } to { transform: translate3d(6%, 5%, 0) rotate(12deg); } }
@keyframes kk-breathe { from { opacity: .45; transform: scale(1); } to { opacity: .9; transform: scale(1.08); } }
/* Subir e deslizar vão e voltam (alternate): sem o salto de quando a animação recomeça. */
@keyframes kk-rise { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(0, -25%, 0); } }
@keyframes kk-slide { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-25%, 0, 0); } }
@keyframes kk-twinkle { from { opacity: .35; } to { opacity: 1; } }

/* Palco: o vídeo de sempre (o ::before/::after ficam vazios). */
.kk-theme[data-theme="palco"]::before, .kk-theme[data-theme="palco"]::after { content: none; }

/* Aurora: nuvens de cor que passeiam devagar. */
.kk-theme[data-theme="aurora"] { background: #0b1016; }
.kk-theme[data-theme="aurora"]::before {
  background: radial-gradient(40% 35% at 30% 40%, #f5a62366, transparent 70%), radial-gradient(45% 40% at 70% 60%, #1fb5a85c, transparent 70%);
  animation-name: kk-drift; animation-duration: 22s; animation-direction: alternate;
}
.kk-theme[data-theme="aurora"]::after {
  background: radial-gradient(38% 34% at 60% 30%, #8b5cf655, transparent 70%), radial-gradient(35% 30% at 25% 75%, #3ddc8440, transparent 70%);
  animation-name: kk-drift; animation-duration: 30s; animation-direction: alternate-reverse;
}

/* Neon: brilho magenta e ciano que pulsa, com linhas de varredura subindo. */
.kk-theme[data-theme="neon"] { background: #0c0812; }
.kk-theme[data-theme="neon"]::before {
  background: radial-gradient(35% 45% at 18% 50%, #ff2bd666, transparent 70%), radial-gradient(35% 45% at 82% 50%, #22d3ee5c, transparent 70%);
  animation-name: kk-breathe; animation-duration: 5s; animation-direction: alternate;
}
.kk-theme[data-theme="neon"]::after {
  inset: 0 0 -50% 0; opacity: .5;
  background: repeating-linear-gradient(0deg, transparent 0 22px, #ff2bd61f 22px 24px, transparent 24px 46px, #22d3ee1a 46px 48px);
  animation-name: kk-rise; animation-duration: 14s; animation-direction: alternate;
}

/* Galáxia: duas camadas de estrelas, uma subindo devagar e outra cintilando. */
.kk-theme[data-theme="galaxia"] { background: radial-gradient(ellipse at 50% 120%, #1b1440, #06070d 70%); }
.kk-theme[data-theme="galaxia"]::before {
  inset: 0 0 -50% 0;
  background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff 50%, transparent), radial-gradient(1px 1px at 90px 120px, #ffe9c4 50%, transparent),
    radial-gradient(1.5px 1.5px at 160px 70px, #c7d2fe 50%, transparent), radial-gradient(1px 1px at 210px 190px, #fff 50%, transparent);
  background-size: 240px 240px;
  animation-name: kk-rise; animation-duration: 90s; animation-direction: alternate;
}
.kk-theme[data-theme="galaxia"]::after {
  inset: 0;
  background-image: radial-gradient(2px 2px at 60px 80px, #fff 50%, transparent), radial-gradient(1.5px 1.5px at 260px 220px, #fde68a 50%, transparent),
    radial-gradient(2px 2px at 330px 40px, #bae6fd 50%, transparent);
  background-size: 380px 300px;
  animation-name: kk-twinkle; animation-duration: 3.5s; animation-direction: alternate;
}

/* Pôr do sol: céu quente com o sol respirando no horizonte. */
.kk-theme[data-theme="por-do-sol"] { background: linear-gradient(to bottom, #1a0f24 0, #3b1532 45%, #7a2e2a 78%, #c2552a 100%); }
.kk-theme[data-theme="por-do-sol"]::before {
  background: radial-gradient(22% 26% at 50% 78%, #ffc56b99, #ff7a3a44 55%, transparent 75%);
  animation-name: kk-breathe; animation-duration: 9s; animation-direction: alternate;
}
.kk-theme[data-theme="por-do-sol"]::after {
  inset: 55% -50% 0 0; opacity: .55;
  background: repeating-linear-gradient(90deg, transparent 0, #ffb36b1f 130px, transparent 260px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 70%); mask-image: linear-gradient(to bottom, transparent, #000 70%);
  animation-name: kk-slide; animation-duration: 40s; animation-direction: alternate;
}

/* Oceano: azul fundo com duas ondas de luz passando em velocidades diferentes. */
.kk-theme[data-theme="oceano"] { background: linear-gradient(to bottom, #04141f 0, #062a3d 60%, #0a3b4f 100%); }
.kk-theme[data-theme="oceano"]::before {
  inset: 35% -50% 0 0; opacity: .7;
  background: repeating-radial-gradient(ellipse 160px 60px at 80px 100%, #38bdf833 0, transparent 70%);
  background-size: 320px 100%;
  animation-name: kk-slide; animation-duration: 26s; animation-direction: alternate;
}
.kk-theme[data-theme="oceano"]::after {
  inset: 20% -50% 0 0; opacity: .5;
  background: repeating-radial-gradient(ellipse 220px 90px at 110px 100%, #5eead42e 0, transparent 70%);
  background-size: 440px 100%;
  animation-name: kk-slide; animation-duration: 38s; animation-direction: alternate-reverse;
}

/* Psicodélicos: aqui é a versão leve (TV enquanto não há vídeo, miniatura e aparelho sem WebGL).
   Cor suave e escura o bastante para o véu manter a letra legível; nada pisca, só gira e respira. */
/* A camada que gira cresce 1,7×: com a sobra de 25% de cada lado, ela cobre a tela inteira em qualquer ângulo
   (até 1:2,2, 16:9 da TV e celular em pé), sem cantos do fundo liso aparecendo durante a volta. */
@keyframes kk-spin { from { transform: rotate(0deg) scale(1.7); } to { transform: rotate(360deg) scale(1.7); } }
@keyframes kk-zoom { from { transform: scale(1); } to { transform: scale(1.3); } }

/* Caleidoscópio: leque de cores girando devagar, com o centro escuro respirando. */
.kk-theme[data-theme="caleidoscopio"] { background: #0d0816; }
.kk-theme[data-theme="caleidoscopio"]::before {
  opacity: .7;
  background: conic-gradient(from 0deg, #7c3aed99, #db277799, #0891b299, #ca8a0499, #7c3aed99, #db277799, #0891b299, #ca8a0499, #7c3aed99);
  animation-name: kk-spin; animation-duration: 80s; animation-timing-function: linear;
}
.kk-theme[data-theme="caleidoscopio"]::after {
  background: radial-gradient(circle at 50% 50%, #0d0816cc 0, #0d081680 30%, transparent 62%);
  animation-name: kk-breathe; animation-duration: 8s; animation-direction: alternate;
}

/* Plasma: manchas de cor quente e fria que escorrem uma sobre a outra. */
.kk-theme[data-theme="plasma"] { background: #100a1a; }
.kk-theme[data-theme="plasma"]::before {
  background: radial-gradient(40% 40% at 30% 35%, #e11d4877, transparent 70%), radial-gradient(42% 42% at 72% 65%, #2563eb70, transparent 70%);
  animation-name: kk-drift; animation-duration: 18s; animation-direction: alternate;
}
.kk-theme[data-theme="plasma"]::after {
  background: radial-gradient(36% 36% at 65% 28%, #f59e0b5c, transparent 70%), radial-gradient(38% 38% at 28% 72%, #10b98152, transparent 70%);
  animation-name: kk-drift; animation-duration: 24s; animation-direction: alternate-reverse;
}

/* Túnel: anéis que se aproximam e um leque girando por cima. */
.kk-theme[data-theme="tunel"] { background: #07060f; }
.kk-theme[data-theme="tunel"]::before {
  background: repeating-radial-gradient(circle at 50% 50%, #06070d 0, #4338ca66 6%, #be185d55 10%, #06070d 15%);
  animation-name: kk-zoom; animation-duration: 10s; animation-direction: alternate;
}
.kk-theme[data-theme="tunel"]::after {
  opacity: .35;
  background: repeating-conic-gradient(from 0deg, #22d3ee55 0deg, transparent 15deg, transparent 30deg, #22d3ee55 45deg);
  animation-name: kk-spin; animation-duration: 120s; animation-timing-function: linear;
}

/* Lava: bolhas quentes subindo e descendo devagar. */
.kk-theme[data-theme="lava"] { background: linear-gradient(to bottom, #12040e, #1c060b); }
.kk-theme[data-theme="lava"]::before {
  inset: 0 0 -50% 0;
  background: radial-gradient(18% 14% at 30% 70%, #f9731688, transparent 70%), radial-gradient(14% 12% at 68% 55%, #db277780, transparent 70%),
    radial-gradient(16% 13% at 50% 90%, #ea580c80, transparent 70%);
  animation-name: kk-rise; animation-duration: 26s; animation-direction: alternate;
}
.kk-theme[data-theme="lava"]::after {
  background: radial-gradient(30% 26% at 50% 100%, #f9731655, transparent 70%);
  animation-name: kk-breathe; animation-duration: 9s; animation-direction: alternate;
}

/* Grafite: liso e parado, para quem quer só a letra. */
.kk-theme[data-theme="grafite"] { background: radial-gradient(ellipse at 50% 30%, #23262d, #121418 70%); }
.kk-theme[data-theme="grafite"]::before, .kk-theme[data-theme="grafite"]::after { content: none; }

@media (prefers-reduced-motion: reduce) {
  .kk-theme::before, .kk-theme::after { animation: none !important; }
}

/* Linha atual do karaokê (TV e web): a parte já cantada fica âmbar e o resto, claro. O --kk-p (0..1)
   vem de lyricWipe (tv-clock.js); a linha quebrada se preenche em sequência porque o fundo de um
   elemento inline é contínuo entre as linhas. */
.kk-sung {
  --kk-done: #ffc65c; --kk-todo: #f4f1ea;
  background: linear-gradient(90deg, var(--kk-done) calc(var(--kk-p, 0) * 100%), var(--kk-todo) calc(var(--kk-p, 0) * 100% + .35em));
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  text-shadow: none;   /* no Chrome a sombra pinta por cima do texto recortado e suja a cor */
}
