/* Only dialog positioning changes; page layout and modal artwork keep their styles. */
.modal.site-responsive-modal {
    --site-modal-width: 350px;
    --site-modal-gap: 16px;
    --site-modal-edge-y: max(var(--site-modal-gap), env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px));
    --site-modal-edge-x: max(var(--site-modal-gap), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    position: fixed;
    top: var(--site-modal-top, 0px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    width: 100% !important;
    height: 100%;
    height: var(--site-modal-height, 100dvh);
    padding: 0 !important;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.site-responsive-modal > .site-modal-stage {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    width: 100%;
    padding: var(--site-modal-gap);
    padding-top: var(--site-modal-edge-y);
    padding-bottom: var(--site-modal-edge-y);
    padding-left: var(--site-modal-edge-x);
    padding-right: var(--site-modal-edge-x);
    pointer-events: none;
}

.site-modal-stage > .site-modal-frame {
    position: relative;
    flex: 0 0 auto;
    margin: auto;
    pointer-events: none;
}

.site-modal-frame-with-close {
    padding-top: 52px;
}

.site-modal-frame > .site-modal-slot {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
}

.site-modal-canvas {
    position: relative;
    overflow: hidden;
    pointer-events: none;
}

.site-responsive-modal .site-modal-canvas > .modal-dialog {
    box-sizing: border-box;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    width: var(--site-modal-width);
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    max-width: none !important;
    transform-origin: top left !important;
    transition: none !important;
    pointer-events: none;
}

.site-modal-canvas > .modal-dialog > * {
    pointer-events: auto;
}

.site-responsive-modal .site-modal-media > img,
.site-responsive-modal .site-modal-media > video {
    position: static !important;
    display: block;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    transform: none !important;
}

/* Long dialogs scroll at the overlay; no page-specific vertical spacer. */
.site-responsive-modal .modal-body-scroll {
    margin-top: 0 !important;
}

/* Single source for icon close positioning; page-level img-close rules are removed. */
.site-responsive-modal .site-modal-close {
    position: absolute;
    top: 0;
    right: var(--site-close-right, 0px);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #242039;
    color: #fff;
    font: 32px/1 sans-serif;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    z-index: 10;
    pointer-events: auto;
}

.site-responsive-modal .site-modal-close:focus-visible {
    outline: 2px solid #f7e88c;
    outline-offset: 2px;
}

.site-responsive-modal .site-modal-close-icon {
    position: static;
    display: block;
    width: 20px;
    height: 20px;
    margin: 0;
    object-fit: contain;
}

/* Dice animations cover the viewport without modal margins or scaling. */
.modal.dice-roll-fullscreen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0 !important;
    overflow: hidden;
}

.modal.dice-roll-fullscreen .modal-dialog,
.modal.dice-roll-fullscreen .modal-content {
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none !important;
}

.modal.dice-roll-fullscreen .video-roll-dice {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    object-fit: cover;
    object-position: center;
}

