body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
}

header {
    background-color: #ADD8E6;
    width: 100%;
    padding: 20px 0;
    text-align: center;
    margin-bottom: 20px;
}

.home-link {
    color: white;
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.main-title {
    font-size: 2.5em;
    color: #3498db;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.popup-link {
    color: #2980b9;
    text-decoration: none;
    font-size: 16px;
}

.game-content {
    display: flex;
    gap: 20px;
    width: 700px; /* Увеличиваем общую ширину */
    height: 550px; /* Фиксированная высота, можно настроить */
}

.grid-container {
    border: 1px solid #ccc;
    padding: 10px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 450px; /* Фиксированная ширина, больше для сканворда */
    height: 450px; /* Чтобы бордер контейнера не распадался*/
}

#grid {
    display: grid;
    grid-template-columns: repeat(17, 1fr);
    grid-template-rows: repeat(17, 1fr);
    gap: 2px;
    width: 440px; /* Увеличиваем размер сетки */
    height: 440px; /* Увеличиваем размер сетки */
padding: 0px; /* Убираем отступы */
    margin: 0px; /* Убираем отступы */
}

.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    font-size: 16px; /* Больше шрифт */
    text-transform: uppercase;
    cursor: pointer;
    background-color: #eee;
    user-select: none;
}

.cell.selected {
    background-color: yellow;
    color: green;
}

.word-list {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 10px;
    width: 230px; /* Уменьшаем ширину списка слов */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: 450px;  /* Убираем высоту. */
}

.word-list ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    /* flex-direction: column;  Удаляем вертикальную организацию, она не нужна*/
    /*height: 430px;   Чтобы слово-лист не выходил за края. Больше не нужно */
}

.word-list li {
    width: calc(50% - 5px); /* Два слова в строке с небольшим отступом */
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;   /* Чтобы padding не увеличивал ширину */
    word-break: break-word; /* Разрываем длинные слова */
}

.word-list li:nth-child(odd) {
    border-right: 1px solid #eee;
    padding-right: 5px; /* Добавляем отступ справа для нечетных элементов */
}

.word-list li:nth-child(even) {
    padding-left: 5px;  /* Добавляем отступ слева для четных элементов */
}

.word-list li:last-child {
    border-bottom: none;
}

.word-list li.completed {
    text-decoration: line-through;
    color: #888;
}
#refreshButton, #restartButton {
    padding: 10px 20px;
    font-size: 16px;
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    margin-top: 20px;
}

#refreshButton:hover, #restartButton:hover {
    background-color: #2980b9;
}

footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 10px 0;
    width: 100%;
    margin-top: auto;
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.popup-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.close-button {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    color: #888;
}

.win-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 11;
    display: none;
}