pb-player {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: var(--pb-ratio, 16 / 9);
  background: #000;
  overflow: hidden;
  border-radius: var(--pb-radius, 8px);
}

pb-player:not(:defined) {
  aspect-ratio: 16 / 9;
}

pb-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
}

.pb-capa {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 1;
  transition: opacity .35s ease;
}

pb-player[data-pb-state="playing-muted"] .pb-capa,
pb-player[data-pb-state="playing"] .pb-capa,
pb-player[data-pb-state="paused"] .pb-capa,
pb-player[data-pb-state="ended"] .pb-capa {
  opacity: 0;
  pointer-events: none;
}

.pb-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .22);
  border-top-color: var(--pb-accent, #e60023);
  animation: pb-spin .9s linear infinite;
}

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

/* Sem arranque automático: a capa é um convite a clicar, não um carregamento. */
.pb-capa-cta .pb-spinner {
  border: 0;
  background: rgba(0, 0, 0, .55) center / 34% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
  width: 68px;
  height: 68px;
  animation: none;
}

/* Estado de erro: a mensagem substitui o indicador. */
pb-player[data-pb-state="error"] .pb-spinner {
  display: none;
}

.pb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pb-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: #fff;
  text-align: center;
  background: transparent;
}

pb-player[data-pb-state="playing-muted"] .pb-overlay {
  display: flex;
}

/* Cartão central: o vídeo continua visível à volta, como na referência. */
.pb-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.5%, 10px);
  width: min(62%, 340px);
  padding: clamp(10px, 3%, 20px) clamp(12px, 4%, 24px);
  border-radius: 6px;
  background: rgba(240, 120, 90, .82);
  transition: background-color .2s ease;
}

.pb-overlay:hover .pb-overlay-card,
.pb-overlay:focus-visible .pb-overlay-card {
  background: rgba(232, 100, 68, .92);
}

.pb-overlay:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -3px;
}

.pb-overlay-icon {
  width: clamp(48px, 34%, 84px);
  aspect-ratio: 1;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4zM14 3.2v2.1c2.9.9 5 3.5 5 6.7s-2.1 5.8-5 6.7v2.1c4-1 7-4.5 7-8.8s-3-7.9-7-8.8z'/%3E%3Cpath d='M2.1 3.5 3.5 2.1l18.4 18.4-1.4 1.4z' stroke='%23fff' stroke-width='.5'/%3E%3C/svg%3E");
  flex: none;
}

.pb-overlay-title,
.pb-overlay-text {
  font-size: clamp(.8rem, 2.4vw, 1rem);
  font-weight: 700;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.pb-toggle {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

pb-player[data-pb-state="playing"] .pb-toggle,
pb-player[data-pb-state="paused"] .pb-toggle,
pb-player[data-pb-state="ended"] .pb-toggle {
  display: block;
}

.pb-toggle-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 68px;
  height: 68px;
  margin: -34px 0 0 -34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
}

pb-player[data-pb-state="paused"] .pb-toggle-icon,
pb-player[data-pb-state="ended"] .pb-toggle-icon {
  opacity: 1;
  background: rgba(0, 0, 0, .55) center / 34% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
}

pb-player.pb-flash[data-pb-state="playing"] .pb-toggle-icon {
  background: rgba(0, 0, 0, .55) center / 34% no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M6 5h4v14H6zm8 0h4v14h-4z'/%3E%3C/svg%3E");
  animation: pb-flash .5s ease forwards;
}

@keyframes pb-flash {
  0% { opacity: 1; transform: scale(.9); }
  100% { opacity: 0; transform: scale(1.15); }
}

.pb-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  z-index: 4;
  background: rgba(255, 255, 255, .25);
  pointer-events: none;
  display: none;
}

pb-player[data-pb-state="playing-muted"] .pb-bar,
pb-player[data-pb-state="playing"] .pb-bar,
pb-player[data-pb-state="paused"] .pb-bar,
pb-player[data-pb-state="ended"] .pb-bar {
  display: block;
}

.pb-bar-fill {
  height: 100%;
  width: 0;
  background: var(--pb-accent, #e60023be);
}

@media (prefers-reduced-motion: reduce) {
  .pb-capa { transition: none; }
  .pb-spinner { animation-duration: 2.4s; }
  pb-player.pb-flash[data-pb-state="playing"] .pb-toggle-icon { animation-duration: .01ms; }
}

.pb-aviso {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: 90%;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: .9rem;
  text-align: center;
  text-decoration: none;
}

/* Estado de erro com hiperligação: a capa inteira é o alvo de clique,
   a pílula continua a ser a etiqueta visível. */
a.pb-aviso {
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  transform: none;
  max-width: none;
  padding: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pb-aviso-pill {
  max-width: 90%;
  margin-bottom: 12%;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .78);
}

a.pb-aviso:hover .pb-aviso-pill,
a.pb-aviso:focus .pb-aviso-pill {
  background: rgba(0, 0, 0, .92);
  text-decoration: underline;
}

pb-player[data-pb-state="error"] .pb-overlay,
pb-player[data-pb-state="error"] .pb-toggle,
pb-player[data-pb-state="error"] .pb-bar {
  display: none;
}
