body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f0f2f5; 
    color: #333;
    overflow: hidden; 
}

h1 {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 15px; 
    color: #2c3e50;
    font-size: 2.2em;
    font-weight: 600;
}

#controls-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 15px 0; 
}

#displayModeToggle {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 400;
    color: white;
    background-color: #5DADE2; 
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#displayModeToggle:hover {
    background-color: #3498DB;
    transform: translateY(-1px);
}

#displayModeToggle:active {
    transform: translateY(0px);
    background-color: #2C81B8;
}


#palette {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    background-color: #e9ecef; 
    border-bottom: 1px solid #d1d5da;
    min-height: 70px; 
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) inset; 
    overflow-y: auto; 
    max-height: 160px; 
}

#workspace {
    flex-grow: 1;
    position: relative; 
    background-color: #ffffff;
    background-image: linear-gradient(45deg, #f9f9f9 25%, transparent 25%), 
                      linear-gradient(-45deg, #f9f9f9 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #f9f9f9 75%),
                      linear-gradient(-45deg, transparent 75%, #f9f9f9 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    overflow: auto; 
    border-top: 1px solid #d1d5da;
}

.color-item {
    width: 65px; 
    height: 65px;
    border: none; 
    border-radius: 12px; 
    margin: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 10px; 
    font-weight: 400;
    color: white; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); 
    cursor: grab;
    user-select: none; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, opacity 0.2s ease;
    box-sizing: border-box;
    position: relative; 
}

.color-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
}

.color-item:active {
    cursor: grabbing;
    transform: scale(1.08); 
    box-shadow: 0 8px 16px rgba(0,0,0,0.2), 0 3px 6px rgba(0,0,0,0.12);
    z-index: 1000; 
}

.color-item.is-dragging {
    opacity: 0.6;
    box-shadow: 0px 10px 25px rgba(0,0,0,0.25);
    transform: scale(1.05);
}


/* Specific styling for workspace items */
#workspace .color-item {
    
}

/* Helper class to adjust text color for light backgrounds */
.color-item.light-bg-text {
    color: #222; 
    text-shadow: 0 1px 1px rgba(255,255,255,0.6); 
}


/* Animations */
@keyframes paletteItemAppear {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.palette-item-appear {
    animation: paletteItemAppear 0.4s ease-out forwards;
}

@keyframes mixedColorAppear {
    from {
        opacity: 0;
        transform: scale(0.7) rotate(-10deg) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg) translateY(0px);
    }
}

.mixed-color-appear {
    animation: mixedColorAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; 
}