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

body {
    font-family: 'Courier New', monospace;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    padding: 20px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    border: 4px solid #0f3460;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

header h1 {
    font-size: 2rem;
    color: #fff;
    text-shadow: 3px 3px 0px #0f3460;
    letter-spacing: 3px;
    margin-bottom: 10px;
}

header h2 {
    font-size: 1.2rem;
    color: #ffeb3b;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-shadow: 2px 2px 0px #0f3460;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 280px 320px;
    gap: 20px;
}

/* Canvas Section */
.canvas-section {
    background: #16213e;
    padding: 20px;
    border-radius: 10px;
    border: 3px solid #0f3460;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.canvas-header h3 {
    color: #00d9ff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.canvas-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.canvas-controls label {
    color: #aaa;
    font-size: 0.9rem;
}

.canvas-controls select {
    background: #0f3460;
    color: #fff;
    border: 2px solid #00d9ff;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.canvas-container {
    background: #0a0a0a;
    border: 3px solid #00d9ff;
    border-radius: 5px;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    max-height: 600px;
}

#pixel-canvas {
    cursor: crosshair;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.zoom-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.zoom-controls button {
    width: 40px;
    height: 40px;
    background: #667eea;
    color: #fff;
    border: 2px solid #00d9ff;
    border-radius: 5px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.zoom-controls button:hover {
    background: #764ba2;
    transform: scale(1.1);
}

#zoom-value {
    color: #00d9ff;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Tools Section */
.tools-section {
    background: #16213e;
    padding: 20px;
    border-radius: 10px;
    border: 3px solid #0f3460;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tool-group h3 {
    color: #ffeb3b;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.tool-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.tool-btn {
    background: #0f3460;
    border: 3px solid #667eea;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tool-btn:hover {
    border-color: #00d9ff;
    transform: translateY(-2px);
}

.tool-btn.active {
    background: #667eea;
    border-color: #00d9ff;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.5);
}

.tool-icon {
    font-size: 2rem;
    display: block;
}

.color-palette {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid #0f3460;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #00d9ff;
}

.color-swatch.active {
    border-color: #ffeb3b;
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.7);
    transform: scale(1.15);
}

#custom-color {
    width: 100%;
    height: 40px;
    border: 3px solid #667eea;
    border-radius: 5px;
    cursor: pointer;
    background: #0f3460;
}

.action-btn {
    width: 100%;
    padding: 12px;
    background: #0f3460;
    color: #fff;
    border: 2px solid #667eea;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.action-btn:hover {
    background: #667eea;
    border-color: #00d9ff;
}

/* Animation Section */
.animation-section {
    background: #16213e;
    padding: 20px;
    border-radius: 10px;
    border: 3px solid #0f3460;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-panel h3,
.frames-panel h3,
.export-panel h3 {
    color: #ff6b6b;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.preview-container {
    background: #0a0a0a;
    border: 3px solid #ff6b6b;
    border-radius: 5px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

#preview-canvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    border: 2px solid #333;
}

.animation-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

#play-pause {
    width: 100%;
    padding: 12px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.2s;
}

#play-pause:hover {
    background: #ee5a52;
    transform: translateY(-2px);
}

.animation-controls label {
    color: #aaa;
    font-size: 0.9rem;
}

#fps-slider {
    width: 100%;
    height: 8px;
    background: #0f3460;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

#fps-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #ff6b6b;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
}

#fps-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #ff6b6b;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
}

.frames-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#add-frame {
    padding: 8px 15px;
    background: #4ecdc4;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: all 0.2s;
}

#add-frame:hover {
    background: #45b7aa;
    transform: scale(1.05);
}

.frames-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #0a0a0a;
    border-radius: 5px;
    border: 2px solid #4ecdc4;
}

.frames-container::-webkit-scrollbar {
    width: 8px;
}

.frames-container::-webkit-scrollbar-track {
    background: #0f3460;
    border-radius: 5px;
}

.frames-container::-webkit-scrollbar-thumb {
    background: #4ecdc4;
    border-radius: 5px;
}

.frame-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #16213e;
    border: 2px solid #0f3460;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.frame-item:hover {
    border-color: #4ecdc4;
}

.frame-item.active {
    border-color: #ffeb3b;
    background: #1e2a47;
    box-shadow: 0 0 15px rgba(255, 235, 59, 0.3);
}

.frame-thumbnail {
    width: 60px;
    height: 60px;
    background: #0a0a0a;
    border: 2px solid #4ecdc4;
    border-radius: 3px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.frame-info {
    flex: 1;
    color: #aaa;
    font-size: 0.8rem;
}

.frame-number {
    color: #ffeb3b;
    font-weight: bold;
    font-size: 0.9rem;
}

.frame-actions {
    display: flex;
    gap: 5px;
}

.frame-actions button {
    width: 30px;
    height: 30px;
    background: #0f3460;
    color: #fff;
    border: 1px solid #667eea;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.frame-actions button:hover {
    background: #667eea;
}

.export-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: #fff;
    border: 2px solid #764ba2;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s;
}

.export-btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.4);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .animation-section,
    .tools-section {
        max-width: 600px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.2rem;
    }

    header h2 {
        font-size: 0.9rem;
    }

    .tool-buttons {
        grid-template-columns: repeat(4, 1fr);
    }

    .color-palette {
        grid-template-columns: repeat(8, 1fr);
    }
}
