* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Запрещаем скролл всей страницы */
    background: linear-gradient(135deg, #1a1c29, #2b2e4a);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Главный оберточный контейнер */
.main-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    max-width: 960px;
    height: 90vh;
    max-height: 680px;
    padding: 0 15px;
}

/* ==========================================
   ЛЕВАЯ ПАНЕЛЬ (Кнопки + Питомец)
   ========================================== */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

/* Блок кнопок и показателей */
.game-actions {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    text-align: center;
    flex: 1.2;
}

.game-actions h1 {
    font-size: 0.95rem;
    font-weight: 500;
    color: #e2e8f0;
}

.game-actions h1 span {
    color: #f6ad55;
    font-weight: 700;
}

.action-btn {
    width: 100%;
    max-width: 220px;
    padding: 9px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.action-btn:disabled {
    background: #334155 !important;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none !important;
    transform: none !important;
    opacity: 0.7;
}

#message {
    min-height: 20px;
    font-size: 0.85rem;
    color: #34d399;
    font-weight: 600;
}

.stats-row {
    display: flex;
    gap: 15px;
}

.stats-row h3 {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 500;
}

.stats-row h3 span {
    color: #38bdf8;
    font-weight: 700;
}

/* Блок питомца с баблом быстрой реакции */
.pet-section {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    flex: 1;
    overflow: hidden;
}

.speech-bubble {
    position: relative;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 0.85rem;
    color: #e2e8f0;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 8px;
    max-width: 90%;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(30, 41, 59, 0.9) transparent transparent transparent;
}

.pet-image {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
}


/* ==========================================
   ПРАВАЯ ПАНЕЛЬ (Чат / Диалог)
   ========================================== */
.right-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Заголовок чата (всегда сверху) */
.chat-header {
    text-align: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
}

.chat-header h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
}

/* Область сообщений со скроллом */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
}

/* Стилизация скроллбара чата */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Базовые стили сообщений */
.message {
    display: flex;
    width: 100%;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.35;
    word-break: break-word;
}

/* Сообщение питомца (Слева) */
.pet-msg {
    justify-content: flex-start;
}
.pet-msg .message-bubble {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 16px 16px 16px 4px;
}

/* Сообщение игрока (Справа) */
.user-msg {
    justify-content: flex-end;
}
.user-msg .message-bubble {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Поле ввода сообщения */
.chat-input-area {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-area input {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input-area input::placeholder {
    color: #64748b;
}

.chat-input-area input:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25);
}

/* Кнопка отправки */
.send-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border: none;
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.send-btn:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.send-btn:active {
    transform: translateY(1px);
}

.action-btn:disabled,
.action-btn.disabled {
    background: #334155 !important; /* Мягкий тёмно-серый цвет вместо фиолетового */
    color: #64748b;                /* Блеклый текст */
    cursor: not-allowed;           /* Курсор «Запрещено» */
    box-shadow: none;              /* Убираем объём и свечение */
    opacity: 0.7;                  /* Дополнительная визуальная неактивность */
    transform: none !important;    /* Отключаем сдвиги */
}

.action-btn:disabled:hover,
.action-btn:disabled:active,
.action-btn.disabled:hover,
.action-btn.disabled:active {
    background: #334155 !important;
    box-shadow: none !important;
    transform: none !important;
}

.typing-bubble { display: inline-flex; gap: 4px; align-items: center; }
.typing-bubble .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #888;
    animation: blink 1.2s infinite both;
}
.typing-bubble .dot:nth-child(2) { animation-delay: .2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
    0%, 80%, 100% { opacity: .2; }
    40% { opacity: 1; }
}


/* ==========================================
   Адаптивность под мобильные экраны
   ========================================== */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        padding: 15px;
    }

    .game-actions, 
    .dialog-main {
        width: 100%;
        max-width: 100%;
        min-height: auto;
    }
}