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

[data-inline-commentary][hidden],
[data-commentary-context-empty][hidden] {
    display: none !important;
}

.commentary-modal {
    position: fixed;
    inset: 0;
    z-index: 170;
    display: grid;
    place-items: center;
    padding: 24px;
}

.commentary-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 29, 49, .66);
    backdrop-filter: blur(5px);
}

.commentary-modal-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(780px, calc(100vw - 32px));
    max-height: min(84vh, 820px);
    overflow: hidden;
    border: 1px solid rgba(15, 47, 83, .16);
    border-radius: 22px;
    background: #fffdf8;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .34);
}

.commentary-modal-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 16px 18px;
    background: #0f2f53;
    color: #fff;
}

.commentary-modal-heading {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.commentary-modal-heading strong,
.commentary-modal-heading span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.commentary-modal-heading strong {
    font-size: 17px;
}

.commentary-modal-heading span {
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
}

.commentary-modal-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.commentary-modal-content {
    overflow: auto;
    padding: 22px;
    overscroll-behavior: contain;
}

.commentary-modal-content .commentary-loading {
    margin: 0;
}

body.commentary-modal-open {
    overflow: hidden;
}

body.commentary-modal-open .strong-tooltip,
body.commentary-modal-open .dictionary-floating-tooltip {
    z-index: 190;
}

.commentary-context-empty {
    margin: 4px 0 0;
    padding: 16px;
    border: 1px dashed #c9b85e;
    border-radius: 14px;
    background: #fffdf0;
    color: #52635b;
    font-size: 13px;
    line-height: 1.55;
    text-align: center;
}

@media (max-width: 760px) {
    .commentary-modal {
        align-items: end;
        padding: 10px;
    }

    .commentary-modal-dialog {
        width: 100%;
        max-height: 88vh;
        border-radius: 20px 20px 14px 14px;
    }

    .commentary-modal-header {
        padding: 14px 15px;
    }

    .commentary-modal-content {
        padding: 17px;
    }
}
