.video-widget {
  position: fixed;
  top: 70px;        /* clear Quarto's navbar (~56px) + small gap */
  right: 24px;
  width: 340px;
  z-index: 1050;    /* above Bootstrap's z-index stack */
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.video-widget iframe,
.video-widget video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}

/* Push main content left so video doesn't overlap text */
body {
  padding-right: 380px !important;
}

/* Collapse button */
.video-toggle-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
  z-index: 1000;
}

.video-widget.collapsed iframe,
.video-widget.collapsed video {
  display: none;
}

.video-widget.collapsed {
  width: auto;
}

@media (max-width: 900px) {
  .video-widget {
    position: static;
    width: 100%;
    margin-bottom: 1.5rem;
    overflow: visible;
  }
  body {
    padding-right: unset !important;
  }
}

.video-widget video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px; /* re-add since overflow:visible no longer clips it */
}

/* Allow fullscreen to break out of the widget */
.video-widget video:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.video-widget video:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}