dialog.ytp-popupmanager[open] {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    width: max-content;
    height: max-content;
    max-width: min(54rem, calc(100% - 2rem));
    max-height: calc(100% - 2rem);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: .75rem;
    background: #fff;
    color: #161616;
    box-shadow: 0 1rem 4rem rgb(0 0 0 / .35);
    overflow: auto;
}

.ytp-popupmanager::backdrop {
    background: rgb(0 0 0 / .68);
}

.ytp-popupmanager__panel {
    display: grid;
    justify-items: center;
    position: relative;
    padding: .75rem;
}

.ytp-popupmanager img,
.ytp-popupmanager video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 75vh;
    max-height: min(75dvh, calc(100dvh - 7rem));
    object-fit: contain;
    border-radius: .35rem;
}

.ytp-popupmanager video {
    width: 48rem;
    background: #000;
}

.ytp-popupmanager__close {
    position: absolute;
    z-index: 1;
    top: 1rem;
    right: 1rem;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #181818;
    color: #fff;
    font: 1.75rem/1 system-ui, sans-serif;
    cursor: pointer;
}

.ytp-popupmanager__link {
    margin-top: .75rem;
}

.ytp-popupmanager :focus-visible {
    outline: 2px solid #215ad0;
    outline-offset: 2px;
}

html:has(.ytp-popupmanager[open]) {
    overflow: hidden;
}
