#detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(255,255,255,.3);
    align-items: center;
    justify-content: center;
}
#detail-modal.open { display: flex; }
#detail-modal-outer {
    position: relative;
    line-height: 0;
    border: 8px solid #111;
    display: none;
}
#detail-modal:not(.loading) #detail-modal-outer {
    display: block;
}
#detail-modal.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: rgba(255,255,255,.8);
    border-radius: 50%;
    animation: dm-spin .7s linear infinite;
    pointer-events: none;
}
@keyframes dm-spin { to { transform: rotate(360deg); } }
#detail-modal-outer img {
    display: block;
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
}
#detail-modal-close {
    position: absolute;
    top: -16px;
    right: -16px;
    visibility: hidden;
    width: 30px;
    height: 30px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M15 5L5 15M5 5l10 10' stroke='%23333' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center/14px no-repeat;
    border: 1px solid #888;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    z-index: 1103;
}
#detail-modal-close:hover { background-color: #eee; }

#detail-modal-prev,
#detail-modal-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,.45);
    border: none;
    color: #fff;
    font-size: 22px;
    width: 35px;
    height: 60px;
    cursor: pointer;
    z-index: 1102;
    visibility: hidden;
    padding: 0;
}
#detail-modal-prev { left: 0; }
#detail-modal-next { right: 0; }
#detail-modal-prev:hover,
#detail-modal-next:hover { background: rgba(0,0,0,.7); }
