* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Georgia', serif;
}

body {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 10px;
}

header {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

h1 {
    font-size: 2.2rem;
    color: #ff6b6b;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

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

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    padding: 12px 5px;
    min-height: 70px;
}

.tool-btn.active {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tool-btn i {
    font-size: 24px;
    margin-bottom: 8px;
}

.tool-btn span {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.canvas-container {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#drawingCanvas {
    background: white;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    cursor: crosshair;
    width: 100%;
    flex: 1;
}

.slider-container, .color-palette, .gallery {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 100;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    max-width: 400px;
}

.slider-container.active, .color-palette.active, .gallery.active {
    display: block;
}

.colors {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.color {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.gallery {
    max-width: 800px;
}

.gallery h2 {
    margin-bottom: 20px;
    color: #ff6b6b;
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.gallery-item {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s;
    box-shadow: 0 3px 8px rgba(0,0,0,0.1);
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

footer {
    text-align: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s;
}

footer.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 768px) {
    .toolbar {
        grid-template-columns: repeat(8, 1fr);
        gap: 12px;
    }
    
    .tool-btn {
        min-height: 80px;
        padding: 15px 8px;
    }
    
    .tool-btn i {
        font-size: 28px;
    }
    
    .tool-btn span {
        font-size: 13px;
    }
    
    h1 {
        font-size: 2.6rem;
    }
}

@media (min-width: 1024px) {
    .tool-btn span {
        font-size: 14px;
    }
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: #ff6b6b;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
}

.slider {
    width: 100%;
    margin: 15px 0;
    height: 8px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 5px;
    outline: none;
}

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

#fileInput {
    display: none;
}

.status {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 50;
}

.status.show {
    opacity: 1;
}