* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: white;
    padding: 20px;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    grid-column: 1 / -1;
    color: #e94560;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.controls {
    background: #16213e;
    padding: 20px;
    border-radius: 15px;
    height: fit-content;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.controls h3 {
    margin: 20px 0 12px 0;
    color: #e94560;
    border-bottom: 2px solid #0f3460;
    padding-bottom: 8px;
    font-size: 1.1em;
}

.controls h3:first-child {
    margin-top: 0;
}

.tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-btn {
    padding: 12px;
    background: #0f3460;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tool-btn:hover {
    background: #1a4b8c;
    transform: translateY(-2px);
}

.tool-btn.active {
    background: #e94560;
    border-color: #ff6b81;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.4);
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.color-swatch {
    width: 35px;
    height: 35px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: white;
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(255,255,255,0.6);
}

#custom-color {
    width: 100%;
    height: 45px;
    margin: 12px 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.controls button, .controls select, .controls input[type="text"] {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.controls button {
    font-weight: 600;
    cursor: pointer;
}

.controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#save-btn { 
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white; 
}

#export-btn { 
    background: linear-gradient(135deg, #e67e22, #f39c12);
    color: white; 
}

#new-grid { 
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white; 
}

#clear-btn { 
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white; 
}

#add-color { 
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white; 
}

.editor-area {
    position: relative;
    background: #0f3460;
    border-radius: 15px;
    padding: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#pixel-canvas {
    background: white;
    border: 3px solid #e94560;
    border-radius: 8px;
    cursor: crosshair;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.grid-overlay {
    position: absolute;
    pointer-events: none;
    border: 1px solid rgba(233, 69, 96, 0.3);
}

.saved-artworks {
    grid-column: 1 / -1;
    background: #16213e;
    padding: 25px;
    border-radius: 15px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.saved-artworks h3 {
    color: #e94560;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.artworks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

.artwork-thumb {
    background: #0f3460;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.artwork-thumb:hover {
    background: #1a4b8c;
    border-color: #e94560;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(233, 69, 96, 0.3);
}

.artwork-thumb canvas {
    width: 100%;
    height: 120px;
    background: white;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 2px solid #e94560;
}

.artwork-name {
    font-weight: bold;
    color: white;
    margin-bottom: 5px;
}

.artwork-date {
    font-size: 12px;
    color: #ccc;
}

.empty-gallery {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #ccc;
    font-style: italic;
}