* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: #000;
    color: #fff;
    height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Фон сцены */
#background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#background-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.8s ease;
}

/* ЕДИНЫЙ контейнер для всей сцены */
#scene-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

/* Контейнер для диалогов И выбора - всё вместе */
#dialogs-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

/* Стили для скроллбара */
#dialogs-container::-webkit-scrollbar {
    width: 8px;
}

#dialogs-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#dialogs-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

#dialogs-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Блоки диалогов */
.dialog-block {
    margin-bottom: 20px;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeInUp 0.5s ease;
    opacity: 0;
    transform: translateY(10px);
    animation-fill-mode: forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Задержки для последовательного появления */
.dialog-block:nth-child(1) { animation-delay: 0.1s; }
.dialog-block:nth-child(2) { animation-delay: 0.2s; }
.dialog-block:nth-child(3) { animation-delay: 0.3s; }
.dialog-block:nth-child(4) { animation-delay: 0.4s; }

/* Блок с аватаркой */
.dialog-with-avatar {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.avatar-container {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dialog-content {
    flex: 1;
}

/* Имя персонажа */
.character-name {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Цвета для разных типов диалогов */
.narrator .character-name {
    color: #95a5a6;
}

.world-change .character-name {
    color: #e74c3c;
}

.player .character-name {
    color: #2ecc71;
}

/* Текст диалога */
.dialog-text {
    font-size: 1.2em;
    min-height: 24px;
    white-space: pre-wrap;
}

/* Анимация печати текста */
.typing {
    display: inline-block;
}

.typing::after {
    content: '|';
    animation: blink 1s infinite;
    color: #3498db;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* БЛОК ВЫБОРА - теперь внутри dialogs-container */
.choice-block {
    margin-top: 20px;
    padding: 20px;
    border: 2px solid rgba(52, 152, 219, 0.5);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    animation: fadeInUp 0.5s ease;
    animation-delay: 0.2s;
    opacity: 0;
    animation-fill-mode: forwards;
}

.choice-question {
    margin-bottom: 20px;
    font-size: 1.3em;
    color: #3498db;
    text-align: center;
    font-weight: bold;
}

.choice-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-btn {
    padding: 16px;
    font-size: 1.1em;
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid #3498db;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    font-family: inherit;
}

.choice-btn:hover {
    background: rgba(52, 152, 219, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.choice-btn:active {
    transform: translateY(0);
}

/* Остальные стили (loading, error) остаются без изменений */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2em;
    color: #3498db;
}

#error-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.hidden {
    display: none !important;
}

.error-card {
    background: rgba(44, 62, 80, 0.95);
    padding: 40px;
    border-radius: 12px;
    border: 2px solid #e74c3c;
    max-width: 500px;
    text-align: center;
}

/* Адаптивность */
@media (max-width: 768px) {
    #dialogs-container {
        padding: 15px;
    }

    .dialog-block {
        padding: 12px;
        margin-bottom: 15px;
    }

    .choice-block {
        padding: 15px;
    }

    .choice-btn {
        padding: 14px;
        font-size: 1em;
    }

    .dialog-with-avatar {
        gap: 10px;
    }

    .avatar-container {
        width: 48px;
        height: 48px;
    }
}

@media (max-width: 480px) {
    #dialogs-container {
        padding: 10px;
    }

    .dialog-text {
        font-size: 1.1em;
    }

    .choice-btn {
        padding: 12px;
    }
}
