I am trying to add a window shadow to two elements, each with a variable width. My desired result is as follows:

I am trying to get this result with a pseudo-element that covers overlapping shadow shadows, but since they should have transparency, I cannot find a solution in which there are no small overlaps at the edges of the boxes or the pseudo-element is adjusted to the correct width. The top box also does not have to have a top border to solve my problem.
Fiddle
HTML:
<div>
<p></p>
</div>
<div>
<p></p>
</div>
SCSS:
div {
display: inline-block;
margin: 75px;
width: 200px;
height: 50px;
position: relative;
p {
position: absolute;
top: 100%;
left: 0;
height: 300px;
width: 250px;
}
&, p {
background: #ededed;
}
}
div:last-child p {
width: 150px
}
div {
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
p {
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}
}
Edit:
JS , , , script .
script , , dom , "" "" . , , . , , , .
JS , .
:
(JS),
, ( JS)
, , :

, , .
, .
- , , css, .