.em-video-modal[hidden] { display: none !important; }

.em-video-modal {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  color: #f7f6f2;
  background: #080a09;
}

.em-video-modal__toolbar {
  z-index: 1;
  display: flex;
  width: min(100%, 1100px);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 14px;
}

.em-video-modal__hint {
  margin: 0;
  color: rgba(247, 246, 242, .8);
  font: 500 13px/1.4 Satoshi, Arial, sans-serif;
}

.em-video-modal__close {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(247, 246, 242, .42);
  border-radius: 999px;
  color: #f7f6f2;
  background: #202522;
  font: 600 14px/1 Satoshi, Arial, sans-serif;
  cursor: pointer;
}

.em-video-modal__close:focus-visible {
  outline: 3px solid #e4d8bd;
  outline-offset: 3px;
}

.em-video-modal__stage {
  position: relative;
  width: min(100%, 1100px);
  max-height: calc(100dvh - 92px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.em-video-modal__stage iframe,
.em-video-modal__stage video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  object-fit: contain;
}

.em-video-modal-open { overflow: hidden; }

@media (max-width: 900px) {
  .em-video-modal {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .em-video-modal__toolbar { padding-bottom: 12px; }
  .em-video-modal__hint { max-width: 55%; font-size: 12px; }
  .em-video-modal__stage {
    width: 100%;
    max-height: calc(100dvh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .em-video-modal__stage--portrait {
    width: min(100%, calc((100dvh - 100px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .5625));
    aspect-ratio: 9 / 16 !important;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .em-video-modal { grid-template-rows: 1fr; padding: 8px 62px; }
  .em-video-modal__toolbar { position: absolute; inset: 8px 8px auto; width: auto; padding: 0; }
  .em-video-modal__hint { display: none; }
  .em-video-modal__stage { max-height: calc(100dvh - 16px); }
}
