/* === Стили для визуальной новеллы === */
/* Главное изображение */
.novel-image {
    width: 100%;
    height: 40vh;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 10px;
    margin-bottom: 20px;
    min-height: 200px;
}

/* Контейнер текста */
.novel-text-container {
    position: relative;
    min-height: 120px;
    padding: 10px 0;
    overflow: hidden;
}

/* Скрытие сегментов */
.novel-segment.hidden {
    display: none;
}

/* Аватарка */
.avatar-container {
    float: left;
    width: 80px;
    height: 80px;
    margin: 40px 15px 5px 0;
    border-radius: 50%;
    overflow: hidden;
    top: 500px;
}

/* Стиль аватарки */
.avatar {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    outline: 1px solid red;
    display: block;
}

/* Текст новеллы */
.novel-text {
    font-size: 1.1em;
    color: #f0ece7;
    line-height: 1.6;
}

/* Обеспечить, чтобы сегмент содержал плавающие элементы */
.novel-segment {
    overflow: hidden;
    min-height: 1px;
    position: relative;
}

/* Кнопки навигации */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 15px;
    overflow: hidden;
}

/* Кнопка "Дальше"/"Назад" */
.novel-prev, .novel-next {
    background: transparent;
    border: none;
    color: #ff4500;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s ease;
}

/* Убираем текст из кнопок, используем псевдоэлемент для стрелки */
.novel-prev::before, .novel-next::before {
    content: "➤";
    display: block;
    font-size: 24px;
    color: #ff4500;
}

/* Поворот стрелки для "назад" */
.novel-prev::before {
    transform: rotate(180deg);
}

/* При наведении — только увеличение */
.novel-prev:hover, .novel-next:hover {
    transform: scale(1.2);
    overflow: hidden;
}

/* Скрытие кнопок */
.novel-prev.hidden,
.novel-next.hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Специфический стиль для первой части текста */
.novel-segment[data-index="0"] .navigation-buttons {
    justify-content: flex-end;
}

/* Кнопки выбора */
.flame-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    animation: fade-in 0.5s ease;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Специальные стили для 2 кнопок */
.flame-buttons.two-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

/* Специальные стили для 3+ кнопок */
.flame-buttons.multi-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

/* Стиль для кнопок в группах */
.flame-buttons.multi-buttons .flame-button {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
    margin: 5px;
    box-sizing: border-box;
}

/* Стиль огненных кнопок */
.flame-button {
    padding: 10px 20px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(135deg, #ff4500, #ff6300);
    color: white;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(255, 69, 0, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    margin: 5px;
    box-sizing: border-box;
    min-width: max-content;
    width: auto;
    text-align: center;
}

.flame-button:hover {
    background: linear-gradient(135deg, #ff6300, #ff8500);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(255, 69, 0, 0.4);
}

.flame-button:active {
    transform: translateY(0);
}

/* Анимации */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Добавляем стиль hidden */
.hidden {
    display: none !important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .novel-image {
        margin-bottom: 5px;
        height: 30vh;
    }

    .novel-text-container {
        padding: 5px 0;
    }

    .avatar-container {
        width: 60px;
        height: 60px;
        margin: 20px 10px 5px 0;
    }
    
    .novel-text {
        font-size: 1em;
    }
    
    .novel-prev, .novel-next {
        font-size: 20px;
    }
    
    .novel-prev::before, .novel-next::before {
        font-size: 20px;
    }
    
    .navigation-buttons {
        margin-top: 1px;
        margin-bottom: 8px;
    }

    .flame-buttons {
        margin-top: 10px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    /* Общие стили кнопок в мобильной версии */
    .flame-button {
        padding: 8px 16px;
        font-size: 0.9em;
        min-width: max-content;
        width: auto;
        flex: 1;
    }

    /* Стиль для одной кнопки */
    .flame-buttons.one-button .flame-button {
        min-width: max-content;
        width: auto;
        padding: 8px 20px;
    }

    /* Стиль для двух кнопок */
    .flame-buttons.two-buttons {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    .flame-buttons.two-buttons .flame-button {
        flex: 1;
        min-width: max-content;
    }

	/* Специальные стили для 3+ кнопок */
	.flame-buttons.multi-buttons {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
	}

	/* Стиль для кнопок в группах */
	.flame-buttons.multi-buttons .flame-button {
		flex: 1 1 auto;
		min-width: 150px;
		max-width: 300px;
		margin: 5px;
		box-sizing: border-box;
	}
}

/* НОВЫЕ СТИЛИ ДЛЯ ДЕСКТОПОВ И ПЛАНШЕТОВ */
@media (min-width: 769px) {
    /* Переопределение для 3+ кнопок */
    .flame-buttons.multi-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        width: 100%;
        justify-items: center;
		padding: 10px 0;
    }
    
    .flame-buttons.multi-buttons .flame-button {
        min-width: auto;
        width: 100%;
        max-width: 100%;
        margin: 0;
        justify-self: center;
		box-sizing: border-box;
    }
    
    /* Для центрирования одиночных кнопок в строках */
    .flame-buttons.multi-buttons::after {
        content: "";
        width: calc(50% - 10px);
    }
    
    /* Центрирование последней кнопки при нечетном количестве */
    .flame-buttons.multi-buttons .flame-button:last-child:nth-child(odd) {
        margin: 0 auto 15px; /* Центрирование по горизонтали */
        max-width: calc(50% - 20px);
		grid-column: 1 / -1;
        justify-self: center;
    }
}




/* Контейнер для шорткода */
.segment-shortcode {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 100, 0, 0.3);
    animation: fade-in 0.5s ease;
}

/* Адаптивность */
@media (max-width: 768px) {
    .segment-shortcode {
        margin: 15px 0;
        padding: 10px;
    }
}