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

:root {
    --primary: #FF9F43;
    --primary-dark: #e88a2e;
    --primary-light: #ffb366;
    --secondary: #5DADE2;
    --accent-blue: #5DADE2;
    --background: #f5f1e8;
    --surface: #ffffff;
    --surface-light: #fafafa;
    --text-primary: #2c2c2c;
    --text-secondary: #5a5a5a;
    --text-muted: #8a8a8a;
    --border: #2c2c2c;
    --success: #00c853;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --comic-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    background-color: var(--primary);
    padding: 1.5rem;
    border: 3px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--comic-shadow);
}

.title {
    font-family: 'Patrick Hand', cursive;
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.icon-logo {
    width: 3rem;
    height: 3rem;
    stroke: var(--primary);
    filter: drop-shadow(2px 2px 0px rgba(0, 0, 0, 0.5));
}

.subtitle {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* Upload Zone */
.upload-zone {
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: 0.5rem;
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out;
    box-shadow: var(--comic-shadow);
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.upload-zone:hover {
    border-color: var(--primary);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px rgba(0, 0, 0, 1);
}

.upload-zone:hover::before {
    opacity: 0.1;
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: rgba(255, 159, 67, 0.15);
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px rgba(0, 0, 0, 1);
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 4rem;
    height: 4rem;
    stroke: var(--primary);
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.upload-title {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.upload-formats {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Workspace */
.workspace {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    animation: fadeIn 0.6s ease-out;
}

.canvas-container {
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--comic-shadow);
}

#canvas {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    cursor: none;
    border-radius: 0.75rem;
    transition: transform 0.2s ease;
}

/* Magnifier */
.magnifier {
    position: fixed;
    width: 150px;
    height: 150px;
    border: 3px solid var(--border);
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
    background: var(--surface);
    overflow: hidden;
    transform: translate(0, 0);
}

#magnifierCanvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 50%;
    pointer-events: none;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: var(--primary);
}

.crosshair::before {
    top: 50%;
    left: -50px;
    right: -50px;
    height: 1px;
    transform: translateY(-50%);
}

.crosshair::after {
    left: 50%;
    top: -50px;
    bottom: -50px;
    width: 1px;
    transform: translateX(-50%);
}

/* Color Info Panel */
.color-info-panel {
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: var(--comic-shadow);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.selected-color-display {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
}

.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    background: #000;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
    border: 3px solid var(--border);
    transition: transform 0.2s ease;
}

.color-preview:hover {
    transform: scale(1.05);
}

.color-details {
    flex: 1;
}

.color-label {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.color-coords {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

/* Color Formats */
.color-formats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.format-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.format-label {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary);
}

.format-value-container {
    display: flex;
    gap: 0.5rem;
}

.format-value {
    flex: 1;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.format-value:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
}

.copy-btn {
    background: var(--secondary);
    border: 2px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 1);
}

.copy-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.copy-btn:hover {
    background: var(--primary);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
}

.copy-btn:active {
    transform: translateY(0);
}

/* New Image Button */
.btn-new-image {
    font-family: 'Patrick Hand', cursive;
    background: var(--secondary);
    border: 3px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    color: white;
    font-weight: 400;
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: auto;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 1);
}

.btn-new-image svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-new-image:hover {
    background: var(--primary);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 1);
}

.btn-new-image svg {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-new-image:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.8);
}

.btn-new-image:active {
    transform: translateY(0);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border: 3px solid var(--border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.15);
    transform: translateY(150%);
    transition: transform 0.3s ease;
    z-index: 1000;
    font-weight: 600;
}

.toast.show {
    transform: translateY(0);
}

.toast-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.toast-message {
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .color-info-panel {
        order: 2;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .title {
        font-size: 2rem;
    }

    .upload-zone {
        padding: 3rem 1.5rem;
    }

    .selected-color-display {
        flex-direction: column;
        text-align: center;
    }
}