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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5em;
    background: linear-gradient(45deg, #f39c12, #e74c3c, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: #95a5a6;
    font-size: 1.1em;
}

.toolbar {
    background: #2c2c54;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}

.tool-group, .color-group, .size-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-btn {
    background: #40407a;
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
}

.tool-btn:hover {
    background: #474787;
    transform: translateY(-2px);
}

.tool-btn.active {
    background: #e74c3c;
}

#colorPicker {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.color-palette {
    display: flex;
    gap: 5px;
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: white;
}

#canvasSize {
    background: #40407a;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 16px;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 30px;
}

.canvas-container {
    background: #2c2c54;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 500px;
}

#pixelCanvas {
    background: white;
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.grid-overlay {
    position: absolute;
    pointer-events: none;
    opacity: 0.2;
}

.animation-controls {
    background: #2c2c54;
    padding: 20px;
    border-radius: 10px;
}

.timeline {
    margin-bottom: 20px;
}

.frames-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    margin-bottom: 10px;
}

.frame-item {
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.frame-item canvas {
    width: 60px;
    height: 60px;
    border: 2px solid #40407a;
    border-radius: 5px;
    image-rendering: pixelated;
    background: white;
}

.frame-item.active canvas {
    border-color: #e74c3c;
    box-shadow: 0 0 10px #e74c3c;
}

.frame-item:hover {
    transform: translateY(-2px);
}

.frame-number {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #e74c3c;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.delete-frame {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #c0392b;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.frame-item:hover .delete-frame {
    opacity: 1;
}

.add-frame-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    width: 100%;
}

.add-frame-btn:hover {
    background: #2ecc71;
    transform: translateY(-2px);
}

.playback-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.playback-controls button {
    background: #40407a;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.playback-controls button:hover {
    background: #474787;
}

#fpsInput {
    width: 50px;
    padding: 5px;
    border-radius: 3px;
    border: 1px solid #40407a;
    background: #1a1a2e;
    color: white;
}

.preview-container {
    text-align: center;
}

.preview-container h3 {
    margin-bottom: 10px;
    color: #95a5a6;
}

#previewCanvas {
    background: white;
    border: 2px solid #40407a;
    border-radius: 5px;
    image-rendering: pixelated;
    width: 150px;
    height: 150px;
}

.export-section {
    background: #2c2c54;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.export-section h3 {
    margin-bottom: 15px;
    color: #95a5a6;
}

.export-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-options button {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.export-options button:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.shortcuts {
    background: #2c2c54;
    padding: 20px;
    border-radius: 10px;
}

.shortcuts h3 {
    margin-bottom: 15px;
    color: #95a5a6;
}

.shortcuts ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.shortcuts li {
    display: flex;
    align-items: center;
    gap: 10px;
}

kbd {
    background: #40407a;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 14px;
}

@media (max-width: 768px) {
    .workspace {
        grid-template-columns: 1fr;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .export-options {
        flex-direction: column;
    }
    
    .export-options button {
        width: 100%;
    }
}