/* Модальное окно письма */
.letter-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.letter-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.letter-modal {
    position: relative;
    width: 90%;
    max-width: 600px;
    min-height: 70vh;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
    border-radius: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 40px;
    transform: translateY(100%);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 85vh;
    overflow-y: auto;
    margin-bottom: 0;
}

.letter-modal-overlay.active .letter-modal {
    transform: translateY(0);
}

.letter-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #ff6b81;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    line-height: 1;
    padding: 5px;
}

.letter-modal-close:hover {
    color: #ff4757;
    transform: scale(1.2);
}

.letter-modal-content h1 {
    font-family: 'Pacifico', cursive;
    color: #ff6b81;
    font-size: 2rem;
    margin: 0 0 10px 0;
}

.letter-modal-content p {
    color: #555;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0 0 20px 0;
}

.letter-modal-content span {
    background: linear-gradient(45deg, #fd6485 0%, #fad0c4 99%, #fad0c4 100%);
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    font-style: italic;
    text-shadow: 0px 0px 20px rgba(255, 96, 101, 0.3);
    letter-spacing: 0.5px;
}

/* Блок диалога */
.dialogue-box {
    border-left: 4px solid #ff9a9e;
    padding: 5px 5px;
    margin: 15px 0;
}

.line {
    margin-bottom: 10px;
    position: relative;
}

.line:last-child {
    margin-bottom: 0;
}

/* Имена говорящих (Д и П) */
.speaker {
    font-weight: bold;
    color: #d67f8c;
    /* Нежный розово-красный */
    font-family: sans-serif;
    /* Контраст со основным текстом */
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Адаптивность для мобильных */
@media (max-width: 450px) {
    .letter-modal {
        width: 95%;
        min-height: 60vh;
        padding: 25px;
    }

    .letter-modal-content h1 {
        font-size: 2rem;
    }

    .letter-modal-content p {
        font-size: 1.1rem;
    }

    .letter-modal-close {
        font-size: 2rem;
        top: 10px;
        right: 15px;
    }
}