/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
    flex-direction: column;
}

/* Контейнер для всего контента */
.container {
    width: 80%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* Стиль для хедера */
header {
    background-color: #4CAF50;
    color: white;
    padding: 20px 0;
    width: 100%;
    text-align: center; /* Центрируем текст в хедере */
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Описание игры */
.game-description {
    margin-top: 20px;
    padding: 10px 20px;
    border-radius: 8px;
    background-color: #4CAF50;
    border: 1px solid #388E3C;
    color: #fff;
    font-size: 1.1rem;
    line-height: 1.5;
    max-width: 600px;
    width: 100%;
    text-align: center; /* Центрируем текст в описании */
}

/* Стили для игрового поля */
.game-board, #gameCanvas {
    margin: 20px auto;
    display: block;
    background-color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 2px solid #ddd;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    grid-template-rows: repeat(3, 100px);
    gap: 10px;
    justify-content: center;
    margin: 0 auto;
}

.cell {
    width: 100px;
    height: 100px;
    border: 2px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: pointer;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.cell:hover {
    background-color: #f1f1f1;
}

/* Канвас Змейки */
#gameCanvas {
    background-color: #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    margin-top: 20px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

/* Кнопки */
button, .back-btn {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1.1rem;
    text-decoration: none;
    margin-top: 20px;
    display: inline-block;
    transition: background-color 0.3s ease;
}

button:hover, .back-btn:hover {
    background-color: #45a049;
}

/* Адаптация для мобильных устройств */
@media screen and (max-width: 768px) {
    .game-board {
        grid-template-columns: repeat(3, 80px);
        grid-template-rows: repeat(3, 80px);
    }

    #gameCanvas {
        width: 250px;
        height: 250px;
    }
}
