* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #2c3e50;
}

section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#intro p {
    margin-bottom: 20px;
    font-size: 18px;
}

#intro button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#intro button:hover {
    background-color: #2980b9;
}

.pieces-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.pieces-container .piece {
    width: 80px;
    height: 60px;
    cursor: grab;
    flex-shrink: 0;
}

.piece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    margin: 30px 0;
    aspect-ratio: 3/4;
    width: 100%;
    max-width: 600px;
    margin: 30px auto;
}

.grid-item {
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    background-color: #f9f9f9;
    cursor: grab;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.grid-item img,
.grid-item .piece,
.grid-item .piece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grid-item.error {
    border-color: #e74c3c;
    background-color: #fdedec;
}

.grid-item .piece {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.grid-item .piece img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    margin: 0 10px;
    font-size: 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(4, 1fr);
    }
    .piece img {
        max-width: 60px;
        max-height: 60px;
    }
}