:root {
--bg-color: #0d0e12;
--surface-color: #16181d;
--surface-hover: #1f2229;
--primary-color: #6366f1;
--primary-hover: #4f46e5;
--text-primary: #ffffff;
--text-secondary: #9ca3af;
--border-color: #2d313a;
--accent-glow: rgba(99, 102, 241, 0.5);

--radius-lg: 16px;
--radius-md: 12px;
--radius-sm: 8px;

--font-main: 'Outfit', sans-serif;

--transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
--transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: var(--font-main);
background-color: var(--bg-color);
color: var(--text-primary);
min-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
}

.app-container {
max-width: 1200px;
margin: 0 auto;
width: 100%;
padding: 2rem;
flex: 1;
display: flex;
flex-direction: column;
}

/* Header */
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 0;
margin-bottom: 3rem;
}

.logo {
display: flex;
align-items: center;
gap: 0.75rem;
font-weight: 600;
font-size: 1.25rem;
color: var(--text-primary);
}

.logo svg {
color: var(--primary-color);
}

.github-link {
color: var(--text-secondary);
text-decoration: none;
font-weight: 500;
transition: var(--transition-fast);
}

.github-link:hover {
color: var(--text-primary);
}

/* Hero */
.hero {
text-align: center;
margin-bottom: 4rem;
animation: fadeIn 0.8s ease-out;
}

.hero h1 {
font-size: 3.5rem;
font-weight: 700;
line-height: 1.1;
margin-bottom: 1rem;
letter-spacing: -0.02em;
}

.hero .highlight {
background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: inline-block;
}

.hero p {
color: var(--text-secondary);
font-size: 1.25rem;
max-width: 600px;
margin: 0 auto;
}

/* Workspace */
.workspace {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
max-width: 800px;
margin: 0 auto;
position: relative;
}

/* Upload Zone */
.upload-zone {
width: 100%;
border: 2px dashed var(--border-color);
background: var(--surface-color);
border-radius: var(--radius-lg);
padding: 4rem 2rem;
text-align: center;
cursor: pointer;
transition: var(--transition-smooth);
position: relative;
overflow: hidden;
}

.upload-zone:hover {
border-color: var(--primary-color);
background: var(--surface-hover);
transform: translateY(-2px);
}

.upload-zone.dragging {
border-color: var(--primary-color);
background: rgba(99, 102, 241, 0.1);
}

.upload-content {
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
z-index: 10;
position: relative;
}

.upload-icon {
color: var(--text-secondary);
margin-bottom: 0.5rem;
transition: var(--transition-fast);
}

.upload-zone:hover .upload-icon {
color: var(--primary-color);
transform: scale(1.1);
}

.upload-content h3 {
font-size: 1.5rem;
font-weight: 600;
}

.upload-content p {
color: var(--text-secondary);
}

/* Editor Panel */
.editor-panel {
width: 100%;
background: var(--surface-color);
border: 1px solid var(--border-color);
border-radius: var(--radius-lg);
padding: 2rem;
animation: slideUp 0.4s ease-out;
}

.hidden {
display: none !important;
}

.preview-container {
display: grid;
grid-template-columns: 1fr auto 1fr;
align-items: center;
gap: 1.5rem;
margin-bottom: 2rem;
}

