/*
 * Design system: camadas do player liberado (themes/youplay/js/ds-player.js).
 * Estado carregando/erro, menu CC, "próximo da coleção" e legendas (::cue legível).
 * Texto branco só sobre mídia/fundo escuro semitransparente.
 */

.dsp {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-sans);
}

.dsp > * { pointer-events: auto; }
.dsp > .dsp-status { pointer-events: none; }

.dsp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.dsp-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.dsp-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgb(255 255 255 / 30%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dsp-spin 0.9s linear infinite;
}

.dsp-spinner[hidden],
.dsp [hidden] { display: none !important; }

@keyframes dsp-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .dsp-spinner { animation-duration: 3s; }
}

.dsp-msg,
.dsp-next {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(420px, calc(100% - 32px));
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--media-overlay);
  color: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
}

.dsp-next { top: auto; bottom: 64px; transform: translateX(-50%); }

.dsp-msg-text,
.dsp-next-title,
.dsp-next-count { margin: 0; font-size: var(--text-md); line-height: var(--leading-normal); }
.dsp-next-count { font-size: var(--text-sm); opacity: 0.85; }

.dsp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--space-5);
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-foreground);
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.dsp-btn-quiet { background: transparent; color: #fff; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 55%); }

.dsp-btn:focus-visible,
.dsp-cc-btn:focus-visible,
.dsp-menu-item:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--ring);
}

.dsp-toast {
  position: absolute;
  left: 50%;
  top: var(--space-4);
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  background: var(--media-overlay);
  color: #fff;
  font-size: var(--text-sm);
  white-space: nowrap;
}

/* Botão CC: aparece com o mouse sobre o player, com foco ou com a legenda ligada */
.dsp-cc {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.plyr:hover .dsp-cc,
.video-player:hover .dsp-cc,
.pt_vdo_plyr:hover .dsp-cc,
.dsp-cc:focus-within { opacity: 1; }

@media (hover: none) { .dsp-cc { opacity: 1; } }

.dsp-cc-btn {
  min-width: 44px;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: var(--media-overlay);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.dsp-cc-btn.on { background: var(--brand); color: var(--brand-foreground); }

.dsp-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  min-width: 180px;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--media-overlay);
  display: flex;
  flex-direction: column;
}

.dsp-menu-item {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #fff;
  font-size: var(--text-base);
  text-align: left;
  cursor: pointer;
}

.dsp-menu-item:hover { background: rgb(255 255 255 / 14%); }
.dsp-menu-item[aria-checked="true"] { font-weight: 700; }
.dsp-menu-item[aria-checked="true"]::before { content: "\2713\00a0"; }

/* Legendas legíveis: fundo semitransparente, contraste alto */
video::cue {
  background: rgb(0 0 0 / 72%);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 1.35em;
  line-height: 1.35;
}
