.rm-no-scroll { overflow: hidden; }

.rm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.82);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    opacity: 0; visibility: hidden;
    transition: opacity .2s ease;
    padding: 20px;
}
.rm-overlay[aria-hidden="false"] { opacity: 1; visibility: visible; }

.rm-dialog {
    position: relative;
    background: #30273b;
    color: #f1f5f8;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    border: 1px solid #2c1a43;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rm-inner {
    padding: 28px 60px 24px;
    overflow-y: auto;
    color: #f1f5f8;
}

/* Кастомный скроллбар под тёмную тему */
.rm-inner::-webkit-scrollbar { width: 10px; }
.rm-inner::-webkit-scrollbar-track { background: #000000; }
.rm-inner::-webkit-scrollbar-thumb { background: #1f142d; border-radius: 5px; }
.rm-inner::-webkit-scrollbar-thumb:hover { background: #1f142d; }

.rm-title {
    margin: 0 40px 16px 0;
    font-size: 1.6rem;
    line-height: 1.2;
    color: #ffd633;
}

.rm-photo-wrap { text-align: center; margin-bottom: 18px; }
.rm-photo { max-width: 150px; max-height: 240px; height: auto; width: auto; }

.rm-content {
    font-size: 1rem;
    line-height: 1.55;
    color: #e6edf2;
}
.rm-content img { max-width: 100%; height: auto; }
.rm-content a { color: #ffd633; text-decoration: underline; }
.rm-content a:hover { color: #fff066; }
.rm-content h1, .rm-content h2, .rm-content h3,
.rm-content h4, .rm-content h5, .rm-content h6 { color: #ffd633; }
.rm-content strong { color: #27de27;}
.rm-content del { color: #0ff; text-decoration: none;}
.rm-content table { color: #e6edf2; }
.rm-content table th { background: #1f142d; color: #ffd633; }
.rm-content table td { border-color: #1f142d; }
.rm-content blockquote {
    border-left: 3px solid #ffd633;
    padding-left: 12px;
    color: #cfd8de;
}

.rm-link {
    display: inline-block;
    margin-top: 18px;
    font-weight: 600;
    text-decoration: none;
    color: #8fc1d5;
}
.rm-link:hover { color: #fff066; text-decoration: underline; }

.rm-error { color: #ff8a8a; }
.rm-error a { color: #ffd633; }

/* Кнопка закрытия */
.rm-close {
    position: absolute; top: 8px; right: 10px;
    background: transparent; border: 0;
    font-size: 32px; line-height: 1;
    cursor: pointer; color: #f1f5f8;
    width: 40px; height: 40px;
    z-index: 7;
    transition: color .15s ease;
}
.rm-close:hover { color: #ffd633; }

/* Навигация */
.rm-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,.45);
    color: #fff;
    border: 1px solid rgba(255,255,255,.2);
    width: 42px; height: 56px;
    font-size: 22px;
    cursor: pointer;
    z-index: 6;
    border-radius: 6px;
    transition: background .15s ease, color .15s ease;
}
.rm-nav:hover:not([disabled]) {
    background: #ffd633;
    color: #1f142d;
    border-color: #ffd633;
}
.rm-nav[disabled] { opacity: .25; cursor: default; }
.rm-prev { left: 8px; }
.rm-next { right: 8px; }

/* Loader */
.rm-loader {
    position: absolute; inset: 0;
    background: rgba(0, 50, 70, .75);
    display: none;
    align-items: center; justify-content: center;
    z-index: 5;
}
.rm-loader.is-active { display: flex; }
.rm-loader span {
    width: 42px; height: 42px;
    border: 4px solid rgba(255,255,255,.25);
    border-top-color: #ffd633;
    border-radius: 50%;
    animation: rm-spin .8s linear infinite;
}
@keyframes rm-spin { to { transform: rotate(360deg); } }

/* ---------- Мобильная версия: full-screen ---------- */
@media (max-width: 768px) {
    .rm-overlay { padding: 0; }
    .rm-dialog {
        max-width: 100%;
        max-height: 100%;
        height: 100vh;
        width: 100vw;
        border-radius: 0;
        border: 0;
    }
    .rm-inner { padding: 60px 18px 90px; }
    .rm-title { font-size: 1.3rem; margin-right: 50px; }

    .rm-prev, .rm-next {
        top: auto; bottom: 14px;
        transform: none;
        width: 56px; height: 48px;
        border-radius: 8px;
    }
    .rm-prev { left: 14px; }
    .rm-next { right: 14px; }

    .rm-close {
        top: 10px; right: 10px;
        width: 48px; height: 48px;
        font-size: 36px;
        background: rgba(255,255,255,.1);
        border-radius: 50%;
    }
}