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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 250px 1fr 200px;
    gap: 20px;
    padding: 20px;
    min-height: 600px;
}

.templates-panel, .colors-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.templates-panel h3, .colors-panel h3 {
    color: #333;
    font-size: 1.2rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    overflow-y: auto;
    max-height: 500px;
}

.template-item {
    aspect-ratio: 1;
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: all 0.3s ease;
}

.template-item:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.template-item.active {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

.canvas-area {
    background: #f8f9fa;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 550px;
}

.coloring-canvas {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coloring-canvas svg {
    max-width: 100%;
    max-height: 500px;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.2));
}

.coloring-canvas path, .coloring-canvas circle, .coloring-canvas ellipse,
.coloring-canvas rect, .coloring-canvas polygon {
    cursor: pointer;
    transition: fill 0.2s ease;
    stroke: #333;
    stroke-width: 2;
}

.coloring-canvas path:hover, .coloring-canvas circle:hover,
.coloring-canvas ellipse:hover, .coloring-canvas rect:hover,
.coloring-canvas polygon:hover {
    filter: brightness(0.9);
}

.color-picker {
    display: flex;
    justify-content: center;
}

#customColor {
    width: 100%;
    height: 60px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-btn {
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.color-btn.active {
    border-color: #333;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.tool-btn {
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.tool-btn:active {
    transform: translateY(0);
}

.tool-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

@media (max-width: 1000px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .templates-panel {
        order: 1;
    }

    .canvas-area {
        order: 2;
        min-height: 400px;
    }

    .colors-panel {
        order: 3;
    }

    .tools {
        flex-direction: row;
    }

    .tool-btn {
        flex: 1;
    }
}

.empty-state {
    text-align: center;
    color: #999;
    font-size: 1.2rem;
}

.empty-state svg {
    width: 200px;
    height: 200px;
    opacity: 0.3;
}
