body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  overflow: hidden; /* Aby uniknąć pasków przewijania */
}

.player-wrapper { /* Dodany wrapper dla lepszego pozycjonowania */
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.video-container { /* Kontener dla wideo */
  position: relative;
  width: 100%;
  height: 100%;
  display: none; /* Początkowo ukryty */
}

#hlsVideoPlayer { /* Zmieniono ID, aby uniknąć konfliktu z globalną zmienną 'video' */
  width: 100%;
  height: 100%;
  object-fit: contain; /* Zachowaj proporcje, dopasuj do kontenera */
}

video::-webkit-media-controls-fullscreen-button {
  display: none;
}

#hlsVideoPlayer::-webkit-media-controls-fullscreen-button {
  display: none;
}

.poster-container { /* Kontener dla postera i przycisku play */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer; /* Kliknięcie na poster też może uruchomić */
}

#posterImage {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Zachowaj proporcje, dopasuj do kontenera */
}

.play-overlay-button { /* Zmieniono nazwę klasy, aby była bardziej jednoznaczna */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background-color: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.3s, opacity 0.3s;
  z-index: 10;
  opacity: 1;
}

.play-overlay-button:hover {
  background-color: rgba(0, 0, 0, 0.9);
}

.play-overlay-button svg {
  width: 40px;
  height: 40px;
  fill: #fff;
}

.play-overlay-button.hidden {
  opacity: 0;
  pointer-events: none; /* Aby nie przechwytywał kliknięć, gdy ukryty */
}

.error-message-container { /* Kontener na komunikaty błędów */
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    background-color: rgba(200, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    z-index: 20;
    display: none; /* Początkowo ukryty */
}

.spinner circle {
  stroke-linecap: round;
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border: 5px solid rgba(255, 255, 255, 0.35);
  border-top: 5px solid #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 15;
}

.loading-spinner.hidden {
  display: none;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.sponsor-overlay {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 12;
  display: block;
  padding: 0;
  margin: 0;
  line-height: 0;
  font-size: 0;
  text-decoration: none;
}

.sponsor-overlay.hidden {
  display: none;
}

#sponsorOverlayImage {
  display: block;
  width: clamp(50px, 15vw, 200px);
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.65));
}

@media (max-width: 768px) {
  .sponsor-overlay {
    top: 10px;
    right: 10px;
  }

  #sponsorOverlayImage {
    width: clamp(50px, 15vw, 150px);
  }
}

.fullscreen-toggle-button {
  position: absolute;
  bottom: 64px;
  right: 16px;
  z-index: 13;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-toggle-button:hover {
  background: rgba(0, 0, 0, 0.82);
}

.fullscreen-toggle-button:focus {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .fullscreen-toggle-button {
    right: 10px;
    bottom: 58px;
    width: 40px;
    height: 40px;
    font-size: 22px;
  }
}