:root {
    --primary-color: #005a8d;
    --secondary-color: #ffc107;
    --light-color: #f0f8ff;
    --dark-color: #333;
    --board-size: 500px;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
    text-align: center;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

p {
    margin-top: 0;
    margin-bottom: 1.5rem;
    max-width: 90vw;
}

#game-container {
    padding: 10px;
    background-color: var(--primary-color);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#game-board {
    display: grid;
    border: 2px solid #fff;
    width: 90vw;
    height: 90vw;
    max-width: var(--board-size);
    max-height: var(--board-size);
    background-color: #fff;
}

.puzzle-piece {
    background-image: url('puzzle-image.png');
    border: 1px solid rgba(0, 60, 94, 0.5);
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.puzzle-piece:hover {
    filter: brightness(1.1);
}

.puzzle-piece:active {
    transform: scale(0.95);
}

#puzzle-selection {
    width: 100%;
    max-width: 600px;
    margin-top: 2rem;
}

#thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 1rem;
    padding: 10px;
    background-color: rgba(0, 90, 141, 0.1);
    border-radius: 10px;
}

.thumbnail-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.thumbnail-image:hover {
    transform: scale(1.05);
}

.thumbnail-image.selected {
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
}

#win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

#win-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

#win-message {
    background-color: white;
    color: var(--dark-color);
    padding: 2em;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    transform: scale(0.7);
    transition: transform 0.3s ease-in-out;
}

#win-overlay:not(.hidden) #win-message {
    transform: scale(1);
}

.hidden {
    display: none;
}

button {
    margin-top: 20px;
    padding: 12px 25px;
    font-size: 1.1em;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    background-color: var(--secondary-color);
    border: none;
    border-radius: 8px;
    color: var(--dark-color);
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: background-color 0.2s, transform 0.2s;
}

button:hover {
    background-color: #ffa000;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
}