/* === ОСНОВНЫЕ СТИЛИ (ДЕСКТОП) === */
body {
    margin: 0;
    padding: 0;
    background: url('https://ilchuk.info/images/fon20.jpg') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Segoe UI', 'Verdana', sans-serif;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.title-over-book {
    flex-shrink: 0;
    text-align: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 8px #1a3a1a;
    margin-bottom: 20px;
    font-family: 'Times New Roman', serif;
    letter-spacing: 2px;
    width: 100%;
}

#ap {
    width: 100%;
    max-width: 1200px;
    background: url('https://ilchuk.info/images/book0.gif') no-repeat center;
    background-size: contain;
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0;
    flex: 1;
    min-height: 0;
}

#ap .right-page {
    width: 45%;
    height: 55%;
    overflow-y: auto;
    margin-right: 1%;
    margin-top: 8%;
    background: transparent;
    border-radius: 12px;
    padding: 15px 20px;
}

#ap a {
    display: block;
    text-decoration: none;
    color: #1e3a1e;
    font-size: 1rem;
    line-height: 1.5;
    padding: 6px 0 6px 15px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}
#ap a:hover {
    color: #0a1a0a;
    border-left-color: #4a6741;
    background-color: rgba(74, 103, 65, 0.1);
    padding-left: 20px;
}

#nazad {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
}
#nazad button {
    background: #2e5e2e;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
}
#nazad button a {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
}

#footer {
    text-align: center;
    margin-top: 20px;
    color: #cdffb8;
    font-size: 0.8rem;
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    z-index: 0;
}

/* === МОБИЛЬНАЯ ВЕРСИЯ (ширина до 768px) === */
@media (max-width: 768px) {
    body {
        height: auto;
        overflow: auto;
        padding: 10px;
        display: block;
    }
    .book-container {
        height: auto;
        padding: 10px;
        display: block;
        
    overflow-x: hidden;   /* убираем горизонтальную прокрутку */

    }
    .title-over-book {
        font-size: 1.5rem;
        margin-top: 45px;
        margin-bottom: 10px;
        text-align: center;
    }
    #ap {
        background: rgba(255, 255, 255, 0.9) !important;
        background-image: none !important;
        height: auto;
        display: block;
        padding: 15px;
        box-shadow: none;
    }
  /*  #ap .right-page {
        width: 100% !important;
       margin-right: 1%;      
           margin-top: 8%;  
              max-height: 55vh;
        overflow-y: auto;
        padding: 10px;
    }*/
   #ap .right-page {
    width: calc(100% - 30px) !important;   /* ширина = 100% минус 30px (по 15px с каждой стороны) */
    margin: 0 auto !important;             /* центрируем */
    max-height: 55vh;
    overflow-y: auto;
    padding: 10px;
}      
    #ap a {
        font-size: 0.9rem;
        padding: 6px 0 6px 10px;
    }
    #nazad {
        position: fixed;
        top: 10px;
        left: 0;
        right: 0;
        text-align: center;
        z-index: 1000;
    }
    #nazad button {
        display: inline-block;
        margin: 0 auto;
        padding: 4px 12px;
        font-size: 0.8rem;
    }
    .book-container {
        padding-bottom: 5vh;
        
    }
}

@media (max-width: 768px) {
    /* ... другие стили ... */

    /* Принудительное размещение стрелок и текста в одну строку */
    #navig {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 2px !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        white-space: nowrap !important;
    }
    #navig a {
        display: inline-block !important;
        flex-shrink: 0 !important;
    }
    #navig a img {
        width: 25px !important;   /* уменьшаем стрелки */
        height: auto !important;
    }
    #navig font[size="5"] {
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        display: inline-block !important;
        padding: 0 2px !important;
    }
}

