:root {
    --bg-color: #eef7ff; /* Very light blue background */
    --pattern-color: rgba(0, 123, 255, 0.05); /* Light blue for pattern */
    --container-bg: #ffffff;
    --puzzle-bg: #cce7ff; /* Light blue for puzzle area */
    --tile-bg: #6bb7ff; /* Medium blue for tiles */
    --tile-hover-bg: #4da3ff; /* Slightly darker blue on hover */
    --text-color: #333;
    --header-color: #0056b3; /* Dark blue for header */
    --accent-color: #17a2b8; /* Teal accent for messages */
    --border-radius-main: 15px;
    --border-radius-tile: 8px;
    --shadow: 0 10px 20px rgba(0,0,0,0.45), 0 6px 6px rgba(0,0,0,0.1);
}

body {
    font-family: 'Poppins', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: var(--bg-color);
    /* Subtle diagonal line pattern */
    background-image: linear-gradient(45deg, var(--pattern-color) 25%, transparent 25%, transparent 75%, var(--pattern-color) 75%, var(--pattern-color)),
                      linear-gradient(45deg, var(--pattern-color) 25%, transparent 25%, transparent 75%, var(--pattern-color) 75%, var(--pattern-color));
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: var(--text-color);
}

.game-container {
    background: var(--container-bg);
    padding: 2rem 2.5rem;
    border-radius: var(--border-radius-main);
    box-shadow: var(--shadow);
    text-align: center;
    /* position: relative; Removed as picker is now outside */
}

.color-picker-container {
    position: fixed; /* Changed to fixed for viewport positioning */
    top: 1rem;       /* Adjusted position */
    right: 1rem;      /* Adjusted position */
    z-index: 100;     /* Ensure it's above other content */
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.8); /* Slightly transparent background */
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.color-picker-container label {
    margin-right: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: 600;
}

#colorPicker {
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%; /* Make it circular */
    cursor: pointer;
    padding: 0; /* Remove default padding */
    background-color: transparent; /* Remove default background */
    overflow: hidden; /* Hide default browser styles */
}
/* Style the color picker's inner swatch */
#colorPicker::-webkit-color-swatch-wrapper {
    padding: 0;
}
#colorPicker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}
#colorPicker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}


h1 {
    color: var(--header-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05); /* Subtle text shadow */
    font-family: cursive;
}

.puzzle-container {
    position: relative;
    background: var(--puzzle-bg);
    border-radius: var(--border-radius-tile);
    margin: 20px auto; /* Center puzzle container */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.puzzle-tile {
    position: absolute;
    background: var(--tile-bg);
    border: none; /* Remove default border */
    border-radius: var(--border-radius-tile);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem; /* Slightly larger font */
    font-weight: 600;
    color: #fff; /* White text on tiles */
    text-shadow: 1px 1px 1px rgba(0,0,0,0.1); /* Subtle text shadow on numbers */
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy transition */
    box-shadow: 0 3px 8px rgba(0,0,0,0.12); /* Slightly stronger shadow */
}

.puzzle-tile:hover {
    background: var(--tile-hover-bg);
    transform: scale(1.05); /* Slight scale on hover */
    z-index: 10; /* Bring hovered tile to front */
}

.puzzle-tile.empty {
    background: transparent;
    box-shadow: none;
    cursor: default;
    z-index: 1;
}

.puzzle-tile.empty:hover {
    transform: none; /* No scale effect for empty tile */
}


.game-info {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    color: var(--text-color);
}

.congrats-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.congrats-content {
    background: var(--container-bg);
    padding: 2rem 3rem;
    border-radius: var(--border-radius-main);
    text-align: center;
    box-shadow: var(--shadow);
    transform: scale(0.9);
    animation: slideUp 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
}

.congrats-content h2 {
    color: var(--header-color);
    margin-bottom: 1rem;
}

.congrats-moves {
    font-weight: 600;
    color: var(--accent-color);
}

.continue-btn {
    background: var(--tile-bg);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.continue-btn:hover {
    background: var(--tile-hover-bg);
    transform: scale(1.05);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#message {
    color: var(--accent-color); /* Use accent color for messages */
    font-weight: 600;
    margin-top: 0.8rem;
    height: 1.5em;
    min-height: 1.5em; /* Ensure space is reserved */
}