.preview-box {
background: repeating-conic-gradient(#202020 0% 25%, #2a2a2a 0% 50%) 50% / 20px 20px;
border-radius: var(--radius-md);
aspect-ratio: 1;
position: relative;
overflow: hidden;
border: 1px solid var(--border-color);
display: flex;
justify-content: center;
align-items: center;
}

.preview-box img,
.preview-box canvas {
max-width: 100%;
max-height: 100%;
object-fit: contain;
}

.preview-box .label {
position: absolute;
top: 0.5rem;
left: 0.5rem;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
padding: 0.25rem 0.5rem;
border-radius: var(--radius-sm);
font-size: 0.75rem;
font-weight: 500;
color: white;
}

.arrow {
display: flex;
justify-content: center;
color: var(--text-secondary);
}

/* Controls */
.controls {
display: flex;
flex-direction: column;
gap: 1.5rem;
padding-top: 2rem;
border-top: 1px solid var(--border-color);
}

.control-group {
display: flex;
align-items: center;
justify-content: space-between;
}

/* Checkbox Styling */
.checkbox-group {
justify-content: flex-start;
gap: 0.75rem;
}

.checkbox-label {
display: flex;
align-items: center;
gap: 0.75rem;
cursor: pointer;
font-size: 1rem;
color: var(--text-primary);
user-select: none;
}

.checkbox-label input {
display: none;
}

.checkbox-custom {
width: 20px;
height: 20px;
border: 2px solid var(--border-color);
border-radius: 4px;
position: relative;
transition: var(--transition-fast);
}

.checkbox-label input:checked+.checkbox-custom {
background-color: var(--primary-color);
border-color: var(--primary-color);
}

.checkbox-label input:checked+.checkbox-custom::after {
content: '';
position: absolute;
left: 6px;
top: 2px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}

.tooltip-icon {
display: inline-flex;
justify-content: center;
align-items: center;
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--surface-hover);
color: var(--text-secondary);
font-size: 0.75rem;
font-weight: 700;
cursor: help;
border: 1px solid var(--border-color);
}

.color-input-wrapper {
display: flex;
align-items: center;
gap: 1rem;
background: var(--bg-color);
padding: 0.5rem;
border-radius: var(--radius-sm);
border: 1px solid var(--border-color);
}

input[type="color"] {
-webkit-appearance: none;
border: none;
width: 32px;
height: 32px;
border-radius: 6px;
cursor: pointer;
background: none;
padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
padding: 0;
}

input[type="color"]::-webkit-color-swatch {
border: none;
border-radius: 6px;
border: 1px solid var(--border-color);
}

#hexInput {
background: transparent;
border: none;
color: var(--text-primary);
font-family: monospace;
font-size: 1rem;
width: 80px;
text-transform: uppercase;
}

#hexInput:focus {
outline: none;
}

.actions {
display: grid;
grid-template-columns: 1fr 2fr;
gap: 1rem;
}

button {
padding: 0.875rem 1.5rem;
border-radius: var(--radius-sm);
font-weight: 600;
font-size: 1rem;
cursor: pointer;
transition: var(--transition-fast);
font-family: var(--font-main);
}

.primary-btn {
background: var(--primary-color);
color: white;
border: none;
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.primary-btn:hover {
background: var(--primary-hover);
transform: translateY(-1px);
box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
background: transparent;
border: 1px solid var(--border-color);
color: var(--text-primary);
}

.secondary-btn:hover {
background: var(--surface-hover);
border-color: var(--text-secondary);
}

/* Footer */
footer {
text-align: center;
padding: 2rem 0;
color: var(--text-secondary);
font-size: 0.875rem;
margin-top: auto;
}

/* Loading Overlay */
.loading-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(13, 14, 18, 0.9);
backdrop-filter: blur(8px);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 1000;
}

.spinner {
width: 48px;
height: 48px;
border: 4px solid var(--surface-hover);
border-top: 4px solid var(--primary-color);
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 1.5rem;
}

.loading-overlay p {
font-size: 1.25rem;
font-weight: 600;
color: var(--text-primary);
}

.loading-overlay .sub-text {
font-size: 1rem;
font-weight: 400;
color: var(--text-secondary);
margin-top: 0.5rem;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}

to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20px);
}

to {
opacity: 1;
transform: translateY(0);
}
}

@media (max-width: 600px) {
.preview-container {
grid-template-columns: 1fr;
}

.arrow {
transform: rotate(90deg);
}

.hero h1 {
font-size: 2.5rem;
}
}