/* Сброс стилей и общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 20px 20px 0;
}

/* Общий контейнер для всех элементов игры */
.game-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Стили заголовка */
.header {
    padding: 20px;
    background-color: #2c3e50;
    color: white;
    text-align: center;
}

.header h1 {
    margin-bottom: 10px;
    font-size: 28px;
}

.header p {
    font-size: 16px;
    line-height: 1.4;
}

/* Стили для статистики */
.stats {
    padding: 15px;
    background-color: #3498db;
    color: white;
    display: flex;
    justify-content: space-around;
}

#moveCount, #fastestResult {
    text-transform: uppercase;
    font-size: 16px;
}

#moveCount span, #fastestResult span {
    font-size: 24px;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

/* Стили для игрового поля */
.game-wrapper {
    width: 100%;
    position: relative;
    padding-bottom: 100%; /* Создаем квадратный контейнер */
}

#board {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #34495e;
    overflow: hidden;
}

.tile {
    width: 33.33%;
    height: 33.33%;
    position: absolute;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #2c3e50;
    transform: translate(0, 0);
    transition: transform 0.3s ease;
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
}

/* Стили для предпросмотра и оверлея */
.preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #34495e;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    cursor: pointer;
}

.preview-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Стили для сообщений и кнопок */
.game-message {
    width: 100%;
    padding: 15px;
    background-color: rgba(46, 204, 113, 0.9);
    color: white;
    text-align: center;
    display: none;
}

.game-message p {
    font-size: 18px;
    margin-bottom: 10px;
}

.game-message button {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-message button:hover {
    background-color: #34495e;
}

/* Медиа-запросы для адаптивности */
@media (max-width: 640px) {
    body {
        padding: 10px 10px 0;
    }

    .game-container {
        width: 100%;
    }

    .header {
        padding: 10px;
    }

    .header h1 {
        font-size: 24px;
    }

    .header p {
        font-size: 14px;
    }

    .stats {
        padding: 10px;
    }

    #moveCount, #fastestResult {
        font-size: 14px;
    }

    #moveCount span, #fastestResult span {
        font-size: 20px;
    }

    .game-message {
        padding: 10px;
    }

    .game-message p {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .game-message button {
        font-size: 16px;
        padding: 8px 16px;
    }
}