:root {
    --bg-main: #1A1817;
    --surface: #252220;
    --text-primary: #EDE9E6;
    --text-secondary: #ADA39A;
    --accent-primary: #D4A373;
    --accent-secondary: #8FA38C;
    --accent-glow: rgba(212, 163, 115, 0.12);
    --border: #36322F;
    --radius-lg: 24px;
    --radius-md: 12px;
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
    --shadow-float: 0 20px 60px -12px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    background-image:
        radial-gradient(at 0% 0%, rgba(212, 163, 115, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(143, 163, 140, 0.03) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 4rem 2rem;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 5rem;
    animation: fadeInScale 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.controls {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 3rem;
    margin-bottom: 3rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both;
}

.control-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

input[type="number"],
input[type="file"],
select {
    padding: 1rem 1.25rem;
    border: 1.5px solid #3D3834;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #2D2A27;
    color: var(--text-primary);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input[type="number"]:focus,
input[type="file"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.button-group {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

button {
    padding: 1.125rem 2.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--surface);
    box-shadow: 0 10px 20px -5px rgba(26, 21, 18, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    background: var(--accent-primary);
    box-shadow: 0 15px 30px -8px rgba(166, 110, 78, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

.options-group {
    display: flex;
    gap: 2.5rem;
    margin: 1.5rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.checkbox-wrapper:hover {
    opacity: 0.8;
}

input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--text-primary);
    border-radius: 6px;
}

.canvas-wrapper {
    background: #2A2724;
    border-radius: var(--radius-lg);
    padding: 4rem;
    box-shadow: var(--shadow-float);
    border: 1px solid var(--border);
    min-height: 500px;
    animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.4s both;
    overflow: auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gridCanvas {
    background: white;
    box-shadow: 0 0 0 1px var(--border);
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-preview {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #2A2724;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    animation: fadeIn 0.4s ease;
}

.preview-image {
    width: auto;
    max-width: 150px;
    max-height: 150px;
    height: auto;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    box-shadow: var(--shadow-soft);
    object-fit: contain;
}

.info-panel {
    display: inline-flex;
    gap: 3rem;
    padding: 1.25rem 3rem;
    background: var(--accent-primary);
    color: #1A1817;
    border-radius: 100px;
    margin-top: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    box-shadow: 0 15px 35px -10px rgba(212, 163, 115, 0.2);
    animation: slideUpFade 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.6s both;
}

.placeholder {
    text-align: center;
    color: var(--text-secondary);
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    opacity: 0.5;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(-10px);
    }

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

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #2D2A27;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.zoom-control input[type="range"] {
    width: 180px;
    accent-color: var(--accent-primary);
    cursor: grab;
    margin: 0 0.5rem;
}

.btn-zoom {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3D3834;
    border: 1.5px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-zoom:hover {
    background: var(--accent-primary);
    color: #1A1817;
    transform: translateY(0);
}

.zoom-control input[type="range"]:active {
    cursor: grabbing;
}

/* Custom Scrollbar */
.canvas-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.canvas-wrapper::-webkit-scrollbar-track {
    background: var(--bg-main);
}

.canvas-wrapper::-webkit-scrollbar-thumb {
    background: #DEDCD7;
    border-radius: 10px;
}

.canvas-wrapper::-webkit-scrollbar-thumb:hover {
    background: #CDCAC4;
}

@media (max-width: 768px) {
    body {
        padding: 2rem 1rem;
    }

    h1 {
        font-size: 2.75rem;
    }

    .controls {
        padding: 1.5rem;
    }

    .canvas-wrapper {
        padding: 1rem;
    }

    .info-panel {
        width: 100%;
        border-radius: var(--radius-md);
        gap: 1rem;
        flex-direction: column;
        text-align: center;
    }
}