/* 1. РЕГИСТРИРУЕМ ОБА КАСТОМНЫХ ШРИФТА */
@font-face {
    font-family: 'Mephisto';
    src: url('fonts/mephisto.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Izvod';
    src: url('fonts/izvod.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* ОСНОВНОЙ КОНТЕЙНЕР */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    touch-action: pan-y;
    overflow: hidden; /* Чтобы избежать лишних полос прокрутки */
    background-color: #120e0c;
    background-image: url('https://www.transparenttextures.com/patterns/dark-wood.png');
    font-family: 'Eb Garamond', serif;
}

/* Главный оберточный блок для центрирования книги и кнопок */
.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 20px 0;
    box-sizing: border-box;
}

.book-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Настройки страниц с текстурой СТАРОГО ПЕРГАМЕНТА */
.page {
    background-color: #f2e6ce;
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    box-shadow: inset 0 0 20px rgba(0,0,0,0.2);
    overflow: hidden; 
}

.page-content {
    padding: 30px 40px;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

.page-content::-webkit-scrollbar { width: 0px; }

/* ОБЛОЖКА */
.cover-front, .cover-back {
    background-color: #3d1616;
    background-image: url('https://www.transparenttextures.com/patterns/dark-leather.png');
    border: 4px solid #1a0808;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.7), 5px 5px 15px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.inside-cover {
    background-color: #c4b597;
    background-image: url('https://www.transparenttextures.com/patterns/lined-paper-2.png');
    box-shadow: inset 0 0 20px rgba(0,0,0,0.4);
}

.cover-title {
    color: #dfb76c;
    font-family: 'Mephisto', serif;
    font-size: 3.5rem;
    text-align: center;
    letter-spacing: 2px;
    line-height: 1.2;
    text-shadow: -1px -1px 1px rgba(255,255,255,0.2), 1px 1px 1px rgba(0,0,0,0.8), 2px 2px 5px rgba(0,0,0,0.6);
}

h2 {
    font-family: 'Mephisto', serif;
    font-size: 2rem;
    color: #2b1f16;
    margin: 0 0 20px 0;
    border-bottom: 2px solid #5c4331;
    letter-spacing: 1px;
}

button {
    background: #4a3325;
    background-image: url('https://www.transparenttextures.com/patterns/dark-leather.png');
    color: #f2e6ce;
    border: 1px solid #2b1f16;
    padding: 10px 20px;
    font-family: 'Mephisto', serif;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: 0.2s;
    letter-spacing: 1px;
}

button:hover { 
    background-color: #5c4331;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.lined-paper {
    background: transparent;
    background-image: repeating-linear-gradient(transparent, transparent 39px, rgba(140, 110, 80, 0.25) 39px, rgba(140, 110, 80, 0.25) 40px);
    line-height: 40px;
    padding-top: 4px;
    border: none;
    width: 100%;
    height: 200px; 
    resize: none;
    font-family: 'Izvod', serif;
    font-size: 1.8rem;
    color: #1f160e;
    outline: none;
}

.auth-box {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.secret-input {
    background: transparent;
    border: none;
    border-bottom: 1px dashed #5c4331;
    font-family: 'Eb Garamond', serif;
    font-size: 1.2rem;
    padding: 5px;
    width: 150px;
    outline: none;
    color: #1f160e;
}

/* ЛЕНТА ИСТОРИИ */
.phrase-item {
    margin-bottom: 25px;
    border-bottom: 1px dotted rgba(92, 67, 49, 0.3);
    padding-bottom: 15px;
}

.phrase-text {
    font-family: 'Izvod', serif;
    font-size: 1.8rem; 
    margin: 0;
    color: #1f160e;
    line-height: 1.4;
    letter-spacing: 0.5px;
}

.phrase-meta {
    font-size: 0.85rem;
    color: #6e5441;
    text-align: right;
    margin-top: 5px;
    font-family: 'Eb Garamond', serif;
}

/* БЛОК УПРАВЛЕНИЯ ПОД КНИГОЙ */
.nav-controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 30px;
    width: 100%;
}

.nav-btn {
    background: #4a3325;
    color: #dfb76c;
    border: 2px solid #5c4331;
    padding: 10px 25px;
    font-family: 'Mephisto', serif;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s, background 0.2s;
    user-select: none;
}

.nav-btn:hover {
    background: #5c4331;
    transform: translateY(-2px);
}

.nav-btn:active {
    transform: translateY(0);
}

/* --- АДАПТАЦИЯ ДЛЯ СМАРТФОНОВ --- */
@media (max-width: 767px) {
    .page-content { padding: 25px 20px; }
    h2 { font-size: 1.6rem; margin-bottom: 15px; }

    .lined-paper {
        font-size: 1.4rem;
        line-height: 35px;
        background-image: repeating-linear-gradient(transparent, transparent 34px, rgba(140, 110, 80, 0.25) 34px, rgba(140, 110, 80, 0.25) 35px);
        height: 175px; 
    }

    .auth-box { flex-direction: column; gap: 12px; margin-top: 15px; }
    .secret-input { width: 100%; box-sizing: border-box; padding: 10px; background: rgba(0, 0, 0, 0.04); border: 1px solid rgba(92, 67, 49, 0.2); border-radius: 4px; }
    button { width: 100%; padding: 12px; font-size: 1.2rem; }
    .phrase-text { font-size: 1.4rem; line-height: 1.3; }
}