.rmf-wrapper { 
    position: relative; 
    margin: auto; 
    text-align: center;
}

.rmf-book { 
    width: 100%; 
    height: 100%; 
    overflow: visible; 
    cursor: pointer;
    transition: all 0.3s ease;
}

.rmf-book:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.rmf-loading { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100%; 
    font-size: 25px; 
    color: #666;
}

.rmf-error {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    height: 100%; 
    font-size: 20px; 
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    padding: 20px;
}

.rmf-page-container { 
    background: #fff; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rmf-page {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Стили для Turn.js */
.rmf-book .turn-page { 
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.rmf-book .turn-page:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* Контролы навигации */
.rmf-controls {
    position: absolute;
    left: 50%;
    bottom: 3%;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.rmf-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.rmf-btn:hover:not(:disabled) {
    background: #005a87;
    transform: translateY(-1px);
}

.rmf-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.rmf-page-info {
    font-size: 0.8em;
    color: #666;
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

.rmf-cover {
    flex: 1;
    max-width: 500px;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.rmf-cover:hover {
    transform: scale(1.05);
}

@media (max-width: 900px) {
    .rmf-layout {
        flex-direction: column;
        text-align: center;
    }
    .rmf-cover {
        max-width: 90%;
    }
}


/* ПОЛНОЭКРАННЫЙ РЕЖИМ */
.rmf-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.rmf-fullscreen-overlay.rmf-active {
    opacity: 1;
    visibility: visible;
}

.rmf-fullscreen-content {
    position: relative;
    width: 100vw;
    height: 85vh;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.rmf-fullscreen-book {
    width: 100vw !important;
    height: 100vh !important;
}

.rmf-fullscreen-book:hover {
    transform: none;
    box-shadow: none;
}

/* Скрываем контролы в полноэкранном режиме */
.rmf-fullscreen-controls {
    display: none;
}

.rmf-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;
}

.rmf-close-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

/* Невидимые зоны для навигации на мобильных */
.rmf-mobile-nav-zone {
    position: absolute;
    top: 0;
    width: 25%;
    height: 100%;
    z-index: 1002;
    cursor: pointer;
}

.rmf-mobile-nav-left {
    left: 0;
}

.rmf-mobile-nav-right {
    right: 0;
}

/* Индикаторы зон навигации для мобильных (показываются при первом касании) */
.rmf-mobile-nav-hint {
    position: absolute;
    top: 72%;
    transform: translateY(-50%);
    background: rgba(240, 235, 197, 0.5);
    color: #333;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 1;
    transition: opacity 0.3s ease;
    z-index: 1003;
    pointer-events: none;
}

.rmf-mobile-nav-hint.rmf-left {
    left: 20px;
}

.rmf-mobile-nav-hint.rmf-right {
    right: 20px;
}

.rmf-fullscreen-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(229, 233, 28, 0.9);
    color: #333;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0.8;
    z-index: 1001;
}

/* Индикатор клика для обычного режима */
.rmf-click-hint {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 124, 186, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0.8;
    z-index: 1000;
    pointer-events: none;
    animation: rmf-hint-pulse 2s ease-in-out infinite;
}

@keyframes rmf-hint-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Адаптивность */
@media (max-width: 768px) {
    .rmf-wrapper {
        margin: 10px;
    }
    
    .rmf-controls {
        position: relative;
        margin-top: 20px;
        transform: none;
        left: auto;
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .rmf-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .rmf-page-info {
        order: -1;
    }
    
    .rmf-fullscreen-content {
        width: 100vw;
        height: 100vh;
    }
    
    /* Убираем ненужные стили для мобильных контролов в полноэкранном режиме */
    .rmf-fullscreen-controls {
        display: none;
    }
    
    .rmf-close-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999; /* ← самое важное */
}

    
    .rmf-fullscreen-hint {
        display: none;
    }
    
    .rmf-click-hint {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px auto;
        display: inline-block;
    }
}

/* Анимации загрузки */
@keyframes rmf-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.rmf-loading {
    animation: rmf-pulse 1.5s ease-in-out infinite;
}

/* Дополнительные стили для плавности */
.rmf-book, .rmf-fullscreen-book {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Стили для предотвращения скролла в полноэкранном режиме */
body.rmf-fullscreen-active {
    overflow: hidden;
}

/* Оформление обложки */
.rmf-cover canvas {
    width: 100% !important;
    height: auto !important;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
    background: #fff;
}

/* Общий блок */
.rmf-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
    width: 80vw;
    height: 80vh;
    margin: 60px auto;
    padding: 30px;
    background: #fafafa;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* Текст */
.rmf-text {
    flex: 1;
    line-height: 1.1;
    color: #222;
}

.rmf-text p {
    font-size: 1.5vw;
    margin: 6%;
}

/* Обложка */
.rmf-cover {
    flex: 1;
    max-width: 450px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.rmf-cover:hover {
    transform: scale(1.03);
}

/* Для мобильных */
@media (max-width: 1000px) {
    .rmf-layout {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    .rmf-text{
        width: 100%;
    }
    .rmf-cover {
        max-width: 85%;
    }
    .rmf-text p{
        font-size: 2.8vw;
    }
}