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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: #262626;
    border-radius: 16px;
    border: 1px solid #404040;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: linear-gradient(180deg, #2a2a2a 0%, #1f1f1f 100%);
    padding: 30px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #404040;
    overflow-y: auto;
    max-height: 100%;
}

.title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: #a0a0a0;
    margin-bottom: 30px;
}

.upload-area {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.upload-area:hover {
    background: linear-gradient(135deg, #5855eb 0%, #7c3aed 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.upload-text {
    margin: 0;
}

.file-input {
    display: none;
}

.palette-section {
    flex: 1;
}

.palette-title {
    font-size: 18px;
    font-weight: 600;
    color: #e5e5e5;
    margin-bottom: 20px;
}

.color-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-item {
    display: flex;
    align-items: center;
    background: #333333;
    border-radius: 10px;
    border: 1px solid #4a4a4a;
    padding: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.color-item:hover {
    background-color: #3a3a3a;
    border-color: #5a5a5a;
    transform: translateY(-1px);
}

.color-item.selected {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: #6366f1;
    transform: translateX(4px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.color-item.selected .color-hex {
    color: white;
}

.color-item.selected .color-rgb {
    color: rgba(255, 255, 255, 0.8);
}

.copy-feedback {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-icon {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.color-item:hover .copy-feedback {
    opacity: 0.6;
    color: #a0a0a0;
}

.copy-feedback.copied {
    opacity: 1 !important;
    color: #10B981;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-right: 12px;
    border: 2px solid #4a4a4a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-info {
    flex: 1;
}

.color-hex {
    font-size: 14px;
    font-weight: 600;
    color: #e5e5e5;
    margin-bottom: 2px;
}

.color-rgb {
    font-size: 12px;
    color: #a0a0a0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 30px;
    background: #1f1f1f;
    border: 2px dashed #555555;
    border-radius: 16px;
    overflow: hidden;
    min-height: 400px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-container:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

.image-container.dragover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.12);
}

.image-container.has-image {
    background: #1a1a1a;
    border: 1px solid #404040;
    cursor: default;
}

.image-container.has-image:hover {
    border: 1px solid #404040;
    background: #1a1a1a;
}

.placeholder {
    text-align: center;
    color: #888888;
    padding: 40px;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.image-container:hover .placeholder-icon {
    opacity: 1;
    transform: scale(1.05);
}

.loader {
    width: 32px;
    height: 32px;
    border: 3px solid #404040;
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

.placeholder.loading .placeholder-icon {
    display: none;
}

.placeholder.loading .loader {
    display: block;
}

.loader {
    display: none;
}

.placeholder-text {
    font-size: 18px;
    margin-bottom: 8px;
    color: #a0a0a0;
    font-weight: 500;
}

.placeholder-hint {
    font-size: 14px;
    color: #888888;
}


.placeholder-text {
    font-size: 18px;
    margin-bottom: 10px;
}

.image-display {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    position: relative;
}

.color-indicator {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    cursor: grab;
    z-index: 10;
    transition: all 0.3s ease;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.color-indicator:hover {
    transform: scale(1.2);
}

.color-indicator:active {
    cursor: grabbing;
}

.color-indicator.selected {
    border-color: #6366f1;
    border-width: 4px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5), 0 0 0 2px rgba(99, 102, 241, 0.3);
    transform: scale(1.15);
}

.pixel-zoom {
    position: absolute;
    width: 120px;
    height: 120px;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.pixel-zoom canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.pixel-zoom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%);
    border: 1px solid white;
}

canvas {
    display: none;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }
    
    .sidebar {
        width: 100%;
        order: 2;
    }
    
    .main-content {
        order: 1;
        min-height: 400px;
    }
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid #404040;
    padding: 12px 20px;
    text-align: center;
    z-index: 100;
}

.footer p {
    font-size: 12px;
    color: #888888;
    margin: 0;
    font-weight: 400;
}

.footer a {
    color: #6366f1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #8b5cf6;
}