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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 40px;
}

section {
    margin-bottom: 40px;
}

h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5em;
}

/* Upload Section */
.upload-section {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #667eea;
}

#imageUpload {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.1em;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#fileName {
    display: block;
    margin-top: 15px;
    color: #666;
    font-style: italic;
}

/* Preview Section */
.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.image-container {
    text-align: center;
}

.image-container h3 {
    margin-bottom: 15px;
}

canvas {
    max-width: 100%;
    height: auto;
    border: 2px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Color Section */
.color-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.color-box {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
}

.color-box:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.color-box.selected {
    border: 3px solid #667eea;
    transform: scale(1.15);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

/* Control Section */
.selected-color-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.selected-color-display label {
    font-weight: bold;
    color: #333;
}

.selected-color-display .color-box {
    width: 80px;
    height: 80px;
    cursor: default;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.input-group input[type="number"] {
    width: 100px;
    padding: 10px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-right: 15px;
}

.input-group input[type="range"] {
    width: calc(100% - 120px);
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.input-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-style: italic;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 5px 20px rgba(86, 171, 47, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    box-shadow: 0 5px 20px rgba(108, 117, 125, 0.4);
}

/* Footer */
footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .preview-section {
        grid-template-columns: 1fr;
    }

    .color-palette {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }

    .button-group {
        flex-direction: column;
    }

    header h1 {
        font-size: 2em;
    }

    main {
        padding: 20px;
    }
}