* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, anta, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.contenedor-aplicacion {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 100%;
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    height: 95vh;
}

.barra-herramientas {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    order: 2;
    min-height: 120px;
}

.grupo-herramientas {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.grupo-colores {
    min-width: 300px;
}

.colores-rapidos {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-rapido {
    width: 45px;
    height: 45px;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-rapido:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-rapido.activo {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5);
    transform: scale(1.1);
}

.botones-grosor {
    display: flex;
    gap: 8px;
}

.btn-grosor {
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    color: #333;
}

.btn-grosor:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-grosor.activo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.btn-herramienta {
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    color: #333;
}

.btn-herramienta:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-herramienta.activo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.btn-fondo-rapido {
    width: 45px;
    height: 45px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-fondo-rapido:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-zoom {
    padding: 10px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.2s;
    color: #333;
    min-width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.valor-zoom {
    font-weight: 600;
    color: #667eea;
    min-width: 60px;
    text-align: center;
    font-size: 14px;
    padding: 0 8px;
}

.grupo-herramientas label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.grupo-herramientas input[type="color"] {
    width: 55px;
    height: 45px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.grupo-herramientas input[type="color"]:hover {
    transform: scale(1.1);
}

.grupo-herramientas input[type="range"] {
    width: 120px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    cursor: pointer;
}

.grupo-herramientas input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: background 0.2s;
}

.grupo-herramientas input[type="range"]::-webkit-slider-thumb:hover {
    background: #764ba2;
}

.grupo-herramientas input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.grupo-herramientas input[type="range"]::-moz-range-thumb:hover {
    background: #764ba2;
}

#valor-grosor {
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
    text-align: center;
    font-size: 14px;
}

.btn-accion {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-height: 50px;
    touch-action: manipulation;
}

.btn-grande {
    padding: 16px 28px;
    font-size: 16px;
    min-height: 55px;
}

.grupo-acciones {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-accion:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-accion:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-accion:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-limpiar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-guardar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.contenedor-dibujo {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    order: 1;
}

#lienzo {
    display: block;
    cursor: crosshair;
    touch-action: none;
    width: 100%;
    height: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .barra-herramientas {
        padding: 15px;
        gap: 10px;
        min-height: auto;
    }
    
    .grupo-herramientas {
        padding: 10px 14px;
        gap: 10px;
    }
    
    .grupo-colores {
        min-width: auto;
        width: 100%;
    }
    
    .colores-rapidos {
        flex-wrap: wrap;
    }
    
    .color-rapido {
        width: 40px;
        height: 40px;
    }
    
    .btn-accion {
        padding: 12px 18px;
        font-size: 14px;
        min-height: 48px;
    }
    
    .btn-grande {
        padding: 14px 20px;
        font-size: 14px;
        min-height: 50px;
    }
    
    .botones-grosor {
        flex-wrap: wrap;
    }
    
    .btn-grosor {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .grupo-herramientas input[type="range"] {
        width: 100px;
    }
    
    .grupo-acciones {
        width: 100%;
        justify-content: center;
    }
}

