.container {
    text-align: center;
    margin: 20px auto;
    max-width: 500px;
    padding: 10px;
}

#board {
    display: grid;
    grid-template-columns: repeat(4, minmax(60px, 100px));
    grid-template-rows: repeat(3, minmax(60px, 100px));
    gap: 4px;
    background: #333;
    padding: 4px;
    margin: 20px auto;
    border-radius: 8px;
    width: fit-content;
    transition: all 0.2s;
}

.tile {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
    border-radius: 4px;
    user-select: none;
    transition: transform 0.1s;
    background-color: #4a90e2; /* Fallback color */
    background-repeat: no-repeat;
    border: 2px solid #fff;
    box-sizing: border-box;
    overflow: hidden;
}

.tile.has-image {
    background-image: url('./puzzle.jpg'); /* Ensure the path is correct */
    background-size: 400px 300px;
}

.tile:active {
    transform: scale(0.95);
}

.tile::after {
    content: attr(data-value);
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    opacity: 0.8;
}

.empty::after {
    display: none;
}

.empty {
    background-image: none !important;
    background-color: transparent;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.complete-state .empty {
    background-image: url('./puzzle.jpg') !important;
    background-color: transparent;
    border: 2px solid #fff;
    opacity: 1;
}

.complete-state .tile::after {
    display: none;
}

button {
    padding: 10px 20px;
    font-size: 1.2em;
    margin: 10px;
    cursor: pointer;
}

#startGame {
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.2s;
}

#startGame:hover {
    background-color: #27ae60;
}

.timer {
    font-size: 1.5em;
    margin: 10px;
    color: #333;
    font-weight: bold;
}

.game-over .timer {
    color: #e74c3c;
}

@media (max-width: 480px) {
    #board {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(3, 1fr);
        width: 95vw;
        height: 71.25vw;
        max-width: 350px;
        max-height: 300px;
    }

    .tile::after {
        font-size: 8px;
        padding: 1px 3px;
    }
}
