#video-background {
  width: 100%;
  height: 100svh;
  height: 100vh;
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
  z-index: -1;
}
 
#video-background iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  width: 177.77777778vh;
  height: 56.25vw;
  min-height: 100%;
  min-width: 100%;
  z-index: -2;
}
 
.content {
  position: relative;
  z-index: 1;
  color: white;
  text-align: center;
}

/*背景に配置した動画がクリックを邪魔する対策*/
#player iframe {
  pointer-events: none;
}

/*YouTubeのUIが一瞬だけ表示される*/
  #video-background {
  background-color: #000;
  background-image: url("fallback.jpg");
  background-size: cover;
}

#video-background {
  opacity: 0;
  transition: opacity 0.5s ease;
}
#video-background.playing {
  opacity: 1;
}

/*画面サイズに合わせて調整*/
#video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: -1;
}
 
#player iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw; /* 16:9比率を維持 */
  min-height: 100vh;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/*代替画像の表示*/
@media (max-width: 768px) {
  #video-background {
    display: none;
  }
 
  body {
    background-image: url("fallback.jpg");
    background-size: cover;
    background-position: center;
  }
}