:root {
    --bg-color-base: #050a0f; 
    --primary-neon: #00ffff;
    --secondary-neon: #ff00ff;
    --text-color: #e6e6e6;
    --font-mono: 'Consolas', 'Courier New', monospace;
    --current-bg: var(--bg-color-base); 
}

body {
    background-color: var(--current-bg);
    color: var(--text-color);
    font-family: var(--font-mono);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: background-color 1.5s ease;
    overflow-x: hidden;
}

header {
    text-align: center;
    padding: 15px 0;
    margin-bottom: 40px;
    position: relative;
    width: 100%;
}

h1 {
    font-size: 3em;
    color: var(--primary-neon);
    text-shadow: 0 0 15px var(--primary-neon), 0 0 5px var(--primary-neon);
    letter-spacing: 7px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    color: var(--secondary-neon);
    text-shadow: 0 0 8px var(--secondary-neon);
    letter-spacing: 2px;
}

.drop-zone {
    width: 90%;
    max-width: 800px;
    height: 200px;
    border: 3px dashed var(--primary-neon);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease, box-shadow 0.8s ease;
    position: relative;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.drop-zone:hover {
    box-shadow: 0 0 30px var(--primary-neon), inset 0 0 15px var(--primary-neon);
    transform: translateY(-3px);
}

.drop-zone.drag-over {
    border-style: solid;
    background-color: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 40px var(--secondary-neon), inset 0 0 20px var(--secondary-neon);
}

.drop-zone p {
    margin: 5px;
    color: var(--text-color);
    text-shadow: 0 0 5px var(--primary-neon);
}

.drop-zone input {
    display: none;
}

.loading-animation {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--secondary-neon);
    font-size: 1.2em;
    text-shadow: 0 0 10px var(--secondary-neon);
    margin-top: 20px;
}

.spinner {
    border: 4px solid rgba(255, 0, 255, 0.3);
    border-top: 4px solid var(--secondary-neon);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.image-preview-container {
    margin-top: 40px;
    width: 90%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

#image-preview {
    max-width: 100%;
    max-height: 400px;
    display: block;
    border: 1px solid var(--primary-neon);
    box-shadow: 0 0 10px var(--primary-neon);
}

#image-canvas {
    display: none;
}

.color-palette-container {
    margin-top: 30px;
    width: 90%;
    max-width: 800px;
    min-height: 80px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--secondary-neon);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.4);
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    position: relative;
    overflow: hidden;
}

.color-item {
    flex-grow: 1;
    min-width: 100px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
}

.color-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 15px var(--primary-neon), inset 0 0 10px var(--primary-neon);
    z-index: 10;
}

.color-hex {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.color-item:hover .color-hex {
    opacity: 1;
}

.message {
    margin-top: 20px;
    color: var(--secondary-neon);
    text-shadow: 0 0 5px var(--secondary-neon);
    font-size: 1.1em;
    text-align: center;
}

footer {
    width: 100%;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9em;
    color: var(--text-color);
    border-top: 2px solid var(--primary-neon);
    box-shadow: 0 -5px 20px rgba(0, 255, 255, 0.3);
    margin-top: 60px;
    text-shadow: 0 0 5px var(--primary-neon);
}

footer p {
    margin: 5px 0;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
        letter-spacing: 4px;
    }
    .subtitle {
        font-size: 1em;
    }
    .drop-zone {
        height: 150px;
        font-size: 1.2em;
    }
    .controls button {
        width: 100%;
        margin-bottom: 10px;
    }
}